www.mooseframework.org
Classes | Public Types | Public Member Functions | List of all members
ExpressionBuilder Class Reference

ExpressionBuilder adds an interface to derived classes that enables convenient construction of FParser expressions through operator overloading. More...

#include <ExpressionBuilder.h>

Inheritance diagram for ExpressionBuilder:
[legend]

Classes

class  EBBinaryFuncTermNode
 Node representing a function with two arguments. More...
 
class  EBBinaryOpTermNode
 Node representing a binary operator. More...
 
class  EBBinaryTermNode
 Base class for nodes with two sub nodes (i.e. functions or operators taking two arguments) More...
 
class  EBFunction
 User facing host object for a function. This combines a term with an argument list. More...
 
class  EBLogPlogSubstitution
 Substitution rule to replace all occurences of log(x) with plog(x, epsilon) with a user defined term for epsilon. More...
 
class  EBNumberNode
 Template class for leaf nodes holding numbers in the expression tree. More...
 
class  EBSubstitutionRule
 Substitution rule functor base class to perform flexible term substitutions. More...
 
class  EBSubstitutionRuleTyped
 Substitution rule base class that applies to nodes of type Node_T. More...
 
class  EBSymbolNode
 Template class for leaf nodes holding symbols (i.e. variables) in the expression tree. More...
 
class  EBTempIDNode
 Template class for leaf nodes holding anonymous IDs in the expression tree. More...
 
class  EBTerm
 User facing host object for an expression tree. More...
 
class  EBTermNode
 Base class for nodes in the expression tree. More...
 
class  EBTermSubstitution
 Generic Substitution rule to replace all occurences of a given symbol node term with a user defined term. More...
 
class  EBTernaryFuncTermNode
 Node representing a function with three arguments. More...
 
class  EBTernaryTermNode
 Base class for nodes with two sub nodes (i.e. functions or operators taking two arguments) More...
 
class  EBUnaryFuncTermNode
 Node representing a function with two arguments. More...
 
class  EBUnaryOpTermNode
 Node representing a unary operator. More...
 
class  EBUnaryTermNode
 Base class for nodes with a single sub node (i.e. functions or operators taking one argument) More...
 

Public Types

typedef std::vector< EBTermEBTermList
 
typedef std::vector< EBTermNode * > EBTermNodeList
 
typedef std::vector< const EBSubstitutionRule * > EBSubstitutionRuleList
 

Public Member Functions

 ExpressionBuilder ()
 
 BINARYFUNC_OP_IMPLEMENT (+, ADD) BINARYFUNC_OP_IMPLEMENT(-
 
SUB BINARYFUNC_OP_IMPLEMENT MUL BINARYFUNC_OP_IMPLEMENT (/, DIV) BINARYFUNC_OP_IMPLEMENT(%
 
SUB BINARYFUNC_OP_IMPLEMENT MUL MOD BINARYFUNC_OP_IMPLEMENT (<, LESS) BINARYFUNC_OP_IMPLEMENT(>
 
SUB BINARYFUNC_OP_IMPLEMENT MUL MOD GREATER BINARYFUNC_OP_IMPLEMENT (<=, LESSEQ) BINARYFUNC_OP_IMPLEMENT(>
 
SUB BINARYFUNC_OP_IMPLEMENT MUL MOD GREATER GREATEREQ BINARYFUNC_OP_IMPLEMENT (==, EQ) BINARYFUNC_OP_IMPLEMENT(!
 

Detailed Description

ExpressionBuilder adds an interface to derived classes that enables convenient construction of FParser expressions through operator overloading.

It exposes the new types EBTerm and EBFunction Variables used in your expressions are of type EBTerm. The following declares three variables that can be used in an expression:

EBTerm c1("c1"), c2("c3"), phi("phi");

Declare a function 'G' and define it. Note the double bracket syntax '(())'':

EBFunction G; G((c1, c2, c3)) = c1 + 2 * c2 + 3 * pow(c3, 2);

Performing a substitution is as easy as: EBFunction H; H((c1, c2)) = G((c1, c2, 1-c1-c2))

Use the << io operator to output functions or terms. Or use explicit or implicit casts from EBFunction to std::string<tt>to pass a function to the FParser Parse method. FParser variables are built using theargs()``` method.

FunctionParserADBase<Real> GParser; GParser.Parse(G, G.args);

Definition at line 47 of file ExpressionBuilder.h.

Member Typedef Documentation

◆ EBSubstitutionRuleList

Definition at line 59 of file ExpressionBuilder.h.

◆ EBTermList

typedef std::vector<EBTerm> ExpressionBuilder::EBTermList

Definition at line 56 of file ExpressionBuilder.h.

◆ EBTermNodeList

Definition at line 58 of file ExpressionBuilder.h.

Constructor & Destructor Documentation

◆ ExpressionBuilder()

ExpressionBuilder::ExpressionBuilder ( )
inline

Definition at line 50 of file ExpressionBuilder.h.

50 {};

Member Function Documentation

◆ BINARYFUNC_OP_IMPLEMENT() [1/5]

ExpressionBuilder::BINARYFUNC_OP_IMPLEMENT ( ,
ADD   
)

◆ BINARYFUNC_OP_IMPLEMENT() [2/5]

SUB BINARYFUNC_OP_IMPLEMENT MUL ExpressionBuilder::BINARYFUNC_OP_IMPLEMENT ( ,
DIV   
)

◆ BINARYFUNC_OP_IMPLEMENT() [3/5]

SUB BINARYFUNC_OP_IMPLEMENT MUL MOD ExpressionBuilder::BINARYFUNC_OP_IMPLEMENT ( )

◆ BINARYFUNC_OP_IMPLEMENT() [4/5]

SUB BINARYFUNC_OP_IMPLEMENT MUL MOD GREATER ExpressionBuilder::BINARYFUNC_OP_IMPLEMENT ( <=  ,
LESSEQ   
)

◆ BINARYFUNC_OP_IMPLEMENT() [5/5]

SUB BINARYFUNC_OP_IMPLEMENT MUL MOD GREATER GREATEREQ ExpressionBuilder::BINARYFUNC_OP_IMPLEMENT ( EQ  )

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