diff --git a/Geo/GModelIO_MSH2.cpp b/Geo/GModelIO_MSH2.cpp index 3b41ed2131fe78d09821fad1fcc71d0d957dd4c7..2c796db92ebe2fe6862eb98646a22ebf2862f312 100644 --- a/Geo/GModelIO_MSH2.cpp +++ b/Geo/GModelIO_MSH2.cpp @@ -414,6 +414,7 @@ int GModel::_readMSH2(const std::string &name) std::vector<MVertex*> vertices; if(vertexVector.size()){ if(!getVertices(numVertices, indices, vertexVector, vertices, minVertex)){ + delete [] indices; fclose(fp); return 0; } @@ -536,6 +537,7 @@ int GModel::_readMSH2(const std::string &name) std::vector<MVertex*> vertices; if(vertexVector.size()){ if(!getVertices(numVertices, indices, vertexVector, vertices, minVertex)){ + delete [] data; fclose(fp); return 0; } @@ -844,7 +846,7 @@ int GModel::_writeMSH2(const std::string &name, double version, bool binary, bool saveAll, bool saveParametric, double scalingFactor, int elementStartNum, int saveSinglePartition, bool multipleView) { - + FILE *fp; if(multipleView) fp = Fopen(name.c_str(), binary ? "ab" : "a"); diff --git a/Geo/GRbf.cpp b/Geo/GRbf.cpp index 30965a0517a8b16c6a365be2c62531d62dd8980e..b3a0d8bfb6b7f72b82faeea400ca067ccdf4c0bc 100644 --- a/Geo/GRbf.cpp +++ b/Geo/GRbf.cpp @@ -232,6 +232,8 @@ void GRbf::buildOctree(double radius) } Octree_Delete(oct); + delete [] _sph; + buildXYZkdtree(); } diff --git a/Geo/Geo.cpp b/Geo/Geo.cpp index 9f5b2f1cb6bfac2d69a4862c74fea38d97c48ac9..ff306d8a5b826150ab95ad2e6d00d7bb99ee9943 100644 --- a/Geo/Geo.cpp +++ b/Geo/Geo.cpp @@ -2228,9 +2228,10 @@ static List_T* GetOrderedUniqueEdges(Surface *s) for(int i = 0; i < numgen; i++){ Curve *ctemp = 0; List_Read(unique, i, &ctemp); - if( !ctemp ){ + if(!ctemp){ Msg::Error("No such curve"); List_Delete(gen_nums); + List_Delete(unique); return 0; } List_Add(gen_nums, &(ctemp->Num)); @@ -2244,9 +2245,10 @@ static List_T* GetOrderedUniqueEdges(Surface *s) Curve *ctemp = 0; int j; List_Read(gen_nums, i, &j); - if( !(ctemp = FindCurve(j)) ){ + if(!(ctemp = FindCurve(j))){ Msg::Error("No such curve %d", j); List_Delete(gen_nums); + List_Delete(unique); return 0; } List_Add(unique, &ctemp); @@ -2384,8 +2386,7 @@ static void ReplaceDuplicatePointsNew(double tol = -1.) for(int i = 0; i < List_Nbr(tmp); i++) { Vertex *V; List_Read(tmp, i, &V); - Vertex *found = v2V[pos.find(V->Pos.X, V->Pos.Y, V->Pos.Z, tol)]; - // printf("v(%d) = %d\n",V->Num,found->Num); + pos.find(V->Pos.X, V->Pos.Y, V->Pos.Z, tol); } List_Delete(tmp); @@ -2806,12 +2807,12 @@ static void ReplaceDuplicateCurves(std::map<int, int> * c_report = 0) */ static void RemoveDegenerateCurves(){ - + { // remove degenerate curves from surface generatrices List_T *All = Tree2List(GModel::current()->getGEOInternals()->Surfaces); for(int i = 0; i < List_Nbr(All); i++) { Surface *s; - List_Read(All, i, &s); + List_Read(All, i, &s); List_T *ll = s->Generatrices; s->Generatrices = List_Create(4, 1, sizeof(Curve *)); // List_Delete(s->GeneratricesByTag); @@ -2838,7 +2839,7 @@ static void RemoveDegenerateCurves(){ DeleteCurve(c->Num); // DeleteCurve(-c->Num); } - } + } } } @@ -2857,14 +2858,14 @@ static void RemoveDegenerateVolumes(){ else unique.erase(it); } if (N-unique.size()) Msg::Info("Coherence : Removing %d seams on Volume %d",N-unique.size(),v->Num); - + List_T *ll= v->Surfaces; List_T *ll2= v->SurfacesOrientations; v->Surfaces = List_Create(1, 2, sizeof(Surface *)); v->SurfacesOrientations = List_Create(1, 2, sizeof(int)); for(int j = 0; j < List_Nbr(ll); j++) { Surface *s; - List_Read(ll, j, &s); + List_Read(ll, j, &s); if (unique.find(s->Num) != unique.end()){ List_Add(v->Surfaces,&s); List_Add(v->SurfacesOrientations, List_Pointer(ll2, j)); @@ -2902,7 +2903,7 @@ static void RemoveDegenerateSurfaces(){ // s->GeneratricesByTag = List_Create(4, 1, sizeof(int)); for(int j = 0; j < List_Nbr(ll); j++) { Curve *c; - List_Read(ll, j, &c); + List_Read(ll, j, &c); if (unique.find(c->Num) != unique.end()){ List_Add(s->Generatrices,&c); // List_Add(s->GeneratricesByTag, &c->Num); @@ -2931,7 +2932,7 @@ static void RemoveDegenerateSurfaces(){ } DeleteSurface(s->Num); } - } + } } bool Surface::degenerate() const { diff --git a/Geo/GeomMeshMatcher.cpp b/Geo/GeomMeshMatcher.cpp index b1c28419b1a98beae5ed12c4ebf7608d99a8f56b..29efce6b0c05eb439f3b04a58777774091a39a56 100644 --- a/Geo/GeomMeshMatcher.cpp +++ b/Geo/GeomMeshMatcher.cpp @@ -705,7 +705,8 @@ int GeomMeshMatcher::match(GModel *geom, GModel *mesh) // This will match SURFACES std::vector<Pair<GFace*, GFace*> > *coresp_f = matchFaces(geom, mesh, coresp_e,ok); - matchRegions(geom, mesh, coresp_f,ok); + + std::vector<Pair<GRegion*, GRegion*> > *coresp_r = matchRegions(geom, mesh, coresp_f,ok); std::map<MVertex*,MVertex*> _mesh_to_geom; copy_vertices(geom, mesh, _mesh_to_geom,coresp_v,coresp_e,coresp_f); @@ -714,6 +715,7 @@ int GeomMeshMatcher::match(GModel *geom, GModel *mesh) delete coresp_v; delete coresp_e; delete coresp_f; + delete coresp_r; return 1; }