mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-20 11:48:25 -06:00
Added start_date_ property to the SimulatorTimer class
This commit is contained in:
parent
158c33eb53
commit
09b3ef785c
@ -30,7 +30,8 @@ namespace Opm
|
||||
/// Default constructor.
|
||||
SimulatorTimer::SimulatorTimer()
|
||||
: current_step_(0),
|
||||
current_time_(0.0)
|
||||
current_time_(0.0),
|
||||
start_date_(2012,1,1) // A really arbitrary default starting value?!
|
||||
{
|
||||
}
|
||||
|
||||
@ -52,6 +53,7 @@ namespace Opm
|
||||
{
|
||||
timesteps_ = deck.getTSTEP().tstep_;
|
||||
total_time_ = std::accumulate(timesteps_.begin(), timesteps_.end(), 0.0);
|
||||
start_date_ = deck.getStartDate();
|
||||
}
|
||||
|
||||
/// Total number of steps.
|
||||
@ -92,6 +94,14 @@ namespace Opm
|
||||
return current_time_;
|
||||
}
|
||||
|
||||
|
||||
boost::posix_time::ptime SimulatorTimer::currentDateTime() const
|
||||
{
|
||||
return boost::posix_time::ptime(start_date_) + boost::posix_time::seconds( (int) current_time_ );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// Total time.
|
||||
double SimulatorTimer::totalTime() const
|
||||
{
|
||||
|
@ -22,6 +22,8 @@
|
||||
|
||||
#include <iosfwd>
|
||||
#include <vector>
|
||||
#include <boost/date_time/gregorian/gregorian.hpp>
|
||||
#include <boost/date_time/posix_time/posix_time_types.hpp>
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
@ -60,6 +62,8 @@ namespace Opm
|
||||
/// Current time.
|
||||
double currentTime() const;
|
||||
|
||||
boost::posix_time::ptime currentDateTime() const;
|
||||
|
||||
/// Total time.
|
||||
double totalTime() const;
|
||||
|
||||
@ -84,6 +88,7 @@ namespace Opm
|
||||
int current_step_;
|
||||
double current_time_;
|
||||
double total_time_;
|
||||
boost::gregorian::date start_date_;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user