Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
panzer::Expr::EvalBase Class Referenceabstract

Base class for panzer::Expr::Eval, does everything that is independent of the Kokkos::View template parameter. More...

#include <Panzer_ExprEval.hpp>

Inheritance diagram for panzer::Expr::EvalBase:
Inheritance graph
[legend]

Public Types

using Function = std::function< void(std::string const &name, Teuchos::any &, std::vector< Teuchos::any > &rhs)>
 The type of user-defined functions which are callable in the math language. More...
 

Public Member Functions

 EvalBase ()
 Constructor. More...
 
void set (std::string const &name, Function const &value)
 Registers an EvalBase::Function, binding it to a name and making it callable. More...
 
template<typename T >
T constget (std::string const &name) const
 Get the value of a variable in the symbol map. More...
 
- Public Member Functions inherited from Teuchos::Reader
virtual ~Reader ()
 
 Reader (ReaderTablesPtr tables_in)
 
void read_stream (any &result, std::istream &stream, std::string const &stream_name_in)
 
void read_string (any &result, std::string const &string, std::string const &string_name)
 
void read_file (any &result, std::string const &file_name)
 

Protected Member Functions

void at_shift (Teuchos::any &result, int token, std::string &text) override
 Called at every parsed token in the math language. More...
 
void at_reduce (Teuchos::any &result, int prod, std::vector< Teuchos::any > &rhs) override
 Called at every reduced production in the math language. More...
 
void ternary_op (Teuchos::any &result, Teuchos::any &cond, Teuchos::any &left, Teuchos::any &right)
 Executes the ternary operator, e.g. (a > b) ? a : b. More...
 
void binary_op (BinaryOpCode code, Teuchos::any &result, Teuchos::any &left, Teuchos::any &right)
 Executes a binary operator. More...
 
void neg_op (Teuchos::any &result, Teuchos::any &right)
 Executes the only native unary operator in the math language, numeric negation via a minus sign. More...
 

Protected Attributes

std::map< std::string,
Teuchos::any
symbol_map
 Stores all current symbols including variables and functions. More...
 

Dispatch to template-specialized Expr::Eval code.

virtual void make_constant (Teuchos::any &result, double const &value)=0
 
virtual void inspect_arg (Teuchos::any const &arg, bool &is_many, bool &is_bool)=0
 
virtual void single_single_ternary_op (Teuchos::any &result, Teuchos::any &cond, Teuchos::any &left, Teuchos::any &right)=0
 
virtual void single_many_ternary_op (Teuchos::any &result, Teuchos::any &cond, Teuchos::any &left, Teuchos::any &right)=0
 
virtual void many_single_ternary_op (Teuchos::any &result, Teuchos::any &cond, Teuchos::any &left, Teuchos::any &right)=0
 
virtual void many_many_ternary_op (Teuchos::any &result, Teuchos::any &cond, Teuchos::any &left, Teuchos::any &right)=0
 
virtual void single_single_binary_op (BinaryOpCode code, Teuchos::any &result, Teuchos::any &left, Teuchos::any &right)=0
 
virtual void single_many_binary_op (BinaryOpCode code, Teuchos::any &result, Teuchos::any &left, Teuchos::any &right)=0
 
virtual void many_single_binary_op (BinaryOpCode code, Teuchos::any &result, Teuchos::any &left, Teuchos::any &right)=0
 
virtual void many_many_binary_op (BinaryOpCode code, Teuchos::any &result, Teuchos::any &left, Teuchos::any &right)=0
 
virtual void many_neg_op (Teuchos::any &result, Teuchos::any &right)=0
 
virtual void single_neg_op (Teuchos::any &result, Teuchos::any &right)=0
 

Detailed Description

Base class for panzer::Expr::Eval, does everything that is independent of the Kokkos::View template parameter.

Definition at line 90 of file Panzer_ExprEval.hpp.

Member Typedef Documentation

using panzer::Expr::EvalBase::Function = std::function<void(std::string const& name, Teuchos::any&, std::vector<Teuchos::any>& rhs)>

The type of user-defined functions which are callable in the math language.

The first argument will be the name that was used to call the function, the second argument is the return value, and the third argument is a vector containing the actual arguments given in the math language. Free functions, functors, and lambdas can all be used to construct a std::function.

Definition at line 104 of file Panzer_ExprEval.hpp.

Constructor & Destructor Documentation

panzer::Expr::EvalBase::EvalBase ( )

Constructor.

Definition at line 54 of file Panzer_ExprEval.cpp.

Member Function Documentation

