]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
splitAbs(): Taking direction into account when skiping start/end nodes
authorabn <adrien.bruneton@cea.fr>
Thu, 17 Jan 2019 10:55:19 +0000 (11:55 +0100)
committerabn <adrien.bruneton@cea.fr>
Thu, 17 Jan 2019 12:49:56 +0000 (13:49 +0100)
src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx
src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.hxx
src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.cxx
src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.hxx
src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx

index d2a31d0cef8335edfa796785ac762fffb654cbcd..c15c9821ddd9396e22a394bfb5f39036076283ea 100644 (file)
@@ -1070,11 +1070,11 @@ void Edge::fillGlobalInfoAbs(bool direction, const std::map<INTERP_KERNEL::Node
 }
 
 void Edge::fillGlobalInfoAbs2(const std::map<INTERP_KERNEL::Node *,int>& mapThis, const std::map<INTERP_KERNEL::Node *,int>& mapOther, int offset1, int offset2, double fact, double baryX, double baryY,
-                              unsigned skipStartOrEnd,
+                              short skipStartOrEnd,
                               std::vector<int>& edgesOther, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int>& 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);
 }
index 65162a84adeb2c5c0dafb9ac66672d990fa38731..c6426789570bd30fb977667c60fa80b9dd30e771 100644 (file)
@@ -285,7 +285,7 @@ namespace INTERP_KERNEL
     void fillGlobalInfoAbs(bool direction, const std::map<INTERP_KERNEL::Node *,int>& mapThis, const std::map<INTERP_KERNEL::Node *,int>& mapOther, int offset1, int offset2, double fact, double baryX, double baryY,
                            std::vector<int>& edgesThis, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int> mapAddCoo) const;
     void fillGlobalInfoAbs2(const std::map<INTERP_KERNEL::Node *,int>& mapThis, const std::map<INTERP_KERNEL::Node *,int>& mapOther, int offset1, int offset2, double fact, double baryX, double baryY,
-                            unsigned skipStartOrEnd,
+                            short skipStartOrEnd,
                             std::vector<int>& edgesOther, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int>& mapAddCoo) const;
 
   protected:
index 43b2f1926353b5cb1982f82d8d33cb3a4a662bff..a75af9ad36f4a09ad418e8038c12ac70555b070b 100644 (file)
@@ -230,9 +230,11 @@ void ElementaryEdge::fillGlobalInfoAbs(const std::map<INTERP_KERNEL::Node *,int>
  * unsorted because the "other" mesh is not subdivided yet.
  */
 void ElementaryEdge::fillGlobalInfoAbs2(const std::map<INTERP_KERNEL::Node *,int>& mapThis, const std::map<INTERP_KERNEL::Node *,int>& mapOther, int offset1, int offset2, double fact, double baryX, double baryY,
-                                        unsigned skipStartOrEnd,
+                                        short skipStartOrEnd,
                                         std::vector<int>& edgesOther, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int>& mapAddCoo) const
 {
+  if (!_direction)
+    skipStartOrEnd *= -1;  // invert value - see QuadraticPolygon::splitAbs()
   _ptr->fillGlobalInfoAbs2(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,skipStartOrEnd,edgesOther,addCoo,mapAddCoo);
 }
 
index dfeea282ea17b627d5247b32cbeb2178edaef7aa..41e423df47692bedfa6e0e840fa727de432cd45c 100644 (file)
@@ -73,7 +73,7 @@ namespace INTERP_KERNEL
     INTERPKERNEL_EXPORT void fillGlobalInfoAbs(const std::map<INTERP_KERNEL::Node *,int>& mapThis, const std::map<INTERP_KERNEL::Node *,int>& mapOther, int offset1, int offset2, double fact, double baryX, double baryY,
                                                std::vector<int>& edgesThis, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int> mapAddCoo) const;
     INTERPKERNEL_EXPORT void fillGlobalInfoAbs2(const std::map<INTERP_KERNEL::Node *,int>& mapThis, const std::map<INTERP_KERNEL::Node *,int>& mapOther, int offset1, int offset2, double fact, double baryX, double baryY,
-                                                unsigned skipStartOrEnd,
+                                                short skipStartOrEnd,
                                                 std::vector<int>& edgesOther, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int>& mapAddCoo) const;
     INTERPKERNEL_EXPORT static ElementaryEdge *BuildEdgeFromStartEndDir(bool direction, INTERP_KERNEL::Node *start, INTERP_KERNEL::Node *end);
   private:
index 7c7494f808f79b2ddd3709e4a8bb08b3f04c1a12..a6a7c79099c6966f77fb8be7c56ffe3a2631b0b2 100644 (file)
@@ -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<ElementaryEdge *>::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);