From 5790302d106663610ece1026c70bc4906b366f8a Mon Sep 17 00:00:00 2001 From: David Wells Date: Tue, 17 Apr 2018 15:24:03 -0400 Subject: [PATCH] Fix a failing test. This test gives the wrong results on master since, in that case, the exterior boundary is curved. This verifies that we really have removed this piece of Boundary-Manifold compatibility. --- tests/manifold/tria_boundary_id_01.cc | 72 ++++++++--------------- tests/manifold/tria_boundary_id_01.output | 11 +--- 2 files changed, 27 insertions(+), 56 deletions(-) diff --git a/tests/manifold/tria_boundary_id_01.cc b/tests/manifold/tria_boundary_id_01.cc index a47d9aaa98..9e42e077e9 100644 --- a/tests/manifold/tria_boundary_id_01.cc +++ b/tests/manifold/tria_boundary_id_01.cc @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 2003 - 2017 by the deal.II authors +// Copyright (C) 2018 by the deal.II authors // // This file is part of the deal.II library. // @@ -14,12 +14,13 @@ // --------------------------------------------------------------------- -// Test that an overlap in boundary and manifold IDs does not lead to -// the boundary being treated as a (curved) manifold upon refinement. - +// Test that an overlap in boundary and manifold IDs does not lead to the +// boundary being treated as a (curved) manifold upon refinement. More +// exactly: with the old boundary compatibility code (removed for the 9.0 +// release) boundary ids may be treated as manifold ids. Make sure that this +// no longer happens. #include "../tests.h" - #include #include #include @@ -36,9 +37,7 @@ void print_triangulation_data(Stream &stream, // Boundary id count std::map boundary_id_count; std::map manifold_id_count; - for (typename Triangulation::active_cell_iterator - cell = triangulation.begin_active(); - cell!=triangulation.end(); ++cell) + for (const auto &cell : triangulation.active_cell_iterators()) { for (unsigned int face=0; face::faces_per_cell; ++face) { @@ -57,36 +56,31 @@ void print_triangulation_data(Stream &stream, } else manifold_id_count[cell->face(face)->manifold_id()]++; - } } } - for (typename std::map::const_iterator - it = boundary_id_count.begin(); - it != boundary_id_count.end(); ++it) + for (const auto &pair : boundary_id_count) { stream - << " Boundary: " << it->first + << " Boundary: " << pair.first << " ;" - << " Number of faces: " << it->second + << " Number of faces: " << pair.second << "\n"; } - for (typename std::map::const_iterator - it = manifold_id_count.begin(); - it != manifold_id_count.end(); ++it) + for (const auto &pair : manifold_id_count) { stream - << " Manifold: " << it->first + << " Manifold: " << pair.first << " ;" - << " Number of faces: " << it->second + << " Number of faces: " << pair.second << "\n"; } stream << std::endl; } -int main (int argc, char *argv[]) +int main () { initlog(); @@ -98,51 +92,33 @@ int main (int argc, char *argv[]) const double outer_radius = 0.5; const double tol = 1e-6; Triangulation tria; - GridGenerator::hyper_cube_with_cylindrical_hole (tria,inner_radius,outer_radius); + GridGenerator::hyper_cube_with_cylindrical_hole (tria, inner_radius, outer_radius); tria.reset_all_manifolds(); - // Enumerate the flat boundaries and the curved one - // separately. Also provide a manifold ID to the curved - // surface. Note that the manifold ID coincides with - // one of the boundary IDs. This is the root cause of the - // issue... + // Enumerate the flat boundaries and the curved one separately. Also provide + // a manifold ID to the curved surface. Note that the manifold ID coincides + // with the boundary IDs. This is the root cause of the issue... const types::manifold_id curved_manifold_id = 1; - for (typename Triangulation::active_cell_iterator - cell = tria.begin_active(); - cell != tria.end(); ++cell) + for (const auto &cell : tria.active_cell_iterators()) { for (unsigned int face=0; face::faces_per_cell; ++face) { if (cell->face(face)->at_boundary()) { - const Point pt_centre = cell->face(face)->center(); - for (unsigned int vertex=0; vertex::vertices_per_face; ++vertex) { const Point pt_vertex = cell->face(face)->vertex(vertex); if (std::abs(pt_vertex.norm() - inner_radius) < tol) - { - cell->face(face)->set_manifold_id(curved_manifold_id); - cell->face(face)->set_boundary_id(5); - } + cell->face(face)->set_manifold_id(curved_manifold_id); else - { - if (std::abs(pt_centre[0] - outer_radius) < tol) - cell->face(face)->set_boundary_id(1); - else if (std::abs(pt_centre[0] + outer_radius) < tol) - cell->face(face)->set_boundary_id(2); - else if (std::abs(pt_centre[1] - outer_radius) < tol) - cell->face(face)->set_boundary_id(3); - else if (std::abs(pt_centre[1] + outer_radius) < tol) - cell->face(face)->set_boundary_id(4); - } + cell->face(face)->set_boundary_id(curved_manifold_id); } } } } - static const SphericalManifold sphere; + const SphericalManifold sphere; tria.set_manifold(curved_manifold_id, sphere); tria.refine_global(n_global_refinements); @@ -150,11 +126,11 @@ int main (int argc, char *argv[]) print_triangulation_data(deallog, tria); deallog << "Output grid: " << std::endl; - std::ofstream file_gridout ("grid.vtu"); - GridOut().write_vtu(tria, file_gridout); GridOut().write_vtk(tria, deallog.get_file_stream()); deallog << "OK" << std::endl; + std::ofstream file_gridout ("grid.vtu"); + GridOut().write_vtu(tria, file_gridout); return 0; } diff --git a/tests/manifold/tria_boundary_id_01.output b/tests/manifold/tria_boundary_id_01.output index e2b4b7d32c..30333f58b0 100644 --- a/tests/manifold/tria_boundary_id_01.output +++ b/tests/manifold/tria_boundary_id_01.output @@ -1,12 +1,7 @@ DEAL::Boundary / manifold information -DEAL:: Boundary: 1 ; Number of faces: 4 - Boundary: 2 ; Number of faces: 4 - Boundary: 3 ; Number of faces: 4 - Boundary: 4 ; Number of faces: 4 - Boundary: 5 ; Number of faces: 16 - Manifold: -1 ; Number of faces: 48 - Manifold: 0 ; Number of faces: 16 +DEAL:: Boundary: 1 ; Number of faces: 32 + Manifold: 0 ; Number of faces: 64 Manifold: 1 ; Number of faces: 16 DEAL::Output grid: @@ -187,7 +182,7 @@ LOOKUP_TABLE default 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 SCALARS manifold double 1 LOOKUP_TABLE default --1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 +0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 SCALARS material double 1 LOOKUP_TABLE default 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 -- 2.39.5