From d361c9cee84e39b3b519971790afa1a39d4bbb0c Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Tue, 7 Jun 2022 23:16:58 +0200 Subject: [PATCH] Avoid saving and setting refinement flags in distributed Tria --- source/distributed/tria.cc | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/source/distributed/tria.cc b/source/distributed/tria.cc index 64fef1ee4c..41ed862418 100644 --- a/source/distributed/tria.cc +++ b/source/distributed/tria.cc @@ -2738,19 +2738,17 @@ namespace parallel bool Triangulation::prepare_coarsening_and_refinement() { - std::vector flags_before[2]; - this->save_coarsen_flags(flags_before[0]); - this->save_refine_flags(flags_before[1]); - bool mesh_changed = false; unsigned int loop_counter = 0; + unsigned int n_changes = 0; do { - this->dealii::Triangulation:: - prepare_coarsening_and_refinement(); + n_changes += this->dealii::Triangulation:: + prepare_coarsening_and_refinement(); this->update_periodic_face_map(); // enforce 2:1 mesh balance over periodic boundaries mesh_changed = enforce_mesh_balance_over_periodic_boundaries(*this); + n_changes += mesh_changed; // We can't be sure that we won't run into a situation where we can // not reconcile mesh smoothing and balancing of periodic faces. As @@ -2766,13 +2764,8 @@ namespace parallel } while (mesh_changed); - // check if any of the refinement flags were changed during this - // function and return that value - std::vector flags_after[2]; - this->save_coarsen_flags(flags_after[0]); - this->save_refine_flags(flags_after[1]); - return ((flags_before[0] != flags_after[0]) || - (flags_before[1] != flags_after[1])); + // report if we observed changes in any of the sub-functions + return n_changes > 0; } -- 2.39.5