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 "KokkosElementIntegralPostprocessor.h" 13 : 14 : template <typename Base> 15 : class KokkosIntegralMaterialProperty : public Base 16 : { 17 : public: 18 : static InputParameters validParams(); 19 : 20 : KokkosIntegralMaterialProperty(const InputParameters & parameters); 21 : 22 : KOKKOS_FUNCTION Real computeQpIntegral(const unsigned int qp, Datum & datum) const; 23 : 24 : protected: 25 : const Moose::Kokkos::MaterialProperty<Real> _scalar; 26 : }; 27 : 28 : template <typename Base> 29 : InputParameters 30 8562 : KokkosIntegralMaterialProperty<Base>::validParams() 31 : { 32 8562 : InputParameters params = Base::validParams(); 33 34248 : params.addRequiredParam<MaterialPropertyName>("mat_prop", "The name of the material property"); 34 8562 : params.addClassDescription("Compute the integral of the material property over the domain"); 35 8562 : return params; 36 0 : } 37 : 38 : template <typename Base> 39 85 : KokkosIntegralMaterialProperty<Base>::KokkosIntegralMaterialProperty( 40 80 : const InputParameters & parameters) 41 90 : : Base(parameters), _scalar(Base::template getKokkosMaterialProperty<Real>("mat_prop")) 42 : { 43 85 : } 44 : 45 : template <typename Base> 46 : KOKKOS_FUNCTION Real 47 9976 : KokkosIntegralMaterialProperty<Base>::computeQpIntegral(const unsigned int qp, Datum & datum) const 48 : { 49 9976 : return _scalar(datum, qp); 50 : } 51 : 52 : typedef KokkosIntegralMaterialProperty<KokkosElementIntegralPostprocessor> 53 : KokkosElementIntegralMaterialProperty;