CEPS  24.01
Cardiac ElectroPhysiology Simulator
AbstractIonicModel.hpp
Go to the documentation of this file.
1 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2  This file is part of CEPS.
3 
4  CEPS is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  CEPS is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with CEPS (see file LICENSE at root of project).
16  If not, see <https://www.gnu.org/licenses/>.
17 
18 
19  Copyright 2019-2024 Inria, Universite de Bordeaux
20 
21  Authors, in alphabetical order:
22 
23  Pierre-Elliott BECUE, Florian CARO, Yves COUDIERE(*), Andjela DAVIDOVIC,
24  Charlie DOUANLA-LONTSI, Marc FUENTES, Mehdi JUHOOR, Michael LEGUEBE(*),
25  Pauline MIGERDITICHAN, Valentin PANNETIER(*), Nejib ZEMZEMI.
26  * : currently active authors
27 
28 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
30 #pragma once
31 
33 #include "pde/common/Unknown.hpp"
36 
37 class IonicSolver;
38 
54 {
55 
56  public:
57 
59  virtual ~AbstractIonicModel();
60 
61  // Model properties ============================================================================
62 
64  CepsString
65  getName() const;
66 
69  Unknown*
70  getUnknown() const;
71 
74  getCm() const;
75 
77  void
79 
81  CepsReal
82  getPaperCm(CepsBool cepsUnit) const;
83 
85  CepsReal
86  getPaperStim() const;
87 
89  void
91 
93  CepsReal
95 
97  virtual CepsUInt
98  getNbStateVariables() const;
99 
101  CepsString
103 
106  virtual void
108 
119  virtual void
121  CepsReal t,
122  CepsReal* y,
123  CepsReal* v,
124  CepsReal* dtyL,
125  CepsReal* dtyNL,
126  CepsReal* dtv,
127  DegreeOfFreedom* dof
128  ) const = 0;
129 
130  // Unit conversion methods =====================================================================
131 
133  virtual CepsReal
134  convertVoltageFromCepsUnit(const CepsReal& v) const;
135 
137  virtual CepsReal
138  convertVoltageToCepsUnit(const CepsReal& v) const;
139 
141  virtual CepsReal
142  convertDtvToCepsUnit(const CepsReal& dtv) const;
143 
145  virtual CepsReal
146  convertCurrentFromCepsUnit(const CepsReal& i) const;
147 
149  virtual CepsReal
150  convertCmFromCepsUnit(const CepsReal& cm) const;
151 
153  virtual CepsReal
154  convertCmToCepsUnit(const CepsReal& cm) const;
155 
156  // Solver linking ==============================================================================
157 
159  void
160  setLinkedSolver(IonicSolver* solver);
161 
163  IonicSolver*
164  getLinkedSolver() const;
165 
166 
167  protected:
168 
171  Unknown* u,
172  const CepsSet<CepsAttribute>& attrs={}
173  );
174 
176  CepsReal
177  getCmInternal(CepsReal t, DegreeOfFreedom* dof) const;
178 
180  CepsReal
181  sigmoid(CepsReal x, CepsReal c, CepsReal k) const;
182 
184  CepsReal
185  gaussian(CepsReal x, CepsReal c, CepsReal s) const;
186 
188  CepsReal
189  uOverExpm1u(CepsReal u) const;
190 
191  protected:
192 
204 };
205 
206 
std::basic_string< CepsChar > CepsString
C++ format string.
Definition: CepsTypes.hpp:128
std::set< _Type, _Compare, _Alloc > CepsSet
C++ set.
Definition: CepsTypes.hpp:209
std::vector< _Type, _Alloc > CepsVector
C++ vector.
Definition: CepsTypes.hpp:155
bool CepsBool
Booleans.
Definition: CepsTypes.hpp:124
std::make_unsigned_t< CepsInt > CepsUInt
Unsigned version on CepsInt.
Definition: CepsTypes.hpp:109
float CepsReal
Need single precision floating point.
Definition: CepsTypes.hpp:100
Represents a ionic model for a group of cells, i.e. multiple systems of ODEs.
CepsReal gaussian(CepsReal x, CepsReal c, CepsReal s) const
Function often used in rates evaluations.
Unknown * getUnknown() const
The unknown object of the transmembrane voltage.
IonicSolver * getLinkedSolver() const
Get link to solver.
IonicSolver * m_solver
Link to solver, set when solver is created.
CepsReal m_paperStim
Original stim amplitude.
ScalarField< DegreeOfFreedom > * m_cm
Link to coef Cm of the PDE, for unit conversion.
virtual CepsReal convertDtvToCepsUnit(const CepsReal &dtv) const
Convert current from ionic model units to ceps units (mV ms-1). Does nothing by default.
ScalarField< DegreeOfFreedom > * getCm() const
Link to Cm coefficient of PDE.
virtual void computeRates(CepsReal t, CepsReal *y, CepsReal *v, CepsReal *dtyL, CepsReal *dtyNL, CepsReal *dtv, DegreeOfFreedom *dof) const =0
Get the linear and non linear part of the evolution function f. Also computes the ionic current.
CepsString getName() const
Name of the solver for info display.
virtual CepsReal convertCmFromCepsUnit(const CepsReal &cm) const
Convert capacitance from ceps units (uF/cm2) to ionic model units. Does nothing by default.
CepsReal * m_dconstants
Constant parameters of the model, computed from others.
CepsUInt m_nStateVars
Dimensionality of the ODE system, -1 for vm.
virtual CepsReal convertCurrentFromCepsUnit(const CepsReal &i) const
Convert current from ionic model units to ceps units (uA per cm2). Does nothing by default.
virtual CepsReal convertCmToCepsUnit(const CepsReal &cm) const
Convert capacitance from ionic model units to ceps units (uF/cm2). Does nothing by default.
CepsReal * m_constants
Constant parameters of the model, from inputs.
virtual CepsUInt getNbStateVariables() const
The number of state variables, except transmembrane voltage.
AbstractIonicModel(Unknown *u, const CepsSet< CepsAttribute > &attrs={})
Called only by derived classes.
CepsReal getStimulation(DegreeOfFreedom *x, CepsReal t) const
Get the sum of all stimulations at time t and dof x.
CepsReal uOverExpm1u(CepsReal u) const
Functions u/(1-exp(u)) that returns 2 (from expansion around 0)
CepsVector< CepsString > m_stateVarNames
Names of state variables.
virtual CepsReal convertVoltageToCepsUnit(const CepsReal &v) const
Convert voltage from ionic model units to ceps units (mV). Does nothing by default.
CepsReal getCmInternal(CepsReal t, DegreeOfFreedom *dof) const
Get either the value of cm on dof, or the default value from the paper.
CepsReal getPaperStim() const
Get the original amplitude of stimulation, converted into ceps units.
Unknown * m_unknown
Pointer on unknown on which the model applies.
virtual ~AbstractIonicModel()
Destructor.
void addStimulation(ScalarSourceTerm *stim)
Links the model to a stimulation function, needed for computation of _ki.
CepsReal getPaperCm(CepsBool cepsUnit) const
Get the original value of Cm used in paper.
CepsVector< ScalarSourceTerm * > m_stims
Link to excitations.
void setCm(ScalarField< DegreeOfFreedom > *)
Link to Cm coefficient of PDE.
CepsString getStateVariableName(CepsUInt i) const
Gives the name of the i-th state variable.
virtual CepsReal convertVoltageFromCepsUnit(const CepsReal &v) const
Convert voltage from ceps units (mV) to ionic model units. Does nothing by default.
CepsReal m_paperCm
Original value of Cm.
CepsReal sigmoid(CepsReal x, CepsReal c, CepsReal k) const
Function often used in rates evaluations.
virtual void getInitialCondition(CepsReal *v, CepsReal *y) const =0
Sets initial values of state variables and transmembrane voltage for a single point....
CepsString m_name
A label for display.
void setLinkedSolver(IonicSolver *solver)
Links instance to solver.
A degree of freedom for any kind of problem The dof can be associated to a geometrical element or not...
A Field is an object wrapped around a SAFunc functor, defined on at least one domain.
Definition: Field.hpp:80
Groups two ODE solvers for ionic variables and interacts with cardiac problem.
Definition: IonicSolver.hpp:44
Source term, essentially a ScalarField.
Definition: SourceTerm.hpp:50
A class used to defined an unknown of a PDE problem The unknown can be defined on a specific region,...
Definition: Unknown.hpp:45
An abstract class from which all objects that contain region attributes should derive.