OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
MathExpr.cpp File Reference

Shunting-yard parser + stack evaluator. More...

#include "MathExpr.hpp"
#include <cmath>
#include <stack>
#include <cctype>
#include <algorithm>
#include <unordered_map>
Include dependency graph for MathExpr.cpp:

Namespaces

namespace  openswmm
 
namespace  openswmm::mathexpr
 

Functions

int openswmm::mathexpr::parse (const std::string &expr_str, Expression &result)
 Parse an infix expression string into a postfix Expression.
 
double openswmm::mathexpr::evaluate (const Expression &expr, const std::function< double(const std::string &)> &var_lookup)
 Evaluate a compiled expression with named variable lookup.
 
double openswmm::mathexpr::evaluate (const Expression &expr, const double *vars, int n_vars)
 Evaluate with a flat variable array (by index).
 

Detailed Description

Shunting-yard parser + stack evaluator.

Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
License\n MIT License