Chaste Release::3.1
AbstractParameterisedSystem< VECTOR > Class Template Reference

#include <AbstractParameterisedSystem.hpp>

Inheritance diagram for AbstractParameterisedSystem< VECTOR >:
Collaboration diagram for AbstractParameterisedSystem< VECTOR >:

List of all members.

Public Member Functions

 AbstractParameterisedSystem (unsigned numberOfStateVariables)
VECTOR & rGetStateVariables ()
VECTOR GetStateVariables ()
void SetStateVariables (const VECTOR &rStateVariables)
double GetStateVariable (unsigned index) const
double GetStateVariable (const std::string &rName) const
void SetStateVariable (unsigned index, double newValue)
void SetStateVariable (const std::string &rName, double newValue)
virtual void VerifyStateVariables ()
void SetDefaultInitialConditions (const VECTOR &rInitialConditions)
void SetDefaultInitialCondition (unsigned index, double initialCondition)
VECTOR GetInitialConditions () const
void ResetToInitialConditions ()
double GetParameter (unsigned index) const
double GetParameter (const std::string &rName) const
void SetParameter (const std::string &rName, double value)
void SetParameter (unsigned index, double value)
double GetAnyVariable (unsigned index, double time=0.0, VECTOR *pDerivedQuantities=NULL)
double GetAnyVariable (const std::string &rName, double time=0.0, VECTOR *pDerivedQuantities=NULL)
void SetAnyVariable (unsigned index, double value)
void SetAnyVariable (const std::string &rName, double value)
virtual VECTOR ComputeDerivedQuantities (double time, const VECTOR &rState)
VECTOR ComputeDerivedQuantitiesFromCurrentState (double time)

Protected Member Functions

std::string DumpState (const std::string &rMessage)
std::string DumpState (const std::string &rMessage, VECTOR Y)
void CheckParametersOnLoad (const std::vector< double > &rParameters, const std::vector< std::string > &rParameterNames)

Protected Attributes

VECTOR mStateVariables
VECTOR mParameters

Private Member Functions

std::string GetStateMessage (const std::string &message, VECTOR Y)

Friends

class TestAbstractCvodeSystem

Detailed Description

template<typename VECTOR>
class AbstractParameterisedSystem< VECTOR >

This class contains the state variable and parameter vectors for an ODE system, along with methods to access these.

Its main purpose is to be a common base class for both AbstractOdeSystem and AbstractCvodeSystem, which require similar functionality but use different vector types.

Definition at line 55 of file AbstractParameterisedSystem.hpp.


Constructor & Destructor Documentation

template<typename VECTOR >
AbstractParameterisedSystem< VECTOR >::AbstractParameterisedSystem ( unsigned  numberOfStateVariables)

Constructor.

Parameters:
numberOfStateVariablesthe number of state variables in the ODE system

Definition at line 46 of file AbstractParameterisedSystem.cpp.

References InitialiseEmptyVector(), AbstractParameterisedSystem< VECTOR >::mParameters, and AbstractParameterisedSystem< VECTOR >::mStateVariables.


Member Function Documentation

template<typename VECTOR >
void AbstractParameterisedSystem< VECTOR >::CheckParametersOnLoad ( const std::vector< double > &  rParameters,
const std::vector< std::string > &  rParameterNames 
) [protected]

This method is called by subclasses on completion of the load method of serialization.

It checks that the parameters that were loaded match those that should be in the class, and fills in with default values any that are missing. Hence this method updates mParameters.

Parameters:
rParametersthe parameters that were loaded.
rParameterNamesthe parameter names that were loaded.

Definition at line 80 of file AbstractParameterisedSystem.cpp.

References CreateVectorIfEmpty(), EXCEPTION, GetVectorSize(), and SetVectorComponent().

template<typename VECTOR>
VECTOR AbstractParameterisedSystem< VECTOR >::ComputeDerivedQuantities ( double  time,
const VECTOR &  rState 
) [virtual]

Compute the derived quantities from the given system state. Uses the current values for the parameters.

Parameters:
timethe time at which to compute the derived quantities
rStatevalues for the state variables

Definition at line 337 of file AbstractParameterisedSystem.cpp.

References EXCEPTION.

Referenced by OdeSolution::rGetDerivedQuantities().

template<typename VECTOR >
VECTOR AbstractParameterisedSystem< VECTOR >::ComputeDerivedQuantitiesFromCurrentState ( double  time)

Compute the derived quantities based on the current system state.

