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 #ifndef _BACKWARDEULERLUORUDYIMODEL1991_HPP_ 00029 #define _BACKWARDEULERLUORUDYIMODEL1991_HPP_ 00030 00031 #include <boost/serialization/access.hpp> 00032 #include <boost/serialization/base_object.hpp> 00033 00034 #include "AbstractStimulusFunction.hpp" 00035 #include "AbstractBackwardEulerCardiacCell.hpp" 00036 00037 #include <vector> 00038 00039 // Needs to be included last 00040 #include <boost/serialization/export.hpp> 00041 00046 class BackwardEulerLuoRudyIModel1991 : public AbstractBackwardEulerCardiacCell<1> 00047 { 00048 private: 00050 friend class boost::serialization::access; 00057 template<class Archive> 00058 void serialize(Archive & archive, const unsigned int version) 00059 { 00060 // This calls serialize on the base class. 00061 archive & boost::serialization::base_object<AbstractBackwardEulerCardiacCell<1> >(*this); 00062 } 00063 /* 00064 * Constants for the LuoRudyIModel1991OdeSystem model 00065 */ 00066 static const double membrane_C; 00067 static const double membrane_F; 00068 static const double membrane_R; 00069 static const double membrane_T; 00070 static const double background_current_E_b; 00071 static const double background_current_g_b; 00072 static const double fast_sodium_current_g_Na; 00073 static const double ionic_concentrations_Ki; 00074 static const double ionic_concentrations_Ko; 00075 static const double ionic_concentrations_Nai; 00076 static const double ionic_concentrations_Nao; 00077 static const double plateau_potassium_current_g_Kp; 00078 static const double time_dependent_potassium_current_PR_NaK; 00081 double fast_sodium_current_E_Na; 00082 00083 00084 public: 00090 BackwardEulerLuoRudyIModel1991(boost::shared_ptr<AbstractStimulusFunction> pIntracellularStimulus); 00091 00097 BackwardEulerLuoRudyIModel1991(boost::shared_ptr<AbstractIvpOdeSolver> /* unused */, 00098 boost::shared_ptr<AbstractStimulusFunction> pIntracellularStimulus); 00099 00103 ~BackwardEulerLuoRudyIModel1991(); 00104 00108 void Init(); 00109 00110 protected: 00117 void ComputeOneStepExceptVoltage(double tStart); 00118 00124 void UpdateTransmembranePotential(double time); 00125 00126 public: 00133 void ComputeResidual(const double rCurrentGuess[1], double rResidual[1]); 00134 00141 void ComputeJacobian(const double rCurrentGuess[1], double rJacobian[1][1]); 00142 00147 double GetIIonic(); 00148 00153 void VerifyStateVariables(); 00154 00158 double GetIntracellularCalciumConcentration(); 00159 }; 00160 00161 BOOST_CLASS_EXPORT(BackwardEulerLuoRudyIModel1991) 00162 00163 namespace boost 00164 { 00165 namespace serialization 00166 { 00171 template<class Archive> 00172 inline void save_construct_data( 00173 Archive & ar, const BackwardEulerLuoRudyIModel1991 * t, const unsigned int file_version) 00174 { 00175 const boost::shared_ptr<AbstractIvpOdeSolver> p_solver = t->GetSolver(); 00176 const boost::shared_ptr<AbstractStimulusFunction> p_stimulus = t->GetStimulusFunction(); 00177 ar << p_solver; 00178 ar << p_stimulus; 00179 } 00180 00187 template<class Archive> 00188 inline void load_construct_data( 00189 Archive & ar, BackwardEulerLuoRudyIModel1991 * t, const unsigned int file_version) 00190 { 00191 boost::shared_ptr<AbstractIvpOdeSolver> p_solver; 00192 boost::shared_ptr<AbstractStimulusFunction> p_stimulus; 00193 ar >> p_solver; 00194 ar >> p_stimulus; 00195 ::new(t)BackwardEulerLuoRudyIModel1991(p_solver, p_stimulus); 00196 } 00197 } 00198 } // namespace ... 00199 00200 #endif // _BACKWARDEULERLUORUDYIMODEL1991_HPP_