AbstractOdeSystem Class Reference

#include <AbstractOdeSystem.hpp>

Inherited by AbstractCardiacCell, AbstractOdeBasedContractionModel, AbstractOdeSystemWithAnalyticJacobian, CombinedOdeSystem, Mirams2010WntOdeSystem, VanLeeuwen2009WntSwatCellCycleOdeSystem, and WntCellCycleOdeSystem.

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< doubleGetInitialConditions () 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) const
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< doublemStateVariables
std::vector< doublemParameters
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

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 VanLeeuwen2009WntSwatCellCycleOdeSystem, WntCellCycleOdeSystem, and TysonNovak2001OdeSystem.

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

Reimplemented in VanLeeuwen2009WntSwatCellCycleOdeSystem, WntCellCycleOdeSystem, and TysonNovak2001OdeSystem.

Definition at line 42 of file AbstractOdeSystem.cpp.

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

std::string AbstractOdeSystem::DumpState ( const std::string &  rMessage,
std::vector< double Y = std::vector<double>() 
) [protected]
virtual void AbstractOdeSystem::EvaluateYDerivatives ( double  time,
const std::vector< double > &  rY,
std::vector< double > &  rDY 
) [pure virtual]
std::vector< double > AbstractOdeSystem::GetInitialConditions (  )  const
unsigned AbstractOdeSystem::GetNumberOfParameters (  )  const

Get the number of parameters.

Definition at line 71 of file AbstractOdeSystem.cpp.

References mParameters.

unsigned AbstractOdeSystem::GetNumberOfStateVariables (  )  const
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.

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

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.

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.

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.

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.

Referenced by AbstractOneStepIvpOdeSolver::Solve().

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().

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.

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::ChangeCellProliferativeTypeDueToCurrentBetaCateninLevel(), AbstractVanLeeuwen2009WntSwatCellCycleModel::ChangeCellProliferativeTypeDueToCurrentBetaCateninLevel(), AbstractCardiacCell::Compute(), AbstractBackwardEulerCardiacCell< SIZE >::Compute(), BackwardEulerLuoRudyIModel1991::ComputeJacobian(), BackwardEulerTenTusscher2006::ComputeOneStepExceptVoltage(), BackwardEulerNobleVargheseKohlNoble1998::ComputeOneStepExceptVoltage(), BackwardEulerMahajanModel2008::ComputeOneStepExceptVoltage(), BackwardEulerLuoRudyIModel1991::ComputeOneStepExceptVoltage(), BackwardEulerFoxModel2002Modified::ComputeOneStepExceptVoltage(), CML_luo_rudy_1991_pe_lut_be::ComputeOneStepExceptVoltage(), BackwardEulerLuoRudyIModel1991::ComputeResidual(), DumpState(), FakeBathCell::FakeBathCell(), Nash2004ContractionModel::GetActiveTension(), SingleOdeWntCellCycleModel::GetBetaCateninConcentration(), AbstractVanLeeuwen2009WntSwatCellCycleModel::GetCytoplasmicBetaCateninLevel(), CellShannon2004FromCellML::GetIIonic(), CML_noble_varghese_kohl_noble_1998_basic_pe_lut::GetIIonic(), CML_noble_varghese_kohl_noble_1998_basic::GetIIonic(), Maleckar2009OdeSystem::GetIIonic(), Mahajan2008OdeSystem::GetIIonic(), FoxModel2002Modified::GetIIonic(), FaberRudy2000Version3Optimised::GetIIonic(), FaberRudy2000Version3::GetIIonic(), BackwardEulerTenTusscher2006::GetIIonic(), BackwardEulerNobleVargheseKohlNoble1998::GetIIonic(), BackwardEulerMahajanModel2008::GetIIonic(), BackwardEulerFoxModel2002Modified::GetIIonic(), Cellluo_rudy_1991FromCellMLOpt::GetIIonic(), CML_luo_rudy_1991_pe_lut_be::GetIIonic(), Cellluo_rudy_1991FromCellML::GetIIonic(), AbstractVanLeeuwen2009WntSwatCellCycleModel::GetMembraneBoundBetaCateninLevel(), AbstractVanLeeuwen2009WntSwatCellCycleModel::GetNuclearBetaCateninLevel(), AbstractOdeBasedCellCycleModel::GetProteinConcentrations(), AbstractCardiacCell::GetVoltage(), SingleOdeWntCellCycleModel::load(), TysonNovakCellCycleModel::ResetForDivision(), AbstractWntOdeBasedCellCycleModel::ResetForDivision(), SingleOdeWntCellCycleModel::save(), AbstractOdeBasedCellCycleModel::serialize(), AbstractOdeBasedCellCycleModel::SetProteinConcentrationsForTestsOnly(), AbstractCardiacCell::SetVoltage(), SingleOdeWntCellCycleModel::SingleOdeWntCellCycleModel(), AbstractIvpOdeSolver::SolveAndUpdateStateVariable(), WntCellCycleModel::SolveOdeToTime(), AbstractVanLeeuwen2009WntSwatCellCycleModel::SolveOdeToTime(), SingleOdeWntCellCycleModel::UpdateBetaCateninLevel(), AbstractOdeBasedCellCycleModel::UpdateCellCyclePhase(), BackwardEulerTenTusscher2006::UpdateTransmembranePotential(), BackwardEulerNobleVargheseKohlNoble1998::UpdateTransmembranePotential(), BackwardEulerMahajanModel2008::UpdateTransmembranePotential(), BackwardEulerLuoRudyIModel1991::UpdateTransmembranePotential(), BackwardEulerFoxModel2002Modified::UpdateTransmembranePotential(), CML_luo_rudy_1991_pe_lut_be::UpdateTransmembranePotential(), TenTusscher2006OdeSystem::VerifyStateVariables(), LuoRudyIModel1991OdeSystem::VerifyStateVariables(), DiFrancescoNoble1985OdeSystem::VerifyStateVariables(), BackwardEulerNobleVargheseKohlNoble1998::VerifyStateVariables(), BackwardEulerLuoRudyIModel1991::VerifyStateVariables(), and WntCellCycleModel::WntCellCycleModel().

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(), and FoxModel2002Modified::EvaluateYDerivatives().

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.

