From: marcfehling Date: Thu, 5 Dec 2019 20:53:58 +0000 (+0100) Subject: Adjusted thresholds for refine_and_coarsen_fixed_number() for both GridRefinement... X-Git-Tag: v9.2.0-rc1~806^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0ff31766e0c803518caaa7ec1af3e82178a16187;p=dealii.git Adjusted thresholds for refine_and_coarsen_fixed_number() for both GridRefinement and parallel::distributed::GridRefinement. --- 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)); } }