LCOV - code coverage report
Current view: top level - src/kokkos/interfaces - KokkosBlockRestrictable.K (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #31730 (e8b711) with base e0c998 Lines: 32 39 82.1 %
Date: 2025-10-29 16:49:47 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      154224 : BlockRestrictable::BlockRestrictable(const BlockRestrictable & object,
      14      126759 :                                      const Moose::Kokkos::FunctorCopy &)
      15      126759 :   : _blk_dual_restrictable(object._blk_dual_restrictable),
      16      126759 :     _blk_feproblem(object._blk_feproblem),
      17      126759 :     _blk_mesh(object._blk_mesh),
      18      126759 :     _boundary_ids(object._boundary_ids),
      19      126759 :     _blk_tid(object._blk_tid),
      20      126759 :     _blk_name(object._blk_name),
      21      126759 :     _blk_dim(object._blk_dim),
      22      126759 :     _moose_object(object._moose_object)
      23             : {
      24      154224 :   _kokkos_element_ids = object._kokkos_element_ids;
      25      154224 :   _kokkos_node_ids = object._kokkos_node_ids;
      26      154224 :   _kokkos_element_side_ids = object._kokkos_element_side_ids;
      27      154224 : }
      28             : 
      29             : void
      30        2839 : BlockRestrictable::initializeKokkosBlockRestrictable(const Moose::Kokkos::Mesh * mesh)
      31             : {
      32        8517 :   if (_moose_object->isParamValid("_kokkos_material"))
      33         952 :     return;
      34             : 
      35        1887 :   auto & blocks = blockRestricted() ? blockIDs() : meshBlockIDs();
      36             : 
      37        1887 :   std::set<ContiguousElementID> element_ids;
      38        1887 :   std::set<ContiguousNodeID> node_ids;
      39             : 
      40        3834 :   for (auto block : blocks)
      41             :   {
      42        1947 :     element_ids.insert(mesh->getSubdomainContiguousElementIDs(block).begin(),
      43        1482 :                        mesh->getSubdomainContiguousElementIDs(block).end());
      44        1947 :     node_ids.insert(mesh->getSubdomainContiguousNodeIDs(block).begin(),
      45        1482 :                     mesh->getSubdomainContiguousNodeIDs(block).end());
      46             :   }
      47             : 
      48        1887 :   _kokkos_element_ids = element_ids;
      49        1887 :   _kokkos_node_ids = node_ids;
      50             : 
      51        5661 :   if (_moose_object->isParamValid("_material_data_type") &&
      52        1438 :       _moose_object->getParam<Moose::MaterialDataType>("_material_data_type") !=
      53        2876 :           Moose::BLOCK_MATERIAL_DATA &&
      54        1438 :       _moose_object->getParam<Moose::MaterialDataType>("_material_data_type") !=
      55             :           Moose::BOUNDARY_MATERIAL_DATA)
      56             :   {
      57           0 :     std::set<Moose::Kokkos::Pair<ContiguousElementID, unsigned int>> element_side_ids;
      58             : 
      59           0 :     for (const auto eid : element_ids)
      60             :     {
      61           0 :       auto type = mesh->getElementInfo(eid).type;
      62             : 
      63           0 :       for (unsigned int side = 0; side < mesh->getNumSides(type); ++side)
      64           0 :         element_side_ids.insert({eid, side});
      65             :     }
      66             : 
      67           0 :     _kokkos_element_side_ids = element_side_ids;
      68           0 :   }
      69        1887 : }

Generated by: LCOV version 1.14