39 #define BOOST_SPIRIT_THREADSAFE
40 #include <boost/spirit/include/classic_assign_actor.hpp>
41 #include <boost/spirit/include/classic_ast.hpp>
42 #include <boost/spirit/include/classic_core.hpp>
43 #include <boost/spirit/include/classic_push_back_actor.hpp>
44 #include <boost/spirit/include/classic_symbols.hpp>
46 #include <boost/random/mersenne_twister.hpp>
47 #include <boost/random/normal_distribution.hpp>
48 #include <boost/random/variate_generator.hpp>
50 #include <boost/algorithm/string/trim.hpp>
51 #include <boost/math/special_functions/bessel.hpp>
53 namespace bsp = boost::spirit::classic;
58 #if defined(__INTEL_COMPILER)
66 namespace LibUtilities
72 return (arg > 0.0) - (arg < 0.0);
81 boost::variate_generator<boost::mt19937 &, boost::normal_distribution<>>
82 _normal(rng, boost::normal_distribution<>(0, sigma));
88 return (x != 0.0 || y != 0.0) ?
sqrt(x * x + y * y) : 0.0;
93 return (x != 0.0 || y != 0.0) ? atan2(y, x) : 0.0;
142 (
"fmod",
static_cast<double (*)(
double,
double)
>(
178 typedef bsp::tree_parse_info<std::string::const_iterator,
179 bsp::node_val_data_factory<NekDouble>>
181 typedef bsp::tree_match<std::string::const_iterator,
182 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 != NULL,
"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(
741 true, boost::lexical_cast<NekDouble>(valueStr.c_str()));
746 "Illegal children under variable node: " + valueStr);
748 VariableMap::const_iterator it = variableMap.find(valueStr);
750 "Unknown variable parsed: " + valueStr);
753 stack.push_back(makeStep<StoreVar>(stateIndex, it->second));
754 return std::make_pair(
false, 0);
759 "Illegal children under parameter node: " + valueStr);
763 "Unknown parameter parsed: " + valueStr);
766 stack.push_back(makeStep<StorePrm>(stateIndex, it->second));
767 return std::make_pair(
false, 0);
773 "Invalid function specified: " + valueStr);
774 ASSERTL1(num_children == 1 || num_children == 2,
775 "Function " + valueStr +
776 " has neither one or two "
777 "arguments: this is not implemented yet.");
779 if (location->children.size() == 1)
782 location->children.begin(), stack, variableMap, stateIndex);
792 makeStep<StoreConst>(stateIndex, const_index));
793 stack.push_back(makeStep<EvalAWGN>(stateIndex, stateIndex));
794 return std::make_pair(
false, 0);
799 return std::make_pair(
true,
807 stack, variableMap, stateIndex);
809 location->children.begin() + 1, stack, variableMap,
813 if (
true == v1.first &&
true == v2.first)
815 return std::make_pair(
816 true,
m_function2[it->second](v1.second, v2.second));
825 stack.push_back(makeStep<EvalAbs>(stateIndex, stateIndex));
826 return std::make_pair(
false, 0);
828 stack.push_back(makeStep<EvalAsin>(stateIndex, stateIndex));
829 return std::make_pair(
false, 0);
831 stack.push_back(makeStep<EvalAcos>(stateIndex, stateIndex));
832 return std::make_pair(
false, 0);
834 stack.push_back(makeStep<EvalAtan>(stateIndex, stateIndex));
835 return std::make_pair(
false, 0);
837 stack.push_back(makeStep<EvalAtan2>(stateIndex, stateIndex,
839 return std::make_pair(
false, 0);
841 stack.push_back(makeStep<EvalAng>(stateIndex, stateIndex,
843 return std::make_pair(
false, 0);
845 stack.push_back(makeStep<EvalBessel>(stateIndex, stateIndex,
847 return std::make_pair(
false, 0);
849 stack.push_back(makeStep<EvalCeil>(stateIndex, stateIndex));
850 return std::make_pair(
false, 0);
852 stack.push_back(makeStep<EvalCos>(stateIndex, stateIndex));
853 return std::make_pair(
false, 0);
855 stack.push_back(makeStep<EvalCosh>(stateIndex, stateIndex));
856 return std::make_pair(
false, 0);
858 stack.push_back(makeStep<EvalExp>(stateIndex, stateIndex));
859 return std::make_pair(
false, 0);
861 stack.push_back(makeStep<EvalFabs>(stateIndex, stateIndex));
862 return std::make_pair(
false, 0);
865 makeStep<EvalFloor>(stateIndex, stateIndex));
866 return std::make_pair(
false, 0);
868 stack.push_back(makeStep<EvalFmod>(stateIndex, stateIndex,
870 return std::make_pair(
false, 0);
872 stack.push_back(makeStep<EvalLog>(stateIndex, stateIndex));
873 return std::make_pair(
false, 0);
876 makeStep<EvalLog10>(stateIndex, stateIndex));
877 return std::make_pair(
false, 0);
879 stack.push_back(makeStep<EvalRad>(stateIndex, stateIndex,
881 return std::make_pair(
false, 0);
883 stack.push_back(makeStep<EvalSin>(stateIndex, stateIndex));
884 return std::make_pair(
false, 0);
886 stack.push_back(makeStep<EvalSinh>(stateIndex, stateIndex));
887 return std::make_pair(
false, 0);
889 stack.push_back(makeStep<EvalSqrt>(stateIndex, stateIndex));
890 return std::make_pair(
false, 0);
892 stack.push_back(makeStep<EvalTan>(stateIndex, stateIndex));
893 return std::make_pair(
false, 0);
895 stack.push_back(makeStep<EvalTanh>(stateIndex, stateIndex));
896 return std::make_pair(
false, 0);
898 stack.push_back(makeStep<EvalSign>(stateIndex, stateIndex));
899 return std::make_pair(
false, 0);
901 ASSERTL0(
false,
"Evaluation of " + valueStr +
902 " is not implemented yet");
904 return std::make_pair(
false, 0);
909 "Illegal factor - it can only be '-' and it was: " +
912 "Illegal number of children under factor node: " +
915 location->children.begin(), stack, variableMap, stateIndex);
920 return std::make_pair(
true, -v.second);
922 stack.push_back(makeStep<EvalNeg>(stateIndex, stateIndex));
923 return std::make_pair(
false, 0);
929 "Too few or too many arguments for mathematical operator: " +
932 location->children.begin() + 0, stack, variableMap, stateIndex);
935 stack, variableMap, stateIndex + 1);
939 if ((left.first ==
true) && (right.first ==
true))
941 switch (*valueStr.begin())
944 return std::make_pair(
true, left.second + right.second);
946 return std::make_pair(
true, left.second - right.second);
948 return std::make_pair(
true, left.second * right.second);
950 return std::make_pair(
true, left.second / right.second);
952 return std::make_pair(
953 true, std::fmod(left.second, right.second));
955 return std::make_pair(
956 true, std::pow(left.second, right.second));
958 return std::make_pair(
true,
959 left.second == right.second);
961 if (*(valueStr.end() - 1) ==
'=')
963 return std::make_pair(
true,
964 left.second <= right.second);
968 return std::make_pair(
true,
969 left.second < right.second);
971 return std::make_pair(
false, 0);
973 if (*(valueStr.end() - 1) ==
'=')
975 return std::make_pair(
true,
976 left.second >= right.second);
980 return std::make_pair(
true,
981 left.second > right.second);
983 return std::make_pair(
false, 0);
986 "Invalid operator encountered: " + valueStr);
988 return std::make_pair(
false, 0);
993 if (
true == left.first)
999 stack.push_back(makeStep<StoreConst>(stateIndex, const_index));
1001 if (
true == right.first)
1008 makeStep<StoreConst>(stateIndex + 1, const_index));
1011 switch (*valueStr.begin())
1014 stack.push_back(makeStep<EvalSum>(stateIndex, stateIndex,
1016 return std::make_pair(
false, 0);
1018 stack.push_back(makeStep<EvalSub>(stateIndex, stateIndex,
1020 return std::make_pair(
false, 0);
1022 stack.push_back(makeStep<EvalMul>(stateIndex, stateIndex,
1024 return std::make_pair(
false, 0);
1026 stack.push_back(makeStep<EvalDiv>(stateIndex, stateIndex,
1028 return std::make_pair(
false, 0);
1030 stack.push_back(makeStep<EvalMod>(stateIndex, stateIndex,
1032 return std::make_pair(
false, 0);
1034 stack.push_back(makeStep<EvalPow>(stateIndex, stateIndex,
1036 return std::make_pair(
false, 0);
1038 stack.push_back(makeStep<EvalLogicalEqual>(
1039 stateIndex, stateIndex, stateIndex + 1));
1040 return std::make_pair(
false, 0);
1042 if (*(valueStr.end() - 1) ==
'=')
1044 stack.push_back(makeStep<EvalLogicalLeq>(
1045 stateIndex, stateIndex, stateIndex + 1));
1049 stack.push_back(makeStep<EvalLogicalLess>(
1050 stateIndex, stateIndex, stateIndex + 1));
1052 return std::make_pair(
false, 0);
1055 if (*(valueStr.end() - 1) ==
'=')
1057 stack.push_back(makeStep<EvalLogicalGeq>(
1058 stateIndex, stateIndex, stateIndex + 1));
1062 stack.push_back(makeStep<EvalLogicalGreater>(
1063 stateIndex, stateIndex, stateIndex + 1));
1065 return std::make_pair(
false, 0);
1069 "Invalid operator encountered: " + valueStr);
1071 return std::make_pair(
false, 0);
1077 "Too few or too many arguments for mathematical operator: " +
1080 ASSERTL0(
false,
"Illegal expression encountered: " + valueStr);
1081 return std::make_pair(
false, 0);
1107 for (
auto const &it : vars)
1127 const std::vector<std::string> &
variables)
1150 *((bsp::root_node_d[bsp::str_p(
"||")] >>
logical_and));
1154 *((bsp::root_node_d[bsp::str_p(
"&&")] >>
equality));
1157 lt_gt >> *((bsp::root_node_d[bsp::str_p(
"==")] >>
lt_gt));
1160 *((bsp::root_node_d[bsp::str_p(
"<=")] >>
add_sub) |
1161 (bsp::root_node_d[bsp::str_p(
">=")] >>
add_sub) |
1162 (bsp::root_node_d[bsp::ch_p(
'<')] >>
add_sub) |
1163 (bsp::root_node_d[bsp::ch_p(
'>')] >>
add_sub));
1166 negate >> *((bsp::root_node_d[bsp::ch_p(
'+')] >>
negate) |
1167 (bsp::root_node_d[bsp::ch_p(
'-')] >>
negate));
1173 *((bsp::root_node_d[bsp::ch_p(
'*')] >>
exponential) |
1174 (bsp::root_node_d[bsp::ch_p(
'/')] >>
exponential) |
1175 (bsp::root_node_d[bsp::ch_p(
'%')] >>
exponential));
1181 bsp::inner_node_d[bsp::ch_p(
'(') >>
expression >>
1184 bsp::leaf_node_d[bsp::lexeme_d[(bsp::alpha_p |
'_' |
'$') >>
1185 *(bsp::alnum_p |
'_' |
1191 bsp::infix_node_d[bsp::inner_node_d[bsp::ch_p(
'(') >>
1197 bsp::leaf_node_d[bsp::lexeme_d[
self.variables_p]] >>
op;
1199 number = bsp::leaf_node_d[bsp::lexeme_d[bsp::real_p]] >>
op;
1202 bsp::leaf_node_d[bsp::lexeme_d[*
self.constants_p]] >>
op;
1204 op = bsp::eps_p(bsp::end_p |
"||" |
"&&" |
"==" |
"<=" |
">=" |
1205 '<' |
'>' |
'+' |
'-' |
'*' |
'/' |
'%' |
'^' |
1215 bsp::rule<ScannerT, bsp::parser_context<>, bsp::parser_tag<N>>;
1317 typedef std::vector<NekDouble> &
vr;
1318 typedef const std::vector<NekDouble> &
cvr;
1323 template <
typename StepType>
1398 for (
int i = 0; i < n; i++)
1414 for (
int i = 0; i < n; i++)
1430 for (
int i = 0; i < n; i++)
1446 for (
int i = 0; i < n; i++)
1462 for (
int i = 0; i < n; i++)
1479 for (
int i = 0; i < n; i++)
1496 for (
int i = 0; i < n; i++)
1513 for (
int i = 0; i < n; i++)
1530 for (
int i = 0; i < n; i++)
1547 for (
int i = 0; i < n; i++)
1563 for (
int i = 0; i < n; i++)
1580 for (
int i = 0; i < n; i++)
1597 for (
int i = 0; i < n; i++)
1614 for (
int i = 0; i < n; i++)
1631 for (
int i = 0; i < n; i++)
1648 for (
int i = 0; i < n; i++)
1665 for (
int i = 0; i < n; i++)
1681 for (
int i = 0; i < n; i++)
1698 for (
int i = 0; i < n; i++)
1714 for (
int i = 0; i < n; i++)
1730 for (
int i = 0; i < n; i++)
1746 for (
int i = 0; i < n; i++)
1763 for (
int i = 0; i < n; i++)
1780 for (
int i = 0; i < n; i++)
1798 for (
int i = 0; i < n; i++)
1814 for (
int i = 0; i < n; i++)
1830 for (
int i = 0; i < n; i++)
1846 for (
int i = 0; i < n; i++)
1862 for (
int i = 0; i < n; i++)
1878 for (
int i = 0; i < n; i++)
1894 for (
int i = 0; i < n; i++)
1911 for (
int i = 0; i < n; i++)
1927 for (
int i = 0; i < n; i++)
1943 for (
int i = 0; i < n; i++)
1960 for (
int i = 0; i < n; i++)
1976 for (
int i = 0; i < n; i++)
1992 for (
int i = 0; i < n; i++)
2008 for (
int i = 0; i < n; i++)
2024 for (
int i = 0; i < n; i++)
2042 boost::variate_generator<boost::mt19937 &,
2043 boost::normal_distribution<>>
2046 for (
int i = 0; i < n; i++)
2053 boost::variate_generator<boost::mt19937 &,
2054 boost::normal_distribution<>>
2076 m_impl = std::move(r.m_impl);
2082 m_impl->SetRandomSeed(seed);
2086 std::map<std::string, NekDouble>
const &constants)
2088 m_impl->AddConstants(constants);
2103 m_impl->SetParameters(params);
2118 return m_impl->GetTime();
2122 const std::string &
function)
2124 return m_impl->DefineFunction(vlist,
function);
2129 return m_impl->Evaluate(AnalyticExpression_id);
2136 return m_impl->Evaluate(AnalyticExpression_id, x, y, z, t);
2140 std::vector<NekDouble> point)
2142 return m_impl->EvaluateAtPoint(AnalyticExpression_id, point);
2152 m_impl->Evaluate(expression_id, x, y, z, t, result);
2156 const int expression_id,
2160 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.
EvaluationStep * makeStep(ci dest, ci src_left=0, ci src_right=0)
Factory method which makes code little less messy.
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...
bsp::tree_match< std::string::const_iterator, bsp::node_val_data_factory< NekDouble > >::tree_iterator ParsedTreeIterator
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
boost::mt19937 m_generator
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.
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)
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.
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.
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)
The above copyright notice and this permission notice shall be included.
scalarT< T > log(scalarT< T > in)
scalarT< T > abs(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< 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< operatorID> exponent
bsp_rule< operatorID> const & start() const
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)
virtual void run_many(ci n)
declaring this guy pure virtual shortens virtual table. It saves some execution time.
virtual void run_many(ci n)
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)
virtual void run_many(ci n)
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)
virtual void run_many(ci n)
declaring this guy pure virtual shortens virtual table. It saves some execution time.
virtual void run_many(ci n)
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)
virtual void run_many(ci n)
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)
virtual void run_many(ci n)
declaring this guy pure virtual shortens virtual table. It saves some execution time.
virtual void run_many(ci n)
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)
virtual void run_many(ci n)
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)
virtual void run_many(ci n)
declaring this guy pure virtual shortens virtual table. It saves some execution time.
EvalCeil(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
EvalCos(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
virtual void run_many(ci n)
declaring this guy pure virtual shortens virtual table. It saves some execution time.
virtual void run_many(ci n)
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)
virtual void run_many(ci n)
declaring this guy pure virtual shortens virtual table. It saves some execution time.
virtual void run_many(ci n)
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)
EvalFabs(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
virtual void run_many(ci n)
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)
virtual void run_many(ci n)
declaring this guy pure virtual shortens virtual table. It saves some execution time.
virtual void run_many(ci n)
declaring this guy pure virtual shortens virtual table. It saves some execution time.
EvalFmod(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
virtual void run_many(ci n)
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)
virtual void run_many(ci n)
declaring this guy pure virtual shortens virtual table. It saves some execution time.
EvalLog(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
EvalLogicalEqual(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
virtual void run_many(ci n)
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)
virtual void run_many(ci n)
declaring this guy pure virtual shortens virtual table. It saves some execution time.
virtual void run_many(ci n)
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)
virtual void run_many(ci n)
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)
virtual void run_many(ci n)
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)
EvalMod(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
virtual void run_many(ci n)
declaring this guy pure virtual shortens virtual table. It saves some execution time.
virtual void run_many(ci n)
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)
virtual void run_many(ci n)
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)
virtual void run_many(ci n)
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)
virtual void run_many(ci n)
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)
virtual void run_many(ci n)
declaring this guy pure virtual shortens virtual table. It saves some execution time.
virtual void run_many(ci n)
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)
virtual void run_many(ci n)
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)
EvalSqrt(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
virtual void run_many(ci n)
declaring this guy pure virtual shortens virtual table. It saves some execution time.
virtual void run_many(ci n)
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)
virtual void run_many(ci n)
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)
EvalTan(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
virtual void run_many(ci n)
declaring this guy pure virtual shortens virtual table. It saves some execution time.
virtual void run_many(ci n)
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
StoreConst(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
virtual void run_many(ci n)
declaring this guy pure virtual shortens virtual table. It saves some execution time.
virtual void run_many(ci n)
declaring this guy pure virtual shortens virtual table. It saves some execution time.
StorePrm(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
StoreVar(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
virtual void run_many(ci n)
declaring this guy pure virtual shortens virtual table. It saves some execution time.