]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
A little missing test consecutive to 1755dbe71b2fd46cd796464e8
authorAnthony Geay <anthony.geay@edf.fr>
Fri, 28 Apr 2017 05:52:00 +0000 (07:52 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Fri, 28 Apr 2017 05:52:00 +0000 (07:52 +0200)
src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py

index da14c7b9ce083e2fd3d01ab3f526392f01902112..04c55fe8e6017d1625dd33740604b5496f93b3f3 100644 (file)
@@ -4549,6 +4549,22 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         self.assertTrue(d.findIdsLowerThan(3).isEqual(DataArrayInt([2,5])))
         self.assertTrue(d.findIdsLowerOrEqualTo(3).isEqual(DataArrayInt([2,3,5])))
         pass
+
+    def testDAFacto1(self):
+        """Test focused of new wrapped methods for MEDCouplingFieldInt thanks to code factorization."""
+        d=DataArrayDouble(7) ; d.iota()
+        m=MEDCouplingUMesh.Build1DMeshFromCoords(d)
+        f=MEDCouplingFieldInt(ON_CELLS) ; f.setMesh(m) ; arr=DataArrayInt(6) ; arr.iota() ; f.setArray(arr) ; f.checkConsistencyLight()
+        f_0=f[::2] # test is here
+        self.assertTrue(f_0.getArray().isEqual(DataArrayInt([0,2,4])))
+        self.assertTrue(f_0.getMesh().isEqual(m[[0,2,4]],1e-12))
+        #
+        f2=MEDCouplingFieldInt(ON_NODES) ; f2.setMesh(m) ; arr=DataArrayInt(7) ; arr.iota() ; f2.setArray(arr) ; f2.checkConsistencyLight()
+        f_1=f2[::2] # test is here
+        self.assertTrue(f_1.getArray().isEqual(DataArrayInt([0,1,2,3,4,5])))
+        m_1=m[[0,2,4]] ; m_1.zipCoords()
+        self.assertTrue(f_1.getMesh().isEqual(m_1,1e-12))
+        pass
     
     pass