From 52dadfe4f8fecb98bdb6b879ce55485fde88458f Mon Sep 17 00:00:00 2001 From: Luca Heltai Date: Sat, 12 Mar 2016 16:22:16 +0100 Subject: [PATCH] Added spherical_manifold 08. --- tests/manifold/spherical_manifold_08.cc | 76 +++++++++++++++++++++ tests/manifold/spherical_manifold_08.output | 23 +++++++ tests/manifold/spherical_manifold_09.cc | 53 +++++++------- 3 files changed, 126 insertions(+), 26 deletions(-) create mode 100644 tests/manifold/spherical_manifold_08.cc create mode 100644 tests/manifold/spherical_manifold_08.output diff --git a/tests/manifold/spherical_manifold_08.cc b/tests/manifold/spherical_manifold_08.cc new file mode 100644 index 0000000000..e166f72a56 --- /dev/null +++ b/tests/manifold/spherical_manifold_08.cc @@ -0,0 +1,76 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2016 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + +// Check SphericalManifold for periodicity issues: check that the +// spherical manifold finds the right intermediate points independent +// on the number of surrounding points + +#include "../tests.h" + +#include +#include + + +int +main() +{ + initlog(); + + // Center and radius of the Ball + Point<2> center(.5, .5); + double radius = center.norm(); + + const SphericalManifold<2,2> manifold(center); + + // Some points on the circle, that would cross the periodicity + // boundary + std::vector > points; + + points.push_back(Point<2>(0.0, 0.0)); + points.push_back(Point<2>(1.0, 0.0)); + + // And the weights + std::vector weights(2); + + unsigned int n_intermediates=10; + + // First, use only two surrounding points. The second time around, + // instead, use four, with additional zero weights + for (unsigned int test_no=0; test_no<2; ++test_no) + { + if (test_no == 1) + { + // Test that we get the same result with four surrounding points + points.push_back(Point<2>(0.0, 1.0)); + points.push_back(Point<2>(1.0, 1.0)); + weights.push_back(0.0); + weights.push_back(0.0); + } + + deallog << "Test " << test_no << std::endl; + for (unsigned int i=0; i(points, weights)) << std::endl; + } + } + + return 0; +} + + + diff --git a/tests/manifold/spherical_manifold_08.output b/tests/manifold/spherical_manifold_08.output new file mode 100644 index 0000000000..db4d9795e6 --- /dev/null +++ b/tests/manifold/spherical_manifold_08.output @@ -0,0 +1,23 @@ + +DEAL::Test 0 +DEAL::1.00000 -1.11022e-16 +DEAL::0.905580 -0.0792280 +DEAL::0.798836 -0.140856 +DEAL::0.683013 -0.183013 +DEAL::0.561628 -0.204416 +DEAL::0.438372 -0.204416 +DEAL::0.316987 -0.183013 +DEAL::0.201164 -0.140856 +DEAL::0.0944202 -0.0792280 +DEAL::-1.11022e-16 0.00000 +DEAL::Test 1 +DEAL::1.00000 -1.11022e-16 +DEAL::0.905580 -0.0792280 +DEAL::0.798836 -0.140856 +DEAL::0.683013 -0.183013 +DEAL::0.561628 -0.204416 +DEAL::0.438372 -0.204416 +DEAL::0.316987 -0.183013 +DEAL::0.201164 -0.140856 +DEAL::0.0944202 -0.0792280 +DEAL::-1.11022e-16 0.00000 diff --git a/tests/manifold/spherical_manifold_09.cc b/tests/manifold/spherical_manifold_09.cc index a8d5668ec5..a1297102a4 100644 --- a/tests/manifold/spherical_manifold_09.cc +++ b/tests/manifold/spherical_manifold_09.cc @@ -59,64 +59,65 @@ void test() // Compute the points with the faces deallog << "Face quadratures (" - << face_quad.size() * GeometryInfo::faces_per_cell - << ")" << std::endl; - - for(unsigned int f=0; f::faces_per_cell; ++f) { - std::vector > vertices; - std::vector weights(GeometryInfo::vertices_per_face); - - for(unsigned int i=0; i::vertices_per_face; ++i) - vertices.push_back(cell->face(f)->vertex(i)); - - for (unsigned int i=0; i::faces_per_cell + << ")" << std::endl; + + for (unsigned int f=0; f::faces_per_cell; ++f) { - for(unsigned int v=0; v > vertices; + std::vector weights(GeometryInfo::vertices_per_face); - deallog << manifold.get_new_point(Quadrature(vertices, weights)) - << std::endl; + for (unsigned int i=0; i::vertices_per_face; ++i) + vertices.push_back(cell->face(f)->vertex(i)); + + for (unsigned int i=0; i(vertices, weights)) + << std::endl; + } } - } // Project the face quads Quadrature quad = QProjector::project_to_all_faces(face_quad); deallog << "Face quadratures projected on cell " - << "(" << quad.size() << ")" << std::endl; + << "(" << quad.size() << ")" << std::endl; std::vector > vertices; - for(unsigned int i=0; i::vertices_per_cell; ++i) + for (unsigned int i=0; i::vertices_per_cell; ++i) vertices.push_back(cell->vertex(i)); // Used to compute weights. FE_Q fe_q(1); std::vector weights(GeometryInfo::vertices_per_cell); - + for (unsigned int i=0; i(vertices, weights)) - << std::endl; + << std::endl; } // for(unsigned int f=0; f::faces_per_cell; ++f) { // std::vector > vertices; // std::vector weights(GeometryInfo::vertices_per_face); - + // for(unsigned int i=0; i::vertices_per_face; ++i) // vertices.push_back(cell->face(f)->vertex(i)); - + // for (unsigned int i=0; i(vertices, weights)) - // << std::endl; + // << std::endl; // } // } } -- 2.39.5