AbstractCardiacCellInterface.cpp

00001 /*
00002 
00003 Copyright (C) University of Oxford, 2005-2010
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 #include "AbstractCardiacCellInterface.hpp"
00030 
00031 #include "Exception.hpp"
00032 #include "HeartConfig.hpp"
00033 
00034 
00035 AbstractCardiacCellInterface::AbstractCardiacCellInterface(
00036             boost::shared_ptr<AbstractIvpOdeSolver> pOdeSolver,
00037             unsigned voltageIndex,
00038             boost::shared_ptr<AbstractStimulusFunction> pIntracellularStimulus)
00039     : mVoltageIndex(voltageIndex),
00040       mpOdeSolver(pOdeSolver),
00041       mpIntracellularStimulus(pIntracellularStimulus),
00042       mSetVoltageDerivativeToZero(false),
00043       mIsUsedInTissue(false),
00044       mHasDefaultStimulusFromCellML(false)
00045 {
00046 }
00047 
00048 
00049 AbstractCardiacCellInterface::~AbstractCardiacCellInterface()
00050 {
00051 }
00052 
00053 
00054 unsigned AbstractCardiacCellInterface::GetVoltageIndex()
00055 {
00056     return mVoltageIndex;
00057 }
00058 
00059 
00060 void AbstractCardiacCellInterface::SetStimulusFunction(boost::shared_ptr<AbstractStimulusFunction> pStimulus)
00061 {
00062     SetIntracellularStimulusFunction(pStimulus);
00063 }
00064 
00065 
00066 double AbstractCardiacCellInterface::GetStimulus(double time)
00067 {
00068     return GetIntracellularStimulus(time);
00069 }
00070 
00071 
00072 void AbstractCardiacCellInterface::SetIntracellularStimulusFunction(boost::shared_ptr<AbstractStimulusFunction> pStimulus)
00073 {
00074     mpIntracellularStimulus = pStimulus;
00075 }
00076 
00077 
00078 double AbstractCardiacCellInterface::GetIntracellularStimulus(double time)
00079 {
00080     return mpIntracellularStimulus->GetStimulus(time);
00081 }
00082 
00083 
00084 double AbstractCardiacCellInterface::GetIntracellularAreaStimulus(double time)
00085 {
00086     double stim;
00087     if (mIsUsedInTissue)
00088     {
00089         // Convert from uA/cm^3 to uA/cm^2 by dividing by Am
00090         stim = GetIntracellularStimulus(time) / HeartConfig::Instance()->GetSurfaceAreaToVolumeRatio();
00091     }
00092     else
00093     {
00094         stim = GetIntracellularStimulus(time);
00095     }
00096     return stim;
00097 }
00098 
00099 void AbstractCardiacCellInterface::SetUsedInTissueSimulation(bool tissue)
00100 {
00101     mIsUsedInTissue = tissue;
00102 }
00103 
00104 void AbstractCardiacCellInterface::UseCellMLDefaultStimulus()
00105 {
00106     assert(!mHasDefaultStimulusFromCellML);
00107     EXCEPTION("This class has no default stimulus from CellML metadata.");
00108 }
00109 
00110 bool AbstractCardiacCellInterface::HasCellMLDefaultStimulus()
00111 {
00112     return mHasDefaultStimulusFromCellML;
00113 }
00114 
00115 boost::shared_ptr<AbstractStimulusFunction> AbstractCardiacCellInterface::GetStimulusFunction()
00116 {
00117     return mpIntracellularStimulus;
00118 }
00119 
00120 // Methods needed by boost serialization.
00121 const boost::shared_ptr<AbstractStimulusFunction> AbstractCardiacCellInterface::GetStimulusFunction() const
00122 {
00123     return mpIntracellularStimulus;
00124 }
00125 
00126 const boost::shared_ptr<AbstractIvpOdeSolver> AbstractCardiacCellInterface::GetSolver() const
00127 {
00128     return mpOdeSolver;
00129 }

Generated on Mon Nov 1 12:35:16 2010 for Chaste by  doxygen 1.5.5