LCOV - code coverage report
Current view: top level - src/kokkos/interfaces - KokkosBoundaryRestrictable.K (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #31653 (2d163b) with base 0cc44f Lines: 37 37 100.0 %
Date: 2025-11-04 20:38:02 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 "KokkosMaterialBase.h"
      11             : 
      12             : #include "BoundaryRestrictable.h"
      13             : 
      14             : #include "MooseMesh.h"
      15             : 
      16      181120 : BoundaryRestrictable::BoundaryRestrictable(const BoundaryRestrictable & object,
      17      152115 :                                            const Moose::Kokkos::FunctorCopy &)
      18      152115 :   : _bnd_feproblem(object._bnd_feproblem),
      19      152115 :     _bnd_mesh(object._bnd_mesh),
      20      152115 :     _bnd_dual_restrictable(object._bnd_dual_restrictable),
      21      152115 :     _block_ids(object._block_ids),
      22      152115 :     _bnd_tid(object._bnd_tid),
      23      152115 :     _bnd_material_data(object._bnd_material_data),
      24      152115 :     _bnd_nodal(object._bnd_nodal),
      25      152115 :     _moose_object(object._moose_object)
      26             : {
      27      181120 :   _kokkos_node_ids = object._kokkos_node_ids;
      28      181120 :   _kokkos_element_side_ids = object._kokkos_element_side_ids;
      29      181120 : }
      30             : 
      31             : void
      32        3102 : BoundaryRestrictable::initializeKokkosBoundaryRestrictable(MooseMesh * mesh)
      33             : {
      34        9306 :   if (_moose_object.isParamValid("_kokkos_material"))
      35         952 :     return;
      36             : 
      37        2150 :   auto & boundaries = boundaryRestricted() ? boundaryIDs() : meshBoundaryIDs();
      38             : 
      39        2150 :   auto kokkos_mesh = mesh->getKokkosMesh();
      40             : 
      41        2150 :   if (_bnd_nodal)
      42             :   {
      43        1757 :     std::set<ContiguousNodeID> node_ids;
      44             : 
      45        4440 :     for (auto boundary : boundaries)
      46        9244 :       for (const auto node : as_range(mesh->getMesh().bid_nodes_begin(boundary),
      47       21297 :                                       mesh->getMesh().bid_nodes_end(boundary)))
      48       19646 :         if (node->processor_id() == _moose_object.processor_id())
      49       19476 :           node_ids.insert(kokkos_mesh->getContiguousNodeID(node));
      50             : 
      51        1757 :     _kokkos_node_ids = node_ids;
      52        1757 :   }
      53             :   else
      54             :   {
      55         393 :     std::set<Moose::Kokkos::Pair<ContiguousElementID, unsigned int>> element_side_ids;
      56             : 
      57        1086 :     for (auto boundary : boundaries)
      58        8239 :       for (auto elem_id : mesh->getBoundaryActiveSemiLocalElemIds(boundary))
      59             :       {
      60        7546 :         const auto elem = mesh->elemPtr(elem_id);
      61             : 
      62        7546 :         if (elem->processor_id() == _moose_object.processor_id())
      63       11044 :           element_side_ids.insert({kokkos_mesh->getContiguousElementID(elem),
      64        4669 :                                    mesh->sideWithBoundaryID(elem, boundary)});
      65         693 :       }
      66             : 
      67         393 :     _kokkos_element_side_ids = element_side_ids;
      68         393 :   }
      69             : }

Generated by: LCOV version 1.14