NANDRAD Data Model Library  Version 2.0
NANDRAD
NANDRAD_OutputGrid.h
1 /* The NANDRAD data model library.
2 
3  Copyright (c) 2012-today, Institut für Bauklimatik, TU Dresden, Germany
4 
5  Primary authors:
6  Andreas Nicolai <andreas.nicolai -[at]- tu-dresden.de>
7  Anne Paepcke <anne.paepcke -[at]- tu-dresden.de>
8 
9  This library is part of SIM-VICUS (https://github.com/ghorwin/SIM-VICUS)
10 
11  This library is free software: you can redistribute it and/or modify
12  it under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  This library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  GNU General Public License for more details.
20 */
21 
22 #ifndef NANDRAD_OutputGridH
23 #define NANDRAD_OutputGridH
24 
25 #include <string>
26 
27 #include "NANDRAD_Interval.h"
28 #include "NANDRAD_CodeGenMacros.h"
29 
30 namespace NANDRAD {
31 
32 /*! An OutputGrid defines time intervals with a given output step size per interval. */
33 class OutputGrid {
34 public:
35 
36  // *** PUBLIC MEMBER FUNCTIONS ***
37 
38  NANDRAD_READWRITE
39  NANDRAD_COMP(OutputGrid)
40  NANDRAD_COMPARE_WITH_NAME
41 
42  /*! Checks input parameters and throws an IBK::Exception if some input values are wrong.
43  \note This function should be called after readXML() during solver initialization, and before
44  setupIntervals() is called.
45  */
46  void checkIntervalDefinition() const;
47 
48  /*! Returns a parameter of the intervals handled in this OutputGrid, if needed, parameters
49  are created/computed on the fly.
50  */
51  IBK::Parameter intervalParameter(unsigned int intervalIndex, Interval::para_t p) const;
52 
53  /*! Returns a parameter of the last interval handled in this OutputGrid, if needed, parameters
54  are created/computed on the fly. Calls \sa intervalParameter().
55  */
56  IBK::Parameter lastIntervalParameter(Interval::para_t p) const;
57 
58  /*! Computes START parameters in all intervals.
59  Call this function after interval parameters have been checked with checkIntervalDefinition().
60  */
61  void setupIntervals();
62 
63  /*! Returns true, if the time point t matches an
64  output grid point defined by this grid.
65  \param t Time point as absolute time offset to Midnight, January 1st of the start year.
66  \warning This function expects that checkParameters() was previously called.
67  */
68  bool isActive(double t) const;
69 
70  /*! Computes and returns next output time point past tOutCurrent that is scheduled
71  with this output grid.
72  */
73  double computeNextOutputTime(double tOutCurrent) const;
74 
75  // *** PUBLIC MEMBER VARIABLES ***
76 
77  /*! Descriptive name for this output grid. */
78  std::string m_name; // XML:A
79 
80  /*! The start/duration/end of each interval in [s].
81  The time points are defined the same as the simulation time itself.
82  */
83  std::vector<Interval> m_intervals; // XML:E
84 };
85 
86 
87 } // namespace NANDRAD
88 
89 #endif // NANDRAD_OutputGridH
bool isActive(double t) const
Returns true, if the time point t matches an output grid point defined by this grid.
NANDRAD_READWRITE NANDRAD_COMPARE_WITH_NAME void checkIntervalDefinition() const
Checks input parameters and throws an IBK::Exception if some input values are wrong.
std::string m_name
Descriptive name for this output grid.
IBK::Parameter lastIntervalParameter(Interval::para_t p) const
Returns a parameter of the last interval handled in this OutputGrid, if needed, parameters are create...
An OutputGrid defines time intervals with a given output step size per interval.
IBK::Parameter intervalParameter(unsigned int intervalIndex, Interval::para_t p) const
Returns a parameter of the intervals handled in this OutputGrid, if needed, parameters are created/co...
std::vector< Interval > m_intervals
The start/duration/end of each interval in [s].
void setupIntervals()
Computes START parameters in all intervals.
The namespace NANDRAD contains the data model classes that make up the NANDRAD solver input data...
double computeNextOutputTime(double tOutCurrent) const
Computes and returns next output time point past tOutCurrent that is scheduled with this output grid...