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 "MOOSEPostprocessorToNEML2.h" 11 : 12 : registerMooseObject("MooseApp", MOOSEPostprocessorToNEML2); 13 : registerMooseObject("MooseApp", MOOSEOldPostprocessorToNEML2); 14 : 15 : template <unsigned int state> 16 : InputParameters 17 28530 : MOOSEPostprocessorToNEML2Templ<state>::validParams() 18 : { 19 28530 : auto params = MOOSEToNEML2Unbatched::validParams(); 20 28530 : params.addClassDescription(NEML2Utils::docstring( 21 : "Gather a MOOSE postprocessor value for insertion into the specified input variable or " 22 : "model parameter of a NEML2 model.")); 23 28530 : params.addRequiredParam<PostprocessorName>( 24 : "from_moose", NEML2Utils::docstring("MOOSE postprocessor to read from")); 25 28530 : return params; 26 0 : } 27 : 28 : template <> 29 0 : MOOSEPostprocessorToNEML2Templ<0>::MOOSEPostprocessorToNEML2Templ(const InputParameters & params) 30 0 : : MOOSEToNEML2Unbatched(params) 31 : #ifdef NEML2_ENABLED 32 : , 33 0 : _moose_pp(getPostprocessorValue("from_moose")) 34 : #endif 35 : { 36 0 : } 37 : 38 : template <> 39 0 : MOOSEPostprocessorToNEML2Templ<1>::MOOSEPostprocessorToNEML2Templ(const InputParameters & params) 40 0 : : MOOSEToNEML2Unbatched(params) 41 : #ifdef NEML2_ENABLED 42 : , 43 0 : _moose_pp(getPostprocessorValueOld("from_moose")) 44 : #endif 45 : { 46 0 : } 47 : 48 : #ifdef NEML2_ENABLED 49 : template <unsigned int state> 50 : neml2::Tensor 51 0 : MOOSEPostprocessorToNEML2Templ<state>::gatheredData() const 52 : { 53 0 : return neml2::Scalar::full(_moose_pp, neml2::kFloat64); 54 : } 55 : #endif 56 : 57 : template class MOOSEPostprocessorToNEML2Templ<0>; 58 : template class MOOSEPostprocessorToNEML2Templ<1>;