]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Composition of Manifold + Rotation.
authorLuca Heltai <luca.heltai@sissa.it>
Fri, 25 Mar 2016 21:14:42 +0000 (22:14 +0100)
committerLuca Heltai <luca.heltai@sissa.it>
Mon, 11 Apr 2016 07:41:41 +0000 (09:41 +0200)
tests/manifold/composition_manifold_02.cc
tests/manifold/composition_manifold_02.with_muparser=true.output
tests/manifold/composition_manifold_03.cc [new file with mode: 0644]
tests/manifold/composition_manifold_03.with_muparser=true.output [new file with mode: 0644]

index 095f0a7480d165bd93c71997a60f4576110fa61a..38cfb6c18ae38286db7b7fe501cced0799a9325e 100644 (file)
@@ -58,6 +58,13 @@ int main ()
   out << "set size ratio -1" << std::endl
       << "plot '-' with vectors " << std::endl;
 
+  Point<2> center(0.0,1.0);
+
+  out << center << " "
+      << sp[0] << std::endl
+      << center << " "
+      << sp[1] << std::endl;
+
   for (unsigned int i=0; i<n_intermediates+1; ++i)
     {
       w[0] = 1.0-(double)i/((double)n_intermediates);
@@ -68,10 +75,7 @@ int main ()
       Tensor<1,spacedim> t2 = manifold.get_tangent_vector(ip, sp[1]);
 
       out << ip << " "
-          << t2 << std::endl
-          // << ip << " "
-          // << t2 << std::endl
-          ;
+          << t2 << std::endl;
     }
 
   out << "e" << std::endl;
index c54d0d7e10910f603565572ee9b1b7e710854d60..97ebceb5670b6548af18f18064b92daba08bc71d 100644 (file)
@@ -1,6 +1,8 @@
 
 set size ratio -1
 plot '-' with vectors 
+0.00000 1.00000 1.00000 1.00000
+0.00000 1.00000 6.12323e-17 2.00000
 1.00000 1.00000 0.00000 1.57080
 0.995185 1.09802 -0.144342 1.46553
 0.980785 1.19509 -0.268141 1.34804
diff --git a/tests/manifold/composition_manifold_03.cc b/tests/manifold/composition_manifold_03.cc
new file mode 100644 (file)
index 0000000..38bb594
--- /dev/null
@@ -0,0 +1,89 @@
+//----------------------------  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 ---------------------------
+
+
+// Test the combination of simple ChartManifolds: SphericalManifold +
+// Rotation
+
+#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;
+
+  SphericalManifold<1,2>    F;
+  std::map<std::string, double> constants;
+  constants["k"] = numbers::PI/3;
+  FunctionManifold<2,2,2> G("cos( k)*x -sin( k)*y; sin( k)*x+cos( k)*y",
+                            "cos(-k)*x -sin(-k)*y; sin(-k)*x+cos(-k)*y",
+                            Point<2>(), constants);
+
+  CompositionManifold<2,2,2,2,1> manifold(F,G);
+
+  // Chart points.
+  Point<2> cp[2];
+  cp[0][0] = 1.0;
+  cp[1][0] = 1.0;
+  cp[1][1] = numbers::PI/2;
+
+  // 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]);
+
+  for (unsigned int d=0; d<2; ++d)
+    if (cp[d].distance(manifold.pull_back(sp[d])) > 1e-10)
+      deallog << "Error!" << std::endl;
+
+  unsigned int n_intermediates = 16;
+
+  out << "set size ratio -1" << std::endl
+      << "plot '-' with vectors " << std::endl;
+
+  Point<2> center;
+
+  out << center << " "
+      << sp[0] << std::endl
+      << center << " "
+      << sp[1] << 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;
+
+  return 0;
+}
+
diff --git a/tests/manifold/composition_manifold_03.with_muparser=true.output b/tests/manifold/composition_manifold_03.with_muparser=true.output
new file mode 100644 (file)
index 0000000..ff5dcc6
--- /dev/null
@@ -0,0 +1,23 @@
+
+set size ratio -1
+plot '-' with vectors 
+0.00000 0.00000 0.500000 0.866025
+0.00000 0.00000 -0.866025 0.500000
+0.500000 0.866025 -1.36035 0.785398
+0.412707 0.910864 -1.34136 0.607761
+0.321439 0.946930 -1.30151 0.441801
+0.227076 0.973877 -1.24293 0.289811
+0.130526 0.991445 -1.16802 0.153773
+0.0327191 0.999465 -1.07934 0.0353341
+-0.0654031 0.997859 -0.979646 -0.0642094
+-0.162895 0.986643 -0.871771 -0.143930
+-0.258819 0.965926 -0.758636 -0.203276
+-0.352250 0.935906 -0.643176 -0.242074
+-0.442289 0.896873 -0.528302 -0.260530
+-0.528068 0.849202 -0.416851 -0.259215
+-0.608761 0.793353 -0.311549 -0.239060
+-0.683592 0.729864 -0.214963 -0.201335
+-0.751840 0.659346 -0.129462 -0.147623
+-0.812847 0.582478 -0.0571846 -0.0798010
+-0.866025 0.500000 0.00000 0.00000
+e

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.