Chaste  Release::2018.1
AbstractCardiacCell Class Reference

#include <AbstractCardiacCell.hpp>

+ Inheritance diagram for AbstractCardiacCell:
+ Collaboration diagram for AbstractCardiacCell:

Public Member Functions

 AbstractCardiacCell (boost::shared_ptr< AbstractIvpOdeSolver > pOdeSolver, unsigned numberOfStateVariables, unsigned voltageIndex, boost::shared_ptr< AbstractStimulusFunction > pIntracellularStimulus)
 
virtual ~AbstractCardiacCell ()
 
void Init ()
 
void SetTimestep (double dt)
 
virtual void SolveAndUpdateState (double tStart, double tEnd)
 
virtual OdeSolution Compute (double tStart, double tEnd, double tSamp=0.0)
 
virtual void ComputeExceptVoltage (double tStart, double tEnd)
 
void SetVoltage (double voltage)
 
double GetVoltage ()
 
unsigned GetNumberOfStateVariables () const
 
unsigned GetNumberOfParameters () const
 
std::vector< doubleGetStdVecStateVariables ()
 
const std::vector< std::string > & rGetStateVariableNames () const
 
void SetStateVariables (const std::vector< double > &rVariables)
 
void SetStateVariable (unsigned index, double newValue)
 
void SetStateVariable (const std::string &rName, double newValue)
 
double GetAnyVariable (const std::string &rName, double time=0.0)
 
double GetParameter (const std::string &rParameterName)
 
double GetParameter (unsigned parameterIndex)
 
void SetParameter (const std::string &rParameterName, double value)
 
virtual void SetState (CellModelState state)
 
virtual void SetSlowValues (const std::vector< double > &rSlowValues)
 
virtual void GetSlowValues (std::vector< double > &rSlowValues)
 
virtual bool IsFastOnly ()
 
virtual void AdjustOutOfRangeSlowValues (std::vector< double > &rSlowValues)
 
virtual unsigned GetNumSlowValues ()
 
- Public Member Functions inherited from AbstractCardiacCellInterface
 AbstractCardiacCellInterface (boost::shared_ptr< AbstractIvpOdeSolver > pOdeSolver, unsigned voltageIndex, boost::shared_ptr< AbstractStimulusFunction > pIntracellularStimulus)
 
virtual ~AbstractCardiacCellInterface ()
 
virtual double GetIIonic (const std::vector< double > *pStateVariables=NULL)=0
 
unsigned GetVoltageIndex ()
 
void SetStimulusFunction (boost::shared_ptr< AbstractStimulusFunction > pStimulus)
 
double GetStimulus (double time)
 
void SetIntracellularStimulusFunction (boost::shared_ptr< AbstractStimulusFunction > pStimulus)
 
double GetIntracellularStimulus (double time)
 
double GetIntracellularAreaStimulus (double time)
 
void SetUsedInTissueSimulation (bool tissue=true)
 
virtual boost::shared_ptr
< RegularStimulus
UseCellMLDefaultStimulus ()
 
bool HasCellMLDefaultStimulus ()
 
virtual
AbstractLookupTableCollection
GetLookupTableCollection ()
 
boost::shared_ptr
< AbstractStimulusFunction
GetStimulusFunction ()
 
const boost::shared_ptr
< AbstractStimulusFunction
GetStimulusFunction () const
 
const boost::shared_ptr
< AbstractIvpOdeSolver
GetSolver () const
 
void SetSolver (boost::shared_ptr< AbstractIvpOdeSolver > pSolver)
 
virtual void SetVoltageDerivativeToZero (bool clamp=true)
 
void SetFixedVoltage (double voltage)
 
virtual void SetStretch (double stretch)
 
virtual double GetIntracellularCalciumConcentration ()
 
- Public Member Functions inherited from AbstractOdeSystem
 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
 
- Public Member Functions inherited from AbstractParameterisedSystem< std::vector< double > >
 AbstractParameterisedSystem (unsigned numberOfStateVariables)
 
std::vector< double > & rGetStateVariables ()
 
std::vector< doubleGetStateVariables ()
 
void SetStateVariables (const std::vector< double > &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 std::vector< double > &rInitialConditions)
 
void SetDefaultInitialCondition (unsigned index, double initialCondition)
 
std::vector< doubleGetInitialConditions () 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, std::vector< double > *pDerivedQuantities=NULL)
 
double GetAnyVariable (const std::string &rName, double time=0.0, std::vector< double > *pDerivedQuantities=NULL)
 
void SetAnyVariable (unsigned index, double value)
 
void SetAnyVariable (const std::string &rName, double value)
 
