www.mooseframework.org
FunctionMaterialPropertyDescriptor.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 FUNCTIONMATERIALPROPERTYDESCRIPTOR_H
8 #define FUNCTIONMATERIALPROPERTYDESCRIPTOR_H
9 
10 #include "DerivativeMaterialPropertyNameInterface.h"
11 #include "Material.h"
12 
13 #include <string>
14 #include <vector>
15 
16 class MooseObject;
17 
22 class FunctionMaterialPropertyDescriptor : public DerivativeMaterialPropertyNameInterface
23 {
24 public:
25  /*
26  * The descriptor is constructed with an expression that describes the
27  * material property.
28  * Examples:
29  * 'F' A material property called 'F' with no declared variable
30  * dependencies (i.e. vanishing derivatives)
31  * 'F(c,phi)' A material property called 'F' with declared dependence
32  * on 'c' and 'phi' (uses DerivativeFunctionMaterial rules to
33  * look up the derivatives)
34  * 'a:=D[x(t),t,t]' The second time derivative of the t-dependent material property 'x'
35  * which will be referred to as 'a' in the function expression.
36  */
37  FunctionMaterialPropertyDescriptor(const std::string &, MooseObject *);
38 
41 
44 
46  static std::vector<FunctionMaterialPropertyDescriptor>
47  parseVector(const std::vector<std::string> &, MooseObject *);
48 
50  const std::string & getSymbolName() const { return _fparser_name; };
51 
53  void setSymbolName(const std::string & n) { _fparser_name = n; };
54 
56  const std::string getPropertyName() const { return propertyName(_base_name, _derivative_vars); };
57 
59  const MaterialProperty<Real> & value() const;
60 
62  void addDerivative(const VariableName & var);
63 
69  bool dependsOn(const std::string & var) const;
70 
72  std::vector<VariableName> getDependentVariables();
73 
74  // output the internal state of this descriptor for debugging purposes
75  void printDebug();
76 
77 private:
78  void parseDerivative(const std::string &);
79  void parseDependentVariables(const std::string &);
80 
82  std::string _fparser_name;
83 
85  std::string _base_name;
86 
87  std::vector<VariableName> _dependent_vars;
88  std::vector<VariableName> _derivative_vars;
89 
91  mutable const MaterialProperty<Real> * _value;
92 
94  MooseObject * _parent;
95 };
96 
97 #endif // FUNCTIONMATERIALPROPERTYDESCRIPTOR_H
Material properties get fully described using this structure, including their dependent variables and...
const std::string getPropertyName() const
get the property name
void addDerivative(const VariableName &var)
take another derivative
const std::string & getSymbolName() const
get the fparser symbol name
static std::vector< FunctionMaterialPropertyDescriptor > parseVector(const std::vector< std::string > &, MooseObject *)
construct a vector of FunctionMaterialPropertyDescriptors from a vector of strings ...
std::string _base_name
function material property base name
MooseObject * _parent
material object that owns this descriptor
std::vector< VariableName > getDependentVariables()
builds a list of dependent variables (exactly all variabled for which depends on returns true) ...
std::string _fparser_name
name used in function expression
void setSymbolName(const std::string &n)
set the fparser symbol name
bool dependsOn(const std::string &var) const
Check if a material property depends on a given variable.
const MaterialProperty< Real > & value() const
get the property reference
const MaterialProperty< Real > * _value
material property value (this is lazily updated and cached when read through value()) ...