SimulatorTimer.hpp
Go to the documentation of this file.
1 /*
2  Copyright 2012 SINTEF ICT, Applied Mathematics.
3 
4  This file is part of the Open Porous Media project (OPM).
5 
6  OPM is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  OPM is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with OPM. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef OPM_SIMULATORTIMER_HEADER_INCLUDED
21 #define OPM_SIMULATORTIMER_HEADER_INCLUDED
22 
23 #include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
25 
26 #include <iosfwd>
27 #include <vector>
28 
29 namespace Opm
30 {
31 
32  namespace parameter { class ParameterGroup; }
33 
35  {
36  public:
37  // use default implementation of these methods
40 
43 
47  void init(const parameter::ParameterGroup& param);
48 
50  void init(TimeMapConstPtr timeMap);
51 
53  int numSteps() const;
54 
59  int currentStepNum() const;
60 
62  void setCurrentStepNum(int step);
63 
68  double currentStepLength() const;
69 
76  double stepLengthTaken () const;
77 
80  double simulationTimeElapsed() const;
81 
83  double totalTime() const;
84 
86  boost::posix_time::ptime startDateTime() const;
87 
92  void setTotalTime(double time);
93 
96  void report(std::ostream& os) const;
97 
100 
102  void advance() { this->operator++(); }
103 
105  bool done() const;
106 
107  private:
108  std::vector<double> timesteps_;
109  int current_step_;
110  double current_time_;
111  double total_time_;
112  boost::gregorian::date start_date_;
113  };
114 
115 
116 } // namespace Opm
117 
118 #endif // OPM_SIMULATORTIMER_HEADER_INCLUDED
void advance()
advance time by currentStepLength
Definition: SimulatorTimer.hpp:102
void setTotalTime(double time)
Definition: AnisotropicEikonal.hpp:43
double simulationTimeElapsed() const
Definition: ParameterGroup.hpp:109
double currentStepLength() const
int numSteps() const
Total number of steps.
double stepLengthTaken() const
void init(const parameter::ParameterGroup &param)
boost::posix_time::ptime startDateTime() const
Return start date of simulation.
virtual boost::posix_time::ptime currentDateTime() const
Return the current time as a posix time object.
Definition: SimulatorTimerInterface.hpp:88
void report(std::ostream &os) const
SimulatorTimer & operator++()
advance time by currentStepLength
virtual time_t currentPosixTime() const
Definition: SimulatorTimerInterface.hpp:96
Interface class for SimulatorTimer objects, to be improved.
Definition: SimulatorTimerInterface.hpp:33
Definition: SimulatorTimer.hpp:34
SimulatorTimer()
Default constructor.
double totalTime() const
Total time.
int currentStepNum() const
void setCurrentStepNum(int step)
Set current step number.
bool done() const
Return true if op++() has been called numSteps() times.