Skip to content

Commit

Permalink
Remove boundary deletion upon child boundary transfer.
Browse files Browse the repository at this point in the history
  • Loading branch information
grmnptr committed Mar 1, 2023
1 parent 5c3afdd commit 055d6e5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
4 changes: 0 additions & 4 deletions src/mesh/boundary_info.C
Original file line number Diff line number Diff line change
Expand Up @@ -1890,12 +1890,8 @@ BoundaryInfo::transfer_boundary_ids_from_children(const Elem * const parent)
// This is where the decision is made. If 50% of the children have the tags,
// we propagate them upwards upon coarsening. Otherwise, they are deleted.
for (const auto & boundary : boundary_counts)
{
if (boundary.second / number_of_sides_on_children > 0.5)
this->add_side(parent, side_i, boundary.first);
else
this->remove_side(parent, side_i, boundary.first);
}
}

for (const auto & child_i : make_range(parent->n_children()))
Expand Down
13 changes: 6 additions & 7 deletions src/mesh/mesh_refinement.C
Original file line number Diff line number Diff line change
Expand Up @@ -1370,9 +1370,8 @@ bool MeshRefinement::_coarsen_elements ()

for (auto & elem : _mesh.element_ptr_range())
{
// Make sure we transfer the element's boundary id(s)
// Make sure we transfer the children's boundary id(s)
// up to its parent when necessary before coarsening.
// This can be adding or removing the corresonding boundary info.
_mesh.get_boundary_info().transfer_boundary_ids_from_children(elem);

// active elements flagged for coarsening will
Expand All @@ -1388,11 +1387,11 @@ bool MeshRefinement::_coarsen_elements ()
elem->nullify_neighbors();

// Remove any boundary information associated
// with this element if we do not allow children to have boundary info
// otherwise we will have trouble in boundary info consistency among
// parent and children elements
// if (!_mesh.get_boundary_info().is_children_on_boundary_side())
_mesh.get_boundary_info().remove (elem);
// with this element if we do not allow children to have boundary info.
// Otherwise, we will do the removal in `transfer_boundary_ids_from_children`
// to make sure we don't delete the information before it is transferred
if (!_mesh.get_boundary_info().is_children_on_boundary_side())
_mesh.get_boundary_info().remove (elem);

// Add this iterator to the _unused_elements
// data structure so we might fill it.
Expand Down
2 changes: 2 additions & 0 deletions tests/mesh/boundary_info.C
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,8 @@ public:
if (c(0) < 1)
{
CPPUNIT_ASSERT(bi.has_boundary_id(elem, 1, 5));
// We clean up this boundary ID for the next round of tests
bi.remove_side(elem, 1, 5);
// we will refine this element again
elem->set_refinement_flag(Elem::REFINE);
}
Expand Down

0 comments on commit 055d6e5

Please sign in to comment.