From: ageay Date: Tue, 7 Feb 2012 09:11:10 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: V6_main_FINAL~887 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8242bf573b48cc481710e61fa12aac39aadf7f87;p=tools%2Fmedcoupling.git *** empty log message *** --- diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DComposedEdge.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DComposedEdge.cxx index 95405817d..592ee26ad 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DComposedEdge.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DComposedEdge.cxx @@ -108,6 +108,14 @@ void ComposedEdge::reverse() (*iter)->reverse(); } +bool ComposedEdge::presenceOfOn() const +{ + bool ret=false; + for(std::list::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end() && !ret;iter++) + ret=((*iter)->getLoc()==FULL_ON_1); + return ret; +} + void ComposedEdge::initLocations() const { for(std::list::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++) diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DComposedEdge.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DComposedEdge.hxx index 4f0a2bac1..248f9738b 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DComposedEdge.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DComposedEdge.hxx @@ -46,6 +46,7 @@ namespace INTERP_KERNEL static void SoftDelete(ComposedEdge *pt) { pt->_sub_edges.clear(); delete pt; } void reverse(); int recursiveSize() const { return (int)_sub_edges.size(); } + bool presenceOfOn() const; void initLocations() const; ComposedEdge *clone() const; bool isNodeIn(Node *n) const; diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx index 19c8a8001..d2a262b45 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx @@ -215,10 +215,11 @@ double QuadraticPolygon::intersectWithAbs(QuadraticPolygon& other) * Size of 'otherEdgeIds' has to be equal to number of ElementaryEdges in 'other'. No check of that will be done. * @param offset1 is the number of nodes contained in global mesh from which 'this' is extracted. * @param offset2 is the sum of nodes contained in global mesh from which 'this' is extracted and 'other' is extracted. + * @param edgesInOtherColinearWithThis will be appended at the end of the vector with colinear edge ids of other (if any) * @otherEdgeIds is a vector with the same size than other before calling this method. It gives in the same order the cell id in global other mesh. */ void QuadraticPolygon::splitAbs(QuadraticPolygon& other, const std::map& mapThis, const std::map& mapOther, int offset1, int offset2 , const std::vector& otherEdgeIds, - std::vector& edgesThis, std::vector< std::vector >& subDivOther, std::vector& addCoo) + std::vector& edgesThis, int cellIdThis, std::vector< std::vector >& edgesInOtherColinearWithThis, std::vector< std::vector >& subDivOther, std::vector& addCoo) { double xBaryBB, yBaryBB; double fact=normalize(&other, xBaryBB, yBaryBB); @@ -271,6 +272,8 @@ void QuadraticPolygon::splitAbs(QuadraticPolygon& other, const std::map1) { for(std::list::const_iterator it=otherTmp._sub_edges.begin();it!=otherTmp._sub_edges.end();it++) @@ -308,6 +311,86 @@ void QuadraticPolygon::buildFromCrudeDataArray(const std::map& mapp, bool isQuad, const int *descBg, const int *descEnd, const std::vector >& intersectEdges, + const INTERP_KERNEL::QuadraticPolygon& pol1, const int *descBg1, const int *descEnd1, const std::vector >& intersectEdges1, + const std::vector< std::vector >& colinear1) +{ + std::size_t nbOfSeg=std::distance(descBg,descEnd); + for(std::size_t i=0;i0; + int edgeId=abs(descBg[i])-1; + bool directos=colinear1[edgeId].empty(); + int idIn1=-1; + int offset1=0; + if(!directos) + { + const std::vector& c=colinear1[edgeId]; + std::size_t nbOfEdgesIn1=std::distance(descBg1,descEnd1); + for(std::size_t j=0;j& subEdge=intersectEdges[edgeId]; + std::size_t nbOfSubEdges=subEdge.size()/2; + if(directos) + { + for(std::size_t j=0;j& subEdge1PossiblyAlreadyIn1=intersectEdges1[idIn1]; + for(std::size_t j=0;jgetPtr(); + ee->incrRef(); ee->declareOn(); + pushBack(new ElementaryEdge(ee,direction11)); + } + } + } + } +} + void QuadraticPolygon::appendCrudeData(const std::map& mapp, std::vector& conn, std::vector& connI) { int nbOfNodesInPg=0; diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.hxx index d4555445a..8ccbde27f 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.hxx @@ -55,8 +55,11 @@ namespace INTERP_KERNEL //! Before intersecting as intersectWith a normalization is done. double intersectWithAbs(QuadraticPolygon& other, double* barycenter); void splitAbs(QuadraticPolygon& other, const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, const std::vector& otherEdgeIds, - std::vector& edgesThis, std::vector< std::vector >& subDivOther, std::vector& addCoo); + std::vector& edgesThis, int cellIdThis, std::vector< std::vector >& edgesInOtherColinearWithThis, std::vector< std::vector >& subDivOther, std::vector& addCoo); void buildFromCrudeDataArray(const std::map& mapp, bool isQuad, const int *descBg, const int *descEnd, const std::vector >& intersectEdges); + void buildFromCrudeDataArray2(const std::map& mapp, bool isQuad, const int *descBg, const int *descEnd, const std::vector >& intersectEdges, + const INTERP_KERNEL::QuadraticPolygon& pol1, const int *descBg1, const int *descEnd1, const std::vector >& intersectEdges1, + const std::vector< std::vector >& colinear1); void appendCrudeData(const std::map& mapp, std::vector& conn, std::vector& connI); void buildPartitionsAbs(QuadraticPolygon& other, const std::map& mapp, int idThis, int idOther, std::vector& conn, std::vector& connI, std::vector& nb1, std::vector& nb2); diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index 3f7fb4ffb..d5a15397a 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -2572,10 +2572,9 @@ namespace ParaMEDMEM } 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, - /*output*/INTERP_KERNEL::QuadraticPolygon& pol1, std::map& mapp, std::map& mappRev) + const int *desc1Bg, const int *desc1End, const std::vector >& intesctEdges1, + /*output*/std::map& mapp, std::map& mappRev) { - std::set nodesToKill; for(const int *desc1=desc1Bg;desc1!=desc1End;desc1++) { int eltId1=abs(*desc1)-1; @@ -2587,12 +2586,31 @@ namespace ParaMEDMEM INTERP_KERNEL::Node *node=MEDCouplingUMeshBuildQPNode(*it1,coo1,offset1,coo2,offset2,addCoo); mapp[node]=*it1; mappRev[*it1]=node; - nodesToKill.insert(node); } } } - pol1.buildFromCrudeDataArray(mappRev,isQuad1,desc1Bg,desc1End,intesctEdges1); } + + /*void MEDCouplingUMeshAssignOnLoc(const INTERP_KERNEL::QuadraticPolygon& pol1, INTERP_KERNEL::QuadraticPolygon& pol2, + const int *desc1Bg, const int *desc1End,const std::vector >& intesctEdges1, + const int *desc2Bg, const int *desc2End,const std::vector >& intesctEdges2, + const std::vector >& colinear1) + { + for(const int *desc1=desc1Bg;desc1!=desc1End;desc1++) + { + int eltId1=abs(*desc1)-1; + for(std::vector::const_iterator it1=intesctEdges1[eltId1].begin();it1!=intesctEdges1[eltId1].end();it1++) + { + std::map::const_iterator it=mappRev.find(*it1); + if(it==mappRev.end()) + { + INTERP_KERNEL::Node *node=MEDCouplingUMeshBuildQPNode(*it1,coo1,offset1,coo2,offset2,addCoo); + mapp[node]=*it1; + mappRev[*it1]=node; + } + } + } + }*/ } /// @endcond @@ -4782,12 +4800,12 @@ std::string MEDCouplingUMesh::getVTKDataSetType() const throw(INTERP_KERNEL::Exc MEDCouplingUMesh *MEDCouplingUMesh::Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps, DataArrayInt *&cellNb1, DataArrayInt *&cellNb2) throw(INTERP_KERNEL::Exception) { - std::vector< std::vector > intersectEdge1, subDiv2; + std::vector< std::vector > intersectEdge1, colinear2, subDiv2; MEDCouplingUMesh *m1Desc=0,*m2Desc=0; DataArrayInt *desc1=0,*descIndx1=0,*revDesc1=0,*revDescIndx1=0,*desc2=0,*descIndx2=0,*revDesc2=0,*revDescIndx2=0; std::vector addCoo; INTERP_KERNEL::QUADRATIC_PLANAR::_precision=eps; - IntersectDescending2DMeshes(m1,m2,eps,intersectEdge1,subDiv2,m1Desc,desc1,descIndx1,revDesc1,revDescIndx1, + IntersectDescending2DMeshes(m1,m2,eps,intersectEdge1,colinear2, subDiv2,m1Desc,desc1,descIndx1,revDesc1,revDescIndx1, m2Desc,desc2,descIndx2,revDesc2,revDescIndx2,addCoo); revDesc1->decrRef(); revDescIndx1->decrRef(); revDesc2->decrRef(); revDescIndx2->decrRef(); std::vector< std::vector > intersectEdge2; @@ -4797,7 +4815,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::Intersect2DMeshes(const MEDCouplingUMesh *m1 subDiv2.clear(); m1Desc->decrRef(); m2Desc->decrRef(); std::vector cr,crI; std::vector cNb1,cNb2; - BuildIntersecting2DCellsFromEdges(eps,m1,b1,desc1->getConstPointer(),descIndx1->getConstPointer(),intersectEdge1,m2,b2,desc2->getConstPointer(),descIndx2->getConstPointer(),intersectEdge2,addCoo, + BuildIntersecting2DCellsFromEdges(eps,m1,b1,desc1->getConstPointer(),descIndx1->getConstPointer(),intersectEdge1,colinear2,m2,b2,desc2->getConstPointer(),descIndx2->getConstPointer(),intersectEdge2,addCoo, /* outputs -> */cr,crI,cNb1,cNb2); // MEDCouplingAutoRefCountObjectPtr addCooDa=DataArrayDouble::New(); @@ -4819,7 +4837,8 @@ MEDCouplingUMesh *MEDCouplingUMesh::Intersect2DMeshes(const MEDCouplingUMesh *m1 /// @endcond -void MEDCouplingUMesh::BuildIntersecting2DCellsFromEdges(double eps, const MEDCouplingUMesh *m1, const std::vector& b1, const int *desc1, const int *descIndx1, const std::vector >& intesctEdges1, +void MEDCouplingUMesh::BuildIntersecting2DCellsFromEdges(double eps, const MEDCouplingUMesh *m1, const std::vector& b1, const int *desc1, const int *descIndx1, + const std::vector >& intesctEdges1, const std::vector< std::vector >& colinear2, const MEDCouplingUMesh *m2, const std::vector& b2, const int *desc2, const int *descIndx2, const std::vector >& intesctEdges2, const std::vector& addCoords, std::vector& cr, std::vector& crI, std::vector& cNb1, std::vector& cNb2) @@ -4842,14 +4861,18 @@ void MEDCouplingUMesh::BuildIntersecting2DCellsFromEdges(double eps, const MEDCo 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); + MEDCouplingUMeshBuildQPFromMesh3(coo1,offset1,coo2,offset2,addCoords,desc1+descIndx1[i],desc1+descIndx1[i+1],intesctEdges1,/* output */mapp,mappRev); + pol1.buildFromCrudeDataArray(mappRev,b1[i],desc1+descIndx1[i],desc1+descIndx1[i+1],intesctEdges1); std::vector crTmp,crITmp; crITmp.push_back(crI.back()); for(std::vector::const_iterator it2=candidates2.begin();it2!=candidates2.end();it2++) { 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); + MEDCouplingUMeshBuildQPFromMesh3(coo1,offset1,coo2,offset2,addCoords,desc2+descIndx2[*it2],desc2+descIndx2[*it2+1],intesctEdges2,/* output */mapp,mappRev); + pol2.buildFromCrudeDataArray2(mappRev,b2[i],desc2+descIndx2[*it2],desc2+descIndx2[*it2+1],intesctEdges2, + pol1,desc1+descIndx1[i],desc1+descIndx1[i+1],intesctEdges1,colinear2); + //MEDCouplingUMeshAssignOnLoc(pol1,pol2,desc1+descIndx1[i],desc1+descIndx1[i+1],intesctEdges1,desc2+descIndx2[*it2],desc2+descIndx2[*it2+1],intesctEdges2,colinear2); pol1.buildPartitionsAbs(pol2,mapp,i,*it2,cr,crI,cNb1,cNb2); } if(!crTmp.empty()) @@ -4867,7 +4890,7 @@ void MEDCouplingUMesh::BuildIntersecting2DCellsFromEdges(double eps, const MEDCo * */ void MEDCouplingUMesh::IntersectDescending2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps, - std::vector< std::vector >& intersectEdge1, std::vector< std::vector >& subDiv2, + std::vector< std::vector >& intersectEdge1, std::vector< std::vector >& colinear2, std::vector< std::vector >& subDiv2, MEDCouplingUMesh *& m1Desc, DataArrayInt *&desc1, DataArrayInt *&descIndx1, DataArrayInt *&revDesc1, DataArrayInt *&revDescIndx1, MEDCouplingUMesh *& m2Desc, DataArrayInt *&desc2, DataArrayInt *&descIndx2, DataArrayInt *&revDesc2, DataArrayInt *&revDescIndx2, std::vector& addCoo) throw(INTERP_KERNEL::Exception) @@ -4885,6 +4908,7 @@ void MEDCouplingUMesh::IntersectDescending2DMeshes(const MEDCouplingUMesh *m1, c int ncell1=m1Desc->getNumberOfCells(); int ncell2=m2Desc->getNumberOfCells(); intersectEdge1.resize(ncell1); + colinear2.resize(ncell1); subDiv2.resize(ncell2); BBTree myTree(&bbox2[0],0,0,m2Desc->getNumberOfCells(),-eps); std::vector candidates1(1); @@ -4900,7 +4924,7 @@ void MEDCouplingUMesh::IntersectDescending2DMeshes(const MEDCouplingUMesh *m1, c INTERP_KERNEL::QuadraticPolygon *pol2=MEDCouplingUMeshBuildQPFromMesh(m2Desc,candidates2,map2); candidates1[0]=i; INTERP_KERNEL::QuadraticPolygon *pol1=MEDCouplingUMeshBuildQPFromMesh(m1Desc,candidates1,map1); - pol1->splitAbs(*pol2,map1,map2,offset1,offset2,candidates2,intersectEdge1[i],subDiv2,addCoo); + pol1->splitAbs(*pol2,map1,map2,offset1,offset2,candidates2,intersectEdge1[i],i,colinear2,subDiv2,addCoo); delete pol2; delete pol1; } diff --git a/src/MEDCoupling/MEDCouplingUMesh.hxx b/src/MEDCoupling/MEDCouplingUMesh.hxx index 5f2bbadb1..d9aec073c 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.hxx +++ b/src/MEDCoupling/MEDCouplingUMesh.hxx @@ -88,7 +88,6 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings); MEDCOUPLING_EXPORT std::string getVTKDataSetType() const throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData) const throw(INTERP_KERNEL::Exception); - MEDCOUPLING_EXPORT void writeVTK(const char *fileName) const throw(INTERP_KERNEL::Exception); //tools MEDCOUPLING_EXPORT bool areCellsEqual(int cell1, int cell2, int compType) const; MEDCOUPLING_EXPORT bool areCellsEqual0(int cell1, int cell2) const; @@ -216,12 +215,12 @@ namespace ParaMEDMEM static void FillInCompact3DMode(int spaceDim, int nbOfNodesInCell, const int *conn, const double *coo, double *zipFrmt) throw(INTERP_KERNEL::Exception); static void AppendExtrudedCell(const int *connBg, const int *connEnd, int nbOfNodesPerLev, bool isQuad, std::vector& ret); static void IntersectDescending2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps, - std::vector< std::vector >& intersectEdge1, std::vector< std::vector >& subDiv2, + std::vector< std::vector >& intersectEdge1, std::vector< std::vector >& colinear2, std::vector< std::vector >& subDiv2, MEDCouplingUMesh *& m1Desc, DataArrayInt *&desc1, DataArrayInt *&descIndx1, DataArrayInt *&revDesc1, DataArrayInt *&revDescIndx1, MEDCouplingUMesh *& m2Desc, DataArrayInt *&desc2, DataArrayInt *&descIndx2, DataArrayInt *&revDesc2, DataArrayInt *&revDescIndx2, std::vector& addCoo) throw(INTERP_KERNEL::Exception); static void BuildIntersectEdges(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, const std::vector& addCoo, const std::vector< std::vector >& subDiv, std::vector< std::vector >& intersectEdge) throw(INTERP_KERNEL::Exception); - static void BuildIntersecting2DCellsFromEdges(double eps, const MEDCouplingUMesh *m1, const std::vector& b1, const int *desc1, const int *descIndx1, const std::vector >& intesctEdges1, + static void BuildIntersecting2DCellsFromEdges(double eps, const MEDCouplingUMesh *m1, const std::vector& b1, const int *desc1, const int *descIndx1, const std::vector >& intesctEdges1, const std::vector< std::vector >& colinear2, const MEDCouplingUMesh *m2, const std::vector& b2, const int *desc2, const int *descIndx2, const std::vector >& intesctEdges2, const std::vector& addCoords, std::vector& cr, std::vector& crI, std::vector& cNb1, std::vector& cNb2);