From 5508ac987da936dabd24ec3e9e9b7de920d5f45d Mon Sep 17 00:00:00 2001 From: Luca Heltai Date: Fri, 25 Mar 2016 22:14:42 +0100 Subject: [PATCH] Composition of Manifold + Rotation. --- tests/manifold/composition_manifold_02.cc | 12 ++- ...tion_manifold_02.with_muparser=true.output | 2 + tests/manifold/composition_manifold_03.cc | 89 +++++++++++++++++++ ...tion_manifold_03.with_muparser=true.output | 23 +++++ 4 files changed, 122 insertions(+), 4 deletions(-) create mode 100644 tests/manifold/composition_manifold_03.cc create mode 100644 tests/manifold/composition_manifold_03.with_muparser=true.output diff --git a/tests/manifold/composition_manifold_02.cc b/tests/manifold/composition_manifold_02.cc index 095f0a7480..38cfb6c18a 100644 --- a/tests/manifold/composition_manifold_02.cc +++ b/tests/manifold/composition_manifold_02.cc @@ -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 t2 = manifold.get_tangent_vector(ip, sp[1]); out << ip << " " - << t2 << std::endl - // << ip << " " - // << t2 << std::endl - ; + << t2 << std::endl; } out << "e" << std::endl; diff --git a/tests/manifold/composition_manifold_02.with_muparser=true.output b/tests/manifold/composition_manifold_02.with_muparser=true.output index c54d0d7e10..97ebceb567 100644 --- a/tests/manifold/composition_manifold_02.with_muparser=true.output +++ b/tests/manifold/composition_manifold_02.with_muparser=true.output @@ -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 index 0000000000..38bb5945e8 --- /dev/null +++ b/tests/manifold/composition_manifold_03.cc @@ -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 +#include + + +// all include files you need here +#include +#include + + +int main () +{ + initlog(); + std::ostream &out = deallog.get_file_stream(); + + const int dim=2, spacedim=2; + + SphericalManifold<1,2> F; + std::map 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 > sp(2); + + // Weights + std::vector 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 ip = manifold.get_new_point(Quadrature(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 index 0000000000..ff5dcc6b5e --- /dev/null +++ b/tests/manifold/composition_manifold_03.with_muparser=true.output @@ -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 -- 2.39.5