]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Assert that ChartManifolds are not singular. 2788/head
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 8 Jul 2016 17:10:09 +0000 (12:10 -0500)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 11 Jul 2016 12:24:31 +0000 (07:24 -0500)
source/grid/manifold.cc

index 912b7516f8bb06c8e9be13fec5a112be2a1139f8..e2d4346ba5a1b6083448c1ecd0d6aaf463f8e54e 100644 (file)
@@ -563,6 +563,16 @@ get_tangent_vector (const Point<spacedim> &x1,
                     const Point<spacedim> &x2) const
 {
   const DerivativeForm<1,chartdim,spacedim> F_prime = push_forward_gradient(pull_back(x1));
+
+  // ensure that the chart is not singular by asserting that its
+  // derivative has a positive determinant. we need to make this
+  // comparison relative to the size of the derivative. since the
+  // determinant is the product of chartdim factors, take the
+  // chartdim-th root of it in comparing against the size of the
+  // derivative
+  Assert (std::pow(F_prime.determinant(), 1./chartdim) >= 1e-12 * F_prime.norm(),
+          ExcMessage("The derivative of a chart function must not be singular."));
+
   const Tensor<1,chartdim>                  delta   = sub_manifold.get_tangent_vector(pull_back(x1),
                                                       pull_back(x2));
 

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.