]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Adjusted ranges for GridRefinement::refine_and_coarsen_fixed_fraction().
authormarcfehling <marc.fehling@gmx.net>
Thu, 5 Dec 2019 20:54:25 +0000 (21:54 +0100)
committermarcfehling <marc.fehling@gmx.net>
Thu, 5 Dec 2019 22:19:04 +0000 (23:19 +0100)
doc/news/changes/incompatibilities/20191205Fehling2 [new file with mode: 0644]
source/grid/grid_refinement.cc

diff --git a/doc/news/changes/incompatibilities/20191205Fehling2 b/doc/news/changes/incompatibilities/20191205Fehling2
new file mode 100644 (file)
index 0000000..27ff597
--- /dev/null
@@ -0,0 +1,4 @@
+Changed: Adjusted ranges for GridRefinement::refine_and_coarsen_fixed_fraction():
+Now criteria of every cell will be considered.
+<br>
+(Marc Fehling, 12/05/2019)
index d60f062b7d00fe4228c368db5e8f380677de2d5d..f5581c3af2240cce7eca8d73ebdb3c7097672a4a 100644 (file)
@@ -292,14 +292,13 @@ GridRefinement::refine_and_coarsen_fixed_fraction(
 
   // compute thresholds
   typename Vector<Number>::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<Number>::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<unsigned int>(
           tria.n_active_cells() +

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.