]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix get_new_point optimization. 8861/head
authorDoug Shi-Dong <doug.shidong@gmail.com>
Thu, 26 Sep 2019 05:47:41 +0000 (01:47 -0400)
committerDoug Shi-Dong <doug.shidong@gmail.com>
Thu, 26 Sep 2019 05:57:03 +0000 (01:57 -0400)
A performance-if ignores next point when current point weight = 0.

However, since the current point weight is 0, we should be replacing the current point with the next point, not skipping the next point.

source/grid/manifold.cc

index 5072c095afa02ac7a7694fda5a99acddae285948..155d34e7f8c55cbd78f215e507d480566094ffb6 100644 (file)
@@ -101,9 +101,15 @@ Manifold<dim, spacedim>::get_new_point(
         weight = w / (weights[permutation[i]] + w);
 
       if (std::abs(weight) > 1e-14)
-        p = get_intermediate_point(p,
-                                   surrounding_points[permutation[i]],
-                                   1.0 - weight);
+        {
+          p = get_intermediate_point(p,
+                                     surrounding_points[permutation[i]],
+                                     1.0 - weight);
+        }
+      else
+        {
+          p = surrounding_points[permutation[i]];
+        }
       w += weights[permutation[i]];
     }
 

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.