]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Check for consistent manifold ids in 2D when creating a Triangulation
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sat, 4 Aug 2018 16:41:29 +0000 (18:41 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sat, 4 Aug 2018 21:15:19 +0000 (23:15 +0200)
source/grid/tria.cc

index aec3fee2aa262f251ffe447e096ae393e354eff8..14bc39b3a7d6d35565f8cb4e43f9ba469250d494 100644 (file)
@@ -1257,7 +1257,18 @@ namespace internal
       << "In SubCellData the line info of the line with vertex indices " << arg1
       << " and " << arg2 << " appears more than once. "
       << "This is not allowed.");
-
+    /**
+     * Exception
+     * @ingroup Exceptions
+     */
+    DeclException2(
+      ExcInconsistentManifoldIdLineInfoOfLine,
+      int,
+      int,
+      << "In SubCellData the line info of the line with vertex indices " << arg1
+      << " and " << arg2
+      << " appears mutiply with different (valid) manifold ids. "
+      << "This is not allowed.");
 
     /**
      * A class into which we put many of the functions that implement
@@ -2161,6 +2172,15 @@ namespace internal
                         ExcMultiplySetLineInfoOfLine(line_vertices.first,
                                                      line_vertices.second));
 
+            // assert that the manifold id is not yet set or consistent
+            // with the previous id
+            AssertThrow(line->manifold_id() == numbers::flat_manifold_id ||
+                          line->manifold_id() == subcell_line.manifold_id,
+                        ExcInconsistentManifoldIdLineInfoOfLine(
+                          line_vertices.first, line_vertices.second));
+            if (subcell_line.manifold_id != numbers::flat_manifold_id)
+              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
@@ -2192,15 +2212,10 @@ namespace internal
                                       line->vertex_index(1),
                                       subcell_line.boundary_id));
                       }
-                    else
-                      {
-                        line->set_manifold_id(subcell_line.manifold_id);
-                      }
                   }
                 else
                   line->set_boundary_id_internal(subcell_line.boundary_id);
               }
-            line->set_manifold_id(subcell_line.manifold_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.