From: Martin Kronbichler Date: Tue, 7 Apr 2020 16:25:07 +0000 (+0200) Subject: One more test case X-Git-Tag: v9.2.0-rc1~19^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F9807%2Fhead;p=dealii.git One more test case --- diff --git a/tests/grid/grid_hyper_shell_08.cc b/tests/grid/grid_hyper_shell_08.cc new file mode 100644 index 0000000000..fb4d73c146 --- /dev/null +++ b/tests/grid/grid_hyper_shell_08.cc @@ -0,0 +1,81 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2020 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.md at +// the top level directory of deal.II. +// +// --------------------------------------------------------------------- + + +// test the various cell variants of GridGenerator::hyper_shell in 3d with +// the center not being the origin, otherwise the same is grid_hyper_shell_07 + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "../tests.h" + +template +void +check(double r1, double r2, unsigned int n) +{ + Point center; + center[0] = 1.2; + center[1] = 0.3; + Triangulation tria(Triangulation::none); + GridGenerator::hyper_shell(tria, center, r1, r2, n); + + deallog << "Number of cells: " << tria.n_cells() << std::endl; + + unsigned int n_r1 = 0; + unsigned int n_r2 = 0; + unsigned int n_other_radius = 0; + + // ensure that all vertices of the mesh are either at r1 or at r2 + for (const auto v : tria.get_vertices()) + if (std::abs((v - center).norm_square() - r1 * r1) < 1e-12) + ++n_r1; + else if (std::abs((v - center).norm_square() - r2 * r2) < 1e-12) + ++n_r2; + else + ++n_other_radius; + + deallog << "Number of vertices at inner radius: " << n_r1 << std::endl; + deallog << "Number of vertices at outer radius: " << n_r2 << std::endl; + deallog << "Number of vertices at other radius: " << n_other_radius + << std::endl; + deallog << std::endl; +} + + +int +main() +{ + initlog(); + + check<3>(.8, 1, 6); + check<3>(.8, 1, 12); + check<3>(.8, 1, 24); + check<3>(.8, 1, 48); + check<3>(.8, 1, 96); + check<3>(.8, 1, 192); + check<3>(.8, 1, 384); + check<3>(.8, 1, 768); + check<3>(.8, 1, 1536); + check<3>(.8, 1, 3072); + check<3>(.8, 1, 6144); +} diff --git a/tests/grid/grid_hyper_shell_08.output b/tests/grid/grid_hyper_shell_08.output new file mode 100644 index 0000000000..437b35def0 --- /dev/null +++ b/tests/grid/grid_hyper_shell_08.output @@ -0,0 +1,56 @@ + +DEAL::Number of cells: 6 +DEAL::Number of vertices at inner radius: 8 +DEAL::Number of vertices at outer radius: 8 +DEAL::Number of vertices at other radius: 0 +DEAL:: +DEAL::Number of cells: 12 +DEAL::Number of vertices at inner radius: 14 +DEAL::Number of vertices at outer radius: 14 +DEAL::Number of vertices at other radius: 0 +DEAL:: +DEAL::Number of cells: 24 +DEAL::Number of vertices at inner radius: 26 +DEAL::Number of vertices at outer radius: 26 +DEAL::Number of vertices at other radius: 0 +DEAL:: +DEAL::Number of cells: 48 +DEAL::Number of vertices at inner radius: 50 +DEAL::Number of vertices at outer radius: 50 +DEAL::Number of vertices at other radius: 0 +DEAL:: +DEAL::Number of cells: 96 +DEAL::Number of vertices at inner radius: 50 +DEAL::Number of vertices at outer radius: 50 +DEAL::Number of vertices at other radius: 50 +DEAL:: +DEAL::Number of cells: 192 +DEAL::Number of vertices at inner radius: 194 +DEAL::Number of vertices at outer radius: 194 +DEAL::Number of vertices at other radius: 0 +DEAL:: +DEAL::Number of cells: 384 +DEAL::Number of vertices at inner radius: 386 +DEAL::Number of vertices at outer radius: 386 +DEAL::Number of vertices at other radius: 0 +DEAL:: +DEAL::Number of cells: 768 +DEAL::Number of vertices at inner radius: 770 +DEAL::Number of vertices at outer radius: 770 +DEAL::Number of vertices at other radius: 0 +DEAL:: +DEAL::Number of cells: 1536 +DEAL::Number of vertices at inner radius: 1538 +DEAL::Number of vertices at outer radius: 1538 +DEAL::Number of vertices at other radius: 0 +DEAL:: +DEAL::Number of cells: 3072 +DEAL::Number of vertices at inner radius: 3074 +DEAL::Number of vertices at outer radius: 3074 +DEAL::Number of vertices at other radius: 0 +DEAL:: +DEAL::Number of cells: 6144 +DEAL::Number of vertices at inner radius: 6146 +DEAL::Number of vertices at outer radius: 6146 +DEAL::Number of vertices at other radius: 0 +DEAL::