virtual std::vector< doubleComputeDerivedQuantities (double time, const std::vector< double > &rState)
 
std::vector< doubleComputeDerivedQuantitiesFromCurrentState (double time)
 
- Public Member Functions inherited from AbstractUntemplatedParameterisedSystem
 AbstractUntemplatedParameterisedSystem (unsigned numberOfStateVariables)
 
virtual ~AbstractUntemplatedParameterisedSystem ()
 
boost::shared_ptr< const
AbstractOdeSystemInformation
GetSystemInformation () const
 
std::string GetSystemName () const
 
unsigned GetNumberOfAttributes () const
 
bool HasAttribute (const std::string &rName) const
 
double GetAttribute (const std::string &rName) const
 
unsigned GetNumberOfStateVariables () const
 
const std::vector< std::string > & rGetStateVariableNames () const
 
const std::vector< std::string > & rGetStateVariableUnits () const
 
unsigned GetStateVariableIndex (const std::string &rName) const
 
bool HasStateVariable (const std::string &rName) const
 
std::string GetStateVariableUnits (unsigned index) const
 
unsigned GetNumberOfParameters () const
 
const std::vector< std::string > & rGetParameterNames () const
 
const std::vector< std::string > & rGetParameterUnits () const
 
unsigned GetParameterIndex (const std::string &rName) const
 
bool HasParameter (const std::string &rName) const
 
std::string GetParameterUnits (unsigned index) const
 
unsigned GetNumberOfDerivedQuantities () const
 
const std::vector< std::string > & rGetDerivedQuantityNames () const
 
const std::vector< std::string > & rGetDerivedQuantityUnits () const
 
unsigned GetDerivedQuantityIndex (const std::string &rName) const
 
bool HasDerivedQuantity (const std::string &rName) const
 
std::string GetDerivedQuantityUnits (unsigned index) const
 
unsigned GetAnyVariableIndex (const std::string &rName) const
 
bool HasAnyVariable (const std::string &rName) const
 
std::string GetAnyVariableUnits (unsigned index) const
 
std::string GetAnyVariableUnits (const std::string &rName) const
 

Protected Attributes

double mDt
 
- Protected Attributes inherited from AbstractCardiacCellInterface
unsigned mVoltageIndex
 
boost::shared_ptr
< AbstractIvpOdeSolver
mpOdeSolver
 
boost::shared_ptr
< AbstractStimulusFunction
mpIntracellularStimulus
 
bool mSetVoltageDerivativeToZero
 
bool mIsUsedInTissue
 
bool mHasDefaultStimulusFromCellML
 
double mFixedVoltage
 
- Protected Attributes inherited from AbstractOdeSystem
bool mUseAnalyticJacobian
 
- Protected Attributes inherited from AbstractParameterisedSystem< std::vector< double > >
std::vector< doublemStateVariables
 
std::vector< doublemParameters
 
- Protected Attributes inherited from AbstractUntemplatedParameterisedSystem
unsigned mNumberOfStateVariables
 
boost::shared_ptr
< AbstractOdeSystemInformation
mpSystemInfo
 

Private Member Functions

template<class Archive >
void serialize (Archive &archive, const unsigned int version)
 
void CheckForArchiveFix ()
 

Friends

class boost::serialization::access
 

Additional Inherited Members

- Protected Member Functions inherited from AbstractParameterisedSystem< std::vector< double > >
std::string DumpState (const std::string &rMessage)
 
std::string DumpState (const std::string &rMessage, std::vector< double >Y)
 
std::string DumpState (const std::string &rMessage, std::vector< double >Y, double time)
 
void CheckParametersOnLoad (const std::vector< double > &rParameters, const std::vector< std::string > &rParameterNames)
 

Detailed Description

This is the base class for ode-based cardiac cell models.

It is essentially a cardiac-specific wrapper for ODE systems providing an interface which can interact with the stimulus classes and the voltage in a mono/bidomain simulation.

Concrete classes can be autogenerated from CellML files by the PyCml package, and will automatically inherit from this class.

Definition at line 74 of file AbstractCardiacCell.hpp.

Constructor & Destructor Documentation

AbstractCardiacCell::AbstractCardiacCell ( boost::shared_ptr< AbstractIvpOdeSolver pOdeSolver,
unsigned  numberOfStateVariables,
unsigned  voltageIndex,
boost::shared_ptr< AbstractStimulusFunction pIntracellularStimulus 
)

Create a new cardiac cell. The state variables of the cell will be set to AbstractOdeSystemInformation::GetInitialConditions(). Note that calls to SetDefaultInitialConditions() on a particular instance of this class will not modify its state variables. You can modify them directly with rGetStateVariables().

