52 template <
class _Result>
62 template <
class _Result>
94 template <
class _Constant>
139 template <
class _Obj1,
class _Obj2>
256 template <
class _Result>
262 template <
class _Result>
267 template <CepsUInt n,
typename Reals>
287 template <
class _Constant>
294 template <
class _Obj1,
class _Obj2>
307 CEPS_ABORT(
"Operator '" << op <<
"' between functions is not implemented (target " << label <<
")");
310 template <
class _Result>
322 "dictionary already contains an object with the label " << label <<
323 "\n of type '" << name <<
"'. Ignoring"
328 map.insert(std::make_pair(
ceps::toKey(label),func));
332 template <
class _Result>
339 template <CepsUInt n,
typename Reals>
348 ifs.seekg(0,std::ios::beg);
354 while(std::getline(ifs,line))
356 std::istringstream iss(line);
357 CepsString errmsg(fileName+
", line "+std::to_string(lc)+
": cannot read real ");
359 value = ceps::convertReal<Reals>(ceps::readReals<n>(iss,errmsg).data());
365 selector =
getScalar(
"dicofunc_time_selector");
#define CEPS_ABORT(message)
Stops the execution with a message. If testing is enabled, only throws a runtime_error.
#define CEPS_WARNS(message)
Writes a warning in the debug log and in the terminal (stderr).
std::basic_string< CepsChar > CepsString
C++ format string.
std::map< _Key, _Tp, _Compare, _Alloc > CepsMap
C++ map.
std::set< _Type, _Compare, _Alloc > CepsSet
C++ set.
std::vector< _Type, _Alloc > CepsVector
C++ vector.
std::make_unsigned_t< CepsInt > CepsUInt
Unsigned version on CepsInt.
float CepsReal
Need single precision floating point.
ConstantSAFunc< _Result > * newConstantSAFunc(_Result val)
Standard way to build a ConstantSAFunc. Only pass the value, or a pointer to it.
OperatorSAFunc<'-', _Res1, _Res2 > * newDiffSAFunc(SAFunc< _Res1 > *, SAFunc< _Res2 > *)
Get a new substraction object without having to look after return types of fn1 and fn2.
OperatorSAFunc<'+', _Res1, _Res2 > * newSumSAFunc(SAFunc< _Res1 > *, SAFunc< _Res2 > *)
Get a new addition object without having to look after return types of fn1 and fn2.
OperatorSAFunc<'/', _Res1, _Res2 > * newDivSAFunc(SAFunc< _Res1 > *, SAFunc< _Res2 > *)
Get a new division object without having to look after return types of fn1 and fn2.
OperatorSAFunc<' *', _Res1, _Res2 > * newProductSAFunc(SAFunc< _Res1 > *, SAFunc< _Res2 > *)
Get a new product object without having to look after return types of fn1 and fn2.
Base class for other (big) CEPS classes. All classes can get a pointer to this base class and also co...
Functions with result that is deduced from a coefficient and an interpolation map.
A simple SA func that extracts time from arguments, will be added to the dictionary upon creation.
CepsReal eval(CepsStandardArgs) override
Returns args.t.
CepsEnum getFlags() const override
Time flags.
FunctionDictionary that holds functions which can be used to define source terms, boundary conditions...
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 CoeffReade...
void addConstant(const CepsString &label, const CepsString ¶ms)
Add a constant function through parameter string.
void addInterpolationTable(const CepsString &label, std::ifstream &ifs, const CepsString &fileName, CepsBool time)
Internal method to add intepolation tables of scalar, vector and tensors.
Map< CepsMathVertex > VectorMap
Typedef for the map of vector functions.
FunctionDictionary()
Constructor, adds some function by default.
CepsBool hasTensor(const CepsString &label) const
Tells if function "label" is registered.
void addFctPiecewise(const CepsString &label, const CepsString ¶ms)
Add a piecewise function, function on eacg.
ScalarEntry parseSpatialFunction(const CepsVector< CepsString > ¶ms)
Returns a pointer to a function deduced from the string parameters.
Map< CepsMathTensor > TensorMap
Typedef for the map of tensor functions.
void addOperator(const CepsString &label, const CepsString ¶ms)
Add an operation between already registered functions and/or real constants.
void addCstPiecewise(const CepsString &label, const CepsString ¶ms)
Add a piecewise function, constant on each region.
CepsSet< CepsString > m_doNotDelete
Functions that must not be deleted (created by alias)
~FunctionDictionary()
Destructor.
ScalarMap m_scalars
All scalar entries.
void deleteVector(const CepsString &label)
Delete a single vector entry. Be careful if the functor was created outside dictionary.
ScalarEntry parseTimeFunction(const CepsVector< CepsString > ¶ms)
Returns a pointer to a function deduced from the string parameters.
VectorMap m_vectors
All vector entries.
CepsBool hasScalar(const CepsString &label) const
Tells if function "label" is registered.
void addAlias(const CepsString &label, const CepsString ¶ms)
Adds a shortcut to an already existing function.
const TensorEntry getTensor(const CepsString &label) const
Get a single tensor entry, const version.
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.
Map< CepsMathScalar > ScalarMap
Typedef for the map of scalar functions.
TensorMap m_tensors
All tensor entries.
CepsMap< CepsString, Entry< _Result > > Map
Typedef for map of functions, any kind.
void addInternal(const CepsString &label, Entry< _Result > func, Map< _Result > &map, const CepsString &name)
Internal adding method.
CepsBool hasVector(const CepsString &label) const
Tells if function "label" is registered.
static CepsBool hasInternal(const CepsString &key, const Map< _Result > &map)
Internal inspecting method.
const TensorMap & getTensors() const
Get all tensor entries, const version.
const VectorMap & getVectors() const
Get all vector entries, const version.
const VectorEntry getVector(const CepsString &label) const
Get a single vector entry, const version.
CepsString m_address
A string that is displayed in error messages.
const ScalarMap & getScalars() const
Get all scalar entries, const version.
void add(const CepsString &label, const CepsString ¶ms, Geometry *geom=nullptr)
Add an object from parameters.
void addFunction(const CepsString &label, const CepsString ¶ms)
Add a function deduced from tags only, works only with scalar return type.
void deleteScalar(const CepsString &label)
Delete a single scalar entry. Be careful if the functor was created outside dictionary.
const ScalarEntry getScalar(const CepsString &label) const
Get a single scalar entry, const version.
void addEntry(const CepsString &label, ScalarEntry func)
Ads an entry to the map of scalar functions.
void deleteTensor(const CepsString &label)
Delete a single tensor entry. Be careful if the functor was created outside dictionary.
ScalarEntry parseFunction(const CepsString ¶ms)
Returns a pointer to a function deduced from the string parameters.
Encapsulates all the geometrical data.
A SAFunc is a ceps::Function that uses CepsStandardArgs as argument of call operator (),...
CepsString toKey(const CepsString &s)
Transform to key type a std::string, upper case and no spaces.
void destroyObject(_Type &)
Destroy[delete] any type.
CepsReal readReal(std::istream &file, const CepsString &errorMessage="")
Reads a floating point number from an istream, aborts if conversion fails advances the stream by 1 wo...
Structure used to pass arguments to SAFunc (see pde directory) The flags of the SAFunc allows extract...