AbstractCardiacCell.hpp
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 #ifndef ABSTRACTCARDIACCELL_HPP_
00037 #define ABSTRACTCARDIACCELL_HPP_
00038
00039 #include "ChasteSerialization.hpp"
00040 #include "ChasteSerializationVersion.hpp"
00041 #include "ClassIsAbstract.hpp"
00042 #include <boost/serialization/base_object.hpp>
00043 #include <boost/shared_ptr.hpp>
00044 #include <boost/serialization/shared_ptr.hpp>
00045
00046
00047
00048 #include "UblasVectorInclude.hpp"
00049
00050 #include "AbstractCardiacCellInterface.hpp"
00051 #include "AbstractOdeSystem.hpp"
00052 #include "AbstractIvpOdeSolver.hpp"
00053 #include "AbstractStimulusFunction.hpp"
00054
00055 #include <vector>
00056
00057 typedef enum _CellModelState
00058 {
00059 STATE_UNSET = 0,
00060 FAST_VARS_ONLY,
00061 ALL_VARS
00062 } CellModelState;
00063
00074 class AbstractCardiacCell : public AbstractCardiacCellInterface, public AbstractOdeSystem
00075 {
00076 private:
00078 friend class boost::serialization::access;
00085 template<class Archive>
00086 void serialize(Archive & archive, const unsigned int version)
00087 {
00088
00089 archive & boost::serialization::base_object<AbstractOdeSystem>(*this);
00090
00091 if (version > 0)
00092 {
00093 archive & boost::serialization::base_object<AbstractCardiacCellInterface>(*this);
00094 }
00095 archive & mDt;
00096
00097
00098
00099 if (version <= 1)
00100 {
00101 archive & this->mSetVoltageDerivativeToZero;
00102 if (version > 0)
00103 {
00104
00105
00106
00107 archive & this->mIsUsedInTissue;
00108 archive & this->mHasDefaultStimulusFromCellML;
00109 }
00110 }
00111
00112 if (version == 0)
00113 {
00114 CheckForArchiveFix();
00115 }
00116
00117
00118 assert(this->mParameters.size() == this->rGetParameterNames().size());
00119 }
00120
00133 void CheckForArchiveFix();
00134
00135 protected:
00137 double mDt;
00138
00139 public:
00151 AbstractCardiacCell(boost::shared_ptr<AbstractIvpOdeSolver> pOdeSolver,
00152 unsigned numberOfStateVariables,
00153 unsigned voltageIndex,
00154 boost::shared_ptr<AbstractStimulusFunction> pIntracellularStimulus);
00155
00157 virtual ~AbstractCardiacCell();
00158
00166 void Init();
00167
00173 void SetTimestep(double dt);
00174
00182 virtual void SolveAndUpdateState(double tStart, double tEnd);
00183
00193 virtual OdeSolution Compute(double tStart, double tEnd, double tSamp=0.0);
00194
00202 virtual void ComputeExceptVoltage(double tStart, double tEnd);
00203
00207 void SetVoltage(double voltage);
00208
00213 double GetVoltage();
00214
00215
00225 unsigned GetNumberOfStateVariables() const;
00226
00236 unsigned GetNumberOfParameters() const;
00237
00247 std::vector<double> GetStdVecStateVariables();
00248
00258 const std::vector<std::string>& rGetStateVariableNames() const;
00259
00260
00270 void SetStateVariables(const std::vector<double>& rVariables);
00271
00282 void SetStateVariable(unsigned index, double newValue);
00283
00294 void SetStateVariable(const std::string& rName, double newValue);
00295
00307 double GetAnyVariable(const std::string& rName, double time=0.0);
00308
00319 double GetParameter(const std::string& rParameterName);
00320
00331 double GetParameter(unsigned parameterIndex);
00332
00343 void SetParameter(const std::string& rParameterName, double value);
00344
00346
00348
00360 virtual void SetState(CellModelState state);
00361
00369 virtual void SetSlowValues(const std::vector<double> &rSlowValues);
00370
00378 virtual void GetSlowValues(std::vector<double>& rSlowValues);
00379
00384 virtual bool IsFastOnly();
00385
00398 virtual void AdjustOutOfRangeSlowValues(std::vector<double>& rSlowValues);
00399
00406 virtual unsigned GetNumSlowValues();
00407
00408 };
00409
00410 CLASS_IS_ABSTRACT(AbstractCardiacCell)
00411 BOOST_CLASS_VERSION(AbstractCardiacCell, 2)
00412
00413 #endif