Parameters
pOdeSolverthe ODE solver to use when simulating this cell
numberOfStateVariablesthe size of the ODE system modelling this cell
voltageIndexthe index of the transmembrane potential within the vector of state variables
pIntracellularStimulusthe intracellular stimulus current

Definition at line 43 of file AbstractCardiacCell.cpp.

References AbstractUntemplatedParameterisedSystem::mNumberOfStateVariables.

AbstractCardiacCell::~AbstractCardiacCell ( )
virtual

Virtual destructor

Definition at line 55 of file AbstractCardiacCell.cpp.

Member Function Documentation

void AbstractCardiacCell::AdjustOutOfRangeSlowValues ( std::vector< double > &  rSlowValues)
virtual

In a multiscale simulation a cut-down cell model can be run:

  • fast values are calculated according to the CellML definition
  • slow values are interpolated on synchronisation time-steps. There's a chance that linear interpolation/extrapolation may push some gating variable out of the range [0, 1]. This method alters any values which are out-of-range.
Note
This must be implemented by fast/slow cardiac cell subclasses.
Parameters
rSlowValuesA vector of the slow values for a particular cell after they have been interpolated from nearby coarse cells

Definition at line 223 of file AbstractCardiacCell.cpp.

References EXCEPTION.

void AbstractCardiacCell::CheckForArchiveFix ( )
private

The Luo-Rudy 1991 model saved in previous Chaste versions had a different ordering of state variables.

It also didn't save mParameters.

Gary: Any changes to other cell models won't work anyway, and as the comment above says, these cells won't work in tissue. We also don't seem to have been checking for optimised cell models. So I think we should retire this conversion with a NEVER_REACHED.

If we're loading that model, we could permute the state vector. This can't (easily) be done in the LR91 code itself, since that is auto-generated!

Definition at line 169 of file AbstractCardiacCell.cpp.

References NEVER_REACHED.

Referenced by serialize().

OdeSolution AbstractCardiacCell::Compute ( double  tStart,
double  tEnd,
double  tSamp = 0.0 
)
virtual

Simulates this cell's behaviour between the time interval [tStart, tEnd], with timestep mDt, and return state variable values.

Parameters
tStartbeginning of the time interval to simulate
tEndend of the time interval to simulate
tSampsampling interval for returned results (defaults to mDt)
Returns
solution object

Implements AbstractCardiacCellInterface.

Reimplemented in AbstractBackwardEulerCardiacCell< 0u >, AbstractBackwardEulerCardiacCell< SIZE >, AbstractGeneralizedRushLarsenCardiacCell, and AbstractRushLarsenCardiacCell.

Definition at line 75 of file AbstractCardiacCell.cpp.

References mDt, AbstractCardiacCellInterface::mpOdeSolver, and AbstractParameterisedSystem< std::vector< double > >::rGetStateVariables().

void AbstractCardiacCell::ComputeExceptVoltage ( double  tStart,
double  tEnd 
)
virtual

Simulates this cell's behaviour between the time interval [tStart, tEnd], with timestep mDt, but does not update the voltage.

Parameters
tStartbeginning of the time interval to simulate
tEndend of the time interval to simulate

Implements AbstractCardiacCellInterface.

Reimplemented in AbstractBackwardEulerCardiacCell< 0u >, AbstractBackwardEulerCardiacCell< SIZE >, AbstractGeneralizedRushLarsenCardiacCell, AbstractRushLarsenCardiacCell, and FakeBathCell.

Definition at line 84 of file AbstractCardiacCell.cpp.

References GetVoltage(), mDt, AbstractCardiacCellInterface::mpOdeSolver, SetVoltage(), AbstractCardiacCellInterface::SetVoltageDerivativeToZero(), and AbstractParameterisedSystem< std::vector< double > >::VerifyStateVariables().

double AbstractCardiacCell::GetAnyVariable ( const std::string &  rName,
double  time = 0.0 
)
virtual

This just calls the method AbstractOdeSystem::GetAnyVariable

It is here (despite being inherited) because we seem to need to specify explicitly which method in the parent classes we intend to implement to take care of the pure definition in AbstractCardiacCellInterface.

Parameters
rNamevariable name
timethe time at which you want it
Returns
value of the variable at that time

Implements AbstractCardiacCellInterface.

Definition at line 147 of file AbstractCardiacCell.cpp.

References AbstractParameterisedSystem< std::vector< double > >::GetAnyVariable().

Referenced by LuoRudySpiralWaveCellFactory::CreateCardiacCellForTissueNode().

