diff --git a/Geo/GeomMeshMatcher.cpp b/Geo/GeomMeshMatcher.cpp index 195d8580fe6ccbd150414293c3ba111d88d35721..1d3b1f46c5bb1a55c6038a7f2293ef426aee0b3d 100644 --- a/Geo/GeomMeshMatcher.cpp +++ b/Geo/GeomMeshMatcher.cpp @@ -162,7 +162,7 @@ GeomMeshMatcher::matchEdges(GModel* m1, GModel* m2, if (v3 == v4) { Msg::Debug("Found a loop (%i) in the mesh %i %i", e2->tag(), v3->tag(), v3->tag()); common_edges.push_back(e2); - } + } } } else { //if (coresp_v->count(vfindMatching<GVertex*>(*coresp_v,v1)1) > 0 && coresp_v->count(v2) > 0) { @@ -212,7 +212,7 @@ GeomMeshMatcher::matchEdges(GModel* m1, GModel* m2, num_matched_edges++; } - + Msg::Info("Matched %i edges out of %i.", num_matched_edges, num_total_edges); if(num_matched_edges != num_total_edges) ok = false; return (coresp_e); @@ -238,12 +238,10 @@ GeomMeshMatcher:: matchFaces(GModel* m1, GModel* m2, std::vector<std::list<GFace*> > lists; std::list<GEdge*> boundary_edges = f1->edges(); - - int num_edge = 0; for (std::list<GEdge*>::iterator boundary_edge = boundary_edges.begin(); boundary_edge != boundary_edges.end(); boundary_edge++) { - + // if (boundary_edge->getBeginVertex() == boundary_edge->getEndVertex() && if (!(*boundary_edge)->isSeam(f1)) lists.push_back(findMatching<GEdge*>(*coresp_e,*boundary_edge)->faces()); @@ -257,12 +255,12 @@ GeomMeshMatcher:: matchFaces(GModel* m1, GModel* m2, Msg::Debug("Could not match face %i (geom).",f1->tag()); continue; } - + if (common_faces.size() == 1) { choice = common_faces[0]; - + } else { - + // Then, compute the minimal bounding box SOrientedBoundingBox geo_obb = f1->getOBB(); @@ -273,14 +271,14 @@ GeomMeshMatcher:: matchFaces(GModel* m1, GModel* m2, SOrientedBoundingBox mesh_obb = (*candidate)->getOBB(); Msg::Info("Comparing score : %f", SOrientedBoundingBox::compare(geo_obb,mesh_obb)); double score = SOrientedBoundingBox::compare(geo_obb,mesh_obb); - + if (score < best_score) { best_score = score; choice = (*candidate); } } } - + if (choice) { Msg::Debug("Faces %i (geom) and %i (mesh) match.",f1->tag(),choice->tag()); coresp_f->push_back(Pair<GFace*,GFace*>(f1,choice)); @@ -288,7 +286,7 @@ GeomMeshMatcher:: matchFaces(GModel* m1, GModel* m2, num_matched_faces++; } } - + Msg::Info("Matched %i faces out of %i.", num_matched_faces, num_total_faces); return coresp_f; @@ -313,10 +311,10 @@ GeomMeshMatcher::matchRegions(GModel* m1, GModel* m2, m2->getEntities(m2_entities,3); if (m1_entities.empty() || m2_entities.empty()) { - Msg::Info("No regions could be matched since one of the models doesn't have any"); + Msg::Info("No regions could be matched since one of the models doesn't have any"); return coresp_r; } - + for (std::vector<GEntity*>::iterator entity1 = m1_entities.begin(); entity1 != m1_entities.end(); @@ -595,7 +593,7 @@ static void copy_vertices (GVertex *to, GVertex *from, std::map<MVertex*,MVertex } } static void copy_vertices (GRegion *to, GRegion *from, std::map<MVertex*,MVertex*> &_mesh_to_geom){ - + to->deleteMesh(); if (from) { for (unsigned int i=0;i<from->mesh_vertices.size();i++){ @@ -670,13 +668,13 @@ static void copy_elements (std::vector<ELEMENT*> &to, } -void copy_vertices (GModel *geom, GModel *mesh, +void copy_vertices (GModel *geom, GModel *mesh, std::map<MVertex*,MVertex*> &_mesh_to_geom, std::vector<Pair<GVertex*, GVertex*> > *coresp_v, std::vector<Pair<GEdge* , GEdge* > > *coresp_e, std::vector<Pair<GFace* , GFace* > > *coresp_f, std::vector<Pair<GRegion*, GRegion*> > *coresp_r){ - + // copy all elements for (unsigned int i=0;i<coresp_v->size();++i) copy_vertices((*coresp_v)[i].first(),(*coresp_v)[i].second(),_mesh_to_geom); @@ -686,7 +684,7 @@ void copy_vertices (GModel *geom, GModel *mesh, copy_vertices((*coresp_f)[i].first(),(*coresp_f)[i].second(),_mesh_to_geom); for (unsigned int i=0;i<coresp_r->size();++i) copy_vertices((*coresp_r)[i].first(),(*coresp_r)[i].second(),_mesh_to_geom); - + // for (GModel::riter rit = geom->firstRegion() ; rit != geom->lastRegion(); rit++) // copy_vertices(*rit,mesh->getRegionByTag((*rit)->tag()),_mesh_to_geom); } @@ -695,28 +693,28 @@ void copy_elements (GModel *geom, GModel *mesh, std::map<MVertex*,MVertex*> &_me std::vector<Pair<GEdge* , GEdge* > > *coresp_e, std::vector<Pair<GFace* , GFace* > > *coresp_f, std::vector<Pair<GRegion*, GRegion*> > *coresp_r){ - + // copy all elements - + for (unsigned int i=0;i<coresp_v->size();++i) { GVertex* dest = (*coresp_v)[i].first(); GVertex* orig = (*coresp_v)[i].second(); copy_elements<MPoint>(dest->points,orig->points,_mesh_to_geom); } - + for (unsigned int i=0;i<coresp_e->size();++i) { GEdge* dest = (*coresp_e)[i].first(); GEdge* orig = (*coresp_e)[i].second(); copy_elements<MLine>(dest->lines,orig->lines,_mesh_to_geom); } - + for (unsigned int i=0;i<coresp_f->size();++i){ GFace* dest = (*coresp_f)[i].first(); GFace* orig = (*coresp_f)[i].second(); copy_elements<MTriangle> (dest->triangles ,orig->triangles ,_mesh_to_geom); copy_elements<MQuadrangle>(dest->quadrangles,orig->quadrangles,_mesh_to_geom); } - + for (unsigned int i=0;i<coresp_r->size();++i){ GRegion* dest = (*coresp_r)[i].first(); GRegion* orig = (*coresp_r)[i].second(); diff --git a/Plugin/DuplicateBoundaries.cpp b/Plugin/DuplicateBoundaries.cpp index 4cbced99b5c718fd98e3638d832d20368ba56a8d..d686d9651109eab4aa4d72f4d60ca3817bb320b9 100644 --- a/Plugin/DuplicateBoundaries.cpp +++ b/Plugin/DuplicateBoundaries.cpp @@ -1513,8 +1513,8 @@ PView *GMSH_DuplicateBoundariesPlugin::executeFourth(PView *view) std::map<GVertex*,GEdge* > SurroudingEdges; for (std::list<GVertex*>::iterator itv = vlist.begin();itv != vlist.end();itv++){ GVertex* vTmp = (*itv); - GVertex* v1; - GVertex* v2; + GVertex* v1=0; + GVertex* v2=0; std::map<std::pair<GVertex*,GRegion*>,GVertex* >::iterator itMap = GVertexGlobalAssociation.find(std::make_pair(vTmp,reg1)); if (itMap != GVertexGlobalAssociation.end()){ v1 = itMap->second; @@ -1534,8 +1534,8 @@ PView *GMSH_DuplicateBoundariesPlugin::executeFourth(PView *view) for (std::list<GEdge*>::iterator ite = elist.begin();ite != elist.end();ite++){ //duplication Gedge GEdge* eTmp = (*ite); - GEdge* e1; - GEdge* e2; + GEdge* e1=0; + GEdge* e2=0; std::map<std::pair<GEdge*,GRegion*>,GEdge* >::iterator itMap = GEdgeGlobalAssociation.find(std::make_pair(eTmp,reg1)); if (itMap != GEdgeGlobalAssociation.end()){ e1 = itMap->second; @@ -1601,12 +1601,12 @@ PView *GMSH_DuplicateBoundariesPlugin::executeFourth(PView *view) m->add(createdRegion); for (unsigned int i = 0; i < fTmp->getNumMeshElements();i++){ MElement* elem = fTmp->getMeshElement(i); - MVertex* v1; - MVertex* v2; - MVertex* v3; - MVertex* v4; - MVertex* v5; - MVertex* v6; + MVertex* v1=0; + MVertex* v2=0; + MVertex* v3=0; + MVertex* v4=0; + MVertex* v5=0; + MVertex* v6=0; std::map<std::pair<MVertex*,GRegion*>,MVertex* >::iterator itMap = VertexGlobalAssociation.find(std::make_pair(elem->getVertex(0),reg1)); if (itMap != VertexGlobalAssociation.end()){ v1 = itMap->second; @@ -1679,7 +1679,7 @@ PView *GMSH_DuplicateBoundariesPlugin::executeFourth(PView *view) std::map<GVertex*,GEdge* > SurroudingEdges; for (std::list<GVertex*>::iterator itv = vlist.begin();itv != vlist.end();itv++){ GVertex* vTmp = (*itv); - GVertex* v1; + GVertex* v1=0; std::map<std::pair<GVertex*,GRegion*>,GVertex* >::iterator itMap = GVertexGlobalAssociation.find(std::make_pair(vTmp,reg1)); if (itMap != GVertexGlobalAssociation.end()){ v1 = itMap->second; @@ -1695,7 +1695,7 @@ PView *GMSH_DuplicateBoundariesPlugin::executeFourth(PView *view) for (std::list<GEdge*>::iterator ite = elist.begin();ite != elist.end();ite++){ //duplication Gedge GEdge* eTmp = (*ite); - GEdge* e1; + GEdge* e1=0; std::map<std::pair<GEdge*,GRegion*>,GEdge* >::iterator itMap = GEdgeGlobalAssociation.find(std::make_pair(eTmp,reg1)); if (itMap != GEdgeGlobalAssociation.end()){ e1 = itMap->second; @@ -1752,9 +1752,9 @@ PView *GMSH_DuplicateBoundariesPlugin::executeFourth(PView *view) m->add(createdRegion); for (unsigned int i = 0; i < fTmp->getNumMeshElements();i++){ MElement* elem = fTmp->getMeshElement(i); - MVertex* v1; - MVertex* v2; - MVertex* v3; + MVertex* v1=0; + MVertex* v2=0; + MVertex* v3=0; std::map<std::pair<MVertex*,GRegion*>,MVertex* >::iterator itMap = VertexGlobalAssociation.find(std::make_pair(elem->getVertex(0),reg1)); if (itMap != VertexGlobalAssociation.end()){ v1 = itMap->second; @@ -2402,8 +2402,8 @@ PView *GMSH_DuplicateBoundariesPlugin::executeDuplicate(PView *view) std::map<GVertex*,GEdge* > SurroudingEdges; for (std::list<GVertex*>::iterator itv = vlist.begin();itv != vlist.end();itv++){ GVertex* vTmp = (*itv); - GVertex* v1; - GVertex* v2; + GVertex* v1=0; + GVertex* v2=0; std::map<std::pair<GVertex*,GRegion*>,GVertex* >::iterator itMap = GVertexGlobalAssociation.find(std::make_pair(vTmp,reg1)); if (itMap != GVertexGlobalAssociation.end()){ v1 = itMap->second; @@ -2423,8 +2423,8 @@ PView *GMSH_DuplicateBoundariesPlugin::executeDuplicate(PView *view) for (std::list<GEdge*>::iterator ite = elist.begin();ite != elist.end();ite++){ //duplication Gedge GEdge* eTmp = (*ite); - GEdge* e1; - GEdge* e2; + GEdge* e1=0; + GEdge* e2=0; std::map<std::pair<GEdge*,GRegion*>,GEdge* >::iterator itMap = GEdgeGlobalAssociation.find(std::make_pair(eTmp,reg1)); if (itMap != GEdgeGlobalAssociation.end()){ e1 = itMap->second; @@ -2490,12 +2490,12 @@ PView *GMSH_DuplicateBoundariesPlugin::executeDuplicate(PView *view) m->add(createdRegion); for (unsigned int i = 0; i < fTmp->getNumMeshElements();i++){ MElement* elem = fTmp->getMeshElement(i); - MVertex* v1; - MVertex* v2; - MVertex* v3; - MVertex* v4; - MVertex* v5; - MVertex* v6; + MVertex* v1=0; + MVertex* v2=0; + MVertex* v3=0; + MVertex* v4=0; + MVertex* v5=0; + MVertex* v6=0; std::map<std::pair<MVertex*,GRegion*>,MVertex* >::iterator itMap = VertexGlobalAssociation.find(std::make_pair(elem->getVertex(0),reg1)); if (itMap != VertexGlobalAssociation.end()){ v1 = itMap->second; @@ -2659,7 +2659,7 @@ PView *GMSH_DuplicateBoundariesPlugin::executeDuplicate(PView *view) std::map<GVertex*,GEdge* > SurroudingEdges; for (std::list<GVertex*>::iterator itv = vlist.begin();itv != vlist.end();itv++){ GVertex* vTmp = (*itv); - GVertex* v1; + GVertex* v1=0; std::map<std::pair<GVertex*,GRegion*>,GVertex* >::iterator itMap = GVertexGlobalAssociation.find(std::make_pair(vTmp,reg1)); if (itMap != GVertexGlobalAssociation.end()){ v1 = itMap->second; @@ -2675,7 +2675,7 @@ PView *GMSH_DuplicateBoundariesPlugin::executeDuplicate(PView *view) for (std::list<GEdge*>::iterator ite = elist.begin();ite != elist.end();ite++){ //duplication Gedge GEdge* eTmp = (*ite); - GEdge* e1; + GEdge* e1=0; std::map<std::pair<GEdge*,GRegion*>,GEdge* >::iterator itMap = GEdgeGlobalAssociation.find(std::make_pair(eTmp,reg1)); if (itMap != GEdgeGlobalAssociation.end()){ e1 = itMap->second; @@ -2732,9 +2732,9 @@ PView *GMSH_DuplicateBoundariesPlugin::executeDuplicate(PView *view) m->add(createdRegion); for (unsigned int i = 0; i < fTmp->getNumMeshElements();i++){ MElement* elem = fTmp->getMeshElement(i); - MVertex* v1; - MVertex* v2; - MVertex* v3; + MVertex* v1=0; + MVertex* v2=0; + MVertex* v3=0; std::map<std::pair<MVertex*,GRegion*>,MVertex* >::iterator itMap = VertexGlobalAssociation.find(std::make_pair(elem->getVertex(0),reg1)); if (itMap != VertexGlobalAssociation.end()){ v1 = itMap->second; @@ -3276,8 +3276,8 @@ PView *GMSH_DuplicateBoundariesPlugin::execute2D(PView *view) GVertex* vTmp = (*itv); std::cout<<"test1"<<std::endl; std::cout<<"on a fac1 "<<fac1->tag()<<" et fac2 "<<fac2->tag()<<" et vTmp "<<vTmp->tag()<<std::endl; - GVertex* v1; - GVertex* v2; + GVertex* v1=0; + GVertex* v2=0; std::map<std::pair<GVertex*,GFace*>,GVertex* >::iterator itMap = GVertexGlobalAssociation.find(std::make_pair(vTmp,fac1)); std::cout<<"test2"<<std::endl; if (itMap != GVertexGlobalAssociation.end()){ @@ -3305,8 +3305,8 @@ PView *GMSH_DuplicateBoundariesPlugin::execute2D(PView *view) std::vector<GFace*> SurroundingsFaces; //duplication Gedge // GEdge* eTmp = (*ite); - GEdge* e1; - GEdge* e2; + GEdge* e1=0; + GEdge* e2=0; std::map<std::pair<GEdge*,GFace*>,GEdge* >::iterator itMap = GEdgeGlobalAssociation.find(std::make_pair(eTmp,fac1)); if (itMap != GEdgeGlobalAssociation.end()){ e1 = itMap->second; @@ -3352,10 +3352,10 @@ PView *GMSH_DuplicateBoundariesPlugin::execute2D(PView *view) std::cout<<"eTmp->getNumMeshElements() "<<eTmp->getNumMeshElements()<<std::endl; for (unsigned int i = 0; i < eTmp->getNumMeshElements();i++){ MElement* elem = eTmp->getMeshElement(i); - MVertex* v1; - MVertex* v2; - MVertex* v3; - MVertex* v4; + MVertex* v1=0; + MVertex* v2=0; + MVertex* v3=0; + MVertex* v4=0; //MVertex* v5; //MVertex* v6; std::map<std::pair<MVertex*,GFace*>,MVertex* >::iterator itMap = VertexGlobalAssociation.find(std::make_pair(elem->getVertex(0),fac1)); @@ -3927,8 +3927,8 @@ PView *GMSH_DuplicateBoundariesPlugin::execute2DWithBound(PView *view) GVertex* vTmp = (*itv); // std::cout<<"test1"<<std::endl; // std::cout<<"on a fac1 "<<fac1->tag()<<" et fac2 "<<fac2->tag()<<" et vTmp "<<vTmp->tag()<<std::endl; - GVertex* v1; - GVertex* v2; + GVertex* v1=0; + GVertex* v2=0; std::map<std::pair<GVertex*,GFace*>,GVertex* >::iterator itMap = GVertexGlobalAssociation.find(std::make_pair(vTmp,fac1)); // std::cout<<"test2"<<std::endl; if (itMap != GVertexGlobalAssociation.end()){ @@ -3956,8 +3956,8 @@ PView *GMSH_DuplicateBoundariesPlugin::execute2DWithBound(PView *view) std::vector<GFace*> SurroundingsFaces; //duplication Gedge // GEdge* eTmp = (*ite); - GEdge* e1; - GEdge* e2; + GEdge* e1=0; + GEdge* e2=0; std::map<std::pair<GEdge*,GFace*>,GEdge* >::iterator itMap = GEdgeGlobalAssociation.find(std::make_pair(eTmp,fac1)); if (itMap != GEdgeGlobalAssociation.end()){ e1 = itMap->second; @@ -4003,10 +4003,10 @@ PView *GMSH_DuplicateBoundariesPlugin::execute2DWithBound(PView *view) // std::cout<<"eTmp->getNumMeshElements() "<<eTmp->getNumMeshElements()<<std::endl; for (unsigned int i = 0; i < eTmp->getNumMeshElements();i++){ MElement* elem = eTmp->getMeshElement(i); - MVertex* v1; - MVertex* v2; - MVertex* v3; - MVertex* v4; + MVertex* v1=0; + MVertex* v2=0; + MVertex* v3=0; + MVertex* v4=0; //MVertex* v5; //MVertex* v6; std::map<std::pair<MVertex*,GFace*>,MVertex* >::iterator itMap = VertexGlobalAssociation.find(std::make_pair(elem->getVertex(0),fac1)); @@ -4131,7 +4131,7 @@ PView *GMSH_DuplicateBoundariesPlugin::execute2DWithBound(PView *view) std::map<GVertex*,GEdge* > SurroudingEdges; for (std::list<GVertex*>::iterator itv = vlist.begin();itv != vlist.end();itv++){ GVertex* vTmp = (*itv); - GVertex* v1; + GVertex* v1=0; std::map<std::pair<GVertex*,GFace*>,GVertex* >::iterator itMap = GVertexGlobalAssociation.find(std::make_pair(vTmp,fac1)); if (itMap != GVertexGlobalAssociation.end()){ v1 = itMap->second; @@ -4147,7 +4147,7 @@ PView *GMSH_DuplicateBoundariesPlugin::execute2DWithBound(PView *view) // for (std::list<GEdge*>::iterator ite = elist.begin();ite != elist.end();ite++){ //duplication Gedge // GEdge* eTmp = (*ite); - GEdge* e1; + GEdge* e1=0; std::map<std::pair<GEdge*,GFace*>,GEdge* >::iterator itMap = GEdgeGlobalAssociation.find(std::make_pair(eTmp,fac1)); if (itMap != GEdgeGlobalAssociation.end()){ e1 = itMap->second; @@ -4204,8 +4204,8 @@ PView *GMSH_DuplicateBoundariesPlugin::execute2DWithBound(PView *view) // m->add(createdRegion); for (unsigned int i = 0; i < eTmp->getNumMeshElements();i++){ MElement* elem = eTmp->getMeshElement(i); - MVertex* v1; - MVertex* v2; + MVertex* v1=0; + MVertex* v2=0; //MVertex* v3; std::map<std::pair<MVertex*,GFace*>,MVertex* >::iterator itMap = VertexGlobalAssociation.find(std::make_pair(elem->getVertex(0),fac1)); if (itMap != VertexGlobalAssociation.end()){ @@ -4673,8 +4673,8 @@ PView *GMSH_DuplicateBoundariesPlugin::executeTer(PView *view) std::map<GVertex*,GEdge* > SurroudingEdges; for (std::list<GVertex*>::iterator itv = vlist.begin();itv != vlist.end();itv++){ GVertex* vTmp = (*itv); - GVertex* v1; - GVertex* v2; + GVertex* v1=0; + GVertex* v2=0; std::map<std::pair<GVertex*,GRegion*>,GVertex* >::iterator itMap = GVertexGlobalAssociation.find(std::make_pair(vTmp,reg1)); if (itMap != GVertexGlobalAssociation.end()){ v1 = itMap->second; @@ -4694,8 +4694,8 @@ PView *GMSH_DuplicateBoundariesPlugin::executeTer(PView *view) for (std::list<GEdge*>::iterator ite = elist.begin();ite != elist.end();ite++){ //duplication Gedge GEdge* eTmp = (*ite); - GEdge* e1; - GEdge* e2; + GEdge* e1=0; + GEdge* e2=0; std::map<std::pair<GEdge*,GRegion*>,GEdge* >::iterator itMap = GEdgeGlobalAssociation.find(std::make_pair(eTmp,reg1)); if (itMap != GEdgeGlobalAssociation.end()){ e1 = itMap->second; @@ -4761,12 +4761,12 @@ PView *GMSH_DuplicateBoundariesPlugin::executeTer(PView *view) m->add(createdRegion); for (unsigned int i = 0; i < fTmp->getNumMeshElements();i++){ MElement* elem = fTmp->getMeshElement(i); - MVertex* v1; - MVertex* v2; - MVertex* v3; - MVertex* v4; - MVertex* v5; - MVertex* v6; + MVertex* v1=0; + MVertex* v2=0; + MVertex* v3=0; + MVertex* v4=0; + MVertex* v5=0; + MVertex* v6=0; std::map<std::pair<MVertex*,GRegion*>,MVertex* >::iterator itMap = VertexGlobalAssociation.find(std::make_pair(elem->getVertex(0),reg1)); if (itMap != VertexGlobalAssociation.end()){ v1 = itMap->second;