Loading...
Searching...
No Matches
SimulatorTimerInterface.hpp
/*
Copyright (c) 2014 IRIS AS
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OPM_SIMULATORTIMERINTERFACE_HEADER_INCLUDED
#define OPM_SIMULATORTIMERINTERFACE_HEADER_INCLUDED
#include <memory>
namespace boost { namespace posix_time { class ptime; } }
namespace Opm
{
class ParameterGroup;
class SimulatorTimerInterface
{
protected:
SimulatorTimerInterface() {}
public:
virtual ~SimulatorTimerInterface() {}
// -----------------------------------------------------------
// Pure virtual functions to be implemented by derived classes
// -----------------------------------------------------------
virtual void advance() = 0 ;
virtual std::unique_ptr< SimulatorTimerInterface > clone () const = 0;
virtual double currentStepLength() const = 0;
virtual int currentStepNum() const = 0;
virtual bool done() const = 0;
virtual bool initialStep() const = 0;
virtual bool lastStepFailed() const = 0;
virtual double simulationTimeElapsed() const = 0;
virtual double stepLengthTaken () const = 0;
virtual boost::posix_time::ptime startDateTime() const = 0;
// -----------------------------------------------------------------
// Virtual functions (not pure) to allow for default implementations
// -----------------------------------------------------------------
virtual boost::posix_time::ptime currentDateTime() const;
virtual time_t currentPosixTime() const;
virtual double reportStepLengthTaken () const { return stepLengthTaken(); }
virtual int reportStepNum() const { return currentStepNum(); }
};
} // namespace Opm
#endif // OPM_SIMULATORTIMER_HEADER_INCLUDED
Opm::SimulatorTimerInterface::currentPosixTime
virtual time_t currentPosixTime() const
Time elapsed since the start of the POSIX epoch (Jan 1st, 1970) until the current time step begins [s...
Definition SimulatorTimerInterface.cpp:37
Opm::SimulatorTimerInterface::startDateTime
virtual boost::posix_time::ptime startDateTime() const =0
Return start date of simulation.
Opm::SimulatorTimerInterface::stepLengthTaken
virtual double stepLengthTaken() const =0
Previous step length.
Opm::SimulatorTimerInterface::advance
virtual void advance()=0
advance time by currentStepLength
Opm::SimulatorTimerInterface::reportStepNum
virtual int reportStepNum() const
Current report step number. This might differ from currentStepNum in case of sub stepping.
Definition SimulatorTimerInterface.hpp:109
Opm::SimulatorTimerInterface::SimulatorTimerInterface
SimulatorTimerInterface()
Default constructor, protected to not allow explicit instances of this class.
Definition SimulatorTimerInterface.hpp:37
Opm::SimulatorTimerInterface::initialStep
virtual bool initialStep() const =0
Whether the current step is the first step.
Opm::SimulatorTimerInterface::lastStepFailed
virtual bool lastStepFailed() const =0
Return true if last time step failed.
Opm::SimulatorTimerInterface::clone
virtual std::unique_ptr< SimulatorTimerInterface > clone() const =0
return copy of current timer instance
Opm::SimulatorTimerInterface::reportStepLengthTaken
virtual double reportStepLengthTaken() const
Previous report step length.
Definition SimulatorTimerInterface.hpp:106
Opm::SimulatorTimerInterface::currentStepLength
virtual double currentStepLength() const =0
Current step length.
Opm::SimulatorTimerInterface::simulationTimeElapsed
virtual double simulationTimeElapsed() const =0
Time elapsed since the start of the simulation until the beginning of the current time step [s].
Opm::SimulatorTimerInterface::~SimulatorTimerInterface
virtual ~SimulatorTimerInterface()
destructor
Definition SimulatorTimerInterface.hpp:41
Opm::SimulatorTimerInterface::done
virtual bool done() const =0
Return true if timer indicates that simulation of timer interval is finished.
Opm::SimulatorTimerInterface::currentStepNum
virtual int currentStepNum() const =0
Current step number.
Opm::SimulatorTimerInterface::currentDateTime
virtual boost::posix_time::ptime currentDateTime() const
Return the current time as a posix time object.
Definition SimulatorTimerInterface.cpp:28
Opm
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilbioeffectsmodules.hh:43