Chaste Commit::baa90ac2819b962188b7562f2326be23c47859a7
AbstractCardiacCellInterface.hpp
1/*
2
3Copyright (c) 2005-2024, University of Oxford.
4All rights reserved.
5
6University of Oxford means the Chancellor, Masters and Scholars of the
7University of Oxford, having an administrative office at Wellington
8Square, Oxford OX1 2JD, UK.
9
10This file is part of Chaste.
11
12Redistribution and use in source and binary forms, with or without
13modification, 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
23THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
29GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
32OF 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
43#include "ClassIsAbstract.hpp"
44
45#include "AbstractIvpOdeSolver.hpp"
46#include "RegularStimulus.hpp"
47#include "OdeSolution.hpp"
48#include "AbstractLookupTableCollection.hpp"
49
59{
60public:
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
419
420protected:
428
430 boost::shared_ptr<AbstractIvpOdeSolver> mpOdeSolver;
431
433 boost::shared_ptr<AbstractStimulusFunction> mpIntracellularStimulus;
434
441
444
447
450
451private:
460 template<class Archive>
461 void serialize(Archive & archive, const unsigned int version)
462 {
463 // For version 0 these were archived by AbstractCardiacCell, now
464 // we have AbstractCvodeCells too, so doing it here.
465 if (version > 0)
466 {
468 archive & mIsUsedInTissue;
470 // archive & mFixedVoltage; - this doesn't need archiving as it is reset every PDE time step if used.
471 }
472 // archive & mVoltageIndex; - always set by constructor - called by concrete class
473 // archive & mpOdeSolver; - always set by constructor - called by concrete class
474 // archive & mpIntracellularStimulus; - always set by constructor - called by concrete class
475 }
476};
477
479BOOST_CLASS_VERSION(AbstractCardiacCellInterface, 1)
480
481#endif /*ABSTRACTCARDIACCELLINTERFACE_HPP_*/
gcov doesn't like this file...
#define CLASS_IS_ABSTRACT(T)
virtual void SetStateVariable(unsigned index, double newValue)=0
virtual const std::vector< std::string > & rGetStateVariableNames() const =0
virtual void SetStateVariables(const std::vector< double > &rVariables)=0
virtual unsigned GetNumberOfStateVariables() const =0
virtual void ComputeExceptVoltage(double tStart, double tEnd)=0
virtual void SetStateVariable(const std::string &rName, double newValue)=0
virtual double GetParameter(unsigned parameterIndex)=0
boost::shared_ptr< AbstractStimulusFunction > GetStimulusFunction()
boost::shared_ptr< AbstractStimulusFunction > mpIntracellularStimulus
virtual double GetIIonic(const std::vector< double > *pStateVariables=NULL)=0
const boost::shared_ptr< AbstractIvpOdeSolver > GetSolver() const
void SetIntracellularStimulusFunction(boost::shared_ptr< AbstractStimulusFunction > pStimulus)
virtual double GetVoltage()=0
virtual void SetTimestep(double dt)=0
virtual void SetVoltageDerivativeToZero(bool clamp=true)
virtual std::vector< double > GetStdVecStateVariables()=0
virtual void SetParameter(const std::string &rParameterName, double value)=0
virtual double GetParameter(const std::string &rParameterName)=0
virtual AbstractLookupTableCollection * GetLookupTableCollection()
virtual OdeSolution Compute(double tStart, double tEnd, double tSamp=0.0)=0
virtual unsigned GetNumberOfParameters() const =0
virtual boost::shared_ptr< RegularStimulus > UseCellMLDefaultStimulus()
friend class boost::serialization::access
boost::shared_ptr< AbstractIvpOdeSolver > mpOdeSolver
virtual void SolveAndUpdateState(double tStart, double tEnd)=0
void serialize(Archive &archive, const unsigned int version)
virtual double GetAnyVariable(const std::string &rName, double time)=0
void SetSolver(boost::shared_ptr< AbstractIvpOdeSolver > pSolver)
virtual void SetVoltage(double voltage)=0
void SetStimulusFunction(boost::shared_ptr< AbstractStimulusFunction > pStimulus)