From: ageay Date: Fri, 17 Feb 2012 11:11:20 +0000 (+0000) Subject: sortByIds is no more a virtual method of Edges. X-Git-Tag: V6_main_FINAL~845 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f4a18fd8017ee809f9bb7b82509c3639c30d7066;p=tools%2Fmedcoupling.git sortByIds is no more a virtual method of Edges. --- diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx index 155f59070..ac1f191a0 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx @@ -854,3 +854,58 @@ bool Edge::isEqual(const Edge& other) const { return _start->isEqual(*other._start) && _end->isEqual(*other._end); } + +inline bool eqpair(const std::pair& p1, const std::pair& p2) +{ + return fabs(p1.first-p2.first)& addNodes, const std::map& mapp1, const std::map& mapp2, std::vector& edgesThis) +{ + Bounds b; + b.prepareForAggregation(); + b.aggregate(getBounds()); + double xBary,yBary; + double dimChar=b.getCaracteristicDim(); + b.getBarycenter(xBary,yBary); + for(std::vector::const_iterator iter=addNodes.begin();iter!=addNodes.end();iter++) + (*iter)->applySimilarity(xBary,yBary,dimChar); + _start->applySimilarity(xBary,yBary,dimChar); + _end->applySimilarity(xBary,yBary,dimChar); + std::size_t sz=addNodes.size(); + std::vector< std::pair > an2(sz); + for(std::size_t i=0;i(getCharactValue(*addNodes[i]),addNodes[i]); + std::sort(an2.begin(),an2.end()); + int startId=(*mapp1.find(_start)).second; + int endId=(*mapp1.find(_end)).second; + std::vector tmpp; + std::vector< std::pair >::const_iterator itend=std::unique(an2.begin(),an2.end(),eqpair); + for(std::vector< std::pair >::const_iterator it=an2.begin();it!=itend;it++) + { + int idd=(*mapp2.find((*it).second)).second; + if((*it).first1-QUADRATIC_PLANAR::_precision) + { + endId=idd; + continue; + } + tmpp.push_back(idd); + } + std::vector tmpp2(tmpp.size()+2); + tmpp2[0]=startId; + std::copy(tmpp.begin(),tmpp.end(),tmpp2.begin()+1); + tmpp2[tmpp.size()+1]=endId; + std::vector::iterator itt=std::unique(tmpp2.begin(),tmpp2.end()); + tmpp2.resize(std::distance(tmpp2.begin(),itt)); + int nbOfEdges=tmpp2.size()-1; + for(int i=0;i& addNodes, const std::map& mapp1, const std::map& mapp2, std::vector& edgesThis); virtual void fillGlobalInfoAbs(bool direction, const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, std::vector& edgesThis, std::vector& addCoo, std::map mapAddCoo) const = 0; virtual void fillGlobalInfoAbs2(const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, std::vector& edgesOther, std::vector& addCoo, std::map& mapAddCoo) const = 0; - virtual void sortIdsAbs(const std::vector& addNodes, const std::map& mapp1, const std::map& mapp2, std::vector& edgesThis) = 0; virtual Edge *buildEdgeLyingOnMe(Node *start, Node *end, bool direction=true) const = 0; protected: Edge():_cnt(1),_loc(FULL_UNKNOWN),_start(0),_end(0) { } diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx index 9f5b846c7..7f2220963 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx @@ -774,18 +774,3 @@ void EdgeArcCircle::fillGlobalInfoAbs2(const std::map _start->fillGlobalInfoAbs2(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,edgesOther); _end->fillGlobalInfoAbs2(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,edgesOther); } - -void EdgeArcCircle::sortIdsAbs(const std::vector& addNodes, const std::map& mapp1, const std::map& mapp2, std::vector& edgesThis) -{ - Bounds b; - b.prepareForAggregation(); - b.aggregate(getBounds()); - double xBary,yBary; - double dimChar=b.getCaracteristicDim(); - b.getBarycenter(xBary,yBary); - applySimilarity(xBary,yBary,dimChar); - for(std::vector::const_iterator iter=addNodes.begin();iter!=addNodes.end();iter++) - (*iter)->applySimilarity(xBary,yBary,dimChar); - _start->applySimilarity(xBary,yBary,dimChar); - _end->applySimilarity(xBary,yBary,dimChar); -} diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.hxx index 9657a816a..582631fe8 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.hxx @@ -118,7 +118,6 @@ namespace INTERP_KERNEL std::vector& edgesThis, std::vector& addCoo, std::map mapAddCoo) const; void fillGlobalInfoAbs2(const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, std::vector& edgesOther, std::vector& addCoo, std::map& mapAddCoo) const; - void sortIdsAbs(const std::vector& addNodes, const std::map& mapp1, const std::map& mapp2, std::vector& edgesThis); protected: //!Value between -2Pi and 2Pi double _angle; diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeLin.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeLin.cxx index 6156ce92f..455115de8 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeLin.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeLin.cxx @@ -318,58 +318,3 @@ void EdgeLin::fillGlobalInfoAbs2(const std::map& mapT _start->fillGlobalInfoAbs2(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,edgesOther); _end->fillGlobalInfoAbs2(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,edgesOther); } - -inline bool eqpair(const std::pair& p1, const std::pair& p2) -{ - return fabs(p1.first-p2.first)& addNodes, const std::map& mapp1, const std::map& mapp2, std::vector& edgesThis) -{ - Bounds b; - b.prepareForAggregation(); - b.aggregate(getBounds()); - double xBary,yBary; - double dimChar=b.getCaracteristicDim(); - b.getBarycenter(xBary,yBary); - for(std::vector::const_iterator iter=addNodes.begin();iter!=addNodes.end();iter++) - (*iter)->applySimilarity(xBary,yBary,dimChar); - _start->applySimilarity(xBary,yBary,dimChar); - _end->applySimilarity(xBary,yBary,dimChar); - std::size_t sz=addNodes.size(); - std::vector< std::pair > an2(sz); - for(std::size_t i=0;i(getCharactValue(*addNodes[i]),addNodes[i]); - std::sort(an2.begin(),an2.end()); - int startId=(*mapp1.find(_start)).second; - int endId=(*mapp1.find(_end)).second; - std::vector tmpp; - std::vector< std::pair >::const_iterator itend=std::unique(an2.begin(),an2.end(),eqpair); - for(std::vector< std::pair >::const_iterator it=an2.begin();it!=itend;it++) - { - int idd=(*mapp2.find((*it).second)).second; - if((*it).first1-QUADRATIC_PLANAR::_precision) - { - endId=idd; - continue; - } - tmpp.push_back(idd); - } - std::vector tmpp2(tmpp.size()+2); - tmpp2[0]=startId; - std::copy(tmpp.begin(),tmpp.end(),tmpp2.begin()+1); - tmpp2[tmpp.size()+1]=endId; - std::vector::iterator itt=std::unique(tmpp2.begin(),tmpp2.end()); - tmpp2.resize(std::distance(tmpp2.begin(),itt)); - int nbOfEdges=tmpp2.size()-1; - for(int i=0;i& edgesThis, std::vector& addCoo, std::map mapAddCoo) const; void fillGlobalInfoAbs2(const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, std::vector& edgesOther, std::vector& addCoo, std::map& mapAddCoo) const; - void sortIdsAbs(const std::vector& addNodes, const std::map& mapp1, const std::map& mapp2, std::vector& edgesThis); }; } diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx index 5618cc78a..696d884da 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx @@ -403,14 +403,14 @@ void QuadraticPolygon::buildFromCrudeDataArray2(const std::map& subEdge=intersectEdges[edgeId]; - std::size_t nbOfSubEdges=subEdge.size()/2; if(directos) {//no subpart of edge 'edgeId' of pol2 is in pol1 so let's operate the same thing that QuadraticPolygon::buildFromCrudeDataArray method appendEdgeFromCrudeDataArray(i,mapp,isQuad,nodalBg,coords,descBg,descEnd,intersectEdges); } else {//there is subpart of edge 'edgeId' of pol2 inside pol1 + const std::vector& subEdge=intersectEdges[edgeId]; + std::size_t nbOfSubEdges=subEdge.size()/2; const std::vector& subEdge1PossiblyAlreadyIn1=intersectEdges1[idIn1]; for(std::size_t j=0;j