From: Martin Kronbichler Date: Tue, 7 Jun 2022 21:16:58 +0000 (+0200) Subject: Avoid saving and setting refinement flags in distributed Tria X-Git-Tag: v9.5.0-rc1~1196^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F13923%2Fhead;p=dealii.git Avoid saving and setting refinement flags in distributed Tria --- 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; }