Parameters:
timethe time at which to compute the derived quantities

Definition at line 344 of file AbstractParameterisedSystem.cpp.

template<typename VECTOR >
std::string AbstractParameterisedSystem< VECTOR >::DumpState ( const std::string &  rMessage) [protected]

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

Parameters:
rMessagethe exception message

Definition at line 54 of file AbstractParameterisedSystem.cpp.

template<typename VECTOR>
std::string AbstractParameterisedSystem< VECTOR >::DumpState ( const std::string &  rMessage,
VECTOR  Y 
) [protected]

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

Parameters:
rMessagethe exception message
Ythe values of the state variables

Definition at line 60 of file AbstractParameterisedSystem.cpp.

template<typename VECTOR>
double AbstractParameterisedSystem< VECTOR >::GetAnyVariable ( unsigned  index,
double  time = 0.0,
VECTOR *  pDerivedQuantities = NULL 
)

Get the value of a variable, whether a state variable, parameter, or derived quantity.

Note that if the variable is a derived quantity, this method will compute all derived quantities, so may not be very efficient. To avoid this, pass a pre-computed vector of derived quantities as the optional third argument.

Parameters:
indexthe index of the variable, as given by GetAnyVariableIndex.
timethe current simulation time, possibly needed if the variable is a derived quantity.
pDerivedQuantitiesoptional vector of pre-computed derived quantity values.

Definition at line 265 of file AbstractParameterisedSystem.cpp.

References DeleteVector(), EXCEPTION, GetVectorComponent(), and GetVectorSize().

template<typename VECTOR>
double AbstractParameterisedSystem< VECTOR >::GetAnyVariable ( const std::string &  rName,
double  time = 0.0,
VECTOR *  pDerivedQuantities = NULL 
)

Get the value of a variable, whether a state variable, parameter, or derived quantity.

Note that if the variable is a derived quantity, this method will compute all derived quantities, so may not be very efficient. To avoid this, pass a pre-computed vector of derived quantities as the optional third argument.

Parameters:
rNamethe name of the variable, (this method is the same as doing GetAnyVariableIndex(rName) and then calling the method above).
timethe current simulation time, possibly needed if the variable is a derived quantity.
pDerivedQuantitiesoptional vector of pre-computed derived quantity values.

Definition at line 302 of file AbstractParameterisedSystem.cpp.

template<typename VECTOR >
double AbstractParameterisedSystem< VECTOR >::GetParameter ( unsigned  index) const

Get the value of a given parameter.

Parameters:
indexthe index of the parameter

Definition at line 229 of file AbstractParameterisedSystem.cpp.

References EXCEPTION, GetVectorComponent(), and GetVectorSize().

Referenced by DeltaNotchCellCycleModel::GetMeanNeighbouringDelta(), and OdeSolution::rGetParameters().

template<typename VECTOR >
double AbstractParameterisedSystem< VECTOR >::GetParameter ( const std::string &  rName) const

Get the value of a given parameter.

Parameters:
rNamethe name of the parameter

Definition at line 255 of file AbstractParameterisedSystem.cpp.

template<typename VECTOR>
std::string AbstractParameterisedSystem< VECTOR >::GetStateMessage ( const std::string &  message,
VECTOR  Y 
) [private]

Helper method to construct a string containing a dump of the vector

Parameters:
messagea string to prefix (e.g. an error or the name of the vector)
Ya vector
Returns:
a string containing the contents of the vector.

Definition at line 67 of file AbstractParameterisedSystem.cpp.

References GetVectorComponent(), and GetVectorSize().

template<typename VECTOR >
double AbstractParameterisedSystem< VECTOR >::GetStateVariable ( unsigned  index) const

Get the value of a given state variable.

Parameters:
indexthe index of the state variable

Definition at line 145 of file AbstractParameterisedSystem.cpp.

References EXCEPTION, and GetVectorComponent().

template<typename VECTOR >
double AbstractParameterisedSystem< VECTOR >::GetStateVariable ( const std::string &  rName) const

Get the value of a given state variable.

Parameters:
rNamethe name of the state variable

Definition at line 155 of file AbstractParameterisedSystem.cpp.

template<typename VECTOR >
VECTOR AbstractParameterisedSystem< VECTOR >::GetStateVariables ( )

Get a copy of the state variable vector. Caller takes responsibility for deleting the returned vector (if required for the VECTOR type).

Definition at line 125 of file AbstractParameterisedSystem.cpp.

References CopyVector().

