Provide routine to return the step length taken

The output routine needs to know which step that has been taken in the
past (to arrive at this result), not which step to take next going
forward.
This commit is contained in:
Roland Kaufmann 2013-11-27 00:36:17 +01:00
parent 73dfe849d6
commit f30ab55974
2 changed files with 18 additions and 2 deletions

View File

@ -89,6 +89,12 @@ namespace Opm
return timesteps_[current_step_];
}
double SimulatorTimer::stepLengthTaken() const
{
assert(current_step_ > 0);
return timesteps_[current_step_ - 1];
}
/// Current time.
double SimulatorTimer::currentTime() const
{

View File

@ -59,10 +59,20 @@ namespace Opm
/// Set current step number.
void setCurrentStepNum(int step);
/// Current step length.
/// Note: if done(), it is an error to call currentStepLength().
/// Current step length. This is the length of the step
/// the simulator will take in the next iteration.
///
/// @note if done(), it is an error to call currentStepLength().
double currentStepLength() const;
/// Previous step length. This is the length of the step that
/// was taken to arrive at this time.
///
/// @note if no increments have been done (i.e. the timer is
/// still in its constructed state and currentStepNum() == 0),
/// it is an error to call stepLengthTaken().
double stepLengthTaken () const;
/// Current time.
double currentTime() const;