A class used to evaluate math expressions. More...
#include <MathExpr.h>
Public Member Functions | |
| MathExpr | clone () const |
| Clone the expression. | |
| const auto & | getExpr () const |
| Return the expression. | |
| const auto & | getVars () const |
| Return the variables. | |
| MathExpr () | |
| Empty constructor. | |
| MathExpr (const MathExpr &)=delete | |
| Copy constructor. | |
| MathExpr (double value) | |
| Scalar. | |
| MathExpr (MathExpr &&rhs) | |
| Move constructor. | |
| MathExpr (std::string expression, std::vector< std::string > variables=std::vector< std::string >()) | |
| Default constructor. | |
| bool | operator!= (const MathExpr &rhs) const |
| Check if two expressions are different. | |
| double | operator() (const double *data) const |
| Evaluate. | |
| double | operator() (const std::initializer_list< double > &data={}) const |
| Evaluate. | |
| MathExpr & | operator= (const MathExpr &)=delete |
| Assignment operator. | |
| MathExpr & | operator= (MathExpr &&rhs) |
| Move assignment operator. | |
| bool | operator== (const MathExpr &rhs) const |
| Check if two expressions are the same. | |
| ~MathExpr () | |
| Destructor. | |
Private Member Functions | |
| void | initialize () |
Private Attributes | |
| std::vector< double > | d_data |
| std::string | d_expr |
| te_expr * | d_fun = nullptr |
| std::vector< te_variable > | d_tevar |
| std::vector< std::string > | d_vars |
A class used to evaluate math expressions.
This class provides the ability to evaluate a string as a math expression. Note: currently this class is not thread-safe. Each thread must have a different copy.
Definition at line 23 of file MathExpr.h.
| AMP::MathExpr::MathExpr | ( | ) |
Empty constructor.
|
explicit |
Default constructor.
Construct a MathExpr object to evaluate an expression with input variables
| [in] | expression | Expression to evaluate: "sqrt(x^2+y^2)" |
| [in] | variables | List of variables: { "x", "y" } |
|
explicit |
|
delete |
Copy constructor.
| AMP::MathExpr::MathExpr | ( | MathExpr && | rhs | ) |
Move constructor.
| AMP::MathExpr::~MathExpr | ( | ) |
Destructor.
| MathExpr AMP::MathExpr::clone | ( | ) | const |
Clone the expression.
|
inline |
|
inline |
|
private |
|
inline |
Check if two expressions are different.
Definition at line 89 of file MathExpr.h.
References operator==().
| double AMP::MathExpr::operator() | ( | const double * | data | ) | const |
Evaluate.
Evaluate the expression provided in the constructor with given arguments
| [in] | data | List of variable values: { x, y } |
| double AMP::MathExpr::operator() | ( | const std::initializer_list< double > & | data = {} | ) | const |
Evaluate.
Evaluate the expression provided in the constructor with given arguments
| [in] | data | List of variable values: { x, y } |
| bool AMP::MathExpr::operator== | ( | const MathExpr & | rhs | ) | const |
Check if two expressions are the same.
Referenced by operator!=().
|
mutableprivate |
Definition at line 98 of file MathExpr.h.
|
private |
Definition at line 94 of file MathExpr.h.
Referenced by getExpr().
|
private |
Definition at line 95 of file MathExpr.h.
|
private |
Definition at line 97 of file MathExpr.h.
|
private |
Definition at line 96 of file MathExpr.h.
Referenced by getVars().
|
Advanced Multi-Physics (AMP) Oak Ridge National Laboratory Idaho National Laboratory Los Alamos National Laboratory |
This page automatically produced from the source code by Last updated: Tue Mar 10 2026 13:06:42. Comments on this page |