CEPS  24.01
Cardiac ElectroPhysiology Simulator
AbstractOdeSolver.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 
32 #include "common/CepsCommon.hpp"
33 // #include "linearAlgebra/DistributedVector.hpp"
34 // #include "ode/ionicModels/AbstractIonicModel.hpp"
35 
36 // class IonicSolver;
37 
69 {
70 
71  public:
72 
75 
76  public:
77 
80 
82  virtual ~AbstractOdeSolver();
83 
84  // Methods for out of class evolution functions
85 
99  virtual void
100  initialize(
101  CepsReal* y0,
102  CepsUInt n,
103  RateFunction* nonlinearFunc,
104  RateFunction* linearFunc = nullptr,
105  CepsBool copy = false
106  );
107 
109  CepsUInt
110  getNbMultiSteps() const;
111 
113  CepsUInt
114  getNbSubSteps() const;
115 
117  CepsReal*
118  getSolution() const;
119 
125  virtual void
127 
130  virtual void
132 
133  protected:
134 
136  virtual void
138 
150  void
151  evaluateDerivative(CepsReal t, CepsReal *y, CepsReal *dty, CepsUInt n, CepsBool nLinPart = true);
152 
157  CepsReal
158  phi1(CepsReal x) const;
159 
164  // CepsVector<CepsReal>
165  // phis(CepsInt n, CepsReal x) const;
166 
167 
168  protected:
169 
173 
177 
180 
183 
184 
185  // CepsBool m_isForGateVars; ///< True to select specific solving method for ionic gate variables
186  // IonicSolver *m_ionSolver; ///< If needed, link to other coupled solver through IonicSolver
187 
188 };
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
Solves ODE systems .
AbstractOdeSolver()
Constructor.
CepsBool m_initialized
Check at deallocation.
CepsUInt getNbSubSteps() const
Tells if several intermediate steps are needed to get to .
virtual void takeOneSubStep(CepsReal t, CepsReal dt)
Progress by a substep, for RK methods. Does nothing by default.
CepsUInt m_nbSubSteps
Number of sub steps (eg RK solvers)
CepsReal * m_yNp1
Solution at time .
void evaluateDerivative(CepsReal t, CepsReal *y, CepsReal *dty, CepsUInt n, CepsBool nLinPart=true)
Selects and computes depending on how it was passed to the class.
virtual void initialize(CepsReal *y0, CepsUInt n, RateFunction *nonlinearFunc, RateFunction *linearFunc=nullptr, CepsBool copy=false)
Allocate data arrays and sets initial condition with given data.
CepsVector< CepsReal * > m_yNm
Solution at time and before.
CepsReal phi1(CepsReal x) const
Function used in exponential schemes.
virtual void takeOneStep(CepsReal t, CepsReal dt)=0
Make a full ode step : must be defined in every child class.
CepsBool m_ownedSolData
Flag for destructor.
CepsUInt m_nbMultiSteps
Number of steps for multi step solvers.
RateFunction * m_fL
Linear function to call in evaluateDerivative.
CepsReal * getSolution() const
Returns a pointer to the solution. Size is the same as y0 argument in initialize.
CepsUInt m_currentStep
Ongoing step.
virtual void shiftDataArraysForNextStep()
Rotates the pointers on data such that yN becomes yN-1, etc...
RateFunction * m_fNL
Non-linear function to call in evaluateDerivative.
virtual ~AbstractOdeSolver()
Destructor.
CepsUInt m_ySize
Function used in exponential schemes. Return all phi_n until n, starting at phi0.
CepsUInt getNbMultiSteps() const
Tells how many time steps the method covers.
function caller : abstract base, only contains an variadic operator()