From 269d6770bb74662d3ff398ac0bcaaba8ada44a58 Mon Sep 17 00:00:00 2001 From: David Wells Date: Sun, 15 Jul 2018 14:43:03 -0400 Subject: [PATCH] Permit merging empty triangulations. This is useful when we build triangulations by repeatedly merging triangulations in a loop. --- source/grid/grid_generator.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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.")); -- 2.39.5