Reverse Polish Notation (RPN) builder.
More...
#include <KokkosFunctionParser.h>
|
| enum class | Opcode {
NUM
, VAR
, NEG
, NOT
,
ADD
, SUB
, MUL
, DIV
,
AND
, OR
, EQ
, NEQ
,
LT
, LEQ
, GT
, GEQ
,
ABS
, ACOS
, ACOSH
, ASIN
,
ASINH
, ATAN
, ATAN2
, ATANH
,
CBRT
, CEIL
, COS
, COSH
,
COT
, CSC
, EXP
, EXP2
,
FLOOR
, HYPOT
, IF
, INT
,
LOG
, LOG2
, LOG10
, MAX
,
MIN
, POW
, SEC
, SIN
,
SINH
, SQRT
, TAN
, TANH
,
TRUNC
} |
| | RPN opcode. More...
|
| |
|
| void | builderError (const peg::Ast &ast, const std::string &message) const |
| | Print a pretty error showing the position of error.
|
| |
| void | checkFinalized () |
| | Error on attempts to update the builder after finalization.
|
| |
Reverse Polish Notation (RPN) builder.
Definition at line 69 of file KokkosFunctionParser.h.
◆ Opcode
RPN opcode.
| Enumerator |
|---|
| NUM | |
| VAR | |
| NEG | |
| NOT | |
| ADD | |
| SUB | |
| MUL | |
| DIV | |
| AND | |
| OR | |
| EQ | |
| NEQ | |
| LT | |
| LEQ | |
| GT | |
| GEQ | |
| ABS | |
| ACOS | |
| ACOSH | |
| ASIN | |
| ASINH | |
| ATAN | |
| ATAN2 | |
| ATANH | |
| CBRT | |
| CEIL | |
| COS | |
| COSH | |
| COT | |
| CSC | |
| EXP | |
| EXP2 | |
| FLOOR | |
| HYPOT | |
| IF | |
| INT | |
| LOG | |
| LOG2 | |
| LOG10 | |
| MAX | |
| MIN | |
| POW | |
| SEC | |
| SIN | |
| SINH | |
| SQRT | |
| TAN | |
| TANH | |
| TRUNC | |
Definition at line 85 of file KokkosFunctionParser.h.
◆ RPNBuilder()
| Moose::Kokkos::RPNBuilder::RPNBuilder |
( |
const std::string & |
expression, |
|
|
const ConsoleStream * |
console = nullptr |
|
) |
| |
|
inline |
Constructor.
- Parameters
-
| expression | The function expression |
| console | The console object |
Definition at line 77 of file KokkosFunctionParser.h.
79 {
80 }
PEGParser _parser
PEG parser.
◆ addDefaultVariables()
| void Moose::Kokkos::RPNBuilder::addDefaultVariables |
( |
| ) |
|
◆ addNumber()
| unsigned int Moose::Kokkos::RPNBuilder::addNumber |
( |
Real |
number | ) |
|
Add a parsed function constant.
- Parameters
-
- Returns
- The constant index
◆ addVariable()
| unsigned int Moose::Kokkos::RPNBuilder::addVariable |
( |
const std::string & |
name | ) |
|
Add a parsed function variable.
- Parameters
-
- Returns
- The variable index
◆ associateField()
| void Moose::Kokkos::RPNBuilder::associateField |
( |
const std::string & |
name, |
|
|
const VariableValue * |
field |
|
) |
| |
Associate a variable with a field variable.
- Parameters
-
| name | The variable name |
| variable | The pointer to the field variable |
◆ associateFunction()
| void Moose::Kokkos::RPNBuilder::associateFunction |
( |
const std::string & |
name, |
|
|
const Function * |
function |
|
) |
| |
Associate a variable with a function.
- Parameters
-
| name | The variable name |
| function | The pointer to the function |
◆ associateProperty()
| void Moose::Kokkos::RPNBuilder::associateProperty |
( |
const std::string & |
name, |
|
|
const MaterialProperty< Real > * |
property |
|
) |
| |
Associate a variable with a material property.
- Parameters
-
| name | The variable name |
| variable | The pointer to the material property |
◆ associateScalar()
| void Moose::Kokkos::RPNBuilder::associateScalar |
( |
const std::string & |
name, |
|
|
const Real * |
scalar |
|
) |
| |
Associate a variable with a scalar value.
- Parameters
-
| name | The variable name |
| value | The pointer to the scalar value |
◆ build() [1/2]
| void Moose::Kokkos::RPNBuilder::build |
( |
| ) |
|
|
inline |
◆ build() [2/2]
| void Moose::Kokkos::RPNBuilder::build |
( |
const peg::Ast & |
ast | ) |
|
Build RPN from AST.
- Parameters
-
◆ builderError()
| void Moose::Kokkos::RPNBuilder::builderError |
( |
const peg::Ast & |
ast, |
|
|
const std::string & |
message |
|
) |
| const |
|
private |
Print a pretty error showing the position of error.
- Parameters
-
| ast | The erroneous AST node |
| message | The error message |
◆ checkFinalized()
| void Moose::Kokkos::RPNBuilder::checkFinalized |
( |
| ) |
|
|
private |
Error on attempts to update the builder after finalization.
◆ finalize()
| void Moose::Kokkos::RPNBuilder::finalize |
( |
| ) |
|
|
inline |
Finalize the builder and prevent further changes.
Definition at line 253 of file KokkosFunctionParser.h.
bool _finalized
Whether builder was finalized.
◆ finalized()
| bool Moose::Kokkos::RPNBuilder::finalized |
( |
| ) |
const |
|
inline |
Get whether the builder was finalized.
- Returns
- Whether the builder was finalized
Definition at line 258 of file KokkosFunctionParser.h.
◆ getNumbers()
| const std::vector< Real > & Moose::Kokkos::RPNBuilder::getNumbers |
( |
| ) |
const |
|
inline |
Get numbers used in the expression.
- Returns
- The numbers
Definition at line 243 of file KokkosFunctionParser.h.
std::vector< Real > _numbers
Numbers used in the function.
◆ getRPN()
| const std::vector< Instruction > & Moose::Kokkos::RPNBuilder::getRPN |
( |
| ) |
const |
|
inline |
Get RPN sequence.
- Returns
- The RPN sequence
Definition at line 190 of file KokkosFunctionParser.h.
std::vector< Instruction > _rpn
RPN sequence.
◆ getVariables()
| const std::unordered_map< std::string, Variable > & Moose::Kokkos::RPNBuilder::getVariables |
( |
| ) |
const |
|
inline |
Get variables used in the expression.
- Returns
- The variables
Definition at line 248 of file KokkosFunctionParser.h.
std::unordered_map< std::string, Variable > _variables
Variables used in the function.
◆ hasDefaultVariables()
| bool Moose::Kokkos::RPNBuilder::hasDefaultVariables |
( |
| ) |
const |
|
inline |
Get whether default variables were added.
- Returns
- Whether default variables were added
Definition at line 200 of file KokkosFunctionParser.h.
bool _has_default_variables
Whether default variables were added.
◆ printRPN()
| void Moose::Kokkos::RPNBuilder::printRPN |
( |
const ConsoleStream & |
console | ) |
const |
Print RPN sequence for debugging.
- Parameters
-
| console | The console object |
◆ _binary_opcode_map
| const std::map<std::string, Opcode> Moose::Kokkos::RPNBuilder::_binary_opcode_map |
|
inlinestaticprivate |
◆ _finalized
| bool Moose::Kokkos::RPNBuilder::_finalized = false |
|
private |
◆ _function_opcode_map
| const std::map<std::string, std::pair<Opcode, unsigned int> > Moose::Kokkos::RPNBuilder::_function_opcode_map |
|
inlinestaticprivate |
Initial value:
Map from functions to opcodes and the expected number of arguments.
Definition at line 287 of file KokkosFunctionParser.h.
◆ _has_default_variables
| bool Moose::Kokkos::RPNBuilder::_has_default_variables = false |
|
private |
◆ _numbers
| std::vector<Real> Moose::Kokkos::RPNBuilder::_numbers |
|
private |
◆ _parser
◆ _rpn
| std::vector<Instruction> Moose::Kokkos::RPNBuilder::_rpn |
|
private |
◆ _unary_opcode_map
| const std::map<std::string, Opcode> Moose::Kokkos::RPNBuilder::_unary_opcode_map |
|
inlinestaticprivate |
◆ _variables
| std::unordered_map<std::string, Variable> Moose::Kokkos::RPNBuilder::_variables |
|
private |
The documentation for this class was generated from the following file: