]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add tests.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Sun, 28 Feb 2016 17:54:16 +0000 (11:54 -0600)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Sun, 28 Feb 2016 19:01:55 +0000 (13:01 -0600)
tests/manifold/flat_manifold_05.cc [new file with mode: 0644]
tests/manifold/flat_manifold_05.output [new file with mode: 0644]
tests/manifold/flat_manifold_06.cc [new file with mode: 0644]
tests/manifold/flat_manifold_06.output [new file with mode: 0644]

diff --git a/tests/manifold/flat_manifold_05.cc b/tests/manifold/flat_manifold_05.cc
new file mode 100644 (file)
index 0000000..254560f
--- /dev/null
@@ -0,0 +1,58 @@
+//-------------------------------------------------------------------
+//    Copyright (C) 2016 by the deal.II authors.
+//
+//    This file is subject to LGPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//-------------------------------------------------------------------
+
+
+// Test direction vector of flat manifold without periodicity
+
+#include "../tests.h"
+#include <fstream>
+#include <deal.II/base/logstream.h>
+#include <deal.II/grid/manifold.h>
+
+
+
+// Helper function
+template <int dim, int spacedim>
+void test()
+{
+  deallog << "Testing dim=" << dim
+          << ", spacedim="<< spacedim << std::endl;
+
+  FlatManifold<dim,spacedim> manifold;
+
+  Point<spacedim> x1, x2;
+  for (unsigned int d=0; d<spacedim; ++d)
+    {
+      x1[d] = 0.1;
+      x2[d] = 0.9;
+    }
+
+  // get the connecting vector between these two points. because we
+  // have no periodicity, this should simply be the vector with
+  // components all equal to 0.8
+  deallog << manifold.get_tangent_vector (x1, x2) << std::endl;
+}
+
+int main ()
+{
+  std::ofstream logfile("output");
+  deallog.attach(logfile);
+  deallog.threshold_double(1.e-10);
+
+  test<1,1>();
+  test<1,2>();
+  test<1,3>();
+  test<2,2>();
+  test<2,3>();
+  test<3,3>();
+
+  return 0;
+}
+
diff --git a/tests/manifold/flat_manifold_05.output b/tests/manifold/flat_manifold_05.output
new file mode 100644 (file)
index 0000000..7795db9
--- /dev/null
@@ -0,0 +1,13 @@
+
+DEAL::Testing dim=1, spacedim=1
+DEAL::0.800000
+DEAL::Testing dim=1, spacedim=2
+DEAL::0.800000 0.800000
+DEAL::Testing dim=1, spacedim=3
+DEAL::0.800000 0.800000 0.800000
+DEAL::Testing dim=2, spacedim=2
+DEAL::0.800000 0.800000
+DEAL::Testing dim=2, spacedim=3
+DEAL::0.800000 0.800000 0.800000
+DEAL::Testing dim=3, spacedim=3
+DEAL::0.800000 0.800000 0.800000
diff --git a/tests/manifold/flat_manifold_06.cc b/tests/manifold/flat_manifold_06.cc
new file mode 100644 (file)
index 0000000..6e7f853
--- /dev/null
@@ -0,0 +1,63 @@
+//-------------------------------------------------------------------
+//    Copyright (C) 2016 by the deal.II authors.
+//
+//    This file is subject to LGPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//-------------------------------------------------------------------
+
+
+// Test direction vector of flat manifold with periodicity
+
+#include "../tests.h"
+#include <fstream>
+#include <deal.II/base/logstream.h>
+#include <deal.II/grid/manifold.h>
+
+
+// Helper function
+template <int dim, int spacedim>
+void test()
+{
+  deallog << "Testing dim=" << dim
+          << ", spacedim="<< spacedim << std::endl;
+
+  // make the domain periodic in the first direction with periodicity 1.1
+  Point<spacedim> periodicity;
+  periodicity[0] = 1.1;
+  FlatManifold<dim,spacedim> manifold(periodicity);
+
+  Point<spacedim> x1, x2;
+  for (unsigned int d=0; d<spacedim; ++d)
+    {
+      x1[d] = 0.1;
+      x2[d] = 0.9;
+    }
+
+  // get the connecting vector between these two points. because we
+  // have no periodicity, this should simply be the vector with
+  // components all equal to 0.8 except for the first, which ought to be -0.3
+  deallog << manifold.get_tangent_vector (x1, x2) << std::endl;
+
+  // then also test the opposite direction
+  deallog << manifold.get_tangent_vector (x2, x1) << std::endl;
+}
+
+int main ()
+{
+  std::ofstream logfile("output");
+  deallog.attach(logfile);
+  deallog.threshold_double(1.e-10);
+
+  test<1,1>();
+  test<1,2>();
+  test<1,3>();
+  test<2,2>();
+  test<2,3>();
+  test<3,3>();
+
+  return 0;
+}
+
diff --git a/tests/manifold/flat_manifold_06.output b/tests/manifold/flat_manifold_06.output
new file mode 100644 (file)
index 0000000..9e77f6a
--- /dev/null
@@ -0,0 +1,19 @@
+
+DEAL::Testing dim=1, spacedim=1
+DEAL::-0.300000
+DEAL::0.300000
+DEAL::Testing dim=1, spacedim=2
+DEAL::-0.300000 0.800000
+DEAL::0.300000 -0.800000
+DEAL::Testing dim=1, spacedim=3
+DEAL::-0.300000 0.800000 0.800000
+DEAL::0.300000 -0.800000 -0.800000
+DEAL::Testing dim=2, spacedim=2
+DEAL::-0.300000 0.800000
+DEAL::0.300000 -0.800000
+DEAL::Testing dim=2, spacedim=3
+DEAL::-0.300000 0.800000 0.800000
+DEAL::0.300000 -0.800000 -0.800000
+DEAL::Testing dim=3, spacedim=3
+DEAL::-0.300000 0.800000 0.800000
+DEAL::0.300000 -0.800000 -0.800000

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.