![]() |
OpenSWMM Engine
6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
|
Classes | |
| struct | Expression |
| struct | Token |
Enumerations | |
| enum class | TokenType : int { NUMBER = 0 , VARIABLE = 1 , ADD = 2 , SUB = 3 , MUL = 4 , DIV = 5 , POW = 6 , NEG = 7 , LPAREN = 8 , RPAREN = 9 , FUNC_ABS = 10 , FUNC_SGN = 11 , FUNC_SQRT = 12 , FUNC_LOG = 13 , FUNC_EXP = 14 , FUNC_SIN = 15 , FUNC_COS = 16 , FUNC_TAN = 17 , FUNC_ASIN = 18 , FUNC_ACOS = 19 , FUNC_ATAN = 20 , FUNC_STEP = 21 , FUNC_MIN = 22 , FUNC_MAX = 23 , COMMA = 24 } |
Functions | |
| int | parse (const std::string &expr_str, Expression &result) |
| Parse an infix expression string into a postfix Expression. | |
| double | evaluate (const Expression &expr, const std::function< double(const std::string &)> &var_lookup) |
| Evaluate a compiled expression with named variable lookup. | |
| double | evaluate (const Expression &expr, const double *vars, int n_vars) |
| Evaluate with a flat variable array (by index). | |
|
strong |
| double openswmm::mathexpr::evaluate | ( | const Expression & | expr, |
| const double * | vars, | ||
| int | n_vars | ||
| ) |
Evaluate with a flat variable array (by index).
| expr | Compiled expression. |
| vars | Variable values indexed by var_idx. |
| n_vars | Size of vars array. |
| double openswmm::mathexpr::evaluate | ( | const Expression & | expr, |
| const std::function< double(const std::string &)> & | var_lookup | ||
| ) |
Evaluate a compiled expression with named variable lookup.
| expr | Compiled expression. |
| var_lookup | Function that maps variable name → value. |
| int openswmm::mathexpr::parse | ( | const std::string & | expr_str, |
| Expression & | result | ||
| ) |
Parse an infix expression string into a postfix Expression.
| expr_str | Infix expression (e.g., "x * exp(-k * t)"). |
| result | [out] Compiled postfix expression. |