From 0ff31766e0c803518caaa7ec1af3e82178a16187 Mon Sep 17 00:00:00 2001 From: marcfehling Date: Thu, 5 Dec 2019 21:53:58 +0100 Subject: [PATCH] Adjusted thresholds for refine_and_coarsen_fixed_number() for both GridRefinement and parallel::distributed::GridRefinement. --- doc/news/changes/incompatibilities/20191205Fehling1 | 6 ++++++ source/distributed/grid_refinement.cc | 4 ++-- source/grid/grid_refinement.cc | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 doc/news/changes/incompatibilities/20191205Fehling1 diff --git a/doc/news/changes/incompatibilities/20191205Fehling1 b/doc/news/changes/incompatibilities/20191205Fehling1 new file mode 100644 index 0000000000..a1e13526a5 --- /dev/null +++ b/doc/news/changes/incompatibilities/20191205Fehling1 @@ -0,0 +1,6 @@ +Changed: Adjusted threshold for fixed number adaptation: The last qualifying +cells for refinement and coarsening now specify their respective threshold. +This affects both GridRefinement::fixed_number_refinement() and +parallel::distributed::GridRefinement::fixed_number_refinement(). +
+(Marc Fehling, 12/05/2019) diff --git a/source/distributed/grid_refinement.cc b/source/distributed/grid_refinement.cc index 8a89ceb141..47e9d439d2 100644 --- a/source/distributed/grid_refinement.cc +++ b/source/distributed/grid_refinement.cc @@ -481,8 +481,8 @@ namespace parallel bottom_threshold = RefineAndCoarsenFixedNumber::compute_threshold( locally_owned_indicators, global_min_and_max, - static_cast((1 - adjusted_fractions.second) * - tria.n_global_active_cells()), + static_cast(std::ceil( + (1 - adjusted_fractions.second) * tria.n_global_active_cells())), mpi_communicator); else { diff --git a/source/grid/grid_refinement.cc b/source/grid/grid_refinement.cc index 0c6af2b6cc..d60f062b7d 100644 --- a/source/grid/grid_refinement.cc +++ b/source/grid/grid_refinement.cc @@ -231,10 +231,10 @@ GridRefinement::refine_and_coarsen_fixed_number( else { std::nth_element(tmp.begin(), - tmp.begin() + refine_cells, + tmp.begin() + refine_cells - 1, tmp.end(), std::greater()); - refine(tria, criteria, *(tmp.begin() + refine_cells)); + refine(tria, criteria, *(tmp.begin() + refine_cells - 1)); } } -- 2.39.5