From b798f3d27a1a9fed658b14506d81cee895e27545 Mon Sep 17 00:00:00 2001 From: geay Date: Mon, 7 Apr 2014 17:19:50 +0200 Subject: [PATCH] Debug on Colinearize2D. --- src/MEDCoupling/MEDCouplingUMesh.cxx | 2 ++ src/MEDCoupling_Swig/MEDCouplingBasicsTest.py | 15 +++++++++++++++ 2 files changed, 17 insertions(+) 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 -- 2.39.2