]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Assert for get_tantgent_vector of SphericalManifold
authorESeNonFossiIo <esenonfossiio@gmail.com>
Thu, 14 Jul 2016 15:50:52 +0000 (17:50 +0200)
committerLuca Heltai <luca.heltai@sissa.it>
Thu, 4 Aug 2016 08:44:10 +0000 (10:44 +0200)
source/grid/manifold_lib.cc

index 9e73b9c9c1f9fd56a10f1099adcee81efbd40154..aee78e7430d46a1e60879559af52389e022e7723 100644 (file)
@@ -216,9 +216,20 @@ get_tangent_vector (const Point<spacedim> &p1,
 
   const double r1 = (p1 - center).norm();
   const double r2 = (p2 - center).norm();
+
+  Assert(r1 > 1e-10,
+         ExcMessage("p1 cannot coincide with the center."));
+
+  Assert(r2 > 1e-10,
+         ExcMessage("p2 cannot coincide with the center."));
+
   const Tensor<1,spacedim> e1 = (p1 - center)/r1;
   const Tensor<1,spacedim> e2 = (p2 - center)/r2;
 
+  Assert(e1*e2 + 1.0 > 1e-10,
+         ExcMessage("p1 and p2 cannot lie on the same diameter and be opposite
+                    respect to the center."));
+
   // Tangent vector to the unit sphere along the geodesic given by e1 and e2.
   Tensor<1,spacedim> tg = (e2-(e2*e1)*e1);
   tg = tg / tg.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.