Skip to content

Commit

Permalink
Build boundary node multimap (#3385)
Browse files Browse the repository at this point in the history
  • Loading branch information
dschwen committed Sep 13, 2022
1 parent beee9d4 commit fd2b4f7
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion src/mesh/mesh_tools.C
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ MeshTools::find_block_boundary_nodes(const MeshBase & mesh)
// mark them as true in on_boundary.
for (const auto & elem : mesh.active_element_ptr_range())
for (auto s : elem->side_index_range())
if (elem->neighbor_ptr(s) && (elem->neighbor_ptr(s)->subdomain_id() != elem->subdomain_id()))
if (elem->neighbor_ptr(s) && elem->neighbor_ptr(s)->subdomain_id() > elem->subdomain_id())
{
auto nodes_on_side = elem->nodes_on_side(s);

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


std::multimap<dof_id_type, std::pair<subdomain_id_type, subdomain_id_type>>
MeshTools::build_block_boundary_node_map(const MeshBase & mesh)
{
std::multimap<dof_id_type, std::pair<subdomain_id_type, subdomain_id_type>> block_boundary_node_map;

// Loop over elements, find those on boundary, and
// mark them as true in on_boundary.
for (const auto & elem : mesh.active_element_ptr_range())
{
const auto id1 = elem->subdomain_id();
for (auto s : elem->side_index_range())
{
const auto id2 = elem->neighbor_ptr(s)->subdomain_id();
if (elem->neighbor_ptr(s) && id2 > id1)
{
auto nodes_on_side = elem->nodes_on_side(s);

for (auto & local_id : nodes_on_side)
block_boundary_node_map.emplace(elem->node_ptr(local_id)->id(), id1, id2);
}
}

return block_boundary_node_map;
}


libMesh::BoundingBox
MeshTools::create_bounding_box (const MeshBase & mesh)
Expand Down

0 comments on commit fd2b4f7

Please sign in to comment.