FunctionEvaluator

class FunctionEvaluator

Class to evaluate function expressions given by a string.

Public Functions

void create(const std::string &expr)

Build the evaluator object.

Parameters:

exprFunction expression to be evaluated

void create(const std::vector<std::string> &expressions)

Build the evaluator object.

Parameters:

expressionsFunction expressions (one per component) to be evaluated

void define_constant(const std::string &name, Real value)

Define a constant.

Parameters:
  • name – Name of the constant

  • value – Value

void register_function(Function *fn)

Register user function with function evaluator.

Parameters:

fnFunction to register

Real evaluate(Int dim, Real time, const Real x[])

Evaluate the function expression at time time and spatial position x

Parameters:
  • dim – Spatial dimension

  • time – Simulation time

  • x – Spatial location