13 using tExprVarVecs = std::map<std::string, Eigen::Vector<real, Eigen::Dynamic>>;
40 void *_ptr_st =
nullptr;
41 void *_ptr_exp =
nullptr;
42 void *_ptr_parser =
nullptr;
45 bool _compiled =
false;
71 _varVecs[name].resize(size);
75 real &
Var(
const std::string &name) {
return _vars.at(name); }
77 real &
VarVec(
const std::string &name,
int i) {
return _varVecs.at(name)(
i); }
88 void Compile(
const std::string &expr);
Core type aliases, constants, and metaprogramming utilities for the DNDS framework.
Thin RAII wrapper over the exprtk expression library.
ExprtkWrapperEvaluator & operator=(const ExprtkWrapperEvaluator &)=delete
real Evaluate()
Evaluate the compiled expression with the current variable values.
void AddScalar(const std::string &name, real init=0)
Register a scalar variable. init is accepted for API symmetry but currently ignored (scalars default ...
ExprtkWrapperEvaluator(const ExprtkWrapperEvaluator &)=delete
ExprtkWrapperEvaluator(ExprtkWrapperEvaluator &&)=delete
~ExprtkWrapperEvaluator()
void AddVector(const std::string &name, int size)
Register a dense vector variable named name of length size.
real & Var(const std::string &name)
Mutable reference to a scalar variable's current value.
ExprtkWrapperEvaluator & operator=(ExprtkWrapperEvaluator &&)=delete
index VarVecSize(const std::string &name)
Length of a registered vector variable.
void Compile(const std::string &expr)
Compile expr. Throws (via DNDS_check_throw) on parse error.
ExprtkWrapperEvaluator()=default
bool Compiled() const
Whether Compile has been called and the expression parsed successfully.
real & VarVec(const std::string &name, int i)
Mutable reference to element i of a vector variable.
void Clear()
Release the compiled expression and parser. Must be called before re-binding variables.
the host side operators are provided as implemented
std::map< std::string, Eigen::Vector< real, Eigen::Dynamic > > tExprVarVecs
Vector name -> Eigen dense vector map fed into an ExprtkWrapperEvaluator.
std::map< std::string, real > tExprVars
Scalar name -> value map fed into an ExprtkWrapperEvaluator.
int64_t index
Global row / DOF index type (signed 64-bit; handles multi-billion-cell meshes).
double real
Canonical floating-point scalar used throughout DNDSR (double precision).