Chaste Commit::f2ff7ee04e70ac9d06c57344df8d017dbb12b97b
AbstractCardiacCellInterface.cpp
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#include "HeartConfig.hpp" // First for Boost 1.33/PETSc 2.2
37#include "AbstractCardiacCellInterface.hpp"
38#include "Exception.hpp"
39
40#include "Citations.hpp"
41static PetscBool CardiacCellChasteCite = PETSC_FALSE;
42const char CardiacCellChasteCitation[] = "@article{cooper2015cce,\n"
43" title = {{Cellular cardiac electrophysiology modelling with Chaste and CellML}},\n"
44" author = {Cooper, Jonathan and Spiteri, Raymond and Mirams, Gary R},\n"
45" year = {2015},\n"
46" journal = {Frontiers in Physiology},\n"
47" pages = {511},\n"
48" url = {http://journal.frontiersin.org/Journal/10.3389/fphys.2014.00511},\n"
49" volume = {5},\n"
50" doi = {10.3389/fphys.2014.00511},\n"
51"}\n";
52
54 boost::shared_ptr<AbstractIvpOdeSolver> pOdeSolver,
55 unsigned voltageIndex,
56 boost::shared_ptr<AbstractStimulusFunction> pIntracellularStimulus)
57 : mVoltageIndex(voltageIndex),
58 mpOdeSolver(pOdeSolver),
59 mpIntracellularStimulus(pIntracellularStimulus),
60 mSetVoltageDerivativeToZero(false),
61 mIsUsedInTissue(false),
62 mHasDefaultStimulusFromCellML(false),
63 mFixedVoltage(DOUBLE_UNSET)
64{
65 // Record a reference for the calculations performed using this class,
66 // can be extracted with the '-citations' flag as an argument to any executable.
67 Citations::Register(CardiacCellChasteCitation, &CardiacCellChasteCite);
68}
69
70
74
75
80
81
82void AbstractCardiacCellInterface::SetStimulusFunction(boost::shared_ptr<AbstractStimulusFunction> pStimulus)
83{
85}
86
87
89{
90 return GetIntracellularStimulus(time);
91}
92
93
94void AbstractCardiacCellInterface::SetIntracellularStimulusFunction(boost::shared_ptr<AbstractStimulusFunction> pStimulus)
95{
96 mpIntracellularStimulus = pStimulus;
97}
98
99
101{
102 return mpIntracellularStimulus->GetStimulus(time);
103}
104
105
107{
108 double stim;
109 if (mIsUsedInTissue)
110 {
111 // Convert from uA/cm^3 to uA/cm^2 by dividing by Am
113 }
114 else
115 {
116 stim = GetIntracellularStimulus(time);
117 }
118 return stim;
119}
120
125
127{
129 EXCEPTION("This class has no default stimulus from CellML metadata.");
130 return boost::shared_ptr<RegularStimulus>();
131}
132
137
138boost::shared_ptr<AbstractStimulusFunction> AbstractCardiacCellInterface::GetStimulusFunction()
139{
141}
142
143// Methods needed by boost serialization.
144const boost::shared_ptr<AbstractStimulusFunction> AbstractCardiacCellInterface::GetStimulusFunction() const
145{
147}
148
149const boost::shared_ptr<AbstractIvpOdeSolver> AbstractCardiacCellInterface::GetSolver() const
150{
151 return mpOdeSolver;
152}
153
154void AbstractCardiacCellInterface::SetSolver(boost::shared_ptr<AbstractIvpOdeSolver> pSolver)
155{
156 mpOdeSolver = pSolver;
157}
158
160{
162 if (clamp)
163 {
165 }
166}
167
169{
170 mFixedVoltage = voltage;
171}
172
174{
175 EXCEPTION("AbstractCardiacCellInterface::GetIntracellularCalciumConcentration() called. "
176 "Either model has no [Ca_i] or method has not been implemented yet");
177}
178
179
const double DOUBLE_UNSET
Definition Exception.hpp:57
#define EXCEPTION(message)
boost::shared_ptr< AbstractStimulusFunction > GetStimulusFunction()
boost::shared_ptr< AbstractStimulusFunction > mpIntracellularStimulus
const boost::shared_ptr< AbstractIvpOdeSolver > GetSolver() const
void SetIntracellularStimulusFunction(boost::shared_ptr< AbstractStimulusFunction > pStimulus)
virtual double GetVoltage()=0
AbstractCardiacCellInterface(boost::shared_ptr< AbstractIvpOdeSolver > pOdeSolver, unsigned voltageIndex, boost::shared_ptr< AbstractStimulusFunction > pIntracellularStimulus)
virtual void SetVoltageDerivativeToZero(bool clamp=true)
virtual boost::shared_ptr< RegularStimulus > UseCellMLDefaultStimulus()
boost::shared_ptr< AbstractIvpOdeSolver > mpOdeSolver
void SetSolver(boost::shared_ptr< AbstractIvpOdeSolver > pSolver)
void SetStimulusFunction(boost::shared_ptr< AbstractStimulusFunction > pStimulus)
static void Register(const char *pCitation, PetscBool *pSet)
Definition Citations.cpp:43
double GetSurfaceAreaToVolumeRatio() const
static HeartConfig * Instance()