From: geay Date: Mon, 7 Apr 2014 15:19:50 +0000 (+0200) Subject: Debug on Colinearize2D. X-Git-Tag: V7_4_0b1~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b798f3d27a1a9fed658b14506d81cee895e27545;p=tools%2Fmedcoupling.git Debug on Colinearize2D. --- diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index 002508a9c..e0113eba9 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -10280,6 +10280,8 @@ bool MEDCouplingUMesh::Colinearize2DCell(const double *coords, const int *connBg } delete eint; eCand->decrRef(); + if(!isColinear) + break; } } break; diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py index e6d186e9b..1f58aec18 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py @@ -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