Skip to content

Commit 6708c6d

Browse files
committed
Replace MapBasedDisconnectedGhosting with DisconnectedNeighborCoupling
This commit removes the `map_based_disconnected_ghosting` implementation and fully migrates the build/runtime logic to `disconnected_neighbor_coupling`. - Remove map_based_disconnected_ghosting.{h,C} and all associated build rules - Add disconnected_neighbor_coupling.{h,C} into all Makefile targets - Drop ghosting implementation in UnstructuredMesh::find_neighbors() - Update tests to use `DisconnectedNeighborCoupling` directly - Enable fine-mesh test (testTempJumpRefine)
1 parent 9f54211 commit 6708c6d

13 files changed

+340
-206
lines changed

Makefile.in

Lines changed: 61 additions & 61 deletions
Large diffs are not rendered by default.

include/Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ include_HEADERS = \
780780
geom/surface.h \
781781
ghosting/default_coupling.h \
782782
ghosting/ghost_point_neighbors.h \
783-
ghosting/map_based_disconnected_ghosting.h \
783+
ghosting/disconnected_neighbor_coupling.h \
784784
ghosting/ghosting_functor.h \
785785
ghosting/non_manifold_coupling.h \
786786
ghosting/overlap_coupling.h \
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#ifndef LIBMESH_DISCONNECTED_NEIGHBOR_COUPLING_H
2+
#define LIBMESH_DISCONNECTED_NEIGHBOR_COUPLING_H
3+
4+
#include "libmesh/ghosting_functor.h"
5+
#include "libmesh/boundary_info.h"
6+
7+
#include <memory>
8+
9+
namespace libMesh
10+
{
11+
12+
class Elem;
13+
class PointLocatorBase;
14+
15+
/**
16+
* Ghosts elements that lie on
17+
* user-defined disconnected interfaces,
18+
* such as cohesive zone boundaries.
19+
*/
20+
class DisconnectedNeighborCoupling : public GhostingFunctor
21+
{
22+
public:
23+
using DisconnectedMap = std::unordered_map<const Elem *, const Elem *>;
24+
25+
DisconnectedNeighborCoupling(const MeshBase & mesh) :
26+
GhostingFunctor(mesh),
27+
_dof_coupling(nullptr)
28+
{}
29+
30+
virtual std::unique_ptr<GhostingFunctor> clone () const override
31+
{ return std::make_unique<DisconnectedNeighborCoupling>(*this); }
32+
33+
virtual void operator() (const MeshBase::const_element_iterator & range_begin,
34+
const MeshBase::const_element_iterator & range_end,
35+
processor_id_type p,
36+
map_type & coupled_elements) override;
37+
38+
private:
39+
const CouplingMatrix * _dof_coupling;
40+
};
41+
42+
} // namespace libMesh
43+
44+
#endif // LIBMESH_DISCONNECTED_NEIGHBOR_COUPLING_H

include/ghosting/map_based_disconnected_ghosting.h

Lines changed: 0 additions & 63 deletions
This file was deleted.

include/include_HEADERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ include_HEADERS = \
176176
geom/surface.h \
177177
ghosting/default_coupling.h \
178178
ghosting/ghost_point_neighbors.h \
179-
ghosting/map_based_disconnected_ghosting.h \
179+
ghosting/disconnected_neighbor_coupling.h \
180180
ghosting/ghosting_functor.h \
181181
ghosting/non_manifold_coupling.h \
182182
ghosting/overlap_coupling.h \

include/libmesh/Makefile.am

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ BUILT_SOURCES = \
166166
surface.h \
167167
default_coupling.h \
168168
ghost_point_neighbors.h \
169-
map_based_disconnected_ghosting.h \
169+
disconnected_neighbor_coupling.h \
170170
ghosting_functor.h \
171171
non_manifold_coupling.h \
172172
overlap_coupling.h \
@@ -1098,7 +1098,7 @@ default_coupling.h: $(top_srcdir)/include/ghosting/default_coupling.h
10981098
ghost_point_neighbors.h: $(top_srcdir)/include/ghosting/ghost_point_neighbors.h
10991099
$(AM_V_GEN)rm -f $@ && $(LN_S) -f $< $@
11001100

