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@supagro.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  public:
83 
85  const openfluid::core::DateTime& End,
86  const openfluid::core::Duration_t DeltaT,
87  const SchedulingConstraint& SConst = SCHED_NONE);
88 
90 
92  { return m_BeginDate; }
93 
95  { return m_EndDate; }
96 
98  { return m_CurrentDate; }
99 
101  { return m_DefaultDeltaT; }
102 
104  { return m_Duration; }
105 
107  { return m_CurrentTimeIndex; }
108 
110  { return m_SchedConstraint; }
111 
112  inline bool isFirstTimeIndex() const
113  { return m_CurrentTimeIndex == 0; }
114 
115  void setCurrentTimeIndex(const openfluid::core::TimeIndex_t& Index);
116 
118  { return m_CurrentStage; }
119 
120  std::string getCurrentStageAsString() const;
121 
122  void setCurrentStage(const SimulationStage& Stage);
123 
124  static std::string getStageAsString(const SimulationStage& Stage);
125 
126 };
127 
128 } } // namespaces
129 
130 
131 #endif /* __OPENFLUID_BASE_SIMULATIONSTATUS_HPP__ */
SchedulingConstraint getSchedulingConstraint() const
Definition: SimulationStatus.hpp:109
SimulationStage getCurrentStage() const
Definition: SimulationStatus.hpp:117
~SimulationStatus()
Definition: SimulationStatus.hpp:89
unsigned long long Duration_t
Definition: DateTime.hpp:68
openfluid::core::DateTime getBeginDate() const
Definition: SimulationStatus.hpp:91
openfluid::core::DateTime getEndDate() const
Definition: SimulationStatus.hpp:94
openfluid::core::Duration_t getSimulationDuration() const
Definition: SimulationStatus.hpp:103
bool isFirstTimeIndex() const
Definition: SimulationStatus.hpp:112
SchedulingConstraint
Definition: SimulationStatus.hpp:62
Definition: SimulationStatus.hpp:55
openfluid::core::DateTime getCurrentDate() const
Definition: SimulationStatus.hpp:97
Definition: ApplicationException.hpp:47
#define OPENFLUID_API
Definition: dllexport.hpp:87
unsigned long long TimeIndex_t
Definition: DateTime.hpp:62
SimulationStage
Definition: SimulationStatus.hpp:59
openfluid::core::TimeIndex_t getCurrentTimeIndex() const
Definition: SimulationStatus.hpp:106
Class for management of date and time information.
Definition: DateTime.hpp:132
openfluid::core::Duration_t getDefaultDeltaT() const
Definition: SimulationStatus.hpp:100