LCOV - code coverage report
Current view: top level - src/kokkos/interfaces - KokkosBoundaryRestrictable.K (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #31730 (e8b711) with base e0c998 Lines: 37 37 100.0 %
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 "KokkosMaterialBase.h"
      11             : 
      12             : #include "BoundaryRestrictable.h"
      13             : 
      14             : #include "MooseMesh.h"
      15             : 
      16      159395 : BoundaryRestrictable::BoundaryRestrictable(const BoundaryRestrictable & object,
      17      130979 :                                            const Moose::Kokkos::FunctorCopy &)
      18      130979 :   : _bnd_feproblem(object._bnd_feproblem),
      19      130979 :     _bnd_mesh(object._bnd_mesh),
      20      130979 :     _bnd_dual_restrictable(object._bnd_dual_restrictable),
      21      130979 :     _block_ids(object._block_ids),
      22      130979 :     _bnd_tid(object._bnd_tid),
      23      130979 :     _bnd_material_data(object._bnd_material_data),
      24      130979 :     _bnd_nodal(object._bnd_nodal),
      25      130979 :     _moose_object(object._moose_object)
      26             : {
      27      159395 :   _kokkos_node_ids = object._kokkos_node_ids;
      28      159395 :   _kokkos_element_side_ids = object._kokkos_element_side_ids;
      29      159395 : }
      30             : 
      31             : void
      32        2930 : BoundaryRestrictable::initializeKokkosBoundaryRestrictable(MooseMesh * mesh)
      33             : {
      34        8790 :   if (_moose_object.isParamValid("_kokkos_material"))
      35         952 :     return;
      36             : 
      37        1978 :   auto & boundaries = boundaryRestricted() ? boundaryIDs() : meshBoundaryIDs();
      38             : 
      39        1978 :   auto kokkos_mesh = mesh->getKokkosMesh();
      40             : 
      41        1978 :   if (_bnd_nodal)
      42             :   {
      43        1653 :     std::set<ContiguousNodeID> node_ids;
      44             : 
      45        4124 :     for (auto boundary : boundaries)
      46        8790 :       for (const auto node : as_range(mesh->getMesh().bid_nodes_begin(boundary),
      47       18404 :                                       mesh->getMesh().bid_nodes_end(boundary)))
      48       17347 :         if (node->processor_id() == _moose_object.processor_id())
      49       17438 :           node_ids.insert(kokkos_mesh->getContiguousNodeID(node));
      50             : 
      51        1653 :     _kokkos_node_ids = node_ids;
      52        1653 :   }
      53             :   else
      54             :   {
      55         325 :     std::set<Moose::Kokkos::Pair<ContiguousElementID, unsigned int>> element_side_ids;
      56             : 
      57         950 :     for (auto boundary : boundaries)
      58        7521 :       for (auto elem_id : mesh->getBoundaryActiveSemiLocalElemIds(boundary))
      59             :       {
      60        6896 :         const auto elem = mesh->elemPtr(elem_id);
      61             : 
      62        6896 :         if (elem->processor_id() == _moose_object.processor_id())
      63        9994 :           element_side_ids.insert({kokkos_mesh->getContiguousElementID(elem),
      64        4159 :                                    mesh->sideWithBoundaryID(elem, boundary)});
      65         625 :       }
      66             : 
      67         325 :     _kokkos_element_side_ids = element_side_ids;
      68         325 :   }
      69             : }

Generated by: LCOV version 1.14