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 "KokkosKernel.h" 13 : 14 : class KokkosBodyForce : public Moose::Kokkos::Kernel 15 : { 16 : public: 17 : static InputParameters validParams(); 18 : 19 : KokkosBodyForce(const InputParameters & parameters); 20 : 21 : KOKKOS_FUNCTION Real computeQpResidual(const unsigned int i, 22 : const unsigned int qp, 23 : ResidualDatum & datum) const; 24 : 25 : protected: 26 : /// Scale factor 27 : const Moose::Kokkos::Scalar<const Real> _scale; 28 : 29 : /// Optional Postprocessor value 30 : const Moose::Kokkos::PostprocessorValue _postprocessor; 31 : }; 32 : 33 : KOKKOS_FUNCTION inline Real 34 580880 : KokkosBodyForce::computeQpResidual(const unsigned int i, 35 : const unsigned int qp, 36 : ResidualDatum & datum) const 37 : { 38 580880 : return -_test(datum, i, qp) * _scale * _postprocessor; 39 : }