AbstractCardiacCellInterface.hpp

00001 /*
00002 
00003 Copyright (c) 2005-2015, University of Oxford.
00004 All rights reserved.
00005 
00006 University of Oxford means the Chancellor, Masters and Scholars of the
00007 University of Oxford, having an administrative office at Wellington
00008 Square, Oxford OX1 2JD, UK.
00009 
00010 This file is part of Chaste.
00011 
00012 Redistribution and use in source and binary forms, with or without
00013 modification, are permitted provided that the following conditions are met:
00014  * Redistributions of source code must retain the above copyright notice,
00015    this list of conditions and the following disclaimer.
00016  * Redistributions in binary form must reproduce the above copyright notice,
00017    this list of conditions and the following disclaimer in the documentation
00018    and/or other materials provided with the distribution.
00019  * Neither the name of the University of Oxford nor the names of its
00020    contributors may be used to endorse or promote products derived from this
00021    software without specific prior written permission.
00022 
00023 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00024 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00025 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00026 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
00027 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00028 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
00029 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00030 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00031 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
00032 OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00033 
00034 */
00035 
00036 #ifndef ABSTRACTCARDIACCELLINTERFACE_HPP_
00037 #define ABSTRACTCARDIACCELLINTERFACE_HPP_
00038 
00039 #include <boost/shared_ptr.hpp>
00040 
00041 #include "ChasteSerialization.hpp"
00042 #include "ChasteSerializationVersion.hpp"
00043 #include "ClassIsAbstract.hpp"
00044 
00045 #include "AbstractIvpOdeSolver.hpp"
00046 #include "RegularStimulus.hpp"
00047 #include "OdeSolution.hpp"
00048 #include "AbstractLookupTableCollection.hpp"
00049 
00058 class AbstractCardiacCellInterface
00059 {
00060 public:
00073     AbstractCardiacCellInterface(boost::shared_ptr<AbstractIvpOdeSolver> pOdeSolver,
00074                                  unsigned voltageIndex,
00075                                  boost::shared_ptr<AbstractStimulusFunction> pIntracellularStimulus);
00076 
00078     virtual ~AbstractCardiacCellInterface();
00079 
00085     virtual void SetTimestep(double dt)=0;
00086 
00094     virtual unsigned GetNumberOfStateVariables() const=0;
00095 
00101     virtual unsigned GetNumberOfParameters() const=0;
00102 
00112     virtual std::vector<double> GetStdVecStateVariables()=0;
00113 
00121     virtual const std::vector<std::string>& rGetStateVariableNames() const=0;
00122 
00123 
00131     virtual void SetStateVariables(const std::vector<double>& rVariables)=0;
00132 
00141     virtual void SetStateVariable(unsigned index, double newValue)=0;
00142 
00152     virtual void SetStateVariable(const std::string& rName, double newValue)=0;
00153 
00163     virtual double GetAnyVariable(const std::string& rName, double time)=0;
00164 
00173     virtual double GetParameter(const std::string& rParameterName)=0;
00174 
00183     virtual double GetParameter(unsigned parameterIndex)=0;
00184 
00193     virtual void SetParameter(const std::string& rParameterName, double value)=0;
00194 
00203     virtual void SolveAndUpdateState(double tStart, double tEnd)=0;
00204 
00215     virtual OdeSolution Compute(double tStart, double tEnd, double tSamp=0.0)=0;
00216 
00225     virtual void ComputeExceptVoltage(double tStart, double tEnd)=0;
00226 
00256     virtual double GetIIonic(const std::vector<double>* pStateVariables=NULL)=0;
00257 
00262     virtual void SetVoltage(double voltage)=0;
00263 
00267     virtual double GetVoltage()=0;
00268 
00275     unsigned GetVoltageIndex();
00276 
00282     void SetStimulusFunction(boost::shared_ptr<AbstractStimulusFunction> pStimulus);
00283 
00289     double GetStimulus(double time);
00290 
00297     void SetIntracellularStimulusFunction(boost::shared_ptr<AbstractStimulusFunction> pStimulus);
00298 
00306     double GetIntracellularStimulus(double time);
00307 
00314     double GetIntracellularAreaStimulus(double time);
00315 
00324     void SetUsedInTissueSimulation(bool tissue=true);
00325 
00333     virtual boost::shared_ptr<RegularStimulus> UseCellMLDefaultStimulus();
00334 
00338     bool HasCellMLDefaultStimulus();
00339 
00346     virtual AbstractLookupTableCollection* GetLookupTableCollection()
00347     {
00348         return NULL;
00349     }
00350 
00354     boost::shared_ptr<AbstractStimulusFunction> GetStimulusFunction();
00355 
00362     const boost::shared_ptr<AbstractStimulusFunction> GetStimulusFunction() const;
00363 
00370     const boost::shared_ptr<AbstractIvpOdeSolver> GetSolver() const;
00371 
00379     void SetSolver(boost::shared_ptr<AbstractIvpOdeSolver> pSolver);
00380 
00385     virtual void SetVoltageDerivativeToZero(bool clamp=true);
00386 
00394     void SetFixedVoltage(double voltage);
00395 
00403     virtual void SetStretch(double stretch)
00404     {
00405     }
00406 
00415     virtual double GetIntracellularCalciumConcentration();
00416 
00417 protected:
00424     unsigned mVoltageIndex;
00425 
00427     boost::shared_ptr<AbstractIvpOdeSolver> mpOdeSolver;
00428 
00430     boost::shared_ptr<AbstractStimulusFunction> mpIntracellularStimulus;
00431 
00437     bool mSetVoltageDerivativeToZero;
00438 
00440     bool mIsUsedInTissue;
00441 
00443     bool mHasDefaultStimulusFromCellML;
00444 
00446     double mFixedVoltage;
00447 
00448 private:
00450     friend class boost::serialization::access;
00457     template<class Archive>
00458     void serialize(Archive & archive, const unsigned int version)
00459     {
00460         // For version 0 these were archived by AbstractCardiacCell, now
00461         // we have AbstractCvodeCells too, so doing it here.
00462         if (version > 0)
00463         {
00464             archive & mSetVoltageDerivativeToZero;
00465             archive & mIsUsedInTissue;
00466             archive & mHasDefaultStimulusFromCellML;
00467             // archive & mFixedVoltage; - this doesn't need archiving as it is reset every PDE time step if used.
00468         }
00469         // archive & mVoltageIndex; - always set by constructor - called by concrete class
00470         // archive & mpOdeSolver; - always set by constructor - called by concrete class
00471         // archive & mpIntracellularStimulus; - always set by constructor - called by concrete class
00472     }
00473 };
00474 
00475 CLASS_IS_ABSTRACT(AbstractCardiacCellInterface)
00476 BOOST_CLASS_VERSION(AbstractCardiacCellInterface, 1)
00477 
00478 #endif /*ABSTRACTCARDIACCELLINTERFACE_HPP_*/

Generated by  doxygen 1.6.2