From 1a1200a4426c9b2090209ad54be7024722d71c13 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 4 Mar 2016 14:10:39 -0600 Subject: [PATCH] Add a bunch of tests for ChartManifold. These test tangent directions for the simple case that the pull back and push forward operations are the identity, or the identity on a subspace (i.e., a projection). --- tests/manifold/chart_manifold_05.cc | 91 +++++++++++++++ tests/manifold/chart_manifold_05.output | 13 +++ tests/manifold/chart_manifold_05_embedded.cc | 96 +++++++++++++++ .../chart_manifold_05_embedded.output | 7 ++ tests/manifold/chart_manifold_06.cc | 105 +++++++++++++++++ tests/manifold/chart_manifold_06.output | 19 +++ tests/manifold/chart_manifold_06_embedded.cc | 109 ++++++++++++++++++ .../chart_manifold_06_embedded.output | 10 ++ 8 files changed, 450 insertions(+) create mode 100644 tests/manifold/chart_manifold_05.cc create mode 100644 tests/manifold/chart_manifold_05.output create mode 100644 tests/manifold/chart_manifold_05_embedded.cc create mode 100644 tests/manifold/chart_manifold_05_embedded.output create mode 100644 tests/manifold/chart_manifold_06.cc create mode 100644 tests/manifold/chart_manifold_06.output create mode 100644 tests/manifold/chart_manifold_06_embedded.cc create mode 100644 tests/manifold/chart_manifold_06_embedded.output diff --git a/tests/manifold/chart_manifold_05.cc b/tests/manifold/chart_manifold_05.cc new file mode 100644 index 0000000000..4e6f86e248 --- /dev/null +++ b/tests/manifold/chart_manifold_05.cc @@ -0,0 +1,91 @@ +//------------------------------------------------------------------- +// 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, where the +// flat manifold is implemented as a ChartManifold with identity +// pull-back and push-forward + +#include "../tests.h" +#include +#include +#include + + +template +class MyFlatManifold : public ChartManifold +{ +public: + virtual + Point + pull_back(const Point &space_point) const + { + return space_point; + } + + + virtual + Point + push_forward(const Point &chart_point) const + { + return chart_point; + } + + virtual + DerivativeForm<1,spacedim,spacedim> + push_forward_gradient(const Point &chart_point) const + { + DerivativeForm<1,spacedim,spacedim> x; + for (unsigned int d=0; d +void test() +{ + deallog << "Testing dim=" << dim + << ", spacedim="<< spacedim << std::endl; + + MyFlatManifold manifold; + + Point x1, x2; + for (unsigned int d=0; d(); + test<1,2>(); + test<1,3>(); + test<2,2>(); + test<2,3>(); + test<3,3>(); + + return 0; +} + diff --git a/tests/manifold/chart_manifold_05.output b/tests/manifold/chart_manifold_05.output new file mode 100644 index 0000000000..7795db95db --- /dev/null +++ b/tests/manifold/chart_manifold_05.output @@ -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/chart_manifold_05_embedded.cc b/tests/manifold/chart_manifold_05_embedded.cc new file mode 100644 index 0000000000..552854fd5e --- /dev/null +++ b/tests/manifold/chart_manifold_05_embedded.cc @@ -0,0 +1,96 @@ +//------------------------------------------------------------------- +// 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, where the +// flat manifold is implemented as a ChartManifold with identity +// pull-back and push-forward +// +// make the chart higher dimensional + +#include "../tests.h" +#include +#include +#include + + +template +class MyFlatManifold : public ChartManifold +{ +public: + virtual + Point + pull_back(const Point &space_point) const + { + Point p; + for (unsigned int d=0; d + push_forward(const Point &chart_point) const + { + Point p; + for (unsigned int d=0; d + push_forward_gradient(const Point &chart_point) const + { + DerivativeForm<1,spacedim+1,spacedim> x; + for (unsigned int d=0; d +void test() +{ + deallog << "Testing dim=" << dim + << ", spacedim="<< spacedim << std::endl; + + MyFlatManifold manifold; + + Point x1, x2; + for (unsigned int d=0; d(); + test<1,2>(); + test<2,2>(); + + return 0; +} + diff --git a/tests/manifold/chart_manifold_05_embedded.output b/tests/manifold/chart_manifold_05_embedded.output new file mode 100644 index 0000000000..2eba4fa8a5 --- /dev/null +++ b/tests/manifold/chart_manifold_05_embedded.output @@ -0,0 +1,7 @@ + +DEAL::Testing dim=1, spacedim=1 +DEAL::0.800000 +DEAL::Testing dim=1, spacedim=2 +DEAL::0.800000 0.800000 +DEAL::Testing dim=2, spacedim=2 +DEAL::0.800000 0.800000 diff --git a/tests/manifold/chart_manifold_06.cc b/tests/manifold/chart_manifold_06.cc new file mode 100644 index 0000000000..fcd443268f --- /dev/null +++ b/tests/manifold/chart_manifold_06.cc @@ -0,0 +1,105 @@ +//------------------------------------------------------------------- +// 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, where the +// flat manifold is implemented as a ChartManifold with identity +// pull-back and push-forward + +#include "../tests.h" +#include +#include +#include + + + +template +class MyFlatManifold : public ChartManifold +{ +public: + MyFlatManifold (const Point &periodicity) + : + ChartManifold(periodicity) + {} + + + virtual + Point + pull_back(const Point &space_point) const + { + return space_point; + } + + + virtual + Point + push_forward(const Point &chart_point) const + { + return chart_point; + } + + virtual + DerivativeForm<1,spacedim,spacedim> + push_forward_gradient(const Point &chart_point) const + { + DerivativeForm<1,spacedim,spacedim> x; + for (unsigned int d=0; d +void test() +{ + deallog << "Testing dim=" << dim + << ", spacedim="<< spacedim << std::endl; + + // make the domain periodic in the first direction with periodicity 1.1 + Point periodicity; + periodicity[0] = 1.1; + MyFlatManifold manifold(periodicity); + + Point x1, x2; + for (unsigned int d=0; d(); + test<1,2>(); + test<1,3>(); + test<2,2>(); + test<2,3>(); + test<3,3>(); + + return 0; +} + diff --git a/tests/manifold/chart_manifold_06.output b/tests/manifold/chart_manifold_06.output new file mode 100644 index 0000000000..9e77f6ab6f --- /dev/null +++ b/tests/manifold/chart_manifold_06.output @@ -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 diff --git a/tests/manifold/chart_manifold_06_embedded.cc b/tests/manifold/chart_manifold_06_embedded.cc new file mode 100644 index 0000000000..9d127b3b29 --- /dev/null +++ b/tests/manifold/chart_manifold_06_embedded.cc @@ -0,0 +1,109 @@ +//------------------------------------------------------------------- +// 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, where the +// flat manifold is implemented as a ChartManifold with identity +// pull-back and push-forward +// +// make the chart higher dimensional + +#include "../tests.h" +#include +#include +#include + + + +template +class MyFlatManifold : public ChartManifold +{ +public: + MyFlatManifold (const Point &periodicity) + : + ChartManifold(periodicity) + {} + + virtual + Point + pull_back(const Point &space_point) const + { + Point p; + for (unsigned int d=0; d + push_forward(const Point &chart_point) const + { + Point p; + for (unsigned int d=0; d + push_forward_gradient(const Point &chart_point) const + { + DerivativeForm<1,spacedim+1,spacedim> x; + for (unsigned int d=0; d +void test() +{ + deallog << "Testing dim=" << dim + << ", spacedim="<< spacedim << std::endl; + + // make the domain periodic in the first direction with periodicity 1.1 + Point periodicity; + periodicity[0] = 1.1; + MyFlatManifold manifold(periodicity); + + Point x1, x2; + for (unsigned int d=0; d(); + test<1,2>(); + test<2,2>(); + + return 0; +} + diff --git a/tests/manifold/chart_manifold_06_embedded.output b/tests/manifold/chart_manifold_06_embedded.output new file mode 100644 index 0000000000..acf0f96c53 --- /dev/null +++ b/tests/manifold/chart_manifold_06_embedded.output @@ -0,0 +1,10 @@ + +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=2, spacedim=2 +DEAL::-0.300000 0.800000 +DEAL::0.300000 -0.800000 -- 2.39.5