diff --git a/Mesh/Generator.cpp b/Mesh/Generator.cpp index 0e1fbdaa348ba0b68296c5b50ca7262d646d120e..2fe8ff3e72296d8c64ab837857356bbecc9989fc 100644 --- a/Mesh/Generator.cpp +++ b/Mesh/Generator.cpp @@ -1,4 +1,4 @@ -// $Id: Generator.cpp,v 1.39 2003-03-01 22:36:42 geuzaine Exp $ +// $Id: Generator.cpp,v 1.40 2003-03-10 04:26:32 geuzaine Exp $ // // Copyright (C) 1997 - 2003 C. Geuzaine, J.-F. Remacle // @@ -185,49 +185,38 @@ void Init_Mesh(Mesh * M, int all) ExitExtrude(); - if(M->Vertices) { - Tree_Action(M->Vertices, Free_Vertex); - Tree_Delete(M->Vertices); - } - if(M->VertexEdges) { - Tree_Action(M->VertexEdges, Free_Vertex); - Tree_Delete(M->VertexEdges); - } - if(M->Simplexes) { - // Tree_Action (M->Simplexes, Free_Simplex); //produit des crashes innatendus... - // normal, cette memoire est dupliquee - // dans les volumes. Je crois qu'on a besoin - // des 2, ce truc ne provoque pas de leaks. - Tree_Delete(M->Simplexes); - } - if(M->Points) { - Tree_Action(M->Points, Free_Vertex); - Tree_Delete(M->Points); - } - if(M->Curves) { - Tree_Action(M->Curves, Free_Curve); - Tree_Delete(M->Curves); - } - if(M->SurfaceLoops) { - //Tree_Action (M->SurfaceLoops, Free_SurfaceLoop); - Tree_Delete(M->SurfaceLoops); - } - if(M->EdgeLoops) { - //Tree_Action (M->EdgeLoops, Free_EdgeLoop); - Tree_Delete(M->EdgeLoops); - } - if(M->Surfaces) { - Tree_Action(M->Surfaces, Free_Surface); - Tree_Delete(M->Surfaces); - } - if(M->Volumes) { - Tree_Action(M->Volumes, Free_Volume); //produit des crashes innatendus... - Tree_Delete(M->Volumes); - } - if(M->PhysicalGroups) { - //Tree_Action (M->PhysicalGroups, Free_PhysicalGroup); - List_Delete(M->PhysicalGroups); - } + Tree_Action(M->Vertices, Free_Vertex); + Tree_Delete(M->Vertices); + + Tree_Action(M->VertexEdges, Free_Vertex); + Tree_Delete(M->VertexEdges); + + Tree_Action(M->Points, Free_Vertex); + Tree_Delete(M->Points); + + // Note: don't free the simplices here (with + // Tree_Action (M->Simplexes, Free_Simplex)): we free them + // in each curve, surface, volume + Tree_Delete(M->Simplexes); + + Tree_Action(M->Curves, Free_Curve); + Tree_Delete(M->Curves); + + //Tree_Action (M->SurfaceLoops, Free_SurfaceLoop); // todo + Tree_Delete(M->SurfaceLoops); + + //Tree_Action (M->EdgeLoops, Free_EdgeLoop); // todo + Tree_Delete(M->EdgeLoops); + + Tree_Action(M->Surfaces, Free_Surface); + Tree_Delete(M->Surfaces); + + Tree_Action(M->Volumes, Free_Volume); + Tree_Delete(M->Volumes); + + //Tree_Action (M->PhysicalGroups, Free_PhysicalGroup); // todo + List_Delete(M->PhysicalGroups); + if(M->Metric) { delete M->Metric; } diff --git a/Mesh/Read_Mesh.cpp b/Mesh/Read_Mesh.cpp index 89df548a5403dfb32dea8352898c0ab7d06be25f..16c8469ec97abba7528e90cf44087a49f2144678 100644 --- a/Mesh/Read_Mesh.cpp +++ b/Mesh/Read_Mesh.cpp @@ -1,4 +1,4 @@ -// $Id: Read_Mesh.cpp,v 1.50 2003-03-01 22:36:42 geuzaine Exp $ +// $Id: Read_Mesh.cpp,v 1.51 2003-03-10 04:26:32 geuzaine Exp $ // // Copyright (C) 1997 - 2003 C. Geuzaine, J.-F. Remacle // @@ -316,7 +316,11 @@ void Read_Mesh_MSH(Mesh * M, FILE * File_GEO) M->Statistics[12]++; break; case PNT: - Tree_Replace(M->Points, &vertsp[0]); + // we need to make a new one: vertices in M->Vertices and + // M->Points should never point to the same memory location + vert = Create_Vertex(vertsp[0]->Num, vertsp[0]->Pos.X, vertsp[0]->Pos.Y, + vertsp[0]->Pos.Z, vertsp[0]->lc, vertsp[0]->w); + Tree_Replace(M->Points, &vert); break; default: Msg(WARNING, "Unknown type of element in Read_Mesh"); diff --git a/doc/VERSIONS b/doc/VERSIONS index f185b27f1027f27f5246f72c62aee3a92b9054c3..2f87af90fdf95f2b930f319414913516eb4b0c23 100644 --- a/doc/VERSIONS +++ b/doc/VERSIONS @@ -1,7 +1,8 @@ -$Id: VERSIONS,v 1.133 2003-03-07 18:35:56 geuzaine Exp $ +$Id: VERSIONS,v 1.134 2003-03-10 04:26:32 geuzaine Exp $ New in 1.42: suppressed the automatic addition of a ".geo" extension -if the file given on the command line is not recognized; +if the file given on the command line is not recognized; fixed various +small bugs; New in 1.41: Gmsh is now licensed under the GNU General Public License; general code cleanup (indent);