Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
AnalyticExpressionEvaluator.hpp
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File AnalyticExpressionEvaluator.hpp
4 //
5 // For more information, please see: http://www.nektar.info
6 //
7 // The MIT License
8 //
9 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10 // Department of Aeronautics, Imperial College London (UK), and Scientific
11 // Computing and Imaging Institute, University of Utah (USA).
12 //
13 // License for the specific language governing rights and limitations under
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: Parser and evaluator of analytic expressions.
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef _ANALYTIC_EXPRESSION_EVALUATOR_HPP
37 #define _ANALYTIC_EXPRESSION_EVALUATOR_HPP
38 
42 
43 #include <boost/version.hpp>
44 #include <boost/random/mersenne_twister.hpp> // for mt19937
45 #include <boost/random/variate_generator.hpp> // for variate_generator
46 #include <boost/random/normal_distribution.hpp>
47 
48 #include <boost/math/special_functions/bessel.hpp>
49 
50 #define BOOST_SPIRIT_THREADSAFE
51 #if( BOOST_VERSION / 100 % 1000 >= 36 )
52 #include <boost/spirit/include/classic_core.hpp>
53 #include <boost/spirit/include/classic_ast.hpp>
54 #include <boost/spirit/include/classic_symbols.hpp>
55 #include <boost/spirit/include/classic_assign_actor.hpp>
56 #include <boost/spirit/include/classic_push_back_actor.hpp>
57 
58 namespace boost_spirit = boost::spirit::classic;
59 #else
60 #include <boost/spirit/core.hpp>
61 #include <boost/spirit/tree/ast.hpp>
62 #include <boost/spirit/symbols/symbols.hpp>
63 #include <boost/spirit/actor/assign_actor.hpp>
64 #include <boost/spirit/actor/push_back_actor.hpp>
65 
66 namespace boost_spirit = boost::spirit;
67 #endif
68 
69 #include <string>
70 #include <vector>
71 #include <map>
72 #if defined(__INTEL_COMPILER)
73 #include <mathimf.h>
74 #else
75 #include <cmath>
76 #endif
77 
78 namespace Nektar
79 {
80  namespace LibUtilities
81  {
83  {
84  if (x != 0. || y != 0.)
85  return sqrt (x*x + y*y);
86  else
87  return 0.;
88  }
89 
91  {
92  NekDouble theta = 0.;
93  if ((x != 0.) || (y != 0.))
94  theta = atan2 (y,x);
95  return theta;
96  }
97 
98  /// This class defines evaluator of analytic (symbolic)
99  /// mathematical expressions. Expressions are allowed to
100  /// depend on a number of spatial-time variables and
101  /// parameters. Pre-processing and evaluation stages are
102  /// split. At evaluation stage one specifies values for
103  /// each variable, resulting expression value is returned.
104  /// Vectorized evaluator (evaluate expression at a set of
105  /// points) is available.
106  ///
107  /// Internally this class uses boost::spirit to parse analytic
108  /// expressions and unrolls their recursive bracketing structure
109  /// into a sequence of evaluation steps (aka execution stack)
110  /// with resolved data dependencies. Once an expression is
111  /// pre-processed, its execution stack is stored internally
112  /// in order to be re-used.
113 
115  {
116 
117  private:
118 
120 
121  public:
122 
123 
124  typedef std::map<std::string, int> VariableMap;
125  typedef std::map<std::string, int> ConstantMap;
126  typedef std::map<std::string, int> ParameterMap;
127  typedef std::map<std::string, int> ExpressionMap;
128  typedef std::map<std::string, int> FunctionNameMap;
129  typedef std::vector<EvaluationStep*> ExecutionStack;
130  typedef std::pair<bool, NekDouble> PrecomputedValue;
133 
134  typedef boost_spirit::tree_parse_info<
135  std::string::const_iterator,
136  boost_spirit::node_val_data_factory<NekDouble>
138  typedef boost_spirit::tree_match<
139  std::string::const_iterator,
140  boost_spirit::node_val_data_factory<NekDouble>
141  >::tree_iterator ParsedTreeIterator;
142 
143  typedef std::vector<const Array<OneD, const NekDouble>* > VariableArray;
144 
145  typedef boost::mt19937 RandomGeneratorType;
146 
147 
148  // ======================================
149  // Methods
150  // ======================================
151 
152 
153  /// Initializes the evaluator to a state where it is ready to accept input
154  /// from the #DefineFunction function.
156 
157  /// Destroys the execution stack.
159 
160 
161  // ======================================
162  // Setting up methods
163  // ======================================
164 
165 
166  LIB_UTILITIES_EXPORT void SetRandomSeed(unsigned int seed = 123u);
167 
168  /// Constants are evaluated and inserted into the function at the time it is parsed
169  /// when calling the #DefineFunction function. After parsing, if a constant is
170  /// changed, it will not be reflected in the function when Evaluate is called. This
171  /// also means that if a function with an unknown constant is added, and then the
172  /// constant is added, the function will not see the added constant and through an
173  /// exception. This function will add all of the constants in the map argument to
174  /// the global internal constants. If a constant was already loaded previously, it will
175  /// throw an exception stating which constants in the map had this issue. It will add
176  /// all of the constants it can and output the constants it couldn't add in the string
177  /// exception.
178  LIB_UTILITIES_EXPORT void AddConstants(std::map<std::string, NekDouble> const& constants);
179 
180  /// This function behaves in the same way as #AddConstants, but it only adds one
181  /// constant at a time. If the constant existed previously, an exception will be thrown
182  /// stating the fact. If it did not exist previously, it will be added to the global
183  /// constants and will be used the next time #DefineFunction is called.
184  LIB_UTILITIES_EXPORT int AddConstant(std::string const& name, NekDouble value);
185 
186  /// If a constant with the specified name exists, it returns the NekDouble value that the
187  /// constant stores. If the constant doesn't exist, it throws an exception.
188  LIB_UTILITIES_EXPORT NekDouble GetConstant(std::string const& name);
189 
190  /// Parameters are like constants, but they are inserted into the function at the time
191  /// #Evaluate is called instead of when the function is parsed. This function can
192  /// be called at any time, and it will take effect in the next call to #Evaluate.
193  /// This function will delete all of the parameters, and replace all of them with only
194  /// the ones in the map argument.
195  LIB_UTILITIES_EXPORT void SetParameters(std::map<std::string, NekDouble> const& params);
196 
197  /// This function behaves in the same way as #SetParameters, but it only adds one
198  /// parameter and it does not delete the others. If the parameter existed previously,
199  /// it will be overridden and replaced with the new value. If it did not exist previously,
200  /// it will be added to the current parameters.
201  LIB_UTILITIES_EXPORT void SetParameter(std::string const& name, NekDouble value);
202 
203  /// If a parameter with the specified name exists, it returns the NekDouble value that the
204  /// parameter stores. If the parameter doesn't exist, it throws an exception.
205  LIB_UTILITIES_EXPORT NekDouble GetParameter(std::string const& name);
206 
207  /// Returns the total time spent in evaluation procedures, seconds.
208  LIB_UTILITIES_EXPORT NekDouble GetTime() const;
209 
210 
211  // ======================================================
212  // Parsing and evaluation methods
213  // ======================================================
214 
215 
216  /// This function allows one to define a function to evaluate. The first argument (vlist)
217  /// is a list of variables (separated by spaces) that the second argument (function)
218  /// depends on. For example, if function = "x + y", then vlist should most likely be
219  /// "x y", unless you are defining x or y as parameters with #SetParameters.
220  /// \output parsed expression ID. You will need this expression id to call evaluation
221  /// methods below.
222  LIB_UTILITIES_EXPORT int DefineFunction(const std::string& vlist, const std::string& function);
223 
224 
225  /// Evaluation method for expressions depending on parameters only.
226  LIB_UTILITIES_EXPORT NekDouble Evaluate(const int AnalyticExpression_id);
227 
228  /// Evaluation method for expressions depending on 4 variables (+parameters).
229  LIB_UTILITIES_EXPORT NekDouble Evaluate(
230  const int AnalyticExpression_id,
231  const NekDouble,
232  const NekDouble,
233  const NekDouble,
234  const NekDouble);
235 
236  /// Evaluation method for expressions depending on unspecified number of variables.
237  /// This suitable for expressions depending on more than 4 variables or for the dynamic
238  /// setting some variables as parameters (there is currently no interface method
239  /// for removing a variable from parameter map though).
241  const int AnalyticExpression_id,
242  std::vector<NekDouble> point);
243 
244  /// Vectorized evaluation method for expressions depending on 4 variables.
246  const int expression_id,
251  Array<OneD, NekDouble>& result);
252 
253 
254 
255  /// Vectorized evaluation method for expressions depending on unspecified
256  /// number of variables.
258  const int expression_id,
259  const std::vector<Array<OneD, const NekDouble> > points,
260  Array<OneD, NekDouble>& result);
261 
262  private:
263 
264  // ======================================================
265  // Private parsing and partial evaluation method
266  // ======================================================
267 
268  /// This method prepares the execution stack (an ordered sequence of
269  /// operators that perform the evaluation) for the parsed evaluation tree.
270  ///
271  /// In order to do this, it unrolls binary tree representing
272  /// the recursive evaluation into an ordered sequence of commands.
273  /// That ordered sequence of commands is equivalent to bottom-up
274  /// walk up the evaluation tree, but this allows not to form tree explicitly.
275  ///
276  /// This approach requires to introduce explicitly an execution state
277  /// (memory) shared by commands in the evaluation sequence: recursively
278  /// dependent commands need to pass data between each other. Such state
279  /// for the recursive evaluation is passed via return values of a recursive
280  /// evaluation function --- which is bad if one wants to implement vectorized
281  /// evaluator.
282  ///
283  /// On the other hand, to run through a sequential container of
284  /// functors is faster than to walk the tree and at each node to check
285  /// the node type.
286  ///
287  /// \input root - iterator generated by boost::spirit;
288  /// stack - initially empty sequential container of evaluation steps;
289  /// varMap - maps variable names to their ids;
290  /// stateIndex - an index in state[] array where an evaluation
291  /// step corresponding to the current tree node
292  /// is allowed to write.
293  /// \output an std::pair<bool, NekDouble> which encodes fully pre-evaluated
294  /// NekDouble value as pair <true, value> if all sub-tree down the
295  /// current node evaluates to constant, or flags the opposite
296  /// via pair <false,0>.
298  const ParsedTreeIterator& root,
299  ExecutionStack& stack,
300  VariableMap &varMap,
301  int stateIndex);
302 
303 
304  // ======================================================
305  // Boost::spirit related data structures
306  // ======================================================
307 
308 
309  /** This is a parser for spirit that parses the CONSTANT values. The default
310  constants are those that are in math.h without the M_ prefix and they are
311  initialized in the AnalyticExpressionEvaluator constructor. **/
312 
313  boost_spirit::symbols<NekDouble> m_constantsParser;
314 
315 
316  /** This is the class that is used as the grammar parser for the spirit engine. **/
317  class AnalyticExpression : public boost_spirit::grammar<AnalyticExpression>
318  {
319  private:
320  const boost_spirit::symbols<NekDouble>* constants_p;
321 
322  /** Variables is a customized parser that will match the variables that the function
323  depends on (the first argument of #DefineFunction). **/
324  struct variables : boost_spirit::symbols<NekDouble*>
325  {
326  variables(std::vector<std::string> const& vars)
327  {
328  for (std::vector<std::string>::const_iterator it = vars.begin(); it != vars.end(); it++)
329  add(it->c_str(), 0);
330  }
331  } variables_p;
332 
333  public:
334  /** These constants are used to determine what parser was used to parse what value,
335  which allows for type identification when analyzing the parsed AST. **/
336  static const int constantID = 1;
337  static const int numberID = 2;
338  static const int variableID = 3;
339  static const int parameterID = 4;
340  static const int functionID = 5;
341  static const int factorID = 6;
342  static const int operatorID = 7;
343 
344  AnalyticExpression(const boost_spirit::symbols<NekDouble>* constants, const std::vector<std::string>& variables) :
345  boost_spirit::grammar<AnalyticExpression>(), constants_p(constants), variables_p(variables) {}
346 
347  // Trivial constructor to avoid compiler warning with
348  // constants_p.
350  {
351  constants_p = NULL;
352  }
353 
354  template <typename ScannerT>
355  struct definition
356  {
357  /** This function specifies the grammar of the MathAnalyticExpression parser. **/
358  definition(AnalyticExpression const& self);
359 
360  /** This holds the NekDouble value that is parsed by spirit so it can be stored in the AST. **/
361  NekDouble ParsedDouble;
362 
363  boost_spirit::rule<ScannerT, boost_spirit::parser_context<>, boost_spirit::parser_tag<constantID> > constant;
364  boost_spirit::rule<ScannerT, boost_spirit::parser_context<>, boost_spirit::parser_tag<numberID> > number;
365  boost_spirit::rule<ScannerT, boost_spirit::parser_context<>, boost_spirit::parser_tag<variableID> > variable;
366  boost_spirit::rule<ScannerT, boost_spirit::parser_context<>, boost_spirit::parser_tag<parameterID> > parameter;
367  boost_spirit::rule<ScannerT, boost_spirit::parser_context<>, boost_spirit::parser_tag<functionID> > function;
368  boost_spirit::rule<ScannerT, boost_spirit::parser_context<>, boost_spirit::parser_tag<factorID> > factor;
369  boost_spirit::rule<ScannerT, boost_spirit::parser_context<>, boost_spirit::parser_tag<operatorID> > exponential;
370  boost_spirit::rule<ScannerT, boost_spirit::parser_context<>, boost_spirit::parser_tag<operatorID> > mult_div;
371  boost_spirit::rule<ScannerT, boost_spirit::parser_context<>, boost_spirit::parser_tag<operatorID> > add_sub;
372  boost_spirit::rule<ScannerT, boost_spirit::parser_context<>, boost_spirit::parser_tag<operatorID> > lt_gt;
373  boost_spirit::rule<ScannerT, boost_spirit::parser_context<>, boost_spirit::parser_tag<operatorID> > equality;
374  boost_spirit::rule<ScannerT, boost_spirit::parser_context<>, boost_spirit::parser_tag<operatorID> > logical_and;
375  boost_spirit::rule<ScannerT, boost_spirit::parser_context<>, boost_spirit::parser_tag<operatorID> > logical_or;
376  boost_spirit::rule<ScannerT, boost_spirit::parser_context<>, boost_spirit::parser_tag<operatorID> > expression;
377  boost_spirit::rule<ScannerT, boost_spirit::parser_context<>, boost_spirit::parser_tag<operatorID> > op;
378 
379  boost_spirit::rule<ScannerT, boost_spirit::parser_context<>, boost_spirit::parser_tag<operatorID> > const&
380  start() const { return expression; }
381  };
382  }; // class AnalyticExpression
383 
384 
385 
386  // ======================================================
387  // Pre-processed expressions
388  // ======================================================
389 
390  /// These vector and map store pre-processed evaluation sequences
391  /// for the analytic expressions. Each ExecutionStack is an ordered
392  /// container of steps of sequential execution process which
393  /// evaluates an analytic expression.
394 
396  std::vector<ExecutionStack> m_executionStack;
397 
398  /// Keeping map of variables individually per each analytic expression
399  /// allows correctly handling expressions which depend on different
400  /// number of variables.
401 
402  std::vector<VariableMap> m_stackVariableMap;
403 
404  // ======================================================
405  // Execution state and data
406  // ======================================================
407 
408  /// The following data structures hold input data to be used on evaluation
409  /// stage. There are three types of input data:
410  /// - constants (never change their value)
411  /// - parameters are allowed to change their values between evaluations
412  /// (compared to constants)
413  /// - variables always change their values at every evaluation call.
414  /// First map looks like <parameter_name, parameter_id> while the second is
415  /// <parameter_id, parameter_value>. The map is used at a preparation
416  /// stage when the analytic expression is parsed. This associates an integer
417  /// id with a parameter name in its string form. On evaluation stage the id
418  /// and a std::vector constant lookup time make evaluation faster compared
419  /// to permanent std::map<std::string, NekDouble> lookup.
420 
424 
425  std::vector<NekDouble> m_parameter;
426  std::vector<NekDouble> m_constant;
427  std::vector<NekDouble> m_variable;
428 
429 
430  /// This vector stores the execution state (memory) used by the
431  /// sequential execution process.
432  std::vector<NekDouble> m_state;
433 
434  /// Vector of state sizes per each
435  std::vector<int> m_state_sizes;
436 
437  /// This counter is used by PrepareExecutionAsYouParse for finding
438  /// the minimal state size necessary for evaluation of function parsed.
440 
441 
442  /// Timer and sum of evaluation times
444  NekDouble m_total_eval_time;
445 
446 
447  RandomGeneratorType m_generator;
448  // boost::variate_generator<RandomGeneratorType&, boost::normal_distribution<> >
449  // m_normal;
450 
451 
452 
453  // ======================================================
454  // A map of (external) mathematical functions
455  // ======================================================
456 
457 
459  std::map<int, OneArgFunc> m_function;
460  std::map<int, TwoArgFunc> m_function2;
461 
462  // ======================================================
463  // Internal representation of evaluation step
464  // ======================================================
465 
466  /// Short names to minimise the infractructural code mess in defining functors below.
467  typedef std::vector<NekDouble>& vr;
468  typedef const std::vector<NekDouble>& cvr;
469  typedef const int ci;
470  typedef RandomGeneratorType& rgt;
471 
472  /// Factory method which makes code little less messy
473  template<typename StepType>
474  EvaluationStep* makeStep(ci dest, ci src_left = 0, ci src_right = 0)
475  {
476  return ( new StepType ( m_generator,m_state,m_constant,m_parameter,m_variable,dest,src_left,src_right ) );
477  }
478 
480  {
485  };
486 
487 
488 
489  /// Function objects (functors)
491  {
492  /// reference to random number generator
493  rgt rng;
494 
495  /// references to arrays holding the common state
496  vr state;
497  cvr consts;
498  cvr params;
499  cvr vars;
500 
501  /// indices in the above arrays uniquely defining actual command arguments
505 
506  EvaluationStep(rgt rn, ci i, ci l, ci r, vr s, cvr c, cvr p, cvr v):
507  rng(rn), state(s), consts(c), params(p), vars(v), storeIdx(i), argIdx1(l), argIdx2(r) {};
508 
509  virtual ~EvaluationStep() {}
510 
511  /// declaring this guy pure virtual shortens virtual table. It saves some execution time.
512  virtual void run_many(ci n) = 0;
513  virtual void run_once() = 0;
514  };
515  struct CopyState: public EvaluationStep
516  {
517  CopyState(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
518  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = state[argIdx1]; }
519  virtual void run_once() { state[storeIdx] = state[argIdx1]; }
520  };
521  struct StoreConst: public EvaluationStep
522  {
523  StoreConst(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
524  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = consts[argIdx1]; }
525  virtual void run_once() { state[storeIdx] = consts[argIdx1]; }
526  };
527  struct StoreVar: public EvaluationStep
528  {
529  StoreVar(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
530  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = vars[argIdx1*n+i]; }
531  virtual void run_once() { state[storeIdx] = vars[argIdx1]; }
532  };
533  struct StorePrm: public EvaluationStep
534  {
535  StorePrm(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
536  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = params[argIdx1]; }
537  virtual void run_once() { state[storeIdx] = params[argIdx1]; }
538  };
539  struct EvalSum: public EvaluationStep
540  {
541  EvalSum(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
542  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = state[argIdx1*n+i] + state[argIdx2*n+i]; }
543  virtual void run_once() { state[storeIdx] = state[argIdx1] + state[argIdx2]; }
544  };
545  struct EvalSub: public EvaluationStep
546  {
547  EvalSub(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
548  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = state[argIdx1*n+i] - state[argIdx2*n+i]; }
549  virtual void run_once() { state[storeIdx] = state[argIdx1] - state[argIdx2]; }
550  };
551  struct EvalMul: public EvaluationStep
552  {
553  EvalMul(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
554  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = state[argIdx1*n+i] * state[argIdx2*n+i]; }
555  virtual void run_once() { state[storeIdx] = state[argIdx1] * state[argIdx2]; }
556  };
557  struct EvalDiv: public EvaluationStep
558  {
559  EvalDiv(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
560  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = state[argIdx1*n+i] / state[argIdx2*n+i]; }
561  virtual void run_once() { state[storeIdx] = state[argIdx1] / state[argIdx2]; }
562  };
563  struct EvalPow: public EvaluationStep
564  {
565  EvalPow(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
566  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = std::pow( state[argIdx1*n+i], state[argIdx2*n+i] ); }
567  virtual void run_once() { state[storeIdx] = std::pow( state[argIdx1], state[argIdx2] ); }
568  };
569  struct EvalNeg: public EvaluationStep
570  {
571  EvalNeg(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
572  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = - state[argIdx1*n+i]; }
573  virtual void run_once() { state[storeIdx] = - state[argIdx1]; }
574  };
576  {
577  EvalLogicalEqual(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
578  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = ( state[argIdx1*n+i] == state[argIdx2*n+i] ); }
579  virtual void run_once() { state[storeIdx] = ( state[argIdx1] == state[argIdx2] ); }
580  };
582  {
583  EvalLogicalLeq(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
584  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = ( state[argIdx1*n+i] <= state[argIdx2*n+i] ); }
585  virtual void run_once() { state[storeIdx] = ( state[argIdx1] <= state[argIdx2] ); }
586  };
588  {
589  EvalLogicalLess(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
590  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = ( state[argIdx1*n+i] < state[argIdx2*n+i] ); }
591  virtual void run_once() { state[storeIdx] = ( state[argIdx1] < state[argIdx2] ); }
592  };
594  {
595  EvalLogicalGeq(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
596  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = ( state[argIdx1*n+i] >= state[argIdx2*n+i] ); }
597  virtual void run_once() { state[storeIdx] = ( state[argIdx1] >= state[argIdx2] ); }
598  };
600  {
601  EvalLogicalGreater(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
602  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = ( state[argIdx1*n+i] > state[argIdx2*n+i] ); }
603  virtual void run_once() { state[storeIdx] = ( state[argIdx1] > state[argIdx2] ); }
604  };
605  struct EvalAbs: public EvaluationStep
606  {
607  EvalAbs(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
608  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = std::abs( state[argIdx1*n+i] ); }
609  virtual void run_once() { state[storeIdx] = std::abs( state[argIdx1] ); }
610  };
611  struct EvalSign: public EvaluationStep
612  {
613  EvalSign(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
614  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = ((state[argIdx1*n+i] > 0.0) - (state[argIdx1*n+i] < 0.0)); }
615  virtual void run_once() { state[storeIdx] = ((state[argIdx1] > 0.0) - (state[argIdx1] < 0.0)); }
616  };
617  struct EvalAsin: public EvaluationStep
618  {
619  EvalAsin(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
620  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = std::asin( state[argIdx1*n+i] ); }
621  virtual void run_once() { state[storeIdx] = std::asin( state[argIdx1] ); }
622  };
623  struct EvalAcos: public EvaluationStep
624  {
625  EvalAcos(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
626  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = std::acos( state[argIdx1*n+i] ); }
627  virtual void run_once() { state[storeIdx] = std::acos( state[argIdx1] ); }
628  };
629  struct EvalAtan: public EvaluationStep
630  {
631  EvalAtan(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
632  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = std::atan( state[argIdx1*n+i] ); }
633  virtual void run_once() { state[storeIdx] = std::atan( state[argIdx1] ); }
634  };
635  struct EvalAtan2: public EvaluationStep
636  {
637  EvalAtan2(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
638  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = std::atan2( state[argIdx1*n+i], state[argIdx2*n+i] ); }
639  virtual void run_once() { state[storeIdx] = std::atan2( state[argIdx1], state[argIdx2] ); }
640  };
641  struct EvalAng: public EvaluationStep
642  {
643  EvalAng(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
644  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = ang( state[argIdx1*n+i], state[argIdx2*n+i] ); }
645  virtual void run_once() { state[storeIdx] = ang( state[argIdx1], state[argIdx2] ); }
646  };
647  struct EvalBessel: public EvaluationStep
648  {
649  EvalBessel(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
650  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = boost::math::cyl_bessel_j( state[argIdx1*n+i], state[argIdx2*n+i] ); }
651  virtual void run_once() { state[storeIdx] = boost::math::cyl_bessel_j( state[argIdx1], state[argIdx2] ); }
652  };
653  struct EvalCeil: public EvaluationStep
654  {
655  EvalCeil(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
656  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = std::ceil( state[argIdx1*n+i] ); }
657  virtual void run_once() { state[storeIdx] = std::ceil( state[argIdx1] ); }
658  };
659  struct EvalCos: public EvaluationStep
660  {
661  EvalCos(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
662  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = std::cos( state[argIdx1*n+i] ); }
663  virtual void run_once() { state[storeIdx] = std::cos( state[argIdx1] ); }
664  };
665  struct EvalCosh: public EvaluationStep
666  {
667  EvalCosh(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
668  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = std::cosh( state[argIdx1*n+i] ); }
669  virtual void run_once() { state[storeIdx] = std::cosh( state[argIdx1] ); }
670  };
671  struct EvalExp: public EvaluationStep
672  {
673  EvalExp(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
674  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = std::exp( state[argIdx1*n+i] ); }
675  virtual void run_once() { state[storeIdx] = std::exp( state[argIdx1] ); }
676  };
677  struct EvalFabs: public EvaluationStep
678  {
679  EvalFabs(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
680  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = std::fabs( state[argIdx1*n+i] ); }
681  virtual void run_once() { state[storeIdx] = std::fabs( state[argIdx1] ); }
682  };
683  struct EvalFloor: public EvaluationStep
684  {
685  EvalFloor(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
686  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = std::floor( state[argIdx1*n+i] ); }
687  virtual void run_once() { state[storeIdx] = std::floor( state[argIdx1] ); }
688  };
689  struct EvalLog: public EvaluationStep
690  {
691  EvalLog(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
692  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = std::log( state[argIdx1*n+i] ); }
693  virtual void run_once() { state[storeIdx] = std::log( state[argIdx1] ); }
694  };
695  struct EvalLog10: public EvaluationStep
696  {
697  EvalLog10(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
698  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = std::log10( state[argIdx1*n+i] ); }
699  virtual void run_once() { state[storeIdx] = std::log10( state[argIdx1] ); }
700  };
701  struct EvalRad: public EvaluationStep
702  {
703  EvalRad(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
704  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = rad( state[argIdx1*n+i], state[argIdx2*n+i] ); }
705  virtual void run_once() { state[storeIdx] = rad( state[argIdx1], state[argIdx2] ); }
706  };
707  struct EvalSin: public EvaluationStep
708  {
709  EvalSin(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
710  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = std::sin( state[argIdx1*n+i] ); }
711  virtual void run_once() { state[storeIdx] = std::sin( state[argIdx1] ); }
712  };
713  struct EvalSinh: public EvaluationStep
714  {
715  EvalSinh(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
716  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = std::sinh( state[argIdx1*n+i] ); }
717  virtual void run_once() { state[storeIdx] = std::sinh( state[argIdx1] ); }
718  };
719  struct EvalSqrt: public EvaluationStep
720  {
721  EvalSqrt(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
722  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = std::sqrt( state[argIdx1*n+i] ); }
723  virtual void run_once() { state[storeIdx] = std::sqrt( state[argIdx1] ); }
724  };
725  struct EvalTan: public EvaluationStep
726  {
727  EvalTan(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
728  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = std::tan( state[argIdx1*n+i] ); }
729  virtual void run_once() { state[storeIdx] = std::tan( state[argIdx1] ); }
730  };
731  struct EvalTanh: public EvaluationStep
732  {
733  EvalTanh(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
734  virtual void run_many(ci n) { for(int i=0;i<n;i++) state[storeIdx*n+i] = std::tanh( state[argIdx1*n+i] ); }
735  virtual void run_once() { state[storeIdx] = std::tanh( state[argIdx1] ); }
736  };
737  struct EvalAWGN: public EvaluationStep
738  {
739  EvalAWGN(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r): EvaluationStep(rn,i,l,r,s,c,p,v) {}
740  virtual void run_many(ci n)
741  {
742  // assuming the argument to AWGN does not depend on spatial variables =>
743  boost::variate_generator<RandomGeneratorType&, boost::normal_distribution<> >
744  _normal(rng, boost::normal_distribution<>(0, state[storeIdx*n]) );
745  for(int i=0;i<n;i++) { state[storeIdx*n+i] = _normal(); }
746  }
747  virtual void run_once()
748  {
749  boost::variate_generator<RandomGeneratorType&, boost::normal_distribution<> >
750  _normal(rng, boost::normal_distribution<>(0, state[storeIdx]) );
751  state[storeIdx] = _normal();
752  }
753  };
754 
755  };
756  };
757 };
758 
759 #endif // _ANALYTIC_EXPRESSION_EVALUATOR_HPP
static NekDouble ang(NekDouble x, NekDouble y)
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.
NekDouble GetTime() const
Returns the total time spent in evaluation procedures, seconds.
boost_spirit::rule< ScannerT, boost_spirit::parser_context<>, boost_spirit::parser_tag< operatorID > > logical_or
std::vector< NekDouble > & vr
Short names to minimise the infractructural code mess in defining functors below. ...
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 Defi...
boost_spirit::tree_parse_info< std::string::const_iterator, boost_spirit::node_val_data_factory< NekDouble > > ParsedTreeInfo
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.
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.
boost_spirit::rule< ScannerT, boost_spirit::parser_context<>, boost_spirit::parser_tag< operatorID > > exponential
EvalTanh(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
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.
StorePrm(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
EvalSinh(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
boost_spirit::rule< ScannerT, boost_spirit::parser_context<>, boost_spirit::parser_tag< operatorID > > const & start() const
virtual void run_many(ci n)
declaring this guy pure virtual shortens virtual table. It saves some execution time.
std::vector< VariableMap > m_stackVariableMap
Keeping map of variables individually per each analytic expression allows correctly handling expressi...
AnalyticExpression(const boost_spirit::symbols< NekDouble > *constants, const std::vector< std::string > &variables)
boost_spirit::rule< ScannerT, boost_spirit::parser_context<>, boost_spirit::parser_tag< operatorID > > op
EvalLog(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
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 no...
std::vector< const Array< OneD, const NekDouble > * > VariableArray
EvalFloor(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
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...
EvalExp(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.
StoreConst(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)
boost_spirit::rule< ScannerT, boost_spirit::parser_context<>, boost_spirit::parser_tag< parameterID > > parameter
EvalAsin(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.
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.
EvaluationStep * makeStep(ci dest, ci src_left=0, ci src_right=0)
Factory method which makes code little less messy.
NekDouble Evaluate(const int AnalyticExpression_id)
Evaluation method for expressions depending on parameters only.
virtual void run_many(ci n)
declaring this guy pure virtual shortens virtual table. It saves some execution time.
std::vector< NekDouble > m_state
This vector stores the execution state (memory) used by the sequential execution process.
EvalRad(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
EvalNeg(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)
EvalAbs(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.
AnalyticExpressionEvaluator(void)
Initializes the evaluator to a state where it is ready to accept input from the DefineFunction functi...
virtual void run_many(ci n)
declaring this guy pure virtual shortens virtual table. It saves some execution time.
NekDouble EvaluateAtPoint(const int AnalyticExpression_id, std::vector< NekDouble > point)
Evaluation method for expressions depending on unspecified number of variables. This suitable for exp...
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.
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.
boost_spirit::rule< ScannerT, boost_spirit::parser_context<>, boost_spirit::parser_tag< operatorID > > mult_div
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.
Nektar::LibUtilities::AnalyticExpressionEvaluator::AnalyticExpression::variables variables_p
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 evaluatio...
NekDouble GetConstant(std::string const &name)
If a constant with the specified name exists, it returns the NekDouble value that the constant stores...
virtual void run_many(ci n)
declaring this guy pure virtual shortens virtual table. It saves some execution time.
int m_state_size
This counter is used by PrepareExecutionAsYouParse for finding the minimal state size necessary for e...
ParameterMap m_parameterMapNameToId
The following data structures hold input data to be used on evaluation stage. There are three types o...
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)
boost_spirit::rule< ScannerT, boost_spirit::parser_context<>, boost_spirit::parser_tag< constantID > > constant
StoreVar(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
virtual void run_many(ci n)=0
declaring this guy pure virtual shortens virtual table. It saves some execution time.
#define LIB_UTILITIES_EXPORT
EvalAWGN(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
boost_spirit::rule< ScannerT, boost_spirit::parser_context<>, boost_spirit::parser_tag< variableID > > variable
virtual void run_many(ci n)
declaring this guy pure virtual shortens virtual table. It saves some execution time.
EvalAcos(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
double NekDouble
virtual void run_many(ci n)
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)
EvalPow(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
boost_spirit::rule< ScannerT, boost_spirit::parser_context<>, boost_spirit::parser_tag< operatorID > > equality
EvalMul(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
This class defines evaluator of analytic (symbolic) mathematical expressions. Expressions are allowed...
boost_spirit::rule< ScannerT, boost_spirit::parser_context<>, boost_spirit::parser_tag< factorID > > factor
boost_spirit::rule< ScannerT, boost_spirit::parser_context<>, boost_spirit::parser_tag< operatorID > > expression
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.
bg::model::point< double, 3, bg::cs::cartesian > point
Definition: BLMesh.cpp:54
virtual void run_many(ci n)
declaring this guy pure virtual shortens virtual table. It saves some execution time.
static NekDouble rad(NekDouble x, NekDouble y)
EvalCeil(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
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 va...
virtual void run_many(ci n)
declaring this guy pure virtual shortens virtual table. It saves some execution time.
boost_spirit::rule< ScannerT, boost_spirit::parser_context<>, boost_spirit::parser_tag< numberID > > number
#define dest(otri, vertexptr)
EvalSin(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
EvalLog10(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
std::vector< int > m_state_sizes
Vector of state sizes per each.
EvalLogicalLeq(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
EvalAng(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
NekDouble GetParameter(std::string const &name)
If a parameter with the specified name exists, it returns the NekDouble value that the parameter stor...
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.
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)
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.
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.
EvalLogicalGeq(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
boost_spirit::rule< ScannerT, boost_spirit::parser_context<>, boost_spirit::parser_tag< operatorID > > add_sub
CopyState(rgt rn, vr s, cvr c, cvr p, cvr v, ci i, ci l, ci r)
~AnalyticExpressionEvaluator(void)
Destroys the execution stack.
boost_spirit::tree_match< std::string::const_iterator, boost_spirit::node_val_data_factory< NekDouble > >::tree_iterator ParsedTreeIterator
virtual void run_many(ci n)
declaring this guy pure virtual shortens virtual table. It saves some execution time.
EvaluationStep(rgt rn, ci i, ci l, ci r, vr s, cvr c, cvr p, cvr v)
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.
virtual void run_many(ci n)
declaring this guy pure virtual shortens virtual table. It saves some execution time.
boost_spirit::rule< ScannerT, boost_spirit::parser_context<>, boost_spirit::parser_tag< operatorID > > logical_and
void 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...
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.
boost_spirit::rule< ScannerT, boost_spirit::parser_context<>, boost_spirit::parser_tag< operatorID > > lt_gt
ci storeIdx
indices in the above arrays uniquely defining actual command arguments
virtual void run_many(ci n)
declaring this guy pure virtual shortens virtual table. It saves some execution time.