From: Wolfgang Bangerth Date: Tue, 12 Dec 2023 23:47:46 +0000 (-0700) Subject: Further guard against unnecessary copies. X-Git-Tag: relicensing~250^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a72b9a0a51d3a341f4e300c1f8fb2d1bc303811;p=dealii.git Further guard against unnecessary copies. --- diff --git a/source/grid/grid_generator.cc b/source/grid/grid_generator.cc index 5ab4247afd..29656d165f 100644 --- a/source/grid/grid_generator.cc +++ b/source/grid/grid_generator.cc @@ -6596,13 +6596,13 @@ namespace GridGenerator // if either Triangulation is empty then merging is just a copy. if (triangulation_1.n_cells() == 0) { - result.copy_triangulation(triangulation_2); - return; + if (&result != &triangulation_2) + result.copy_triangulation(triangulation_2); } else if (triangulation_2.n_cells() == 0) { - result.copy_triangulation(triangulation_1); - return; + if (&result != &triangulation_1) + result.copy_triangulation(triangulation_1); } else merge_triangulations({&triangulation_1, &triangulation_2},