]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Permit merging empty triangulations.
authorDavid Wells <drwells@email.unc.edu>
Sun, 15 Jul 2018 18:43:03 +0000 (14:43 -0400)
committerDavid Wells <drwells@email.unc.edu>
Thu, 26 Jul 2018 14:41:17 +0000 (10:41 -0400)
This is useful when we build triangulations by repeatedly merging triangulations
in a loop.

source/grid/grid_generator.cc

index 4181dc1a7ec24bc291e3c5f5665982df6b234650..313a3302f00b9d0a9c9ef155b09ded1629f711ed 100644 (file)
@@ -4145,6 +4145,18 @@ namespace GridGenerator
                        const double duplicated_vertex_tolerance,
                        const bool   copy_manifold_ids)
   {
+    // if either Triangulation is empty then merging is just a copy.
+    if (triangulation_1.n_cells() == 0)
+      {
+        result.copy_triangulation(triangulation_2);
+        return;
+      }
+    if (triangulation_2.n_cells() == 0)
+      {
+        result.copy_triangulation(triangulation_1);
+        return;
+      }
+
     Assert(triangulation_1.n_levels() == 1,
            ExcMessage("The input triangulations must be non-empty "
                       "and must not be refined."));

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.