LCOV - code coverage report
Current view: top level - src/kokkos/postprocessors - KokkosIntegralPostprocessor.K (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 18 19 94.7 %
Date: 2026-05-29 20:35:17 Functions: 10 10 100.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.14