@@ -1370,9 +1370,8 @@ bool MeshRefinement::_coarsen_elements ()
13701370
13711371 for (auto & elem : _mesh .element_ptr_range ())
13721372 {
1373- // Make sure we transfer the element 's boundary id(s)
1373+ // Make sure we transfer the children 's boundary id(s)
13741374 // up to its parent when necessary before coarsening.
1375- // This can be adding or removing the corresonding boundary info.
13761375 _mesh .get_boundary_info ().transfer_boundary_ids_from_children (elem );
13771376
13781377 // active elements flagged for coarsening will
@@ -1388,11 +1387,11 @@ bool MeshRefinement::_coarsen_elements ()
13881387 elem -> nullify_neighbors ();
13891388
13901389 // Remove any boundary information associated
1391- // with this element if we do not allow children to have boundary info
1392- // otherwise we will have trouble in boundary info consistency among
1393- // parent and children elements
1394- // if (!_mesh.get_boundary_info().is_children_on_boundary_side())
1395- _mesh .get_boundary_info ().remove (elem );
1390+ // with this element if we do not allow children to have boundary info.
1391+ // Otherwise, we will do the removal in `transfer_boundary_ids_from_children`
1392+ // to make sure we don't delete the information before it is transferred
1393+ if (!_mesh .get_boundary_info ().is_children_on_boundary_side ())
1394+ _mesh .get_boundary_info ().remove (elem );
13961395
13971396 // Add this iterator to the _unused_elements
13981397 // data structure so we might fill it.
0 commit comments