From: Rene Gassmoeller Date: Wed, 5 Apr 2017 01:08:02 +0000 (-0600) Subject: Add test X-Git-Tag: v9.0.0-rc1~1744^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F4182%2Fhead;p=dealii.git Add test --- diff --git a/source/grid/manifold_lib.cc b/source/grid/manifold_lib.cc index 3579acfd3b..57acfd6890 100644 --- a/source/grid/manifold_lib.cc +++ b/source/grid/manifold_lib.cc @@ -257,9 +257,11 @@ get_tangent_vector (const Point &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 index 0000000000..1ba9e861e2 --- /dev/null +++ b/tests/manifold/spherical_manifold_05.cc @@ -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 +#include + + +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 index 0000000000..9786a16672 --- /dev/null +++ b/tests/manifold/spherical_manifold_05.output @@ -0,0 +1,3 @@ + +DEAL::0.500000 0.00000 +DEAL::0.00000 0.00000 -0.500000