SimulatorTimerInterface.hpp
Go to the documentation of this file.
1/*
2 Copyright (c) 2014 IRIS AS
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_SIMULATORTIMERINTERFACE_HEADER_INCLUDED
21#define OPM_SIMULATORTIMERINTERFACE_HEADER_INCLUDED
22
23#include <memory>
24
25namespace boost { namespace posix_time { class ptime; } }
26
27namespace Opm
28{
29
30 class ParameterGroup;
31
34 {
35 protected:
38
39 public:
42
47 virtual int currentStepNum() const = 0;
48
50 virtual int reportStepNum() const { return currentStepNum(); }
51
56 virtual double currentStepLength() const = 0;
57
64 virtual double stepLengthTaken () const = 0;
65
72 virtual double reportStepLengthTaken () const { return stepLengthTaken(); }
73
76 virtual double simulationTimeElapsed() const = 0;
77
79 virtual void advance() = 0 ;
80
82 virtual bool done() const = 0;
83
85 virtual bool initialStep() const = 0;
86
88 virtual boost::posix_time::ptime startDateTime() const = 0;
89
91 virtual boost::posix_time::ptime currentDateTime() const;
92
95 virtual time_t currentPosixTime() const;
96
98 virtual bool lastStepFailed() const = 0;
99
101 virtual std::unique_ptr< SimulatorTimerInterface > clone () const = 0;
102 };
103
104
105} // namespace Opm
106
107#endif // OPM_SIMULATORTIMER_HEADER_INCLUDED
Interface class for SimulatorTimer objects, to be improved.
Definition: SimulatorTimerInterface.hpp:34
virtual boost::posix_time::ptime startDateTime() const =0
Return start date of simulation.
virtual double stepLengthTaken() const =0
virtual void advance()=0
advance time by currentStepLength
virtual time_t currentPosixTime() const
virtual int reportStepNum() const
Current report step number. This might differ from currentStepNum in case of sub stepping.
Definition: SimulatorTimerInterface.hpp:50
virtual boost::posix_time::ptime currentDateTime() const
Return the current time as a posix time object.
SimulatorTimerInterface()
Default constructor, protected to not allow explicit instances of this class.
Definition: SimulatorTimerInterface.hpp:37
virtual bool initialStep() const =0
Whether the current step is the first step.
virtual bool lastStepFailed() const =0
Return true if last time step failed.
virtual std::unique_ptr< SimulatorTimerInterface > clone() const =0
return copy of current timer instance
virtual double reportStepLengthTaken() const
Definition: SimulatorTimerInterface.hpp:72
virtual double currentStepLength() const =0
virtual double simulationTimeElapsed() const =0
virtual ~SimulatorTimerInterface()
destructor
Definition: SimulatorTimerInterface.hpp:41
virtual bool done() const =0
Return true if timer indicates that simulation of timer interval is finished.
virtual int currentStepNum() const =0
Definition: BlackoilPhases.hpp:27
Definition: PropertyTree.hpp:27