Evaluating string math expressions containing named variables.
More...
#include <dumux/common/functionfromstringexpression.hh>
template<std::size_t numVars, class Scalar = double>
class Dumux::FunctionFromStringExpression< numVars, Scalar >
- Template Parameters
-
numVars | number of variables in the expression; number of function arguments of the call operator |
Scalar | type of numerical values in the expression |
Example usage
std::string expr =
getParam(
"Problem.Function");
const double x = 1.0, t = 2.0;
const double result = f(x, t);
Evaluating string math expressions containing named variables.
Definition functionfromstringexpression.hh:58
T getParam(Args &&... args)
A free function to get a parameter from the parameter tree singleton.
Definition parameters.hh:139
For variables with several characters construct
|
| FunctionFromStringExpression (const std::string &expression, const std::array< std::string, numVars > &variableNames) |
| Constructor from math expression and array of variable names.
|
|
| FunctionFromStringExpression (const std::string &expression, std::string_view variableNames) |
| Delegating constructor using all characters of a string as variables.
|
|
template<class S , std::enable_if_t< std::is_convertible_v< Scalar, S >, int > = 0> |
Scalar | operator() (const std::array< S, numVars > ¶ms) const |
|
template<class S , std::enable_if_t< std::is_convertible_v< Scalar, S >, int > = 0> |
Scalar | operator() (const Dune::FieldVector< S, numVars > ¶ms) const |
|
template<class ... Params, std::enable_if_t<(sizeof...(Params)==numVars) &&(std::is_convertible_v< Scalar, std::decay_t< Params > > &&...), int > = 0> |
Scalar | operator() (Params &&... params) const |
|
void | setVerbosity (unsigned int v) |
|
◆ FunctionFromStringExpression() [1/2]
template<std::size_t numVars, class Scalar = double>
Dumux::FunctionFromStringExpression< numVars, Scalar >::FunctionFromStringExpression |
( |
const std::string & |
expression, |
|
|
const std::array< std::string, numVars > & |
variableNames |
|
) |
| |
|
inline |
◆ FunctionFromStringExpression() [2/2]
template<std::size_t numVars, class Scalar = double>
◆ operator()() [1/3]
template<std::size_t numVars, class Scalar = double>
template<class S , std::enable_if_t< std::is_convertible_v< Scalar, S >, int > = 0>
◆ operator()() [2/3]
template<std::size_t numVars, class Scalar = double>
template<class S , std::enable_if_t< std::is_convertible_v< Scalar, S >, int > = 0>
◆ operator()() [3/3]
template<std::size_t numVars, class Scalar = double>
template<class ... Params, std::enable_if_t<(sizeof...(Params)==numVars) &&(std::is_convertible_v< Scalar, std::decay_t< Params > > &&...), int > = 0>
◆ setVerbosity()
template<std::size_t numVars, class Scalar = double>
◆ numVariables
template<std::size_t numVars, class Scalar = double>
The documentation for this class was generated from the following file: