SimulationStatus.hpp
Go to the documentation of this file.
1 /*
2 
3  This file is part of OpenFLUID software
4  Copyright(c) 2007, INRA - Montpellier SupAgro
5 
6 
7  == GNU General Public License Usage ==
8 
9  OpenFLUID is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  OpenFLUID is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with OpenFLUID. If not, see <http://www.gnu.org/licenses/>.
21 
22 
23  == Other Usage ==
24 
25  Other Usage means a use of OpenFLUID that is inconsistent with the GPL
26  license, and requires a written agreement between You and INRA.
27  Licensees for Other Usage of OpenFLUID may use this file in accordance
28  with the terms contained in the written agreement between You and INRA.
29 
30 */
31 
32 
33 /**
34  @file SimulationStatus.hpp
35 
36  @author Jean-Christophe FABRE <jean-christophe.fabre@inra.fr>
37  */
38 
39 
40 #ifndef __OPENFLUID_BASE_SIMULATIONSTATUS_HPP__
41 #define __OPENFLUID_BASE_SIMULATIONSTATUS_HPP__
42 
43 
44 #include <openfluid/dllexport.hpp>
46 
47 
48 namespace openfluid { namespace base {
49 
50 
51 // =====================================================================
52 // =====================================================================
53 
54 
56 {
57  public:
58 
59  enum SimulationStage { PRE, INITPARAMS, PREPAREDATA, CHECKCONSISTENCY,
60  INITIALIZERUN, RUNSTEP, FINALIZERUN, POST, UNKNOWN };
61 
62  enum SchedulingConstraint { SCHED_NONE, SCHED_DTCHECKED, SCHED_DTFORCED };
63 
64  private:
65 
66  openfluid::core::DateTime m_BeginDate;
67 
68  openfluid::core::DateTime m_EndDate;
69 
70  openfluid::core::Duration_t m_Duration;
71 
72  openfluid::core::DateTime m_CurrentDate;
73 
74  openfluid::core::TimeIndex_t m_CurrentTimeIndex;
75 
76  openfluid::core::Duration_t m_DefaultDeltaT;
77 
78  SchedulingConstraint m_SchedConstraint;
79 
80  SimulationStage m_CurrentStage;
81 
82 
83  public:
84 
85  SimulationStatus() = delete;
86 
88  const openfluid::core::DateTime& End,
89  const openfluid::core::Duration_t DeltaT,
90  const SchedulingConstraint& SConst = SCHED_NONE);
91 
93  { }
94 
96  {
97  return m_BeginDate;
98  }
99 
101  {
102  return m_EndDate;
103  }
104 
106  {
107  return m_CurrentDate;
108  }
109 
111  {
112  return m_DefaultDeltaT;
113  }
114 
116  {
117  return m_Duration;
118  }
119 
121  {
122  return m_CurrentTimeIndex;
123  }
124 
126  {
127  return m_SchedConstraint;
128  }
129 
130  inline bool isFirstTimeIndex() const
131  {
132  return m_CurrentTimeIndex == 0;
133  }
134 
135  void setCurrentTimeIndex(const openfluid::core::TimeIndex_t& Index);
136 
138  {
139  return m_CurrentStage;
140  }
141 
142  std::string getCurrentStageAsString() const;
143 
144  void setCurrentStage(const SimulationStage& Stage);
145 
146  static std::string getStageAsString(const SimulationStage& Stage);
147 };
148 
149 } } // namespaces
150 
151 
152 #endif /* __OPENFLUID_BASE_SIMULATIONSTATUS_HPP__ */
SchedulingConstraint
Definition: SimulationStatus.hpp:62
std::uint64_t TimeIndex_t
Definition: TypeDefs.hpp:298
SchedulingConstraint getSchedulingConstraint() const
Definition: SimulationStatus.hpp:125
Class for management of date and time information.
Definition: DateTime.hpp:87
std::uint64_t Duration_t
Definition: TypeDefs.hpp:312
openfluid::core::Duration_t getSimulationDuration() const
Definition: SimulationStatus.hpp:115
openfluid::core::TimeIndex_t getCurrentTimeIndex() const
Definition: SimulationStatus.hpp:120
Definition: SimulationStatus.hpp:55
Definition: ApplicationException.hpp:47
openfluid::core::DateTime getBeginDate() const
Definition: SimulationStatus.hpp:95
SimulationStage
Definition: SimulationStatus.hpp:59
~SimulationStatus()
Definition: SimulationStatus.hpp:92
openfluid::core::DateTime getCurrentDate() const
Definition: SimulationStatus.hpp:105
openfluid::core::DateTime getEndDate() const
Definition: SimulationStatus.hpp:100
SimulationStage getCurrentStage() const
Definition: SimulationStatus.hpp:137
#define OPENFLUID_API
Definition: dllexport.hpp:86
openfluid::core::Duration_t getDefaultDeltaT() const
Definition: SimulationStatus.hpp:110
bool isFirstTimeIndex() const
Definition: SimulationStatus.hpp:130