Chaste  Release::2017.1
AbstractCardiacCellInterface.hpp
1 /*
2 
3 Copyright (c) 2005-2017, University of Oxford.
4 All rights reserved.
5 
6 University of Oxford means the Chancellor, Masters and Scholars of the
7 University of Oxford, having an administrative office at Wellington
8 Square, Oxford OX1 2JD, UK.
9 
10 This file is part of Chaste.
11 
12 Redistribution and use in source and binary forms, with or without
13 modification, are permitted provided that the following conditions are met:
14  * Redistributions of source code must retain the above copyright notice,
15  this list of conditions and the following disclaimer.
16  * Redistributions in binary form must reproduce the above copyright notice,
17  this list of conditions and the following disclaimer in the documentation
18  and/or other materials provided with the distribution.
19  * Neither the name of the University of Oxford nor the names of its
20  contributors may be used to endorse or promote products derived from this
21  software without specific prior written permission.
22 
23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
29 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
32 OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 
34 */
35 
36 #ifndef ABSTRACTCARDIACCELLINTERFACE_HPP_
37 #define ABSTRACTCARDIACCELLINTERFACE_HPP_
38 
39 #include <boost/shared_ptr.hpp>
40 
41 #include "ChasteSerialization.hpp"
43 #include "ClassIsAbstract.hpp"
44 
45 #include "AbstractIvpOdeSolver.hpp"
46 #include "RegularStimulus.hpp"
47 #include "OdeSolution.hpp"
48 #include "AbstractLookupTableCollection.hpp"
49 
59 {
60 public:
73  AbstractCardiacCellInterface(boost::shared_ptr<AbstractIvpOdeSolver> pOdeSolver,
74  unsigned voltageIndex,
75  boost::shared_ptr<AbstractStimulusFunction> pIntracellularStimulus);
76 
79 
85  virtual void SetTimestep(double dt)=0;
86 
94  virtual unsigned GetNumberOfStateVariables() const=0;
95 
101  virtual unsigned GetNumberOfParameters() const=0;
102 
112  virtual std::vector<double> GetStdVecStateVariables()=0;
113 
121  virtual const std::vector<std::string>& rGetStateVariableNames() const=0;
122 
123 
131  virtual void SetStateVariables(const std::vector<double>& rVariables)=0;
132 
141  virtual void SetStateVariable(unsigned index, double newValue)=0;
142 
152  virtual void SetStateVariable(const std::string& rName, double newValue)=0;
153 
163  virtual double GetAnyVariable(const std::string& rName, double time)=0;
164 
173  virtual double GetParameter(const std::string& rParameterName)=0;
174 
183  virtual double GetParameter(unsigned parameterIndex)=0;
184 
193  virtual void SetParameter(const std::string& rParameterName, double value)=0;
194 
203  virtual void SolveAndUpdateState(double tStart, double tEnd)=0;
204 
215  virtual OdeSolution Compute(double tStart, double tEnd, double tSamp=0.0)=0;
216 
225  virtual void ComputeExceptVoltage(double tStart, double tEnd)=0;
226 
256  virtual double GetIIonic(const std::vector<double>* pStateVariables=NULL)=0;
257 
262  virtual void SetVoltage(double voltage)=0;
263 
267  virtual double GetVoltage()=0;
268 
275  unsigned GetVoltageIndex();
276 
282  void SetStimulusFunction(boost::shared_ptr<AbstractStimulusFunction> pStimulus);
283 
289  double GetStimulus(double time);
290 
297  void SetIntracellularStimulusFunction(boost::shared_ptr<AbstractStimulusFunction> pStimulus);
298 
306  double GetIntracellularStimulus(double time);
307 
314  double GetIntracellularAreaStimulus(double time);
315 
324  void SetUsedInTissueSimulation(bool tissue=true);
325 
333  virtual boost::shared_ptr<RegularStimulus> UseCellMLDefaultStimulus();
334 
339 
347  {
348  return NULL;
349  }
350 
354  boost::shared_ptr<AbstractStimulusFunction> GetStimulusFunction();
355 
362  const boost::shared_ptr<AbstractStimulusFunction> GetStimulusFunction() const;
363 
370  const boost::shared_ptr<AbstractIvpOdeSolver> GetSolver() const;
371 
379  void SetSolver(boost::shared_ptr<AbstractIvpOdeSolver> pSolver);
380 
385  virtual void SetVoltageDerivativeToZero(bool clamp=true);
386 
394  void SetFixedVoltage(double voltage);
395 
403  virtual void SetStretch(double stretch)
404  {
405  }
406 
415  virtual double GetIntracellularCalciumConcentration();
416 
417 protected:
424  unsigned mVoltageIndex;
425 
427  boost::shared_ptr<AbstractIvpOdeSolver> mpOdeSolver;
428 
430  boost::shared_ptr<AbstractStimulusFunction> mpIntracellularStimulus;
431 
438 
441 
444 
447 
448 private:
457  template<class Archive>
458  void serialize(Archive & archive, const unsigned int version)
459  {
460  // For version 0 these were archived by AbstractCardiacCell, now
461  // we have AbstractCvodeCells too, so doing it here.
462  if (version > 0)
463  {
464  archive & mSetVoltageDerivativeToZero;
465  archive & mIsUsedInTissue;
467  // archive & mFixedVoltage; - this doesn't need archiving as it is reset every PDE time step if used.
468  }
469  // archive & mVoltageIndex; - always set by constructor - called by concrete class
470  // archive & mpOdeSolver; - always set by constructor - called by concrete class
471  // archive & mpIntracellularStimulus; - always set by constructor - called by concrete class
472  }
473 };
474 
476 BOOST_CLASS_VERSION(AbstractCardiacCellInterface, 1)
477 
478 #endif /*ABSTRACTCARDIACCELLINTERFACE_HPP_*/
AbstractCardiacCellInterface(boost::shared_ptr< AbstractIvpOdeSolver > pOdeSolver, unsigned voltageIndex, boost::shared_ptr< AbstractStimulusFunction > pIntracellularStimulus)
virtual void SetStretch(double stretch)
virtual double GetAnyVariable(const std::string &rName, double time)=0
boost::shared_ptr< AbstractStimulusFunction > mpIntracellularStimulus
virtual unsigned GetNumberOfParameters() const =0
virtual void SetParameter(const std::string &rParameterName, double value)=0
const boost::shared_ptr< AbstractIvpOdeSolver > GetSolver() const
#define CLASS_IS_ABSTRACT(T)
virtual double GetVoltage()=0
void SetStimulusFunction(boost::shared_ptr< AbstractStimulusFunction > pStimulus)
void SetIntracellularStimulusFunction(boost::shared_ptr< AbstractStimulusFunction > pStimulus)
virtual const std::vector< std::string > & rGetStateVariableNames() const =0
virtual std::vector< double > GetStdVecStateVariables()=0
virtual void SetStateVariables(const std::vector< double > &rVariables)=0
virtual unsigned GetNumberOfStateVariables() const =0
virtual double GetParameter(const std::string &rParameterName)=0
virtual void SetTimestep(double dt)=0
virtual AbstractLookupTableCollection * GetLookupTableCollection()
virtual OdeSolution Compute(double tStart, double tEnd, double tSamp=0.0)=0
virtual double GetIIonic(const std::vector< double > *pStateVariables=NULL)=0
virtual boost::shared_ptr< RegularStimulus > UseCellMLDefaultStimulus()
virtual void ComputeExceptVoltage(double tStart, double tEnd)=0
virtual void SolveAndUpdateState(double tStart, double tEnd)=0
void serialize(Archive &archive, const unsigned int version)
virtual void SetVoltage(double voltage)=0
virtual void SetVoltageDerivativeToZero(bool clamp=true)
boost::shared_ptr< AbstractStimulusFunction > GetStimulusFunction()
gcov doesn&#39;t like this file...
friend class boost::serialization::access
boost::shared_ptr< AbstractIvpOdeSolver > mpOdeSolver
virtual void SetStateVariable(unsigned index, double newValue)=0
void SetSolver(boost::shared_ptr< AbstractIvpOdeSolver > pSolver)