From 00a4484945fdf8fd121e0650354d61b21127f15a Mon Sep 17 00:00:00 2001 From: bruneton Date: Wed, 18 Sep 2013 07:02:07 +0000 Subject: [PATCH] tessellate: adding Python test ... and fixing mem leak :-) --- .../Test/MEDCouplingBasicsTest5.cxx | 2 ++ src/MEDCoupling_Swig/MEDCouplingBasicsTest.py | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx index ea3d7126d..85da2ecce 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx @@ -104,6 +104,8 @@ void MEDCouplingBasicsTest5::testUMeshTessellate2DCurve1() MEDCouplingUMesh *m2 = static_cast(m1->deepCpy()); m2->tessellate2DCurve(0.1); CPPUNIT_ASSERT_NO_THROW(m2->checkCoherency1(0.0)); // eps param not used + m1->decrRef(); + m2->decrRef(); } /*! diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py index b560dbafb..9ad66f093 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py @@ -8443,6 +8443,25 @@ class MEDCouplingBasicsTest(unittest.TestCase): self.assertEqual(expected4,m12.getNodalConnectivityIndex().getValues()); pass + def testUMeshTessellate2DCurve1(self): + # A quarter of circle: + mcoords = [0.4,0.0, 0.0,-0.4, 0.283,-0.283] + mconnec = [0,1,2] + + m1 = MEDCouplingUMesh.New() + m1.setMeshDimension(1) + m1.allocateCells(1) + m1.insertNextCell(NORM_SEG3, mconnec) + + myCoords = DataArrayDouble.New(mcoords, 3, 2) + myCoords.alloc(3,2) + m1.setCoords(myCoords) + + m2 = m1.deepCpy() + m2.tessellate2DCurve(0.1) + # If the following raises, the test will fail automatically: + m2.checkCoherency1(0.0) # eps param not used + def testIntersect2DMeshesTmp4(self): m1Coords=[0.,0.,1.,0.,1.5,0.,0.,1.,0.,1.5,-1.,0.,-1.5,0.,0.,-1,0.,-1.5,0.5,0.,1.25,0.,0.70710678118654757,0.70710678118654757,1.0606601717798214,1.0606601717798214,0.,0.5,0.,1.25,-0.70710678118654757,0.70710678118654757,-1.0606601717798214,1.0606601717798214,-0.5,0.,-1.25,0.,-0.70710678118654757,-0.70710678118654757,-1.0606601717798214,-1.0606601717798214,0.,-0.5,0.,-1.25,0.70710678118654757,-0.70710678118654757,1.0606601717798214,-1.0606601717798214]; m1Conn=[0,3,1,13,11,9, 3,4,2,1,14,12,10,11, 5,3,0,15,13,17, 6,4,3,5,16,14,15,18, 5,0,7,17,21,19, 6,5,7,8,18,19,22,20, 0,1,7,9,23,21, 1,2,8,7,10,24,22,23]; -- 2.39.2