#include <Parser.h>
|
virtual std::string | eval (hit::Field *n, const std::list< std::string > &args, hit::BraceExpander &exp) |
|
Definition at line 22 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 29 of file Parser.C.
31 std::string func_text;
34 auto n_errs =
exp.errors.size();
39 std::vector<std::string> var_names;
40 auto ret = fp.ParseAndDeduceVariables(func_text, var_names);
43 exp.errors.emplace_back(
44 "fparse error: " + std::string(fp.ErrorMsg()) +
" in '" + n->fullpath() +
"'", n);
48 std::vector<double> var_vals;
49 for (
auto & var : var_names)
53 while ((curr = curr->parent()))
55 auto src = curr->find(var);
56 if (src && src != n && src->type() == hit::NodeType::Field)
58 exp.used.push_back(hit::pathJoin({curr->fullpath(), var}));
59 var_vals.push_back(curr->param<
double>(var));
65 exp.errors.emplace_back(
"no variable '" + var +
66 "' found for use in function parser expression in '" +
71 if (
exp.errors.size() != n_errs)
75 ss << std::setprecision(17) << fp.Eval(var_vals.data());
78 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: