]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix get_intermediate_point in 1D. 3026/head
authorDavid Wells <wellsd2@rpi.edu>
Sun, 28 Aug 2016 18:38:55 +0000 (14:38 -0400)
committerDavid Wells <wellsd2@rpi.edu>
Sun, 28 Aug 2016 18:38:55 +0000 (14:38 -0400)
Since geometrical entities with spacedim == 1 are line segments, we
should just do a linear combination to find the intermediate
point (there is no need for angle calculations).

source/grid/manifold_lib.cc

index 69ace8735f13f5c0f03a77c5a4cb3eb4768d3c55..0b0fd94ae061d73279cf1b2ef5a9903aa9c7dae9 100644 (file)
@@ -185,6 +185,11 @@ get_intermediate_point (const Point<spacedim> &p1,
   else if (w > 1.0 - tol)
     return p2;
 
+  // If the points are one dimensional then there is no need for anything but
+  // a linear combination.
+  if (spacedim == 1)
+    return Point<spacedim>(w*p2 + (1-w)*p1);
+
   const Tensor<1,spacedim> v1 = p1 - center;
   const Tensor<1,spacedim> v2 = p2 - center;
   const double r1 = v1.norm();

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.