]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add test 4182/head
authorRene Gassmoeller <rene.gassmoeller@mailbox.org>
Wed, 5 Apr 2017 01:08:02 +0000 (19:08 -0600)
committerRene Gassmoeller <rene.gassmoeller@mailbox.org>
Wed, 5 Apr 2017 18:08:03 +0000 (12:08 -0600)
source/grid/manifold_lib.cc
tests/manifold/spherical_manifold_05.cc [new file with mode: 0644]
tests/manifold/spherical_manifold_05.output [new file with mode: 0644]

index 3579acfd3bc50a24ffb44ed0ce6dd7b5f2101c37..57acfd68900661693889cba55a07d3dc2d2a8563 100644 (file)
@@ -257,9 +257,11 @@ get_tangent_vector (const Point<spacedim> &p1,
   // Tangent vector to the unit sphere along the geodesic given by e1 and e2.
   Tensor<1,spacedim> tg = (e2-(e2*e1)*e1);
 
-  // There is a special case if e2*e1, in which case tg=0
+  // There is a special case if e2*e1==1.0, in which case tg==0
   const double tg_norm = tg.norm();
-  if (tg_norm > tolerance)
+  if (tg_norm < tolerance)
+    return p2-p1;
+  else
     tg /= tg_norm;
 
   const double gamma = std::acos(e1*e2);
diff --git a/tests/manifold/spherical_manifold_05.cc b/tests/manifold/spherical_manifold_05.cc
new file mode 100644 (file)
index 0000000..1ba9e86
--- /dev/null
@@ -0,0 +1,37 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2017 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+// test tangent vectors for linear dependent positions
+
+#include "../tests.h"
+
+#include <deal.II/base/utilities.h>
+#include <deal.II/grid/manifold_lib.h>
+
+
+int
+main()
+{
+  initlog();
+
+  const SphericalManifold<2> manifold_2;
+  const SphericalManifold<3> manifold_3;
+
+  // get tangent vectors for positions that are on a line as seen from the center
+  deallog << manifold_2.get_tangent_vector (Point<2>(0.5, 0),
+                                            Point<2>(1.0, 0)) << std::endl
+          << manifold_3.get_tangent_vector (Point<3>(0, 0, -0.5),
+                                            Point<3>(0, 0, -1.0)) << std::endl;
+}
diff --git a/tests/manifold/spherical_manifold_05.output b/tests/manifold/spherical_manifold_05.output
new file mode 100644 (file)
index 0000000..9786a16
--- /dev/null
@@ -0,0 +1,3 @@
+
+DEAL::0.500000 0.00000
+DEAL::0.00000 0.00000 -0.500000

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.