]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Merge branch 'master' into gdd/py3
authorGilles DAVID <gilles-g.david@edf.fr>
Mon, 15 May 2017 12:30:11 +0000 (14:30 +0200)
committerGilles DAVID <gilles-g.david@edf.fr>
Mon, 15 May 2017 12:30:11 +0000 (14:30 +0200)
Conflicts:
src/MEDLoader/Swig/MEDLoaderTest3.py

12 files changed:
1  2 
src/MEDCoupling_Swig/CMakeLists.txt
src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py
src/MEDCoupling_Swig/MEDCouplingCommon.i
src/MEDCoupling_Swig/MEDCouplingDataArrayTypemaps.i
src/MEDCoupling_Swig/MEDCouplingFinalize.i
src/MEDCoupling_Swig/MEDCouplingMemArray.i
src/MEDCoupling_Swig/MEDCouplingNumPyTest.py
src/MEDCoupling_Swig/MEDCouplingPickleTest.py
src/MEDLoader/Swig/MEDLoader.i
src/MEDLoader/Swig/MEDLoaderCommon.i
src/MEDLoader/Swig/MEDLoaderTest3.py
src/RENUMBER_Swig/MEDRenumberCommon.i

Simple merge
index 00ec3d71d33633333523f22f88ea2b996c961a95,b410892c498311de54e3395cbc3d771f404ced5f..28465ef7639135d049de01def5e4c58b60d6bf8a
  #ifndef __MEDCOUPLINGDATAARRAYTYPEMAPS_I__
  #define __MEDCOUPLINGDATAARRAYTYPEMAPS_I__
  
 +#if PY_VERSION_HEX >= 0x03000000
 +#define PyInt_AS_LONG PyLong_AS_LONG
 +#endif
 +
  #include "InterpKernelAutoPtr.hxx"
+ #include "MEDCouplingDataArrayTraits.hxx"
  
  #include <sstream>
  
index 0f9a8c5a2e45a5fa9039cca64c476390c2e8ac52,6d84db1f65caf34877f27f04f9b52cadc6415b8a..57de04b74ef6916d3c0b73587508fba63baa0ffb
@@@ -53,13 -48,11 +60,17 @@@ MEDCouplingFieldDouble.__isub__=MEDCoup
  MEDCouplingFieldDouble.__imul__=MEDCouplingFieldDoubleImul
  MEDCouplingFieldDouble.__idiv__=MEDCouplingFieldDoubleIdiv
  MEDCouplingFieldDouble.__ipow__=MEDCouplingFieldDoubleIpow
 +MEDCouplingFieldDouble.__truediv__=MEDCouplingFieldDouble.__div__
 +MEDCouplingFieldDouble.__rtruediv__=MEDCouplingFieldDouble.__rdiv__
 +MEDCouplingFieldDouble.__itruediv__=MEDCouplingFieldDoubleIdiv
 +MEDCouplingFieldDouble.__floordiv__=MEDCouplingFieldDouble.__div__
 +MEDCouplingFieldDouble.__rfloordiv__=MEDCouplingFieldDouble.__rdiv__
 +MEDCouplingFieldDouble.__ifloordiv__=MEDCouplingFieldDoubleIdiv
  
+ MEDCouplingFieldInt.__new__=classmethod(MEDCouplingFieldIntnew)
+   
+ MEDCouplingFieldFloat.__new__=classmethod(MEDCouplingFieldFloatnew)
  DataArrayDoubleTuple.__iadd__=MEDCouplingDataArrayDoubleTupleIadd
  DataArrayDoubleTuple.__isub__=MEDCouplingDataArrayDoubleTupleIsub
  DataArrayDoubleTuple.__imul__=MEDCouplingDataArrayDoubleTupleImul
@@@ -85,14 -74,7 +96,13 @@@ MEDCouplingCurveLinearMesh.__new__=clas
  MEDCouplingCMesh.__new__=classmethod(MEDCouplingCMeshnew)
  MEDCouplingIMesh.__new__=classmethod(MEDCouplingIMeshnew)
  MEDCouplingMappedExtrudedMesh.__new__=classmethod(MEDCouplingExtrudedMeshnew)
- MEDCouplingFieldDouble.__new__=classmethod(MEDCouplingFieldDoublenew)
  
 +DataArrayAsciiCharIterator.__next__ = DataArrayAsciiCharIterator.next
 +DataArrayIntIterator.__next__ = DataArrayIntIterator.next
 +DataArrayDoubleIterator.__next__ = DataArrayDoubleIterator.next
 +MEDCouplingUMeshCellIterator.__next__ = MEDCouplingUMeshCellIterator.next
 +MEDCouplingUMeshCellByTypeIterator.__next__ = MEDCouplingUMeshCellByTypeIterator.next
 +
  del INTERPKERNELExceptionReduce
  del MEDCouplingDataArrayDoublenew
  del MEDCouplingDataArrayDoubleIadd
Simple merge
Simple merge
index 52a518156d31a14dd79bc843c14e0c7f15eaaa74,55fd117f1498925885467cdc0a8710660c16c6fe..7ee67284d2d35fd47905e69357562d57838576e7
@@@ -2153,30 -2143,30 +2153,30 @@@ class MEDLoaderTest3(unittest.TestCase)
          m=m.buildUnstructured()
          m.setName("mm")
          f=m.getMeasureField(False)
