LCOV - code coverage report
Current view: top level - src/kokkos/interfaces - KokkosBlockRestrictable.K (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #33416 (b10b36) with base 9fbd27 Lines: 42 42 100.0 %
Date: 2026-07-23 16:15:30 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://www.mooseframework.org
       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 "BlockRestrictable.h"
      11             : #include "MooseMesh.h"
      12             : 
      13      319961 : BlockRestrictable::BlockRestrictable(const BlockRestrictable & object,
      14      182829 :                                      const Moose::Kokkos::FunctorCopy &)
      15      182829 :   : _blk_dual_restrictable(object._blk_dual_restrictable),
      16      182829 :     _blk_feproblem(object._blk_feproblem),
      17      182829 :     _blk_mesh(object._blk_mesh),
      18      182829 :     _boundary_ids(object._boundary_ids),
      19      182829 :     _blk_tid(object._blk_tid),
      20      182829 :     _blk_name(object._blk_name),
      21      182829 :     _blk_dim(object._blk_dim),
      22      182829 :     _moose_object(object._moose_object)
      23             : {
      24      319961 :   _kokkos_element_ids = object._kokkos_element_ids;
      25      319961 :   _kokkos_node_ids = object._kokkos_node_ids;
      26      319961 :   _kokkos_element_side_ids = object._kokkos_element_side_ids;
      27      319961 : }
      28             : 
      29             : void
      30        8291 : BlockRestrictable::initializeKokkosBlockRestrictable()
      31             : {
      32       24873 :   if (_moose_object->isParamValid("_kokkos_material"))
      33        2744 :     return;
      34             : 
      35        5547 :   const auto & blocks = blockRestricted() ? blockIDs() : meshBlockIDs();
      36             : 
      37        5547 :   const auto * const kokkos_mesh = _blk_mesh->getKokkosMesh();
      38             : 
      39        5547 :   std::vector<ContiguousElementID> element_ids;
      40        5547 :   std::vector<ContiguousNodeID> node_ids;
      41        5547 :   std::set<Moose::Kokkos::Pair<ContiguousElementID, unsigned int>> element_side_ids;
      42             : 
      43       11989 :   for (const auto block : blocks)
      44             :   {
      45        9935 :     element_ids.insert(element_ids.end(),
      46        3493 :                        kokkos_mesh->getSubdomainContiguousElementIDRange(block).begin(),
      47        3493 :                        kokkos_mesh->getSubdomainContiguousElementIDRange(block).end());
      48        6442 :     node_ids.insert(node_ids.end(),
      49        3493 :                     kokkos_mesh->getSubdomainContiguousNodeIDs(block).begin(),
      50        3493 :                     kokkos_mesh->getSubdomainContiguousNodeIDs(block).end());
      51             : 
      52       19326 :     if (_moose_object->isParamValid("_kokkos_flux_kernel"))
      53       22618 :       for (const auto elem : _blk_mesh->getMesh().active_local_subdomain_elements_ptr_range(block))
      54             :       {
      55       22389 :         const auto eid = kokkos_mesh->getContiguousElementID(elem);
      56             : 
      57      105535 :         for (const auto side : make_range(elem->n_sides()))
      58       83146 :           element_side_ids.insert({eid, side});
      59         229 :       }
      60             :   }
      61             : 
      62        5547 :   _kokkos_element_ids = element_ids;
      63             : 
      64       20026 :   if (_moose_object->isParamValid("unique_node_execute") &&
      65        3415 :       !_moose_object->getParam<bool>("unique_node_execute"))
      66         204 :     _kokkos_node_ids = node_ids;
      67             :   else
      68        5343 :     _kokkos_node_ids = std::set<ContiguousNodeID>(node_ids.begin(), node_ids.end());
      69             : 
      70        5547 :   _kokkos_element_side_ids = element_side_ids;
      71        5547 : }

Generated by: LCOV version 1.14