|
NGSolve
5.3
|
Numerical expression parser. More...
#include <evalfunc.hpp>

Classes | |
| struct | argtype |
| the arguments passed to the function More... | |
| class | ResultType |
| class | step |
| one step of evaluation More... | |
Public Member Functions | |
| EvalFunction (istream &aist) | |
| parse from input stream | |
| EvalFunction (const string &str) | |
| parse from string | |
| EvalFunction (const EvalFunction &eval2) | |
| bool | Parse (istream &aist) |
| parse from stream | |
| void | DefineConstant (const string &name, double val) |
| define constant | |
| void | DefineGlobalVariable (const string &name, double *var) |
| define constant | |
| void | DefineGlobalVariable (const string &name, GenericVariable *var) |
| define constant | |
| void | DefineArgument (const string &name, int num, int vecdim=1, bool iscomplex=false) |
| define arguments | |
| double | Eval (const double *x=NULL) const |
| evaluate function | |
| void | Eval (const double *x, double *y, int ydim) const |
| evaluate multi-value function | |
| complex< double > | Eval (const complex< double > *x=NULL) const |
| evaluate function | |
| void | Eval (const complex< double > *x, complex< double > *y, int ydim) const |
| evaluate multi-value complex function | |
| void | Eval (const complex< double > *x, double *y, int ydim) const |
| evaluate multi-value complex function with real result | |
| template<typename TIN , typename TCALC > | |
| void | Eval (const TIN *x, TCALC *stack) const |
| bool | IsComplex () const |
| is expression complex valued ? | |
| bool | IsResultComplex () const |
| is expression complex valued ? | |
| bool | IsConstant () const |
| is expression a constant ? | |
| double | EvalConstant () const |
| evaluate the constant value | |
| int | Dimension () const |
| vector dimension of result | |
| void | AddConstant (double val) |
| push constant on stack. | |
| void | AddVariable (int varnum) |
| push variable x[varnum-1]. | |
| void | AddGlobVariable (const double *dp) |
| push pointer to global double value. | |
| void | AddGlobVariable (const GenericVariable *dp) |
| push pointer to global double value. | |
| void | AddOperation (EVAL_TOKEN op) |
| push operation. | |
| void | AddFunction (double(*fun)(double)) |
| push function call. | |
| void | Print (ostream &ost) const |
| print expression | |
| EVAL_TOKEN | GetToken () const |
| returns last token | |
| double | GetNumValue () const |
| returns num_value of last token | |
| int | GetVariableNumber () const |
| returns variable number of last token | |
| int | GetVariableDimension () const |
| returns dimension of variable of last token | |
| bool | GetVariableIsComplex () const |
| const char * | GetStringValue () const |
| returns identifier of last token | |
| void | ReadNext (bool optional=true) |
| read next token | |
| void | WriteBack () |
| bool | ToBool (double x) const |
| bool | ToBool (complex< double > x) const |
| double | CheckReal (double x) const |
| double | CheckReal (complex< double > x) const |
| double | Abs (double x) const |
| double | Abs (complex< double > x) const |
Public Attributes | |
| SymbolTable< argtype > | arguments |
| int | num_arguments |
Protected Types | |
| typedef double(* | TFUNP )(double) |
Protected Member Functions | |
| ResultType | ParseExpression () |
| parsing expression (standard parsing grammer) | |
| ResultType | ParseCommaExpression () |
| parsing expression (standard parsing grammer) | |
| ResultType | ParseSubExpression () |
| parsing expression (standard parsing grammer) | |
| ResultType | ParseTerm () |
| parsing expression (standard parsing grammer) | |
| ResultType | ParsePrimary () |
| parsing expression (standard parsing grammer) | |
Protected Attributes | |
| Array< step > | program |
| the evaluation sequence | |
| ResultType | res_type |
| const double | eps |
| istream * | ist |
| parse from stream | |
| EVAL_TOKEN | token |
| double | num_value |
| char | string_value [1000] |
| int | var_num |
| int | var_dim |
| bool | var_iscomplex |
| double * | globvar |
| GenericVariable * | globgenvar |
| streampos | lastpos |
| SymbolTable< double > | constants |
| registerd constants | |
| SymbolTable< double * > | globvariables |
| registerd variables | |
| SymbolTable< GenericVariable * > | genericvariables |
| registerd variables | |
Static Protected Attributes | |
| static SymbolTable< TFUNP > | functions |
| registerd functions | |
Numerical expression parser.
The expression is stored in reverse Polnish notation. The evaluation tree can be filled form an external parser, see Addxxx methods.
1.7.6.1