-         self.assertIn(m.getHeapMemorySize(), list(range(3552 - 100, 3552 + 100 + 4 * strMulFac)))
-         self.assertIn(f.getHeapMemorySize(), list(range(4215 - 100, 4215 + 100 + 8 * strMulFac)))
 -        self.assertIn(m.getHeapMemorySize(),xrange(3552-100,3552+100+4*strMulFac))
 -        self.assertIn(f.getHeapMemorySize(),xrange(4215-100,4215+100+8*strMulFac))
++        self.assertIn(m.getHeapMemorySize(),range(3552-100,3552+100+4*strMulFac))
++        self.assertIn(f.getHeapMemorySize(),range(4215-100,4215+100+8*strMulFac))
          #
          mm=MEDFileUMesh()
          mm.setMeshAtLevel(0,m)
-         self.assertIn(mm.getHeapMemorySize(), list(range(3889 - 100, 4225 + 100 + 10 * strMulFac)))
 -        self.assertIn(mm.getHeapMemorySize(),xrange(3889-100,4225+100+10*strMulFac))
++        self.assertIn(mm.getHeapMemorySize(),range(3889-100,4225+100+10*strMulFac))
          ff=MEDFileField1TS()
          ff.setFieldNoProfileSBT(f)
-         self.assertIn(ff.getHeapMemorySize(), list(range(771 - 40, 871 + 21 + (4 + 1) * strMulFac)))
 -        self.assertIn(ff.getHeapMemorySize(),xrange(771-40,871+21+(4+1)*strMulFac))
++        self.assertIn(ff.getHeapMemorySize(),range(771-40,871+21+(4+1)*strMulFac))
          #
          fff=MEDFileFieldMultiTS()
          fff.appendFieldNoProfileSBT(f)
-         self.assertIn(fff.getHeapMemorySize(), list(range(815 - 50, 915 + 30 + (6 + 2) * strMulFac)))
 -        self.assertIn(fff.getHeapMemorySize(),xrange(815-50,915+30+(6+2)*strMulFac))
++        self.assertIn(fff.getHeapMemorySize(),range(815-50,915+30+(6+2)*strMulFac))
          f.setTime(1.,0,-1)
          fff.appendFieldNoProfileSBT(f)
-         self.assertIn(fff.getHeapMemorySize(), list(range(1594 - 90, 1794 + 50 + (10 + 1) * strMulFac)))
-         self.assertIn(fff[0, -1].getHeapMemorySize(), list(range(771 - 40, 871 + 20 + (4 + 1) * strMulFac)))
 -        self.assertIn(fff.getHeapMemorySize(),xrange(1594-90,1794+50+(10+1)*strMulFac))
 -        self.assertIn(fff[0,-1].getHeapMemorySize(),xrange(771-40,871+20+(4+1)*strMulFac))
++        self.assertIn(fff.getHeapMemorySize(),range(1594-90,1794+50+(10+1)*strMulFac))
++        self.assertIn(fff[0,-1].getHeapMemorySize(),range(771-40,871+20+(4+1)*strMulFac))
          f2=f[:50]
          f2.setTime(2.,1,-1)
          pfl=DataArrayInt.Range(0,50,1) ; pfl.setName("pfl")
          fff.appendFieldProfile(f2,mm,0,pfl)
-         self.assertIn(fff.getHeapMemorySize(), list(range(2348 - 130, 2608 + 100 + (10 + 2) * strMulFac)))
-         self.assertIn(fff.getProfile("pfl").getHeapMemorySize(), list(range(204 - 10, 204 + 10 + 2 * strMulFac)))
-         self.assertIn(fff[1, -1].getHeapMemorySize(), list(range(738 - 50, 838 + 30 + 4 * strMulFac)))
 -        self.assertIn(fff.getHeapMemorySize(),xrange(2348-130,2608+100+(10+2)*strMulFac))
 -        self.assertIn(fff.getProfile("pfl").getHeapMemorySize(),xrange(204-10,204+10+2*strMulFac))
 -        self.assertIn(fff[1,-1].getHeapMemorySize(),xrange(738-50,838+30+4*strMulFac))
++        self.assertIn(fff.getHeapMemorySize(),range(2348-130,2608+100+(10+2)*strMulFac))
++        self.assertIn(fff.getProfile("pfl").getHeapMemorySize(),range(204-10,204+10+2*strMulFac))
++        self.assertIn(fff[1,-1].getHeapMemorySize(),range(738-50,838+30+4*strMulFac))
          pass
  
      def testCurveLinearMesh1(self):
          mm.setMeshAtLevel(0,m)
          mm.setMeshAtLevel(-1,m1)
          namesCellL0=DataArrayAsciiChar(6,16)
-         namesCellL0[:] = ["CellL0#%.3d      " % (i) for i in range(6)]
 -        namesCellL0[:]=["CellL0#%.3d      "%(i) for i in xrange(6)]
++        namesCellL0[:]=["CellL0#%.3d      "%(i) for i in range(6)]
          mm.setNameFieldAtLevel(0,namesCellL0)
          namesCellL1=DataArrayAsciiChar.Aggregate([namesCellL0,namesCellL0,namesCellL0.subArray(2)])
-         namesCellL1[:] = ["CellLM1#%.3d     " % (i) for i in range(16)]
 -        namesCellL1[:]=["CellLM1#%.3d     "%(i) for i in xrange(16)]