unsigned AbstractCardiacCell::GetNumberOfParameters ( ) const
virtual

This just returns the number of parameters in the cell model.

It is here because we seem to need to specify explicitly which method in the parent classes we intend to implement to take care of the pure definition in AbstractCardiacCellInterface

Returns
the number of parameters

Implements AbstractCardiacCellInterface.

Definition at line 117 of file AbstractCardiacCell.cpp.

References AbstractUntemplatedParameterisedSystem::GetNumberOfParameters().

unsigned AbstractCardiacCell::GetNumberOfStateVariables ( ) const
virtual

This just returns the number of state variables in the cell model.

It is here because we seem to need to specify explicitly which method in the parent classes we intend to implement to take care of the pure definition in AbstractCardiacCellInterface

Returns
the number of state variables

Implements AbstractCardiacCellInterface.

Definition at line 112 of file AbstractCardiacCell.cpp.

References AbstractUntemplatedParameterisedSystem::GetNumberOfStateVariables().

unsigned AbstractCardiacCell::GetNumSlowValues ( )
virtual
Returns
the number of slow variables for the cell model (irrespective of whether in fast or slow mode).
Note
This must be implemented by fast/slow cardiac cell subclasses.

Definition at line 218 of file AbstractCardiacCell.cpp.

References EXCEPTION.

double AbstractCardiacCell::GetParameter ( const std::string &  rParameterName)
virtual

This just calls AbstractOdeSystem::GetParameter

It is here (despite being inherited) because we seem to need to specify explicitly which method in the parent classes we intend to implement to take care of the pure definition in AbstractCardiacCellInterface.

Parameters
rParameterNamethe name of a parameter to get the value of,
Returns
the parameter's value.

Implements AbstractCardiacCellInterface.

Definition at line 152 of file AbstractCardiacCell.cpp.

References AbstractParameterisedSystem< std::vector< double > >::GetParameter().

double AbstractCardiacCell::GetParameter ( unsigned  parameterIndex)
virtual

This just calls AbstractOdeSystem::GetParameter

It is here (despite being inherited) because we seem to need to specify explicitly which method in the parent classes we intend to implement to take care of the pure definition in AbstractCardiacCellInterface.

Parameters
parameterIndexthe index of a parameter to get the value of,
Returns
the parameter's value.

Implements AbstractCardiacCellInterface.

Definition at line 157 of file AbstractCardiacCell.cpp.

References AbstractParameterisedSystem< std::vector< double > >::GetParameter().

void AbstractCardiacCell::GetSlowValues ( std::vector< double > &  rSlowValues)
virtual
Returns
the current values of the slow variables. Should only be valid in slow mode.
Note
This must be implemented by fast/slow cardiac cell subclasses.
Parameters
rSlowValueswill be filled in with the values of the slow variables on return.

Definition at line 208 of file AbstractCardiacCell.cpp.

References EXCEPTION.

std::vector< double > AbstractCardiacCell::GetStdVecStateVariables ( )
virtual

This just returns the state variables in the cell model.

It is here (despite being inherited) because we seem to need to specify explicitly which method in the parent classes we intend to implement to take care of the pure definition in AbstractCardiacCellInterface.

Returns
the state variables

Implements AbstractCardiacCellInterface.

Definition at line 122 of file AbstractCardiacCell.cpp.

References AbstractParameterisedSystem< std::vector< double > >::GetStateVariables().

double AbstractCardiacCell::GetVoltage ( )
virtual
Returns
the current value of the transmembrane potential, as given in our state variable vector.

Implements AbstractCardiacCellInterface.

Definition at line 107 of file AbstractCardiacCell.cpp.

References AbstractParameterisedSystem< std::vector< double > >::GetAnyVariable(), and AbstractCardiacCellInterface::mVoltageIndex.

Referenced by ComputeExceptVoltage().

bool AbstractCardiacCell::IsFastOnly ( )
virtual
Returns
whether this cell is a fast or slow version.
Note
This must be implemented by fast/slow cardiac cell subclasses.

Definition at line 213 of file AbstractCardiacCell.cpp.

References EXCEPTION.

const std::vector< std::string > & AbstractCardiacCell::rGetStateVariableNames ( ) const
virtual

Just calls AbstractOdeSystem::rGetStateVariableNames().

It is here (despite being inherited) because we seem to need to specify explicitly which method in the parent classes we intend to implement to take care of the pure definition in AbstractCardiacCellInterface.

Returns
the state variable names in the cell's ODE system.

Implements AbstractCardiacCellInterface.

Definition at line 127 of file AbstractCardiacCell.cpp.

