From 2a72b9a0a51d3a341f4e300c1f8fb2d1bc303811 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 12 Dec 2023 16:47:46 -0700 Subject: [PATCH] Further guard against unnecessary copies. --- source/grid/grid_generator.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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}, -- 2.39.5