Nektar++
Public Types | Public Member Functions | Public Attributes | List of all members
Nektar::LibUtilities::Interpreter::ExpressionEvaluator::AnalyticExpression::definition< ScannerT > Struct Template Reference

Public Types

template<int N>
using bsp_rule = bsp::rule< ScannerT, bsp::parser_context<>, bsp::parser_tag< N > >
 

Public Member Functions

 definition (AnalyticExpression const &self)
 
bsp_rule< operatorID> const & start () const
 

Public Attributes

NekDouble ParsedDouble
 
bsp_rule< constantIDconstant
 
bsp_rule< numberIDnumber
 
bsp_rule< variableIDvariable
 
bsp_rule< parameterIDparameter
 
bsp_rule< functionIDfunction
 
bsp_rule< unaryIDnegate
 
bsp_rule< operatorIDbase
 
bsp_rule< operatorIDexponent
 
bsp_rule< operatorIDexponential
 
bsp_rule< operatorIDmult_div_mod
 
bsp_rule< operatorIDadd_sub
 
bsp_rule< operatorIDlt_gt
 
bsp_rule< operatorIDequality
 
bsp_rule< operatorIDlogical_and
 
bsp_rule< operatorIDlogical_or
 
bsp_rule< operatorIDexpression
 
bsp_rule< operatorIDop
 

Detailed Description

template<typename ScannerT>
struct Nektar::LibUtilities::Interpreter::ExpressionEvaluator::AnalyticExpression::definition< ScannerT >

Definition at line 1148 of file Interpreter/Interpreter.cpp.

Member Typedef Documentation

◆ bsp_rule

template<typename ScannerT >
template<int N>
using Nektar::LibUtilities::Interpreter::ExpressionEvaluator::AnalyticExpression::definition< ScannerT >::bsp_rule = bsp::rule<ScannerT, bsp::parser_context<>, bsp::parser_tag<N> >

Definition at line 1222 of file Interpreter/Interpreter.cpp.

Constructor & Destructor Documentation

◆ definition()

template<typename ScannerT >
Nektar::LibUtilities::Interpreter::ExpressionEvaluator::AnalyticExpression::definition< ScannerT >::definition ( AnalyticExpression const &  self)
inline

This function specifies the grammar of the MathAnalyticExpression parser.

Definition at line 1152 of file Interpreter/Interpreter.cpp.

1153 {
1155
1156 logical_or =
1157 logical_and >>
1158 *((bsp::root_node_d[bsp::str_p("||")] >> logical_and));
1159
1160 logical_and =
1161 equality >>
1162 *((bsp::root_node_d[bsp::str_p("&&")] >> equality));
1163
1164 equality =
1165 lt_gt >> *((bsp::root_node_d[bsp::str_p("==")] >> lt_gt));
1166
1167 lt_gt = add_sub >>
1168 *((bsp::root_node_d[bsp::str_p("<=")] >> add_sub) |
1169 (bsp::root_node_d[bsp::str_p(">=")] >> add_sub) |
1170 (bsp::root_node_d[bsp::ch_p('<')] >> add_sub) |
1171 (bsp::root_node_d[bsp::ch_p('>')] >> add_sub));
1172
1173 add_sub =
1174 negate >> *((bsp::root_node_d[bsp::ch_p('+')] >> negate) |
1175 (bsp::root_node_d[bsp::ch_p('-')] >> negate));
1176
1177 negate = !(bsp::root_node_d[bsp::ch_p('-')]) >> mult_div_mod;
1178
1179 mult_div_mod =
1180 exponential >>
1181 *((bsp::root_node_d[bsp::ch_p('*')] >> exponential) |
1182 (bsp::root_node_d[bsp::ch_p('/')] >> exponential) |
1183 (bsp::root_node_d[bsp::ch_p('%')] >> exponential));
1184
1185 exponential =
1186 base >> !(bsp::root_node_d[bsp::ch_p('^')] >> exponential);
1187
1189 bsp::inner_node_d[bsp::ch_p('(') >> expression >>
1190 bsp::ch_p(')')];
1191 parameter =
1192 bsp::leaf_node_d[bsp::lexeme_d[(bsp::alpha_p | '_' | '$') >>
1193 *(bsp::alnum_p | '_' |
1194 '$')]] >>
1195 op;
1196
1197 function =
1198 bsp::root_node_d[functions_p] >>
1199 bsp::infix_node_d[bsp::inner_node_d[bsp::ch_p('(') >>
1200 expression >>
1201 *(',' >> expression) >>
1202 bsp::ch_p(')')]];
1203
1204 variable =
1205 bsp::leaf_node_d[bsp::lexeme_d[self.variables_p]] >> op;
1206
1207 number = bsp::leaf_node_d[bsp::lexeme_d[bsp::real_p]] >> op;
1208
1209 constant =
1210 bsp::leaf_node_d[bsp::lexeme_d[*self.constants_p]] >> op;
1211
1212 op = bsp::eps_p(bsp::end_p | "||" | "&&" | "==" | "<=" | ">=" |
1213 '<' | '>' | '+' | '-' | '*' | '/' | '%' | '^' |
1214 ')' | ',');
1215 }
Nektar::LibUtilities::functions functions_p