1101-
map_based_disconnected_ghosting.h: $(top_srcdir)/include/ghosting/map_based_disconnected_ghosting.h
1101+
disconnected_neighbor_coupling.h: $(top_srcdir)/include/ghosting/disconnected_neighbor_coupling.h
11021102
$(AM_V_GEN)rm -f $@ && $(LN_S) -f $< $@
11031103

11041104
ghosting_functor.h: $(top_srcdir)/include/ghosting/ghosting_functor.h

include/libmesh/Makefile.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ BUILT_SOURCES = dirichlet_boundaries.h dof_map.h dof_map_base.h \
576576
node_elem.h node_range.h plane.h point.h reference_elem.h \
577577
remote_elem.h sphere.h stored_range.h surface.h \
578578
default_coupling.h ghost_point_neighbors.h \
579-
map_based_disconnected_ghosting.h ghosting_functor.h \
579+
disconnected_neighbor_coupling.h ghosting_functor.h \
580580
non_manifold_coupling.h overlap_coupling.h \
581581
point_neighbor_coupling.h sibling_coupling.h abaqus_io.h \
582582
boundary_info.h boundary_mesh.h checkpoint_io.h \
@@ -1432,7 +1432,7 @@ default_coupling.h: $(top_srcdir)/include/ghosting/default_coupling.h
14321432
ghost_point_neighbors.h: $(top_srcdir)/include/ghosting/ghost_point_neighbors.h
14331433
$(AM_V_GEN)rm -f $@ && $(LN_S) -f $< $@
14341434

1435-
map_based_disconnected_ghosting.h: $(top_srcdir)/include/ghosting/map_based_disconnected_ghosting.h
1435+
disconnected_neighbor_coupling.h: $(top_srcdir)/include/ghosting/disconnected_neighbor_coupling.h
14361436
$(AM_V_GEN)rm -f $@ && $(LN_S) -f $< $@
14371437

14381438
ghosting_functor.h: $(top_srcdir)/include/ghosting/ghosting_functor.h
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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+
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+
libmesh_assert(_mesh);
18+
auto * db = _mesh->get_disconnected_boundaries();
19+
if (!db)
20+
return;
21+
22+
std::unique_ptr<PointLocatorBase> point_locator = _mesh->sub_point_locator();
23+
24+
// Primary ghosting: elements in range_begin...range_end
25+
for (const auto & elem : as_range(range_begin, range_end))
26+
if (elem->processor_id() != p)
27+
coupled_elements.emplace(elem, _dof_coupling);
28+
29+
// Also ghost their disconnected neighbors
30+
for (const auto & elem : as_range(range_begin, range_end))
31+
for (auto s : elem->side_index_range())
32+
{
33+
for (const auto & [id, boundary_ptr] : *db)
34+
{
35+
if (!_mesh->get_boundary_info().has_boundary_id(elem, s, id))
36+
continue;
37+
38+
unsigned int neigh_side = invalid_uint;
39+
const Elem * neigh =
40+
db->neighbor(id, *point_locator, elem, s, &neigh_side);
41+
42+
if (!neigh || neigh == remote_elem)
43+
continue;
44+
45+
if (neigh->processor_id() != p)
46+
coupled_elements.emplace(neigh, _dof_coupling);
47+
}
48+
}
49+
}
50+
51+
52+
} // namespace libMesh

src/ghosting/map_based_disconnected_ghosting.C

Lines changed: 0 additions & 59 deletions
This file was deleted.

src/libmesh_SOURCES

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ libmesh_SOURCES = \
193193
src/geom/surface.C \
194194
src/ghosting/default_coupling.C \
195195
src/ghosting/ghost_point_neighbors.C \
196-
src/ghosting/map_based_disconnected_ghosting.C \
196+
src/ghosting/disconnected_neighbor_coupling.C \
197197
src/ghosting/non_manifold_coupling.C \
198198
src/ghosting/overlap_coupling.C \
199199
src/ghosting/point_neighbor_coupling.C \

0 commit comments

Comments
 (0)