AbstractCardiacCell.hpp

00001 /*
00002 
00003 Copyright (C) University of Oxford, 2005-2009
00004 
00005 University of Oxford means the Chancellor, Masters and Scholars of the
00006 University of Oxford, having an administrative office at Wellington
00007 Square, Oxford OX1 2JD, UK.
00008 
00009 This file is part of Chaste.
00010 
00011 Chaste is free software: you can redistribute it and/or modify it
00012 under the terms of the GNU Lesser General Public License as published
00013 by the Free Software Foundation, either version 2.1 of the License, or
00014 (at your option) any later version.
00015 
00016 Chaste is distributed in the hope that it will be useful, but WITHOUT
00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
00019 License for more details. The offer of Chaste under the terms of the
00020 License is subject to the License being interpreted in accordance with
00021 English Law and subject to any action against the University of Oxford
00022 being under the jurisdiction of the English Courts.
00023 
00024 You should have received a copy of the GNU Lesser General Public License
00025 along with Chaste. If not, see <http://www.gnu.org/licenses/>.
00026 
00027 */
00028 
00029 
00030 #ifndef ABSTRACTCARDIACCELL_HPP_
00031 #define ABSTRACTCARDIACCELL_HPP_
00032 
00033 #include "AbstractOdeSystem.hpp"
00034 #include "AbstractIvpOdeSolver.hpp"
00035 #include "AbstractStimulusFunction.hpp"
00036 #include "HeartConfig.hpp"
00037 
00038 #include <vector>
00039 
00040 typedef enum _CellModelState
00041 {
00042     STATE_UNSET = 0,
00043     FAST_VARS_ONLY,
00044     ALL_VARS
00045 } CellModelState;
00046 
00050 class AbstractCardiacCell : public AbstractOdeSystem
00051 {
00052 
00053 protected:
00054     unsigned mVoltageIndex;  
00055     AbstractIvpOdeSolver *mpOdeSolver;   
00056     double mDt;
00057     AbstractStimulusFunction* mpIntracellularStimulus;
00058 
00059     // flag set to true if ComputeExceptVoltage is called
00060     bool mSetVoltageDerivativeToZero;
00061 
00062 public:
00063 
00064     AbstractCardiacCell(AbstractIvpOdeSolver *pOdeSolver,
00065                         unsigned numberOfStateVariables,
00066                         unsigned voltageIndex,
00067                         AbstractStimulusFunction* intracellularStimulus);
00068 
00069     virtual ~AbstractCardiacCell();
00070 
00076     virtual void Init();
00077 
00082     virtual OdeSolution Compute(double tStart, double tEnd);
00083 
00088     virtual void ComputeExceptVoltage(double tStart, double tEnd);
00089 
00094     virtual double GetIIonic() = 0;
00095 
00096     void SetVoltage(double voltage);
00097 
00098     double GetVoltage();
00099 
00100     unsigned GetVoltageIndex();
00101 
00102     void SetStimulusFunction(AbstractStimulusFunction *stimulus);
00103 
00104     double GetStimulus(double time);
00105 
00106     void SetIntracellularStimulusFunction(AbstractStimulusFunction *stimulus);
00107 
00108     double GetIntracellularStimulus(double time);
00109 
00117     virtual double GetIntracellularCalciumConcentration();
00118 
00125     virtual void VerifyStateVariables()
00126     {
00133 //        for(std::set<unsigned>::iterator iter = mGatingVariableIndices.begin();
00134 //            iter != mGatingVariableIndices.end();
00135 //            ++iter)
00136 //        {
00137 //            double value = mStateVariables[*iter];
00138 //            if(value<0.0)
00139 //            {
00140 //                std::stringstream error;
00141 //                error << "State variable " << *iter << ", a gating variable, has gone negative";
00142 //                EXCEPTION(DumpState(error.str()));
00143 //            }
00144 //            if(value>1.0)
00145 //            { 
00146 //                std::stringstream error;
00147 //                error << "State variable " << *iter << ", a gating variable, has become greater than one";
00148 //                EXCEPTION(DumpState(error.str()));
00149 //            }
00150 //        }
00151 //        
00152 //        for(std::set<unsigned>::iterator iter = mConcentrationIndices.begin();
00153 //            iter != mConcentrationIndices.end();
00154 //            ++iter)
00155 //        {
00156 //            if(mStateVariables[*iter] < 0.0)
00157 //            {
00158 //                std::stringstream error;
00159 //                error << "State variable " << *iter << ", a concentration, has gone negative";
00160 //                EXCEPTION(DumpState(error.str()));
00161 //            }
00162 //        }
00163     }    
00164 
00165 
00166 
00168     //  METHODS NEEDED BY FAST CARDIAC CELLS
00170     
00176     virtual void SetState(CellModelState state);
00177 
00179     virtual void SetSlowValues(const std::vector<double> &rSlowValues);
00180 
00182     virtual void GetSlowValues(std::vector<double>& rSlowValues);
00183     
00185     virtual bool IsFastOnly();
00186     
00187     virtual void AdjustOutOfRangeSlowValues(std::vector<double>& rSlowValues);
00188 
00193     virtual unsigned GetNumSlowValues();
00194     
00195 };
00196 
00197 #endif /*ABSTRACTCARDIACCELL_HPP_*/

Generated on Wed Mar 18 12:51:51 2009 for Chaste by  doxygen 1.5.5