Chaste Release::3.1
AbstractOdeSystem Class Reference

#include <AbstractOdeSystem.hpp>

Inheritance diagram for AbstractOdeSystem:
Collaboration diagram for AbstractOdeSystem:

List of all members.

Public Member Functions

 AbstractOdeSystem (unsigned numberOfStateVariables)
virtual ~AbstractOdeSystem ()
virtual void EvaluateYDerivatives (double time, const std::vector< double > &rY, std::vector< double > &rDY)=0
virtual bool CalculateStoppingEvent (double time, const std::vector< double > &rY)
virtual double CalculateRootFunction (double time, const std::vector< double > &rY)
bool GetUseAnalyticJacobian ()
const std::vector< double > & rGetConstStateVariables () const

Protected Attributes

bool mUseAnalyticJacobian

Private Member Functions

template<class Archive >
void save (Archive &archive, const unsigned int version) const
template<class Archive >
void load (Archive &archive, const unsigned int version)

Friends

class TestAbstractOdeSystem
class boost::serialization::access

Detailed Description

Abstract OdeSystem class.

Sets up variables and functions for a general ODE system.

ODE systems are specified primarily by the EvaluateYDerivatives() method, which calculates the right-hand side of the system.

Instances can store their state internally in the mStateVariables vector in our base class AbstractParameterisedSystem (see also GetNumberOfStateVariables(), SetStateVariables() and rGetStateVariables()), although this is not essential - the vector may be empty, in which case AbstractIvpOdeSolver::SolveAndUpdateStateVariable may not be used to solve the system.

ODE systems may also have a vector of parameters, which can be accessed through the GetParameter() and SetParameter() methods of our base class.

Information about what the parameters and state variables represent is provided by a subclass of AbstractOdeSystemInformation. Various wrapper methods (e.g. rGetStateVariableNames()) are provided in our base class to access this information.

There are two more advanced facilities available for subclass authors. An analytic form for the Jacobian matrix of the system may be provided, in which case you must subclass AbstractOdeSystemWithAnalyticJacobian. The GetUseAnalyticJacobian() method will test whether this is the case.

Also, subclasses may define a condition at which ODE solvers should stop prematurely. For the Chaste solvers this is done by overriding CalculateStoppingEvent(); if the more advanced CVODE solvers are being used then implement CalculateRootFunction() instead to detect the stopping time more accurately.

Definition at line 87 of file AbstractOdeSystem.hpp.


Constructor & Destructor Documentation

AbstractOdeSystem::AbstractOdeSystem ( unsigned  numberOfStateVariables)

Constructor.

Parameters:
numberOfStateVariablesthe number of state variables in the ODE system

Definition at line 39 of file AbstractOdeSystem.cpp.

AbstractOdeSystem::~AbstractOdeSystem ( ) [virtual]

Virtual destructor since we have virtual methods.

Definition at line 45 of file AbstractOdeSystem.cpp.


Member Function Documentation

double AbstractOdeSystem::CalculateRootFunction ( double  time,
const std::vector< double > &  rY 
) [virtual]

An alternative approach to stopping events; currently only useful with CVODE. CVODE can search for roots (zeros) of this function while solving the ODE system, and home in on them to find sign transitions to high precision.

The default implementation here fakes a root function using CalculateStoppingEvent.

Parameters:
timethe current time
rYthe current values of the state variables

Reimplemented in TysonNovak2001OdeSystem, VanLeeuwen2009WntSwatCellCycleOdeSystem, and WntCellCycleOdeSystem.

Definition at line 54 of file AbstractOdeSystem.cpp.

References CalculateStoppingEvent().

bool AbstractOdeSystem::CalculateStoppingEvent ( double  time,
const std::vector< double > &  rY 
) [virtual]

CalculateStoppingEvent() - can be overloaded if the ODE is to be solved only until a particular event (for example, only until the y value becomes negative.

After each timestep the solver will call this method on the ODE to see if it should stop there. By default, false is returned here.

Parameters:
timethe current time
rYthe current values of the state variables

Reimplemented in Alarcon2004OxygenBasedCellCycleOdeSystem, TysonNovak2001OdeSystem, VanLeeuwen2009WntSwatCellCycleOdeSystem, and WntCellCycleOdeSystem.

Definition at line 49 of file AbstractOdeSystem.cpp.

Referenced by CalculateRootFunction(), RungeKuttaFehlbergIvpOdeSolver::InternalSolve(), AbstractOneStepIvpOdeSolver::InternalSolve(), RungeKuttaFehlbergIvpOdeSolver::Solve(), CvodeAdaptor::Solve(), and AbstractOneStepIvpOdeSolver::Solve().

bool AbstractOdeSystem::GetUseAnalyticJacobian ( )

Get whether an analytic Jacobian is used.

Returns:
mUseAnalyticJacobian

Definition at line 60 of file AbstractOdeSystem.cpp.

References mUseAnalyticJacobian.

Referenced by BackwardEulerIvpOdeSolver::ComputeJacobian().

template<class Archive >
void AbstractOdeSystem::load ( Archive &  archive,
const unsigned int  version 
) [inline, private]
const std::vector< double > & AbstractOdeSystem::rGetConstStateVariables ( ) const
Todo:
move to AbstractParameterisedSystem? (1540)
Returns:
const reference to the state variables in the ODE system (used in archiving).

Definition at line 65 of file AbstractOdeSystem.cpp.

References AbstractParameterisedSystem< std::vector< double > >::mStateVariables.

template<class Archive >
void AbstractOdeSystem::save ( Archive &  archive,
const unsigned int  version 
) const [inline, private]

Member Data Documentation


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