39#include <boost/spirit/include/classic_assign_actor.hpp>
40#include <boost/spirit/include/classic_ast.hpp>
41#include <boost/spirit/include/classic_core.hpp>
42#include <boost/spirit/include/classic_push_back_actor.hpp>
43#include <boost/spirit/include/classic_symbols.hpp>
45#include <boost/algorithm/string/trim.hpp>
46#include <boost/math/special_functions/bessel.hpp>
48namespace bsp = boost::spirit::classic;
62 return (arg > 0.0) - (arg < 0.0);
71 std::random_device rd;
72 std::mt19937 gen(rd());
73 return std::normal_distribution<>(0, sigma)(gen);
78 return (x != 0.0 || y != 0.0) ?
sqrt(x * x + y * y) : 0.0;
83 return (x != 0.0 || y != 0.0) ? atan2(y, x) : 0.0;
134 (
"fmod",
static_cast<double (*)(
double,
double)
>(
172 typedef bsp::tree_parse_info<std::string::const_iterator,
173 bsp::node_val_data_factory<NekDouble>>
175 typedef bsp::tree_match<std::string::const_iterator,
176 bsp::node_val_data_factory<NekDouble>>::
278 for (
auto &it : it_es)
300 for (
auto const &it : constants)
326 std::string errormsg =
327 "Attempt to add numerically different constants under the "
330 std::cout << errormsg << std::endl;
342 ASSERTL1(value !=
nullptr,
"Constant variable not found: " +
name);
351 for (
auto const &it : params)
382 "Parameter not found: " +
name);
416 std::vector<std::string> variableNames;
417 bsp::parse((
char *)vlist.c_str(),
419 *(+(+bsp::graph_p)[bsp::push_back_a(variableNames)] >>
428 bsp::ast_parse<bsp::node_val_data_factory<NekDouble>,
430 bsp::space_parser>(expr.begin(), expr.end(),
431 myGrammar, bsp::space_p);
434 "Unable to fully parse function. Stopped just before: " +
435 std::string(parseInfo.stop, parseInfo.stop + 15));
439 throw std::runtime_error(
440 "Unable to fully parse function at: " +
441 std::string(parseInfo.stop, parseInfo.stop + 15));
455 for (
int i = 0; i < variableNames.size(); i++)
457 variableMap[variableNames[i]] = i;
463 stack, variableMap, 0);
469 "Constant expression yeilds non-empty execution stack. "
470 "Bug in PrepareExecutionAsYouParse()");
473 std::string(
"EXPRESSION_") + std::to_string(stackId), v.second);
474 stack.push_back(makeStep<StoreConst>(0, const_index));
497 "unknown analytic expression, it must first be defined "
498 "with DefineFunction(...)");
503 for (
int i = 0; i < stack.size(); i++)
505 (*stack[i]).run_once();
523 "unknown analytic expression, it must first be defined with "
524 "DefineFunction(...)");
545 for (
int i = 0; i < stack.size(); i++)
547 (*stack[i]).run_once();
564 "unknown analytic expression, it must first be defined with "
565 "DefineFunction(...)");
570 ASSERTL1(point.size() == variableMap.size(),
571 "The number of variables used to define this expression should"
572 " match the point dimensionality.");
577 VariableMap::const_iterator it;
579 for (it = variableMap.begin(); it != variableMap.end(); ++it)
585 for (
int i = 0; i < stack.size(); i++)
587 (*stack[i]).run_once();
605 std::vector<Array<OneD, const NekDouble>> points = {x, y,
z, t};
618 const int num_points = points[0].size();
620 "unknown analytic expression, it must first be defined "
621 "with DefineFunction(...)");
622 ASSERTL1(result.size() >= num_points,
623 "destination array must have enough capacity to store "
624 "expression values at each given point");
631 const int max_chunk_size = 1024;
632 const int nvals = points.size();
633 const int chunk_size = (std::min)(max_chunk_size, num_points);
643 if (result.size() < num_points)
649 int work_left = num_points;
650 while (work_left > 0)
652 const int this_chunk_size = (std::min)(work_left, 1024);
653 for (
int i = 0; i < this_chunk_size; i++)
655 for (
int j = 0; j < nvals; ++j)
657 m_variable[i + this_chunk_size * j] = points[j][offset + i];
660 for (
int i = 0; i < stack.size(); i++)
662 (*stack[i]).run_many(this_chunk_size);
664 for (
int i = 0; i < this_chunk_size; i++)
666 result[offset + i] =
m_state[i];
668 work_left -= this_chunk_size;
669 offset += this_chunk_size;
716 std::string valueStr(location->value.begin(), location->value.end());
717 boost::algorithm::trim(valueStr);
719 const bsp::parser_id parserID = location->value.id();
720#if defined(NEKTAR_DEBUG) || defined(NEKTAR_FULLDEBUG)
721 const int num_children = location->children.size();
727 "Illegal children under constant node: " + valueStr);
731 "Cannot find the value for the specified constant: " +
734 return std::make_pair(
true,
m_constant[it->second]);
739 "Illegal children under number node: " + valueStr);
740 return std::make_pair(
true, std::stod(valueStr.c_str()));
745 "Illegal children under variable node: " + valueStr);
747 VariableMap::const_iterator it = variableMap.find(valueStr);
749 "Unknown variable parsed: " + valueStr);
752 stack.push_back(makeStep<StoreVar>(stateIndex, it->second));
753 return std::make_pair(
false, 0);
758 "Illegal children under parameter node: " + valueStr);
762 "Unknown parameter parsed: " + valueStr);
765 stack.push_back(makeStep<StorePrm>(stateIndex, it->second));
766 return std::make_pair(
false, 0);
772 "Invalid function specified: " + valueStr);
773 ASSERTL1(num_children == 1 || num_children == 2,
774 "Function " + valueStr +
775 " has neither one or two "
776 "arguments: this is not implemented yet.");
778 if (location->children.size() == 1)
781 location->children.begin(), stack, variableMap, stateIndex);
791 makeStep<StoreConst>(stateIndex, const_index));
792 stack.push_back(makeStep<EvalAWGN>(stateIndex, stateIndex));
793 return std::make_pair(
false, 0);
798 return std::make_pair(
true,
806 stack, variableMap, stateIndex);
808 location->children.begin() + 1, stack, variableMap,
812 if (
true == v1.first &&
true == v2.first)
814 return std::make_pair(
815 true,
m_function2[it->second](v1.second, v2.second));
824 stack.push_back(makeStep<EvalAbs>(stateIndex, stateIndex));
825 return std::make_pair(
false, 0);
827 stack.push_back(makeStep<EvalAsin>(stateIndex, stateIndex));
828 return std::make_pair(
false, 0);
830 stack.push_back(makeStep<EvalAcos>(stateIndex, stateIndex));
831 return std::make_pair(
false, 0);
833 stack.push_back(makeStep<EvalAtan>(stateIndex, stateIndex));
834 return std::make_pair(
false, 0);
836 stack.push_back(makeStep<EvalAtan2>(stateIndex, stateIndex,
838 return std::make_pair(
false, 0);
840 stack.push_back(makeStep<EvalAng>(stateIndex, stateIndex,
842 return std::make_pair(
false, 0);
844 stack.push_back(makeStep<EvalBessel>(stateIndex, stateIndex,
846 return std::make_pair(
false, 0);
848 stack.push_back(makeStep<EvalCeil>(stateIndex, stateIndex));
849 return std::make_pair(
false, 0);
851 stack.push_back(makeStep<EvalCos>(stateIndex, stateIndex));
852 return std::make_pair(
false, 0);
854 stack.push_back(makeStep<EvalCosh>(stateIndex, stateIndex));
855 return std::make_pair(
false, 0);
857 stack.push_back(makeStep<EvalExp>(stateIndex, stateIndex));
858 return std::make_pair(
false, 0);
860 stack.push_back(makeStep<EvalFabs>(stateIndex, stateIndex));
861 return std::make_pair(
false, 0);
864 makeStep<EvalFloor>(stateIndex, stateIndex));
865 return std::make_pair(
false, 0);
867 stack.push_back(makeStep<EvalFmod>(stateIndex, stateIndex,
869 return std::make_pair(
false, 0);
871 stack.push_back(makeStep<EvalLog>(stateIndex, stateIndex));
872 return std::make_pair(
false, 0);
875 makeStep<EvalLog10>(stateIndex, stateIndex));
876 return std::make_pair(
false, 0);
878 stack.push_back(makeStep<EvalMax>(stateIndex, stateIndex,
880 return std::make_pair(
false, 0);
882 stack.push_back(makeStep<EvalMin>(stateIndex, stateIndex,
884 return std::make_pair(
false, 0);
886 stack.push_back(makeStep<EvalRad>(stateIndex, stateIndex,
888 return std::make_pair(
false, 0);
890 stack.push_back(makeStep<EvalSin>(stateIndex, stateIndex));
891 return std::make_pair(
false, 0);
893 stack.push_back(makeStep<EvalSinh>(stateIndex, stateIndex));
894 return std::make_pair(
false, 0);
896 stack.push_back(makeStep<EvalSqrt>(stateIndex, stateIndex));
897 return std::make_pair(
false, 0);
899 stack.push_back(makeStep<EvalTan>(stateIndex, stateIndex));
900 return std::make_pair(
false, 0);
902 stack.push_back(makeStep<EvalTanh>(stateIndex, stateIndex));
903 return std::make_pair(
false, 0);
905 stack.push_back(makeStep<EvalSign>(stateIndex, stateIndex));
906 return std::make_pair(
false, 0);
908 ASSERTL0(
false,
"Evaluation of " + valueStr +
909 " is not implemented yet");
911 return std::make_pair(
false, 0);
916 "Illegal factor - it can only be '-' and it was: " +
919 "Illegal number of children under factor node: " +
922 location->children.begin(), stack, variableMap, stateIndex);
927 return std::make_pair(
true, -v.second);
929 stack.push_back(makeStep<EvalNeg>(stateIndex, stateIndex));
930 return std::make_pair(
false, 0);
936 "Too few or too many arguments for mathematical operator: " +
939 location->children.begin() + 0, stack, variableMap, stateIndex);
942 stack, variableMap, stateIndex + 1);
946 if ((left.first ==
true) && (right.first ==
true))
948 switch (*valueStr.begin())
951 return std::make_pair(
true, left.second + right.second);
953 return std::make_pair(
true, left.second - right.second);
955 return std::make_pair(
true, left.second * right.second);
957 return std::make_pair(
true, left.second / right.second);
959 return std::make_pair(
960 true, std::fmod(left.second, right.second));
962 return std::make_pair(
963 true, std::pow(left.second, right.second));
965 return std::make_pair(
true,
966 left.second == right.second);
968 if (*(valueStr.end() - 1) ==
'=')
970 return std::make_pair(
true,
971 left.second <= right.second);
975 return std::make_pair(
true,
976 left.second < right.second);
979 if (*(valueStr.end() - 1) ==
'=')
981 return std::make_pair(
true,
982 left.second >= right.second);
986 return std::make_pair(
true,
987 left.second > right.second);
991 "Invalid operator encountered: " + valueStr);
993 return std::make_pair(
false, 0);
998 if (
true == left.first)
1004 stack.push_back(makeStep<StoreConst>(stateIndex, const_index));
1006 if (
true == right.first)
1013 makeStep<StoreConst>(stateIndex + 1, const_index));
1016 switch (*valueStr.begin())
1019 stack.push_back(makeStep<EvalSum>(stateIndex, stateIndex,
1021 return std::make_pair(
false, 0);
1023 stack.push_back(makeStep<EvalSub>(stateIndex, stateIndex,
1025 return std::make_pair(
false, 0);
1027 stack.push_back(makeStep<EvalMul>(stateIndex, stateIndex,
1029 return std::make_pair(
false, 0);
1031 stack.push_back(makeStep<EvalDiv>(stateIndex, stateIndex,
1033 return std::make_pair(
false, 0);
1035 stack.push_back(makeStep<EvalMod>(stateIndex, stateIndex,
1037 return std::make_pair(
false, 0);
1039 stack.push_back(makeStep<EvalPow>(stateIndex, stateIndex,
1041 return std::make_pair(
false, 0);
1043 stack.push_back(makeStep<EvalLogicalEqual>(
1044 stateIndex, stateIndex, stateIndex + 1));
1045 return std::make_pair(
false, 0);
1047 if (*(valueStr.end() - 1) ==
'=')
1049 stack.push_back(makeStep<EvalLogicalLeq>(
1050 stateIndex, stateIndex, stateIndex + 1));
1054 stack.push_back(makeStep<EvalLogicalLess>(
1055 stateIndex, stateIndex, stateIndex + 1));
1057 return std::make_pair(
false, 0);
1060 if (*(valueStr.end() - 1) ==
'=')
1062 stack.push_back(makeStep<EvalLogicalGeq>(
1063 stateIndex, stateIndex, stateIndex + 1));
1067 stack.push_back(makeStep<EvalLogicalGreater>(
1068 stateIndex, stateIndex, stateIndex + 1));
1070 return std::make_pair(
false, 0);
1074 "Invalid operator encountered: " + valueStr);
1076 return std::make_pair(
false, 0);
1082 "Too few or too many arguments for mathematical operator: " +
1085 ASSERTL0(
false,
"Illegal expression encountered: " + valueStr);
1086 return std::make_pair(
false, 0);
1112 for (
auto const &it : vars)
1132 const std::vector<std::string> &
variables)
1155 *((bsp::root_node_d[bsp::str_p(
"||")] >>
logical_and));
1159 *((bsp::root_node_d[bsp::str_p(
"&&")] >>
equality));
1162 lt_gt >> *((bsp::root_node_d[bsp::str_p(
"==")] >>
lt_gt));
1165 *((bsp::root_node_d[bsp::str_p(
"<=")] >>
add_sub) |
1166 (bsp::root_node_d[bsp::str_p(
">=")] >>
add_sub) |
1167 (bsp::root_node_d[bsp::ch_p(
'<')] >>
add_sub) |
1168 (bsp::root_node_d[bsp::ch_p(
'>')] >>
add_sub));
1171 negate >> *((bsp::root_node_d[bsp::ch_p(
'+')] >>
negate) |
1172 (bsp::root_node_d[bsp::ch_p(
'-')] >>
negate));
1178 *((bsp::root_node_d[bsp::ch_p(
'*')] >>
exponential) |
1179 (bsp::root_node_d[bsp::ch_p(
'/')] >>
exponential) |
1180 (bsp::root_node_d[bsp::ch_p(
'%')] >>
exponential));
1186 bsp::inner_node_d[bsp::ch_p(
'(') >>
expression >>
1189 bsp::leaf_node_d[bsp::lexeme_d[(bsp::alpha_p |
'_' |
'$') >>
1190 *(bsp::alnum_p |
'_' |
1196 bsp::infix_node_d[bsp::inner_node_d[bsp::ch_p(
'(') >>
1204 number = bsp::leaf_node_d[bsp::lexeme_d[bsp::real_p]] >>
op;
1209 op = bsp::eps_p(bsp::end_p |
"||" |
"&&" |
"==" |
"<=" |
">=" |
1210 '<' |
'>' |
'+' |
'-' |
'*' |
'/' |
'%' |
'^' |
1220 bsp::rule<ScannerT, bsp::parser_context<>, bsp::parser_tag<N>>;
1322 typedef std::vector<NekDouble> &
vr;
1323 typedef const std::vector<NekDouble> &
cvr;
1328 template <
typename StepType>
1405 for (
int i = 0; i < n; i++)
1423 for (
int i = 0; i < n; i++)
1441 for (
int i = 0; i < n; i++)
1459 for (
int i = 0; i < n; i++)
1477 for (
int i = 0; i < n; i++)
1496 for (
int i = 0; i < n; i++)
1515 for (
int i = 0; i < n; i++)
1534 for (
int i = 0; i < n; i++)
1553 for (
int i = 0; i < n; i++)
1572 for (
int i = 0; i < n; i++)
1590 for (
int i = 0; i < n; i++)
1609 for (
int i = 0; i < n; i++)
1628 for (
int i = 0; i < n; i++)
1647 for (
int i = 0; i < n; i++)
1666 for (
int i = 0; i < n; i++)
1685 for (
int i = 0; i < n; i++)
1704 for (
int i = 0; i < n; i++)
1722 for (
int i = 0; i < n; i++)
1741 for (
int i = 0; i < n; i++)
1759 for (
int i = 0; i < n; i++)
1777 for (
int i = 0; i < n; i++)
1795 for (
int i = 0; i < n; i++)
1814 for (
int i = 0; i < n; i++)
1833 for (
int i = 0; i < n; i++)
1853 for (
int i = 0; i < n; i++)
1871 for (
int i = 0; i < n; i++)
1889 for (
int i = 0; i < n; i++)
1907 for (
int i = 0; i < n; i++)
1925 for (
int i = 0; i < n; i++)
1943 for (
int i = 0; i < n; i++)
1961 for (
int i = 0; i < n; i++)
1980 for (
int i = 0; i < n; i++)
1998 for (
int i = 0; i < n; i++)
2016 for (
int i = 0; i < n; i++)
2035 for (
int i = 0; i < n; i++)
2054 for (
int i = 0; i < n; i++)
2073 for (
int i = 0; i < n; i++)
2091 for (
int i = 0; i < n; i++)
2109 for (
int i = 0; i < n; i++)
2127 for (
int i = 0; i < n; i++)
2145 for (
int i = 0; i < n; i++)
2166 for (
int i = 0; i < n; i++)
2194 m_impl = std::move(r.m_impl);
2200 m_impl->SetRandomSeed(seed);
2204 std::map<std::string, NekDouble>
const &constants)
2206 m_impl->AddConstants(constants);
2221 m_impl->SetParameters(params);
2236 return m_impl->GetTime();
2240 const std::string &function)
2242 return m_impl->DefineFunction(vlist, function);
2247 return m_impl->Evaluate(AnalyticExpression_id);
2254 return m_impl->Evaluate(AnalyticExpression_id, x, y,
z, t);
2258 std::vector<NekDouble> point)
2260 return m_impl->EvaluateAtPoint(AnalyticExpression_id, point);
2270 m_impl->Evaluate(expression_id, x, y,
z, t, result);
2274 const int expression_id,
2278 m_impl->Evaluate(expression_id, points, result);
#define ASSERTL0(condition, msg)
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
#define LIB_UTILITIES_EXPORT
static const int variableID
AnalyticExpression(const bsp::symbols< NekDouble > *constants, const std::vector< std::string > &variables)
static const int numberID
static const int constantID
static const int functionID
static const int parameterID
static const int operatorID
Nektar::LibUtilities::Interpreter::ExpressionEvaluator::AnalyticExpression::variables variables_p
const bsp::symbols< NekDouble > * constants_p
Concrete implementation of the interface defined in Interpreter.
std::map< std::string, int > VariableMap
void Evaluate(const int id, const Array< OneD, const NekDouble > &x, const Array< OneD, const NekDouble > &y, const Array< OneD, const NekDouble > &z, const Array< OneD, const NekDouble > &t, Array< OneD, NekDouble > &result)
Evaluate a function which depends only on constants and/or parameters.
std::vector< NekDouble > m_constant
int AddConstant(std::string const &name, NekDouble value)
Set constants to be evaluated.
void SetParameters(std::map< std::string, NekDouble > const ¶ms)
Set parameter values.
const std::vector< NekDouble > & cvr
std::map< std::string, int > ParameterMap
VariableMap m_expressionVariableMap
std::map< std::string, int > FunctionNameMap
std::vector< int > m_state_sizes
Vector of state sizes per each.
FunctionNameMap m_functionMapNameToInstanceType
int DefineFunction(const std::string &vlist, const std::string &expr)
Defines a function for the purposes of evaluation.
NekDouble GetConstant(std::string const &name)
Return the value of a constant.
NekDouble Evaluate(const int id)
Evaluate a function which depends only on constants and/or parameters.
std::vector< ExecutionStack > m_executionStack
ConstantMap m_constantMapNameToId
Timer m_timer
Timer and sum of evaluation times.
std::vector< const Array< OneD, const NekDouble > * > VariableArray
NekDouble(* TwoArgFunc)(NekDouble, NekDouble)
std::vector< VariableMap > m_stackVariableMap
Keeping map of variables individually per each analytic expression allows correctly handling expressi...
NekDouble EvaluateAtPoint(const int id, const std::vector< NekDouble > point)
Evaluate a function which depends on zero or more variables.
std::vector< EvaluationStep * > ExecutionStack
std::map< int, TwoArgFunc > m_function2
NekDouble Evaluate(const int id, const NekDouble x, const NekDouble y, const NekDouble z, const NekDouble t)
Evaluate a function which depends only on constants and/or parameters.
std::map< int, OneArgFunc > m_function
void SetParameter(std::string const &name, NekDouble value)
Set parameter values.
ParameterMap m_parameterMapNameToId
The following data structures hold input data to be used on evaluation stage. There are three types o...
int m_state_size
This counter is used by PrepareExecutionAsYouParse for finding the minimal state size necessary for e...
NekDouble GetTime() const
Returns the total walltime spent in evaluation procedures in seconds.
ExpressionEvaluator()
Initializes the evaluator.
std::vector< NekDouble > m_variable
std::vector< NekDouble > m_parameter
std::pair< bool, NekDouble > PrecomputedValue
NekDouble GetParameter(std::string const &name)
Get the value of a parameter.
void Evaluate(const int id, const std::vector< Array< OneD, const NekDouble > > &points, Array< OneD, NekDouble > &result)
Evaluate a function which depends only on constants and/or parameters.
bsp::tree_parse_info< std::string::const_iterator, bsp::node_val_data_factory< NekDouble > > ParsedTreeInfo
std::vector< NekDouble > & vr
Short names to minimise the infractructural code mess in defining functors below.
void SetRandomSeed(unsigned int seed)
Sets the random seed for the pseudorandom number generator.
std::vector< NekDouble > m_state
This vector stores the execution state (memory) used by the sequential execution process.
std::map< std::string, int > ExpressionMap
NekDouble(* OneArgFunc)(NekDouble)
bsp::tree_match< std::string::const_iterator, bsp::node_val_data_factory< NekDouble > >::tree_iterator ParsedTreeIterator
PrecomputedValue PrepareExecutionAsYouParse(const ParsedTreeIterator &location, ExecutionStack &stack, VariableMap &variableMap, int stateIndex)
Prepares an execution stack for the evaluation of a function.
void AddConstants(std::map< std::string, NekDouble > const &constants)
Set constants to be evaluated.
bsp::symbols< NekDouble > m_constantsParser
NekDouble m_total_eval_time
~ExpressionEvaluator(void)
Destructor that removes all entries from the execution stack.
EvaluationStep * makeStep(ci dest, ci src_left=0, ci src_right=0)
Factory method which makes code little less messy.
ExpressionMap m_parsedMapExprToExecStackId
These vector and map store pre-processed evaluation sequences for the analytic expressions....
std::map< std::string, int > ConstantMap
Interpreter class for the evaluation of mathematical expressions.
NekDouble GetTime() const
Returns the total walltime spent in evaluation procedures in seconds.
void AddConstants(std::map< std::string, NekDouble > const &constants)
Set constants to be evaluated.
Interpreter()
Default constructor.
std::unique_ptr< ExpressionEvaluator > m_impl
Concrete implementation of the above API calls.
Interpreter & operator=(Interpreter &&)
Default assignment operator.
NekDouble GetConstant(std::string const &name)
Return the value of a constant.
int AddConstant(std::string const &name, NekDouble value)
Set constants to be evaluated.
NekDouble EvaluateAtPoint(const int id, std::vector< NekDouble > point)
Evaluate a function which depends on zero or more variables.
int DefineFunction(const std::string &vlist, const std::string &expr)
Defines a function for the purposes of evaluation.
~Interpreter()
Default destructor.
void SetParameters(std::map< std::string, NekDouble > const ¶ms)
Set parameter values.
void SetParameter(std::string const &name, NekDouble value)
Set parameter values.
NekDouble Evaluate(const int id)
Evaluate a function which depends only on constants and/or parameters.
NekDouble GetParameter(std::string const &name)
Get the value of a parameter.
void SetRandomSeed(unsigned int seed=123u)
Sets the random seed for the pseudorandom number generator.
NekDouble TimePerTest(unsigned int n)
Returns amount of seconds per iteration in a test with n iterations.
NekDouble(* PFD1)(NekDouble)
NekDouble(* PFD2)(NekDouble, NekDouble)
static NekDouble rad(NekDouble x, NekDouble y)
NekDouble awgn(NekDouble sigma)
static NekDouble ang(NekDouble x, NekDouble y)
NekDouble(* PFD4)(NekDouble, NekDouble, NekDouble, NekDouble)
NekDouble(* PFD3)(NekDouble, NekDouble, NekDouble)
NekDouble sign(NekDouble arg)
Nektar::LibUtilities::functions functions_p
InputIterator find(InputIterator first, InputIterator last, InputIterator startingpoint, const EqualityComparable &value)
std::vector< double > z(NPUPPER)
scalarT< T > abs(scalarT< T > in)
scalarT< T > log(scalarT< T > in)
scalarT< T > sqrt(scalarT< T > in)
bsp_rule< operatorID> add_sub
bsp_rule< operatorID> mult_div_mod
bsp_rule< parameterID > parameter
bsp_rule< operatorID> const & start() const
bsp::rule< ScannerT, bsp::parser_context<>, bsp::parser_tag< N > > bsp_rule
bsp_rule< operatorID> lt_gt
bsp_rule< unaryID > negate
bsp_rule< variableID > variable
definition(AnalyticExpression const &self)
bsp_rule< operatorID> expression
bsp_rule< operatorID> logical_and
bsp_rule< operatorID> equality
bsp_rule< constantID > constant
bsp_rule< functionID > function
bsp_rule< operatorID> exponent
bsp_rule< numberID > number
bsp_rule< operatorID> base
bsp_rule< operatorID> logical_or
bsp_rule< operatorID> exponential
variables(std::vector< std::string > const &vars)
CopyState(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
EvalAWGN(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
EvalAbs(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
EvalAcos(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
EvalAng(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
EvalAsin(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
EvalAtan2(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
EvalAtan(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
EvalBessel(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
EvalCeil(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
EvalCos(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
EvalCosh(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
EvalDiv(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
EvalExp(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
EvalFabs(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
EvalFloor(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
EvalFmod(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
EvalLog10(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
EvalLog(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
EvalLogicalEqual(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
EvalLogicalGeq(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
EvalLogicalGreater(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
EvalLogicalLeq(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
EvalLogicalLess(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
EvalMax(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
EvalMin(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
EvalMod(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
EvalMul(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
EvalNeg(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
EvalPow(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
EvalRad(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
EvalSign(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
EvalSin(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
EvalSinh(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
EvalSqrt(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
EvalSub(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
EvalSum(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
EvalTan(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
EvalTanh(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
Function objects (functors)
rgt rng
reference to random number generator
virtual void run_many(ci n)=0
declaring this guy pure virtual shortens virtual table. It saves some execution time.
ci storeIdx
indices in the above arrays uniquely defining actual command arguments
virtual ~EvaluationStep()
virtual void run_once()=0
EvaluationStep(rgt rn, ci i, ci l, ci r, vr s, cvr c, cvr p, cvr v)
vr state
references to arrays holding the common state
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
StoreConst(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
StorePrm(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
void run_many(ci n) override
declaring this guy pure virtual shortens virtual table. It saves some execution time.
StoreVar(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)