void panzer::Expr::EvalBase::set ( std::string const name,
Function const value 
)

Registers an EvalBase::Function, binding it to a name and making it callable.

Definition at line 58 of file Panzer_ExprEval.cpp.

template<typename T >
T const& panzer::Expr::EvalBase::get ( std::string const name) const
inline

Get the value of a variable in the symbol map.

Definition at line 113 of file Panzer_ExprEval.hpp.

void panzer::Expr::EvalBase::at_shift ( Teuchos::any result,
int  token,
std::string &  text 
)
overrideprotectedvirtual

Called at every parsed token in the math language.

Reimplemented from Teuchos::Reader.

Definition at line 62 of file Panzer_ExprEval.cpp.

void panzer::Expr::EvalBase::at_reduce ( Teuchos::any result,
int  prod,
std::vector< Teuchos::any > &  rhs 
)
overrideprotectedvirtual

Called at every reduced production in the math language.

Reimplemented from Teuchos::Reader.

Definition at line 77 of file Panzer_ExprEval.cpp.

void panzer::Expr::EvalBase::ternary_op ( Teuchos::any result,
Teuchos::any cond,
Teuchos::any left,
Teuchos::any right 
)
protected

Executes the ternary operator, e.g. (a > b) ? a : b.

Definition at line 194 of file Panzer_ExprEval.cpp.

void panzer::Expr::EvalBase::binary_op ( BinaryOpCode  code,
Teuchos::any result,
Teuchos::any left,
Teuchos::any right 
)
protected

Executes a binary operator.

Parameters
codeWhich binary operator to execute
resultHolds the resulting value
leftHolds the left operand
rightHolds the right operand

This function figures out which operands are singular versus plural and then dispatches to the appropriate virtual functions (e.g. many_single_binary_op), which are implemented in Expr::Eval.

Definition at line 246 of file Panzer_ExprEval.cpp.

void panzer::Expr::EvalBase::neg_op ( Teuchos::any result,
Teuchos::any right 
)
protected

Executes the only native unary operator in the math language, numeric negation via a minus sign.

Definition at line 267 of file Panzer_ExprEval.cpp.

virtual void panzer::Expr::EvalBase::make_constant ( Teuchos::any result,
double const value 
)
protectedpure virtual
virtual void panzer::Expr::EvalBase::inspect_arg ( Teuchos::any const arg,
bool &  is_many,
bool &  is_bool 
)
protectedpure virtual
virtual void panzer::Expr::EvalBase::single_single_ternary_op ( Teuchos::any result,
Teuchos::any cond,
Teuchos::any left,
Teuchos::any right 
)
protectedpure virtual
virtual void panzer::Expr::EvalBase::single_many_ternary_op ( Teuchos::any result,
Teuchos::any cond,
Teuchos::any left,
Teuchos::any right 
)
protectedpure virtual
virtual void panzer::Expr::EvalBase::many_single_ternary_op ( Teuchos::any result,
Teuchos::any cond,
Teuchos::any left,
Teuchos::any right 
)
protectedpure virtual
virtual void panzer::Expr::EvalBase::many_many_ternary_op ( Teuchos::any result,
Teuchos::any cond,
Teuchos::any left,
Teuchos::any right 
)
protectedpure virtual
virtual void panzer::Expr::EvalBase::single_single_binary_op ( BinaryOpCode  code,
Teuchos::any result,
Teuchos::any left,
Teuchos::any right 
)
protectedpure virtual
virtual void panzer::Expr::EvalBase::single_many_binary_op ( BinaryOpCode  code,
Teuchos::any result,
Teuchos::any left,
Teuchos::any right 
)
protectedpure virtual
virtual void panzer::Expr::EvalBase::many_single_binary_op ( BinaryOpCode  code,
Teuchos::any result,
Teuchos::any left,
Teuchos::any right 
)
protectedpure virtual
virtual void panzer::Expr::EvalBase::many_many_binary_op ( BinaryOpCode  code,
Teuchos::any result,
Teuchos::any left,
Teuchos::any right 
)
protectedpure virtual
virtual void panzer::Expr::EvalBase::many_neg_op ( Teuchos::any result,
Teuchos::any right 
)
protectedpure virtual
virtual void panzer::Expr::EvalBase::single_neg_op ( Teuchos::any result,
Teuchos::any right 
)
protectedpure virtual

Member Data Documentation

std::map<std::string, Teuchos::any> panzer::Expr::EvalBase::symbol_map
protected

Stores all current symbols including variables and functions.

Definition at line 123 of file Panzer_ExprEval.hpp.


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