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 : #pragma once 11 : 12 : #include "MOOSEToNEML2Batched.h" 13 : 14 : #include "RankTwoTensor.h" 15 : #include "SymmetricRankTwoTensor.h" 16 : 17 : /** 18 : * Gather a MOOSE material property for insertion into the NEML2 model. 19 : */ 20 : template <typename T, unsigned int state> 21 : class MOOSEMaterialPropertyToNEML2 : public MOOSEToNEML2Batched<T> 22 : { 23 : public: 24 : static InputParameters validParams(); 25 : 26 : MOOSEMaterialPropertyToNEML2(const InputParameters & params); 27 : 28 : #ifdef NEML2_ENABLED 29 : protected: 30 4200 : const MooseArray<T> & elemMOOSEData() const override { return _mat_prop.get(); } 31 : 32 : /// MOOSE material property to read data from 33 : const MaterialProperty<T> & _mat_prop; 34 : #endif 35 : }; 36 : 37 : #define DefineMOOSEMaterialPropertyToNEML2Alias(T, alias) \ 38 : using MOOSE##alias##MaterialPropertyToNEML2 = MOOSEMaterialPropertyToNEML2<T, 0>; \ 39 : using MOOSEOld##alias##MaterialPropertyToNEML2 = MOOSEMaterialPropertyToNEML2<T, 1> 40 : 41 : DefineMOOSEMaterialPropertyToNEML2Alias(Real, Real); 42 : DefineMOOSEMaterialPropertyToNEML2Alias(RankTwoTensor, RankTwoTensor); 43 : DefineMOOSEMaterialPropertyToNEML2Alias(SymmetricRankTwoTensor, SymmetricRankTwoTensor); 44 : DefineMOOSEMaterialPropertyToNEML2Alias(RealVectorValue, RealVectorValue);