#include <Parser.h>
|
virtual std::string | eval (hit::Field *n, const std::list< std::string > &args, hit::BraceExpander &exp) |
|
Definition at line 34 of file Parser.h.
◆ eval()
std::string FuncParseEvaler::eval |
( |
hit::Field * |
n, |
|
|
const std::list< std::string > & |
args, |
|
|
hit::BraceExpander & |
exp |
|
) |
| |
|
virtual |
Definition at line 37 of file Parser.C.
39 std::string func_text;
42 auto n_errs =
exp.errors.size();
47 std::vector<std::string> var_names;
48 auto ret = fp.ParseAndDeduceVariables(func_text, var_names);
51 exp.errors.push_back(hit::errormsg(n,
"fparse error: ", fp.ErrorMsg()));
56 std::vector<double> var_vals;
57 for (
auto & var : var_names)
61 while ((curr = curr->parent()))
63 auto src = curr->find(var);
64 if (src && src != n && src->type() == hit::NodeType::Field)
66 exp.used.push_back(hit::pathJoin({curr->fullpath(), var}));
67 var_vals.push_back(curr->param<
double>(var));
73 exp.errors.push_back(hit::errormsg(
74 n,
"\n no variable '", var,
"' found for use in function parser expression"));
77 if (
exp.errors.size() != n_errs)
81 ss << std::setprecision(17) << fp.Eval(var_vals.data());
84 n->setVal(n->val(), hit::Field::Kind::Float);
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
The documentation for this class was generated from the following files: