LCOV - code coverage report
Current view: top level - src/kokkos/postprocessors - KokkosNodalMaxValueId.K (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 24 25 96.0 %
Date: 2026-05-29 20:35:17 Functions: 6 6 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 "KokkosNodalMaxValueId.h"
      11             : 
      12      363195 : registerKokkosUserObject("MooseApp", KokkosNodalMaxValueId);
      13             : 
      14             : InputParameters
      15        2132 : KokkosNodalMaxValueId::validParams()
      16             : {
      17        2132 :   InputParameters params = KokkosNodalVariablePostprocessor::validParams();
      18        2132 :   params.addClassDescription(
      19             :       "Finds the node ID with the maximum nodal value across all postprocessors.");
      20        2132 :   return params;
      21           0 : }
      22             : 
      23          17 : KokkosNodalMaxValueId::KokkosNodalMaxValueId(const InputParameters & parameters)
      24           9 :   : KokkosNodalVariablePostprocessor(parameters)
      25             : {
      26          17 : }
      27             : 
      28             : void
      29          91 : KokkosNodalMaxValueId::initialize()
      30             : {
      31          91 :   allocateReductionBuffer(2);
      32          91 : }
      33             : 
      34             : void
      35          91 : KokkosNodalMaxValueId::finalize()
      36             : {
      37          91 :   Real proxy = _reduction_buffer(0);
      38         182 :   auto value = std::make_pair<dof_id_type, processor_id_type>(_reduction_buffer(1), processor_id());
      39             : 
      40          91 :   gatherProxyValueMax(proxy, value);
      41             : 
      42          91 :   if (processor_id() == value.second)
      43        9193 :     for (const auto node : kokkosMesh().getLocalNodes())
      44        9193 :       if (kokkosMesh().getContiguousNodeID(node) == value.first)
      45             :       {
      46          67 :         _node_id = node->id();
      47          67 :         break;
      48             :       }
      49             : 
      50          91 :   comm().broadcast(_node_id, value.second);
      51          91 : }
      52             : 
      53             : Real
      54          91 : KokkosNodalMaxValueId::getValue() const
      55             : {
      56          91 :   return _node_id;
      57             : }

Generated by: LCOV version 1.14