References Nektar::LibUtilities::Interpreter::ExpressionEvaluator::AnalyticExpression::definition< ScannerT >::add_sub, Nektar::LibUtilities::Interpreter::ExpressionEvaluator::AnalyticExpression::definition< ScannerT >::base, Nektar::LibUtilities::Interpreter::ExpressionEvaluator::AnalyticExpression::definition< ScannerT >::constant, Nektar::LibUtilities::Interpreter::ExpressionEvaluator::AnalyticExpression::constants_p, Nektar::LibUtilities::Interpreter::ExpressionEvaluator::AnalyticExpression::definition< ScannerT >::equality, Nektar::LibUtilities::Interpreter::ExpressionEvaluator::AnalyticExpression::definition< ScannerT >::exponential, Nektar::LibUtilities::Interpreter::ExpressionEvaluator::AnalyticExpression::definition< ScannerT >::expression, Nektar::LibUtilities::Interpreter::ExpressionEvaluator::AnalyticExpression::definition< ScannerT >::function, Nektar::LibUtilities::functions_p, Nektar::LibUtilities::Interpreter::ExpressionEvaluator::AnalyticExpression::definition< ScannerT >::logical_and, Nektar::LibUtilities::Interpreter::ExpressionEvaluator::AnalyticExpression::definition< ScannerT >::logical_or, Nektar::LibUtilities::Interpreter::ExpressionEvaluator::AnalyticExpression::definition< ScannerT >::lt_gt, Nektar::LibUtilities::Interpreter::ExpressionEvaluator::AnalyticExpression::definition< ScannerT >::mult_div_mod, Nektar::LibUtilities::Interpreter::ExpressionEvaluator::AnalyticExpression::definition< ScannerT >::negate, Nektar::LibUtilities::Interpreter::ExpressionEvaluator::AnalyticExpression::definition< ScannerT >::number, Nektar::LibUtilities::Interpreter::ExpressionEvaluator::AnalyticExpression::definition< ScannerT >::op, Nektar::LibUtilities::Interpreter::ExpressionEvaluator::AnalyticExpression::definition< ScannerT >::parameter, Nektar::LibUtilities::Interpreter::ExpressionEvaluator::AnalyticExpression::definition< ScannerT >::variable, and Nektar::LibUtilities::Interpreter::ExpressionEvaluator::AnalyticExpression::variables_p.

Member Function Documentation

◆ start()

template<typename ScannerT >
bsp_rule< operatorID> const & Nektar::LibUtilities::Interpreter::ExpressionEvaluator::AnalyticExpression::definition< ScannerT >::start ( ) const
inline

Member Data Documentation

◆ add_sub

◆ base

◆ constant

◆ equality

◆ exponent

Definition at line 1232 of file Interpreter/Interpreter.cpp.

◆ exponential

◆ expression

◆ function

◆ logical_and

◆ logical_or

◆ lt_gt

◆ mult_div_mod

◆ negate

◆ number

◆ op

◆ parameter

◆ ParsedDouble

This holds the NekDouble value that is parsed by spirit so it can be stored in the AST.

Definition at line 1219 of file Interpreter/Interpreter.cpp.

◆ variable