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>
53namespace bsp = boost::spirit::classic;
58#if defined(__INTEL_COMPILER)
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;
144 (
"fmod",
static_cast<double (*)(
double,
double)
>(
182 typedef bsp::tree_parse_info<std::string::const_iterator,
183 bsp::node_val_data_factory<NekDouble>>
185 typedef bsp::tree_match<std::string::const_iterator,
186 bsp::node_val_data_factory<NekDouble>>::
288 for (
auto &it : it_es)
310 for (
auto const &it : constants)
336 std::string errormsg =
337 "Attempt to add numerically different constants under the "
340 std::cout << errormsg << std::endl;
352 ASSERTL1(value != NULL,
"Constant variable not found: " +
name);
361 for (
auto const &it : params)
392 "Parameter not found: " +
name);
426 std::vector<std::string> variableNames;
427 bsp::parse((
char *)vlist.c_str(),
429 *(+(+bsp::graph_p)[bsp::push_back_a(variableNames)] >>
438 bsp::ast_parse<bsp::node_val_data_factory<NekDouble>,
440 bsp::space_parser>(expr.begin(), expr.end(),
441 myGrammar, bsp::space_p);
444 "Unable to fully parse function. Stopped just before: " +
445 std::string(parseInfo.stop, parseInfo.stop + 15));
449 throw std::runtime_error(
450 "Unable to fully parse function at: " +
451 std::string(parseInfo.stop, parseInfo.stop + 15));
465 for (
int i = 0; i < variableNames.size(); i++)
467 variableMap[variableNames[i]] = i;
473 stack, variableMap, 0);
479 "Constant expression yeilds non-empty execution stack. "
480 "Bug in PrepareExecutionAsYouParse()");
483 std::string(
"EXPRESSION_") + std::to_string(stackId), v.second);
484 stack.push_back(makeStep<StoreConst>(0, const_index));
507 "unknown analytic expression, it must first be defined "
508 "with DefineFunction(...)");
513 for (
int i = 0; i < stack.size(); i++)
515 (*stack[i]).run_once();
533 "unknown analytic expression, it must first be defined with "
534 "DefineFunction(...)");
555 for (
int i = 0; i < stack.size(); i++)
557 (*stack[i]).run_once();
574 "unknown analytic expression, it must first be defined with "
575 "DefineFunction(...)");
580 ASSERTL1(point.size() == variableMap.size(),
581 "The number of variables used to define this expression should"
582 " match the point dimensionality.");
587 VariableMap::const_iterator it;
589 for (it = variableMap.begin(); it != variableMap.end(); ++it)
595 for (
int i = 0; i < stack.size(); i++)
597 (*stack[i]).run_once();
615 std::vector<Array<OneD, const NekDouble>> points = {x, y,
z, t};
628 const int num_points = points[0].size();
630 "unknown analytic expression, it must first be defined "
631 "with DefineFunction(...)");
632 ASSERTL1(result.size() >= num_points,
633 "destination array must have enough capacity to store "
634 "expression values at each given point");
641 const int max_chunk_size = 1024;
642 const int nvals = points.size();
643 const int chunk_size = (std::min)(max_chunk_size, num_points);
653 if (result.size() < num_points)
659 int work_left = num_points;
660 while (work_left > 0)
662 const int this_chunk_size = (std::min)(work_left, 1024);
663 for (
int i = 0; i < this_chunk_size; i++)
665 for (
int j = 0; j < nvals; ++j)
667 m_variable[i + this_chunk_size * j] = points[j][offset + i];
670 for (
int i = 0; i < stack.size(); i++)
672 (*stack[i]).run_many(this_chunk_size);
674 for (
int i = 0; i < this_chunk_size; i++)
676 result[offset + i] =
m_state[i];
678 work_left -= this_chunk_size;
679 offset += this_chunk_size;
726 std::string valueStr(location->value.begin(), location->value.end());
727 boost::algorithm::trim(valueStr);
729 const bsp::parser_id parserID = location->value.id();
730#if defined(NEKTAR_DEBUG) || defined(NEKTAR_FULLDEBUG)
731 const int num_children = location->children.size();
737 "Illegal children under constant node: " + valueStr);
741 "Cannot find the value for the specified constant: " +
744 return std::make_pair(
true,
m_constant[it->second]);
749 "Illegal children under number node: " + valueStr);
750 return std::make_pair(
751 true, boost::lexical_cast<NekDouble>(valueStr.c_str()));
756 "Illegal children under variable node: " + valueStr);
758 VariableMap::const_iterator it = variableMap.find(valueStr);
760 "Unknown variable parsed: " + valueStr);
763 stack.push_back(makeStep<StoreVar>(stateIndex, it->second));
764 return std::make_pair(
false, 0);
769 "Illegal children under parameter node: " + valueStr);
773 "Unknown parameter parsed: " + valueStr);
776 stack.push_back(makeStep<StorePrm>(stateIndex, it->second));
777 return std::make_pair(
false, 0);
783 "Invalid function specified: " + valueStr);
784 ASSERTL1(num_children == 1 || num_children == 2,
785 "Function " + valueStr +
786 " has neither one or two "
787 "arguments: this is not implemented yet.");
789 if (location->children.size() == 1)
792 location->children.begin(), stack, variableMap, stateIndex);
802 makeStep<StoreConst>(stateIndex, const_index));
803 stack.push_back(makeStep<EvalAWGN>(stateIndex, stateIndex));
804 return std::make_pair(
false, 0);
809 return std::make_pair(
true,
817 stack, variableMap, stateIndex);
819 location->children.begin() + 1, stack, variableMap,
823 if (
true == v1.first &&
true == v2.first)
825 return std::make_pair(
826 true,
m_function2[it->second](v1.second, v2.second));
835 stack.push_back(makeStep<EvalAbs>(stateIndex, stateIndex));
836 return std::make_pair(
false, 0);
838 stack.push_back(makeStep<EvalAsin>(stateIndex, stateIndex));
839 return std::make_pair(
false, 0);
841 stack.push_back(makeStep<EvalAcos>(stateIndex, stateIndex));
842 return std::make_pair(
false, 0);
844 stack.push_back(makeStep<EvalAtan>(stateIndex, stateIndex));
845 return std::make_pair(
false, 0);
847 stack.push_back(makeStep<EvalAtan2>(stateIndex, stateIndex,
849 return std::make_pair(
false, 0);
851 stack.push_back(makeStep<EvalAng>(stateIndex, stateIndex,
853 return std::make_pair(
false, 0);
855 stack.push_back(makeStep<EvalBessel>(stateIndex, stateIndex,
857 return std::make_pair(
false, 0);
859 stack.push_back(makeStep<EvalCeil>(stateIndex, stateIndex));
860 return std::make_pair(
false, 0);
862 stack.push_back(makeStep<EvalCos>(stateIndex, stateIndex));
863 return std::make_pair(
false, 0);
865 stack.push_back(makeStep<EvalCosh>(stateIndex, stateIndex));
866 return std::make_pair(
false, 0);
868 stack.push_back(makeStep<EvalExp>(stateIndex, stateIndex));
869 return std::make_pair(
false, 0);
871 stack.push_back(makeStep<EvalFabs>(stateIndex, stateIndex));
872 return std::make_pair(
false, 0);
875 makeStep<EvalFloor>(stateIndex, stateIndex));
876 return std::make_pair(
false, 0);
878 stack.push_back(makeStep<EvalFmod>(stateIndex, stateIndex,
880 return std::make_pair(
false, 0);
882 stack.push_back(makeStep<EvalLog>(stateIndex, stateIndex));
883 return std::make_pair(
false, 0);
886 makeStep<EvalLog10>(stateIndex, stateIndex));
887 return std::make_pair(
false, 0);
889 stack.push_back(makeStep<EvalMax>(stateIndex, stateIndex,
891 return std::make_pair(
false, 0);
893 stack.push_back(makeStep<EvalMin>(stateIndex, stateIndex,
895 return std::make_pair(
false, 0);
897 stack.push_back(makeStep<EvalRad>(stateIndex, stateIndex,
899 return std::make_pair(
false, 0);
901 stack.push_back(makeStep<EvalSin>(stateIndex, stateIndex));
902 return std::make_pair(
false, 0);
904 stack.push_back(makeStep<EvalSinh>(stateIndex, stateIndex));
905 return std::make_pair(
false, 0);
907 stack.push_back(makeStep<EvalSqrt>(stateIndex, stateIndex));
908 return std::make_pair(
false, 0);
910 stack.push_back(makeStep<EvalTan>(stateIndex, stateIndex));
911 return std::make_pair(
false, 0);
913 stack.push_back(makeStep<EvalTanh>(stateIndex, stateIndex));
914 return std::make_pair(
false, 0);
916 stack.push_back(makeStep<EvalSign>(stateIndex, stateIndex));
917 return std::make_pair(
false, 0);
919 ASSERTL0(
false,
"Evaluation of " + valueStr +
920 " is not implemented yet");
922 return std::make_pair(
false, 0);
927 "Illegal factor - it can only be '-' and it was: " +
930 "Illegal number of children under factor node: " +
933 location->children.begin(), stack, variableMap, stateIndex);
938 return std::make_pair(
true, -v.second);
940 stack.push_back(makeStep<EvalNeg>(stateIndex, stateIndex));
941 return std::make_pair(
false, 0);
947 "Too few or too many arguments for mathematical operator: " +
950 location->children.begin() + 0, stack, variableMap, stateIndex);
953 stack, variableMap, stateIndex + 1);
957 if ((left.first ==
true) && (right.first ==
true))
959 switch (*valueStr.begin())
962 return std::make_pair(
true, left.second + right.second);
964 return std::make_pair(
true, left.second - right.second);
966 return std::make_pair(
true, left.second * right.second);
968 return std::make_pair(
true, left.second / right.second);
970 return std::make_pair(
971 true, std::fmod(left.second, right.second));
973 return std::make_pair(
974 true, std::pow(left.second, right.second));
976 return std::make_pair(
true,
977 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);
989 return std::make_pair(
false, 0);
991 if (*(valueStr.end() - 1) ==
'=')
993 return std::make_pair(
true,
994 left.second >= right.second);
998 return std::make_pair(
true,
999 left.second > right.second);
1001 return std::make_pair(
false, 0);
1004 "Invalid operator encountered: " + valueStr);
1006 return std::make_pair(
false, 0);
1011 if (
true == left.first)
1017 stack.push_back(makeStep<StoreConst>(stateIndex, const_index));
1019 if (
true == right.first)
1026 makeStep<StoreConst>(stateIndex + 1, const_index));
1029 switch (*valueStr.begin())
1032 stack.push_back(makeStep<EvalSum>(stateIndex, stateIndex,
1034 return std::make_pair(
false, 0);
1036 stack.push_back(makeStep<EvalSub>(stateIndex, stateIndex,
1038 return std::make_pair(
false, 0);
1040 stack.push_back(makeStep<EvalMul>(stateIndex, stateIndex,
1042 return std::make_pair(
false, 0);
1044 stack.push_back(makeStep<EvalDiv>(stateIndex, stateIndex,
1046 return std::make_pair(
false, 0);
1048 stack.push_back(makeStep<EvalMod>(stateIndex, stateIndex,
1050 return std::make_pair(
false, 0);
1052 stack.push_back(makeStep<EvalPow>(stateIndex, stateIndex,
1054 return std::make_pair(
false, 0);
1056 stack.push_back(makeStep<EvalLogicalEqual>(
1057 stateIndex, stateIndex, stateIndex + 1));
1058 return std::make_pair(
false, 0);
1060 if (*(valueStr.end() - 1) ==
'=')
1062 stack.push_back(makeStep<EvalLogicalLeq>(
1063 stateIndex, stateIndex, stateIndex + 1));
1067 stack.push_back(makeStep<EvalLogicalLess>(
1068 stateIndex, stateIndex, stateIndex + 1));
1070 return std::make_pair(
false, 0);
1073 if (*(valueStr.end() - 1) ==
'=')
1075 stack.push_back(makeStep<EvalLogicalGeq>(
1076 stateIndex, stateIndex, stateIndex + 1));
1080 stack.push_back(makeStep<EvalLogicalGreater>(
1081 stateIndex, stateIndex, stateIndex + 1));
1083 return std::make_pair(
false, 0);
1087 "Invalid operator encountered: " + valueStr);
1089 return std::make_pair(
false, 0);
1095 "Too few or too many arguments for mathematical operator: " +
1098 ASSERTL0(
false,
"Illegal expression encountered: " + valueStr);
1099 return std::make_pair(
false, 0);
1125 for (
auto const &it : vars)
1145 const std::vector<std::string> &
variables)
1168 *((bsp::root_node_d[bsp::str_p(
"||")] >>
logical_and));
1172 *((bsp::root_node_d[bsp::str_p(
"&&")] >>
equality));
1175 lt_gt >> *((bsp::root_node_d[bsp::str_p(
"==")] >>
lt_gt));
1178 *((bsp::root_node_d[bsp::str_p(
"<=")] >>
add_sub) |
1179 (bsp::root_node_d[bsp::str_p(
">=")] >>
add_sub) |
1180 (bsp::root_node_d[bsp::ch_p(
'<')] >>
add_sub) |
1181 (bsp::root_node_d[bsp::ch_p(
'>')] >>
add_sub));
1184 negate >> *((bsp::root_node_d[bsp::ch_p(
'+')] >>
negate) |
1185 (bsp::root_node_d[bsp::ch_p(
'-')] >>
negate));
1191 *((bsp::root_node_d[bsp::ch_p(
'*')] >>
exponential) |
1192 (bsp::root_node_d[bsp::ch_p(
'/')] >>
exponential) |
1193 (bsp::root_node_d[bsp::ch_p(
'%')] >>
exponential));
1199 bsp::inner_node_d[bsp::ch_p(
'(') >>
expression >>
1202 bsp::leaf_node_d[bsp::lexeme_d[(bsp::alpha_p |
'_' |
'$') >>
1203 *(bsp::alnum_p |
'_' |
1209 bsp::infix_node_d[bsp::inner_node_d[bsp::ch_p(
'(') >>
1217 number = bsp::leaf_node_d[bsp::lexeme_d[bsp::real_p]] >>
op;
1222 op = bsp::eps_p(bsp::end_p |
"||" |
"&&" |
"==" |
"<=" |
">=" |
1223 '<' |
'>' |
'+' |
'-' |
'*' |
'/' |
'%' |
'^' |
1233 bsp::rule<ScannerT, bsp::parser_context<>, bsp::parser_tag<N>>;
1335 typedef std::vector<NekDouble> &
vr;
1336 typedef const std::vector<NekDouble> &
cvr;
1341 template <
typename StepType>
1418 for (
int i = 0; i < n; i++)
1434 for (
int i = 0; i < n; i++)
1450 for (
int i = 0; i < n; i++)
1466 for (
int i = 0; i < n; i++)
1482 for (
int i = 0; i < n; i++)
1499 for (
int i = 0; i < n; i++)
1516 for (
int i = 0; i < n; i++)
1533 for (
int i = 0; i < n; i++)
1550 for (
int i = 0; i < n; i++)
1567 for (
int i = 0; i < n; i++)
1583 for (
int i = 0; i < n; i++)
1600 for (
int i = 0; i < n; i++)
1617 for (
int i = 0; i < n; i++)
1634 for (
int i = 0; i < n; i++)
1651 for (
int i = 0; i < n; i++)
1668 for (
int i = 0; i < n; i++)
1685 for (
int i = 0; i < n; i++)
1701 for (
int i = 0; i < n; i++)
1718 for (
int i = 0; i < n; i++)
1734 for (
int i = 0; i < n; i++)
1750 for (
int i = 0; i < n; i++)
1766 for (
int i = 0; i < n; i++)
1783 for (
int i = 0; i < n; i++)
1800 for (
int i = 0; i < n; i++)
1818 for (
int i = 0; i < n; i++)
1834 for (
int i = 0; i < n; i++)
1850 for (
int i = 0; i < n; i++)
1866 for (
int i = 0; i < n; i++)
1882 for (
int i = 0; i < n; i++)
1898 for (
int i = 0; i < n; i++)
1914 for (
int i = 0; i < n; i++)
1931 for (
int i = 0; i < n; i++)
1947 for (
int i = 0; i < n; i++)
1963 for (
int i = 0; i < n; i++)
1980 for (
int i = 0; i < n; i++)
1997 for (
int i = 0; i < n; i++)
2014 for (
int i = 0; i < n; i++)
2030 for (
int i = 0; i < n; i++)
2046 for (
int i = 0; i < n; i++)
2062 for (
int i = 0; i < n; i++)
2078 for (
int i = 0; i < n; i++)
2096 boost::variate_generator<boost::mt19937 &,
2097 boost::normal_distribution<>>
2100 for (
int i = 0; i < n; i++)
2107 boost::variate_generator<boost::mt19937 &,
2108 boost::normal_distribution<>>
2130 m_impl = std::move(r.m_impl);
2136 m_impl->SetRandomSeed(seed);
2140 std::map<std::string, NekDouble>
const &constants)
2142 m_impl->AddConstants(constants);
2157 m_impl->SetParameters(params);
2172 return m_impl->GetTime();
2176 const std::string &function)
2178 return m_impl->DefineFunction(vlist, function);
2183 return m_impl->Evaluate(AnalyticExpression_id);
2190 return m_impl->Evaluate(AnalyticExpression_id, x, y,
z, t);
2194 std::vector<NekDouble> point)
2196 return m_impl->EvaluateAtPoint(AnalyticExpression_id, point);
2206 m_impl->Evaluate(expression_id, x, y,
z, t, result);
2210 const int expression_id,
2214 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
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.
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)
The above copyright notice and this permission notice shall be included.
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)
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)
virtual void run_many(ci n)
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)
virtual void run_many(ci n)
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)
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.