--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2003 - 2017 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.
+//
+// ---------------------------------------------------------------------
+
+
+// Test that an overlap in boundary and manifold IDs does not lead to
+// the boundary being treated as a (curved) manifold upon refinement.
+
+#include "../tests.h"
+
+
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/grid/grid_tools.h>
+#include <deal.II/grid/grid_out.h>
+#include <deal.II/grid/manifold_lib.h>
+
+#include <fstream>
+
+using namespace dealii;
+
+template <typename Stream, int dim>
+void print_triangulation_data(Stream &stream,
+ const Triangulation<dim> &triangulation)
+{
+// Boundary id count
+ std::map<int,int> boundary_id_count;
+ std::map<int,int> manifold_id_count;
+ for (typename Triangulation<dim>::active_cell_iterator
+ cell = triangulation.begin_active();
+ cell!=triangulation.end(); ++cell)
+ {
+ for (unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face)
+ {
+ if (cell->face(face)->at_boundary())
+ {
+ boundary_id_count[cell->face(face)->boundary_id()]++;
+ manifold_id_count[cell->face(face)->manifold_id()]++;
+ }
+ else
+ {
+ // Prevent double-accounting when face is shared
+ if (cell->neighbor_level(face) == cell->level())
+ {
+ if (cell->id() < cell->neighbor(face)->id())
+ manifold_id_count[cell->face(face)->manifold_id()]++;
+ }
+ else
+ manifold_id_count[cell->face(face)->manifold_id()]++;
+
+ }
+ }
+ }
+
+ for (typename std::map<int,int>::const_iterator
+ it = boundary_id_count.begin();
+ it != boundary_id_count.end(); ++it)
+ {
+ stream
+ << " Boundary: " << it->first
+ << " ;"
+ << " Number of faces: " << it->second
+ << "\n";
+ }
+ for (typename std::map<int,int>::const_iterator
+ it = manifold_id_count.begin();
+ it != manifold_id_count.end(); ++it)
+ {
+ stream
+ << " Manifold: " << it->first
+ << " ;"
+ << " Number of faces: " << it->second
+ << "\n";
+ }
+
+ stream << std::endl;
+}
+
+int main (int argc, char *argv[])
+{
+ initlog();
+
+ const int dim = 2;
+ const unsigned int n_global_refinements = 1;
+
+ // Create a geometry with flat and curved boundaries
+ const double inner_radius = 0.25;
+ const double outer_radius = 0.5;
+ const double tol = 1e-6;
+ Triangulation<dim> tria;
+ 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...
+ const types::manifold_id curved_manifold_id = 1;
+ for (typename Triangulation<dim>::active_cell_iterator
+ cell = tria.begin_active();
+ cell != tria.end(); ++cell)
+ {
+ for (unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face)
+ {
+ if (cell->face(face)->at_boundary())
+ {
+ const Point<dim> pt_centre = cell->face(face)->center();
+
+ for (unsigned int vertex=0; vertex<GeometryInfo<dim>::vertices_per_face; ++vertex)
+ {
+ const Point<dim> 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);
+ }
+ 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);
+ }
+ }
+ }
+ }
+ }
+
+ static const SphericalManifold<dim> sphere;
+ tria.set_manifold(curved_manifold_id, sphere);
+ tria.refine_global(n_global_refinements);
+
+ deallog << "Boundary / manifold information" << std::endl;
+ 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;
+
+ return 0;
+}
--- /dev/null
+
+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
+ Manifold: 1 ; Number of faces: 16
+
+DEAL::Output grid:
+# vtk DataFile Version 3.0
+#This file was generated
+ASCII
+DATASET UNSTRUCTURED_GRID
+
+POINTS 128 double
+0.500000 0.00000 0
+0.500000 0.250000 0
+0.375000 0.00000 0
+0.365485 0.172835 0
+0.500000 0.250000 0
+0.500000 0.500000 0
+0.365485 0.172835 0
+0.338388 0.338388 0
+0.375000 0.00000 0
+0.365485 0.172835 0
+0.250000 0.00000 0
+0.230970 0.0956709 0
+0.365485 0.172835 0
+0.338388 0.338388 0
+0.230970 0.0956709 0
+0.176777 0.176777 0
+0.500000 0.500000 0
+0.250000 0.500000 0
+0.338388 0.338388 0
+0.172835 0.365485 0
+0.250000 0.500000 0
+3.06162e-17 0.500000 0
+0.172835 0.365485 0
+2.29621e-17 0.375000 0
+0.338388 0.338388 0
+0.172835 0.365485 0
+0.176777 0.176777 0
+0.0956709 0.230970 0
+0.172835 0.365485 0
+2.29621e-17 0.375000 0
+0.0956709 0.230970 0
+1.53081e-17 0.250000 0
+3.06162e-17 0.500000 0
+-0.250000 0.500000 0
+2.29621e-17 0.375000 0
+-0.172835 0.365485 0
+-0.250000 0.500000 0
+-0.500000 0.500000 0
+-0.172835 0.365485 0
+-0.338388 0.338388 0
+2.29621e-17 0.375000 0
+-0.172835 0.365485 0
+1.53081e-17 0.250000 0
+-0.0956709 0.230970 0
+-0.172835 0.365485 0
+-0.338388 0.338388 0
+-0.0956709 0.230970 0
+-0.176777 0.176777 0
+-0.500000 0.500000 0
+-0.500000 0.250000 0
+-0.338388 0.338388 0
+-0.365485 0.172835 0
+-0.500000 0.250000 0
+-0.500000 6.12323e-17 0
+-0.365485 0.172835 0
+-0.375000 4.59243e-17 0
+-0.338388 0.338388 0
+-0.365485 0.172835 0
+-0.176777 0.176777 0
+-0.230970 0.0956709 0
+-0.365485 0.172835 0
+-0.375000 4.59243e-17 0
+-0.230970 0.0956709 0
+-0.250000 3.06162e-17 0
+-0.500000 6.12323e-17 0
+-0.500000 -0.250000 0
+-0.375000 4.59243e-17 0
+-0.365485 -0.172835 0
+-0.500000 -0.250000 0
+-0.500000 -0.500000 0
+-0.365485 -0.172835 0
+-0.338388 -0.338388 0
+-0.375000 4.59243e-17 0
+-0.365485 -0.172835 0
+-0.250000 3.06162e-17 0
+-0.230970 -0.0956709 0
+-0.365485 -0.172835 0
+-0.338388 -0.338388 0
+-0.230970 -0.0956709 0
+-0.176777 -0.176777 0
+-0.500000 -0.500000 0
+-0.250000 -0.500000 0
+-0.338388 -0.338388 0
+-0.172835 -0.365485 0
+-0.250000 -0.500000 0
+-9.18485e-17 -0.500000 0
+-0.172835 -0.365485 0
+-6.88864e-17 -0.375000 0
+-0.338388 -0.338388 0
+-0.172835 -0.365485 0
+-0.176777 -0.176777 0
+-0.0956709 -0.230970 0
+-0.172835 -0.365485 0
+-6.88864e-17 -0.375000 0
+-0.0956709 -0.230970 0
+-4.59243e-17 -0.250000 0
+-9.18485e-17 -0.500000 0
+0.250000 -0.500000 0
+-6.88864e-17 -0.375000 0
+0.172835 -0.365485 0
+0.250000 -0.500000 0
+0.500000 -0.500000 0
+0.172835 -0.365485 0
+0.338388 -0.338388 0
+-6.88864e-17 -0.375000 0
+0.172835 -0.365485 0
+-4.59243e-17 -0.250000 0
+0.0956709 -0.230970 0
+0.172835 -0.365485 0
+0.338388 -0.338388 0
+0.0956709 -0.230970 0
+0.176777 -0.176777 0
+0.500000 -0.500000 0
+0.500000 -0.250000 0
+0.338388 -0.338388 0
+0.365485 -0.172835 0
+0.500000 -0.250000 0
+0.500000 0.00000 0
+0.365485 -0.172835 0
+0.375000 0.00000 0
+0.338388 -0.338388 0
+0.365485 -0.172835 0
+0.176777 -0.176777 0
+0.230970 -0.0956709 0
+0.365485 -0.172835 0
+0.375000 0.00000 0
+0.230970 -0.0956709 0
+0.250000 0.00000 0
+
+CELLS 32 160
+4 0 1 3 2
+4 4 5 7 6
+4 8 9 11 10
+4 12 13 15 14
+4 16 17 19 18
+4 20 21 23 22
+4 24 25 27 26
+4 28 29 31 30
+4 32 33 35 34
+4 36 37 39 38
+4 40 41 43 42
+4 44 45 47 46
+4 48 49 51 50
+4 52 53 55 54
+4 56 57 59 58
+4 60 61 63 62
+4 64 65 67 66
+4 68 69 71 70
+4 72 73 75 74
+4 76 77 79 78
+4 80 81 83 82
+4 84 85 87 86
+4 88 89 91 90
+4 92 93 95 94
+4 96 97 99 98
+4 100 101 103 102
+4 104 105 107 106
+4 108 109 111 110
+4 112 113 115 114
+4 116 117 119 118
+4 120 121 123 122
+4 124 125 127 126
+
+CELL_TYPES 32
+ 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9
+POINT_DATA 128
+SCALARS level 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
+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
+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
+SCALARS subdomain 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
+SCALARS level_subdomain 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
+DEAL::OK