]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add test case.
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Thu, 2 Nov 2017 12:57:48 +0000 (13:57 +0100)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Thu, 2 Nov 2017 13:00:45 +0000 (14:00 +0100)
tests/manifold/chart_manifold_10.cc [new file with mode: 0644]
tests/manifold/chart_manifold_10.output [new file with mode: 0644]

diff --git a/tests/manifold/chart_manifold_10.cc b/tests/manifold/chart_manifold_10.cc
new file mode 100644 (file)
index 0000000..92a2dc8
--- /dev/null
@@ -0,0 +1,106 @@
+// ---------------------------------------------------------------------
+//
+// 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.
+//
+// ---------------------------------------------------------------------
+
+// Check ChartManifold::get_intermediate_point
+
+#include "../tests.h"
+
+#include <deal.II/base/utilities.h>
+#include <deal.II/grid/manifold_lib.h>
+
+
+template <int dim>
+void
+print_intermediate_point (const Manifold<dim> &manifold,
+                          const std::string &manifold_name,
+                          const Point<dim> &p1,
+                          const Point<dim> &p2,
+                          const double weight)
+{
+  const std::vector<Point<dim> > points({{p1, p2}});
+  const std::vector<double> weights({{1-weight, weight}});
+  deallog.precision(3);
+  deallog << manifold_name << " between points [" << p1 << "] and ["
+          << p2 << "] with weight " << weight << std::endl;
+  deallog.precision(12);
+  deallog << "Intermediate point: "
+          << manifold.get_intermediate_point(p1, p2, weight)
+          << std::endl
+          << "get_new_point:      "
+          << manifold.get_new_point(points, weights) << std::endl;
+}
+
+
+int
+main()
+{
+  initlog();
+
+  const PolarManifold<2> polar;
+  {
+    Point<2> p1(1., 0.1);
+    Point<2> p2(0.1, 1);
+    print_intermediate_point(polar, "PolarManifold", p1, p2, 0.1);
+    print_intermediate_point(polar, "PolarManifold", p1, p2, 0.5);
+    print_intermediate_point(polar, "PolarManifold", p1, p2, 0.9);
+  }
+  {
+    Point<2> p1(1., 0.1);
+    Point<2> p2(1., -0.1);
+    print_intermediate_point(polar, "PolarManifold", p1, p2, 0.1);
+    print_intermediate_point(polar, "PolarManifold", p1, p2, 0.5);
+    print_intermediate_point(polar, "PolarManifold", p1, p2, 0.9);
+  }
+  {
+    Point<2> p1(1., 0.1);
+    Point<2> p2(-1., -0.099);
+    print_intermediate_point(polar, "PolarManifold", p1, p2, 0.5);
+  }
+  {
+    Point<2> p1(1., 0.1);
+    Point<2> p2(-1., -0.101);
+    print_intermediate_point(polar, "PolarManifold", p1, p2, 0.5);
+  }
+
+  const CylindricalManifold<3> cylindrical(2);
+  {
+    Point<3> p1(1., 0.1, 0.2);
+    Point<3> p2(0.1, 1, 0.2);
+    print_intermediate_point(cylindrical, "CylindricalManifold", p1, p2, 0.1);
+    print_intermediate_point(cylindrical, "CylindricalManifold", p1, p2, 0.5);
+    print_intermediate_point(cylindrical, "CylindricalManifold", p1, p2, 0.9);
+  }
+  {
+    Point<3> p1(1., 0.1, 0.2);
+    Point<3> p2(-1, -0.099, 0.2);
+    print_intermediate_point(cylindrical, "CylindricalManifold", p1, p2, 0.5);
+  }
+  {
+    Point<3> p1(1., 0.1, 0.2);
+    Point<3> p2(-1, -0.101, 0.2);
+    print_intermediate_point(cylindrical, "CylindricalManifold", p1, p2, 0.5);
+  }
+  {
+    Point<3> p1(1., 0.1, 0.2);
+    Point<3> p2(-1, -0.101, 0.5);
+    print_intermediate_point(cylindrical, "CylindricalManifold", p1, p2, 0.1);
+    print_intermediate_point(cylindrical, "CylindricalManifold", p1, p2, 0.5);
+    print_intermediate_point(cylindrical, "CylindricalManifold", p1, p2, 0.9);
+  }
+
+
+
+  return 0;
+}
diff --git a/tests/manifold/chart_manifold_10.output b/tests/manifold/chart_manifold_10.output
new file mode 100644 (file)
index 0000000..f078660
--- /dev/null
@@ -0,0 +1,49 @@
+
+DEAL::PolarManifold between points [1.00 0.100] and [0.100 1.00] with weight 0.100
+DEAL::Intermediate point: 0.976938594605 0.235777400045
+DEAL::get_new_point:      0.976938594605 0.235777400045
+DEAL::PolarManifold between points [1.00 0.100] and [0.100 1.00] with weight 0.500
+DEAL::Intermediate point: 0.710633520178 0.710633520178
+DEAL::get_new_point:      0.710633520178 0.710633520178
+DEAL::PolarManifold between points [1.00 0.100] and [0.100 1.00] with weight 0.900
+DEAL::Intermediate point: 0.235777400045 0.976938594605
+DEAL::get_new_point:      0.235777400045 0.976938594605
+DEAL::PolarManifold between points [1.00 0.100] and [1.00 -0.100] with weight 0.100
+DEAL::Intermediate point: 1.00179457081 0.0800477225761
+DEAL::get_new_point:      1.00179457081 0.0800477225761
+DEAL::PolarManifold between points [1.00 0.100] and [1.00 -0.100] with weight 0.500
+DEAL::Intermediate point: 1.00498756211 9.06555268871e-17
+DEAL::get_new_point:      1.00498756211 9.06555268871e-17
+DEAL::PolarManifold between points [1.00 0.100] and [1.00 -0.100] with weight 0.900
+DEAL::Intermediate point: 1.00179457081 -0.0800477225761
+DEAL::get_new_point:      1.00179457081 -0.0800477225761
+DEAL::PolarManifold between points [1.00 0.100] and [-1.00 -0.0990] with weight 0.500
+DEAL::Intermediate point: -0.0994999878052 1.00000012499
+DEAL::get_new_point:      -0.0994999878052 1.00000012499
+DEAL::PolarManifold between points [1.00 0.100] and [-1.00 -0.101] with weight 0.500
+DEAL::Intermediate point: 0.100499987687 -1.00000012499
+DEAL::get_new_point:      0.100499987687 -1.00000012499
+DEAL::CylindricalManifold between points [1.00 0.100 0.200] and [0.100 1.00 0.200] with weight 0.100
+DEAL::Intermediate point: 0.976938594605 0.235777400045 0.200000000000
+DEAL::get_new_point:      0.976938594605 0.235777400045 0.200000000000
+DEAL::CylindricalManifold between points [1.00 0.100 0.200] and [0.100 1.00 0.200] with weight 0.500
+DEAL::Intermediate point: 0.710633520178 0.710633520178 0.200000000000
+DEAL::get_new_point:      0.710633520178 0.710633520178 0.200000000000
+DEAL::CylindricalManifold between points [1.00 0.100 0.200] and [0.100 1.00 0.200] with weight 0.900
+DEAL::Intermediate point: 0.235777400045 0.976938594605 0.200000000000
+DEAL::get_new_point:      0.235777400045 0.976938594605 0.200000000000
+DEAL::CylindricalManifold between points [1.00 0.100 0.200] and [-1.00 -0.0990 0.200] with weight 0.500
+DEAL::Intermediate point: -0.0994999878052 1.00000012499 0.200000000000
+DEAL::get_new_point:      -0.0994999878052 1.00000012499 0.200000000000
+DEAL::CylindricalManifold between points [1.00 0.100 0.200] and [-1.00 -0.101 0.200] with weight 0.500
+DEAL::Intermediate point: 0.100499987687 -1.00000012499 0.200000000000
+DEAL::get_new_point:      0.100499987687 -1.00000012499 0.200000000000
+DEAL::CylindricalManifold between points [1.00 0.100 0.200] and [-1.00 -0.101 0.500] with weight 0.100
+DEAL::Intermediate point: 0.981989158853 -0.213816255219 0.230000000000
+DEAL::get_new_point:      0.981989158853 -0.213816255219 0.230000000000
+DEAL::CylindricalManifold between points [1.00 0.100 0.200] and [-1.00 -0.101 0.500] with weight 0.500
+DEAL::Intermediate point: 0.100499987687 -1.00000012499 0.350000000000
+DEAL::get_new_point:      0.100499987687 -1.00000012499 0.350000000000
+DEAL::CylindricalManifold between points [1.00 0.100 0.200] and [-1.00 -0.101 0.500] with weight 0.900
+DEAL::Intermediate point: -0.919876745725 -0.404978606564 0.470000000000
+DEAL::get_new_point:      -0.919876745725 -0.404978606564 0.470000000000

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.