13 #ifndef FFA_MATH_EXPR_FACTORY_H
14 #define FFA_MATH_EXPR_FACTORY_H
41 static size_t countArgs(
const std::string& expression,
const char** vars,
42 std::vector<bool>* present = 0);
45 int create(
int id,
const std::string& expression,
46 size_t nvar = 1,
const char** vars = 0);
49 double getValue(
int id,
double arg,
int& error);
51 double getValue(
int id,
const double* arg,
int& error);
54 double getDiff(
int id,
double arg,
int& error);
56 double getDiff(
int id,
size_t idArg,
const double* arg,
int& error);
66 std::vector<FFaMathExpr*>
diff;
67 std::vector<FFaMathVar*>
args;
82 using IMIter = std::map<int,FFaMathFunc>::iterator;
Template for singleton classes.
Class describing a mathematical expression.
Definition: FFaMathExprFactory.H:62
FFaMathFunc()
Default constructor.
Definition: FFaMathExprFactory.H:70
FFaMathFunc(const FFaMathFunc &)=delete
The copy constructor is deleted.
std::vector< FFaMathExpr * > diff
Exression tree for function derivatives.
Definition: FFaMathExprFactory.H:66
FFaMathFunc & operator=(const FFaMathFunc &)=delete
The assignment operator is deleted.
std::string estr
Function expression as text.
Definition: FFaMathExprFactory.H:64
~FFaMathFunc()
The destructor deletes the heap-allocated members.
Definition: FFaMathExprFactory.C:19
FFaMathExpr * expr
Resolved expression tree.
Definition: FFaMathExprFactory.H:65
std::vector< FFaMathVar * > args
Function arguments.
Definition: FFaMathExprFactory.H:67
Singelton class holding all mathematical expression objects.
Definition: FFaMathExprFactory.H:30
int create(int id, const std::string &expression, size_t nvar=1, const char **vars=0)
Creates a new FFaMathFunc instance from the string expression.
Definition: FFaMathExprFactory.C:53
std::map< int, FFaMathFunc > myIndexMap
Definition: FFaMathExprFactory.H:79
double getValue(int id, double arg, int &error)
Evaluates a single-argument math expression.
Definition: FFaMathExprFactory.C:86
virtual ~FFaMathExprFactory()
The destructor is private to allow singelton destruction only.
Definition: FFaMathExprFactory.H:34
FFaMathExprFactory()
The constructor is private to allow singelton construction only.
Definition: FFaMathExprFactory.H:32
static size_t countArgs(const std::string &expression, const char **vars, std::vector< bool > *present=0)
Counts the occurances of arguments vars in expression.
Definition: FFaMathExprFactory.C:29
double getDiff(int id, double arg, int &error)
Evaluates the derivative of a single-argument math expression.
Definition: FFaMathExprFactory.C:121
Definition: FFaMathExpr.H:16
Definition: FFaMathVar.H:15
Template for singleton classes.
Definition: FFaSingelton.H:26