From a9bb37c7aa46152b7be64c07725a50c7c41942b2 Mon Sep 17 00:00:00 2001 From: marcfehling Date: Thu, 5 Dec 2019 21:54:25 +0100 Subject: [PATCH] Adjusted ranges for GridRefinement::refine_and_coarsen_fixed_fraction(). --- doc/news/changes/incompatibilities/20191205Fehling2 | 4 ++++ source/grid/grid_refinement.cc | 7 +++---- 2 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 doc/news/changes/incompatibilities/20191205Fehling2 diff --git a/doc/news/changes/incompatibilities/20191205Fehling2 b/doc/news/changes/incompatibilities/20191205Fehling2 new file mode 100644 index 0000000000..27ff597551 --- /dev/null +++ b/doc/news/changes/incompatibilities/20191205Fehling2 @@ -0,0 +1,4 @@ +Changed: Adjusted ranges for GridRefinement::refine_and_coarsen_fixed_fraction(): +Now criteria of every cell will be considered. +
+(Marc Fehling, 12/05/2019) diff --git a/source/grid/grid_refinement.cc b/source/grid/grid_refinement.cc index d60f062b7d..f5581c3af2 100644 --- a/source/grid/grid_refinement.cc +++ b/source/grid/grid_refinement.cc @@ -292,14 +292,13 @@ GridRefinement::refine_and_coarsen_fixed_fraction( // compute thresholds typename Vector::const_iterator pp = tmp.begin(); - for (double sum = 0; - (sum < top_fraction * total_error) && (pp != (tmp.end() - 1)); + for (double sum = 0; (sum < top_fraction * total_error) && (pp != tmp.end()); ++pp) sum += *pp; double top_threshold = (pp != tmp.begin() ? (*pp + *(pp - 1)) / 2 : *pp); typename Vector::const_iterator qq = (tmp.end() - 1); for (double sum = 0; - (sum < bottom_fraction * total_error) && (qq != tmp.begin()); + (sum < bottom_fraction * total_error) && (qq != tmp.begin() - 1); --qq) sum += *qq; double bottom_threshold = (qq != (tmp.end() - 1) ? (*qq + *(qq + 1)) / 2 : 0); @@ -318,7 +317,7 @@ GridRefinement::refine_and_coarsen_fixed_fraction( // refinemnt as well. { const unsigned int refine_cells = pp - tmp.begin(), - coarsen_cells = tmp.end() - qq; + coarsen_cells = tmp.end() - 1 - qq; if (static_cast( tria.n_active_cells() + -- 2.39.5