#include <AbstractCvodeCell.hpp>
Inherits AbstractCardiacCellInterface, and AbstractCvodeSystem.
Public Member Functions | |
AbstractCvodeCell (boost::shared_ptr< AbstractIvpOdeSolver > pSolver, unsigned numberOfStateVariables, unsigned voltageIndex, boost::shared_ptr< AbstractStimulusFunction > pIntracellularStimulus) | |
virtual | ~AbstractCvodeCell () |
double | GetVoltage () |
void | SetVoltage (double voltage) |
void | SetTimestep (double maxDt) |
virtual void | SolveAndUpdateState (double tStart, double tEnd) |
OdeSolution | Compute (double tStart, double tEnd, double tSamp=0.0) |
void | ComputeExceptVoltage (double tStart, double tEnd) |
void | SetVoltageDerivativeToZero (bool clamp=true) |
Private Attributes | |
double | mMaxDt |
A cardiac cell that is designed to be simulated using CVODE. It uses CVODE's vector type natively.
Functionality is similar to that provided by AbstractCardiacCell and AbstractOdeSystem, but not identical. It also includes a direct interface to the CVODE solver, via the Solve methods, since the CvodeAdaptor class doesn't work for us.
Assumes that it will be solving stiff systems, so uses BDF/Newton.
Note that a call to Solve will initialise the CVODE solver, and free its working memory when done. There is thus a non-trivial overhead involved.
Definition at line 59 of file AbstractCvodeCell.hpp.
AbstractCvodeCell::AbstractCvodeCell | ( | boost::shared_ptr< AbstractIvpOdeSolver > | pSolver, | |
unsigned | numberOfStateVariables, | |||
unsigned | voltageIndex, | |||
boost::shared_ptr< AbstractStimulusFunction > | pIntracellularStimulus | |||
) |
Create a new cardiac cell.
pSolver | not used for these cells (they're always solved with CVODE); may be empty | |
numberOfStateVariables | the size of the ODE system modelling this cell | |
voltageIndex | the index of the transmembrane potential within the vector of state variables | |
pIntracellularStimulus | the intracellular stimulus current |
Definition at line 41 of file AbstractCvodeCell.cpp.
AbstractCvodeCell::~AbstractCvodeCell | ( | ) | [virtual] |
Free the state variables, if they have been set.
Definition at line 52 of file AbstractCvodeCell.cpp.
OdeSolution AbstractCvodeCell::Compute | ( | double | tStart, | |
double | tEnd, | |||
double | tSamp = 0.0 | |||
) | [virtual] |
Simulates this cell's behaviour between the time interval [tStart, tEnd], and return state variable values.
The maximum time step to use will be taken as mMaxDt. If this is unset it is the same as the sampling interval, which defaults to HeartConfig::Instance()->GetPrintingTimeStep().
tStart | beginning of the time interval to simulate | |
tEnd | end of the time interval to simulate | |
tSamp | sampling interval for returned results (defaults to dt) |
Implements AbstractCardiacCellInterface.
Definition at line 84 of file AbstractCvodeCell.cpp.
References DOUBLE_UNSET, HeartConfig::GetPrintingTimeStep(), HeartConfig::Instance(), mMaxDt, SetTimestep(), and AbstractCvodeSystem::Solve().
Simulates this cell's behaviour between the time interval [tStart, tEnd], but does not update the voltage.
tStart | beginning of the time interval to simulate | |
tEnd | end of the time interval to simulate |
Implements AbstractCardiacCellInterface.
Definition at line 98 of file AbstractCvodeCell.cpp.
References EXCEPTION.
double AbstractCvodeCell::GetVoltage | ( | ) | [virtual] |
Get the current value of the transmembrane potential, as given in our state variable vector.
Implements AbstractCardiacCellInterface.
Definition at line 56 of file AbstractCvodeCell.cpp.
References AbstractParameterisedSystem< N_Vector >::GetAnyVariable(), AbstractParameterisedSystem< N_Vector >::mStateVariables, and AbstractCardiacCellInterface::mVoltageIndex.
void AbstractCvodeCell::SetTimestep | ( | double | maxDt | ) | [virtual] |
Set the maximum timestep to use for simulating this cell.
maxDt | the maximum timestep |
Implements AbstractCardiacCellInterface.
Definition at line 69 of file AbstractCvodeCell.cpp.
References mMaxDt.
Referenced by Compute(), and SolveAndUpdateState().
void AbstractCvodeCell::SetVoltage | ( | double | voltage | ) | [virtual] |
Set the transmembrane potential
voltage | new value |
Implements AbstractCardiacCellInterface.
Definition at line 62 of file AbstractCvodeCell.cpp.
References AbstractParameterisedSystem< N_Vector >::mStateVariables, AbstractCardiacCellInterface::mVoltageIndex, and AbstractParameterisedSystem< N_Vector >::SetAnyVariable().
void AbstractCvodeCell::SetVoltageDerivativeToZero | ( | bool | clamp = true |
) | [virtual] |
Set whether to clamp the voltage by setting its derivative to zero. We need to ensure CVODE is re-initialised if this setting changes.
clamp | whether to clamp |
Reimplemented from AbstractCardiacCellInterface.
Definition at line 104 of file AbstractCvodeCell.cpp.
References AbstractCardiacCellInterface::mSetVoltageDerivativeToZero, and AbstractCvodeSystem::ResetSolver().
Simulate this cell's behaviour between the time interval [tStart, tEnd], updating the internal state variable values.
The maximum time step to use is given by mMaxDt, which defaults to HeartConfig::Instance()->GetPrintingTimeStep() if unset.
tStart | beginning of the time interval to simulate | |
tEnd | end of the time interval to simulate |
Implements AbstractCardiacCellInterface.
Definition at line 75 of file AbstractCvodeCell.cpp.
References DOUBLE_UNSET, HeartConfig::Instance(), mMaxDt, SetTimestep(), and AbstractCvodeSystem::Solve().
double AbstractCvodeCell::mMaxDt [private] |
The maximum timestep to use.
Definition at line 63 of file AbstractCvodeCell.hpp.
Referenced by Compute(), SetTimestep(), and SolveAndUpdateState().