LCOV - code coverage report
Current view: top level - src/kokkos/interfaces - KokkosBoundaryRestrictable.K (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 6f668f Lines: 37 37 100.0 %
Date: 2025-09-22 20:01:15 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      131332 : BoundaryRestrictable::BoundaryRestrictable(const BoundaryRestrictable & object,
      17      106932 :                                            const Moose::Kokkos::FunctorCopy &)
      18      106932 :   : _bnd_feproblem(object._bnd_feproblem),
      19      106932 :     _bnd_mesh(object._bnd_mesh),
      20      106932 :     _bnd_dual_restrictable(object._bnd_dual_restrictable),
      21      106932 :     _block_ids(object._block_ids),
      22      106932 :     _bnd_tid(object._bnd_tid),
      23      106932 :     _bnd_material_data(object._bnd_material_data),
      24      106932 :     _bnd_nodal(object._bnd_nodal),
      25      106932 :     _moose_object(object._moose_object)
      26             : {
      27      131332 :   _kokkos_node_ids = object._kokkos_node_ids;
      28      131332 :   _kokkos_element_side_ids = object._kokkos_element_side_ids;
      29      131332 : }
      30             : 
      31             : void
      32        2626 : BoundaryRestrictable::initializeKokkosBoundaryRestrictable(MooseMesh * mesh)
      33             : {
      34        7878 :   if (_moose_object.isParamValid("_kokkos_material"))
      35         952 :     return;
      36             : 
      37        1674 :   auto & boundaries = boundaryRestricted() ? boundaryIDs() : meshBoundaryIDs();
      38             : 
      39        1674 :   auto kokkos_mesh = mesh->getKokkosMesh();
      40             : 
      41        1674 :   if (_bnd_nodal)
      42             :   {
      43        1473 :     std::set<ContiguousNodeID> node_ids;
      44             : 
      45        3332 :     for (auto boundary : boundaries)
      46        6300 :       for (const auto node : as_range(mesh->getMesh().bid_nodes_begin(boundary),
      47       13109 :                                       mesh->getMesh().bid_nodes_end(boundary)))
      48       11866 :         if (node->processor_id() == _moose_object.processor_id())
      49       12312 :           node_ids.insert(kokkos_mesh->getContiguousNodeID(node));
      50             : 
      51        1473 :     _kokkos_node_ids = node_ids;
      52        1473 :   }
      53             :   else
      54             :   {
      55         201 :     std::set<Moose::Kokkos::Pair<ContiguousElementID, unsigned int>> element_side_ids;
      56             : 
      57         402 :     for (auto boundary : boundaries)
      58        1531 :       for (auto elem_id : mesh->getBoundaryActiveSemiLocalElemIds(boundary))
      59             :       {
      60        1330 :         const auto elem = mesh->elemPtr(elem_id);
      61             : 
      62        1330 :         if (elem->processor_id() == _moose_object.processor_id())
      63        2058 :           element_side_ids.insert({kokkos_mesh->getContiguousElementID(elem),
      64         863 :                                    mesh->sideWithBoundaryID(elem, boundary)});
      65         201 :       }
      66             : 
      67         201 :     _kokkos_element_side_ids = element_side_ids;
      68         201 :   }
      69             : }

Generated by: LCOV version 1.14