++        namesCellL1[:]=["CellLM1#%.3d     "%(i) for i in range(16)]
          mm.setNameFieldAtLevel(-1,namesCellL1)
          namesNodes=namesCellL1.subArray(4,16)
-         namesNodes[:] = ["Node#%.3d        " % (i) for i in range(12)]
 -        namesNodes[:]=["Node#%.3d        "%(i) for i in xrange(12)]
++        namesNodes[:]=["Node#%.3d        "%(i) for i in range(12)]
          mm.setNameFieldAtLevel(1,namesNodes)
          mm.write(fname,2)
          #
          mmr=MEDFileMesh.New(fname)
-         self.assertTrue(mm.getNameFieldAtLevel(0).isEqual(DataArrayAsciiChar(["CellL0#%.3d      " % (i) for i in range(6)])))
-         self.assertTrue(mm.getNameFieldAtLevel(-1).isEqual(DataArrayAsciiChar(["CellLM1#%.3d     " % (i) for i in range(16)])))
-         self.assertTrue(mm.getNameFieldAtLevel(1).isEqual(DataArrayAsciiChar(["Node#%.3d        " % (i) for i in range(12)])))
 -        self.assertTrue(mm.getNameFieldAtLevel(0).isEqual(DataArrayAsciiChar(["CellL0#%.3d      "%(i) for i in xrange(6)])))
 -        self.assertTrue(mm.getNameFieldAtLevel(-1).isEqual(DataArrayAsciiChar(["CellLM1#%.3d     "%(i) for i in xrange(16)])))
 -        self.assertTrue(mm.getNameFieldAtLevel(1).isEqual(DataArrayAsciiChar(["Node#%.3d        "%(i) for i in xrange(12)])))
++        self.assertTrue(mm.getNameFieldAtLevel(0).isEqual(DataArrayAsciiChar(["CellL0#%.3d      "%(i) for i in range(6)])))
++        self.assertTrue(mm.getNameFieldAtLevel(-1).isEqual(DataArrayAsciiChar(["CellLM1#%.3d     "%(i) for i in range(16)])))
++        self.assertTrue(mm.getNameFieldAtLevel(1).isEqual(DataArrayAsciiChar(["Node#%.3d        "%(i) for i in range(12)])))
          self.assertTrue(mm.isEqual(mmr,1e-12)[0])
          mmr.getNameFieldAtLevel(1).setIJ(0,0,'M')
          self.assertTrue(not mm.isEqual(mmr,1e-12)[0])
          mm.write(fname,2)
          mmr=MEDFileMesh.New(fname)
          self.assertEqual(mmr.getNameFieldAtLevel(1),None)
-         self.assertTrue(mmr.getNameFieldAtLevel(0).isEqual(DataArrayAsciiChar(["CellL0#%.3d      " % (i) for i in range(6)])))
 -        self.assertTrue(mmr.getNameFieldAtLevel(0).isEqual(DataArrayAsciiChar(["CellL0#%.3d      "%(i) for i in xrange(6)])))
++        self.assertTrue(mmr.getNameFieldAtLevel(0).isEqual(DataArrayAsciiChar(["CellL0#%.3d      "%(i) for i in range(6)])))
          self.assertEqual(mmr.getNameFieldAtLevel(-1),None)
          #
          c=MEDCouplingCMesh()
          c.setName("cmesh")
          cc=MEDFileCMesh()
          cc.setMesh(c)
-         cc.setNameFieldAtLevel(0, DataArrayAsciiChar(["Cell#%.3d        " % (i) for i in range(4)]))
-         cc.setNameFieldAtLevel(1, DataArrayAsciiChar(["Node#%.3d        " % (i) for i in range(9)]))
 -        cc.setNameFieldAtLevel(0,DataArrayAsciiChar(["Cell#%.3d        "%(i) for i in xrange(4)]))
 -        cc.setNameFieldAtLevel(1,DataArrayAsciiChar(["Node#%.3d        "%(i) for i in xrange(9)]))
++        cc.setNameFieldAtLevel(0,DataArrayAsciiChar(["Cell#%.3d        "%(i) for i in range(4)]))
++        cc.setNameFieldAtLevel(1,DataArrayAsciiChar(["Node#%.3d        "%(i) for i in range(9)]))
          cc.write(fname2,2)
          ccr=MEDFileMesh.New(fname2)
-         self.assertTrue(ccr.getNameFieldAtLevel(0).isEqual(DataArrayAsciiChar(["Cell#%.3d        " % (i) for i in range(4)])))
-         self.assertTrue(ccr.getNameFieldAtLevel(1).isEqual(DataArrayAsciiChar(["Node#%.3d        " % (i) for i in range(9)])))
 -        self.assertTrue(ccr.getNameFieldAtLevel(0).isEqual(DataArrayAsciiChar(["Cell#%.3d        "%(i) for i in xrange(4)])))
 -        self.assertTrue(ccr.getNameFieldAtLevel(1).isEqual(DataArrayAsciiChar(["Node#%.3d        "%(i) for i in xrange(9)])))
++        self.assertTrue(ccr.getNameFieldAtLevel(0).isEqual(DataArrayAsciiChar(["Cell#%.3d        "%(i) for i in range(4)])))
++        self.assertTrue(ccr.getNameFieldAtLevel(1).isEqual(DataArrayAsciiChar(["Node#%.3d        "%(i) for i in range(9)])))
          self.assertTrue(cc.isEqual(ccr,1e-12)[0])
          ccr.getNameFieldAtLevel(1).setIJ(0,0,'M')
          self.assertTrue(not cc.isEqual(ccr,1e-12)[0])
          self.assertTrue(a.isEqual(f1,1e-12,1e-12))
          a=ffs1.getFieldOnMeshAtLevel(ON_CELLS,0,1,0,mm1)
          self.assertTrue(a.isEqual(f1,1e-12,1e-12))
