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 "MOOSEMaterialPropertyToNEML2.h" 11 : 12 : #define registerMOOSEMaterialPropertyToNEML2(alias) \ 13 : registerMooseObject("MooseApp", MOOSE##alias##MaterialPropertyToNEML2); \ 14 : registerMooseObject("MooseApp", MOOSEOld##alias##MaterialPropertyToNEML2) 15 : 16 : registerMOOSEMaterialPropertyToNEML2(Real); 17 : registerMOOSEMaterialPropertyToNEML2(RankTwoTensor); 18 : registerMOOSEMaterialPropertyToNEML2(SymmetricRankTwoTensor); 19 : registerMOOSEMaterialPropertyToNEML2(RealVectorValue); 20 : 21 : template <typename T, unsigned int state> 22 : InputParameters 23 114148 : MOOSEMaterialPropertyToNEML2<T, state>::validParams() 24 : { 25 114148 : auto params = MOOSEToNEML2Batched<T>::validParams(); 26 114148 : params.addClassDescription(NEML2Utils::docstring( 27 : "Gather a MOOSE material property of type " + demangle(typeid(T).name()) + 28 : " for insertion into the specified input or model parameter of a NEML2 model.")); 29 114148 : params.template addRequiredParam<MaterialPropertyName>( 30 : "from_moose", NEML2Utils::docstring("MOOSE material property to read from")); 31 114148 : return params; 32 0 : } 33 : 34 : template <typename T, unsigned int state> 35 14 : MOOSEMaterialPropertyToNEML2<T, state>::MOOSEMaterialPropertyToNEML2(const InputParameters & params) 36 0 : : MOOSEToNEML2Batched<T>(params) 37 : #ifdef NEML2_ENABLED 38 : , 39 14 : _mat_prop(this->template getGenericMaterialProperty<T, false>("from_moose", state)) 40 : #endif 41 : { 42 14 : } 43 : 44 : #define instantiateMOOSEMaterialPropertyToNEML2(T) \ 45 : template class MOOSEMaterialPropertyToNEML2<T, 0>; \ 46 : template class MOOSEMaterialPropertyToNEML2<T, 1> 47 : 48 : instantiateMOOSEMaterialPropertyToNEML2(Real); 49 : instantiateMOOSEMaterialPropertyToNEML2(RankTwoTensor); 50 : instantiateMOOSEMaterialPropertyToNEML2(SymmetricRankTwoTensor); 51 : instantiateMOOSEMaterialPropertyToNEML2(RealVectorValue);