]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use get_intermediate_point after merging directions. 5408/head
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Tue, 7 Nov 2017 08:24:52 +0000 (09:24 +0100)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Tue, 7 Nov 2017 08:25:15 +0000 (09:25 +0100)
source/grid/manifold_lib.cc

index 7c7325e231dec26b7b4ddcab173a63ad33d9e604..44a0a1c503e5af49e211576196c1e47a1d4d1b21 100644 (file)
@@ -461,6 +461,22 @@ get_new_point (const ArrayView<const Point<spacedim>> &vertices,
 
     const unsigned int n_merged_points = directions.size();
 
+    // check if we only have two points now, in which case we can use the
+    // get_intermediate_point function
+    if (n_merged_points == 2)
+      {
+        SphericalManifold<3,3> unit_manifold;
+        Assert(std::abs(merged_weights[0] + merged_weights[1] - 1.0) < 1e-13,
+               ExcMessage("Weights do not sum up to 1"));
+        Point<3> intermediate = unit_manifold.get_intermediate_point
+                                (Point<3>(directions[0]), Point<3>(directions[1]), merged_weights[1]);
+        // copy back to spacedim-point
+        Point<spacedim> p;
+        for (unsigned int d=0; d<spacedim; ++d)
+          p[d] = intermediate[d];
+        return center + rho * p;
+      }
+
     Tensor<1,3> vPerp;
     Tensor<2,2> Hessian;
     Tensor<1,2> gradient;

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.