]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Test periodicity.
authorLuca Heltai <luca.heltai@sissa.it>
Sun, 27 Mar 2016 18:05:13 +0000 (20:05 +0200)
committerLuca Heltai <luca.heltai@sissa.it>
Mon, 11 Apr 2016 07:41:41 +0000 (09:41 +0200)
tests/manifold/composition_manifold_04.cc [new file with mode: 0644]
tests/manifold/composition_manifold_04.with_muparser=true.output [new file with mode: 0644]

diff --git a/tests/manifold/composition_manifold_04.cc b/tests/manifold/composition_manifold_04.cc
new file mode 100644 (file)
index 0000000..c04f9a7
--- /dev/null
@@ -0,0 +1,113 @@
+//----------------------------  function_manifold_chart ---------------------------
+//    Copyright (C) 2011 - 2015 by the mathLab team.
+//
+//    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.
+//
+//---------------------------- composition_manifold ---------------------------
+
+
+// Stress periodicity in CompositionManifold
+
+#include "../tests.h"
+#include <fstream>
+#include <deal.II/base/logstream.h>
+
+
+// all include files you need here
+#include <deal.II/grid/manifold_lib.h>
+#include <deal.II/grid/manifold_tools.h>
+
+
+int main ()
+{
+  initlog();
+  std::ostream &out = deallog.get_file_stream();
+
+  const int dim=2, spacedim=2;
+
+  Point<spacedim> center;
+
+  SphericalManifold<dim,spacedim> S(center);
+  FunctionManifold<dim,spacedim,spacedim> F("x;y", "x;y");
+
+  CompositionManifold<dim> manifold(S,F);
+
+  // Chart points.
+  Point<spacedim> cp[2];
+
+  // Radius
+  cp[0][0] = 1.0;
+  cp[1][0] = 1.0;
+
+  // Last point
+  cp[0][1] = -numbers::PI/4;
+  cp[1][1] =  numbers::PI/4;
+
+  // Spacedim points
+  std::vector<Point<spacedim> > sp(2);
+
+  // Weights
+  std::vector<double> w(2);
+
+  sp[0] = manifold.push_forward(cp[0]);
+  sp[1] = manifold.push_forward(cp[1]);
+
+  unsigned int n_intermediates = 32;
+
+  for (unsigned int n=0; n<2; ++n)
+    {
+      if (n == 1)
+        {
+          sp.push_back(manifold.push_forward(Point<2>(1.0, numbers::PI/4)));
+          sp.push_back(manifold.push_forward(Point<2>(1.0, numbers::PI*3/4)));
+          w.push_back(0);
+          w.push_back(0);
+        }
+      out << "set terminal aqua " << n << std::endl
+          << "set size ratio -1" << std::endl
+          << "plot '-' with vectors " << std::endl;
+
+      for (unsigned int v=0; v<sp.size(); ++v)
+        out << center << " "
+            << sp[v] << std::endl;
+
+
+      for (unsigned int i=0; i<n_intermediates+1; ++i)
+        {
+          w[0] = 1.0-(double)i/((double)n_intermediates);
+          w[1] = 1.0 - w[0];
+
+          Point<spacedim> ip = manifold.get_new_point(Quadrature<spacedim>(sp, w));
+          Tensor<1,spacedim> t1 = manifold.get_tangent_vector(ip, sp[0]);
+          Tensor<1,spacedim> t2 = manifold.get_tangent_vector(ip, sp[1]);
+
+          out << ip << " "
+              << t2 << std::endl;
+        }
+
+      out << "e" << std::endl;
+
+      out << "set terminal aqua " << 2+n << std::endl
+          << "set size ratio -1" << std::endl
+          << "plot '-' w lp " << std::endl;
+
+      for (unsigned int i=0; i<n_intermediates+1; ++i)
+        {
+          w[0] = 1.0-(double)i/((double)n_intermediates);
+          w[1] = 1.0 - w[0];
+
+          Point<spacedim> ip = manifold.
+                               pull_back(manifold.get_new_point(Quadrature<spacedim>(sp, w)));
+
+          ip[0] = w[1];
+
+          out << ip << std::endl;
+        }
+      out << "e" << std::endl;
+    }
+
+  return 0;
+}
diff --git a/tests/manifold/composition_manifold_04.with_muparser=true.output b/tests/manifold/composition_manifold_04.with_muparser=true.output
new file mode 100644 (file)
index 0000000..e69de29

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.