From: Wolfgang Bangerth Date: Sun, 26 Dec 2021 17:55:01 +0000 (-0700) Subject: Add a test. X-Git-Tag: v9.4.0-rc1~588^2~6 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a4db4263a6a0fae1a76fe416e1c062d7f19e541;p=dealii.git Add a test. --- diff --git a/tests/grid/flatten_grid_02.cc b/tests/grid/flatten_grid_02.cc new file mode 100644 index 0000000000..48969852fa --- /dev/null +++ b/tests/grid/flatten_grid_02.cc @@ -0,0 +1,90 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2004 - 2018 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. +// +// --------------------------------------------------------------------- + +// Generate a grid, refine it once, flatten it and output the result. +// +// This test checks that we are also copying the boundary and manifold +// ids of edges in 3d. + +#include +#include +#include + +#include "../tests.h" + +template +void +test() +{ + deallog << dim << 'd' << std::endl; + + // Create a triangulation, then set the boundary and manifold ids of + // boundary faces and, in 3d, of boundary edges + Triangulation tria1; + GridGenerator::hyper_cube(tria1); + tria1.refine_global(1); + + for (const auto &cell : tria1.active_cell_iterators()) + for (const auto &face : cell->face_iterators()) + if (face->at_boundary()) + { + face->set_boundary_id(101); + face->set_manifold_id(102); + + if (dim == 3) + for (unsigned int l = 0; l < face->n_lines(); ++l) + { + face->line(l)->set_boundary_id(201); + face->line(l)->set_manifold_id(202); + } + } + + + // Then flatten the triangulation, and output the boundary and + // manifold ids of all objects on the boundary + Triangulation tria2; + GridGenerator::flatten_triangulation(tria1, tria2); + + for (const auto &cell : tria2.active_cell_iterators()) + for (const auto &face : cell->face_iterators()) + if (face->at_boundary()) + { + deallog << "Face " << face << std::endl; + deallog << " center = " << face->center() << std::endl; + deallog << " boundary id = " << face->boundary_id() << std::endl; + deallog << " manifold id = " << face->manifold_id() << std::endl; + + if (dim == 3) + for (unsigned int l = 0; l < face->n_lines(); ++l) + { + deallog << " Edge " << face->line(l) << std::endl; + deallog << " boundary id = " << face->line(l)->boundary_id() + << std::endl; + deallog << " manifold id = " << face->line(l)->manifold_id() + << std::endl; + } + } + + deallog << std::endl << std::endl; +} + +int +main() +{ + initlog(); + + test<2>(); + test<3>(); +} diff --git a/tests/grid/flatten_grid_02.output b/tests/grid/flatten_grid_02.output new file mode 100644 index 0000000000..47e170cc52 --- /dev/null +++ b/tests/grid/flatten_grid_02.output @@ -0,0 +1,423 @@ + +DEAL::2d +DEAL::Face 1 +DEAL:: center = 0.00000 0.250000 +DEAL:: boundary id = 101 +DEAL:: manifold id = 102 +DEAL::Face 0 +DEAL:: center = 0.250000 0.00000 +DEAL:: boundary id = 101 +DEAL:: manifold id = 102 +DEAL::Face 2 +DEAL:: center = 1.00000 0.250000 +DEAL:: boundary id = 101 +DEAL:: manifold id = 102 +DEAL::Face 4 +DEAL:: center = 0.750000 0.00000 +DEAL:: boundary id = 101 +DEAL:: manifold id = 102 +DEAL::Face 6 +DEAL:: center = 0.00000 0.750000 +DEAL:: boundary id = 101 +DEAL:: manifold id = 102 +DEAL::Face 3 +DEAL:: center = 0.250000 1.00000 +DEAL:: boundary id = 101 +DEAL:: manifold id = 102 +DEAL::Face 8 +DEAL:: center = 1.00000 0.750000 +DEAL:: boundary id = 101 +DEAL:: manifold id = 102 +DEAL::Face 9 +DEAL:: center = 0.750000 1.00000 +DEAL:: boundary id = 101 +DEAL:: manifold id = 102 +DEAL:: +DEAL:: +DEAL::3d +DEAL::Face 2 +DEAL:: center = 0.00000 0.250000 0.250000 +DEAL:: boundary id = 101 +DEAL:: manifold id = 102 +DEAL:: Edge 2 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 17 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 1 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 20 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL::Face 0 +DEAL:: center = 0.250000 0.00000 0.250000 +DEAL:: boundary id = 101 +DEAL:: manifold id = 102 +DEAL:: Edge 0 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 19 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 2 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 13 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL::Face 1 +DEAL:: center = 0.250000 0.250000 0.00000 +DEAL:: boundary id = 101 +DEAL:: manifold id = 102 +DEAL:: Edge 1 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 14 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 0 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 16 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL::Face 3 +DEAL:: center = 1.00000 0.250000 0.250000 +DEAL:: boundary id = 101 +DEAL:: manifold id = 102 +DEAL:: Edge 4 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 22 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 3 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 24 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL::Face 6 +DEAL:: center = 0.750000 0.00000 0.250000 +DEAL:: boundary id = 101 +DEAL:: manifold id = 102 +DEAL:: Edge 12 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 36 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 13 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 4 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL::Face 8 +DEAL:: center = 0.750000 0.250000 0.00000 +DEAL:: boundary id = 101 +DEAL:: manifold id = 102 +DEAL:: Edge 14 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 3 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 12 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 39 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL::Face 11 +DEAL:: center = 0.00000 0.750000 0.250000 +DEAL:: boundary id = 101 +DEAL:: manifold id = 102 +DEAL:: Edge 17 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 6 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 15 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 42 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL::Face 4 +DEAL:: center = 0.250000 1.00000 0.250000 +DEAL:: boundary id = 101 +DEAL:: manifold id = 102 +DEAL:: Edge 5 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 28 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 6 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 26 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL::Face 9 +DEAL:: center = 0.250000 0.750000 0.00000 +DEAL:: boundary id = 101 +DEAL:: manifold id = 102 +DEAL:: Edge 15 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 40 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 16 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 5 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL::Face 15 +DEAL:: center = 1.00000 0.750000 0.250000 +DEAL:: boundary id = 101 +DEAL:: manifold id = 102 +DEAL:: Edge 22 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 7 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 21 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 45 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL::Face 17 +DEAL:: center = 0.750000 1.00000 0.250000 +DEAL:: boundary id = 101 +DEAL:: manifold id = 102 +DEAL:: Edge 25 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 47 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 26 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 7 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL::Face 25 +DEAL:: center = 0.750000 0.750000 0.00000 +DEAL:: boundary id = 101 +DEAL:: manifold id = 102 +DEAL:: Edge 40 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 21 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 39 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 25 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL::Face 12 +DEAL:: center = 0.00000 0.250000 0.750000 +DEAL:: boundary id = 101 +DEAL:: manifold id = 102 +DEAL:: Edge 18 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 43 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 20 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 9 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL::Face 13 +DEAL:: center = 0.250000 0.00000 0.750000 +DEAL:: boundary id = 101 +DEAL:: manifold id = 102 +DEAL:: Edge 19 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 8 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 18 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 37 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL::Face 5 +DEAL:: center = 0.250000 0.250000 1.00000 +DEAL:: boundary id = 101 +DEAL:: manifold id = 102 +DEAL:: Edge 9 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 31 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 8 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 33 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL::Face 16 +DEAL:: center = 1.00000 0.250000 0.750000 +DEAL:: boundary id = 101 +DEAL:: manifold id = 102 +DEAL:: Edge 23 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 46 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 24 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 10 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL::Face 21 +DEAL:: center = 0.750000 0.00000 0.750000 +DEAL:: boundary id = 101 +DEAL:: manifold id = 102 +DEAL:: Edge 36 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 30 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 37 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 23 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL::Face 19 +DEAL:: center = 0.750000 0.250000 1.00000 +DEAL:: boundary id = 101 +DEAL:: manifold id = 102 +DEAL:: Edge 31 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 10 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 30 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 49 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL::Face 28 +DEAL:: center = 0.00000 0.750000 0.750000 +DEAL:: boundary id = 101 +DEAL:: manifold id = 102 +DEAL:: Edge 43 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 27 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 42 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 32 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL::Face 18 +DEAL:: center = 0.250000 1.00000 0.750000 +DEAL:: boundary id = 101 +DEAL:: manifold id = 102 +DEAL:: Edge 28 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 11 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 27 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 48 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL::Face 20 +DEAL:: center = 0.250000 0.750000 1.00000 +DEAL:: boundary id = 101 +DEAL:: manifold id = 102 +DEAL:: Edge 32 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 50 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 33 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 11 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL::Face 30 +DEAL:: center = 1.00000 0.750000 0.750000 +DEAL:: boundary id = 101 +DEAL:: manifold id = 102 +DEAL:: Edge 46 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 29 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 45 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 34 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL::Face 31 +DEAL:: center = 0.750000 1.00000 0.750000 +DEAL:: boundary id = 101 +DEAL:: manifold id = 102 +DEAL:: Edge 47 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 35 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 48 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 29 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL::Face 32 +DEAL:: center = 0.750000 0.750000 1.00000 +DEAL:: boundary id = 101 +DEAL:: manifold id = 102 +DEAL:: Edge 50 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 34 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 49 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: Edge 35 +DEAL:: boundary id = 201 +DEAL:: manifold id = 202 +DEAL:: +DEAL::