Salome HOME
Improve swig generation process on Windows platform.
[tools/medcoupling.git] / src / INTERP_KERNEL / Geometric2D / InterpKernelGeo2DQuadraticPolygon.cxx
index e2cc2028880db58213b55d6b5082fcf416348f09..9cfb340750b567445054aafd36c8b1c6e81fa309 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2014  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -60,9 +60,24 @@ QuadraticPolygon::QuadraticPolygon(const char *file)
         }
       while(1);
   }
-  catch(std::ifstream::failure&)
+  catch(const std::ifstream::failure&)
   {
   }
+  catch(const std::exception & ex)
+  {
+      // Some code before this catch throws the C++98 version of the exception (mangled
+      // name is " NSt8ios_base7failureE"), but FED24 compilation of the current version of the code
+      // tries to catch the C++11 version of it (mangled name "NSt8ios_base7failureB5cxx11E").
+      // So we have this nasty hack to catch both versions ...
+
+      // TODO: the below should be replaced by a better handling avoiding exception throwing.
+      if (std::string(ex.what()) == "basic_ios::clear")
+        {
+          //std::cout << "std::ios_base::failure C++11\n";
+        }
+      else
+        throw ex;
+  }
   front()->changeStartNodeWith(back()->getEndNode());
 }
 
@@ -274,7 +289,7 @@ void QuadraticPolygon::splitAbs(QuadraticPolygon& other,
                                 const std::vector<int>& otherEdgeIds,
                                 std::vector<int>& edgesThis, int cellIdThis,
                                 std::vector< std::vector<int> >& edgesInOtherColinearWithThis, std::vector< std::vector<int> >& subDivOther,
-                                std::vector<double>& addCoo)
+                                std::vector<double>& addCoo, std::map<int,int>& mergedNodes)
 {
   double xBaryBB, yBaryBB;
   double fact=normalizeExt(&other, xBaryBB, yBaryBB);
@@ -302,6 +317,10 @@ void QuadraticPolygon::splitAbs(QuadraticPolygon& other,
             {
               ElementaryEdge* curE1=it1.current();
               merge.clear();
+              //
+              std::map<INTERP_KERNEL::Node *,int>::const_iterator thisStart(mapThis.find(curE1->getStartNode())),thisEnd(mapThis.find(curE1->getEndNode())),otherStart(mapOther.find(curE2->getStartNode())),otherEnd(mapOther.find(curE2->getEndNode()));
+              int thisStart2(thisStart==mapThis.end()?-1:(*thisStart).second),thisEnd2(thisEnd==mapThis.end()?-1:(*thisEnd).second),otherStart2(otherStart==mapOther.end()?-1:(*otherStart).second+offset1),otherEnd2(otherEnd==mapOther.end()?-1:(*otherEnd).second+offset1);
+              //
               if(curE1->getPtr()->intersectWith(curE2->getPtr(),merge,*c1,*c2))
                 {
                   if(!curE1->getDirection()) c1->reverse();
@@ -325,6 +344,7 @@ void QuadraticPolygon::splitAbs(QuadraticPolygon& other,
                   UpdateNeighbours(merge,it1,it2,curE1,curE2);
                   it1.next();
                 }
+              merge.updateMergedNodes(thisStart2,thisEnd2,otherStart2,otherEnd2,mergedNodes);
             }
         }
       if(otherTmp.presenceOfOn())