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 : #include "KokkosSideIntegralPostprocessor.h" 14 : 15 : template <typename Base> 16 : class KokkosIntegralVariablePostprocessor : public Base, public MooseVariableInterface<Real> 17 : { 18 : public: 19 : static InputParameters validParams(); 20 : 21 : KokkosIntegralVariablePostprocessor(const InputParameters & parameters); 22 : 23 : KOKKOS_FUNCTION Real computeQpIntegral(const unsigned int qp, Datum & datum) const; 24 : 25 : protected: 26 : /// Holds the solution at current quadrature points 27 : Moose::Kokkos::VariableValue _u; 28 : /// Holds the solution gradient at the current quadrature points 29 : Moose::Kokkos::VariableGradient _grad_u; 30 : /// Option to use absolute variable value 31 : const bool _use_abs_value; 32 : }; 33 : 34 : template <typename Base> 35 : KOKKOS_FUNCTION inline Real 36 156148 : KokkosIntegralVariablePostprocessor<Base>::computeQpIntegral(const unsigned int qp, 37 : Datum & datum) const 38 : { 39 156148 : if (_use_abs_value) 40 96 : return Kokkos::abs(_u(datum, qp)); 41 : else 42 156052 : return _u(datum, qp); 43 : } 44 : 45 : typedef KokkosIntegralVariablePostprocessor<KokkosElementIntegralPostprocessor> 46 : KokkosElementIntegralVariablePostprocessor; 47 : typedef KokkosIntegralVariablePostprocessor<KokkosSideIntegralPostprocessor> 48 : KokkosSideIntegralVariablePostprocessor;