CEPS
24.01
Cardiac ElectroPhysiology Simulator
|
FunctionDictionary that holds functions which can be used to define source terms, boundary conditions or physical coefficients.
Entries are added from a character string. See the Syntax to add boundary conditions and source terms. page for usage. Some entries can be added directly from an object, though (constants, functions...)
Definition at line 45 of file FunctionDictionary.hpp.
#include <FunctionDictionary.hpp>
Public Types | |
template<class _Result > | |
using | Entry = SAFunc< _Result > * |
Typedef for any kind of entry. We do not put SAFunc<_Result>* as the operators return a ceps::Function .... More... | |
using | ScalarEntry = Entry< CepsMathScalar > |
Typedef for scalar functions. More... | |
using | VectorEntry = Entry< CepsMathVertex > |
Typedef for vector functions. More... | |
using | TensorEntry = Entry< CepsMathTensor > |
Typedef for tensor functions. More... | |
template<class _Result > | |
using | Map = CepsMap< CepsString, Entry< _Result > > |
Typedef for map of functions, any kind. More... | |
using | ScalarMap = Map< CepsMathScalar > |
Typedef for the map of scalar functions. More... | |
using | VectorMap = Map< CepsMathVertex > |
Typedef for the map of vector functions. More... | |
using | TensorMap = Map< CepsMathTensor > |
Typedef for the map of tensor functions. More... | |
Public Member Functions | |
FunctionDictionary () | |
Constructor, adds some function by default. More... | |
~FunctionDictionary () | |
Destructor. More... | |
void | add (const CepsString &label, const CepsString ¶ms, Geometry *geom=nullptr) |
Add an object from parameters. More... | |
void | addConstant (const CepsString &label, const CepsString ¶ms) |
Add a constant function through parameter string. More... | |
template<class _Constant > | |
void | addConstant (const CepsString &label, _Constant value) |
Add a constant function directly from the value. More... | |
void | addCstPiecewise (const CepsString &label, const CepsString ¶ms) |
Add a piecewise function, constant on each region. More... | |
void | addFctPiecewise (const CepsString &label, const CepsString ¶ms) |
Add a piecewise function, function on eacg. More... | |
void | addFromFile (const CepsString &label, const CepsString ¶ms, Geometry *geom, CepsBool neverMind=false) |
Add a function read from data file, requires geometry. If the extension is compatible with CoeffReader (vtk, etc) it creates a space varying function. Otherwise, consider the file as a column formatted text file and return an interpolator. (The functor in the interpolator can be set later on for correct selection from CepsStandardArgs) The last bool cancels the add if data with arrayname provided in params is not found in file (spatial only) More... | |
void | addFunction (const CepsString &label, const CepsString ¶ms) |
Add a function deduced from tags only, works only with scalar return type. More... | |
void | addOperator (const CepsString &label, const CepsString ¶ms) |
Add an operation between already registered functions and/or real constants. More... | |
template<class _Obj1 , class _Obj2 > | |
void | addOperator (const CepsString &label, _Obj1 *a, const CepsChar &op, _Obj2 *b) |
Add an operation between already registered functions and/or real constants, directly from the objects. More... | |
void | addAlias (const CepsString &label, const CepsString ¶ms) |
Adds a shortcut to an already existing function. More... | |
void | addEntry (const CepsString &label, ScalarEntry func) |
Ads an entry to the map of scalar functions. More... | |
void | addEntry (const CepsString &label, VectorEntry func) |
Ads an entry to the map of vector functions. More... | |
void | addEntry (const CepsString &label, TensorEntry func) |
Ads an entry to the map of tensor functions. More... | |
CepsBool | hasScalar (const CepsString &label) const |
Tells if function "label" is registered. More... | |
CepsBool | hasVector (const CepsString &label) const |
Tells if function "label" is registered. More... | |
CepsBool | hasTensor (const CepsString &label) const |
Tells if function "label" is registered. More... | |
const ScalarMap & | getScalars () const |
Get all scalar entries, const version. More... | |
const VectorMap & | getVectors () const |
Get all vector entries, const version. More... | |
const TensorMap & | getTensors () const |
Get all tensor entries, const version. More... | |
const ScalarEntry | getScalar (const CepsString &label) const |
Get a single scalar entry, const version. More... | |
const VectorEntry | getVector (const CepsString &label) const |
Get a single vector entry, const version. More... | |
const TensorEntry | getTensor (const CepsString &label) const |
Get a single tensor entry, const version. More... | |
const ScalarEntry | getScalar (const CepsString &label, const ScalarEntry def) const |
Get a single scalar entry, with default value, const version. More... | |
const VectorEntry | getVector (const CepsString &label, const VectorEntry def) const |
Get a single vector entry, with default value, const version. More... | |
const TensorEntry | getTensor (const CepsString &label, const TensorEntry def) const |
Get a single tensor entry, with default value, const version. More... | |
void | deleteScalar (const CepsString &label) |
Delete a single scalar entry. Be careful if the functor was created outside dictionary. More... | |
void | deleteVector (const CepsString &label) |
Delete a single vector entry. Be careful if the functor was created outside dictionary. More... | |
void | deleteTensor (const CepsString &label) |
Delete a single tensor entry. Be careful if the functor was created outside dictionary. More... | |
Public Member Functions inherited from CepsObject | |
CepsObject ()=default | |
default constructor More... | |
CepsObject (const CepsObject &)=default | |
Copy constructor. More... | |
virtual | ~CepsObject ()=default |
Destructor. More... | |
CepsObject & | operator= (const CepsObject &)=default |
Assignment operator. More... | |
CepsObject * | toBaseObject () |
Returns a pointer to CepsObject class. More... | |
const CepsObject * | toBaseObject () const |
Returns a pointer to CepsObject class, const version. More... | |
Profiler * | getProfiler () const |
Access to profiler. More... | |
Protected Attributes | |
ScalarMap | m_scalars |
All scalar entries. More... | |
VectorMap | m_vectors |
All vector entries. More... | |
TensorMap | m_tensors |
All tensor entries. More... | |
CepsSet< CepsString > | m_doNotDelete |
Functions that must not be deleted (created by alias) More... | |
CepsString | m_address = " See https://carmen.gitlabpages.inria.fr/ceps/syntax.html for details on syntax" |
A string that is displayed in error messages. More... | |
Private Member Functions | |
ScalarEntry | parseFunction (const CepsString ¶ms) |
Returns a pointer to a function deduced from the string parameters. More... | |
ScalarEntry | parseTimeFunction (const CepsVector< CepsString > ¶ms) |
Returns a pointer to a function deduced from the string parameters. More... | |
ScalarEntry | parseSpatialFunction (const CepsVector< CepsString > ¶ms) |
Returns a pointer to a function deduced from the string parameters. More... | |
void | checkParam (const CepsVector< CepsString > &words, const CepsVector< CepsString > &keys, const CepsVector< CepsUInt > &nToRead={}) const |
Aborts if a function parameter is missing or not a number. More... | |
template<class _Result > | |
void | addInternal (const CepsString &label, Entry< _Result > func, Map< _Result > &map, const CepsString &name) |
Internal adding method. More... | |
template<CepsUInt n, typename Reals > | |
void | addInterpolationTable (const CepsString &label, std::ifstream &ifs, const CepsString &fileName, CepsBool time) |
Internal method to add intepolation tables of scalar, vector and tensors. More... | |
Static Private Member Functions | |
template<class _Result > | |
static CepsBool | hasInternal (const CepsString &key, const Map< _Result > &map) |
Internal inspecting method. More... | |
Additional Inherited Members | |
Static Protected Attributes inherited from CepsObject | |
static Profiler | m_profiler |
The same profiler for each big object. More... | |
using FunctionDictionary::Entry = SAFunc<_Result>* |
Typedef for any kind of entry. We do not put SAFunc<_Result>* as the operators return a ceps::Function ....
Definition at line 53 of file FunctionDictionary.hpp.
using FunctionDictionary::Map = CepsMap<CepsString, Entry<_Result> > |
Typedef for map of functions, any kind.
Definition at line 63 of file FunctionDictionary.hpp.
Typedef for scalar functions.
Definition at line 55 of file FunctionDictionary.hpp.
Typedef for the map of scalar functions.
Definition at line 65 of file FunctionDictionary.hpp.
Typedef for tensor functions.
Definition at line 59 of file FunctionDictionary.hpp.
Typedef for the map of tensor functions.
Definition at line 69 of file FunctionDictionary.hpp.
Typedef for vector functions.
Definition at line 57 of file FunctionDictionary.hpp.
Typedef for the map of vector functions.
Definition at line 67 of file FunctionDictionary.hpp.
FunctionDictionary::FunctionDictionary | ( | ) |
Constructor, adds some function by default.
Definition at line 33 of file FunctionDictionary.cpp.
FunctionDictionary::~FunctionDictionary | ( | ) |
Destructor.
Definition at line 38 of file FunctionDictionary.cpp.
void FunctionDictionary::add | ( | const CepsString & | label, |
const CepsString & | params, | ||
Geometry * | geom = nullptr |
||
) |
Add an object from parameters.
label | the key of the object |
params | the params of the object |
geom | a geometry, needed for data loaded from file, nullptr otherwise |
Definition at line 52 of file FunctionDictionary.cpp.
void FunctionDictionary::addAlias | ( | const CepsString & | label, |
const CepsString & | params | ||
) |
Adds a shortcut to an already existing function.
Definition at line 345 of file FunctionDictionary.cpp.
void FunctionDictionary::addConstant | ( | const CepsString & | label, |
_Constant | value | ||
) |
Add a constant function directly from the value.
Definition at line 289 of file FunctionDictionary.hpp.
void FunctionDictionary::addConstant | ( | const CepsString & | label, |
const CepsString & | params | ||
) |
Add a constant function through parameter string.
Definition at line 83 of file FunctionDictionary.cpp.
void FunctionDictionary::addCstPiecewise | ( | const CepsString & | label, |
const CepsString & | params | ||
) |
Add a piecewise function, constant on each region.
Definition at line 104 of file FunctionDictionary.cpp.
void FunctionDictionary::addEntry | ( | const CepsString & | label, |
ScalarEntry | func | ||
) |
Ads an entry to the map of scalar functions.
Definition at line 366 of file FunctionDictionary.cpp.
void FunctionDictionary::addEntry | ( | const CepsString & | label, |
TensorEntry | func | ||
) |
Ads an entry to the map of tensor functions.
Definition at line 378 of file FunctionDictionary.cpp.
void FunctionDictionary::addEntry | ( | const CepsString & | label, |
VectorEntry | func | ||
) |
Ads an entry to the map of vector functions.
Definition at line 372 of file FunctionDictionary.cpp.
void FunctionDictionary::addFctPiecewise | ( | const CepsString & | label, |
const CepsString & | params | ||
) |
Add a piecewise function, function on eacg.
Definition at line 152 of file FunctionDictionary.cpp.
void FunctionDictionary::addFromFile | ( | const CepsString & | label, |
const CepsString & | params, | ||
Geometry * | geom, | ||
CepsBool | neverMind = false |
||
) |
Add a function read from data file, requires geometry. If the extension is compatible with CoeffReader (vtk, etc) it creates a space varying function. Otherwise, consider the file as a column formatted text file and return an interpolator. (The functor in the interpolator can be set later on for correct selection from CepsStandardArgs) The last bool cancels the add if data with arrayname provided in params is not found in file (spatial only)
Definition at line 193 of file FunctionDictionary.cpp.
void FunctionDictionary::addFunction | ( | const CepsString & | label, |
const CepsString & | params | ||
) |
Add a function deduced from tags only, works only with scalar return type.
Definition at line 285 of file FunctionDictionary.cpp.
|
private |
Internal adding method.
Definition at line 312 of file FunctionDictionary.hpp.
|
private |
Internal method to add intepolation tables of scalar, vector and tensors.
Definition at line 341 of file FunctionDictionary.hpp.
void FunctionDictionary::addOperator | ( | const CepsString & | label, |
_Obj1 * | a, | ||
const CepsChar & | op, | ||
_Obj2 * | b | ||
) |
Add an operation between already registered functions and/or real constants, directly from the objects.
Definition at line 296 of file FunctionDictionary.hpp.
void FunctionDictionary::addOperator | ( | const CepsString & | label, |
const CepsString & | params | ||
) |
Add an operation between already registered functions and/or real constants.
Definition at line 291 of file FunctionDictionary.cpp.
|
private |
Aborts if a function parameter is missing or not a number.
Definition at line 612 of file FunctionDictionary.cpp.
void FunctionDictionary::deleteScalar | ( | const CepsString & | label | ) |
Delete a single scalar entry. Be careful if the functor was created outside dictionary.
Definition at line 488 of file FunctionDictionary.cpp.
void FunctionDictionary::deleteTensor | ( | const CepsString & | label | ) |
Delete a single tensor entry. Be careful if the functor was created outside dictionary.
Definition at line 504 of file FunctionDictionary.cpp.
void FunctionDictionary::deleteVector | ( | const CepsString & | label | ) |
Delete a single vector entry. Be careful if the functor was created outside dictionary.
Definition at line 496 of file FunctionDictionary.cpp.
const FunctionDictionary::ScalarEntry FunctionDictionary::getScalar | ( | const CepsString & | label | ) | const |
Get a single scalar entry, const version.
Definition at line 427 of file FunctionDictionary.cpp.
const FunctionDictionary::ScalarEntry FunctionDictionary::getScalar | ( | const CepsString & | label, |
const ScalarEntry | def | ||
) | const |
Get a single scalar entry, with default value, const version.
Definition at line 457 of file FunctionDictionary.cpp.
const FunctionDictionary::ScalarMap & FunctionDictionary::getScalars | ( | ) | const |
Get all scalar entries, const version.
Definition at line 409 of file FunctionDictionary.cpp.
const FunctionDictionary::TensorEntry FunctionDictionary::getTensor | ( | const CepsString & | label | ) | const |
Get a single tensor entry, const version.
Definition at line 447 of file FunctionDictionary.cpp.
const FunctionDictionary::TensorEntry FunctionDictionary::getTensor | ( | const CepsString & | label, |
const TensorEntry | def | ||
) | const |
Get a single tensor entry, with default value, const version.
Definition at line 475 of file FunctionDictionary.cpp.
const FunctionDictionary::TensorMap & FunctionDictionary::getTensors | ( | ) | const |
Get all tensor entries, const version.
Definition at line 421 of file FunctionDictionary.cpp.
const FunctionDictionary::VectorEntry FunctionDictionary::getVector | ( | const CepsString & | label | ) | const |
Get a single vector entry, const version.
Definition at line 437 of file FunctionDictionary.cpp.
const FunctionDictionary::VectorEntry FunctionDictionary::getVector | ( | const CepsString & | label, |
const VectorEntry | def | ||
) | const |
Get a single vector entry, with default value, const version.
Definition at line 466 of file FunctionDictionary.cpp.
const FunctionDictionary::VectorMap & FunctionDictionary::getVectors | ( | ) | const |
Get all vector entries, const version.
Definition at line 415 of file FunctionDictionary.cpp.
|
staticprivate |
Internal inspecting method.
Definition at line 334 of file FunctionDictionary.hpp.
CepsBool FunctionDictionary::hasScalar | ( | const CepsString & | label | ) | const |
Tells if function "label" is registered.
Definition at line 387 of file FunctionDictionary.cpp.
CepsBool FunctionDictionary::hasTensor | ( | const CepsString & | label | ) | const |
Tells if function "label" is registered.
Definition at line 399 of file FunctionDictionary.cpp.
CepsBool FunctionDictionary::hasVector | ( | const CepsString & | label | ) | const |
Tells if function "label" is registered.
Definition at line 393 of file FunctionDictionary.cpp.
|
private |
Returns a pointer to a function deduced from the string parameters.
The function can be a product of time and space functions
Definition at line 517 of file FunctionDictionary.cpp.
|
private |
Returns a pointer to a function deduced from the string parameters.
Definition at line 591 of file FunctionDictionary.cpp.
|
private |
Returns a pointer to a function deduced from the string parameters.
Definition at line 572 of file FunctionDictionary.cpp.
|
protected |
A string that is displayed in error messages.
Definition at line 281 of file FunctionDictionary.hpp.
|
protected |
Functions that must not be deleted (created by alias)
Definition at line 278 of file FunctionDictionary.hpp.
|
protected |
All scalar entries.
Definition at line 274 of file FunctionDictionary.hpp.
|
protected |
All tensor entries.
Definition at line 276 of file FunctionDictionary.hpp.
|
protected |
All vector entries.
Definition at line 275 of file FunctionDictionary.hpp.