-         it = ffs1.__iter__() ; next(it) ; ff2bis = next(it)
 -        it=ffs1.__iter__() ; it.next() ; ff2bis=it.next()
++        it=ffs1.__iter__() ; next(it) ; ff2bis=next(it)
          a=ff2bis.getFieldOnMeshAtLevel(0,ON_CELLS,mm1)
          self.assertTrue(a.getArray().isEqual(2*f1.getArray()))
          f1.setTime(3.,1,2) ; f1.getArray()[:]*=2
          nf1=MEDCouplingFieldInt(ON_NODES)
          nf1.setTime(9.,10,-1)
          nf1.setMesh(f1.getMesh())
-         narr = DataArrayInt(12, 2) ; narr.setInfoOnComponents(["aa [u1]", "bbbvv [ppp]"]) ; narr[:, 0] = list(range(12)) ; narr[:, 1] = 2 * narr[:, 0]
 -        narr=DataArrayInt(12,2) ; narr.setInfoOnComponents(["aa [u1]","bbbvv [ppp]"]) ; narr[:,0]=range(12) ; narr[:,1]=2*narr[:,0]
++        narr=DataArrayInt(12,2) ; narr.setInfoOnComponents(["aa [u1]","bbbvv [ppp]"]) ; narr[:,0]=list(range(12)) ; narr[:,1]=2*narr[:,0]
          nf1.setName("VectorFieldOnNodes") ; nf1.setArray(narr)
          nff1=MEDFileIntField1TS.New()
          nff1.setFieldNoProfileSBT(nf1)
          nf2=MEDCouplingFieldInt(ON_NODES)
          nf2.setTime(19.,20,-11)
          nf2.setMesh(f1.getMesh())
-         narr2 = DataArrayInt(8, 2) ; narr.setInfoOnComponents(["aapfl [u1]", "bbbvvpfl [ppp]"]) ; narr2[:, 0] = list(range(8)) ; narr2[:, 0] += 10  ; narr2[:, 1] = 3 * narr2[:, 0]
 -        narr2=DataArrayInt(8,2) ; narr.setInfoOnComponents(["aapfl [u1]","bbbvvpfl [ppp]"]) ; narr2[:,0]=range(8) ; narr2[:,0]+=10  ; narr2[:,1]=3*narr2[:,0]
++        narr2=DataArrayInt(8,2) ; narr.setInfoOnComponents(["aapfl [u1]","bbbvvpfl [ppp]"]) ; narr2[:,0]=list(range(8)) ; narr2[:,0]+=10  ; narr2[:,1]=3*narr2[:,0]
          nf2.setName("VectorFieldOnNodesPfl") ; narr2.setName(nf2.getName()) ; nf2.setArray(narr2)
          nff2=MEDFileIntField1TS.New()
          npfl=DataArrayInt([1,2,4,5,6,7,10,11]) ; npfl.setName("npfl")
          c=DataArrayDouble(12) ; c.iota(); m=MEDCouplingCMesh() ; m.setCoordsAt(0,c) ; m.setName("mesh")
          mm=MEDFileCMesh() ; mm.setMesh(m) ; mm.write(fname,2)
          f1.setMesh(m)
-         arr = DataArrayDouble(12, 2) ; arr.setInfoOnComponents(["aa [u1]", "bbbvv [ppp]"]) ; arr[:, 0] = list(range(12)) ; arr[:, 1] = 2 * arr[:, 0]
 -        arr=DataArrayDouble(12,2) ; arr.setInfoOnComponents(["aa [u1]","bbbvv [ppp]"]) ; arr[:,0]=range(12) ; arr[:,1]=2*arr[:,0]
++        arr=DataArrayDouble(12,2) ; arr.setInfoOnComponents(["aa [u1]","bbbvv [ppp]"]) ; arr[:,0]=list(range(12)) ; arr[:,1]=2*arr[:,0]
          f1.setArray(arr)
          f1.setName("Field1")
          ff1=MEDFileField1TS.New()
          tri=MEDCouplingUMesh("tri",2)
          tri.allocateCells() ; tri.insertNextCell(NORM_TRI3,[0,1,2])
          tri.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,0.)]))
-         tris = [tri.deepCopy() for i in range(4)]
 -        tris=[tri.deepCopy() for i in xrange(4)]
++        tris=[tri.deepCopy() for i in range(4)]
          for i,elt in enumerate(tris): elt.translate([i,0])
          tris=MEDCouplingUMesh.MergeUMeshes(tris)
          quad=MEDCouplingUMesh("quad",2)
          quad.allocateCells() ; quad.insertNextCell(NORM_QUAD4,[0,1,2,3])
          quad.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,1.),(1.,0.)]))
-         quads = [quad.deepCopy() for i in range(5)]
 -        quads=[quad.deepCopy() for i in xrange(5)]
