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
43 // -----------------------------------------------------------
44 // Pure virtual functions to be implemented by derived classes
45 // -----------------------------------------------------------
46
48 virtual void advance() = 0 ;
49
51 virtual std::unique_ptr< SimulatorTimerInterface > clone () const = 0;
52
57 virtual double currentStepLength() const = 0;
58
63 virtual int currentStepNum() const = 0;
64
66 virtual bool done() const = 0;
67
69 virtual bool initialStep() const = 0;
70
72 virtual bool lastStepFailed() const = 0;
73
76 virtual double simulationTimeElapsed() const = 0;
77
84 virtual double stepLengthTaken () const = 0;
85
87 virtual boost::posix_time::ptime startDateTime() const = 0;
88
89 // -----------------------------------------------------------------
90 // Virtual functions (not pure) to allow for default implementations
91 // -----------------------------------------------------------------
92
94 virtual boost::posix_time::ptime currentDateTime() const;
95
98 virtual time_t currentPosixTime() const;
99
106 virtual double reportStepLengthTaken () const { return stepLengthTaken(); }
107
109 virtual int reportStepNum() const { return currentStepNum(); }
110
111 };
112
113
114} // namespace Opm
115
116#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:109
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:106
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: blackoilboundaryratevector.hh:39
Definition: PropertyTree.hpp:30