TimeStepper Class Reference

#include <TimeStepper.hpp>

Collaboration diagram for TimeStepper:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 TimeStepper (double startTime, double endTime, double dt, bool enforceConstantTimeStep=false, std::vector< double > additionalTimes=std::vector< double >())
void AdvanceOneTimeStep ()
double GetTime () const
double GetNextTime () const
double GetNextTimeStep ()
bool IsTimeAtEnd () const
unsigned EstimateTimeSteps () const
unsigned GetTotalTimeStepsTaken () const
void ResetTimeStep (double dt)

Private Member Functions

double CalculateNextTime ()

Private Attributes

double mStart
double mEnd
double mDt
unsigned mTotalTimeStepsTaken
unsigned mAdditionalTimesReached
double mTime
double mNextTime
std::vector< double > mAdditionalTimes

Friends

class TestTimeStepper


Detailed Description

A helper class that provides a robust way to deal with time loops.

An incremented integer counter is used to calculate the current time and ensure that the correct end time.

Definition at line 41 of file TimeStepper.hpp.


Constructor & Destructor Documentation

TimeStepper::TimeStepper ( double  startTime,
double  endTime,
double  dt,
bool  enforceConstantTimeStep = false,
std::vector< double >  additionalTimes = std::vector<double> () 
)

Create a new time stepper over some simulation interval. Time units are not specified, but all parameters should have consistent units.

Parameters:
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.
additionalTimes If the timestepper needs to stop at certain additional times, they can be passed in in this std::vector. Defaults to empty. These times must be in ascending order. Note that if, for example, start=0, end=0.5, dt=0.1, and the additional stopping time is 0.33, the times used will be 0,0.1,0.2,0.3,0.33,0.4,0.5 NOT ..,0.33,0.43,0.5

Definition at line 38 of file TimeStepper.cpp.

References CalculateNextTime(), EstimateTimeSteps(), EXCEPTION, mAdditionalTimes, mDt, mEnd, mNextTime, and mStart.


Member Function Documentation

void TimeStepper::AdvanceOneTimeStep (  ) 

double TimeStepper::GetTime (  )  const

double TimeStepper::GetNextTime (  )  const

double TimeStepper::GetNextTimeStep (  ) 

bool TimeStepper::IsTimeAtEnd (  )  const

unsigned TimeStepper::EstimateTimeSteps (  )  const

Estimate number of time steps remaining, which may be an overestimate Used to reserve memory for writing intermediate solutions.

Definition at line 148 of file TimeStepper.cpp.

References mAdditionalTimes, mDt, mEnd, and mStart.

Referenced by AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::DefineWriterColumns(), CvodeAdaptor::Solve(), AbstractOneStepIvpOdeSolver::Solve(), AbstractCvodeCell::Solve(), and TimeStepper().

unsigned TimeStepper::GetTotalTimeStepsTaken (  )  const

The number of time AdvanceOneTimeStep() has been called SINCE the last time ResetTimeStep() was called.

Definition at line 153 of file TimeStepper.cpp.

References mTotalTimeStepsTaken.

Referenced by CvodeAdaptor::Solve(), AbstractOneStepIvpOdeSolver::Solve(), and AbstractCvodeCell::Solve().

void TimeStepper::ResetTimeStep ( double  dt  ) 

Set the time step to use for adaptive time integration. Note that this also resets mStart to be the current time and zeroes mTotalTimeStepsTaken.

Parameters:
dt is the new time-step

Definition at line 158 of file TimeStepper.cpp.

References CalculateNextTime(), mDt, mNextTime, mStart, mTime, and mTotalTimeStepsTaken.

Referenced by AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::Solve().

double TimeStepper::CalculateNextTime (  )  [private]

Compute what the time will be after the next time step.

Definition at line 81 of file TimeStepper.cpp.

References mAdditionalTimes, mAdditionalTimesReached, mDt, mEnd, mStart, and mTotalTimeStepsTaken.

Referenced by AdvanceOneTimeStep(), ResetTimeStep(), and TimeStepper().


Member Data Documentation

double TimeStepper::mStart [private]

The start time.

Definition at line 110 of file TimeStepper.hpp.

Referenced by CalculateNextTime(), EstimateTimeSteps(), ResetTimeStep(), and TimeStepper().

double TimeStepper::mEnd [private]

The end time.

Definition at line 113 of file TimeStepper.hpp.

Referenced by CalculateNextTime(), EstimateTimeSteps(), GetNextTimeStep(), IsTimeAtEnd(), and TimeStepper().

double TimeStepper::mDt [private]

The size of time step.

Definition at line 116 of file TimeStepper.hpp.

Referenced by CalculateNextTime(), EstimateTimeSteps(), GetNextTimeStep(), ResetTimeStep(), and TimeStepper().

The total number of time steps taken, including those to get one of the 'additional times'.

Definition at line 119 of file TimeStepper.hpp.

Referenced by AdvanceOneTimeStep(), CalculateNextTime(), GetTotalTimeStepsTaken(), and ResetTimeStep().

The number of times one of the 'additional times' has been passed.

Definition at line 122 of file TimeStepper.hpp.

Referenced by CalculateNextTime(), and GetNextTimeStep().

double TimeStepper::mTime [private]

The current time.

Definition at line 125 of file TimeStepper.hpp.

Referenced by AdvanceOneTimeStep(), GetNextTimeStep(), GetTime(), IsTimeAtEnd(), and ResetTimeStep().

double TimeStepper::mNextTime [private]

What the time will be after the next time step.

Definition at line 128 of file TimeStepper.hpp.

Referenced by AdvanceOneTimeStep(), GetNextTime(), GetNextTimeStep(), ResetTimeStep(), and TimeStepper().

std::vector<double> TimeStepper::mAdditionalTimes [private]

Vector to store the additional times the stepper must stop at.

Definition at line 134 of file TimeStepper.hpp.

Referenced by CalculateNextTime(), EstimateTimeSteps(), GetNextTimeStep(), and TimeStepper().


The documentation for this class was generated from the following files:

Generated on Mon Apr 18 11:37:59 2011 for Chaste by  doxygen 1.5.5