]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Simplify check for boundary ids
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Mon, 6 Aug 2018 18:11:55 +0000 (20:11 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Mon, 6 Aug 2018 18:38:40 +0000 (20:38 +0200)
source/grid/grid_generator.cc
source/grid/grid_in.cc
source/grid/tria.cc

index a8ad44864c7734b28f7c7c09a676551958c9c0fc..ca0fb5b178f25d938d70781dc0b1f07273a4969f 100644 (file)
@@ -4217,11 +4217,16 @@ namespace GridGenerator
                       if (line->manifold_id() != numbers::flat_manifold_id)
                         {
                           CellData<1> boundary_line;
+
                           boundary_line.vertices[0] =
                             line->vertex_index(0) + offset;
                           boundary_line.vertices[1] =
                             line->vertex_index(1) + offset;
+
                           boundary_line.manifold_id = line->manifold_id();
+                          boundary_line.boundary_id =
+                            numbers::internal_face_boundary_id; // default
+
                           subcell_data.boundary_lines.push_back(
                             boundary_line); // trivially-copyable
                         }
@@ -4260,6 +4265,7 @@ namespace GridGenerator
                       if (face->manifold_id() != numbers::flat_manifold_id)
                         {
                           CellData<2> boundary_quad;
+
                           boundary_quad.vertices[0] =
                             face->vertex_index(0) + offset;
                           boundary_quad.vertices[1] =
@@ -4270,6 +4276,9 @@ namespace GridGenerator
                             face->vertex_index(3) + offset;
 
                           boundary_quad.manifold_id = face->manifold_id();
+                          boundary_quad.boundary_id =
+                            numbers::internal_face_boundary_id; // default
+
                           subcell_data.boundary_quads.push_back(
                             boundary_quad); // trivially-copyable
                         }
@@ -4279,12 +4288,17 @@ namespace GridGenerator
                             numbers::flat_manifold_id)
                           {
                             CellData<1> boundary_line;
+
                             boundary_line.vertices[0] =
                               cell->line(l)->vertex_index(0) + offset;
                             boundary_line.vertices[1] =
                               cell->line(l)->vertex_index(1) + offset;
+
                             boundary_line.manifold_id =
                               cell->line(l)->manifold_id();
+                            boundary_line.boundary_id =
+                              numbers::internal_face_boundary_id; // default
+
                             subcell_data.boundary_lines.push_back(
                               boundary_line); // trivially_copyable
                           }
@@ -5196,6 +5210,8 @@ namespace GridGenerator
                              (subcell_data.boundary_lines[i].vertices[1] ==
                               map_vert_index[face->line(e)->vertex_index(0)])))
                           {
+                            subcell_data.boundary_lines[i].boundary_id =
+                              numbers::internal_face_boundary_id;
                             edge_found = true;
                             break;
                           }
@@ -5208,7 +5224,7 @@ namespace GridGenerator
                       map_vert_index[face->line(e)->vertex_index(0)];
                     edge.vertices[1] =
                       map_vert_index[face->line(e)->vertex_index(1)];
-                    edge.boundary_id = numbers::internal_face_boundary_id;
+                    edge.boundary_id = 0;
                     edge.manifold_id = face->line(e)->manifold_id();
 
                     subcell_data.boundary_lines.push_back(edge);
index d6f98790a29b6632ceb7213cf8bc585f05d370bb..c6f3d5ecfa32efe06cda187444967439eb5ec350 100644 (file)
@@ -796,11 +796,19 @@ GridIn<dim, spacedim>::read_ucd(std::istream &in,
                                numbers::internal_face_boundary_id));
 
           if (apply_all_indicators_to_manifolds)
-            subcelldata.boundary_lines.back().manifold_id =
-              static_cast<types::manifold_id>(material_id);
+            {
+              subcelldata.boundary_lines.back().boundary_id =
+                numbers::internal_face_boundary_id;
+              subcelldata.boundary_lines.back().manifold_id =
+                static_cast<types::manifold_id>(material_id);
+            }
           else
-            subcelldata.boundary_lines.back().boundary_id =
-              static_cast<types::boundary_id>(material_id);
+            {
+              subcelldata.boundary_lines.back().boundary_id =
+                static_cast<types::boundary_id>(material_id);
+              subcelldata.boundary_lines.back().manifold_id =
+                numbers::flat_manifold_id;
+            }
 
           // transform from ucd to
           // consecutive numbering
@@ -844,11 +852,19 @@ GridIn<dim, spacedim>::read_ucd(std::istream &in,
                                numbers::internal_face_boundary_id));
 
           if (apply_all_indicators_to_manifolds)
-            subcelldata.boundary_quads.back().manifold_id =
-              static_cast<types::manifold_id>(material_id);
+            {
+              subcelldata.boundary_quads.back().boundary_id =
+                numbers::internal_face_boundary_id;
+              subcelldata.boundary_quads.back().manifold_id =
+                static_cast<types::manifold_id>(material_id);
+            }
           else
-            subcelldata.boundary_quads.back().boundary_id =
-              static_cast<types::boundary_id>(material_id);
+            {
+              subcelldata.boundary_quads.back().boundary_id =
+                static_cast<types::boundary_id>(material_id);
+              subcelldata.boundary_quads.back().manifold_id =
+                numbers::flat_manifold_id;
+            }
 
           // transform from ucd to
           // consecutive numbering
index da91e1251fa8a310238ce5b3c44e7aca5392c87a..c4cb44bdd2c6a410d0596c03028898802a2ce220 100644 (file)
@@ -2196,40 +2196,16 @@ namespace internal
                                                       "manifold ids"));
             line->set_manifold_id(subcell_line.manifold_id);
 
-            // Assert that only exterior lines are given a boundary
-            // indicator; however, it is possible that someone may
-            // want to give an interior line a manifold id (and thus
-            // lists this line in the subcell_data structure), and we
-            // need to allow that
+            // assert that only exterior lines are given a boundary
+            // indicator
             if (subcell_line.boundary_id != numbers::internal_face_boundary_id)
               {
-                if (line->boundary_id() == numbers::internal_face_boundary_id)
-                  {
-                    // if we are here, it means that we want to assign a
-                    // boundary indicator different from
-                    // numbers::internal_face_boundary_id to an internal line.
-                    // As said, this would be not allowed, and an exception
-                    // should be immediately thrown. Still, there is the
-                    // possibility that one only wants to specify a manifold_id
-                    // here. If that is the case (manifold_id !=
-                    // numbers::flat_manifold_id) the operation is allowed.
-                    // Otherwise, we really tried to specify a boundary_id (and
-                    // not a manifold_id) to an internal face. The exception
-                    // must be thrown.
-                    if (subcell_line.manifold_id == numbers::flat_manifold_id)
-                      {
-                        // If we are here, this assertion will surely fail, for
-                        // the aforementioned reasons
-                        AssertThrow(!(line->boundary_id() ==
-                                      numbers::internal_face_boundary_id),
-                                    ExcInteriorLineCantBeBoundary(
-                                      line->vertex_index(0),
-                                      line->vertex_index(1),
-                                      subcell_line.boundary_id));
-                      }
-                  }
-                else
-                  line->set_boundary_id_internal(subcell_line.boundary_id);
+                AssertThrow(
+                  line->boundary_id() != numbers::internal_face_boundary_id,
+                  ExcInteriorLineCantBeBoundary(line->vertex_index(0),
+                                                line->vertex_index(1),
+                                                subcell_line.boundary_id));
+                line->set_boundary_id_internal(subcell_line.boundary_id);
               }
           }
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.