++        quads=[quad.deepCopy() for i in range(5)]
          for i,elt in enumerate(quads): elt.translate([5+i,0])
          quads=MEDCouplingUMesh.MergeUMeshes(quads)
          m=MEDCouplingUMesh.MergeUMeshes(tris,quads)
          tri=MEDCouplingUMesh("tri",2)
          tri.allocateCells() ; tri.insertNextCell(NORM_TRI3,[0,1,2])
          tri.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,0.)]))
-         tris = [tri.deepCopy() for i in range(4)]
 -        tris=[tri.deepCopy() for i in xrange(4)]
++        tris=[tri.deepCopy() for i in range(4)]
          for i,elt in enumerate(tris): elt.translate([i,0])
          tris=MEDCouplingUMesh.MergeUMeshes(tris)
          quad=MEDCouplingUMesh("quad",2)
          quad.allocateCells() ; quad.insertNextCell(NORM_QUAD4,[0,1,2,3])
          quad.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,1.),(1.,0.)]))
-         quads = [quad.deepCopy() for i in range(5)]
 -        quads=[quad.deepCopy() for i in xrange(5)]
++        quads=[quad.deepCopy() for i in range(5)]
          for i,elt in enumerate(quads): elt.translate([5+i,0])
          quads=MEDCouplingUMesh.MergeUMeshes(quads)
          m=MEDCouplingUMesh.MergeUMeshes(tris,quads)
          tri=MEDCouplingUMesh("tri",2)
          tri.allocateCells() ; tri.insertNextCell(NORM_TRI3,[0,1,2])
          tri.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,0.)]))
-         tris = [tri.deepCopy() for i in range(4)]
 -        tris=[tri.deepCopy() for i in xrange(4)]
++        tris=[tri.deepCopy() for i in range(4)]
          for i,elt in enumerate(tris): elt.translate([i,0])
          tris=MEDCouplingUMesh.MergeUMeshes(tris)
          quad=MEDCouplingUMesh("quad",2)
          quad.allocateCells() ; quad.insertNextCell(NORM_QUAD4,[0,1,2,3])
          quad.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,1.),(1.,0.)]))
-         quads = [quad.deepCopy() for i in range(5)]
 -        quads=[quad.deepCopy() for i in xrange(5)]
++        quads=[quad.deepCopy() for i in range(5)]
          for i,elt in enumerate(quads): elt.translate([5+i,0])
          quads=MEDCouplingUMesh.MergeUMeshes(quads)
          m=MEDCouplingUMesh.MergeUMeshes(tris,quads)
          tri=MEDCouplingUMesh("tri",2)
          tri.allocateCells() ; tri.insertNextCell(NORM_TRI3,[0,1,2])
          tri.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,0.)]))
-         tris = [tri.deepCopy() for i in range(4)]
 -        tris=[tri.deepCopy() for i in xrange(4)]
++        tris=[tri.deepCopy() for i in range(4)]
          for i,elt in enumerate(tris): elt.translate([i,0])
          tris=MEDCouplingUMesh.MergeUMeshes(tris)
          quad=MEDCouplingUMesh("quad",2)
          quad.allocateCells() ; quad.insertNextCell(NORM_QUAD4,[0,1,2,3])
          quad.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,1.),(1.,0.)]))
-         quads = [quad.deepCopy() for i in range(5)]
 -        quads=[quad.deepCopy() for i in xrange(5)]
++        quads=[quad.deepCopy() for i in range(5)]
          for i,elt in enumerate(quads): elt.translate([5+i,0])
          quads=MEDCouplingUMesh.MergeUMeshes(quads)
          m=MEDCouplingUMesh.MergeUMeshes(tris,quads)
          tri=MEDCouplingUMesh("tri",2)
          tri.allocateCells() ; tri.insertNextCell(NORM_TRI3,[0,1,2])
          tri.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,0.)]))
-         tris = [tri.deepCopy() for i in range(30)]
 -        tris=[tri.deepCopy() for i in xrange(30)]
++        tris=[tri.deepCopy() for i in range(30)]
          for i,elt in enumerate(tris): elt.translate([i,0])
          tris=MEDCouplingUMesh.MergeUMeshes(tris)
          quad=MEDCouplingUMesh("quad",2)
          quad.allocateCells() ; quad.insertNextCell(NORM_QUAD4,[0,1,2,3])
          quad.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,1.),(1.,0.)]))
-         quads = [quad.deepCopy() for i in range(40)]
 -        quads=[quad.deepCopy() for i in xrange(40)]
++        quads=[quad.deepCopy() for i in range(40)]
          for i,elt in enumerate(quads): elt.translate([40+i,0])
          quads=MEDCouplingUMesh.MergeUMeshes(quads)
          m=MEDCouplingUMesh.MergeUMeshes(tris,quads)
          self.assertTrue(not ff0.getUndergroundDataArray().isAllocated())
          self.assertEqual(ff0.getUndergroundDataArray().getInfoOnComponents(),['X [km]','YY [mm]'])
          heap_memory_ref=ff0.getHeapMemorySize()
-         self.assertIn(heap_memory_ref, list(range(182, 465 + 2 * strMulFac)))
 -        self.assertIn(heap_memory_ref,xrange(182,481+2*strMulFac))
++        self.assertIn(heap_memory_ref,range(182,481+2*strMulFac))
          ff0.loadArrays() ##
          arr=DataArrayDouble(140) ; arr.iota() ; arr.rearrange(2)
          self.assertTrue(ff0.getUndergroundDataArray().isEqualWithoutConsideringStr(arr,1e-14))
          ff0=MEDFileField1TS(fname,"FieldCellPfl",False)
          self.assertEqual(ff0.getUndergroundDataArray().getInfoOnComponents(),["XX [pm]","YYY [hm]"])
          heap_memory_ref=ff0.getHeapMemorySize()