template<typename VECTOR >
void AbstractParameterisedSystem< VECTOR >::ResetToInitialConditions ( )

Reset the system's state variables to the default initial conditions.

Definition at line 217 of file AbstractParameterisedSystem.cpp.

References DeleteVector().

template<typename VECTOR >
VECTOR & AbstractParameterisedSystem< VECTOR >::rGetStateVariables ( )

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

Definition at line 119 of file AbstractParameterisedSystem.cpp.

Referenced by WntCellCycleModel::AdjustOdeParameters(), SingleOdeWntCellCycleModel::AdjustOdeParameters(), AbstractVanLeeuwen2009WntSwatCellCycleModel::AdjustOdeParameters(), Alarcon2004OxygenBasedCellCycleModel::AdjustOdeParameters(), WntCellCycleModel::ChangeCellProliferativeTypeDueToCurrentBetaCateninLevel(), AbstractVanLeeuwen2009WntSwatCellCycleModel::ChangeCellProliferativeTypeDueToCurrentBetaCateninLevel(), WntCellCycleModel::CreateCellCycleModel(), VanLeeuwen2009WntSwatCellCycleModelHypothesisTwo::CreateCellCycleModel(), VanLeeuwen2009WntSwatCellCycleModelHypothesisOne::CreateCellCycleModel(), StochasticWntCellCycleModel::CreateCellCycleModel(), SingleOdeWntCellCycleModel::CreateCellCycleModel(), TysonNovakCellCycleModel::CreateCellCycleModel(), DeltaNotchCellCycleModel::CreateCellCycleModel(), Alarcon2004OxygenBasedCellCycleModel::CreateCellCycleModel(), SingleOdeWntCellCycleModel::GetBetaCateninConcentration(), AbstractVanLeeuwen2009WntSwatCellCycleModel::GetCytoplasmicBetaCateninLevel(), DeltaNotchCellCycleModel::GetDelta(), AbstractVanLeeuwen2009WntSwatCellCycleModel::GetMembraneBoundBetaCateninLevel(), DeltaNotchCellCycleModel::GetNotch(), AbstractVanLeeuwen2009WntSwatCellCycleModel::GetNuclearBetaCateninLevel(), AbstractOdeBasedCellCycleModel::GetProteinConcentrations(), AbstractWntOdeBasedCellCycleModel::ResetForDivision(), TysonNovakCellCycleModel::ResetForDivision(), Alarcon2004OxygenBasedCellCycleModel::ResetForDivision(), AbstractOdeBasedCellCycleModel::SetProteinConcentrationsForTestsOnly(), AbstractIvpOdeSolver::SolveAndUpdateStateVariable(), and AbstractOdeBasedCellCycleModel::UpdateCellCyclePhase().

template<typename VECTOR >
void AbstractParameterisedSystem< VECTOR >::SetAnyVariable ( unsigned  index,
double  value 
)

Set the value of a variable, whether a state variable or parameter. Attempting to set the value of a derived quantity will raise an exception.

Parameters:
indexthe index of the variable, as given by GetAnyVariableIndex.
valuethe value to give the variable.

Definition at line 310 of file AbstractParameterisedSystem.cpp.

References EXCEPTION, GetVectorSize(), and SetVectorComponent().

template<typename VECTOR >
void AbstractParameterisedSystem< VECTOR >::SetAnyVariable ( const std::string &  rName,
double  value 
)

Set the value of a variable, whether a state variable or parameter. Attempting to set the value of a derived quantity will raise an exception.

Parameters:
rNamethe name of the variable.
valuethe value to give the variable.

Definition at line 327 of file AbstractParameterisedSystem.cpp.

template<typename VECTOR >
void AbstractParameterisedSystem< VECTOR >::SetDefaultInitialCondition ( unsigned  index,
double  initialCondition 
)

Set a single component of the default initial conditions for the system.

Note:
The default initial conditions are shared among all instances of the particular concrete system class.
This method DOES NOT change the state variables of the object on which it is called.
Parameters:
indexthe index of the state variable in the system
initialConditionthe initial value for the state variable

Definition at line 195 of file AbstractParameterisedSystem.cpp.

References EXCEPTION.

template<typename VECTOR>
void AbstractParameterisedSystem< VECTOR >::SetDefaultInitialConditions ( const VECTOR &  rInitialConditions)

Set the default initial conditions for the system.

Note:
The default initial conditions are shared among all instances of the particular concrete system class.
This method DOES NOT change the state variables of the object on which it is called.
Parameters:
rInitialConditionsvector containing initial values for the state variables

