In SimulatorTimer: added setTotalTime(), made setCurrentStepNum() update current time.
This commit is contained in:
parent
1a95fe8199
commit
294ce0b579
@ -69,7 +69,13 @@ namespace Opm
|
||||
/// Set current step number.
|
||||
void SimulatorTimer::setCurrentStepNum(int step)
|
||||
{
|
||||
if (current_step_ < 0 || current_step_ > int(timesteps_.size())) {
|
||||
// Note that we do allow current_step_ == timesteps_.size(),
|
||||
// that is the done() state.
|
||||
THROW("Trying to set invalid step number: " << step);
|
||||
}
|
||||
current_step_ = step;
|
||||
current_time_ = std::accumulate(timesteps_.begin(), timesteps_.begin() + step, 0.0);
|
||||
}
|
||||
|
||||
|
||||
@ -92,6 +98,15 @@ namespace Opm
|
||||
return total_time_;
|
||||
}
|
||||
|
||||
/// Set total time.
|
||||
/// This is primarily intended for multi-epoch schedules,
|
||||
/// where a timer for a given epoch does not have
|
||||
/// access to later timesteps.
|
||||
void SimulatorTimer::setTotalTime(double time)
|
||||
{
|
||||
total_time_ = time;
|
||||
}
|
||||
|
||||
/// Print a report with current and total time etc.
|
||||
void SimulatorTimer::report(std::ostream& os) const
|
||||
{
|
||||
|
@ -63,6 +63,12 @@ namespace Opm
|
||||
/// Total time.
|
||||
double totalTime() const;
|
||||
|
||||
/// Set total time.
|
||||
/// This is primarily intended for multi-epoch schedules,
|
||||
/// where a timer for a given epoch does not have
|
||||
/// access to later timesteps.
|
||||
void setTotalTime(double time);
|
||||
|
||||
/// Print a report with current and total time etc.
|
||||
/// Note: if done(), it is an error to call report().
|
||||
void report(std::ostream& os) const;
|
||||
|
Loading…
Reference in New Issue
Block a user