#include "muParser.h"
Go to the source code of this file.
Classes | |
class | Function |
Functions | |
double * | _functionAddVar (const char *name, void *data) |
double* _functionAddVar | ( | const char * | name, | |
void * | data | |||
) |
Simple function parser and evaluator for MOOSE. This can take a mathematical expression in standard C form and a list of variables values and evaluate the results.
Call-back to add variables to parser automatically.
We use different storage for constants and variables. Variables are stored in a vector of Variable object pointers. They must have the name x{index} where index is any non-negative integer. Note that the vector is resized to whatever the maximum index is. It is up to the user to make sure that indices are sequential without any gap. In case there is a gap in indices, those entries will remain unused.
If the name starts with anything other than `x` or `y`, then it is taken to be a named constant, which must be set before any expression or variables and error is thrown.
NOTE: this is called not on setting expression but on first attempt at evaluation of the same, i.e. when you access `value` of the Function object.
References Function::_numVar, Function::_pullbuf, and Function::_varbuf.