]> SALOME platform Git repositories - modules/med.git/commitdiff
Salome HOME
Debug on Colinearize2D.
authorgeay <anthony.geay@cea.fr>
Mon, 7 Apr 2014 15:19:50 +0000 (17:19 +0200)
committergeay <anthony.geay@cea.fr>
Mon, 7 Apr 2014 15:19:50 +0000 (17:19 +0200)
src/MEDCoupling/MEDCouplingUMesh.cxx
src/MEDCoupling_Swig/MEDCouplingBasicsTest.py

index 002508a9ccd12408480eb91fdccd2d1fc15613cb..e0113eba9aabb457c74698baa1eb9b6fa7664981 100644 (file)
@@ -10280,6 +10280,8 @@ bool MEDCouplingUMesh::Colinearize2DCell(const double *coords, const int *connBg
                         }
                       delete eint;
                       eCand->decrRef();
+                      if(!isColinear)
+                        break;
                     }
                 }
               break;
index e6d186e9be0525848220465a976b9c82d8f98e8e..1f58aec188b11d5235783192f5522827bb61bc83 100644 (file)
@@ -14709,6 +14709,21 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         self.assertTrue(mu.getCoords().isEqual(coo6,1e-12))
         pass
 
+    def testSwig2Colinearize2D2(self):
+        """ simple non regression test but that has revealed a bug"""
+        coo=DataArrayDouble([(0,0),(0,0.5),(0,1),(1,1),(1,0),(0.5,0)])
+        m=MEDCouplingUMesh("mesh",2) ; m.setCoords(coo)
+        m.allocateCells() ; m.insertNextCell(NORM_POLYGON,[0,1,2,3,4,5])
+        m.checkCoherency2()
+        refPtr=m.getCoords().getHiddenCppPointer()
+        #
+        m.colinearize2D(1e-12)
+        m.checkCoherency2()
+        self.assertEqual(refPtr,m.getCoords().getHiddenCppPointer())
+        self.assertTrue(m.getNodalConnectivity().isEqual(DataArrayInt([5,0,2,3,4])))
+        self.assertTrue(m.getNodalConnectivityIndex().isEqual(DataArrayInt([0,5])))
+        pass
+
     def setUp(self):
         pass
     pass