-         self.assertIn(heap_memory_ref, list(range(350, 520 + 6 * strMulFac)))
 -        self.assertIn(heap_memory_ref,xrange(350,536+6*strMulFac))
++        self.assertIn(heap_memory_ref,range(350,536+6*strMulFac))
          ff0.loadArrays() ##
          arr=DataArrayDouble(100) ; arr.iota() ; arr.rearrange(2)
          self.assertTrue(ff0.getUndergroundDataArray().isEqualWithoutConsideringStr(arr,1e-14))
          self.assertEqual(ff0.getUndergroundDataArray().getIJ(30,1),5.5)
          self.assertTrue(not ff0.getUndergroundDataArray().isEqualWithoutConsideringStr(arr,1e-14))
          heap_memory_ref=ff0.getHeapMemorySize()
-         self.assertIn(heap_memory_ref, list(range(1100, 1384 + 2 * strMulFac)))
 -        self.assertIn(heap_memory_ref,xrange(1100,1400+2*strMulFac))
++        self.assertIn(heap_memory_ref,range(1100,1400+2*strMulFac))
          ff0.unloadArrays()
          hmd=ff0.getHeapMemorySize()-heap_memory_ref
          self.assertEqual(hmd,-800) # -50*8*2
          #
          ff0=MEDFileField1TS(fname,"FieldCellPfl",-1,-1,False)
          heap_memory_ref=ff0.getHeapMemorySize()
-         self.assertIn(heap_memory_ref, list(range(299, 520 + 6 * strMulFac)))
 -        self.assertIn(heap_memory_ref,xrange(299,536+6*strMulFac))
++        self.assertIn(heap_memory_ref,range(299,536+6*strMulFac))
          ff0.loadArrays() ##
          self.assertTrue(ff0.getUndergroundDataArray().isEqualWithoutConsideringStr(arr,1e-14))
          self.assertEqual(ff0.getHeapMemorySize()-heap_memory_ref,50*8*2)
          #
          ff0=MEDFileAnyTypeFieldMultiTS.New(fname,fieldName,False)
          heap_memory_ref=ff0.getHeapMemorySize()
-         self.assertIn(heap_memory_ref,list(range(5536,8212+(80+26+1)*strMulFac)))
 -        self.assertIn(heap_memory_ref,xrange(5536,10242+(80+26+1)*strMulFac))
++        self.assertIn(heap_memory_ref,range(5536,10242+(80+26+1)*strMulFac))
          ff0.loadArrays()
          self.assertEqual(ff0.getHeapMemorySize()-heap_memory_ref,20*70*8*2)
          del ff0
          #
          ffs=MEDFileFields(fname,False)
          heap_memory_ref=ffs.getHeapMemorySize()
-         self.assertIn(heap_memory_ref,list(range(5335,9031+(80+50+len(ffs))*strMulFac)))
 -        self.assertIn(heap_memory_ref,xrange(5335,11507+(80+50+len(ffs))*strMulFac))
++        self.assertIn(heap_memory_ref,range(5335,11507+(80+50+len(ffs))*strMulFac))
          ffs.loadArrays()
          self.assertEqual(ffs.getHeapMemorySize()-heap_memory_ref,20*70*8*2+70*8*2+50*8*2)
          pass
          tri=MEDCouplingUMesh("tri",2)
          tri.allocateCells() ; tri.insertNextCell(NORM_TRI3,[0,1,2])
          tri.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,0.)]))
-         tris = [tri.deepCopy() for i in range(4)]
 -        tris=[tri.deepCopy() for i in xrange(4)]
++        tris=[tri.deepCopy() for i in range(4)]
          for i,elt in enumerate(tris): elt.translate([i,0])
          tris=MEDCouplingUMesh.MergeUMeshes(tris)
          quad=MEDCouplingUMesh("quad",2)
          quad.allocateCells() ; quad.insertNextCell(NORM_QUAD4,[0,1,2,3])
          quad.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,1.),(1.,0.)]))
-         quads = [quad.deepCopy() for i in range(5)]
 -        quads=[quad.deepCopy() for i in xrange(5)]
++        quads=[quad.deepCopy() for i in range(5)]
          for i,elt in enumerate(quads): elt.translate([5+i,0])
          quads=MEDCouplingUMesh.MergeUMeshes(quads)
          m=MEDCouplingUMesh.MergeUMeshes(tris,quads)
          tri=MEDCouplingUMesh("tri",2)
          tri.allocateCells() ; tri.insertNextCell(NORM_TRI3,[0,1,2])
          tri.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,0.)]))
-         tris = [tri.deepCopy() for i in range(4)]
 -        tris=[tri.deepCopy() for i in xrange(4)]
++        tris=[tri.deepCopy() for i in range(4)]
          for i,elt in enumerate(tris): elt.translate([i,0])
          tris=MEDCouplingUMesh.MergeUMeshes(tris)
          quad=MEDCouplingUMesh("quad",2)
          quad.allocateCells() ; quad.insertNextCell(NORM_QUAD4,[0,1,2,3])
          quad.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,1.),(1.,0.)]))
-         quads = [quad.deepCopy() for i in range(5)]
 -        quads=[quad.deepCopy() for i in xrange(5)]
