LCOV - code coverage report
Current view: top level - src/ghosting - disconnected_neighbor_coupling.C (source / functions) Hit Total Coverage
Test: libMesh/libmesh: #4283 (f95625) with base 739e36 Lines: 19 22 86.4 %
Date: 2025-10-30 15:32:02 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : #include "libmesh/disconnected_neighbor_coupling.h"
       2             : #include "libmesh/elem.h"
       3             : #include "libmesh/mesh_base.h"
       4             : #include "libmesh/point_locator_base.h"
       5             : #include "libmesh/remote_elem.h"
       6             : #include "libmesh/periodic_boundaries.h"
       7             : 
       8             : namespace libMesh
       9             : {
      10             : 
      11         384 : void DisconnectedNeighborCoupling::operator()(
      12             :     const MeshBase::const_element_iterator & range_begin,
      13             :     const MeshBase::const_element_iterator & range_end,
      14             :     processor_id_type p,
      15             :     map_type & coupled_elements)
      16             : {
      17           0 :   libmesh_assert(_mesh);
      18         384 :   auto * db = _mesh->get_disconnected_boundaries();
      19         384 :   if (!db)
      20           0 :     return;
      21             : 
      22         384 :   std::unique_ptr<PointLocatorBase> point_locator = _mesh->sub_point_locator();
      23             : 
      24             :   // Primary ghosting: elements in range_begin...range_end
      25        1952 :   for (const auto & elem : as_range(range_begin, range_end))
      26         592 :     if (elem->processor_id() != p)
      27         384 :       coupled_elements.emplace(elem, _dof_coupling);
      28             : 
      29             :   // Also ghost their disconnected neighbors
      30        1952 :   for (const auto & elem : as_range(range_begin, range_end))
      31        2960 :     for (auto s : elem->side_index_range())
      32             :     {
      33        7104 :       for (const auto & [id, boundary_ptr] : *db)
      34             :       {
      35        4736 :         if (!_mesh->get_boundary_info().has_boundary_id(elem, s, id))
      36        4528 :           continue;
      37             : 
      38         208 :         unsigned int neigh_side = invalid_uint;
      39             :         const Elem * neigh =
      40         208 :             db->neighbor(id, *point_locator, elem, s, &neigh_side);
      41             : 
      42         208 :         if (!neigh || neigh == remote_elem)
      43           0 :           continue;
      44             : 
      45         208 :         if (neigh->processor_id() != p)
      46         130 :           coupled_elements.emplace(neigh, _dof_coupling);
      47             :       }
      48         384 :     }
      49         384 : }
      50             : 
      51             : 
      52             : } // namespace libMesh

Generated by: LCOV version 1.14