From 871a92ef14e904d84712e8ae27de84927bf25fd7 Mon Sep 17 00:00:00 2001 From: Matti Pellika <matti.pellikka@tut.fi> Date: Fri, 29 Jan 2010 06:15:07 +0000 Subject: [PATCH] Fix CellComplex::removeSubdomain iterator invalidating. --- Geo/CellComplex.cpp | 15 +++++---------- Geo/ChainComplex.cpp | 5 +++-- Plugin/HomologyComputation.cpp | 1 + 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/Geo/CellComplex.cpp b/Geo/CellComplex.cpp index 9daf3e83ec..3fd25ddbe2 100644 --- a/Geo/CellComplex.cpp +++ b/Geo/CellComplex.cpp @@ -500,21 +500,16 @@ int CellComplex::reduceComplex(){ void CellComplex::removeSubdomain(){ for(int i = 0; i < 4; i++){ - for(citer cit = firstCell(i); cit != lastCell(i); cit++){ - Cell* cell = *cit; - if(cell->inSubdomain()) { - removeCell(cell); - ++cit; - } - } - for(citer cit = firstCell(i); cit != lastCell(i); cit++){ + for(citer cit = firstCell(i); cit != lastCell(i); ){ Cell* cell = *cit; if(cell->inSubdomain()) { removeCell(cell); - cit = firstCell(i); + cit++; } + else ++cit; } } + return; } @@ -526,7 +521,7 @@ int CellComplex::coreduceComplex(){ int count = 0; - CellComplex::removeSubdomain(); + removeSubdomain(); for(int dim = 0; dim < 4; dim++){ citer cit = firstCell(dim); diff --git a/Geo/ChainComplex.cpp b/Geo/ChainComplex.cpp index cbd5806298..9a9d75d6a6 100644 --- a/Geo/ChainComplex.cpp +++ b/Geo/ChainComplex.cpp @@ -1,3 +1,4 @@ + // Gmsh - Copyright (C) 1997-2009 C. Geuzaine, J.-F. Remacle // // See the LICENSE.txt file for license information. Please report all @@ -703,8 +704,8 @@ void Chain::createPView(){ opt_mesh_pyramids(0, GMSH_SET, 0); // show post-processing normals, tangents and element boundaries - opt_view_normals(0, GMSH_SET, 20); - opt_view_tangents(0, GMSH_SET, 20); + //opt_view_normals(0, GMSH_SET, 20); + //opt_view_tangents(0, GMSH_SET, 20); opt_view_show_element(0, GMSH_SET, 1); if(!data.empty()){ diff --git a/Plugin/HomologyComputation.cpp b/Plugin/HomologyComputation.cpp index 60cc7c613a..2b58529890 100644 --- a/Plugin/HomologyComputation.cpp +++ b/Plugin/HomologyComputation.cpp @@ -94,6 +94,7 @@ PView *GMSH_HomologyComputationPlugin::execute(PView *v) else if(cuts != 1 && gens != 1 && betti == 1) homology->computeBettiNumbers(); else Msg::Error("Choose either generators, dual generators or Betti numbers to compute."); + delete homology; return 0; -- GitLab