www.mooseframework.org
FunctionParserUtils.h
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #ifndef FUNCTIONPARSERUTILS_H
16 #define FUNCTIONPARSERUTILS_H
17 
18 #include "Moose.h"
19 
20 #include "libmesh/fparser_ad.hh"
21 
22 // C++ includes
23 #include <memory>
24 
25 // Forward declartions
27 class InputParameters;
28 
29 template <typename T>
31 
32 template <>
34 
36 {
37 public:
38  FunctionParserUtils(const InputParameters & parameters);
39 
41  typedef FunctionParserADBase<Real> ADFunction;
42 
44  typedef std::shared_ptr<ADFunction> ADFunctionPtr;
45 
47  void setParserFeatureFlags(ADFunctionPtr &);
48 
49 protected:
51  Real evaluate(ADFunctionPtr &);
52 
54  void addFParserConstants(ADFunctionPtr & parser,
55  const std::vector<std::string> & constant_names,
56  const std::vector<std::string> & constant_expressions);
57 
65 
67  const Real _nan;
68 
70  static const char * _eval_error_msg[];
71 
73  std::vector<Real> _func_params;
74 };
75 
76 #endif // FUNCTIONPARSERUTILS_H
static const char * _eval_error_msg[]
table of FParser eval error codes
Real evaluate(ADFunctionPtr &)
Evaluate FParser object and check EvalError.
void addFParserConstants(ADFunctionPtr &parser, const std::vector< std::string > &constant_names, const std::vector< std::string > &constant_expressions)
add constants (which can be complex expressions) to the parser object
FunctionParserADBase< Real > ADFunction
Shorthand for an autodiff function parser object.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
std::shared_ptr< ADFunction > ADFunctionPtr
Shorthand for an smart pointer to an autodiff function parser object.
InputParameters validParams()
FunctionParserUtils(const InputParameters &parameters)
const Real _nan
appropriate not a number value to return
InputParameters validParams< FunctionParserUtils >()
std::vector< Real > _func_params
Array to stage the parameters passed to the functions when calling Eval.
void setParserFeatureFlags(ADFunctionPtr &)
apply input paramters to internal feature flags of the parser object