]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add test
authorRene Gassmoeller <rene.gassmoeller@mailbox.org>
Mon, 24 Feb 2020 20:09:27 +0000 (15:09 -0500)
committerRene Gassmoeller <rene.gassmoeller@mailbox.org>
Thu, 27 Feb 2020 19:33:42 +0000 (14:33 -0500)
tests/manifold/polar_manifold_09.cc [new file with mode: 0644]
tests/manifold/polar_manifold_09.output [new file with mode: 0644]

diff --git a/tests/manifold/polar_manifold_09.cc b/tests/manifold/polar_manifold_09.cc
new file mode 100644 (file)
index 0000000..f4e5788
--- /dev/null
@@ -0,0 +1,76 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2020 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.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+// Check PolarManifold for normal vector issues. The PolarManifold
+// should produce the same normal vector as the SphericalManifold in 2D,
+// in particular for points at the same radius.
+
+#include <deal.II/base/geometry_info.h>
+#include <deal.II/base/utilities.h>
+
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/grid/manifold_lib.h>
+
+#include "../tests.h"
+
+
+int
+main()
+{
+  initlog();
+
+  // Center and radius of the Ball
+
+  const PolarManifold<2, 2>     polar_manifold;
+  const SphericalManifold<2, 2> spherical_manifold;
+
+  Triangulation<2, 2> tria;
+  GridGenerator::hyper_shell(tria, Point<2>(), .3, .6, 12);
+
+  tria.set_manifold(1, polar_manifold);
+
+  for (typename Triangulation<2, 2>::active_cell_iterator cell =
+         tria.begin_active();
+       cell != tria.end();
+       ++cell)
+    {
+      cell->set_all_manifold_ids(1);
+    }
+
+  for (typename Triangulation<2, 2>::active_cell_iterator cell =
+         tria.begin_active();
+       cell != tria.end();
+       ++cell)
+    {
+      for (unsigned int f = 0; f < GeometryInfo<2>::faces_per_cell; ++f)
+        {
+          const Point<2>     position = cell->face(f)->center();
+          const Tensor<1, 2> polar_normal =
+            polar_manifold.normal_vector(cell->face(f), position);
+          const Tensor<1, 2> spherical_normal =
+            spherical_manifold.normal_vector(cell->face(f), position);
+          deallog << "Position: " << position << std::endl;
+          deallog << "Polar normal: " << polar_normal << std::endl;
+          deallog << "Spherical normal: " << spherical_normal << std::endl;
+          deallog << "Relative difference: "
+                  << (polar_normal - spherical_normal).norm() /
+                       polar_normal.norm()
+                  << std::endl
+                  << std::endl;
+        }
+    }
+
+  return 0;
+}
diff --git a/tests/manifold/polar_manifold_09.output b/tests/manifold/polar_manifold_09.output
new file mode 100644 (file)
index 0000000..674d7c7
--- /dev/null
@@ -0,0 +1,241 @@
+
+DEAL::Position: 0.450000 0.00000
+DEAL::Polar normal: 0.00000 1.00000
+DEAL::Spherical normal: 0.00000 1.00000
+DEAL::Relative difference: 0.00000
+DEAL::
+DEAL::Position: 0.389711 0.225000
+DEAL::Polar normal: -0.500000 0.866025
+DEAL::Spherical normal: -0.500000 0.866025
+DEAL::Relative difference: 5.55112e-17
+DEAL::
+DEAL::Position: 0.559808 0.150000
+DEAL::Polar normal: 0.965926 0.258819
+DEAL::Spherical normal: 0.965926 0.258819
+DEAL::Relative difference: 0.00000
+DEAL::
+DEAL::Position: 0.279904 0.0750000
+DEAL::Polar normal: 0.965926 0.258819
+DEAL::Spherical normal: 0.965926 0.258819
+DEAL::Relative difference: 0.00000
+DEAL::
+DEAL::Position: 0.389711 0.225000
+DEAL::Polar normal: -0.500000 0.866025
+DEAL::Spherical normal: -0.500000 0.866025
+DEAL::Relative difference: 5.55112e-17
+DEAL::
+DEAL::Position: 0.225000 0.389711
+DEAL::Polar normal: -0.866025 0.500000
+DEAL::Spherical normal: -0.866025 0.500000
+DEAL::Relative difference: 1.11022e-16
+DEAL::
+DEAL::Position: 0.409808 0.409808
+DEAL::Polar normal: 0.707107 0.707107
+DEAL::Spherical normal: 0.707107 0.707107
+DEAL::Relative difference: 0.00000
+DEAL::
+DEAL::Position: 0.204904 0.204904
+DEAL::Polar normal: 0.707107 0.707107
+DEAL::Spherical normal: 0.707107 0.707107
+DEAL::Relative difference: 0.00000
+DEAL::
+DEAL::Position: 0.225000 0.389711
+DEAL::Polar normal: -0.866025 0.500000
+DEAL::Spherical normal: -0.866025 0.500000
+DEAL::Relative difference: 1.11022e-16
+DEAL::
+DEAL::Position: 2.75546e-17 0.450000
+DEAL::Polar normal: -1.00000 6.12323e-17
+DEAL::Spherical normal: -1.00000 6.12323e-17
+DEAL::Relative difference: 1.23260e-32
+DEAL::
+DEAL::Position: 0.150000 0.559808
+DEAL::Polar normal: 0.258819 0.965926
+DEAL::Spherical normal: 0.258819 0.965926
+DEAL::Relative difference: 0.00000
+DEAL::
+DEAL::Position: 0.0750000 0.279904
+DEAL::Polar normal: 0.258819 0.965926
+DEAL::Spherical normal: 0.258819 0.965926
+DEAL::Relative difference: 0.00000
+DEAL::
+DEAL::Position: 2.75546e-17 0.450000
+DEAL::Polar normal: -1.00000 6.12323e-17
+DEAL::Spherical normal: -1.00000 6.12323e-17
+DEAL::Relative difference: 1.23260e-32
+DEAL::
+DEAL::Position: -0.225000 0.389711
+DEAL::Polar normal: -0.866025 -0.500000
+DEAL::Spherical normal: -0.866025 -0.500000
+DEAL::Relative difference: 0.00000
+DEAL::
+DEAL::Position: -0.150000 0.559808
+DEAL::Polar normal: -0.258819 0.965926
+DEAL::Spherical normal: -0.258819 0.965926
+DEAL::Relative difference: 0.00000
+DEAL::
+DEAL::Position: -0.0750000 0.279904
+DEAL::Polar normal: -0.258819 0.965926
+DEAL::Spherical normal: -0.258819 0.965926
+DEAL::Relative difference: 0.00000
+DEAL::
+DEAL::Position: -0.225000 0.389711
+DEAL::Polar normal: -0.866025 -0.500000
+DEAL::Spherical normal: -0.866025 -0.500000
+DEAL::Relative difference: 0.00000
+DEAL::
+DEAL::Position: -0.389711 0.225000
+DEAL::Polar normal: -0.500000 -0.866025
+DEAL::Spherical normal: -0.500000 -0.866025
+DEAL::Relative difference: 5.55112e-17
+DEAL::
+DEAL::Position: -0.409808 0.409808
+DEAL::Polar normal: -0.707107 0.707107
+DEAL::Spherical normal: -0.707107 0.707107
+DEAL::Relative difference: 0.00000
+DEAL::
+DEAL::Position: -0.204904 0.204904
+DEAL::Polar normal: -0.707107 0.707107
+DEAL::Spherical normal: -0.707107 0.707107
+DEAL::Relative difference: 0.00000
+DEAL::
+DEAL::Position: -0.389711 0.225000
+DEAL::Polar normal: -0.500000 -0.866025
+DEAL::Spherical normal: -0.500000 -0.866025
+DEAL::Relative difference: 5.55112e-17
+DEAL::
+DEAL::Position: -0.450000 5.51091e-17
+DEAL::Polar normal: -1.22465e-16 -1.00000
+DEAL::Spherical normal: -1.22465e-16 -1.00000
+DEAL::Relative difference: 2.46519e-32
+DEAL::
+DEAL::Position: -0.559808 0.150000
+DEAL::Polar normal: -0.965926 0.258819
+DEAL::Spherical normal: -0.965926 0.258819
+DEAL::Relative difference: 0.00000
+DEAL::
+DEAL::Position: -0.279904 0.0750000
+DEAL::Polar normal: -0.965926 0.258819
+DEAL::Spherical normal: -0.965926 0.258819
+DEAL::Relative difference: 0.00000
+DEAL::
+DEAL::Position: -0.450000 5.51091e-17
+DEAL::Polar normal: -1.22465e-16 -1.00000
+DEAL::Spherical normal: -1.22465e-16 -1.00000
+DEAL::Relative difference: 2.46519e-32
+DEAL::
+DEAL::Position: -0.389711 -0.225000
+DEAL::Polar normal: 0.500000 -0.866025
+DEAL::Spherical normal: 0.500000 -0.866025
+DEAL::Relative difference: 4.00297e-16
+DEAL::
+DEAL::Position: -0.559808 -0.150000
+DEAL::Polar normal: -0.965926 -0.258819
+DEAL::Spherical normal: -0.965926 -0.258819
+DEAL::Relative difference: 0.00000
+DEAL::
+DEAL::Position: -0.279904 -0.0750000
+DEAL::Polar normal: -0.965926 -0.258819
+DEAL::Spherical normal: -0.965926 -0.258819
+DEAL::Relative difference: 0.00000
+DEAL::
+DEAL::Position: -0.389711 -0.225000
+DEAL::Polar normal: 0.500000 -0.866025
+DEAL::Spherical normal: 0.500000 -0.866025
+DEAL::Relative difference: 4.00297e-16
+DEAL::
+DEAL::Position: -0.225000 -0.389711
+DEAL::Polar normal: 0.866025 -0.500000
+DEAL::Spherical normal: 0.866025 -0.500000
+DEAL::Relative difference: 8.95090e-16
+DEAL::
+DEAL::Position: -0.409808 -0.409808
+DEAL::Polar normal: -0.707107 -0.707107
+DEAL::Spherical normal: -0.707107 -0.707107
+DEAL::Relative difference: 0.00000
+DEAL::
+DEAL::Position: -0.204904 -0.204904
+DEAL::Polar normal: -0.707107 -0.707107
+DEAL::Spherical normal: -0.707107 -0.707107
+DEAL::Relative difference: 0.00000
+DEAL::
+DEAL::Position: -0.225000 -0.389711
+DEAL::Polar normal: 0.866025 -0.500000
+DEAL::Spherical normal: 0.866025 -0.500000
+DEAL::Relative difference: 8.95090e-16
+DEAL::
+DEAL::Position: -8.26637e-17 -0.450000
+DEAL::Polar normal: 1.00000 -1.83697e-16
+DEAL::Spherical normal: 1.00000 -1.83697e-16
+DEAL::Relative difference: 2.46519e-32
+DEAL::
+DEAL::Position: -0.150000 -0.559808
+DEAL::Polar normal: -0.258819 -0.965926
+DEAL::Spherical normal: -0.258819 -0.965926
+DEAL::Relative difference: 0.00000
+DEAL::
+DEAL::Position: -0.0750000 -0.279904
+DEAL::Polar normal: -0.258819 -0.965926
+DEAL::Spherical normal: -0.258819 -0.965926
+DEAL::Relative difference: 0.00000
+DEAL::
+DEAL::Position: -8.26637e-17 -0.450000
+DEAL::Polar normal: 1.00000 -1.83697e-16
+DEAL::Spherical normal: 1.00000 -1.83697e-16
+DEAL::Relative difference: 2.46519e-32
+DEAL::
+DEAL::Position: 0.225000 -0.389711
+DEAL::Polar normal: 0.866025 0.500000
+DEAL::Spherical normal: 0.866025 0.500000
+DEAL::Relative difference: 1.11022e-16
+DEAL::
+DEAL::Position: 0.150000 -0.559808
+DEAL::Polar normal: 0.258819 -0.965926
+DEAL::Spherical normal: 0.258819 -0.965926
+DEAL::Relative difference: 0.00000
+DEAL::
+DEAL::Position: 0.0750000 -0.279904
+DEAL::Polar normal: 0.258819 -0.965926
+DEAL::Spherical normal: 0.258819 -0.965926
+DEAL::Relative difference: 0.00000
+DEAL::
+DEAL::Position: 0.225000 -0.389711
+DEAL::Polar normal: 0.866025 0.500000
+DEAL::Spherical normal: 0.866025 0.500000
+DEAL::Relative difference: 1.11022e-16
+DEAL::
+DEAL::Position: 0.389711 -0.225000
+DEAL::Polar normal: 0.500000 0.866025
+DEAL::Spherical normal: 0.500000 0.866025
+DEAL::Relative difference: 1.11022e-16
+DEAL::
+DEAL::Position: 0.409808 -0.409808
+DEAL::Polar normal: 0.707107 -0.707107
+DEAL::Spherical normal: 0.707107 -0.707107
+DEAL::Relative difference: 0.00000
+DEAL::
+DEAL::Position: 0.204904 -0.204904
+DEAL::Polar normal: 0.707107 -0.707107
+DEAL::Spherical normal: 0.707107 -0.707107
+DEAL::Relative difference: 0.00000
+DEAL::
+DEAL::Position: 0.389711 -0.225000
+DEAL::Polar normal: 0.500000 0.866025
+DEAL::Spherical normal: 0.500000 0.866025
+DEAL::Relative difference: 1.11022e-16
+DEAL::
+DEAL::Position: 0.450000 0.00000
+DEAL::Polar normal: 0.00000 1.00000
+DEAL::Spherical normal: 0.00000 1.00000
+DEAL::Relative difference: 0.00000
+DEAL::
+DEAL::Position: 0.559808 -0.150000
+DEAL::Polar normal: 0.965926 -0.258819
+DEAL::Spherical normal: 0.965926 -0.258819
+DEAL::Relative difference: 0.00000
+DEAL::
+DEAL::Position: 0.279904 -0.0750000
+DEAL::Polar normal: 0.965926 -0.258819
+DEAL::Spherical normal: 0.965926 -0.258819
+DEAL::Relative difference: 0.00000
+DEAL::

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.