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 "KokkosElementStatistics.h" 13 : 14 : class KokkosElementVariableStatistics : public KokkosElementStatistics 15 : { 16 : public: 17 : static InputParameters validParams(); 18 : 19 : KokkosElementVariableStatistics(const InputParameters & parameters); 20 : 21 : KOKKOS_FUNCTION Kokkos::pair<Real, Real> computeValue(Datum & datum) const; 22 : 23 : protected: 24 : /// The coupled variable used. 25 : const Moose::Kokkos::VariableValue _v; 26 : }; 27 : 28 : KOKKOS_FUNCTION inline Kokkos::pair<Real, Real> 29 600 : KokkosElementVariableStatistics::computeValue(Datum & datum) const 30 : { 31 600 : Real val = 0; 32 600 : Real vol = 0; 33 : 34 3000 : for (unsigned int qp = 0; qp < datum.n_qps(); ++qp) 35 : { 36 2400 : val += _v(datum, qp) * datum.JxW(qp); 37 2400 : vol += datum.JxW(qp); 38 : } 39 : 40 600 : val /= vol; 41 : 42 600 : return {val, vol}; 43 : }