From 332dd27f2e4a87b2e2f92c3a223695b5cdd8b822 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@uliege.be>
Date: Thu, 19 May 2022 22:53:52 +0200
Subject: [PATCH] tentative fix for #1919

---
 src/geo/GFace.cpp | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/geo/GFace.cpp b/src/geo/GFace.cpp
index 19775b9f0d..770132ac7c 100644
--- a/src/geo/GFace.cpp
+++ b/src/geo/GFace.cpp
@@ -1787,7 +1787,7 @@ static void meshCompound(GFace *gf, bool verbose)
 
   std::set<GEdge *, GEntityPtrLessThan> bnd, emb1;
   std::set<GVertex *, GEntityPtrLessThan> emb0;
-  std::vector<int> phys;
+  std::set<int> phys;
   for(std::size_t i = 0; i < gf->compound.size(); i++) {
     auto *c = (GFace *)gf->compound[i];
     df->triangles.insert(df->triangles.end(), c->triangles.begin(),
@@ -1818,7 +1818,7 @@ static void meshCompound(GFace *gf, bool verbose)
     }
     c->compoundSurface = df;
     if(!magic) {
-      phys.insert(phys.end(), c->physicals.begin(), c->physicals.end());
+      phys.insert(c->physicals.begin(), c->physicals.end());
       c->physicals.clear();
     }
   }
@@ -1869,7 +1869,8 @@ static void meshCompound(GFace *gf, bool verbose)
   }
 
   if(!magic) {
-    df->physicals = phys;
+    df->physicals.clear();
+    df->physicals.insert(df->physicals.end(), phys.begin(), phys.end());
     return;
   }
 
-- 
GitLab