From fc1cf1d0d408af8ed229a1b0cc37f29c7978edbf Mon Sep 17 00:00:00 2001 From: ageay Date: Tue, 31 Jan 2012 12:03:21 +0000 Subject: [PATCH] *** empty log message *** --- src/MEDCoupling/MEDCouplingUMesh.cxx | 42 +++++++++------------------- 1 file changed, 13 insertions(+), 29 deletions(-) diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index 224fa7b85..2eb8fee7e 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -2571,12 +2571,11 @@ namespace ParaMEDMEM return new INTERP_KERNEL::Node(coo1[2*nodeId],coo1[2*nodeId+1]); } - void MEDCouplingUMeshBuildQPFromMesh2(const double *coo1, int offset1, const double *coo2, int offset2, const std::vector& addCoo, + void MEDCouplingUMeshBuildQPFromMesh3(const double *coo1, int offset1, const double *coo2, int offset2, const std::vector& addCoo, bool isQuad1, const int *desc1Bg, const int *desc1End, const std::vector >& intesctEdges1, - bool isQuad2, const int *desc2Bg, const int *desc2End, const std::vector >& intesctEdges2, - /*output*/INTERP_KERNEL::QuadraticPolygon& pol1, INTERP_KERNEL::QuadraticPolygon& pol2, std::map& mapp) + /*output*/INTERP_KERNEL::QuadraticPolygon& pol1, std::map& mapp, std::map& mappRev) { - std::map mappRev; + std::set nodesToKill; for(const int *desc1=desc1Bg;desc1!=desc1End;desc1++) { int eltId1=abs(*desc1)-1; @@ -2588,29 +2587,11 @@ namespace ParaMEDMEM INTERP_KERNEL::Node *node=MEDCouplingUMeshBuildQPNode(*it1,coo1,offset1,coo2,offset2,addCoo); mapp[node]=*it1; mappRev[*it1]=node; + nodesToKill.insert(node); } } } - for(const int *desc2=desc2Bg;desc2!=desc2End;desc2++) - { - int eltId2=abs(*desc2)-1; - for(std::vector::const_iterator it2=intesctEdges2[eltId2].begin();it2!=intesctEdges2[eltId2].end();it2++) - { - int curNodeId2=*it2; - std::map::const_iterator it=mappRev.find(curNodeId2); - if(it==mappRev.end()) - { - INTERP_KERNEL::Node *node=MEDCouplingUMeshBuildQPNode(curNodeId2,coo1,offset1,coo2,offset2,addCoo); - mapp[node]=curNodeId2; - mappRev[curNodeId2]=node; - } - } - } - // pol1.buildFromCrudeDataArray(mappRev,isQuad1,desc1Bg,desc1End,intesctEdges1); - pol2.buildFromCrudeDataArray(mappRev,isQuad2,desc2Bg,desc2End,intesctEdges2); - for(std::map::const_iterator it=mappRev.begin();it!=mappRev.end();it++) - (*it).second->decrRef(); } } @@ -4858,16 +4839,19 @@ void MEDCouplingUMesh::BuildIntersecting2DCellsFromEdges(double eps, const MEDCo { std::vector candidates2; myTree.getIntersectingElems(&bbox1[i*2*SPACEDIM],candidates2); + std::map mapp; + std::map mappRev; + INTERP_KERNEL::QuadraticPolygon pol1; + MEDCouplingUMeshBuildQPFromMesh3(coo1,offset1,coo2,offset2,addCoords,b1[i],desc1+descIndx1[i],desc1+descIndx1[i+1],intesctEdges1,/* output */pol1,mapp,mappRev); for(std::vector::const_iterator it2=candidates2.begin();it2!=candidates2.end();it2++) { - INTERP_KERNEL::QuadraticPolygon pol1,pol2; - std::map mapp; - MEDCouplingUMeshBuildQPFromMesh2(coo1,offset1,coo2,offset2,addCoords, - b1[i],desc1+descIndx1[i],desc1+descIndx1[i+1],intesctEdges1, - b2[*it2],desc2+descIndx2[*it2],desc2+descIndx2[*it2+1],intesctEdges2, - /* output */pol1,pol2,mapp); + INTERP_KERNEL::QuadraticPolygon pol2; + pol1.initLocations(); + MEDCouplingUMeshBuildQPFromMesh3(coo1,offset1,coo2,offset2,addCoords,b2[*it2],desc2+descIndx2[*it2],desc2+descIndx2[*it2+1],intesctEdges2,/* output */pol2,mapp,mappRev); pol1.buildPartitionsAbs(pol2,mapp,i,*it2,cr,crI,cNb1,cNb2); } + for(std::map::const_iterator it=mappRev.begin();it!=mappRev.end();it++) + (*it).second->decrRef(); } } -- 2.39.2