www.mooseframework.org
ParsedMaterialHelper.h
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 #ifndef PARSEDMATERIALHELPER_H
8 #define PARSEDMATERIALHELPER_H
9 
10 #include "FunctionMaterialBase.h"
11 #include "FunctionParserUtils.h"
13 
14 #include "libmesh/fparser_ad.hh"
15 
16 // forward declatration
18 
19 template <>
20 InputParameters validParams<ParsedMaterialHelper>();
21 
26 class ParsedMaterialHelper : public FunctionMaterialBase, public FunctionParserUtils
27 {
28 public:
30  {
33  };
34 
35  ParsedMaterialHelper(const InputParameters & parameters, VariableNameMappingMode map_mode);
36 
37  void functionParse(const std::string & function_expression);
38  void functionParse(const std::string & function_expression,
39  const std::vector<std::string> & constant_names,
40  const std::vector<std::string> & constant_expressions);
41  void functionParse(const std::string & function_expression,
42  const std::vector<std::string> & constant_names,
43  const std::vector<std::string> & constant_expressions,
44  const std::vector<std::string> & mat_prop_names,
45  const std::vector<std::string> & tol_names,
46  const std::vector<Real> & tol_values);
47 
48 protected:
49  virtual void computeProperties();
50 
51  // tasks to perform after parsing the primary function
52  virtual void functionsPostParse();
53 
54  // run FPOptimizer on the parsed function
55  virtual void functionsOptimize();
56 
58  ADFunctionPtr _func_F;
59 
61  std::vector<std::string> _variable_names;
62 
64  typedef std::vector<FunctionMaterialPropertyDescriptor> MatPropDescriptorList;
65 
67  MatPropDescriptorList _mat_prop_descriptors;
68 
70  std::vector<Real> _tol;
71 
79 };
80 
81 #endif // PARSEDMATERIALHELPER_H
virtual void computeProperties()
std::vector< std::string > _variable_names
variable names used in the expression (depends on the map_mode)
std::vector< FunctionMaterialPropertyDescriptor > MatPropDescriptorList
convenience typedef for the material property descriptors
Material base class central for all Materials that provide a Function as a material property value...
const VariableNameMappingMode _map_mode
Flag to indicate if MOOSE nonlinear variable names should be used as FParser variable names...
std::vector< Real > _tol
Tolerance values for all arguments (to protect from log(0)).
InputParameters validParams< ParsedMaterialHelper >()
virtual void functionsPostParse()
Helper class to perform the parsing and optimization of the function expression.
MatPropDescriptorList _mat_prop_descriptors
Material property descriptors (obtained by parsing _mat_prop_expressions)
virtual void functionsOptimize()
ParsedMaterialHelper(const InputParameters &parameters, VariableNameMappingMode map_mode)
ADFunctionPtr _func_F
The undiffed free energy function parser object.
void functionParse(const std::string &function_expression)