www.mooseframework.org
GenericConstantRankTwoTensor.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
11 
13 
14 template <>
17 {
19  params.addRequiredParam<std::vector<Real>>(
20  "tensor_values", "Vector of values defining the constant rank two tensor");
21  params.addRequiredParam<MaterialPropertyName>(
22  "tensor_name", "Name of the tensor material property to be created");
23  return params;
24 }
25 
27  : Material(parameters),
28  _prop(declareProperty<RankTwoTensor>(getParam<MaterialPropertyName>("tensor_name")))
29 {
30  _tensor.fillFromInputVector(getParam<std::vector<Real>>("tensor_values"));
31 }
32 
33 void
35 {
36  _prop[_qp] = _tensor;
37 }
registerMooseObject("MooseApp", GenericConstantRankTwoTensor)
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
Definition: MooseObject.h:191
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
unsigned int _qp
Definition: Material.h:222
void fillFromInputVector(const std::vector< T > &input, FillMethod fill_method=autodetect)
fillFromInputVector takes 6 or 9 inputs to fill in the Rank-2 tensor.
Materials compute MaterialProperties.
Definition: Material.h:46
virtual void computeQpProperties() override
Users must override this method.
GenericConstantRankTwoTensor(const InputParameters &parameters)
InputParameters validParams< GenericConstantRankTwoTensor >()
Declares a constant material property of type RankTwoTensor.
InputParameters validParams< Material >()
Definition: Material.C:22
MaterialProperty< RankTwoTensor > & _prop