++        quads=[quad.deepCopy() for i in range(5)]
          for i,elt in enumerate(quads): elt.translate([5+i,0])
          quads=MEDCouplingUMesh.MergeUMeshes(quads)
          m=MEDCouplingUMesh.MergeUMeshes(tris,quads)
          m00=MEDCouplingUMesh("mesh",1) ; m00.setCoords(m0.getCoords()) ; m00.allocateCells(0)
          m=MEDFileUMesh()
          m.setMeshAtLevel(0,m00)
-         m.setRenumFieldArr(1, DataArrayInt(list(range(10, 26))))
 -        m.setRenumFieldArr(1,DataArrayInt(range(10,26)))
++        m.setRenumFieldArr(1,DataArrayInt(list(range(10,26))))
          m.setFamilyFieldArr(1,DataArrayInt([-1,-1,-1,-1,-1,-2,-2,-2,-2,-2,-2,0,-1,-3,-3,-3]))
          m.write(fname,2)
          del m,a,c,m0,m00
          m=MEDFileMesh.New(fname)
          self.assertEqual((),m.getNonEmptyLevels())
          self.assertTrue(m.getCoords().isEqual(DataArrayDouble([(0,0),(1,0),(2,0),(3,0),(0,1),(1,1),(2,1),(3,1),(0,2),(1,2),(2,2),(3,2),(0,3),(1,3),(2,3),(3,3)]),1e-12))
-         self.assertTrue(m.getNumberFieldAtLevel(1).isEqual(DataArrayInt(list(range(10, 26)))))
 -        self.assertTrue(m.getNumberFieldAtLevel(1).isEqual(DataArrayInt(range(10,26))))
++        self.assertTrue(m.getNumberFieldAtLevel(1).isEqual(DataArrayInt(list(range(10,26)))))
          self.assertTrue(m.getFamilyFieldAtLevel(1).isEqual(DataArrayInt([-1,-1,-1,-1,-1,-2,-2,-2,-2,-2,-2,0,-1,-3,-3,-3])))
          pass
  
          m.insertNextCell([0,2,1,3])
          m.setCoords(DataArrayDouble([0.,0.,1.,1.,1.,0.,0.,1.],4,2))
          #
-         ms = [m.deepCopy() for i in range(4)]
 -        ms=[m.deepCopy() for i in xrange(4)]
++        ms=[m.deepCopy() for i in range(4)]
          for i,elt in enumerate(ms):
              elt.translate([float(i)*1.5,0.])
              pass
          m0=MEDCoupling1SGTUMesh.Merge1SGTUMeshes(ms).buildUnstructured()
          m0.convertAllToPoly()
          #
-         ms = [m.deepCopy() for i in range(5)]
 -        ms=[m.deepCopy() for i in xrange(5)]
++        ms=[m.deepCopy() for i in range(5)]
          for i,elt in enumerate(ms):
              elt.translate([float(i)*1.5,1.5])
              pass
          renum0=DataArrayInt([3,6,7,10,11,0,2,1,9,8,5,4,12,13,14,24,23,22,21,20,19,18,17,16,15])
          famField0=DataArrayInt([-3,-6,-7,-10,-11,0,-2,-1,-9,-8,-5,-4,-12,-13,-14,-24,-23,-22,-21,-20,-19,-18,-17,-16,-15])
          namesCellL0=DataArrayAsciiChar(25,16)
-         namesCellL0[:] = ["Cell#%.3d        " % (i) for i in range(25)]
 -        namesCellL0[:]=["Cell#%.3d        "%(i) for i in xrange(25)]
++        namesCellL0[:]=["Cell#%.3d        "%(i) for i in range(25)]
          renumM1=DataArrayInt([3,4,0,2,1])
          famFieldM1=DataArrayInt([-3,-4,0,-2,-1])
          mm.setRenumFieldArr(0,renum0)
          renum1=DataArrayInt([13,16,17,20,21,10,12,11,19,18,15,14,22,23,24,34,33,32,31,30,29,28,27,26,25,45,44,43,42,41,40,39,38,37,36,35])
          famField1=DataArrayInt([-13,-16,-17,-20,-21,-10,-12,-11,-19,-18,-15,-14,-22,-23,-24,-34,-33,-32,-31,-30,-29,-28,-27,-26,-25,-45,-44,-43,-42,-41,-40,-39,-38,-37,-36,-35])
          namesNodes=DataArrayAsciiChar(36,16)
-         namesNodes[:] = ["Node#%.3d        " % (i) for i in range(36)]
 -        namesNodes[:]=["Node#%.3d        "%(i) for i in xrange(36)]
++        namesNodes[:]=["Node#%.3d        "%(i) for i in range(36)]
          mm.setRenumFieldArr(1,renum1)
          mm.setFamilyFieldArr(1,famField1)
          mm.setNameFieldAtLevel(1,namesNodes)
          f=MEDCouplingFieldDouble(ON_CELLS,ONE_TIME) ; f.setMesh(m)
          f.setName("Field")
          arr=DataArrayDouble(25,2) ; arr.setInfoOnComponents(compos)
-         arr[:, 0] = list(range(25))
-         arr[:, 1] = list(range(100, 125))
 -        arr[:,0]=range(25)
 -        arr[:,1]=range(100,125)
