LCOV - code coverage report
Current view: top level - include/kokkos/postprocessors - KokkosNodalSum.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 12 12 100.0 %
Date: 2026-05-29 20:35:17 Functions: 7 7 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             : #pragma once
      11             : 
      12             : #include "KokkosNodalVariablePostprocessor.h"
      13             : 
      14             : class KokkosNodalSum : public KokkosNodalVariablePostprocessor
      15             : {
      16             : public:
      17             :   static InputParameters validParams();
      18             : 
      19             :   KokkosNodalSum(const InputParameters & parameters);
      20             : 
      21             :   virtual void initialize() override;
      22             :   virtual void finalize() override;
      23             :   virtual Real getValue() const override;
      24             : 
      25             :   template <typename Derived>
      26             :   KOKKOS_FUNCTION void reduce(Datum & datum, Real * result) const;
      27             : 
      28         360 :   KOKKOS_FUNCTION Real computeValue(const unsigned int qp, Datum & datum) const
      29             :   {
      30         360 :     return _u(datum, qp);
      31             :   }
      32             : 
      33             :   template <typename Derived>
      34             :   KOKKOS_FUNCTION void join(Real * result, const Real * source) const;
      35             :   template <typename Derived>
      36             :   KOKKOS_FUNCTION void init(Real * result) const;
      37             : };
      38             : 
      39             : template <typename Derived>
      40             : KOKKOS_FUNCTION void
      41         468 : KokkosNodalSum::reduce(Datum & datum, Real * result) const
      42             : {
      43         468 :   if (datum.isNodalDefined(_u.variable()))
      44         468 :     result[0] += static_cast<const Derived *>(this)->computeValue(0, datum);
      45         468 : }
      46             : 
      47             : template <typename Derived>
      48             : KOKKOS_FUNCTION void
      49           8 : KokkosNodalSum::join(Real * result, const Real * source) const
      50             : {
      51           8 :   result[0] += source[0];
      52           8 : }
      53             : 
      54             : template <typename Derived>
      55             : KOKKOS_FUNCTION void
      56          72 : KokkosNodalSum::init(Real * result) const
      57             : {
      58          72 :   result[0] = 0;
      59          72 : }

Generated by: LCOV version 1.14