Definition at line 182 of file AbstractParameterisedSystem.cpp.

References CopyToStdVector(), EXCEPTION, and GetVectorSize().

template<typename VECTOR >
void AbstractParameterisedSystem< VECTOR >::SetParameter ( const std::string &  rName,
double  value 
)

Set the value of a given parameter.

Parameters:
rNamethe name of the parameter
valuethe value

Reimplemented in AbstractCardiacCell, and AbstractCvodeCell.

Definition at line 249 of file AbstractParameterisedSystem.cpp.

References SetVectorComponent().

Referenced by DeltaNotchCellCycleModel::CreateCellCycleModel(), and DeltaNotchCellCycleModel::UpdateDeltaNotch().

template<typename VECTOR >
void AbstractParameterisedSystem< VECTOR >::SetParameter ( unsigned  index,
double  value 
)

Set the value of a given parameter.

Parameters:
indexthe index of the parameter
valuethe value

Reimplemented in AbstractCardiacCell, and AbstractCvodeCell.

Definition at line 239 of file AbstractParameterisedSystem.cpp.

References EXCEPTION, GetVectorSize(), and SetVectorComponent().

template<typename VECTOR >
void AbstractParameterisedSystem< VECTOR >::SetStateVariable ( const std::string &  rName,
double  newValue 
)

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

Parameters:
rNamename of the state variable to be set
newValuenew value of the state variable

Reimplemented in AbstractCardiacCell, and AbstractCvodeCell.

Definition at line 171 of file AbstractParameterisedSystem.cpp.

template<typename VECTOR >
void AbstractParameterisedSystem< VECTOR >::SetStateVariable ( unsigned  index,
double  newValue 
)

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

Parameters:
indexindex of the state variable to be set
newValuenew value of the state variable

Reimplemented in AbstractCardiacCell, and AbstractCvodeCell.

Definition at line 161 of file AbstractParameterisedSystem.cpp.

References EXCEPTION, and SetVectorComponent().

template<typename VECTOR>
void AbstractParameterisedSystem< VECTOR >::SetStateVariables ( const VECTOR &  rStateVariables)

Set the state variables equal to the values in the given vector, copying it. Caller thus maintains responsibility for deleting the input vector (if required for the VECTOR type).

Parameters:
rStateVariablesnew values for the state variables

Reimplemented in AbstractCardiacCell, and AbstractCvodeCell.

Definition at line 131 of file AbstractParameterisedSystem.cpp.

References CreateVectorIfEmpty(), EXCEPTION, GetVectorComponent(), GetVectorSize(), and SetVectorComponent().

Referenced by WntCellCycleModel::Initialise(), SingleOdeWntCellCycleModel::Initialise(), AbstractVanLeeuwen2009WntSwatCellCycleModel::Initialise(), TysonNovakCellCycleModel::Initialise(), DeltaNotchCellCycleModel::Initialise(), TysonNovakCellCycleModel::ResetForDivision(), AbstractOdeBasedCellCycleModel::SetProteinConcentrationsForTestsOnly(), and CellCycleModelOdeHandler::SetStateVariables().

template<typename VECTOR>
virtual void AbstractParameterisedSystem< VECTOR >::VerifyStateVariables ( ) [inline, virtual]

Empty method which can be over-ridden and used in solvers to go through the current state vector and do range checking on the values (e.g. check that concentrations are positive and probabilities are between zero and one).

This method is overridden with a currently commented out method in AbstractCardiacCell which would be called by the ComputeExceptVoltage method (in heart).

This method is called by the AbstractCvodeSystem::Solve() method (in ode).

Reimplemented in CorriasBuistICCModified, and CorriasBuistSMCModified.

Definition at line 181 of file AbstractParameterisedSystem.hpp.


Member Data Documentation

template<typename VECTOR>
VECTOR AbstractParameterisedSystem< VECTOR >::mParameters [protected]

Vector containing parameter values.

Definition at line 74 of file AbstractParameterisedSystem.hpp.

Referenced by AbstractParameterisedSystem< VECTOR >::AbstractParameterisedSystem().

template<typename VECTOR>
VECTOR AbstractParameterisedSystem< VECTOR >::mStateVariables [protected]

Vector containing the current values of the state variables.

Definition at line 71 of file AbstractParameterisedSystem.hpp.

Referenced by AbstractParameterisedSystem< VECTOR >::AbstractParameterisedSystem().


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