AbstractCardiacCellInterface.cpp

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

Generated on Mon Apr 18 11:35:28 2011 for Chaste by  doxygen 1.5.5