++        arr[:,0]=list(range(25))
++        arr[:,1]=list(range(100,125))
          f.setArray(arr)
          WriteField(fileName,f,True)
          f=MEDCouplingFieldDouble(ON_NODES,ONE_TIME) ; f.setMesh(m)
          f.setName("FieldNode")
          arr=DataArrayDouble(36,2) ; arr.setInfoOnComponents(compos)
-         arr[:, 0] = list(range(200, 236))
-         arr[:, 1] = list(range(300, 336))
 -        arr[:,0]=range(200,236)
 -        arr[:,1]=range(300,336)
++        arr[:,0]=list(range(200,236))
++        arr[:,1]=list(range(300,336))
          f.setArray(arr)
          f.checkConsistencyLight()
          WriteFieldUsingAlreadyWrittenMesh(fileName,f)
          fs=MEDFileFields.LoadPartOf(fileName,False,ms)
          fs=fs.deepCopy()
          fs[0][0].loadArrays()
-         arr = DataArrayDouble(12, 2) ; arr[:, 0] = list(range(3, 15)) ; arr[:, 1] = list(range(103, 115))
 -        arr=DataArrayDouble(12,2) ; arr[:,0]=range(3,15) ; arr[:,1]=range(103,115)
++        arr=DataArrayDouble(12,2) ; arr[:,0]=range(3,15) ; arr[:,1]=list(range(103,115))
          arr.setInfoOnComponents(compos)
          self.assertTrue(fs[0][0].getUndergroundDataArray().isEqual(arr,1e-12))
          fs[1][0].loadArrays()
-         arr = DataArrayDouble(21, 2) ; arr[:, 0] = list(range(203, 224)) ; arr[:, 1] = list(range(303, 324))
 -        arr=DataArrayDouble(21,2) ; arr[:,0]=range(203,224) ; arr[:,1]=range(303,324)
++        arr=DataArrayDouble(21,2) ; arr[:,0]=range(203,224) ; arr[:,1]=list(range(303,324))
          arr.setInfoOnComponents(compos)
          self.assertTrue(fs[1][0].getUndergroundDataArray().isEqual(arr,1e-12))
          pass
          f=MEDCouplingFieldDouble(ON_CELLS,ONE_TIME) ; f.setMesh(m)
          f.setName("Field")
          arr=DataArrayDouble(25,2) ; arr.setInfoOnComponents(compos)
-         arr[:, 0] = list(range(25))
-         arr[:, 1] = list(range(100, 125))
 -        arr[:,0]=range(25)
 -        arr[:,1]=range(100,125)
++        arr[:,0]=list(range(25))
++        arr[:,1]=list(range(100,125))
          f.setArray(arr)
          WriteField(fileName,f,True)
          f=MEDCouplingFieldDouble(ON_NODES,ONE_TIME) ; f.setMesh(m)
          f.setName("FieldNode")
          arr=DataArrayDouble(36,2) ; arr.setInfoOnComponents(compos)
-         arr[:, 0] = list(range(200, 236))
-         arr[:, 1] = list(range(300, 336))
 -        arr[:,0]=range(200,236)
 -        arr[:,1]=range(300,336)
++        arr[:,0]=list(range(200,236))
++        arr[:,1]=list(range(300,336))
          f.setArray(arr)
          f.checkConsistencyLight()
          WriteFieldUsingAlreadyWrittenMesh(fileName,f)
          g2_1.setName("G2")
          mm.setGroupsAtLevel(-1,[g1_1,g2_1],False)
          g1_N=DataArrayInt.New()
-         g1_N.setValues(list(range(8)), 8, 1)
 -        g1_N.setValues(range(8),8,1)
++        g1_N.setValues(list(range(8)),8,1)
          g1_N.setName("G1")
          g2_N=DataArrayInt.New()
-         g2_N.setValues(list(range(9)), 9, 1)
 -        g2_N.setValues(range(9),9,1)
++        g2_N.setValues(list(range(9)),9,1)
          g2_N.setName("G2")
          mm.setGroupsAtLevel(1,[g1_N,g2_N],False)
          mm.createGroupOnAll(0,"GrpOnAllCell")
          m=m.buildUnstructured()
          m.setName(meshName)
          #
-         nbOfField = nbPdt // maxPdt
 -        nbOfField=nbPdt/maxPdt
++        nbOfField=nbPdt//maxPdt
          fs=MEDFileFields()
 -        for j in xrange(nbOfField):
 +        for j in range(nbOfField):
              fmts=MEDFileFieldMultiTS()
              s=DataArray.GetSlice(slice(0,nbPdt,1),j,nbOfField)
-             for i in range(s.start, s.stop, s.step):
 -            for i in xrange(s.start,s.stop,s.step):
++            for i in range(s.start,s.stop,s.step):
                  f=MEDCouplingFieldDouble(ON_NODES)
                  f.setMesh(m)
                  arr=DataArrayDouble(nbNodes) ; arr.iota() ; arr*=i
              zeResu.setName(k)
              fs2.pushField(zeResu)
              pass
-         self.assertEqual(fs2[0].getTimeSteps(), [(i, 0, float(i)) for i in range(nbPdt)])
 -        self.assertEqual(fs2[0].getTimeSteps(),[(i,0,float(i)) for i in xrange(nbPdt)])
++        self.assertEqual(fs2[0].getTimeSteps(),[(i,0,float(i)) for i in range(nbPdt)])
          pass
      
      def testMEDFileMeshRearrangeFamIds1(self):
Simple merge