LCOV - code coverage report
Current view: top level - include/kokkos/userobjects - KokkosElementReducer.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 6 6 100.0 %
Date: 2026-05-29 20:35:17 Functions: 9 10 90.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 "KokkosReducerBase.h"
      13             : 
      14             : #include "BlockRestrictable.h"
      15             : 
      16             : namespace Moose::Kokkos
      17             : {
      18             : 
      19             : class ElementReducer : public ReducerBase, public ::BlockRestrictable
      20             : {
      21             : public:
      22             :   static InputParameters validParams();
      23             : 
      24             :   ElementReducer(const MooseObject * object);
      25             : 
      26             :   /**
      27             :    * Copy constructor for parallel dispatch
      28             :    */
      29             :   ElementReducer(const ElementReducer & object);
      30             : 
      31        1283 :   virtual ThreadID numReducerThreads() const override { return numKokkosBlockElements(); }
      32             : 
      33             :   /**
      34             :    * The parallel computation entry function called by Kokkos
      35             :    */
      36             :   template <typename Derived>
      37             :   KOKKOS_FUNCTION void
      38             :   operator()(ReducerLoop, const ThreadID tid, const Derived & reducer, Real * result) const;
      39             : };
      40             : 
      41             : template <typename Derived>
      42             : KOKKOS_FUNCTION void
      43      228367 : ElementReducer::operator()(ReducerLoop,
      44             :                            const ThreadID tid,
      45             :                            const Derived & reducer,
      46             :                            Real * result) const
      47             : {
      48      228367 :   auto elem = kokkosBlockElementID(tid);
      49             : 
      50      228367 :   Datum datum(elem, libMesh::invalid_uint, kokkosAssembly(), kokkosSystems());
      51             : 
      52      228367 :   reducer.template reduce<Derived>(datum, result);
      53      228367 : }
      54             : 
      55             : } // namespace Moose::Kokkos

Generated by: LCOV version 1.14