AbstractCardiacCellInterface.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #include "HeartConfig.hpp"
00037 #include "AbstractCardiacCellInterface.hpp"
00038 #include "Exception.hpp"
00039
00040 #include "Citations.hpp"
00041 static PetscBool CardiacCellChasteCite = PETSC_FALSE;
00042 const char CardiacCellChasteCitation[] = "@article{cooper2015cce,\n"
00043 " title = {{Cellular cardiac electrophysiology modelling with Chaste and CellML}},\n"
00044 " author = {Cooper, Jonathan and Spiteri, Raymond and Mirams, Gary R},\n"
00045 " year = {2015},\n"
00046 " journal = {Frontiers in Physiology},\n"
00047 " pages = {511},\n"
00048 " url = {http://journal.frontiersin.org/Journal/10.3389/fphys.2014.00511},\n"
00049 " volume = {5},\n"
00050 " doi = {10.3389/fphys.2014.00511},\n"
00051 "}\n";
00052
00053 AbstractCardiacCellInterface::AbstractCardiacCellInterface(
00054 boost::shared_ptr<AbstractIvpOdeSolver> pOdeSolver,
00055 unsigned voltageIndex,
00056 boost::shared_ptr<AbstractStimulusFunction> pIntracellularStimulus)
00057 : mVoltageIndex(voltageIndex),
00058 mpOdeSolver(pOdeSolver),
00059 mpIntracellularStimulus(pIntracellularStimulus),
00060 mSetVoltageDerivativeToZero(false),
00061 mIsUsedInTissue(false),
00062 mHasDefaultStimulusFromCellML(false),
00063 mFixedVoltage(DOUBLE_UNSET)
00064 {
00065
00066
00067 Citations::Register(CardiacCellChasteCitation, &CardiacCellChasteCite);
00068 }
00069
00070
00071 AbstractCardiacCellInterface::~AbstractCardiacCellInterface()
00072 {
00073 }
00074
00075
00076 unsigned AbstractCardiacCellInterface::GetVoltageIndex()
00077 {
00078 return mVoltageIndex;
00079 }
00080
00081
00082 void AbstractCardiacCellInterface::SetStimulusFunction(boost::shared_ptr<AbstractStimulusFunction> pStimulus)
00083 {
00084 SetIntracellularStimulusFunction(pStimulus);
00085 }
00086
00087
00088 double AbstractCardiacCellInterface::GetStimulus(double time)
00089 {
00090 return GetIntracellularStimulus(time);
00091 }
00092
00093
00094 void AbstractCardiacCellInterface::SetIntracellularStimulusFunction(boost::shared_ptr<AbstractStimulusFunction> pStimulus)
00095 {
00096 mpIntracellularStimulus = pStimulus;
00097 }
00098
00099
00100 double AbstractCardiacCellInterface::GetIntracellularStimulus(double time)
00101 {
00102 return mpIntracellularStimulus->GetStimulus(time);
00103 }
00104
00105
00106 double AbstractCardiacCellInterface::GetIntracellularAreaStimulus(double time)
00107 {
00108 double stim;
00109 if (mIsUsedInTissue)
00110 {
00111
00112 stim = GetIntracellularStimulus(time) / HeartConfig::Instance()->GetSurfaceAreaToVolumeRatio();
00113 }
00114 else
00115 {
00116 stim = GetIntracellularStimulus(time);
00117 }
00118 return stim;
00119 }
00120
00121 void AbstractCardiacCellInterface::SetUsedInTissueSimulation(bool tissue)
00122 {
00123 mIsUsedInTissue = tissue;
00124 }
00125
00126 boost::shared_ptr<RegularStimulus> AbstractCardiacCellInterface::UseCellMLDefaultStimulus()
00127 {
00128 assert(!mHasDefaultStimulusFromCellML);
00129 EXCEPTION("This class has no default stimulus from CellML metadata.");
00130 return boost::shared_ptr<RegularStimulus>();
00131 }
00132
00133 bool AbstractCardiacCellInterface::HasCellMLDefaultStimulus()
00134 {
00135 return mHasDefaultStimulusFromCellML;
00136 }
00137
00138 boost::shared_ptr<AbstractStimulusFunction> AbstractCardiacCellInterface::GetStimulusFunction()
00139 {
00140 return mpIntracellularStimulus;
00141 }
00142
00143
00144 const boost::shared_ptr<AbstractStimulusFunction> AbstractCardiacCellInterface::GetStimulusFunction() const
00145 {
00146 return mpIntracellularStimulus;
00147 }
00148
00149 const boost::shared_ptr<AbstractIvpOdeSolver> AbstractCardiacCellInterface::GetSolver() const
00150 {
00151 return mpOdeSolver;
00152 }
00153
00154 void AbstractCardiacCellInterface::SetSolver(boost::shared_ptr<AbstractIvpOdeSolver> pSolver)
00155 {
00156 mpOdeSolver = pSolver;
00157 }
00158
00159 void AbstractCardiacCellInterface::SetVoltageDerivativeToZero(bool clamp)
00160 {
00161 mSetVoltageDerivativeToZero = clamp;
00162 if (clamp)
00163 {
00164 mFixedVoltage = GetVoltage();
00165 }
00166 }
00167
00168 void AbstractCardiacCellInterface::SetFixedVoltage(double voltage)
00169 {
00170 mFixedVoltage = voltage;
00171 }
00172
00173 double AbstractCardiacCellInterface::GetIntracellularCalciumConcentration()
00174 {
00175 EXCEPTION("AbstractCardiacCellInterface::GetIntracellularCalciumConcentration() called. "
00176 "Either model has no [Ca_i] or method has not been implemented yet");
00177 }
00178
00179