Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 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 : 10 : #include "GenericConstantRankTwoTensor.h" 11 : 12 : registerMooseObject("MooseApp", GenericConstantRankTwoTensor); 13 : registerMooseObject("MooseApp", ADGenericConstantRankTwoTensor); 14 : 15 : template <bool is_ad> 16 : InputParameters 17 28734 : GenericConstantRankTwoTensorTempl<is_ad>::validParams() 18 : { 19 28734 : InputParameters params = Material::validParams(); 20 28734 : params.addClassDescription( 21 : "Object for declaring a constant rank two tensor as a material property."); 22 28734 : params.addRequiredParam<std::vector<Real>>( 23 : "tensor_values", "Vector of values defining the constant rank two tensor"); 24 28734 : params.addRequiredParam<MaterialPropertyName>( 25 : "tensor_name", "Name of the tensor material property to be created"); 26 28734 : params.set<MooseEnum>("constant_on") = "SUBDOMAIN"; 27 28734 : return params; 28 0 : } 29 : 30 : template <bool is_ad> 31 156 : GenericConstantRankTwoTensorTempl<is_ad>::GenericConstantRankTwoTensorTempl( 32 : const InputParameters & parameters) 33 : : Material(parameters), 34 156 : _prop( 35 156 : declareGenericProperty<RankTwoTensor, is_ad>(getParam<MaterialPropertyName>("tensor_name"))) 36 : { 37 156 : _tensor.fillFromInputVector(getParam<std::vector<Real>>("tensor_values")); 38 156 : } 39 : 40 : template <bool is_ad> 41 : void 42 640000 : GenericConstantRankTwoTensorTempl<is_ad>::initQpStatefulProperties() 43 : { 44 640000 : GenericConstantRankTwoTensorTempl<is_ad>::computeQpProperties(); 45 640000 : } 46 : 47 : template <bool is_ad> 48 : void 49 640520 : GenericConstantRankTwoTensorTempl<is_ad>::computeQpProperties() 50 : { 51 640520 : _prop[_qp] = _tensor; 52 640520 : } 53 : 54 : template class GenericConstantRankTwoTensorTempl<false>; 55 : template class GenericConstantRankTwoTensorTempl<true>;