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 "KokkosIntegralPostprocessor.h" 11 : 12 : template <typename Base> 13 : InputParameters 14 20188 : KokkosIntegralPostprocessor<Base>::validParams() 15 : { 16 20188 : InputParameters params = Base::validParams(); 17 60564 : params.addParam<bool>("average", false, "Whether to compute volume average"); 18 20188 : return params; 19 0 : } 20 : 21 : template <typename Base> 22 758 : KokkosIntegralPostprocessor<Base>::KokkosIntegralPostprocessor(const InputParameters & parameters) 23 592 : : Base(parameters), _average(Base::template getParam<bool>("average")) 24 : { 25 527 : } 26 : 27 : template <typename Base> 28 : void 29 1200 : KokkosIntegralPostprocessor<Base>::initialize() 30 : { 31 1200 : Base::allocateReductionBuffer(_average ? 2 : 1); 32 1200 : } 33 : 34 : template <typename Base> 35 : Real 36 1200 : KokkosIntegralPostprocessor<Base>::getValue() const 37 : { 38 2720 : return _average ? Base::_reduction_buffer[0] / Base::_reduction_buffer[1] 39 1200 : : Base::_reduction_buffer[0]; 40 : } 41 : 42 : template <typename Base> 43 : void 44 1200 : KokkosIntegralPostprocessor<Base>::finalize() 45 : { 46 2400 : Base::gatherSum(Base::_reduction_buffer[0]); 47 : 48 1200 : if (_average) 49 1450 : Base::gatherSum(Base::_reduction_buffer[1]); 50 1200 : } 51 : 52 : template class KokkosIntegralPostprocessor<Moose::Kokkos::ElementPostprocessor>; 53 : template class KokkosIntegralPostprocessor<Moose::Kokkos::SidePostprocessor>;