Skip to content

Commit f75c3de

Browse files
committed
Build boundary node multimap (libMesh#3385)
1 parent 34ce67b commit f75c3de

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

src/mesh/mesh_tools.C

+26-1
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ MeshTools::find_block_boundary_nodes(const MeshBase & mesh)
537537
// mark them as true in on_boundary.
538538
for (const auto & elem : mesh.active_element_ptr_range())
539539
for (auto s : elem->side_index_range())
540-
if (elem->neighbor_ptr(s) && (elem->neighbor_ptr(s)->subdomain_id() != elem->subdomain_id()))
540+
if (elem->neighbor_ptr(s) && elem->neighbor_ptr(s)->subdomain_id() > elem->subdomain_id())
541541
{
542542
auto nodes_on_side = elem->nodes_on_side(s);
543543

@@ -549,6 +549,31 @@ MeshTools::find_block_boundary_nodes(const MeshBase & mesh)
549549
}
550550

551551

552+
std::multimap<dof_id_type, std::pair<subdomain_id_type, subdomain_id_type>>
553+
MeshTools::build_block_boundary_node_map(const MeshBase & mesh)
554+
{
555+
std::multimap<dof_id_type, std::pair<subdomain_id_type, subdomain_id_type>> block_boundary_node_map;
556+
557+
// Loop over elements, find those on boundary, and
558+
// mark them as true in on_boundary.
559+
for (const auto & elem : mesh.active_element_ptr_range())
560+
{
561+
const auto id1 = elem->subdomain_id();
562+
for (auto s : elem->side_index_range())
563+
{
564+
const auto id2 = elem->neighbor_ptr(s)->subdomain_id();
565+
if (elem->neighbor_ptr(s) && id2 > id1)
566+
{
567+
auto nodes_on_side = elem->nodes_on_side(s);
568+
569+
for (auto & local_id : nodes_on_side)
570+
block_boundary_node_map.emplace(elem->node_ptr(local_id)->id(), id1, id2);
571+
}
572+
}
573+
574+
return block_boundary_node_map;
575+
}
576+
552577

553578
libMesh::BoundingBox
554579
MeshTools::create_bounding_box (const MeshBase & mesh)

0 commit comments

Comments
 (0)