References AbstractUntemplatedParameterisedSystem::rGetStateVariableNames().

template<class Archive >
void AbstractCardiacCell::serialize ( Archive &  archive,
const unsigned int  version 
)
inlineprivate
void AbstractCardiacCell::SetParameter ( const std::string &  rParameterName,
double  value 
)
virtual

This just calls AbstractOdeSystem::SetParameter

It is here (despite being inherited) because we seem to need to specify explicitly which method in the parent classes we intend to implement to take care of the pure definition in AbstractCardiacCellInterface.

Parameters
rParameterNamethe parameter name to set the value of,
valuevalue to set it to.

Implements AbstractCardiacCellInterface.

Definition at line 162 of file AbstractCardiacCell.cpp.

References AbstractParameterisedSystem< std::vector< double > >::SetParameter().

Referenced by LuoRudySpiralWaveCellFactory::CreateCardiacCellForTissueNode().

void AbstractCardiacCell::SetSlowValues ( const std::vector< double > &  rSlowValues)
virtual

Set the slow variables. Should only be valid in fast mode.

Note
This must be implemented by fast/slow cardiac cell subclasses.
Parameters
rSlowValuesvalues for the slow variables

Definition at line 203 of file AbstractCardiacCell.cpp.

References EXCEPTION.

void AbstractCardiacCell::SetState ( CellModelState  state)
virtual

This should be implemented by fast/slow cardiac cell subclasses, and

  • set the state
  • initialise the cell
  • SET mNumberOfStateVariables CORRECTLY (as this would not have been known in the constructor.
Note
This must be implemented by fast/slow cardiac cell subclasses.
Parameters
statewhether this cell is in fast or slow mode.

Definition at line 198 of file AbstractCardiacCell.cpp.

References EXCEPTION.

void AbstractCardiacCell::SetStateVariable ( unsigned  index,
double  newValue 
)
virtual

This just calls the method AbstractOdeSystem::SetStateVariable

It is here (despite being inherited) because we seem to need to specify explicitly which method in the parent classes we intend to implement to take care of the pure definition in AbstractCardiacCellInterface.

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

Implements AbstractCardiacCellInterface.

Definition at line 137 of file AbstractCardiacCell.cpp.

References AbstractParameterisedSystem< std::vector< double > >::SetStateVariable().

void AbstractCardiacCell::SetStateVariable ( const std::string &  rName,
double  newValue 
)
virtual

This just calls the method AbstractOdeSystem::SetStateVariable

It is here (despite being inherited) because we seem to need to specify explicitly which method in the parent classes we intend to implement to take care of the pure definition in AbstractCardiacCellInterface.

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

Implements AbstractCardiacCellInterface.

Definition at line 142 of file AbstractCardiacCell.cpp.

References AbstractParameterisedSystem< std::vector< double > >::SetStateVariable().

void AbstractCardiacCell::SetStateVariables ( const std::vector< double > &  rVariables)
virtual

This just sets the state variables in the cell model.

It is here (despite being inherited) because we seem to need to specify explicitly which method in the parent classes we intend to implement to take care of the pure definition in AbstractCardiacCellInterface.

Parameters
rVariablesthe state variables (to take a copy of).

Implements AbstractCardiacCellInterface.

Definition at line 132 of file AbstractCardiacCell.cpp.

References AbstractParameterisedSystem< std::vector< double > >::SetStateVariables().

void AbstractCardiacCell::SetTimestep ( double  dt)
virtual

Set the timestep to use for simulating this cell.

Parameters
dtthe timestep

Implements AbstractCardiacCellInterface.

Definition at line 65 of file AbstractCardiacCell.cpp.

References mDt.

void AbstractCardiacCell::SetVoltage ( double  voltage)
virtual
void AbstractCardiacCell::SolveAndUpdateState ( double  tStart,
double  tEnd 
)
virtual

Simulate this cell's behaviour between the time interval [tStart, tEnd], with timestemp mDt, updating the internal state variable values.

Parameters
tStartbeginning of the time interval to simulate
tEndend of the time interval to simulate

Implements AbstractCardiacCellInterface.

Reimplemented in AbstractBackwardEulerCardiacCell< 0u >, AbstractBackwardEulerCardiacCell< SIZE >, AbstractGeneralizedRushLarsenCardiacCell, and AbstractRushLarsenCardiacCell.

Definition at line 70 of file AbstractCardiacCell.cpp.

References mDt, and AbstractCardiacCellInterface::mpOdeSolver.

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Needed for serialization.

Definition at line 78 of file AbstractCardiacCell.hpp.

Member Data Documentation


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