Nektar++
|
This class defines evaluator of analytic (symbolic) mathematical expressions. Expressions are allowed to depend on a number of spatial-time variables and parameters. Pre-processing and evaluation stages are split. At evaluation stage one specifies values for each variable, resulting expression value is returned. Vectorized evaluator (evaluate expression at a set of points) is available. More...
#include <AnalyticExpressionEvaluator.hpp>
Classes | |
class | AnalyticExpression |
struct | CopyState |
struct | EvalAbs |
struct | EvalAcos |
struct | EvalAng |
struct | EvalAsin |
struct | EvalAtan |
struct | EvalAtan2 |
struct | EvalAWGN |
struct | EvalBessel |
struct | EvalCeil |
struct | EvalCos |
struct | EvalCosh |
struct | EvalDiv |
struct | EvalExp |
struct | EvalFabs |
struct | EvalFloor |
struct | EvalLog |
struct | EvalLog10 |
struct | EvalLogicalEqual |
struct | EvalLogicalGeq |
struct | EvalLogicalGreater |
struct | EvalLogicalLeq |
struct | EvalLogicalLess |
struct | EvalMul |
struct | EvalNeg |
struct | EvalPow |
struct | EvalRad |
struct | EvalSign |
struct | EvalSin |
struct | EvalSinh |
struct | EvalSqrt |
struct | EvalSub |
struct | EvalSum |
struct | EvalTan |
struct | EvalTanh |
struct | EvaluationStep |
Function objects (functors) More... | |
struct | StoreConst |
struct | StorePrm |
struct | StoreVar |
Public Types | |
typedef std::map< std::string, int > | VariableMap |
typedef std::map< std::string, int > | ConstantMap |
typedef std::map< std::string, int > | ParameterMap |
typedef std::map< std::string, int > | ExpressionMap |
typedef std::map< std::string, int > | FunctionNameMap |
typedef std::vector < EvaluationStep * > | ExecutionStack |
typedef std::pair< bool, NekDouble > | PrecomputedValue |
typedef NekDouble(* | OneArgFunc )(NekDouble) |
typedef NekDouble(* | TwoArgFunc )(NekDouble, NekDouble) |
typedef boost_spirit::tree_parse_info < std::string::const_iterator, boost_spirit::node_val_data_factory < NekDouble > > | ParsedTreeInfo |
typedef boost_spirit::tree_match < std::string::const_iterator, boost_spirit::node_val_data_factory < NekDouble > >::tree_iterator | ParsedTreeIterator |
typedef std::vector< const Array< OneD, const NekDouble > * > | VariableArray |
typedef boost::mt19937 | RandomGeneratorType |
Public Member Functions | |
AnalyticExpressionEvaluator (void) | |
Initializes the evaluator to a state where it is ready to accept input from the DefineFunction function. More... | |
~AnalyticExpressionEvaluator (void) | |
Destroys the execution stack. More... | |
void | SetRandomSeed (unsigned int seed=123u) |
void | AddConstants (std::map< std::string, NekDouble > const &constants) |
Constants are evaluated and inserted into the function at the time it is parsed when calling the DefineFunction function. After parsing, if a constant is changed, it will not be reflected in the function when Evaluate is called. This also means that if a function with an unknown constant is added, and then the constant is added, the function will not see the added constant and through an exception. This function will add all of the constants in the map argument to the global internal constants. If a constant was already loaded previously, it will throw an exception stating which constants in the map had this issue. It will add all of the constants it can and output the constants it couldn't add in the string exception. More... | |
int | AddConstant (std::string const &name, NekDouble value) |
This function behaves in the same way as AddConstants, but it only adds one constant at a time. If the constant existed previously, an exception will be thrown stating the fact. If it did not exist previously, it will be added to the global constants and will be used the next time DefineFunction is called. More... | |
NekDouble | GetConstant (std::string const &name) |
If a constant with the specified name exists, it returns the NekDouble value that the constant stores. If the constant doesn't exist, it throws an exception. More... | |
void | SetParameters (std::map< std::string, NekDouble > const ¶ms) |
Parameters are like constants, but they are inserted into the function at the time Evaluate is called instead of when the function is parsed. This function can be called at any time, and it will take effect in the next call to Evaluate. This function will delete all of the parameters, and replace all of them with only the ones in the map argument. More... | |
void | SetParameter (std::string const &name, NekDouble value) |
This function behaves in the same way as SetParameters, but it only adds one parameter and it does not delete the others. If the parameter existed previously, it will be overridden and replaced with the new value. If it did not exist previously, it will be added to the current parameters. More... | |
NekDouble | GetParameter (std::string const &name) |
If a parameter with the specified name exists, it returns the NekDouble value that the parameter stores. If the parameter doesn't exist, it throws an exception. More... | |
NekDouble | GetTime () const |
Returns the total time spent in evaluation procedures, seconds. More... | |
int | DefineFunction (const std::string &vlist, const std::string &function) |
This function allows one to define a function to evaluate. The first argument (vlist) is a list of variables (separated by spaces) that the second argument (function) depends on. For example, if function = "x + y", then vlist should most likely be "x y", unless you are defining x or y as parameters with SetParameters. parsed expression ID. You will need this expression id to call evaluation methods below. More... | |
NekDouble | Evaluate (const int AnalyticExpression_id) |
Evaluation method for expressions depending on parameters only. More... | |
NekDouble | Evaluate (const int AnalyticExpression_id, const NekDouble, const NekDouble, const NekDouble, const NekDouble) |
Evaluation method for expressions depending on 4 variables (+parameters). More... | |
NekDouble | EvaluateAtPoint (const int AnalyticExpression_id, std::vector< NekDouble > point) |
Evaluation method for expressions depending on unspecified number of variables. This suitable for expressions depending on more than 4 variables or for the dynamic setting some variables as parameters (there is currently no interface method for removing a variable from parameter map though). More... | |
void | Evaluate (const int expression_id, const Array< OneD, const NekDouble > &, const Array< OneD, const NekDouble > &, const Array< OneD, const NekDouble > &, const Array< OneD, const NekDouble > &, Array< OneD, NekDouble > &result) |
Vectorized evaluation method for expressions depending on 4 variables. More... | |
void | Evaluate (const int expression_id, const std::vector< Array< OneD, const NekDouble > > points, Array< OneD, NekDouble > &result) |
Vectorized evaluation method for expressions depending on unspecified number of variables. More... | |
Private Types | |
enum | EvaluationStepType { E_ABS, E_ASIN, E_ACOS, E_ATAN, E_ATAN2, E_ANG, E_CEIL, E_COS, E_COSH, E_EXP, E_FABS, E_FLOOR, E_LOG, E_LOG10, E_POW, E_RAD, E_SIN, E_SINH, E_SQRT, E_TAN, E_TANH, E_SIGN, E_AWGN, E_BESSEL } |
typedef std::vector< NekDouble > & | vr |
Short names to minimise the infractructural code mess in defining functors below. More... | |
typedef const std::vector < NekDouble > & | cvr |
typedef const int | ci |
typedef RandomGeneratorType & | rgt |
Private Member Functions | |
PrecomputedValue | PrepareExecutionAsYouParse (const ParsedTreeIterator &root, ExecutionStack &stack, VariableMap &varMap, int stateIndex) |
This method prepares the execution stack (an ordered sequence of operators that perform the evaluation) for the parsed evaluation tree. More... | |
template<typename StepType > | |
EvaluationStep * | makeStep (ci dest, ci src_left=0, ci src_right=0) |
Factory method which makes code little less messy. More... | |
Private Attributes | |
boost_spirit::symbols< NekDouble > | m_constantsParser |
ExpressionMap | m_parsedMapExprToExecStackId |
These vector and map store pre-processed evaluation sequences for the analytic expressions. Each ExecutionStack is an ordered container of steps of sequential execution process which evaluates an analytic expression. More... | |
std::vector< ExecutionStack > | m_executionStack |
std::vector< VariableMap > | m_stackVariableMap |
Keeping map of variables individually per each analytic expression allows correctly handling expressions which depend on different number of variables. More... | |
ParameterMap | m_parameterMapNameToId |
The following data structures hold input data to be used on evaluation stage. There are three types of input data: More... | |
ConstantMap | m_constantMapNameToId |
VariableMap | m_expressionVariableMap |
std::vector< NekDouble > | m_parameter |
std::vector< NekDouble > | m_constant |
std::vector< NekDouble > | m_variable |
std::vector< NekDouble > | m_state |
This vector stores the execution state (memory) used by the sequential execution process. More... | |
std::vector< int > | m_state_sizes |
Vector of state sizes per each. More... | |
int | m_state_size |
This counter is used by PrepareExecutionAsYouParse for finding the minimal state size necessary for evaluation of function parsed. More... | |
Timer | m_timer |
Timer and sum of evaluation times. More... | |
NekDouble | m_total_eval_time |
RandomGeneratorType | m_generator |
FunctionNameMap | m_functionMapNameToInstanceType |
std::map< int, OneArgFunc > | m_function |
std::map< int, TwoArgFunc > | m_function2 |
This class defines evaluator of analytic (symbolic) mathematical expressions. Expressions are allowed to depend on a number of spatial-time variables and parameters. Pre-processing and evaluation stages are split. At evaluation stage one specifies values for each variable, resulting expression value is returned. Vectorized evaluator (evaluate expression at a set of points) is available.
Internally this class uses boost::spirit to parse analytic expressions and unrolls their recursive bracketing structure into a sequence of evaluation steps (aka execution stack) with resolved data dependencies. Once an expression is pre-processed, its execution stack is stored internally in order to be re-used.
Definition at line 114 of file AnalyticExpressionEvaluator.hpp.
|
private |
Definition at line 469 of file AnalyticExpressionEvaluator.hpp.
typedef std::map<std::string, int> Nektar::LibUtilities::AnalyticExpressionEvaluator::ConstantMap |
Definition at line 125 of file AnalyticExpressionEvaluator.hpp.
|
private |
Definition at line 468 of file AnalyticExpressionEvaluator.hpp.
typedef std::vector<EvaluationStep*> Nektar::LibUtilities::AnalyticExpressionEvaluator::ExecutionStack |
Definition at line 129 of file AnalyticExpressionEvaluator.hpp.
typedef std::map<std::string, int> Nektar::LibUtilities::AnalyticExpressionEvaluator::ExpressionMap |
Definition at line 127 of file AnalyticExpressionEvaluator.hpp.
typedef std::map<std::string, int> Nektar::LibUtilities::AnalyticExpressionEvaluator::FunctionNameMap |
Definition at line 128 of file AnalyticExpressionEvaluator.hpp.
Definition at line 131 of file AnalyticExpressionEvaluator.hpp.
typedef std::map<std::string, int> Nektar::LibUtilities::AnalyticExpressionEvaluator::ParameterMap |
Definition at line 126 of file AnalyticExpressionEvaluator.hpp.
typedef boost_spirit::tree_parse_info< std::string::const_iterator, boost_spirit::node_val_data_factory<NekDouble> > Nektar::LibUtilities::AnalyticExpressionEvaluator::ParsedTreeInfo |
Definition at line 137 of file AnalyticExpressionEvaluator.hpp.
typedef boost_spirit::tree_match< std::string::const_iterator, boost_spirit::node_val_data_factory<NekDouble> >::tree_iterator Nektar::LibUtilities::AnalyticExpressionEvaluator::ParsedTreeIterator |
Definition at line 141 of file AnalyticExpressionEvaluator.hpp.
typedef std::pair<bool, NekDouble> Nektar::LibUtilities::AnalyticExpressionEvaluator::PrecomputedValue |
Definition at line 130 of file AnalyticExpressionEvaluator.hpp.
typedef boost::mt19937 Nektar::LibUtilities::AnalyticExpressionEvaluator::RandomGeneratorType |
Definition at line 145 of file AnalyticExpressionEvaluator.hpp.
Definition at line 470 of file AnalyticExpressionEvaluator.hpp.
typedef NekDouble(* Nektar::LibUtilities::AnalyticExpressionEvaluator::TwoArgFunc)(NekDouble, NekDouble) |
Definition at line 132 of file AnalyticExpressionEvaluator.hpp.
typedef std::vector<const Array<OneD, const NekDouble>* > Nektar::LibUtilities::AnalyticExpressionEvaluator::VariableArray |
Definition at line 143 of file AnalyticExpressionEvaluator.hpp.
typedef std::map<std::string, int> Nektar::LibUtilities::AnalyticExpressionEvaluator::VariableMap |
Definition at line 119 of file AnalyticExpressionEvaluator.hpp.
|
private |
Short names to minimise the infractructural code mess in defining functors below.
Definition at line 467 of file AnalyticExpressionEvaluator.hpp.
Enumerator | |
---|---|
E_ABS | |
E_ASIN | |
E_ACOS | |
E_ATAN | |
E_ATAN2 | |
E_ANG | |
E_CEIL | |
E_COS | |
E_COSH | |
E_EXP | |
E_FABS | |
E_FLOOR | |
E_LOG | |
E_LOG10 | |
E_POW | |
E_RAD | |
E_SIN | |
E_SINH | |
E_SQRT | |
E_TAN | |
E_TANH | |
E_SIGN | |
E_AWGN | |
E_BESSEL |
Definition at line 479 of file AnalyticExpressionEvaluator.hpp.
Nektar::LibUtilities::AnalyticExpressionEvaluator::AnalyticExpressionEvaluator | ( | void | ) |
Initializes the evaluator to a state where it is ready to accept input from the DefineFunction function.
Definition at line 220 of file AnalyticExpressionEvaluator.cpp.
References AddConstant(), Nektar::LibUtilities::ang(), E_ABS, E_ACOS, E_ANG, E_ASIN, E_ATAN, E_ATAN2, E_AWGN, E_BESSEL, E_CEIL, E_COS, E_COSH, E_EXP, E_FABS, E_FLOOR, E_LOG, E_LOG10, E_RAD, E_SIGN, E_SIN, E_SINH, E_SQRT, E_TAN, E_TANH, m_function, m_function2, m_functionMapNameToInstanceType, m_state_size, Nektar::LibUtilities::rad(), and Nektar::LibUtilities::sign().
Nektar::LibUtilities::AnalyticExpressionEvaluator::~AnalyticExpressionEvaluator | ( | void | ) |
Destroys the execution stack.
Definition at line 296 of file AnalyticExpressionEvaluator.cpp.
References Nektar::iterator, and m_executionStack.
int Nektar::LibUtilities::AnalyticExpressionEvaluator::AddConstant | ( | std::string const & | name, |
NekDouble | value | ||
) |
This function behaves in the same way as AddConstants, but it only adds one constant at a time. If the constant existed previously, an exception will be thrown stating the fact. If it did not exist previously, it will be added to the global constants and will be used the next time DefineFunction is called.
Definition at line 324 of file AnalyticExpressionEvaluator.cpp.
References m_constant, m_constantMapNameToId, and m_constantsParser.
Referenced by AddConstants(), AnalyticExpressionEvaluator(), DefineFunction(), and PrepareExecutionAsYouParse().
void Nektar::LibUtilities::AnalyticExpressionEvaluator::AddConstants | ( | std::map< std::string, NekDouble > const & | constants | ) |
Constants are evaluated and inserted into the function at the time it is parsed when calling the DefineFunction function. After parsing, if a constant is changed, it will not be reflected in the function when Evaluate is called. This also means that if a function with an unknown constant is added, and then the constant is added, the function will not see the added constant and through an exception. This function will add all of the constants in the map argument to the global internal constants. If a constant was already loaded previously, it will throw an exception stating which constants in the map had this issue. It will add all of the constants it can and output the constants it couldn't add in the string exception.
Definition at line 316 of file AnalyticExpressionEvaluator.cpp.
References AddConstant().
Referenced by Nektar::LibUtilities::Equation::SetConstants().
int Nektar::LibUtilities::AnalyticExpressionEvaluator::DefineFunction | ( | const std::string & | vlist, |
const std::string & | function | ||
) |
This function allows one to define a function to evaluate. The first argument (vlist) is a list of variables (separated by spaces) that the second argument (function) depends on. For example, if function = "x + y", then vlist should most likely be "x y", unless you are defining x or y as parameters with SetParameters. parsed expression ID. You will need this expression id to call evaluation methods below.
Definition at line 402 of file AnalyticExpressionEvaluator.cpp.
References AddConstant(), ASSERTL1, m_constantsParser, m_executionStack, m_parsedMapExprToExecStackId, m_stackVariableMap, m_state_size, m_state_sizes, and PrepareExecutionAsYouParse().
Referenced by Nektar::NekMeshUtils::CurveMesh::CurveMesh(), Nektar::LibUtilities::Equation::Equation(), Nektar::NekMeshUtils::Generator2D::Process(), Nektar::Utilities::ProcessScalar::Process(), Nektar::SpatialDomains::MeshGraph::ReadCurves(), Nektar::SpatialDomains::MeshGraph::ReadGeometry(), and Nektar::Utilities::ProcessCurve::v_GenerateEdgeNodes().
NekDouble Nektar::LibUtilities::AnalyticExpressionEvaluator::Evaluate | ( | const int | AnalyticExpression_id | ) |
Evaluation method for expressions depending on parameters only.
Definition at line 494 of file AnalyticExpressionEvaluator.cpp.
References ASSERTL1, m_executionStack, m_state, m_state_sizes, m_timer, m_total_eval_time, Nektar::Timer::Start(), Nektar::Timer::Stop(), and Nektar::Timer::TimePerTest().
Referenced by Nektar::LibUtilities::Equation::Evaluate(), Evaluate(), Nektar::Utilities::ProcessCurve::EvaluateCoordinate(), Nektar::NekMeshUtils::Generator2D::MakeBL(), Nektar::SpatialDomains::MeshGraph::ReadCurves(), and Nektar::SpatialDomains::MeshGraph::ReadGeometry().
NekDouble Nektar::LibUtilities::AnalyticExpressionEvaluator::Evaluate | ( | const int | AnalyticExpression_id, |
const NekDouble | x, | ||
const NekDouble | y, | ||
const NekDouble | z, | ||
const NekDouble | t | ||
) |
Evaluation method for expressions depending on 4 variables (+parameters).
Definition at line 514 of file AnalyticExpressionEvaluator.cpp.
References ASSERTL1, m_executionStack, m_state, m_state_sizes, m_timer, m_total_eval_time, m_variable, Nektar::Timer::Start(), Nektar::Timer::Stop(), and Nektar::Timer::TimePerTest().
void Nektar::LibUtilities::AnalyticExpressionEvaluator::Evaluate | ( | const int | expression_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 | ||
) |
Vectorized evaluation method for expressions depending on 4 variables.
Definition at line 588 of file AnalyticExpressionEvaluator.cpp.
References Evaluate(), m_timer, m_total_eval_time, Nektar::Timer::Start(), Nektar::Timer::Stop(), and Nektar::Timer::TimePerTest().
void Nektar::LibUtilities::AnalyticExpressionEvaluator::Evaluate | ( | const int | expression_id, |
const std::vector< Array< OneD, const NekDouble > > | points, | ||
Array< OneD, NekDouble > & | result | ||
) |
Vectorized evaluation method for expressions depending on unspecified number of variables.
If number of points tends to 10^6, one may end up with up to ~0.5Gb data allocated for m_state only. Lets split the work into cache-sized chunks. Ahtung, magic constant!
Definition at line 612 of file AnalyticExpressionEvaluator.cpp.
References ASSERTL1, m_executionStack, m_state, m_state_sizes, m_timer, m_total_eval_time, m_variable, Nektar::Timer::Start(), Nektar::Timer::Stop(), and Nektar::Timer::TimePerTest().
NekDouble Nektar::LibUtilities::AnalyticExpressionEvaluator::EvaluateAtPoint | ( | const int | AnalyticExpression_id, |
std::vector< NekDouble > | point | ||
) |
Evaluation method for expressions depending on unspecified number of variables. This suitable for expressions depending on more than 4 variables or for the dynamic setting some variables as parameters (there is currently no interface method for removing a variable from parameter map though).
Definition at line 555 of file AnalyticExpressionEvaluator.cpp.
References ASSERTL1, m_executionStack, m_stackVariableMap, m_state, m_state_sizes, m_timer, m_total_eval_time, m_variable, Nektar::Timer::Start(), Nektar::Timer::Stop(), and Nektar::Timer::TimePerTest().
NekDouble Nektar::LibUtilities::AnalyticExpressionEvaluator::GetConstant | ( | std::string const & | name | ) |
If a constant with the specified name exists, it returns the NekDouble value that the constant stores. If the constant doesn't exist, it throws an exception.
Definition at line 349 of file AnalyticExpressionEvaluator.cpp.
References ASSERTL1, Nektar::StdRegions::find(), and m_constantsParser.
NekDouble Nektar::LibUtilities::AnalyticExpressionEvaluator::GetParameter | ( | std::string const & | name | ) |
If a parameter with the specified name exists, it returns the NekDouble value that the parameter stores. If the parameter doesn't exist, it throws an exception.
Definition at line 382 of file AnalyticExpressionEvaluator.cpp.
References ASSERTL1, m_parameter, and m_parameterMapNameToId.
NekDouble Nektar::LibUtilities::AnalyticExpressionEvaluator::GetTime | ( | ) | const |
Returns the total time spent in evaluation procedures, seconds.
Definition at line 392 of file AnalyticExpressionEvaluator.cpp.
References m_total_eval_time.
Referenced by Nektar::LibUtilities::Equation::GetTime().
|
inlineprivate |
Factory method which makes code little less messy.
Definition at line 474 of file AnalyticExpressionEvaluator.hpp.
|
private |
This method prepares the execution stack (an ordered sequence of operators that perform the evaluation) for the parsed evaluation tree.
In order to do this, it unrolls binary tree representing the recursive evaluation into an ordered sequence of commands. That ordered sequence of commands is equivalent to bottom-up walk up the evaluation tree, but this allows not to form tree explicitly.
This approach requires to introduce explicitly an execution state (memory) shared by commands in the evaluation sequence: recursively dependent commands need to pass data between each other. Such state for the recursive evaluation is passed via return values of a recursive evaluation function — which is bad if one wants to implement vectorized evaluator.
On the other hand, to run through a sequential container of functors is faster than to walk the tree and at each node to check the node type.
root - iterator generated by boost::spirit; stack - initially empty sequential container of evaluation steps; varMap - maps variable names to their ids; stateIndex - an index in state[] array where an evaluation step corresponding to the current tree node is allowed to write. an std::pair<bool, NekDouble> which encodes fully pre-evaluated NekDouble value as pair <true, value> if all sub-tree down the current node evaluates to constant, or flags the opposite via pair <false,0>.
Definition at line 678 of file AnalyticExpressionEvaluator.cpp.
References AddConstant(), ASSERTL0, ASSERTL1, Nektar::LibUtilities::AnalyticExpressionEvaluator::AnalyticExpression::constantID, E_ABS, E_ACOS, E_ANG, E_ASIN, E_ATAN, E_ATAN2, E_AWGN, E_BESSEL, E_CEIL, E_COS, E_COSH, E_EXP, E_FABS, E_FLOOR, E_LOG, E_LOG10, E_RAD, E_SIGN, E_SIN, E_SINH, E_SQRT, E_TAN, E_TANH, Nektar::LibUtilities::AnalyticExpressionEvaluator::AnalyticExpression::factorID, Nektar::LibUtilities::AnalyticExpressionEvaluator::AnalyticExpression::functionID, m_constant, m_constantMapNameToId, m_function, m_function2, m_functionMapNameToInstanceType, m_parameterMapNameToId, m_state_size, Nektar::LibUtilities::AnalyticExpressionEvaluator::AnalyticExpression::numberID, Nektar::LibUtilities::AnalyticExpressionEvaluator::AnalyticExpression::operatorID, Nektar::LibUtilities::AnalyticExpressionEvaluator::AnalyticExpression::parameterID, and Nektar::LibUtilities::AnalyticExpressionEvaluator::AnalyticExpression::variableID.
Referenced by DefineFunction().
void Nektar::LibUtilities::AnalyticExpressionEvaluator::SetParameter | ( | std::string const & | name, |
NekDouble | value | ||
) |
This function behaves in the same way as SetParameters, but it only adds one parameter and it does not delete the others. If the parameter existed previously, it will be overridden and replaced with the new value. If it did not exist previously, it will be added to the current parameters.
Definition at line 366 of file AnalyticExpressionEvaluator.cpp.
References m_parameter, and m_parameterMapNameToId.
Referenced by Nektar::LibUtilities::Equation::SetParameter(), and SetParameters().
void Nektar::LibUtilities::AnalyticExpressionEvaluator::SetParameters | ( | std::map< std::string, NekDouble > const & | params | ) |
Parameters are like constants, but they are inserted into the function at the time Evaluate is called instead of when the function is parsed. This function can be called at any time, and it will take effect in the next call to Evaluate. This function will delete all of the parameters, and replace all of them with only the ones in the map argument.
Definition at line 358 of file AnalyticExpressionEvaluator.cpp.
References SetParameter().
void Nektar::LibUtilities::AnalyticExpressionEvaluator::SetRandomSeed | ( | unsigned int | seed = 123u | ) |
Definition at line 310 of file AnalyticExpressionEvaluator.cpp.
References m_generator.
|
private |
Definition at line 426 of file AnalyticExpressionEvaluator.hpp.
Referenced by AddConstant(), and PrepareExecutionAsYouParse().
|
private |
Definition at line 422 of file AnalyticExpressionEvaluator.hpp.
Referenced by AddConstant(), and PrepareExecutionAsYouParse().
|
private |
This is a parser for spirit that parses the CONSTANT values. The default constants are those that are in math.h without the M_ prefix and they are initialized in the AnalyticExpressionEvaluator constructor.
Definition at line 313 of file AnalyticExpressionEvaluator.hpp.
Referenced by AddConstant(), DefineFunction(), and GetConstant().
|
private |
Definition at line 396 of file AnalyticExpressionEvaluator.hpp.
Referenced by DefineFunction(), Evaluate(), EvaluateAtPoint(), and ~AnalyticExpressionEvaluator().
|
private |
Definition at line 423 of file AnalyticExpressionEvaluator.hpp.
|
private |
Definition at line 459 of file AnalyticExpressionEvaluator.hpp.
Referenced by AnalyticExpressionEvaluator(), and PrepareExecutionAsYouParse().
|
private |
Definition at line 460 of file AnalyticExpressionEvaluator.hpp.
Referenced by AnalyticExpressionEvaluator(), and PrepareExecutionAsYouParse().
|
private |
Definition at line 458 of file AnalyticExpressionEvaluator.hpp.
Referenced by AnalyticExpressionEvaluator(), and PrepareExecutionAsYouParse().
|
private |
Definition at line 447 of file AnalyticExpressionEvaluator.hpp.
Referenced by SetRandomSeed().
|
private |
Definition at line 425 of file AnalyticExpressionEvaluator.hpp.
Referenced by GetParameter(), and SetParameter().
|
private |
The following data structures hold input data to be used on evaluation stage. There are three types of input data:
Definition at line 421 of file AnalyticExpressionEvaluator.hpp.
Referenced by GetParameter(), PrepareExecutionAsYouParse(), and SetParameter().
|
private |
These vector and map store pre-processed evaluation sequences for the analytic expressions. Each ExecutionStack is an ordered container of steps of sequential execution process which evaluates an analytic expression.
Definition at line 395 of file AnalyticExpressionEvaluator.hpp.
Referenced by DefineFunction().
|
private |
Keeping map of variables individually per each analytic expression allows correctly handling expressions which depend on different number of variables.
Definition at line 402 of file AnalyticExpressionEvaluator.hpp.
Referenced by DefineFunction(), and EvaluateAtPoint().
|
private |
This vector stores the execution state (memory) used by the sequential execution process.
Definition at line 432 of file AnalyticExpressionEvaluator.hpp.
Referenced by Evaluate(), and EvaluateAtPoint().
|
private |
This counter is used by PrepareExecutionAsYouParse for finding the minimal state size necessary for evaluation of function parsed.
Definition at line 439 of file AnalyticExpressionEvaluator.hpp.
Referenced by AnalyticExpressionEvaluator(), DefineFunction(), and PrepareExecutionAsYouParse().
|
private |
Vector of state sizes per each.
Definition at line 435 of file AnalyticExpressionEvaluator.hpp.
Referenced by DefineFunction(), Evaluate(), and EvaluateAtPoint().
|
private |
Timer and sum of evaluation times.
Definition at line 443 of file AnalyticExpressionEvaluator.hpp.
Referenced by Evaluate(), and EvaluateAtPoint().
|
private |
Definition at line 444 of file AnalyticExpressionEvaluator.hpp.
Referenced by Evaluate(), EvaluateAtPoint(), and GetTime().
|
private |
Definition at line 427 of file AnalyticExpressionEvaluator.hpp.
Referenced by Evaluate(), and EvaluateAtPoint().