From f1d69296ac7f7b2b8cbc7990aa39676d7c529760 Mon Sep 17 00:00:00 2001 From: abn Date: Thu, 17 Jan 2019 11:55:19 +0100 Subject: [PATCH] splitAbs(): Taking direction into account when skiping start/end nodes --- src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx | 6 +++--- src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.hxx | 2 +- .../Geometric2D/InterpKernelGeo2DElementaryEdge.cxx | 4 +++- .../Geometric2D/InterpKernelGeo2DElementaryEdge.hxx | 2 +- .../Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx | 4 ++-- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx index d2a31d0ce..c15c9821d 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx @@ -1070,11 +1070,11 @@ void Edge::fillGlobalInfoAbs(bool direction, const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, - unsigned skipStartOrEnd, + short skipStartOrEnd, std::vector& edgesOther, std::vector& addCoo, std::map& mapAddCoo) const { - if (skipStartOrEnd != 1) // see meaning in splitAbs() + if (skipStartOrEnd != -1) // see meaning in splitAbs() _start->fillGlobalInfoAbs2(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,edgesOther); - if (skipStartOrEnd != 2) + if (skipStartOrEnd != 1) _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 65162a84a..c64267895 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.hxx @@ -285,7 +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, + short 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 43b2f1926..a75af9ad3 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.cxx @@ -230,9 +230,11 @@ 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, + short skipStartOrEnd, std::vector& edgesOther, std::vector& addCoo, std::map& mapAddCoo) const { + if (!_direction) + skipStartOrEnd *= -1; // invert value - see QuadraticPolygon::splitAbs() _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 dfeea282e..41e423df4 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.hxx @@ -73,7 +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, + short 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/InterpKernelGeo2DQuadraticPolygon.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx index 7c7494f80..a6a7c7909 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx @@ -362,10 +362,10 @@ void QuadraticPolygon::splitAbs(QuadraticPolygon& other, // Converting back to integer connectivity: if(otherTmp._sub_edges.size()>1) // only if a new point has been added (i.e. an actual intersection was done) { - int jj = 0; + int jj = 0, sz(otherTmp._sub_edges.size()); 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 + short skipStartOrEnd = jj == 0 ? -1 : (jj == sz-1 ? 1 : 0); // -1 means START, 1 means END, 0 other (*it)->fillGlobalInfoAbs2(mapThis,mapOther,offset1,offset2, fact,xBaryBB,yBaryBB, skipStartOrEnd, /*out*/ subDivOther[otherEdgeIds[i]],addCoo,mapAddCoo); -- 2.39.2