From 7799982b6e19319464997fd2d9606a8ed5745fb7 Mon Sep 17 00:00:00 2001 From: abn Date: Mon, 14 Jan 2019 15:29:26 +0100 Subject: [PATCH] Intersec bug fix: point not added properly inserted in splitting. --- .../Geometric2D/InterpKernelGeo2DEdge.cxx | 7 +++++-- .../Geometric2D/InterpKernelGeo2DEdge.hxx | 1 + .../Geometric2D/InterpKernelGeo2DElementaryEdge.cxx | 3 ++- .../Geometric2D/InterpKernelGeo2DElementaryEdge.hxx | 1 + .../Geometric2D/InterpKernelGeo2DNode.cxx | 7 +++---- .../Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx | 10 ++++++++-- 6 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx index ed5739df4..37d9c4b3c 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx @@ -1067,8 +1067,11 @@ void Edge::fillGlobalInfoAbs(bool direction, 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 + unsigned skipStartOrEnd, + std::vector& edgesOther, std::vector& addCoo, std::map& mapAddCoo) const { - _start->fillGlobalInfoAbs2(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,edgesOther); + if (skipStartOrEnd != 1) // see meaning in splitAbs() + _start->fillGlobalInfoAbs2(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,edgesOther); + if (skipStartOrEnd != 2) _end->fillGlobalInfoAbs2(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,edgesOther); } diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.hxx index 8375791b1..eb346ec04 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.hxx @@ -285,6 +285,7 @@ namespace INTERP_KERNEL 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; void fillGlobalInfoAbs2(const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, + unsigned skipStartOrEnd, std::vector& edgesOther, std::vector& addCoo, std::map& mapAddCoo) const; protected: diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.cxx index 3f99fcde6..43b2f1926 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.cxx @@ -230,9 +230,10 @@ void ElementaryEdge::fillGlobalInfoAbs(const std::map * unsorted because the "other" mesh is not subdivided yet. */ void ElementaryEdge::fillGlobalInfoAbs2(const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, + unsigned skipStartOrEnd, std::vector& edgesOther, std::vector& addCoo, std::map& mapAddCoo) const { - _ptr->fillGlobalInfoAbs2(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,edgesOther,addCoo,mapAddCoo); + _ptr->fillGlobalInfoAbs2(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,skipStartOrEnd,edgesOther,addCoo,mapAddCoo); } /*! diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.hxx index f585b9aa1..dfeea282e 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.hxx @@ -73,6 +73,7 @@ namespace INTERP_KERNEL INTERPKERNEL_EXPORT void fillGlobalInfoAbs(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; INTERPKERNEL_EXPORT void fillGlobalInfoAbs2(const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, + unsigned skipStartOrEnd, std::vector& edgesOther, std::vector& addCoo, std::map& mapAddCoo) const; INTERPKERNEL_EXPORT static ElementaryEdge *BuildEdgeFromStartEndDir(bool direction, INTERP_KERNEL::Node *start, INTERP_KERNEL::Node *end); private: diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.cxx index 76d4efeac..e8a71439e 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.cxx @@ -185,8 +185,8 @@ void Node::fillGlobalInfoAbs2(const std::map& mapThis int tmp; std::size_t sz1=addCoo.size(); fillGlobalInfoAbs(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,&tmp); - if(sz1!=addCoo.size() - || (tmp >= offset2 + if(sz1!=addCoo.size() // newly created point + || (tmp >= offset2 // or previously created point merged with a neighbour && (pointsOther.size() == 0 || pointsOther.back() != tmp))) { pointsOther.push_back(tmp); @@ -195,6 +195,5 @@ void Node::fillGlobalInfoAbs2(const std::map& mapThis std::vector::const_iterator it=std::find(pointsOther.begin(),pointsOther.end(),tmp); if(it!=pointsOther.end()) return ; - if(tmp1) // only if a new point has been added (i.e. an actual intersection was done) { - for(std::list::const_iterator it=otherTmp._sub_edges.begin();it!=otherTmp._sub_edges.end();it++) - (*it)->fillGlobalInfoAbs2(mapThis,mapOther,offset1,offset2,/**/fact,xBaryBB,yBaryBB,/**/subDivOther[otherEdgeIds[i]],addCoo,mapAddCoo); + int jj = 0; + for(std::list::const_iterator it=otherTmp._sub_edges.begin();it!=otherTmp._sub_edges.end();it++, jj++) + { + unsigned skipStartOrEnd = jj == 0 ? 1 : (jj == _sub_edges.size()-1 ? 2 : -1); // 1 means START, 2 means END, -1 other + (*it)->fillGlobalInfoAbs2(mapThis,mapOther,offset1,offset2, + fact,xBaryBB,yBaryBB, skipStartOrEnd, + /*out*/ subDivOther[otherEdgeIds[i]],addCoo,mapAddCoo); + } } } Delete(cThis); -- 2.39.2