CEPS  24.01
Cardiac ElectroPhysiology Simulator
FileInterpolatorSAFunc.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
32 
33 #include <vtkSmartPointer.h>
34 #include <vtkUnstructuredGridReader.h>
35 
36 class AbstractPdeProblem;
37 
39 class FileInterpolatorSAFunc: public SAFunc<CepsReal>
40 {
41 
42  public:
43 
45  explicit FileInterpolatorSAFunc(
47  CepsReal snapTimeRef,
48  const CepsString& filesBase,
49  CepsUInt tOrder = 1
50  );
51 
54 
57  operator=(const FileInterpolatorSAFunc&) = default;
58 
60  CepsReal
61  virtual eval(CepsStandardArgs args) final;
62 
64  CepsEnum
65  getFlags() const final;
66 
67 
68  protected:
69 
71  void
73 
76  getVtkFileName(CepsUInt i) const;
77 
79  void
81 
87 
96 
99 
102 
103 };
104 
105 namespace ceps {
107  CepsEnum
109 }
std::basic_string< CepsChar > CepsString
C++ format string.
Definition: CepsTypes.hpp:128
CepsIndex CepsUnknownIndex
For unknowns.
Definition: CepsTypes.hpp:217
std::map< _Key, _Tp, _Compare, _Alloc > CepsMap
C++ map.
Definition: CepsTypes.hpp:196
int CepsEnum
Enum type.
Definition: CepsTypes.hpp:216
std::vector< _Type, _Alloc > CepsVector
C++ vector.
Definition: CepsTypes.hpp:155
CepsGlobalIndex CepsDofGlobalIndex
Indices of degrees of freedom.
Definition: CepsTypes.hpp:226
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
Base class for creating PDEs to solve.
Functor that uses data from a collection of files to return a value at position x and time t.
CepsReal m_loadedTMax
Time of Max snapshot of currently loaded files.
CepsString getVtkFileName(CepsUInt i) const
Get full file name for snapshot i.
CepsUInt m_loadedSnapIdMax
Max snapshot ID of currently loaded files Loaded data, indexed by time, unknown id (array name in vtk...
virtual CepsReal eval(CepsStandardArgs args) final
Call operator to evaluate functor.
CepsEnum getFlags() const final
flag is Attribute only
CepsUInt m_loadedSnapIdMin
Min snapshot ID of currently loaded files.
CepsReal m_ptLocatorTolerance
Distance under which closest point search is tolerated (can be set in input file)
CepsUInt m_nDigitsFile
Number of digits of file number in collection of files.
FileInterpolatorSAFunc(AbstractPdeProblem *pb, CepsReal snapTimeRef, const CepsString &filesBase, CepsUInt tOrder=1)
Constructor with map. Flag is the expected flag of the coefficient used to interpolate.
void computeInterpolationWeights()
Computes the interpolation weights using geom locators.
FileInterpolatorSAFunc & operator=(const FileInterpolatorSAFunc &)=default
We allow the assignement from a functor to another.
void loadFilesForTime(CepsReal t)
Loads the appropriate files to perform time interpolation at time t.
CepsMap< CepsDofGlobalIndex, CepsMap< vtkIdType, CepsReal > > m_itpWeights
Precomputed interpolation weights. Built using point/cell locator.
AbstractPdeProblem * m_problem
Link to problem.
CepsUInt m_tOrder
Time interpolation order.
CepsReal m_loadedTMin
Time of Min snapshot of currently loaded files.
CepsVector< CepsMap< CepsUnknownIndex, CepsVector< CepsReal > > > m_loadedData
CepsVector< CepsMap< CepsUnknownIndex, CepsReal > > m_loadedData0D
Loaded data, indexed by time, unknown id (array name in vtk file)
CepsString m_filesBase
Base names of data files.
CepsReal m_snapTimeRef
Reference output period.
FileInterpolatorSAFunc(const FileInterpolatorSAFunc &)=default
We allow the copy from a functor to another.
A SAFunc is a ceps::Function that uses CepsStandardArgs as argument of call operator (),...
Definition: SAFunc.hpp:100
A namespace for all utility methods.
CepsEnum getFlagsOf(FileInterpolatorSAFunc *f)
get functor options
Structure used to pass arguments to SAFunc (see pde directory) The flags of the SAFunc allows extract...
Definition: CepsTypes.hpp:239