From cc152e838cce93d34262775b2f2ebad6522b49f1 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Fri, 29 Jan 2010 10:56:15 +0000
Subject: [PATCH] and yet another try...

---
 Geo/CellComplex.cpp | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/Geo/CellComplex.cpp b/Geo/CellComplex.cpp
index 5b57a935ab..87a8515e67 100644
--- a/Geo/CellComplex.cpp
+++ b/Geo/CellComplex.cpp
@@ -497,21 +497,20 @@ int CellComplex::reduceComplex(){
 }
 
 
-void CellComplex::removeSubdomain(){
-  
+void CellComplex::removeSubdomain()
+{
+  std::vector<Cell*> toRemove;
   for(int i = 0; i < 4; i++){
-    for(citer cit = firstCell(i); cit != lastCell(i); ){
-      Cell* cell = *cit;
-      cit++;
-      if(cell->inSubdomain()) removeCell(cell);
+    for(citer cit = firstCell(i); cit != lastCell(i); ++cit){
+      Cell *cell = *cit;
+      if(cell->inSubdomain()) toRemove.push_back(cell);
     }
   }
-
-  return;
+  for(unsigned int i = 0; i < toRemove.size(); i++) removeCell(toRemove[i]);
 }
 
-
-int CellComplex::coreduceComplex(){
+int CellComplex::coreduceComplex()
+{
 
   Msg::Debug("Cell complex before coreduction: %d volumes, %d faces, %d edges and %d vertices.\n",
          getSize(3), getSize(2), getSize(1), getSize(0));
-- 
GitLab