walberla::math::FunctionParser Class Reference

Detailed Description

Function parser, for parsing and evaluating functions.

Can parse mathematical expressions containing the standard arithmetic operations(+,-,/,*) , brackets, functions (cos,sin,exp,sqrt) and variables

After parsing an expression, values can be bound to variables using a symbol table.

Example:

p.parse("(t*t +5) + exp(Pi/2) * sin(cos(1)) ");
std::map<string,double> symbolTable;
symbolTable["Pi"]=3.141;
symbolTable["t"] = 24;
p.evaluate(symbolTable);

#include <Parser.h>

Public Member Functions

 FunctionParser ()
 
 ~FunctionParser ()
 
void parse (const std::string &equation)
 
double evaluate (const std::map< std::string, double > &symbolTable) const
 
const bool & isConstant () const
 
const bool & isZero () const
 
bool symbolExists (const std::string &symbol) const
 

Protected Member Functions

 FunctionParser (const FunctionParser &other)
 
FunctionParseroperator= (const FunctionParser &other)
 

Protected Attributes

exprtk::expression< double > * expression_
 
exprtk::symbol_table< double > * symbolTable_
 
bool isConstant_
 
bool isZero_
 

Constructor & Destructor Documentation

walberla::math::FunctionParser::FunctionParser ( )
walberla::math::FunctionParser::~FunctionParser ( )
walberla::math::FunctionParser::FunctionParser ( const FunctionParser other)
protected

Member Function Documentation

double walberla::math::FunctionParser::evaluate ( const std::map< std::string, double > &  symbolTable) const
const bool& walberla::math::FunctionParser::isConstant ( ) const
inline
const bool& walberla::math::FunctionParser::isZero ( ) const
inline
FunctionParser& walberla::math::FunctionParser::operator= ( const FunctionParser other)
protected
void walberla::math::FunctionParser::parse ( const std::string &  equation)
bool walberla::math::FunctionParser::symbolExists ( const std::string &  symbol) const

Member Data Documentation

exprtk::expression<double>* walberla::math::FunctionParser::expression_
protected
bool walberla::math::FunctionParser::isConstant_
protected
bool walberla::math::FunctionParser::isZero_
protected
exprtk::symbol_table<double>* walberla::math::FunctionParser::symbolTable_
protected

The documentation for this class was generated from the following files: