From: marcfehling Date: Thu, 5 Dec 2019 20:54:25 +0000 (+0100) Subject: Adjusted ranges for GridRefinement::refine_and_coarsen_fixed_fraction(). X-Git-Tag: v9.2.0-rc1~806^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a9bb37c7aa46152b7be64c07725a50c7c41942b2;p=dealii.git Adjusted ranges for GridRefinement::refine_and_coarsen_fixed_fraction(). --- 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() +