]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add test for cylindrical manifold
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Tue, 5 Mar 2019 17:41:39 +0000 (18:41 +0100)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Tue, 5 Mar 2019 17:44:10 +0000 (18:44 +0100)
tests/manifold/cylindrical_manifold_03.cc [new file with mode: 0644]
tests/manifold/cylindrical_manifold_03.output [new file with mode: 0644]

diff --git a/tests/manifold/cylindrical_manifold_03.cc b/tests/manifold/cylindrical_manifold_03.cc
new file mode 100644 (file)
index 0000000..ec29949
--- /dev/null
@@ -0,0 +1,75 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2019 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.
+//
+// ---------------------------------------------------------------------
+
+// Test cylindrical manifold for the mid point axis of a cylinder
+
+#include "../tests.h"
+
+
+// all include files you need here
+#include <deal.II/grid/manifold_lib.h>
+
+
+
+int
+main()
+{
+  initlog();
+  deallog << std::setprecision(10);
+
+  Tensor<1, 3>   axis({0.0, 0.0, 1.0});
+  const Point<3> origin(1.0, 2.0, 3.0);
+
+  // the larger the tolerance value, the more likely we identify the mid point
+  const double tolerance = 1e-6;
+
+  const CylindricalManifold<3> cylinder(axis, origin, tolerance);
+
+  // take two points symmetric about cylinder axis
+  const double          offset = 1.0;
+  std::vector<Point<3>> surrounding_points_vector(
+    {Point<3>(origin[0] + offset, origin[1], origin[2]),
+     Point<3>(origin[0] - offset, origin[1], origin[2])});
+  const ArrayView<const Point<3>> surrounding_points =
+    make_array_view(surrounding_points_vector);
+  const std::vector<double>     weights_vector({0.5, 0.5});
+  const ArrayView<const double> weights = make_array_view(weights_vector);
+
+  deallog << "New point is at "
+          << cylinder.get_new_point(surrounding_points, weights)
+          << " and it should be " << origin << std::endl;
+
+  surrounding_points_vector[0][2] = -1;
+  surrounding_points_vector[1][2] = -1;
+
+  deallog << "New point is at "
+          << cylinder.get_new_point(surrounding_points, weights)
+          << " and it should be " << Point<3>(origin[0], origin[1], -1.0)
+          << std::endl;
+
+  axis[0] = 0.3;
+  axis[1] = 0.6;
+  axis[2] = 0.8;
+
+  surrounding_points_vector[0][2] = origin[2];
+  surrounding_points_vector[1][2] = origin[2];
+
+  const CylindricalManifold<3> second_cylinder(axis, origin, tolerance);
+  deallog << "New point is at "
+          << second_cylinder.get_new_point(surrounding_points, weights)
+          << " and it should be " << origin << std::endl;
+
+  return 0;
+}
diff --git a/tests/manifold/cylindrical_manifold_03.output b/tests/manifold/cylindrical_manifold_03.output
new file mode 100644 (file)
index 0000000..87c17c1
--- /dev/null
@@ -0,0 +1,4 @@
+
+DEAL::New point is at 1.000000000 2.000000000 3.000000000 and it should be 1.000000000 2.000000000 3.000000000
+DEAL::New point is at 1.000000000 2.000000000 -1.000000000 and it should be 1.000000000 2.000000000 -1.000000000
+DEAL::New point is at 1.000000000 2.000000000 3.000000000 and it should be 1.000000000 2.000000000 3.000000000

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.