AbstractOdeSystem Class Reference

#include <AbstractOdeSystem.hpp>

Inheritance diagram for AbstractOdeSystem:

Inheritance graph
[legend]
Collaboration diagram for AbstractOdeSystem:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 AbstractOdeSystem (unsigned numberOfStateVariables=0)
virtual ~AbstractOdeSystem ()
virtual void EvaluateYDerivatives (double time, const std::vector< double > &rY, std::vector< double > &rDY)=0
unsigned GetNumberOfStateVariables () const
unsigned GetNumberOfParameters () const
double GetParameter (unsigned index) const
void SetParameter (unsigned index, double value)
const std::vector< std::string > & rGetParameterNames () const
const std::vector< std::string > & rGetParameterUnits () const
void SetInitialConditions (const std::vector< double > &rInitialConditions)
void SetInitialConditionsComponent (unsigned index, double initialCondition)
std::vector< double > GetInitialConditions () const
void SetStateVariables (const std::vector< double > &rStateVariables)
void SetStateVariable (unsigned stateVariable, double newValue)
std::vector< double > & rGetStateVariables ()
const std::vector< std::string > & rGetVariableNames () const
const std::vector< std::string > & rGetVariableUnits () const
virtual bool CalculateStoppingEvent (double time, const std::vector< double > &rY)
virtual double CalculateRootFunction (double time, const std::vector< double > &rY)
bool GetUseAnalyticJacobian ()
unsigned GetStateVariableNumberByName (const std::string name)
double GetStateVariableValueByNumber (unsigned varNumber) const
std::string GetStateVariableUnitsByNumber (unsigned varNumber) const
boost::shared_ptr< const
AbstractOdeSystemInformation
GetSystemInformation () const

Protected Member Functions

std::string DumpState (const std::string &rMessage, std::vector< double > Y=std::vector< double >())

Protected Attributes

unsigned mNumberOfStateVariables
std::vector< double > mStateVariables
std::vector< double > mParameters
boost::shared_ptr
< AbstractOdeSystemInformation
mpSystemInfo
bool mUseAnalyticJacobian

Private Member Functions

