From: Wolfgang Bangerth Date: Fri, 8 Jul 2016 17:10:09 +0000 (-0500) Subject: Assert that ChartManifolds are not singular. X-Git-Tag: v8.5.0-rc1~884^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F2788%2Fhead;p=dealii.git Assert that ChartManifolds are not singular. --- diff --git a/source/grid/manifold.cc b/source/grid/manifold.cc index 912b7516f8..e2d4346ba5 100644 --- a/source/grid/manifold.cc +++ b/source/grid/manifold.cc @@ -563,6 +563,16 @@ get_tangent_vector (const Point &x1, const Point &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));