CEPS  24.01
Cardiac ElectroPhysiology Simulator
PdeErrorCalculator.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"
35 
36 // Forward declarations
37 class AbstractPdeProblem;
40 
43 {
44 
45  public:
46 
48  explicit PdeErrorCalculator(
49  AbstractPdeProblem* pb,
50  CepsReal dt = 1.
51  );
52 
55 
57  void
58  compute(DHVecPtr num, CepsReal time=0.);
59 
61  CepsReal
62  getReferenceNormNow(CepsInt px) const;
63 
65  CepsReal
67 
69  CepsReal
71 
73  CepsReal
75 
77  CepsReal
78  getRelativeErrorNow(CepsInt px) const;
79 
81  CepsReal
83 
85  void
87 
89  void
90  reset();
91 
92  protected:
93 
95  void
96  checkPxPt(CepsInt px, CepsInt pt) const;
97 
100 
103 
106 
109 
112 
115 
118 
121 
124 
127 
128 };
bool CepsBool
Booleans.
Definition: CepsTypes.hpp:124
float CepsReal
Need single precision floating point.
Definition: CepsTypes.hpp:100
CepsArray< _Type, 3U > CepsArray3
C++ array, 3 elements.
Definition: CepsTypes.hpp:165
int32_t CepsInt
Need 32 bit integer.
Definition: CepsTypes.hpp:106
std::shared_ptr< DistributedHaloVector > DHVecPtr
Typedef for pointer on Distributed Halo CepsVector.
Base class for creating PDEs to solve.
Astract Problem which does not depend on time.
Astract Problem which does depend on time.
Utility to measure distance with respect to analytic solution or given vectors.
CepsReal getAbsoluteErrorNow(CepsInt px) const
Get norm of difference at current time.
void setAnalyticSolution(ceps::Function< CepsReal(CepsStandardArgs)> *func)
Manually set the analytic solution.
CepsArray3< CepsReal > m_refNow
Norm of reference at current time.
AbstractPdeProblem * m_problem
Link to problem.
CepsArray3< CepsReal > m_errNow
Norm of difference at current time.
CepsReal m_dt
Time step, 1 by default,.
CepsReal getRelativeErrorNow(CepsInt px) const
Get relative norm of difference at current time.
CepsReal getReferenceNormNow(CepsInt px) const
Get norm of reference at current time. p=0 max, p=1 l1 normm, p=2 l2 norm.
PdeErrorCalculator(AbstractPdeProblem *pb, CepsReal dt=1.)
Constructor with discretization.
CepsArray3< CepsReal > m_mxTNormsRef
max norm in time
CepsBool m_ignoreZeroD
Do not add errors from 0D unknowns.
CepsArray3< TimeIntegrator * > m_l1TNormsRef
Integrator for L1 norm in time.
CepsArray3< TimeIntegrator * > m_l1TNormsErr
Integrator for L1 norm in time.
void reset()
Reset all cumulated norms.
CepsReal getAbsoluteErrorCumulative(CepsInt px, CepsInt pt) const
Get cumulated norm of difference.
~PdeErrorCalculator()
Destructor.
CepsReal getRelativeErrorCumulative(CepsInt px, CepsInt pt) const
Get relative cumulated norm of difference.
void compute(DHVecPtr num, CepsReal time=0.)
Compute the error at current time and add to total.
ScalarSAFunc * m_solution
Analytic function.
CepsArray3< CepsReal > m_mxTNormsErr
max norm in time
void checkPxPt(CepsInt px, CepsInt pt) const
Aborts if pw or pt is not 0,1,2.
CepsReal getReferenceNormCumulative(CepsInt px, CepsInt pt) const
Get cumulated norm of reference so far.
A SAFunc is a ceps::Function that uses CepsStandardArgs as argument of call operator (),...
Definition: SAFunc.hpp:100
Structure used to pass arguments to SAFunc (see pde directory) The flags of the SAFunc allows extract...
Definition: CepsTypes.hpp:239
function caller : abstract base, only contains an variadic operator()