00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef OPM_SIMULATORTIMER_HEADER_INCLUDED
00021 #define OPM_SIMULATORTIMER_HEADER_INCLUDED
00022
00023 #include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
00024 #include <opm/simulators/timestepping/SimulatorTimerInterface.hpp>
00025
00026 #include <iosfwd>
00027 #include <vector>
00028
00029 namespace Opm
00030 {
00031
00032 class ParameterGroup;
00033
00034 class SimulatorTimer : public SimulatorTimerInterface
00035 {
00036 public:
00037
00038 using SimulatorTimerInterface::currentDateTime;
00039 using SimulatorTimerInterface::currentPosixTime;
00040
00042 SimulatorTimer();
00043
00047 void init(const ParameterGroup& param);
00048
00050 void init(const TimeMap& timeMap, size_t report_step = 0);
00051
00053 bool initialStep() const;
00054
00056 int numSteps() const;
00057
00062 int currentStepNum() const;
00063
00065 void setCurrentStepNum(int step);
00066
00071 double currentStepLength() const;
00072
00079 double stepLengthTaken () const;
00080
00083 double simulationTimeElapsed() const;
00084
00086 double totalTime() const;
00087
00089 boost::posix_time::ptime startDateTime() const;
00090
00092 boost::posix_time::ptime currentDateTime() const;
00093
00098 void setTotalTime(double time);
00099
00102 void report(std::ostream& os) const;
00103
00105 SimulatorTimer& operator++();
00106
00108 void advance() { this->operator++(); }
00109
00111 bool done() const;
00112
00115 bool lastStepFailed() const {return false;}
00116
00118 virtual std::unique_ptr< SimulatorTimerInterface > clone() const;
00119
00120 private:
00121 std::vector<double> timesteps_;
00122 int current_step_;
00123 double current_time_;
00124 double total_time_;
00125 boost::gregorian::date start_date_;
00126 };
00127
00128
00129 }
00130
00131 #endif // OPM_SIMULATORTIMER_HEADER_INCLUDED