template<class Archive>
void serialize (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 (see GetNumberOfStateVariables, SetStateVariables and rGetStateVariables), although this is not essential - the vector may be empty, although in this 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.

Information about what the parameters and state variables represent is provided by a subclass of AbstractOdeSystemInformation. Various wrapper methods (e.g. rGetVariableNames) are provided in this 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 77 of file AbstractOdeSystem.hpp.


Constructor & Destructor Documentation

AbstractOdeSystem::AbstractOdeSystem ( unsigned  numberOfStateVariables = 0  ) 

Constructor.

Parameters:
numberOfStateVariables the number of state variables in the ODE system (defaults to 0)

Definition at line 33 of file AbstractOdeSystem.cpp.

AbstractOdeSystem::~AbstractOdeSystem (  )  [virtual]

Virtual destructor since we have virtual methods.

Definition at line 39 of file AbstractOdeSystem.cpp.


Member Function Documentation

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

virtual void AbstractOdeSystem::EvaluateYDerivatives ( double  time,
const std::vector< double > &  rY,
std::vector< double > &  rDY 
) [pure virtual]

unsigned AbstractOdeSystem::GetNumberOfStateVariables (  )  const

unsigned AbstractOdeSystem::GetNumberOfParameters (  )  const

Get the number of parameters.

Definition at line 71 of file AbstractOdeSystem.cpp.

References mParameters.

double AbstractOdeSystem::GetParameter ( unsigned  index  )  const

Get the value of a given parameter.

Parameters:
index the index of the parameter

Definition at line 76 of file AbstractOdeSystem.cpp.

References mParameters.

void AbstractOdeSystem::SetParameter ( unsigned  index,
double  value 
)

Set the value of a given parameter.

Parameters:
index the index of the parameter
value the value

Definition at line 81 of file AbstractOdeSystem.cpp.

References mParameters.

const std::vector< std::string > & AbstractOdeSystem::rGetParameterNames (  )  const

Get the names of the parameters in the ODE system.

Definition at line 86 of file AbstractOdeSystem.cpp.

References mpSystemInfo.

const std::vector< std::string > & AbstractOdeSystem::rGetParameterUnits (  )  const

Get the units of the parameters in the ODE system.

Definition at line 92 of file AbstractOdeSystem.cpp.

References mpSystemInfo.

void AbstractOdeSystem::SetInitialConditions ( const std::vector< double > &  rInitialConditions  ) 

Set the initial conditions for the ODE system.

Parameters:
rInitialConditions vector containing initial values for the state variables

Definition at line 99 of file AbstractOdeSystem.cpp.

References mNumberOfStateVariables, and mpSystemInfo.

void AbstractOdeSystem::SetInitialConditionsComponent ( unsigned  index,
double  initialCondition 
)

Set the initial condition one state variable.

Parameters:
index the index of the state variable in the system
initialCondition the initial value for the state variable

Definition at line 109 of file AbstractOdeSystem.cpp.

References mNumberOfStateVariables, and mpSystemInfo.

Referenced by IngeWntSwatCellCycleOdeSystem::IngeWntSwatCellCycleOdeSystem(), and WntCellCycleOdeSystem::WntCellCycleOdeSystem().

std::vector< double > AbstractOdeSystem::GetInitialConditions (  )  const

void AbstractOdeSystem::SetStateVariables ( const std::vector< double > &  rStateVariables  ) 

void AbstractOdeSystem::SetStateVariable ( unsigned  stateVariable,
double  newValue 
)

Set the value of a single state variable in the ODE system.

Parameters:
stateVariable index of the state variable to be set
newValue new value of the state variable

Definition at line 134 of file AbstractOdeSystem.cpp.

References mNumberOfStateVariables, and mStateVariables.

std::vector< double > & AbstractOdeSystem::rGetStateVariables (  ) 

Get the values of the state variables in the ODE system.

Definition at line 144 of file AbstractOdeSystem.cpp.

References mStateVariables.

Referenced by WntCellCycleModel::ChangeCellTypeDueToCurrentBetaCateninLevel(), IngeWntSwatCellCycleModel::ChangeCellTypeDueToCurrentBetaCateninLevel(), AbstractCardiacCell::Compute(), AbstractBackwardEulerCardiacCell< SIZE >::Compute(), BackwardEulerLuoRudyIModel1991::ComputeJacobian(), BackwardEulerLuoRudyIModel1991::ComputeOneStepExceptVoltage(), BackwardEulerFoxModel2002Modified::ComputeOneStepExceptVoltage(), BackwardEulerLuoRudyIModel1991::ComputeResidual(), DumpState(), FakeBathCell::FakeBathCell(), IngeWntSwatCellCycleModel::GetCytoplasmicBetaCateninLevel(), Mahajan2008OdeSystem::GetIIonic(), FoxModel2002Modified::GetIIonic(), BackwardEulerFoxModel2002Modified::GetIIonic(), IngeWntSwatCellCycleModel::GetMembraneBoundBetaCateninLevel(), IngeWntSwatCellCycleModel::GetNuclearBetaCateninLevel(), AbstractOdeBasedCellCycleModel::GetProteinConcentrations(), AbstractCardiacCell::GetVoltage(), IngeWntSwatCellCycleModel::IngeWntSwatCellCycleModel(), TysonNovakCellCycleModel::ResetForDivision(), AbstractWntOdeBasedCellCycleModel::ResetForDivision(), AbstractOdeBasedCellCycleModel::serialize(), AbstractOdeBasedCellCycleModel::SetProteinConcentrationsForTestsOnly(), AbstractCardiacCell::SetVoltage(), AbstractIvpOdeSolver::SolveAndUpdateStateVariable(), WntCellCycleModel::SolveOdeToTime(), IngeWntSwatCellCycleModel::SolveOdeToTime(), AbstractOdeBasedCellCycleModel::UpdateCellCyclePhase(), BackwardEulerLuoRudyIModel1991::UpdateTransmembranePotential(), BackwardEulerFoxModel2002Modified::UpdateTransmembranePotential(), TenTusscher2006OdeSystem::VerifyStateVariables(), LuoRudyIModel1991OdeSystem::VerifyStateVariables(), DiFrancescoNoble1985OdeSystem::VerifyStateVariables(), BackwardEulerLuoRudyIModel1991::VerifyStateVariables(), WntCellCycleModel::WntCellCycleModel(), and CardiacElectroMechanicsProblem< DIM >::WriteWatchedLocationData().

const std::vector< std::string > & AbstractOdeSystem::rGetVariableNames (  )  const

Get the names of the state variables in the ODE system.

Definition at line 149 of file AbstractOdeSystem.cpp.

References mpSystemInfo.

Referenced by DumpState(), FoxModel2002Modified::EvaluateYDerivatives(), and OdeSolution::WriteToFile().

const std::vector< std::string > & AbstractOdeSystem::rGetVariableUnits (  )  const

Get the units of the state variables in the ODE system.

Definition at line 155 of file AbstractOdeSystem.cpp.

References mpSystemInfo.

Referenced by OdeSolution::WriteToFile().

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:
time the current time
rY the current values of the state variables

Reimplemented in IngeWntSwatCellCycleOdeSystem, TysonNovak2001OdeSystem, and WntCellCycleOdeSystem.

Definition at line 42 of file AbstractOdeSystem.cpp.

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

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:
time the current time
rY the current values of the state variables

Reimplemented in IngeWntSwatCellCycleOdeSystem, TysonNovak2001OdeSystem, and WntCellCycleOdeSystem.

Definition at line 167 of file AbstractOdeSystem.cpp.

References CalculateStoppingEvent().

bool AbstractOdeSystem::GetUseAnalyticJacobian (  ) 

Get whether an analytic Jacobian is used.

Returns:
mUseAnalyticJacobian

Definition at line 173 of file AbstractOdeSystem.cpp.

References mUseAnalyticJacobian.

Referenced by BackwardEulerIvpOdeSolver::ComputeJacobian().

unsigned AbstractOdeSystem::GetStateVariableNumberByName ( const std::string  name  ) 

This method is used to establish a state variable's position within the vector of state variables of an ODE system. This number can then be used with the methods GetStateVariableValueByNumber and GetStateVariableUnitsByNumber.

Parameters:
name the name of a state variable.
Returns:
the state variable's position within the vector of state variables associated with the ODE system.

Definition at line 178 of file AbstractOdeSystem.cpp.

References mpSystemInfo.

double AbstractOdeSystem::GetStateVariableValueByNumber ( unsigned  varNumber  )  const

Get the value of a state variable given its index in the ODE system.

Parameters:
varNumber a state variable's position within the vector of state variables associated with the ODE system.
Returns:
the current value of the state variable.

Definition at line 184 of file AbstractOdeSystem.cpp.

References mNumberOfStateVariables, and mStateVariables.

std::string AbstractOdeSystem::GetStateVariableUnitsByNumber ( unsigned  varNumber  )  const

Get the units of a state variable given its index in the ODE system.

Parameters:
varNumber a state variable's position within the vector of state variables associated with the ODE system.
Returns:
the units of the state variable.

Definition at line 190 of file AbstractOdeSystem.cpp.

References mNumberOfStateVariables, and mpSystemInfo.

boost::shared_ptr< const AbstractOdeSystemInformation > AbstractOdeSystem::GetSystemInformation (  )  const

Get the object which provides information about this ODE system.

Definition at line 161 of file AbstractOdeSystem.cpp.

References mpSystemInfo.

std::string AbstractOdeSystem::DumpState ( const std::string &  rMessage,
std::vector< double >  Y = std::vector<double>() 
) [protected]

Used to include extra debugging information in exception messages. For example, EXCEPTION(DumpState("Gating variable out of range"));

Parameters:
rMessage the exception message
Y the values of the state variables (optional input argument)

Definition at line 47 of file AbstractOdeSystem.cpp.

References rGetStateVariables(), and rGetVariableNames().

Referenced by FoxModel2002Modified::EvaluateYDerivatives(), TenTusscher2006OdeSystem::VerifyStateVariables(), LuoRudyIModel1991OdeSystem::VerifyStateVariables(), and DiFrancescoNoble1985OdeSystem::VerifyStateVariables().


Friends And Related Function Documentation

friend class boost::serialization::access [friend]


Member Data Documentation

std::vector<double> AbstractOdeSystem::mStateVariables [protected]

std::vector<double> AbstractOdeSystem::mParameters [protected]

Vector containing parameters.

Definition at line 111 of file AbstractOdeSystem.hpp.

Referenced by GetNumberOfParameters(), GetParameter(), serialize(), and SetParameter().

Whether to use an analytic Jacobian.

Definition at line 122 of file AbstractOdeSystem.hpp.

Referenced by AbstractOdeSystemWithAnalyticJacobian::AbstractOdeSystemWithAnalyticJacobian(), GetUseAnalyticJacobian(), and serialize().


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

Generated on Tue Aug 4 16:10:43 2009 for Chaste by  doxygen 1.5.5