AbstractCardiacCellInterface.hpp

00001 /*
00002 
00003 Copyright (c) 2005-2014, 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 
00062 class AbstractCardiacCellInterface
00063 {
00064 public:
00077     AbstractCardiacCellInterface(boost::shared_ptr<AbstractIvpOdeSolver> pOdeSolver,
00078                                  unsigned voltageIndex,
00079                                  boost::shared_ptr<AbstractStimulusFunction> pIntracellularStimulus);
00080 
00082     virtual ~AbstractCardiacCellInterface();
00083 
00089     virtual void SetTimestep(double dt)=0;
00090 
00098     virtual unsigned GetNumberOfStateVariables() const=0;
00099 
00105     virtual unsigned GetNumberOfParameters() const=0;
00106 
00116     virtual std::vector<double> GetStdVecStateVariables()=0;
00117 
00125     virtual const std::vector<std::string>& rGetStateVariableNames() const=0;
00126 
00127 
00135     virtual void SetStateVariables(const std::vector<double>& rVariables)=0;
00136 
00145     virtual void SetStateVariable(unsigned index, double newValue)=0;
00146 
00156     virtual void SetStateVariable(const std::string& rName, double newValue)=0;
00157 
00167     virtual double GetAnyVariable(const std::string& rName, double time)=0;
00168 
00177     virtual double GetParameter(const std::string& rParameterName)=0;
00178 
00187     virtual double GetParameter(unsigned parameterIndex)=0;
00188 
00197     virtual void SetParameter(const std::string& rParameterName, double value)=0;
00198 
00207     virtual void SolveAndUpdateState(double tStart, double tEnd)=0;
00208 
00219     virtual OdeSolution Compute(double tStart, double tEnd, double tSamp=0.0)=0;
00220 
00229     virtual void ComputeExceptVoltage(double tStart, double tEnd)=0;
00230 
00260     virtual double GetIIonic(const std::vector<double>* pStateVariables=NULL)=0;
00261 
00266     virtual void SetVoltage(double voltage)=0;
00267 
00271     virtual double GetVoltage()=0;
00272 
00279     unsigned GetVoltageIndex();
00280 
00286     void SetStimulusFunction(boost::shared_ptr<AbstractStimulusFunction> pStimulus);
00287 
00293     double GetStimulus(double time);
00294 
00301     void SetIntracellularStimulusFunction(boost::shared_ptr<AbstractStimulusFunction> pStimulus);
00302 
00310     double GetIntracellularStimulus(double time);
00311 
00318     double GetIntracellularAreaStimulus(double time);
00319 
00328     void SetUsedInTissueSimulation(bool tissue=true);
00329 
00337     virtual boost::shared_ptr<RegularStimulus> UseCellMLDefaultStimulus();
00338 
00342     bool HasCellMLDefaultStimulus();
00343 
00350     virtual AbstractLookupTableCollection* GetLookupTableCollection()
00351     {
00352         return NULL;
00353     }
00354 
00358     boost::shared_ptr<AbstractStimulusFunction> GetStimulusFunction();
00359 
00366     const boost::shared_ptr<AbstractStimulusFunction> GetStimulusFunction() const;
00367 
00374     const boost::shared_ptr<AbstractIvpOdeSolver> GetSolver() const;
00375 
00380     virtual void SetVoltageDerivativeToZero(bool clamp=true);
00381 
00389     void SetFixedVoltage(double voltage);
00390 
00398     virtual void SetStretch(double stretch)
00399     {
00400     }
00401 
00410     virtual double GetIntracellularCalciumConcentration();
00411 
00412 protected:
00419     unsigned mVoltageIndex;
00420 
00422     boost::shared_ptr<AbstractIvpOdeSolver> mpOdeSolver;
00423 
00425     boost::shared_ptr<AbstractStimulusFunction> mpIntracellularStimulus;
00426 
00432     bool mSetVoltageDerivativeToZero;
00433 
00435     bool mIsUsedInTissue;
00436 
00438     bool mHasDefaultStimulusFromCellML;
00439 
00441     double mFixedVoltage;
00442 
00443 private:
00445     friend class boost::serialization::access;
00452     template<class Archive>
00453     void serialize(Archive & archive, const unsigned int version)
00454     {
00455         // For version 0 these were archived by AbstractCardiacCell, now
00456         // we have AbstractCvodeCells too, so doing it here.
00457         if (version > 0)
00458         {
00459             archive & mSetVoltageDerivativeToZero;
00460             archive & mIsUsedInTissue;
00461             archive & mHasDefaultStimulusFromCellML;
00462             // archive & mFixedVoltage; - this doesn't need archiving as it is reset every PDE time step if used.
00463         }
00464         // archive & mVoltageIndex; - always set by constructor - called by concrete class
00465         // archive & mpOdeSolver; - always set by constructor - called by concrete class
00466         // archive & mpIntracellularStimulus; - always set by constructor - called by concrete class
00467     }
00468 };
00469 
00470 CLASS_IS_ABSTRACT(AbstractCardiacCellInterface)
00471 BOOST_CLASS_VERSION(AbstractCardiacCellInterface, 1)
00472 
00473 #endif /*ABSTRACTCARDIACCELLINTERFACE_HPP_*/

Generated by  doxygen 1.6.2