www.mooseframework.org
FunctionMaterialBase.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 FUNCTIONMATERIALBASE_H
8 #define FUNCTIONMATERIALBASE_H
9 
10 #include "Material.h"
11 #include "DerivativeMaterialInterface.h"
12 
13 // Forward Declarations
15 
16 template <>
17 InputParameters validParams<FunctionMaterialBase>();
18 
23 class FunctionMaterialBase : public DerivativeMaterialInterface<Material>
24 {
25 public:
26  FunctionMaterialBase(const InputParameters & parameters);
27 
28 protected:
43  unsigned int argIndex(unsigned int i_var) const
44  {
45  const unsigned int idx = libMeshVarNumberRemap(i_var);
46  mooseAssert(idx < _arg_index.size() && _arg_numbers[_arg_index[idx]] == i_var,
47  "Requesting argIndex() for a derivative w.r.t. a variable not coupled to.");
48  return _arg_index[idx];
49  }
50 
52  std::vector<const VariableValue *> _args;
53 
58  std::string _F_name;
59 
62 
64  unsigned int _nargs;
65 
67  std::vector<std::string> _arg_names;
68 
70  std::vector<unsigned int> _arg_numbers;
71 
73  std::vector<std::string> _arg_param_names;
74 
76  std::vector<std::string> _arg_constant_defaults;
77 
80 
82  MaterialProperty<Real> * _prop_F;
83 
84 private:
86  unsigned int libMeshVarNumberRemap(unsigned int var) const
87  {
88  const int b = static_cast<int>(var);
89  return b >= 0 ? b << 1 : (-b << 1) - 1;
90  }
91 
93  std::vector<unsigned int> _arg_index;
94 };
95 
96 #endif // FUNCTIONMATERIALBASE_H
FunctionMaterialBase(const InputParameters &parameters)
std::vector< std::string > _arg_constant_defaults
coupled variables with default values
Material base class central for all Materials that provide a Function as a material property value...
std::vector< std::string > _arg_param_names
String vector of the input file coupling parameter name for each argument.
std::vector< unsigned int > _arg_index
Vector to look up the internal coupled variable index into arg* through the libMesh variable number...
MaterialProperty< Real > * _prop_F
Material property to store the function value.
unsigned int _nargs
Number of coupled arguments.
bool _third_derivatives
Calculate (and allocate memory for) the third derivatives of the free energy.
InputParameters validParams< FunctionMaterialBase >()
unsigned int libMeshVarNumberRemap(unsigned int var) const
map the variable numbers to an even/odd interspersed pattern
std::string _F_name
Name of the function value material property and used as a base name to concatenate the material prop...
std::vector< const VariableValue * > _args
Coupled variables for function arguments.
std::vector< std::string > _arg_names
String vector of all argument names.
bool _mapping_is_unique
Flag that indicates if exactly one linear variable is coupled per input file coupling parameter...
std::vector< unsigned int > _arg_numbers
Vector of all argument MOOSE variable numbers.
unsigned int argIndex(unsigned int i_var) const
FunctionMaterialBase keeps an internal list of all the variables the derivatives are taken w...