]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Further guard against unnecessary copies. 16341/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Tue, 12 Dec 2023 23:47:46 +0000 (16:47 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Tue, 12 Dec 2023 23:47:46 +0000 (16:47 -0700)
source/grid/grid_generator.cc

index 5ab4247afdb05bb64d0ccc9a64650c74328d65ab..29656d165f8afd87562ef767afd609dde4d11cda 100644 (file)
@@ -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},

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.