template<class Archive >
void AbstractOdeSystem::serialize ( Archive &  archive,
const unsigned int  version 
) [inline, private]
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 Mirams2010WntOdeSystem::Mirams2010WntOdeSystem(), VanLeeuwen2009WntSwatCellCycleOdeSystem::VanLeeuwen2009WntSwatCellCycleOdeSystem(), and WntCellCycleOdeSystem::WntCellCycleOdeSystem().

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.

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.

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

Friends And Related Function Documentation

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

Member Data Documentation

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

Vector containing parameters.

Definition at line 112 of file AbstractOdeSystem.hpp.

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

Information about the concrete ODE system class.

Subclasses need to set this in their constructor to point to an instance of a suitable class. See for example the OdeSystemInformation class.

Definition at line 120 of file AbstractOdeSystem.hpp.

Referenced by BackwardEulerFoxModel2002Modified::BackwardEulerFoxModel2002Modified(), CombinedOdeSystem::CombinedOdeSystem(), AbstractBackwardEulerCardiacCell< SIZE >::Compute(), DiFrancescoNoble1985OdeSystem::DiFrancescoNoble1985OdeSystem(), FaberRudy2000Version3::FaberRudy2000Version3(), FakeBathCell::FakeBathCell(), FitzHughNagumo1961OdeSystem::FitzHughNagumo1961OdeSystem(), FoxModel2002Modified::FoxModel2002Modified(), GetInitialConditions(), GetStateVariableNumberByName(), GetStateVariableUnitsByNumber(), GetSystemInformation(), HodgkinHuxleySquidAxon1952OriginalOdeSystem::HodgkinHuxleySquidAxon1952OriginalOdeSystem(), BackwardEulerLuoRudyIModel1991::Init(), Kerchoffs2003ContractionModel::Kerchoffs2003ContractionModel(), LuoRudyIModel1991OdeSystem::LuoRudyIModel1991OdeSystem(), Mahajan2008OdeSystem::Mahajan2008OdeSystem(), Maleckar2009OdeSystem::Maleckar2009OdeSystem(), Mirams2010WntOdeSystem::Mirams2010WntOdeSystem(), Nash2004ContractionModel::Nash2004ContractionModel(), NhsContractionModel::NhsContractionModel(), rGetParameterNames(), rGetParameterUnits(), rGetVariableNames(), rGetVariableUnits(), SetInitialConditions(), SetInitialConditionsComponent(), TenTusscher2006OdeSystem::TenTusscher2006OdeSystem(), TysonNovak2001OdeSystem::TysonNovak2001OdeSystem(), VanLeeuwen2009WntSwatCellCycleOdeSystem::VanLeeuwen2009WntSwatCellCycleOdeSystem(), and WntCellCycleOdeSystem::WntCellCycleOdeSystem().

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

Whether to use an analytic Jacobian.

Definition at line 123 of file AbstractOdeSystem.hpp.

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


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

Generated by  doxygen 1.6.2