From: ageay Date: Thu, 25 Oct 2012 12:53:30 +0000 (+0000) Subject: Little enhancement. X-Git-Tag: V6_6_0b1~36 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d53d3afc8d1693f2754439d03caae9f07625faa9;p=tools%2Fmedcoupling.git Little enhancement. --- diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx index 69b6dacad..1912c6b5b 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx @@ -1058,8 +1058,8 @@ std::list::iterator QuadraticPolygon::CheckInList(Node *n, s return iEnd; } -void QuadraticPolygon::ComputeResidual(const std::set& notUsedInPol1, const std::set& edgesInPol2OnBoundary, int idThis, - std::vector& addCoordsQuadratic, std::vector& conn, std::vector& connI, std::vector& nb1) +void QuadraticPolygon::ComputeResidual(const QuadraticPolygon& pol1, const std::set& notUsedInPol1, const std::set& edgesInPol2OnBoundary, const std::map& mapp, int offset, int idThis, + std::vector& addCoordsQuadratic, std::vector& conn, std::vector& connI, std::vector& nb1, std::vector& nb2) { for(std::set::const_iterator it=edgesInPol2OnBoundary.begin();it!=edgesInPol2OnBoundary.end();it++) { (*it)->initLocs(); (*it)->declareIn(); } @@ -1078,6 +1078,8 @@ void QuadraticPolygon::ComputeResidual(const std::set& notUsedInPol1, co if((*it)->getEndNode()->getLoc()==ON_1) { curN=(*it)->getStartNode(); edgesInPol2OnBoundaryL.erase(it); tmp1->pushBack(new ElementaryEdge(*it,false)); break; } } + if(!curN) + throw INTERP_KERNEL::Exception("Presence of a target polygon fully included in source polygon ! The partition of this leads to a non simply connex cell (with hole) ! Impossible ! Such resulting cell cannot be stored in MED cell format !"); // while(curN->getLoc()!=ON_1 && !edgesInPol2OnBoundaryL.empty()) { @@ -1091,8 +1093,23 @@ void QuadraticPolygon::ComputeResidual(const std::set& notUsedInPol1, co } pol2Zip.push_back(tmp1); } - //pol2.zipConsecutiveInSegments(); - //std::vector ret; - //if(!pol2Zip.empty()) - // closePolygons(pol2Zip,pol1,ret); + for(std::list::const_iterator it=pol1._sub_edges.begin();it!=pol1._sub_edges.end();it++) + { (*it)->getPtr()->initLocs(); (*it)->declareOut(); } + for(std::set::const_iterator it=notUsedInPol1.begin();it!=notUsedInPol1.end();it++) + { (*it)->initLocs(); (*it)->declareIn(); } + for(std::set::const_iterator it=edgesInPol2OnBoundary.begin();it!=edgesInPol2OnBoundary.end();it++) + { (*it)->initLocs(); (*it)->declareOn(); } + std::vector ret; + if(pol2Zip.empty()) + return; + QuadraticPolygon *firstPol2=*(pol2Zip.begin()); + firstPol2->closePolygons(pol2Zip,pol1,ret); + // + for(std::vector::iterator it=ret.begin();it!=ret.end();it++) + { + (*it)->appendCrudeData(mapp,0.,0.,1.,offset,addCoordsQuadratic,conn,connI); + nb1.push_back(idThis); + nb2.push_back(-1); + delete *it; + } } diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.hxx index 2c9edcd34..586852363 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.hxx @@ -82,8 +82,8 @@ namespace INTERP_KERNEL static void SplitPolygonsEachOther(QuadraticPolygon& pol1, QuadraticPolygon& pol2, int& nbOfSplits); std::vector buildIntersectionPolygons(const QuadraticPolygon& pol1, const QuadraticPolygon& pol2) const; bool amIAChanceToBeCompletedBy(const QuadraticPolygon& pol1Splitted, const QuadraticPolygon& pol2NotSplitted, bool& direction); - static void ComputeResidual(const std::set& notUsedInPol1, const std::set& edgesInPol2OnBoundary, int idThis, - std::vector& addCoordsQuadratic, std::vector& conn, std::vector& connI, std::vector& nb1); + static void ComputeResidual(const QuadraticPolygon& pol1, const std::set& notUsedInPol1, const std::set& edgesInPol2OnBoundary, const std::map& mapp, int offset, int idThis, + std::vector& addCoordsQuadratic, std::vector& conn, std::vector& connI, std::vector& nb1, std::vector& nb2); protected: std::list zipConsecutiveInSegments() const; void dumpInXfigFile(std::ostream& stream, int resolution, const Bounds& box) const;