From: David Wells Date: Sun, 15 Jul 2018 18:43:03 +0000 (-0400) Subject: Permit merging empty triangulations. X-Git-Tag: v9.1.0-rc1~874^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=269d6770bb74662d3ff398ac0bcaaba8ada44a58;p=dealii.git Permit merging empty triangulations. This is useful when we build triangulations by repeatedly merging triangulations in a loop. --- diff --git a/source/grid/grid_generator.cc b/source/grid/grid_generator.cc index 4181dc1a7e..313a3302f0 100644 --- a/source/grid/grid_generator.cc +++ b/source/grid/grid_generator.cc @@ -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."));