#include <TimeStepper.hpp>
Public Member Functions | |
TimeStepper (double startTime, double endTime, double dt, bool enforceConstantTimeStep=false) | |
void | AdvanceOneTimeStep () |
double | GetTime () const |
double | GetNextTime () const |
double | GetNextTimeStep () |
bool | IsTimeAtEnd () const |
unsigned | EstimateTimeSteps () const |
unsigned | GetTimeStepsElapsed () const |
Private Member Functions | |
double | CalculateNextTime () const |
Private Attributes | |
double | mStart |
double | mEnd |
double | mDt |
unsigned | mTimeStep |
double | mTime |
double | mNextTime |
Friends | |
class | TestTimeStepper |
An incremented integer counter is used to calculate the current time and ensure that the correct end time.
Definition at line 39 of file TimeStepper.hpp.
TimeStepper::TimeStepper | ( | double | startTime, | |
double | endTime, | |||
double | dt, | |||
bool | enforceConstantTimeStep = false | |||
) |
Create a new time stepper over some simulation interval. Time units are not specified, but all parameters should have consistent units.
startTime | the start of the interval | |
endTime | the end of the interval | |
dt | the time step to use. | |
enforceConstantTimeStep | If this is true the stepper estimates whether non-constant timesteps will be used and quits if so. |
Definition at line 38 of file TimeStepper.cpp.
References CalculateNextTime(), EstimateTimeSteps(), mDt, mEnd, mNextTime, and mStart.
void TimeStepper::AdvanceOneTimeStep | ( | ) |
Step forward one step in time and update member variables.
Definition at line 84 of file TimeStepper.cpp.
References CalculateNextTime(), mNextTime, mTime, and mTimeStep.
Referenced by AbstractOneStepIvpOdeSolver::InternalSolve(), AbstractDynamicAssemblerMixin< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::Solve(), AbstractOneStepIvpOdeSolver::Solve(), CardiacElectroMechanicsProblem< DIM >::Solve(), AbstractCardiacProblem< ELEM_DIM, SPACE_DIM, PROBLEM_DIM >::Solve(), and NhsSystemWithImplicitSolver::SolveDoNotUpdate().
double TimeStepper::GetTime | ( | ) | const |
Get the time
Definition at line 95 of file TimeStepper.cpp.
References mTime.
Referenced by AbstractOneStepIvpOdeSolver::InternalSolve(), AbstractDynamicAssemblerMixin< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::Solve(), AbstractOneStepIvpOdeSolver::Solve(), CardiacElectroMechanicsProblem< DIM >::Solve(), and AbstractCardiacProblem< ELEM_DIM, SPACE_DIM, PROBLEM_DIM >::Solve().
double TimeStepper::GetNextTime | ( | ) | const |
Get the value time will take at the next step
Definition at line 100 of file TimeStepper.cpp.
References mNextTime.
Referenced by AbstractOneStepIvpOdeSolver::Solve(), CardiacElectroMechanicsProblem< DIM >::Solve(), and AbstractCardiacProblem< ELEM_DIM, SPACE_DIM, PROBLEM_DIM >::Solve().
double TimeStepper::GetNextTimeStep | ( | ) |
Get the size of the next time step which will be taken. GetNextTimeStep() == GetNextTime() - GetTime()
Definition at line 105 of file TimeStepper.cpp.
References mDt, mEnd, mNextTime, and mTime.
Referenced by AbstractOneStepIvpOdeSolver::InternalSolve(), and AbstractDynamicAssemblerMixin< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::Solve().
bool TimeStepper::IsTimeAtEnd | ( | ) | const |
True when GetTime == endTime
Definition at line 116 of file TimeStepper.cpp.
Referenced by AbstractOneStepIvpOdeSolver::InternalSolve(), AbstractDynamicAssemblerMixin< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::Solve(), AbstractOneStepIvpOdeSolver::Solve(), CardiacElectroMechanicsProblem< DIM >::Solve(), AbstractCardiacProblem< ELEM_DIM, SPACE_DIM, PROBLEM_DIM >::Solve(), and NhsSystemWithImplicitSolver::SolveDoNotUpdate().
unsigned TimeStepper::EstimateTimeSteps | ( | ) | const |
Estimate number of time steps, which may be an overestimate Used to reserve memory for writing intermediate solutions.
Definition at line 121 of file TimeStepper.cpp.
References mDt, mEnd, and mStart.
Referenced by AbstractOneStepIvpOdeSolver::Solve(), and TimeStepper().
unsigned TimeStepper::GetTimeStepsElapsed | ( | ) | const |
The number of time AdvanceOneTimeStep() has been called.
Definition at line 126 of file TimeStepper.cpp.
References mTimeStep.
Referenced by AbstractOneStepIvpOdeSolver::Solve().
double TimeStepper::CalculateNextTime | ( | ) | const [private] |
Compute what the time will be after the next time step.
Definition at line 74 of file TimeStepper.cpp.
References mDt, mEnd, mStart, and mTimeStep.
Referenced by AdvanceOneTimeStep(), and TimeStepper().
double TimeStepper::mStart [private] |
The start time.
Definition at line 95 of file TimeStepper.hpp.
Referenced by CalculateNextTime(), EstimateTimeSteps(), and TimeStepper().
double TimeStepper::mEnd [private] |
The end time.
Definition at line 98 of file TimeStepper.hpp.
Referenced by CalculateNextTime(), EstimateTimeSteps(), GetNextTimeStep(), IsTimeAtEnd(), and TimeStepper().
double TimeStepper::mDt [private] |
The size of time step.
Definition at line 101 of file TimeStepper.hpp.
Referenced by CalculateNextTime(), EstimateTimeSteps(), GetNextTimeStep(), and TimeStepper().
unsigned TimeStepper::mTimeStep [private] |
The number of time steps elapsed.
Definition at line 104 of file TimeStepper.hpp.
Referenced by AdvanceOneTimeStep(), CalculateNextTime(), and GetTimeStepsElapsed().
double TimeStepper::mTime [private] |
The current time.
Definition at line 107 of file TimeStepper.hpp.
Referenced by AdvanceOneTimeStep(), GetNextTimeStep(), GetTime(), and IsTimeAtEnd().
double TimeStepper::mNextTime [private] |
What the time will be after the next time step.
Definition at line 110 of file TimeStepper.hpp.
Referenced by AdvanceOneTimeStep(), GetNextTime(), GetNextTimeStep(), and TimeStepper().