]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
tessellate: adding Python test ... and fixing mem leak :-)
authorbruneton <bruneton>
Wed, 18 Sep 2013 07:02:07 +0000 (07:02 +0000)
committerbruneton <bruneton>
Wed, 18 Sep 2013 07:02:07 +0000 (07:02 +0000)
src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx
src/MEDCoupling_Swig/MEDCouplingBasicsTest.py

index ea3d7126d8bf73a05f9ef48dd267669067ac49c4..85da2eccefe8ac0278c880b22b007193bd1f65c5 100644 (file)
@@ -104,6 +104,8 @@ void MEDCouplingBasicsTest5::testUMeshTessellate2DCurve1()
   MEDCouplingUMesh *m2 = static_cast<MEDCouplingUMesh *>(m1->deepCpy());
   m2->tessellate2DCurve(0.1);
   CPPUNIT_ASSERT_NO_THROW(m2->checkCoherency1(0.0)); // eps param not used
+  m1->decrRef();
+  m2->decrRef();
 }
 
 /*!
index b560dbafbae48c50c42e7723e27b7cd74f12a247..9ad66f09324fa80ca4d00951af1dd8f3d9308848 100644 (file)
@@ -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];