]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
[PY3] MEDCoupling ready for Python 3 ! gdd/py3_V8
authorGilles DAVID <gilles-g.david@edf.fr>
Mon, 27 Mar 2017 15:00:02 +0000 (17:00 +0200)
committerGilles DAVID <gilles-g.david@edf.fr>
Tue, 25 Apr 2017 10:12:13 +0000 (12:12 +0200)
49 files changed:
CMakeLists.txt
doc/user/doxygen/BuildPyExamplesFromCPP.py
doc/user/doxygen/doxy2swig/doxy2swig.py
src/INTERP_KERNEL/GaussPoints/CleanUpGauss.py
src/MEDCoupling_Swig/CMakeLists.txt
src/MEDCoupling_Swig/MEDCouplingBasicsTest1.py
src/MEDCoupling_Swig/MEDCouplingBasicsTest2.py
src/MEDCoupling_Swig/MEDCouplingBasicsTest3.py
src/MEDCoupling_Swig/MEDCouplingBasicsTest4.py
src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py
src/MEDCoupling_Swig/MEDCouplingCommon.i
src/MEDCoupling_Swig/MEDCouplingDataArrayTypemaps.i
src/MEDCoupling_Swig/MEDCouplingDataForTest.py
src/MEDCoupling_Swig/MEDCouplingExamplesTest.py
src/MEDCoupling_Swig/MEDCouplingFinalize.i
src/MEDCoupling_Swig/MEDCouplingIntersectTest.py
src/MEDCoupling_Swig/MEDCouplingMemArray.i
src/MEDCoupling_Swig/MEDCouplingNumPyTest.py
src/MEDCoupling_Swig/MEDCouplingPickleTest.py
src/MEDCoupling_Swig/MEDCouplingRemapperTest.py
src/MEDLoader/Swig/CMakeLists.txt
src/MEDLoader/Swig/CaseIO.py
src/MEDLoader/Swig/CaseReader.py
src/MEDLoader/Swig/CaseWriter.py
src/MEDLoader/Swig/ConvertMEDFileTo30.py
src/MEDLoader/Swig/MEDLoader.i
src/MEDLoader/Swig/MEDLoaderCommon.i
src/MEDLoader/Swig/MEDLoaderCouplingTrainingSession.py
src/MEDLoader/Swig/MEDLoaderDataForTest.py
src/MEDLoader/Swig/MEDLoaderExamplesTest.py
src/MEDLoader/Swig/MEDLoaderSplitter.py
src/MEDLoader/Swig/MEDLoaderTest1.py
src/MEDLoader/Swig/MEDLoaderTest3.py
src/MEDLoader/Swig/MEDLoaderTest4.py
src/MEDLoader/Swig/MEDLoaderTypemaps.i
src/MEDLoader/Swig/SauvLoaderTest.py
src/MEDLoader/Swig/VTKReader.py
src/MEDLoader/Swig/medutilities.py
src/MEDPartitioner_Swig/CMakeLists.txt
src/MEDPartitioner_Swig/MEDPartitionerTest.py
src/ParaMEDMEM_Swig/CMakeLists.txt
src/ParaMEDMEM_Swig/ParaMEDMEM.typemap
src/ParaMEDMEM_Swig/test_InterpKernelDEC.py
src/ParaMEDMEM_Swig/test_NonCoincidentDEC.py
src/ParaMEDMEM_Swig/test_StructuredCoincidentDEC.py
src/RENUMBER_Swig/CMakeLists.txt
src/RENUMBER_Swig/MEDRenumberCommon.i
v8_work/ModifyNamespace.py
v8_work/medcoup7to8.py

index aad68421adb11cad754f017d8d449acc7c95be43..4dfda9cb3df93316afcd6ab95fc2d3c431b3a728 100644 (file)
@@ -153,6 +153,9 @@ IF(MEDCOUPLING_ENABLE_PYTHON)
   SALOME_LOG_OPTIONAL_PACKAGE(PythonInterp MEDCOUPLING_ENABLE_PYTHON)
   SALOME_LOG_OPTIONAL_PACKAGE(PythonLibs MEDCOUPLING_ENABLE_PYTHON)
   SALOME_LOG_OPTIONAL_PACKAGE(SWIG   MEDCOUPLING_ENABLE_PYTHON)
+  IF ("${PYTHON_VERSION_MAJOR}" STREQUAL "3")
+      MESSAGE(STATUS "Using Python 3")
+  ENDIF()
 ENDIF(MEDCOUPLING_ENABLE_PYTHON)
 
 IF(MEDCOUPLING_BUILD_DOC)
index 9b4f59317918f592ec1d86aa2b89ac9d76644161..fbc36f33bc837f0c4d6c25a38d96eda5b4958dda 100644 (file)
@@ -66,8 +66,8 @@ def discardPythonFrom(contents):
 
 # Usage: BuildPyExamplesFromCPP.py <examples.in> <output directory>
 
-fCpp=file(sys.argv[1],"r")
-cppCont=fCpp.readlines() ; del fCpp
+with open(sys.argv[1], "r") as fCpp:
+    cppCont = fCpp.readlines()
 pyCont=cppCont[:]
 pyCont=[elt.replace("medcouplingcppexamples","medcouplingpyexamples") for elt in pyCont]
 pyCont=Cpp2Python(pyCont)
@@ -79,8 +79,8 @@ cppCont=discardPythonFrom(cppCont) # remove Python-only contents from Cpp
 # Save CPP and PY examples in two separate dox files
 outFileName=os.path.join(sys.argv[2],os.path.basename(sys.argv[1]))
 
-f=file(os.path.splitext(outFileName)[0]+"CPP.dox","w")
-f.writelines(cppCont) ; del f
+with open(os.path.splitext(outFileName)[0] + "CPP.dox", "w") as f:
+    f.writelines(cppCont)
 
-f=file(os.path.splitext(outFileName)[0]+"PY.dox","w")
-f.writelines(pyCont) ; del f
+with open(os.path.splitext(outFileName)[0] + "PY.dox", "w") as f:
+    f.writelines(pyCont)
index b7c7755d610698b55c688a02307e14104e282105..f8499b449647ca45f350ef9048913860754c0749 100755 (executable)
@@ -150,7 +150,7 @@ class Doxy2SWIG:
 
     def add_text(self, value):
         """Adds text corresponding to `value` into `self.pieces`."""
-        if type(value) in (types.ListType, types.TupleType):
+        if isinstance(value, (list, tuple)):
             self.pieces.extend(value)
         else:
             self.pieces.append(value)
@@ -210,13 +210,13 @@ class Doxy2SWIG:
         kind = node.attributes['kind'].value
         if kind in ('class', 'struct'):
             prot = node.attributes['prot'].value
-            if prot <> 'public':
+            if prot != 'public':
                 return
             names = ('compoundname', 'briefdescription',
                      'detaileddescription', 'includes')
             first = self.get_specific_nodes(node, names)
             for n in names:
-                if first.has_key(n):
+                if n in first:
                     self.parse(first[n])
             self.add_text(['";','\n'])
             for n in node.childNodes:
@@ -280,7 +280,7 @@ class Doxy2SWIG:
             if name[:8] == 'operator': # Don't handle operators yet.
                 return
 
-            if not first.has_key('definition') or \
+            if 'definition' not in first or \
                    kind in ['variable', 'typedef']:
                 return
 
@@ -375,7 +375,7 @@ class Doxy2SWIG:
             if not os.path.exists(fname):
                 fname = os.path.join(self.my_dir,  fname)
             if not self.quiet:
-                print "parsing file: %s"%fname
+                print("parsing file: %s"%fname)
             p = Doxy2SWIG(fname, self.include_function_definition, self.quiet)
             p.generate()
             self.pieces.extend(self.clean_pieces(p.pieces))
index 7a2c28e53daf61bc30bdbcd20f8e774b0ccb6649..2cf96300fac4ee0520706273105336421df2bded 100644 (file)
@@ -39,7 +39,7 @@ if not mEnd:
 #
 nbLines=len(lines)-4
 casePat=re.compile("[\s]+case[\s]+([\d]+)\:[\s]*$")
-entries=filter(lambda (i,x): casePat.match(x),enumerate(lines[offsetLines:-1]))
+entries=[i_x for i_x in enumerate(lines[offsetLines:-1]) if casePat.match(i_x[1])]
 #
 nbPts=len(entries)
 if nbLines%nbPts!=0:
@@ -48,7 +48,7 @@ dim=nbLines/nbPts-2
 if dim<1 or dim>3:
     raise Exception("Ooops invalid dim !")
 entries=[(i,int(casePat.match(elt).group(1))) for i,elt in entries]
-assert(set([elt[1] for elt in entries])==set(range(nbPts)))
+assert({elt[1] for elt in entries} == set(range(nbPts)))
 #
 partEndEntries=re.compile("[\s]*break[\s]*\;[\s]*$")
 zePat=re.compile("[\s]+coords\[([\d]+)\][\s]*=[\s]*([\-]?[\d]+[\.]?[\d]*)[\s]*\;[\s]*$")
@@ -56,7 +56,7 @@ zeTab=(nbPts*dim)*[None]
 for lineId,ptId in entries:
     endLine=lines[offsetLines+lineId+1+dim]
     assert(partEndEntries.match(endLine))
-    for j in xrange(dim):
+    for j in range(dim):
         curLine=lines[offsetLines+lineId+1+j]
         m=zePat.match(curLine)
         assert(m)
@@ -68,11 +68,11 @@ assert(None not in zeTab)
 patInit="Init"
 assert(m0.group(1)[-len(patInit):]==patInit)
 varName="%s_REF"%((m0.group(1)[:-len(patInit)]).upper())
-print("const double %s[%d]={%s};"%(varName,len(zeTab),", ".join(zeTab)))
-for i in xrange(nbPts):
-    print("  case %d:"%(i))
-    for j in xrange(dim):
-        print("    coords[%d] = %s[%d];"%(j,varName,i*dim+j))
+print(("const double %s[%d]={%s};"%(varName,len(zeTab),", ".join(zeTab))))
+for i in range(nbPts):
+    print(("  case %d:"%(i)))
+    for j in range(dim):
+        print(("    coords[%d] = %s[%d];"%(j,varName,i*dim+j)))
         pass
     print("    break;")
         
index a3cf107e343143fcd98a56ca7b1e7da006e4a8cb..ce7ac5b33fe85cf37f207ce92ae0137eca8208cd 100644 (file)
@@ -22,7 +22,11 @@ INCLUDE(${SWIG_USE_FILE})
 ADD_DEFINITIONS(${PYTHON_DEFINITIONS} ${NUMPY_DEFINITIONS} ${SCIPY_DEFINITIONS})
 
 SET_SOURCE_FILES_PROPERTIES(MEDCoupling.i PROPERTIES CPLUSPLUS ON)
-SET_SOURCE_FILES_PROPERTIES(MEDCoupling.i PROPERTIES SWIG_DEFINITIONS "-shadow")
+IF ("${PYTHON_VERSION_MAJOR}" STREQUAL "3")
+  SET_SOURCE_FILES_PROPERTIES(MEDCoupling.i PROPERTIES SWIG_FLAGS "-py3")
+ELSE()
+  SET_SOURCE_FILES_PROPERTIES(MEDCoupling.i PROPERTIES SWIG_DEFINITIONS "-shadow")
+ENDIF()
 SET(SWIG_MODULE_MEDCoupling_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS}")
 
 SET (MEDCoupling_SWIG_DPYS_FILES
@@ -91,7 +95,11 @@ SWIG_ADD_MODULE(MEDCoupling python MEDCoupling.i)
 SWIG_LINK_LIBRARIES(MEDCoupling ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} medcoupling)
 
 SET_SOURCE_FILES_PROPERTIES(MEDCouplingRemapper.i PROPERTIES CPLUSPLUS ON)
-SET_SOURCE_FILES_PROPERTIES(MEDCouplingRemapper.i PROPERTIES SWIG_DEFINITIONS "-shadow")
+IF ("${PYTHON_VERSION_MAJOR}" STREQUAL "3")
+  SET_SOURCE_FILES_PROPERTIES(MEDCouplingRemapper.i PROPERTIES SWIG_FLAGS "-py3")
+ELSE()
+  SET_SOURCE_FILES_PROPERTIES(MEDCouplingRemapper.i PROPERTIES SWIG_DEFINITIONS "-shadow")
+ENDIF()
 SET(SWIG_MODULE_MEDCouplingRemapper_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS}")
 
 # _ABR_ Ensure dependency mechanism on all SWIG files and headers
index cdc7565519432feff07e948f9e5b7f90c93b09bc..857c4ce4eef68367edcfbf4c59f51f400a0cae40 100644 (file)
@@ -17,6 +17,9 @@
 #
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
+from __future__ import division
+# Uncomment to be coherent with Python 3
+# from __future__ import unicode_literals
 
 from MEDCoupling import *
 import unittest
@@ -60,21 +63,21 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         self.assertEqual(7,arr4.getNumberOfTuples());
         self.assertEqual(2,arr4.getNumberOfComponents());
         tmp=arr4.getValues()
-        for i in xrange(14):
+        for i in range(14):
             self.assertTrue(abs(arr4Ref[i]-tmp[i])<1e-14);
             pass
         arr5=arr4.subArray(3);
         self.assertEqual(4,arr5.getNumberOfTuples());
         self.assertEqual(2,arr5.getNumberOfComponents());
         tmp=arr5.getValues()
-        for i in xrange(8):
+        for i in range(8):
             self.assertTrue(abs(arr4Ref[6+i]-tmp[i])<1e-14);
             pass
         arr6=arr4.subArray(2,5);
         self.assertEqual(3,arr6.getNumberOfTuples());
         self.assertEqual(2,arr6.getNumberOfComponents());
         tmp=arr6.getValues()
-        for i in xrange(6):
+        for i in range(6):
             self.assertTrue(abs(arr4Ref[4+i]-tmp[i])<1e-14);
             pass
         pass
@@ -133,7 +136,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         field.setNature(ExtensiveMaximum)
         myCoords=DataArrayDouble.New()
         sampleTab=[]
-        for i in range(nbOfCells*9):
+        for i in range(nbOfCells * 9):
             sampleTab.append(float(i))
         myCoords.setValues(sampleTab,nbOfCells,9);
         field.setArray(myCoords)
@@ -797,7 +800,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         self.assertEqual(5,m4.getMesh2D().getNumberOfCells());
         self.assertEqual(3,m4.getMesh1D().getNumberOfCells());
         m3DIds=m4.getMesh3DIds().getValues();
-        self.assertEqual(range(15),list(m3DIds));
+        self.assertEqual(list(range(15)), list(m3DIds));
         #some random in cells to check that extrusion alg find it correctly
         expected1=[1,3,2,0,6,5,7,10,11,8,12,9,14,13,4]
         m3.renumberCells(expected1,False);
@@ -853,7 +856,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         expected2=[0.075,0.0375,0.0375,0.075,0.075,
                    0.1125,0.05625,0.05625,0.1125,0.1125,
                    0.0625,0.03125,0.03125,0.0625,0.0625]
-        for i in xrange(15):
+        for i in range(15):
             self.assertAlmostEqual(expected2[rexpected1[i]],arrPtr[i],16);
             pass
         m5=m4.build3DUnstructuredMesh();
@@ -864,7 +867,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         self.assertTrue(isinstance(f.getMesh(),MEDCouplingMappedExtrudedMesh))
         arr=f.getArray();
         arrPtr=arr.getValues();
-        for i in xrange(15):
+        for i in range(15):
             self.assertAlmostEqual(expected2[rexpected1[i]],arrPtr[i],15);
             pass
         pass
@@ -877,7 +880,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         o2n,newNbOfNodes=targetMesh.buildNewNumberingFromCommonNodesFormat(comm,commI);
         self.assertEqual(27,newNbOfNodes);
         self.assertEqual(27,o2n.getNumberOfTuples());
-        o2nExp1=range(27)
+        o2nExp1 = list(range(27))
         self.assertEqual(o2nExp1,list(o2n.getValues()));
         #
         targetMesh=MEDCouplingDataForTest.build3DTargetMeshMergeNode_1();
@@ -992,7 +995,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
     def testMergeMeshOnSameCoords1(self):
         m1=MEDCouplingDataForTest.build2DTargetMesh_1();
         m2=MEDCouplingDataForTest.build2DTargetMesh_1();
-        cells=range(5);
+        cells = list(range(5));
         m2.convertToPolyTypes(cells);
         m1.tryToShareSameCoords(m2,1e-12);
         m3=MEDCouplingDataForTest.build2DTargetMesh_1();
@@ -1035,7 +1038,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         values=[0.25,0.125,0.125,0.25,0.25,0.5,0.5]
         tmp=f3.getArray().getValues();
         self.assertEqual(len(values),len(tmp))
-        for i in xrange(7):
+        for i in range(7):
             self.assertTrue(abs(values[i]-tmp[i])<1e-12)
             pass
         pass
@@ -1054,7 +1057,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         values1=[-0.1,0.23333333333333336,0.56666666666666665,0.4,0.9]
         tmp=f1.getArray().getValues();
         self.assertEqual(len(values1),len(tmp))
-        for i in xrange(len(tmp)):
+        for i in range(len(tmp)):
             self.assertTrue(abs(tmp[i]-values1[i])<1.e-12)
             pass
         #
@@ -1067,7 +1070,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         values2=[-0.6,-0.1,0.4,-0.1,0.4,0.9,0.4,0.9,1.4]
         tmp=f1.getArray().getValues();
         self.assertEqual(len(values2),len(tmp))
-        for i in xrange(len(tmp)):
+        for i in range(len(tmp)):
             self.assertTrue(abs(tmp[i]-values2[i])<1.e-12)
             pass
         #
@@ -1080,7 +1083,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         values3=[-0.6,-1.2,-0.1,-0.2,0.4,0.8,-0.1,-0.2,0.4,0.8,0.9,1.8,0.4,0.8,0.9,1.8,1.4,2.8]
         tmp=f1.getArray().getValues();
         self.assertEqual(len(values3),len(tmp))
-        for i in xrange(len(tmp)):
+        for i in range(len(tmp)):
             self.assertTrue(abs(tmp[i]-values3[i])<1.e-12)
             pass
         values4=f1.accumulate();
@@ -1106,7 +1109,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         values1=[-0.1,0.23333333333333336,0.56666666666666665,0.4,0.9]
         tmp=f1.getArray().getValues();
         self.assertEqual(len(values1),len(tmp))
-        for i in xrange(len(values1)):
+        for i in range(len(values1)):
             self.assertTrue(abs(values1[i]-tmp[i])<1.e-12);
             pass
         #
@@ -1119,7 +1122,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         values2=[-0.9,0.1,1.1,-0.4,0.6,1.6,0.1,1.1,2.1]
         tmp=f1.getArray().getValues();
         self.assertEqual(len(values2),len(tmp))
-        for i in xrange(len(values2)):
+        for i in range(len(values2)):
             self.assertTrue(abs(values2[i]-tmp[i])<1.e-12);
             pass
         f1=m.fillFromAnalytic(ON_NODES,1,"2.*x+y");
@@ -1131,7 +1134,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         tmp=f1.getArray().getValues();
         values2Bis=[-0.9,0.1,1.1,-0.4,0.6,1.6,0.1,1.1,2.1]
         self.assertEqual(len(values2Bis),len(tmp))
-        for i in xrange(len(values2Bis)):
+        for i in range(len(values2Bis)):
             self.assertTrue(abs(values2Bis[i]-tmp[i])<1.e-12);
             pass
         #
@@ -1144,7 +1147,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         values3=[-0.6,-1.2,-0.1,-0.2,0.4,0.8,-0.1,-0.2,0.4,0.8,0.9,1.8,0.4,0.8,0.9,1.8,1.4,2.8]
         tmp=f1.getArray().getValues();
         self.assertEqual(len(values3),len(tmp))
-        for i in xrange(len(values3)):
+        for i in range(len(values3)):
             self.assertTrue(abs(values3[i]-tmp[i])<1.e-12);
             pass
         values4=f1.accumulate();
@@ -1171,7 +1174,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         values1=[-1.8,-0.3,1.2,-0.3,1.2,2.7,1.2,2.7,4.2]
         tmp=f1.getArray().getValues();
         self.assertEqual(len(values1),len(tmp))
-        for i in xrange(len(tmp)):
+        for i in range(len(tmp)):
             self.assertTrue(abs(tmp[i]-values1[i])<1.e-12)
             pass
         pass
@@ -1201,7 +1204,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
                  5.0423700574830965, 17.435300118916864]
         tmp=f2.getArray().getValues();
         self.assertEqual(len(tmp),len(values2))
-        for i in xrange(len(tmp)):
+        for i in range(len(tmp)):
             self.assertTrue(abs(tmp[i]-values2[i])<1.e-12)
             pass
         #
@@ -1213,7 +1216,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         values1=[-1.8,-0.3,1.2,-0.3,1.2,2.7,1.2,2.7,4.2]
         tmp=f1.getArray().getValues();
         self.assertEqual(len(tmp),len(values1))
-        for i in xrange(len(tmp)):
+        for i in range(len(tmp)):
             self.assertTrue(abs(tmp[i]-values1[i])<1.e-12)
             pass
         pass
@@ -1231,7 +1234,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         values1=[-1.2,-0.2,0.8,-0.2,0.8,1.8,0.8,1.8,2.8]
         tmp=f3.getArray().getValues();
         self.assertEqual(len(values1),len(tmp))
-        for i in xrange(len(tmp)):
+        for i in range(len(tmp)):
             self.assertTrue(abs(tmp[i]-values1[i])<1.e-12)
             pass
         #
@@ -1242,7 +1245,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         values2=[0.36,0.01,0.16,0.01,0.16,0.81,0.16,0.81,1.96]
         tmp=f3.getArray().getValues();
         self.assertEqual(len(values2),len(tmp))
-        for i in xrange(len(tmp)):
+        for i in range(len(tmp)):
             self.assertTrue(abs(tmp[i]-values2[i])<1.e-12)
             pass
         #
@@ -1254,7 +1257,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         values3=[0.6,0.1,-0.4,0.1,-0.4,-0.9,-0.4,-0.9,-1.4]
         tmp=f4.getArray().getValues();
         self.assertEqual(len(values3),len(tmp))
-        for i in xrange(len(tmp)):
+        for i in range(len(tmp)):
             self.assertTrue(abs(tmp[i]-values3[i])<1.e-12)
             pass
         #
@@ -1264,7 +1267,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         self.assertEqual(f4.getTypeOfField(),ON_NODES);
         self.assertEqual(f4.getTimeDiscretization(),ONE_TIME);
         tmp=f4.getArray().getValues();
-        for i in xrange(len(tmp)):
+        for i in range(len(tmp)):
             self.assertTrue(abs(tmp[i]-2.)<1.e-12)
             pass
         #
@@ -1280,7 +1283,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         tmp=f3.getArray().getValues();
         values4=[-1.2,-0.2,0.8,-0.2,0.8,1.8,0.8,1.8,2.8]
         self.assertEqual(len(values3),len(tmp))
-        for i in xrange(len(tmp)):
+        for i in range(len(tmp)):
             self.assertTrue(abs(tmp[i]-values4[i])<1.e-12)
             pass
         #
@@ -1296,7 +1299,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         tmp=f3.getArray().getValues();
         values5=[-1.2,-0.2,0.8,-0.2,0.8,1.8,0.8,1.8,2.8]
         self.assertEqual(len(values5),len(tmp))
-        for i in xrange(len(tmp)):
+        for i in range(len(tmp)):
             self.assertTrue(abs(tmp[i]-values5[i])<1.e-12)
             pass
         pass
@@ -1316,7 +1319,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         self.assertEqual(1,f3.getNumberOfComponents());
         self.assertEqual(9,f3.getNumberOfTuples());
         val=f3.getArray().getValues();
-        for i in xrange(9):
+        for i in range(9):
             self.assertTrue(abs(expected1[i]-val[i])<1.e-12);
         #
         f1=m.buildOrthogonalField();
@@ -1326,13 +1329,13 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         f3=f1*f2;
         expected2=[-0.035355339059327376,0.,0.035355339059327376, 0.2592724864350674,0.,-0.2592724864350674, 0.37712361663282529,0.,-0.37712361663282529, -0.035355339059327376,0.,0.035355339059327376, 0.31819805153394637,0.,-0.31819805153394637]
         val=f3.getArray().getValues();
-        for i in xrange(15):
+        for i in range(15):
             self.assertTrue(abs(expected2[i]-val[i])<1.e-12);
             pass
         #
         f3=f2*f1;
         val=f3.getArray().getValues();
-        for i in xrange(15):
+        for i in range(15):
             self.assertTrue(abs(expected2[i]-val[i])<1.e-12);
             pass
         pass
@@ -1351,7 +1354,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         self.assertEqual(1,f1.getNumberOfComponents());
         self.assertEqual(9,f1.getNumberOfTuples());
         val=f1.getArray().getValues();
-        for i in xrange(9):
+        for i in range(9):
             self.assertTrue(abs(expected1[i]-val[i])<1.e-12);
             pass
         #
@@ -1360,7 +1363,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         f1*=f2
         expected2=[-0.035355339059327376,0.,0.035355339059327376, 0.2592724864350674,0.,-0.2592724864350674, 0.37712361663282529,0.,-0.37712361663282529, -0.035355339059327376,0.,0.035355339059327376, 0.31819805153394637,0.,-0.31819805153394637]
         val=f1.getArray().getValues();
-        for i in xrange(15):
+        for i in range(15):
             self.assertTrue(abs(expected2[i]-val[i])<1.e-12);
             pass
         #
@@ -1546,7 +1549,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         self.assertEqual(3,len(corr));
         expectedVals1=[3,3,2]
         expectedVals2=[[0,1,2],[3,0,2],[3,0]]
-        for i in xrange(3):
+        for i in range(3):
             arr=corr[i];
             self.assertEqual(1,arr.getNumberOfComponents());
             nbOfVals=expectedVals1[i];
@@ -1561,7 +1564,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         self.assertEqual(1,arr2.getNumberOfComponents());
         self.assertEqual(4,arr2.getNumberOfTuples());
         self.assertEqual(fidExp,list(arr2.getValues()));
-        for i in xrange(3):
+        for i in range(3):
             nbOfVals=expectedVals1[i];
             self.assertEqual(list(fidsOfGroups[i]),fidsGrp[i]);
             pass
@@ -1595,7 +1598,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         self.assertEqual(5,field.getNumberOfTuples());
         self.assertEqual(3,field.getNumberOfComponents());
         vals=field.getArray().getValues();
-        for i in xrange(15):
+        for i in range(15):
             self.assertTrue(abs(expected[i%3]-vals[i])<1e-12);
         # testing
         targetCoords=[0.,0.,0.,0.5,0.,0.5,1.,0.,1.,0.,1.,0.]
@@ -1699,7 +1702,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         fieldOnCells.setMesh(targetMesh);
         array=DataArrayDouble.New();
         tmp=2*nbOfCells*[None]
-        for i in xrange(nbOfCells):
+        for i in range(nbOfCells):
             tmp[2*i]=7.+float(i);
             tmp[2*i+1]=17.+float(i)
             pass
@@ -1719,7 +1722,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         fieldOnNodes.setMesh(targetMesh);
         array=DataArrayDouble.New();
         tmp=2*nbOfNodes*[None]
-        for i in xrange(nbOfNodes):
+        for i in range(nbOfNodes):
             tmp[2*i]=17.+float(i);
             tmp[2*i+1]=27.+float(i)
             pass
@@ -1765,7 +1768,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
                     7., 4., 6., 7., 9., 5., 7., 8., 10., 7., 9., 10., 12.];
         
         val=fieldOnNodes.getArray().getValues();
-        for i in xrange(64):
+        for i in range(64):
           self.assertAlmostEqual(expected1[i], val[i], 12)
         res=fieldOnNodes.getValueOnPos(1, 3, 2);
         self.assertAlmostEqual(7., res[0], 12);
@@ -1776,7 +1779,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         val=fieldOnCells.getArray().getValues();
         expected2=[0, 1.5, 3, 1.5, 3, 4.5, 3, 4.5, 6, 1.5, 3, 4.5, 3, 4.5,
                     6, 4.5, 6, 7.5, 3, 4.5, 6, 4.5, 6, 7.5, 6, 7.5, 9];
-        for i in xrange(27):
+        for i in range(27):
           self.assertAlmostEqual(expected2[i], val[i], 12);
         #res=fieldOnCells.getValueOnPos(1,2,1);
         #self.assertAlmostEqual(6.,res,12);
@@ -1962,7 +1965,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
                    -0.05,0.45, 0.2,0.45, 0.45,0.45]
         val=mesh.getCoords().getValues();
         self.assertEqual(18,len(val))
-        for i in xrange(18):
+        for i in range(18):
             self.assertTrue(abs(expected1[i]-val[i])<1e-12);
             pass
         pass
@@ -2049,7 +2052,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         self.assertEqual(3,m1.getSpaceDimension());
         expected=[-0.3,-0.3,0., 0.2,-0.3,0., 0.7,-0.3,0., -0.3,0.2,0., 0.2,0.2,0., 0.7,0.2,0., -0.3,0.7,0., 0.2,0.7,0., 0.7,0.7,0.]
         val=m1.getCoords().getValues();
-        for i in xrange(27):
+        for i in range(27):
             self.assertTrue(abs(expected[i]-val[i])<1e-14);
             pass
         pass
@@ -2084,7 +2087,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         self.assertEqual(2,f.getNbOfGaussLocalization());
         array=DataArrayDouble.New();
         ptr=18*2*[None]
-        for i in xrange(18*2):
+        for i in range(18 * 2):
             ptr[i]=float(i+1)
         array.setValues(ptr,18,2);
         ptr=array.getPointer();
@@ -2146,7 +2149,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         f.setDescription("MyDescriptionNE");
         array=DataArrayDouble.New();
         tmp=18*2*[None]
-        for i in xrange(18*2):
+        for i in range(18 * 2):
             tmp[i]=float(i+7)
             pass
         array.setValues(tmp,18,2);
@@ -2228,7 +2231,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         self.assertEqual(1,f3.getNumberOfComponents());
         f3Ptr=f3.getArray().getValues();
         expected1=[0.075,0.0375,0.0375,0.075,0.075, 0.1125,0.05625,0.05625,0.1125,0.1125, 0.0625,0.03125,0.03125,0.0625,0.0625];
-        for i in xrange(15):
+        for i in range(15):
             self.assertTrue(abs(expected1[i]-f3Ptr[i])<1e-12);
             pass
         f4=m5.computeCellCenterOfMass();
@@ -2236,7 +2239,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         self.assertEqual(3,f4.getNumberOfComponents());
         f4Ptr=f4.getValues();
         expected2=[-0.05,-0.05,0.15, 0.3666666666666667,-0.13333333333333333,0.15, 0.53333333333333333,0.033333333333333333,0.15, -0.05,0.45,0.15, 0.45,0.45,0.15,-0.05,-0.05,0.525, 0.3666666666666667,-0.13333333333333333,0.525, 0.53333333333333333,0.033333333333333333,0.525, -0.05,0.45,0.525, 0.45,0.45,0.525,-0.05,-0.05,0.875, 0.3666666666666667,-0.13333333333333333,0.875, 0.53333333333333333,0.033333333333333333,0.875, -0.05,0.45,0.875, 0.45,0.45,0.875];
-        for i in xrange(45):
+        for i in range(45):
             self.assertTrue(abs(expected2[i]-f4Ptr[i])<1e-12);
             pass
         pass
@@ -2244,7 +2247,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
     def testCellOrientation3(self):
         from cmath import rect  
 
-        c = [rect(1.0, i*pi/4.0) for i in range(8)]
+        c = [rect(1.0, i * pi / 4.0) for i in range(8)]
         coords = [c[-1].real,c[-1].imag,  c[3].real,c[3].imag,
                    c[5].real,c[5].imag,  c[1].real,c[1].imag]
         connec = [0,1,2,3] 
@@ -2284,7 +2287,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         self.assertEqual(3,da.getNumberOfComponents());
         daPtr=da.getValues();
         ref=meshN.getCoords().getValues()[24:];
-        for i in xrange(3):
+        for i in range(3):
             self.assertTrue(abs(ref[i]-daPtr[i])<1e-12);
             pass
         #
@@ -2293,7 +2296,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         da=meshN.computeCellCenterOfMass();
         daPtr=da.getValues();
         ref=meshN.getCoords().getValues()[24:];
-        for i in xrange(3):
+        for i in range(3):
             self.assertTrue(abs(ref[i]-daPtr[i])<1e-12);
             pass
         #
@@ -2302,7 +2305,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         da=meshN.computeCellCenterOfMass();
         daPtr=da.getValues();
         ref=meshN.getCoords().getValues()[24:];
-        for i in xrange(3):
+        for i in range(3):
             self.assertTrue(abs(ref[i]-daPtr[i])<1e-12);
             pass
         #
@@ -2313,7 +2316,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         da=meshN.computeCellCenterOfMass();
         daPtr=da.getValues();
         ref=meshN.getCoords().getValues()[24:];
-        for i in xrange(3):
+        for i in range(3):
             self.assertTrue(abs(ref[i]-daPtr[i])<1e-10);
             pass
         pass
@@ -2332,7 +2335,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         self.assertEqual(1,f3.getNumberOfComponents());
         expected9=[0.75,5.105,0.8,5.155]
         ptr=f3.getValues();
-        for i in xrange(4):
+        for i in range(4):
             self.assertTrue(abs(expected9[i]-ptr[i])<1e-12);
             pass
         #
@@ -2341,13 +2344,13 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         self.assertEqual(1,f2.getNumberOfComponents());
         expected1=[0.5,0.21,-0.6,-0.31]
         ptr=f2.getArray().getValues();
-        for i in xrange(4):
+        for i in range(4):
             self.assertTrue(abs(expected1[i]-ptr[i])<1e-12);
             pass
         expected2=[0.5,0.21,0.6,0.31]
         f2=m1.getMeasureField(True);
         ptr=f2.getArray().getValues();
-        for i in xrange(4):
+        for i in range(4):
             self.assertTrue(abs(expected2[i]-ptr[i])<1e-12);
             pass
         #integral
@@ -2355,7 +2358,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         res=f1.integral(False);
         self.assertTrue(3,len(res))
         expected3=[0.9866,-0.3615,0.4217]
-        for i in xrange(3):
+        for i in range(3):
             self.assertTrue(abs(expected3[i]-res[i])<1e-12);
             pass
         self.assertTrue(abs(expected3[0]-f1.integral(0,False))<1e-12);
@@ -2363,14 +2366,14 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         self.assertTrue(abs(expected3[2]-f1.integral(2,False))<1e-12);
         res=f1.integral(True);
         expected4=[-3.4152,8.7639,-14.6879]
-        for i in xrange(3):
+        for i in range(3):
             self.assertTrue(abs(expected4[i]-res[i])<1e-12);
             pass
         #normL1
         res=f1.normL1();
         self.assertTrue(3,len(res))
         expected5=[6.979506172839505, 16.89018518518518, 27.02969135802469]
-        for i in xrange(3):
+        for i in range(3):
             self.assertTrue(abs(expected5[i]-res[i])<1e-12);
             pass
         self.assertTrue(abs(expected5[0]-f1.normL1(0))<1e-12);
@@ -2380,7 +2383,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         res=f1.normL2();
         self.assertTrue(3,len(res))
         expected7=[7.090910979452395, 16.9275542960123, 27.053271464160858]
-        for i in xrange(3):
+        for i in range(3):
             self.assertTrue(abs(expected7[i]-res[i])<1e-9);
             pass
         self.assertTrue(abs(expected7[0]-f1.normL2(0))<1e-9);
@@ -2397,14 +2400,14 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         self.assertEqual(4,f2.getArray().getNumberOfTuples());
         self.assertEqual(1,f2.getNumberOfComponents());
         ptr=f2.getArray().getValues();
-        for i in xrange(4):
+        for i in range(4):
             self.assertTrue(abs(sqrt(2.)*expected2[i]-ptr[i])<1e-12);
             pass
         f2=m1.getMeasureField(True);
         self.assertEqual(4,f2.getArray().getNumberOfTuples());
         self.assertEqual(1,f2.getNumberOfComponents());
         ptr=f2.getArray().getValues();
-        for i in xrange(4):
+        for i in range(4):
             self.assertTrue(abs(expected2[i]*sqrt(2.)-ptr[i])<1e-12);
             pass
         #bary
@@ -2413,7 +2416,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         self.assertEqual(2,f3.getNumberOfComponents());
         expected10=[0.75,0.75,5.105,5.105,0.8,0.8,5.155,5.155]
         ptr=f3.getValues();
-        for i in xrange(8):
+        for i in range(8):
             self.assertTrue(abs(expected10[i]-ptr[i])<1e-12);
             pass
         #
@@ -2423,19 +2426,19 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         array.setValues(arr,m1.getNumberOfCells(),3);
         f1.setArray(array);
         res=f1.integral(False);
-        for i in xrange(3):
+        for i in range(3):
             self.assertTrue(abs(sqrt(2.)*expected4[i]-res[i])<1e-12);
             pass
         res=f1.integral(True);
-        for i in xrange(3):
+        for i in range(3):
             self.assertTrue(abs(sqrt(2.)*expected4[i]-res[i])<1e-12);
             pass
         res=f1.normL1();
-        for i in xrange(3):
+        for i in range(3):
             self.assertTrue(abs(expected5[i]-res[i])<1e-12);
             pass
         res=f1.normL2();
-        for i in xrange(3):
+        for i in range(3):
             self.assertTrue(abs(expected7[i]-res[i])<1e-12);
             pass
         pass
@@ -2447,12 +2450,12 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         self.assertEqual(1,f1.getNumberOfComponents());
         expected1=[-0.5,-1,-1.5,-0.5,-1,  0.5,1,1.5,0.5,1]
         ptr=f1.getArray().getValues();
-        for i in xrange(10):
+        for i in range(10):
             self.assertTrue(abs(expected1[i]-ptr[i])<1e-12);
             pass
         f1=m1.getMeasureField(True);
         ptr=f1.getArray().getValues();
-        for i in xrange(10):
+        for i in range(10):
             self.assertTrue(abs(abs(expected1[i])-ptr[i])<1e-12);
             pass
         f2=m1.computeCellCenterOfMass();
@@ -2460,7 +2463,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         self.assertEqual(2,f2.getNumberOfComponents());
         expected2=[0.5,0.3333333333333333,0.5,0.5,0.5,0.77777777777777777,0.5,0.3333333333333333,0.5,0.5,0.5,0.3333333333333333,0.5,0.5,0.5,0.77777777777777777,0.5,0.3333333333333333,0.5,0.5]
         ptr=f2.getValues();
-        for i in xrange(20):
+        for i in range(20):
             self.assertTrue(abs(expected2[i]-ptr[i])<1e-12);
             pass
         m1.changeSpaceDimension(3);
@@ -2468,7 +2471,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         self.assertEqual(10,f1.getArray().getNumberOfTuples());
         self.assertEqual(1,f1.getNumberOfComponents());
         ptr=f1.getArray().getValues();
-        for i in xrange(10):
+        for i in range(10):
             self.assertTrue(abs(abs(expected1[i])-ptr[i])<1e-12);
             pass
         f2=m1.computeCellCenterOfMass();
@@ -2476,7 +2479,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         self.assertEqual(3,f2.getNumberOfComponents());
         ptr=f2.getValues();
         expected3=[0.5,0.3333333333333333,0.,0.5,0.5,0.,0.5,0.77777777777777777,0.,0.5,0.3333333333333333,0.,0.5,0.5,0., 0.5,0.3333333333333333,0.,0.5,0.5,0.,0.5,0.77777777777777777,0.,0.5,0.3333333333333333,0.,0.5,0.5,0.]
-        for i in xrange(30):
+        for i in range(30):
             self.assertTrue(abs(expected3[i]-ptr[i])<1e-12);
             pass
         pass
@@ -2563,7 +2566,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         self.assertEqual(4,da.getNumberOfTuples());
         self.assertEqual(3,da.getNumberOfComponents());
         daPtr=da.getValues();
-        for i in xrange(12):
+        for i in range(12):
             self.assertTrue(abs(barys[i]-daPtr[i])<1e-12);
             pass
         pass
@@ -2579,22 +2582,22 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         f.setArray(arr);
         renumber1=[3,1,0,4,2]
         loc=[-0.05,-0.05, 0.55,-0.25, 0.55,0.15, -0.05,0.45, 0.45,0.45]
-        for j in xrange(5):
+        for j in range(5):
             res=f.getValueOn(loc[2*j:2*j+2]);
-            for i in xrange(3):
+            for i in range(3):
                 self.assertTrue(abs(values1[i+3*j]-res[i])<1e-12);
                 pass
             pass
         f.renumberCells(renumber1,False);
         ptr=f.getArray().getValues();
         expected1=[9.,109.,10009.,8.,108.,10008.,11.,111.,10011.,7.,107.,10007.,10.,110.,10010.]
-        for i in xrange(15):
+        for i in range(15):
             self.assertTrue(abs(expected1[i]-ptr[i])<1e-12);
             pass
         #check that fields remains the same geometrically
-        for j in xrange(5):
+        for j in range(5):
             res=f.getValueOn(loc[2*j:2*(j+1)]);
-            for i in xrange(3):
+            for i in range(3):
                 self.assertTrue(abs(values1[i+3*j]-res[i])<1e-12);
                 pass
             pass
@@ -2628,7 +2631,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         self.assertTrue(not f.isEqual(fCpy,1e-12,1e-12));
         expected2=[21.,1021.,22.,1022.,23.,1023.,24.,1024.,25.,1025.,26.,1026., 11.,1011.,12.,1012.,13.,1013.,14.,1014.,15.,1015.,16.,1016., 41.,1041.,42.,1042., 1.,1001.,2.,1002., 31.,1031.,32.,1032.]
         ptr=f.getArray().getValues();
-        for i in xrange(36):
+        for i in range(36):
             self.assertTrue(abs(expected2[i]-ptr[i])<1e-12);
             pass
         renumber2=[2,1,4,0,3]
@@ -2648,7 +2651,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         self.assertTrue(not f.isEqual(fCpy,1e-12,1e-12));
         expected3=[21.,1021.,22.,1022.,23.,1023.,11.,1011.,12.,1012.,13.,1013.,41.,1041.,42.,1042.,43.,1043.,44.,1044.,1.,1001.,2.,1002.,3.,1003.,4.,1004.,31.,1031.,32.,1032.,33.,1033.,34.,1034.]
         ptr=f.getArray().getValues();
-        for i in xrange(36):
+        for i in range(36):
             self.assertTrue(abs(expected3[i]-ptr[i])<1e-12);
             pass
         f.renumberCells(renumber2,False);#perform reverse operation of renumbering to check that the resulting field is equal.
@@ -2670,9 +2673,9 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         renumber1=[0,4,1,3,5,2,6,7,8]
         loc=[0.5432,-0.2432, 0.5478,0.1528]
         expected1=[9.0272, 109.0272, 10009.0272, 11.4124,111.4124,10011.4124]
-        for j in xrange(2):
+        for j in range(2):
             res=f.getValueOn(loc[2*j:2*j+2]);
-            for i in xrange(3):
+            for i in range(3):
                 self.assertTrue(abs(expected1[i+3*j]-res[i])<1e-12);
                 pass
             pass
@@ -2680,14 +2683,14 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         self.assertTrue(f.isEqual(fCpy,1e-12,1e-12));
         f.renumberNodes(renumber1);
         self.assertTrue(not f.isEqual(fCpy,1e-12,1e-12));
-        for j in xrange(2):
+        for j in range(2):
             res=f.getValueOn(loc[2*j:2*j+2]);
-            for i in xrange(3):
+            for i in range(3):
                 self.assertTrue(abs(expected1[i+3*j]-res[i])<1e-12);
                 pass
             pass
         expected2=[7.,107.,10007.,9.,109.,10009.,12.,112.,10012.,10.,110.,10010.,8.,108.,10008.,11.,111.,10011.,13.,113.,10013.,14.,114.,10014.,15.,115.,10015.]
-        for i in xrange(27):
+        for i in range(27):
             self.assertTrue(abs(expected2[i]-f.getArray().getValues()[i])<1e-12);
             pass
         renumber2=[0,2,5,3,1,4,6,7,8]
@@ -2701,7 +2704,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         types=mesh.getAllGeoTypes();
         types.sort()
         self.assertEqual(5,len(types));
-        expected1=[NORM_POLYGON, NORM_TRI3, NORM_QUAD4, NORM_TRI6, NORM_QUAD8]
+        expected1 = [NORM_POLYGON, NORM_TRI3, NORM_QUAD4, NORM_TRI6, NORM_QUAD8]
         expected1.sort()
         self.assertEqual(expected1,types);
         self.assertTrue(mesh.isPresenceOfQuadratic());
@@ -2824,7 +2827,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         self.assertEqual(None,cellCor);
         self.assertNotEqual(None,nodeCor);
         expected1=[0, 1, 3, 4, 5, 6, 7, 8, 9]
-        for i in xrange(9):
+        for i in range(9):
             self.assertEqual(expected1[i],nodeCor.getIJ(i,0));
             pass
         pass
@@ -2943,7 +2946,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         f2=m2.getMeasureField(False);
         self.assertEqual(5,f1.getArray().getNumberOfTuples());
         self.assertEqual(1,f2.getArray().getNumberOfTuples());
-        for i in xrange(5):
+        for i in range(5):
             self.assertAlmostEqual(expected1[i],f1.getIJ(i,0),12);
             pass
         self.assertAlmostEqual(expected1[0],f2.getIJ(0,0),12);
@@ -2954,7 +2957,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         f2=m2.getMeasureField(False);
         self.assertEqual(5,f1.getArray().getNumberOfTuples());
         self.assertEqual(1,f2.getArray().getNumberOfTuples());
-        for i in xrange(5):
+        for i in range(5):
             self.assertAlmostEqual(expected1[i],f1.getIJ(i,0),12);
             pass
         self.assertAlmostEqual(expected1[0],f2.getIJ(0,0),12);
@@ -2978,7 +2981,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         f1.changeUnderlyingMesh(mesh2,10,1e-12);
         #self.assertTrue(f1.getMesh()==mesh2);
         expected1=[7.,107.,9.,109.,8.,108.,10.,110.,11.,111.,12.,112.,13.,113.,15.,115.,14.,114.,16.,116.]
-        for i in xrange(20):
+        for i in range(20):
             self.assertAlmostEqual(expected1[i],f1.getArray().getIJ(0,i),12);
             pass
         #
@@ -2995,7 +2998,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         f1.changeUnderlyingMesh(mesh2,10,1e-12);
         #self.assertTrue(f1.getMesh()==mesh2);
         expected2=[7.,107.,17.,117.,8.,108.,10.,110.,11.,111.,12.,112.,13.,113.,15.,115.,14.,114.,16.,116.,9.,109.]
-        for i in xrange(22):
+        for i in range(22):
             self.assertAlmostEqual(expected2[i],f1.getArray().getIJ(0,i),12);
             pass
         pass
@@ -3076,13 +3079,13 @@ class MEDCouplingBasicsTest1(unittest.TestCase):
         #
         f3=f1.dot(f2);
         expected1=[842.,1820.,2816.,3830.,4862.,5912.,6980.,8066.,9170.,10292.]
-        for i in xrange(10):
+        for i in range(10):
             self.assertAlmostEqual(expected1[i],f3.getIJ(i,0),9);
             pass
         #
         f4=f1.crossProduct(f2);
         expected2=[-93., 186., -93., -392., 784., -392., -691., 1382., -691., -990., 1980., -990., -1289., 2578., -1289., -1588., 3176., -1588., -1887., 3774., -1887., -2186., 4372., -2186., -2485., 4970., -2485., -2784., 5568., -2784.]
-        for i in xrange(30):
+        for i in range(30):
             self.assertAlmostEqual(expected2[i],f4.getIJ(0,i),9);
             pass
         pass
index f48cf9edb6dd2f0ffb4fea473c3458e171d51172..c6269b4657ceb6f0bda79a87099fbe8f055ecd6f 100644 (file)
@@ -17,6 +17,9 @@
 #
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
+from __future__ import division
+# Uncomment to be coherent with Python 3
+# from __future__ import unicode_literals
 
 from MEDCoupling import *
 import unittest
@@ -45,13 +48,13 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         #
         f3=f1.max(f2);
         expected1=[7.,108.,207.,9.,108.,209.,9.,110.,209.,11.,110.,211.,11.,112.,211.,13.,112.,213.,13.,114.,213.,15.,114.,215.,15.,116.,215.,17.,116.,217.]
-        for i in xrange(30):
+        for i in range(30):
             self.assertAlmostEqual(expected1[i],f3.getIJ(0,i),9);
             pass
         #
         f4=f1.min(f2);
         expected2=[6.,107.,206.,8.,107.,208.,8.,109.,208.,10.,109.,210.,10.,111.,210.,12.,111.,212.,12.,113.,212.,14.,113.,214.,14.,115.,214.,16.,115.,216.]
-        for i in xrange(30):
+        for i in range(30):
             self.assertAlmostEqual(expected2[i],f4.getIJ(0,i),9);
             pass
         #
@@ -68,7 +71,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         #
         f1.applyLin(2.,3.,0);
         expected1=[17.,107.,19.,108.,21.,109.,23.,110.,25.,111.,27.,112.,29.,113.,31.,114.,33.,115.,35.,116.]
-        for i in xrange(20):
+        for i in range(20):
             self.assertAlmostEqual(expected1[i],f1.getIJ(0,i),9);
             pass
         #
@@ -80,11 +83,11 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         f1.applyLin(4.,5.,1);
         #
         expected2=[17.,433.,19.,437.,21.,441.,23.,445.,25.,449.,27.,453.,29.,457.,31.,461.,33.,465.,35.,469.]
-        for i in xrange(20):
+        for i in range(20):
             self.assertAlmostEqual(expected2[i],f1.getIJ(0,i),9);
             pass
         expected3=[2.,413.,3.,417.,4.,421.,5.,425.,6.,429.,7.,433.,8.,437.,9.,441.,10.,445.,11.,449.]
-        for i in xrange(20):
+        for i in range(20):
             self.assertAlmostEqual(expected3[i],f1.getEndArray().getIJ(0,i),9);
             pass
         #
@@ -102,13 +105,13 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         #
         f1.checkConsistencyLight();
         da=f1.findIdsInRange(2.9,7.1);
-        self.failUnlessEqual(5,da.getNbOfElems());
+        self.assertEqual(5,da.getNbOfElems());
         expected1=[2,3,5,7,9]
-        self.failUnlessEqual(expected1,list(da.getValues()));
+        self.assertEqual(expected1,list(da.getValues()));
         da=f1.findIdsInRange(8.,12.);
-        self.failUnlessEqual(4,da.getNbOfElems());
+        self.assertEqual(4,da.getNbOfElems());
         expected2=[1,4,6,8]
-        self.failUnlessEqual(expected2,list(da.getValues()));
+        self.assertEqual(expected2,list(da.getValues()));
         #
         pass
 
@@ -125,26 +128,26 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         part1=[2,1,4]
         f2=f1[part1];
         f2.zipCoords()
-        self.failUnlessEqual(3,f2.getNumberOfTuples());
-        self.failUnlessEqual(2,f2.getNumberOfComponents());
+        self.assertEqual(3,f2.getNumberOfTuples());
+        self.assertEqual(2,f2.getNumberOfComponents());
         expected1=[5.,105.,4.,104.,7.,107.]
-        for i in xrange(6):
+        for i in range(6):
             self.assertAlmostEqual(f2.getIJ(0,i),expected1[i],12);
             pass
-        self.failUnlessEqual(3,f2.getMesh().getNumberOfCells());
-        self.failUnlessEqual(6,f2.getMesh().getNumberOfNodes());
-        self.failUnlessEqual(2,f2.getMesh().getSpaceDimension());
-        self.failUnlessEqual(2,f2.getMesh().getMeshDimension());
+        self.assertEqual(3,f2.getMesh().getNumberOfCells());
+        self.assertEqual(6,f2.getMesh().getNumberOfNodes());
+        self.assertEqual(2,f2.getMesh().getSpaceDimension());
+        self.assertEqual(2,f2.getMesh().getMeshDimension());
         m2C=f2.getMesh();
-        self.failUnlessEqual(13,m2C.getNodalConnectivityArrayLen());
+        self.assertEqual(13,m2C.getNodalConnectivityArrayLen());
         expected2=[0.2, -0.3, 0.7, -0.3, 0.2, 0.2, 0.7, 0.2, 0.2, 0.7, 0.7, 0.7]
-        for i in xrange(12):
+        for i in range(12):
             self.assertAlmostEqual(expected2[i],m2C.getCoords().getIJ(0,i),12);
             pass
         expected3=[3,2,3,1,3,0,2,1,4,4,5,3,2]
-        self.failUnlessEqual(expected3,list(m2C.getNodalConnectivity().getValues()));
+        self.assertEqual(expected3,list(m2C.getNodalConnectivity().getValues()));
         expected4=[0,4,8,13]
-        self.failUnlessEqual(expected4,list(m2C.getNodalConnectivityIndex().getValues()));
+        self.assertEqual(expected4,list(m2C.getNodalConnectivityIndex().getValues()));
         # Test with field on nodes.
         f1=MEDCouplingFieldDouble.New(ON_NODES,ONE_TIME);
         f1.setTime(2.3,5,6);
@@ -155,68 +158,68 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         f1.setArray(array);
         part2=[1,2]
         f2=f1.buildSubPart(part2);
-        self.failUnlessEqual(4,f2.getNumberOfTuples());
-        self.failUnlessEqual(2,f2.getNumberOfComponents());
+        self.assertEqual(4,f2.getNumberOfTuples());
+        self.assertEqual(2,f2.getNumberOfComponents());
         expected5=[4.,104.,5.,105.,7.,107.,8.,108.]
-        for i in xrange(8):
+        for i in range(8):
             self.assertAlmostEqual(f2.getIJ(0,i),expected5[i],12);
             pass
-        self.failUnlessEqual(2,f2.getMesh().getNumberOfCells());
-        self.failUnlessEqual(4,f2.getMesh().getNumberOfNodes());
-        self.failUnlessEqual(2,f2.getMesh().getSpaceDimension());
-        self.failUnlessEqual(2,f2.getMesh().getMeshDimension());
+        self.assertEqual(2,f2.getMesh().getNumberOfCells());
+        self.assertEqual(4,f2.getMesh().getNumberOfNodes());
+        self.assertEqual(2,f2.getMesh().getSpaceDimension());
+        self.assertEqual(2,f2.getMesh().getMeshDimension());
         m2C=f2.getMesh();
-        self.failUnlessEqual(8,m2C.getNodalConnectivityArrayLen());
-        for i in xrange(8):#8 is not an error
+        self.assertEqual(8,m2C.getNodalConnectivityArrayLen());
+        for i in range(8):  # 8 is not an error
             self.assertAlmostEqual(expected2[i],m2C.getCoords().getIJ(0,i),12);
             pass
-        self.failUnlessEqual(expected3[:4],list(m2C.getNodalConnectivity().getValues())[4:]);
-        self.failUnlessEqual(expected3[4:8],list(m2C.getNodalConnectivity().getValues())[:4]);
-        self.failUnlessEqual(expected4[:3],list(m2C.getNodalConnectivityIndex().getValues()));
+        self.assertEqual(expected3[:4],list(m2C.getNodalConnectivity().getValues())[4:]);
+        self.assertEqual(expected3[4:8],list(m2C.getNodalConnectivity().getValues())[:4]);
+        self.assertEqual(expected4[:3],list(m2C.getNodalConnectivityIndex().getValues()));
         #idem previous because nodes of cell#4 are not fully present in part3
         part3=[1,2]
         arrr=DataArrayInt.New();
         arrr.setValues(part3,2,1);
         f2=f1.buildSubPart(arrr);
-        self.failUnlessEqual(4,f2.getNumberOfTuples());
-        self.failUnlessEqual(2,f2.getNumberOfComponents());
-        for i in xrange(8):
+        self.assertEqual(4,f2.getNumberOfTuples());
+        self.assertEqual(2,f2.getNumberOfComponents());
+        for i in range(8):
             self.assertAlmostEqual(f2.getIJ(0,i),expected5[i],12);
             pass
-        self.failUnlessEqual(2,f2.getMesh().getNumberOfCells());
-        self.failUnlessEqual(4,f2.getMesh().getNumberOfNodes());
-        self.failUnlessEqual(2,f2.getMesh().getSpaceDimension());
-        self.failUnlessEqual(2,f2.getMesh().getMeshDimension());
+        self.assertEqual(2,f2.getMesh().getNumberOfCells());
+        self.assertEqual(4,f2.getMesh().getNumberOfNodes());
+        self.assertEqual(2,f2.getMesh().getSpaceDimension());
+        self.assertEqual(2,f2.getMesh().getMeshDimension());
         m2C=f2.getMesh();
-        self.failUnlessEqual(8,m2C.getNodalConnectivityArrayLen());
-        for i in xrange(8):#8 is not an error
+        self.assertEqual(8,m2C.getNodalConnectivityArrayLen());
+        for i in range(8):  # 8 is not an error
             self.assertAlmostEqual(expected2[i],m2C.getCoords().getIJ(0,i),12);
             pass
-        self.failUnlessEqual(expected3[:4],list(m2C.getNodalConnectivity().getValues())[4:8]);
-        self.failUnlessEqual(expected3[4:8],list(m2C.getNodalConnectivity().getValues())[:4]);
-        self.failUnlessEqual(expected4[:3],list(m2C.getNodalConnectivityIndex().getValues()));
+        self.assertEqual(expected3[:4],list(m2C.getNodalConnectivity().getValues())[4:8]);
+        self.assertEqual(expected3[4:8],list(m2C.getNodalConnectivity().getValues())[:4]);
+        self.assertEqual(expected4[:3],list(m2C.getNodalConnectivityIndex().getValues()));
         #
         part4=[1,2,4]
         f2=f1.buildSubPart(part4);
-        self.failUnlessEqual(6,f2.getNumberOfTuples());
-        self.failUnlessEqual(2,f2.getNumberOfComponents());
+        self.assertEqual(6,f2.getNumberOfTuples());
+        self.assertEqual(2,f2.getNumberOfComponents());
         expected6=[4.,104.,5.,105.,7.,107.,8.,108.,10.,110.,11.,111.]
-        for i in xrange(12):
+        for i in range(12):
             self.assertAlmostEqual(f2.getIJ(0,i),expected6[i],12);
             pass
-        self.failUnlessEqual(3,f2.getMesh().getNumberOfCells());
-        self.failUnlessEqual(6,f2.getMesh().getNumberOfNodes());
-        self.failUnlessEqual(2,f2.getMesh().getSpaceDimension());
-        self.failUnlessEqual(2,f2.getMesh().getMeshDimension());
+        self.assertEqual(3,f2.getMesh().getNumberOfCells());
+        self.assertEqual(6,f2.getMesh().getNumberOfNodes());
+        self.assertEqual(2,f2.getMesh().getSpaceDimension());
+        self.assertEqual(2,f2.getMesh().getMeshDimension());
         m2C=f2.getMesh();
-        self.failUnlessEqual(13,m2C.getNodalConnectivityArrayLen());
-        for i in xrange(12):
+        self.assertEqual(13,m2C.getNodalConnectivityArrayLen());
+        for i in range(12):
             self.assertAlmostEqual(expected2[i],m2C.getCoords().getIJ(0,i),12);
             pass
-        self.failUnlessEqual(expected3[0:4],list(m2C.getNodalConnectivity().getValues())[4:8]);
-        self.failUnlessEqual(expected3[4:8],list(m2C.getNodalConnectivity().getValues())[0:4]);
-        self.failUnlessEqual(expected3[8:13],list(m2C.getNodalConnectivity().getValues())[8:13]);
-        self.failUnlessEqual(expected4,list(m2C.getNodalConnectivityIndex().getValues()));
+        self.assertEqual(expected3[0:4],list(m2C.getNodalConnectivity().getValues())[4:8]);
+        self.assertEqual(expected3[4:8],list(m2C.getNodalConnectivity().getValues())[0:4]);
+        self.assertEqual(expected3[8:13],list(m2C.getNodalConnectivity().getValues())[8:13]);
+        self.assertEqual(expected4,list(m2C.getNodalConnectivityIndex().getValues()));
         pass
 
     def testDoublyContractedProduct1(self):
@@ -233,7 +236,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         f2.checkConsistencyLight();
         self.assertEqual(1,f2.getNumberOfComponents());
         self.assertEqual(5,f2.getNumberOfTuples());
-        for i in xrange(5):
+        for i in range(5):
             self.assertAlmostEqual(3906.56,f2.getIJ(i,0),9);
             pass
         #
@@ -256,7 +259,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(CONST_ON_TIME_INTERVAL,f2.getTimeDiscretization());
         self.assertEqual(1,f2.getNumberOfComponents());
         self.assertEqual(5,f2.getNumberOfValues());
-        for i in xrange(5):
+        for i in range(5):
             self.assertAlmostEqual(-2.42,f2.getIJ(i,0),13);
             pass
         #6 components multi arrays with end array not defined
@@ -275,7 +278,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(LINEAR_TIME,f2.getTimeDiscretization());
         self.assertEqual(1,f2.getArray().getNumberOfComponents());
         self.assertEqual(9,f2.getNumberOfTuples());
-        for i in xrange(9):
+        for i in range(9):
             self.assertAlmostEqual(137.335,f2.getIJ(i,0),10);
             pass
         #6 components multi arrays with end array defined
@@ -298,7 +301,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertAlmostEqual(3.8,time2,12);
         self.assertEqual(7,it);
         self.assertEqual(3,order);
-        for i in xrange(9):
+        for i in range(9):
             self.assertAlmostEqual(137.335,f2.getIJ(i,0),10);
             self.assertAlmostEqual(1289.685,f2.getEndArray().getIJ(i,0),9);
             pass
@@ -321,7 +324,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertAlmostEqual(7.8,time2,12);
         self.assertEqual(10,it);
         self.assertEqual(2,order);
-        for i in xrange(5):
+        for i in range(5):
             self.assertAlmostEqual(3.267,f2.getIJ(i,0),13);
             pass
         pass
@@ -341,7 +344,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(3,f2.getNumberOfComponents());
         self.assertEqual(5,f2.getNumberOfTuples());
         expected1=[13.638813677891717,-4.502313844635971,-2.2364998332557486]
-        for i in xrange(5):
+        for i in range(5):
             self.assertAlmostEqual(expected1[0],f2.getIJ(i,0),13);
             self.assertAlmostEqual(expected1[1],f2.getIJ(i,1),13);
             self.assertAlmostEqual(expected1[2],f2.getIJ(i,2),13);
@@ -366,7 +369,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
                    0.7381111277307373, 0.06458838384003074, -0.6715804522117897,#eigenvect 1
                    -0.4012053603397987, 0.8423032781211455, -0.3599436712889738#eigenvect 2
                    ]
-        for i in xrange(5):
+        for i in range(5):
             self.assertAlmostEqual(expected1[0],f2.getIJ(i,0),13);
             self.assertAlmostEqual(expected1[1],f2.getIJ(i,1),13);
             self.assertAlmostEqual(expected1[2],f2.getIJ(i,2),13);
@@ -395,7 +398,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(9,f2.getNumberOfComponents());
         self.assertEqual(5,f2.getNumberOfTuples());
         expected1=[-2.6538108356290113, 2.855831037649208, -1.1111111111111067, 3.461891643709813, -4.775022956841121, 2.2222222222222143, -1.1111111111111054, 2.222222222222214, -1.1111111111111072]
-        for i in xrange(5):
+        for i in range(5):
             self.assertAlmostEqual(expected1[0],f2.getIJ(i,0),13);
             self.assertAlmostEqual(expected1[1],f2.getIJ(i,1),13);
             self.assertAlmostEqual(expected1[2],f2.getIJ(i,2),13);
@@ -418,7 +421,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(6,f2.getNumberOfComponents());
         self.assertEqual(5,f2.getNumberOfTuples());
         expected3=[-0.3617705098531818, -0.8678630828458127, -0.026843764174972983, 0.5539957431465833, 0.13133439560823013, -0.05301294502145887]
-        for i in xrange(5):
+        for i in range(5):
             self.assertAlmostEqual(expected3[0],f2.getIJ(i,0),13);
             self.assertAlmostEqual(expected3[1],f2.getIJ(i,1),13);
             self.assertAlmostEqual(expected3[2],f2.getIJ(i,2),13);
@@ -438,7 +441,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(4,f2.getNumberOfComponents());
         self.assertEqual(5,f2.getNumberOfTuples());
         expected2=[-1.8595041322314059, 0.9504132231404963, 1.404958677685951, -0.49586776859504156]
-        for i in xrange(5):
+        for i in range(5):
             self.assertAlmostEqual(expected2[0],f2.getIJ(i,0),13);
             self.assertAlmostEqual(expected2[1],f2.getIJ(i,1),13);
             self.assertAlmostEqual(expected2[2],f2.getIJ(i,2),13);
@@ -461,7 +464,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         f2.checkConsistencyLight();
         self.assertEqual(1,f2.getNumberOfComponents());
         self.assertEqual(5,f2.getNumberOfTuples());
-        for i in xrange(5):
+        for i in range(5):
             self.assertAlmostEqual(15.9,f2.getIJ(i,0),13);
             pass
         #
@@ -475,7 +478,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         f2.checkConsistencyLight();
         self.assertEqual(1,f2.getNumberOfComponents());
         self.assertEqual(5,f2.getNumberOfTuples());
-        for i in xrange(5):
+        for i in range(5):
             self.assertAlmostEqual(25.8,f2.getIJ(i,0),13);
             pass
         #
@@ -489,7 +492,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         f2.checkConsistencyLight();
         self.assertEqual(1,f2.getNumberOfComponents());
         self.assertEqual(5,f2.getNumberOfTuples());
-        for i in xrange(5):
+        for i in range(5):
             self.assertAlmostEqual(5.7,f2.getIJ(i,0),13);
             pass
         #
@@ -510,7 +513,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(6,f2.getNumberOfComponents());
         self.assertEqual(5,f2.getNumberOfTuples());
         expected1=[-1.1,0.,1.1,4.5,5.6,6.7]
-        for i in xrange(5):
+        for i in range(5):
             self.assertAlmostEqual(expected1[0],f2.getIJ(i,0),13);
             self.assertAlmostEqual(expected1[1],f2.getIJ(i,1),13);
             self.assertAlmostEqual(expected1[2],f2.getIJ(i,2),13);
@@ -535,7 +538,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         f2.checkConsistencyLight();
         self.assertEqual(1,f2.getNumberOfComponents());
         self.assertEqual(5,f2.getNumberOfTuples());
-        for i in xrange(5):
+        for i in range(5):
             self.assertAlmostEqual(8.3606219864313918,f2.getIJ(i,0),13);
             pass
         #
@@ -555,14 +558,14 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         f2.checkConsistencyLight();
         self.assertEqual(1,f2.getNumberOfComponents());
         self.assertEqual(5,f2.getNumberOfTuples());
-        for i in xrange(5):
+        for i in range(5):
             self.assertAlmostEqual(5.6,f2.getIJ(i,0),13);
             pass
         #
         d2,d2I=array.maxPerTupleWithCompoId()
         self.assertEqual(1,d2.getNumberOfComponents());
         self.assertEqual(5,d2.getNumberOfTuples());
-        for i in xrange(5):
+        for i in range(5):
             self.assertAlmostEqual(5.6,d2.getIJ(i,0),13);
             pass
         self.assertTrue(d2I.isEqual(DataArrayInt([4,3,2,0,1])))
@@ -583,7 +586,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(3,f1.getNumberOfComponents());
         self.assertEqual(5,f1.getNumberOfTuples());
         expected1=[1.2,2.3,3.4, 1.2,3.4,4.5, 3.4,4.5,5.6, 5.6,1.2,2.3, 4.5,5.6,1.2]
-        for i in xrange(15):
+        for i in range(15):
             self.assertAlmostEqual(expected1[i],f1.getIJ(0,i),13);
             pass
         f1.changeNbOfComponents(4,7.77);
@@ -591,7 +594,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(4,f1.getNumberOfComponents());
         self.assertEqual(5,f1.getNumberOfTuples());
         expected2=[1.2,2.3,3.4,7.77, 1.2,3.4,4.5,7.77, 3.4,4.5,5.6,7.77, 5.6,1.2,2.3,7.77, 4.5,5.6,1.2,7.77]
-        for i in xrange(20):
+        for i in range(20):
             self.assertAlmostEqual(expected2[i],f1.getIJ(0,i),13);
             pass
         #
@@ -611,7 +614,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         f1.checkConsistencyLight();
         self.assertEqual(5,f1.getNumberOfComponents());
         self.assertEqual(5,f1.getNumberOfTuples());
-        for i in xrange(5):
+        for i in range(5):
             self.assertAlmostEqual(arr1[0],f1.getIJ(i,0),13);
             self.assertAlmostEqual(arr1[1],f1.getIJ(i,1),13);
             self.assertAlmostEqual(arr1[2],f1.getIJ(i,2),13);
@@ -623,7 +626,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         f1.checkConsistencyLight();
         self.assertEqual(5,f1.getNumberOfComponents());
         self.assertEqual(5,f1.getNumberOfTuples());
-        for i in xrange(5):
+        for i in range(5):
             self.assertAlmostEqual(arr1[4],f1.getIJ(i,0),13);
             self.assertAlmostEqual(arr1[3],f1.getIJ(i,1),13);
             self.assertAlmostEqual(arr1[2],f1.getIJ(i,2),13);
@@ -726,7 +729,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(5,f1.getNumberOfTuples());
         self.assertEqual(1,f1.getNumberOfComponents());
         expected1=[1.,1.4142135623730951, 1.4142135623730951,1.,1.]
-        for i in xrange(5):
+        for i in range(5):
             self.assertAlmostEqual(expected1[i],f1.getIJ(i,0),14);
             pass
         #
@@ -736,7 +739,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(5,f1.getNumberOfTuples());
         self.assertEqual(1,f1.getNumberOfComponents());
         expected2=[1.4142135623730951, 1.7320508075688772, 1.7320508075688772, 1.4142135623730951, 1.4142135623730951]
-        for i in xrange(5):
+        for i in range(5):
             self.assertAlmostEqual(expected2[i],f1.getIJ(i,0),14);
             pass
         pass
@@ -757,7 +760,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         values1=[-0.1,0.23333333333333336,0.56666666666666665,0.4,0.9]
         tmp=f1.getArray().getValues();
         self.assertEqual(len(values1),len(tmp))
-        for i in xrange(len(values1)):
+        for i in range(len(values1)):
             self.assertTrue(abs(values1[i]-tmp[i])<1.e-12);
             pass
         #
@@ -773,7 +776,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         values2=[-0.9,0.1,1.1,-0.4,0.6,1.6,0.1,1.1,2.1]
         tmp=f1.getArray().getValues();
         self.assertEqual(len(values2),len(tmp))
-        for i in xrange(len(values2)):
+        for i in range(len(values2)):
             self.assertTrue(abs(values2[i]-tmp[i])<1.e-12);
             pass
         f1=MEDCouplingFieldDouble.New(ON_NODES,LINEAR_TIME);
@@ -788,12 +791,12 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         tmp=f1.getArray().getValues();
         values2Bis=[-0.9,0.1,1.1,-0.4,0.6,1.6,0.1,1.1,2.1]
         self.assertEqual(len(values2Bis),len(tmp))
-        for i in xrange(len(values2Bis)):
+        for i in range(len(values2Bis)):
             self.assertTrue(abs(values2Bis[i]-tmp[i])<1.e-12);
             pass
         tmp=f1.getEndArray().getValues();
         self.assertEqual(len(values2Bis),len(tmp))
-        for i in xrange(len(values2Bis)):
+        for i in range(len(values2Bis)):
             self.assertTrue(abs(values2Bis[i]-tmp[i])<1.e-12);
             pass
         #
@@ -808,7 +811,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         values3=[-0.6,-1.2,-0.1,-0.2,0.4,0.8,-0.1,-0.2,0.4,0.8,0.9,1.8,0.4,0.8,0.9,1.8,1.4,2.8]
         tmp=f1.getArray().getValues();
         self.assertEqual(len(values3),len(tmp))
-        for i in xrange(len(values3)):
+        for i in range(len(values3)):
             self.assertTrue(abs(values3[i]-tmp[i])<1.e-12);
             pass
         values4=f1.accumulate();
@@ -832,14 +835,14 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         f1.checkConsistencyLight();
         self.assertEqual(1,f1.getNumberOfComponents());
         self.assertEqual(5,f1.getNumberOfTuples());
-        for i in xrange(5):
+        for i in range(5):
             self.assertAlmostEqual(0.07,f1.getIJ(i,0),16);
             pass
         f1.assign(0.09);
         f1.checkConsistencyLight();
         self.assertEqual(1,f1.getNumberOfComponents());
         self.assertEqual(5,f1.getNumberOfTuples());
-        for i in xrange(5):
+        for i in range(5):
             self.assertAlmostEqual(0.09,f1.getIJ(i,0),16);
             pass
         #
@@ -850,12 +853,12 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         f1.checkConsistencyLight();
         self.assertEqual(1,f1.getNumberOfComponents());
         self.assertEqual(9,f1.getNumberOfTuples());
-        for i in xrange(9):
+        for i in range(9):
             self.assertAlmostEqual(0.08,f1.getIJ(i,0),16);
             pass
         self.assertEqual(1,f1.getEndArray().getNumberOfComponents());
         self.assertEqual(9,f1.getEndArray().getNumberOfTuples());
-        for i in xrange(9):
+        for i in range(9):
             self.assertAlmostEqual(0.08,f1.getEndArray().getIJ(i,0),16);
             pass
         pass
@@ -940,20 +943,20 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(3,f.getNumberOfTuples());
         self.assertEqual(1,f.getNumberOfComponents());
         expected1=[1.1,2.4,4.4]
-        for i in xrange(3):
+        for i in range(3):
             self.assertAlmostEqual(expected1[i],f.getIJ(i,0),12);
             pass
         coords=m.getCoordinatesAndOwner();
         self.assertEqual(4,coords.getNumberOfTuples());
         self.assertEqual(1,coords.getNumberOfComponents());
-        for i in xrange(4):
+        for i in range(4):
             self.assertAlmostEqual(discX[i],coords.getIJ(i,0),12);
             pass
         coords=m.computeCellCenterOfMass();
         self.assertEqual(3,coords.getNumberOfTuples());
         self.assertEqual(1,coords.getNumberOfComponents());
         expected1_3=[2.85,4.6,8.]
-        for i in xrange(3):
+        for i in range(3):
             self.assertAlmostEqual(expected1_3[i],coords.getIJ(i,0),12);
             pass
         #
@@ -968,21 +971,21 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(6,f.getNumberOfTuples());
         self.assertEqual(1,f.getNumberOfComponents());
         expected2=[12.21,26.64,48.84,24.64,53.76,98.56]
-        for i in xrange(6):
+        for i in range(6):
             self.assertAlmostEqual(expected2[i],f.getIJ(i,0),12);
             pass
         coords=m.getCoordinatesAndOwner();
         self.assertEqual(12,coords.getNumberOfTuples());
         self.assertEqual(2,coords.getNumberOfComponents());
         expected2_2=[2.3,12.3,3.4,12.3,5.8,12.3,10.2,12.3, 2.3,23.4,3.4,23.4,5.8,23.4,10.2,23.4, 2.3,45.8,3.4,45.8,5.8,45.8,10.2,45.8]
-        for i in xrange(24):
+        for i in range(24):
             self.assertAlmostEqual(expected2_2[i],coords.getIJ(0,i),12);
             pass
         coords=m.computeCellCenterOfMass();
         self.assertEqual(6,coords.getNumberOfTuples());
         self.assertEqual(2,coords.getNumberOfComponents());
         expected2_3=[2.85,17.85,4.6,17.85,8.,17.85, 2.85,34.6,4.6,34.6,8.,34.6]
-        for i in xrange(12):
+        for i in range(12):
             self.assertAlmostEqual(expected2_3[i],coords.getIJ(0,i),12);
             pass
         #
@@ -997,7 +1000,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(24,f.getNumberOfTuples());
         self.assertEqual(1,f.getNumberOfComponents());
         expected3=[23.199, 50.616, 92.796, 46.816, 102.144, 187.264, 0.6105, 1.332, 2.442, 1.232, 2.688, 4.928, 10.7448, 23.4432, 42.9792, 21.6832, 47.3088, 86.7328, 6.5934, 14.3856, 26.3736, 13.3056, 29.0304, 53.2224]
-        for i in xrange(24):
+        for i in range(24):
             self.assertAlmostEqual(expected3[i],f.getIJ(i,0),12);
             pass
         coords=m.getCoordinatesAndOwner();
@@ -1009,7 +1012,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
             2.3,12.3,1.25, 3.4,12.3,1.25, 5.8,12.3,1.25, 10.2,12.3,1.25, 2.3,23.4,1.25, 3.4,23.4,1.25, 5.8,23.4,1.25, 10.2,23.4,1.25, 2.3,45.8,1.25, 3.4,45.8,1.25, 5.8,45.8,1.25, 10.2,45.8,1.25,
             2.3,12.3,2.13, 3.4,12.3,2.13, 5.8,12.3,2.13, 10.2,12.3,2.13, 2.3,23.4,2.13, 3.4,23.4,2.13, 5.8,23.4,2.13, 10.2,23.4,2.13, 2.3,45.8,2.13, 3.4,45.8,2.13, 5.8,45.8,2.13, 10.2,45.8,2.13,
             2.3,12.3,2.67, 3.4,12.3,2.67, 5.8,12.3,2.67, 10.2,12.3,2.67, 2.3,23.4,2.67, 3.4,23.4,2.67, 5.8,23.4,2.67, 10.2,23.4,2.67, 2.3,45.8,2.67, 3.4,45.8,2.67, 5.8,45.8,2.67, 10.2,45.8,2.67];
-        for i in xrange(180):
+        for i in range(180):
             self.assertAlmostEqual(expected3_2[i],coords.getIJ(0,i),12);
             pass
         coords=m.computeCellCenterOfMass();
@@ -1020,7 +1023,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
             2.85,17.85,1.225,4.6,17.85,1.225,8.,17.85,1.225, 2.85,34.6,1.225,4.6,34.6,1.225,8.,34.6,1.225,
             2.85,17.85,1.69,4.6,17.85,1.69,8.,17.85,1.69, 2.85,34.6,1.69,4.6,34.6,1.69,8.,34.6,1.69,
             2.85,17.85,2.4,4.6,17.85,2.4,8.,17.85,2.4, 2.85,34.6,2.4,4.6,34.6,2.4,8.,34.6,2.4];
-        for i in xrange(72):
+        for i in range(72):
             self.assertAlmostEqual(expected3_3[i],coords.getIJ(0,i),12);
             pass
         pass
@@ -1034,18 +1037,18 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(18,f.getNumberOfTuples());
         self.assertEqual(2,f.getNumberOfComponents());
         expected1=[-0.6, -0.6, 0.4, 0.4, 1.4, 1.4, -0.6, -0.6, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 1.4, 1.4, -0.6, -0.6, 0.4, 0.4, 1.4, 1.4, -0.6, -0.6, 1.4, 1.4, -0.6, -0.6, 0.4, 0.4, 1.4, 1.4, 0.4, 0.4]
-        for i in xrange(36):
+        for i in range(36):
             self.assertAlmostEqual(expected1[i],f.getIJ(0,i),12);
             pass
         self.assertTrue(f.zipCoords());
         f.checkConsistencyLight();
         expected2=[-0.6, -0.6, 1.4, 1.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 1.4, 1.4, -0.6, -0.6, 0.4, 0.4, 1.4, 1.4, 1.4, 1.4, -0.6, -0.6, 0.4, 0.4, 1.4, 1.4, 0.4, 0.4]
-        for i in xrange(30):
+        for i in range(30):
             self.assertAlmostEqual(expected2[i],f.getIJ(0,i),12);
             pass
         self.assertTrue(not f.zipCoords());
         f.checkConsistencyLight();
-        for i in xrange(30):
+        for i in range(30):
             self.assertAlmostEqual(expected2[i],f.getIJ(0,i),12);
             pass
         self.assertTrue(f.getArray().getInfoOnComponent(0)=="titi");
@@ -1073,7 +1076,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         expected1=[-0.05, -0.05, 0.3666666666666667, 0.3666666666666667, 0.53333333333333321, 0.53333333333333321,
                    -0.05, -0.05, 0.45, 0.45, 0.53333333333333321, 0.53333333333333321, -0.05, -0.05, 0.45, 0.45,
                    0.36666666666666659, 0.36666666666666659, 0.033333333333333326, 0.033333333333333326];
-        for i in xrange(20):
+        for i in range(20):
             self.assertAlmostEqual(expected1[i],f.getIJ(0,i),12);
             pass
         f.getArray().setInfoOnComponent(0,"titi");
@@ -1084,7 +1087,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
                    -0.05, -0.05, 0.45, 0.45, 0.36666666666666659, 0.36666666666666659, 0.033333333333333326, 0.033333333333333326];
         self.assertEqual(7,f.getNumberOfTuples());
         self.assertEqual(2,f.getNumberOfComponents());
-        for i in xrange(14):
+        for i in range(14):
             self.assertAlmostEqual(expected2[i],f.getIJ(0,i),12);
             pass
         self.assertTrue(f.getArray().getInfoOnComponent(0)=="titi");
@@ -1095,13 +1098,13 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
                    -0.3, -0.3, 0.2, 0.2, 0.7, 0.7];
         self.assertEqual(9,f2.getNumberOfTuples());
         self.assertEqual(2,f2.getNumberOfComponents());
-        for i in xrange(18):
+        for i in range(18):
             self.assertAlmostEqual(expected3[i],f2.getIJ(0,i),12);
             pass
         self.assertTrue(f2.zipConnectivity(0));
         self.assertEqual(9,f2.getNumberOfTuples());
         self.assertEqual(2,f2.getNumberOfComponents());
-        for i in xrange(18):
+        for i in range(18):
             self.assertAlmostEqual(expected3[i],f2.getIJ(0,i),12);
             pass
         pass
@@ -1120,7 +1123,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertTrue(b.getInfoOnComponent(0)=="toto");
         self.assertTrue(b.getInfoOnComponent(1)=="tata");
         expected1=[3.1, 13.1, 2.1, 12.1, 7.1, 17.1, 1.1, 11.1, 6.1, 16.1, 5.1, 15.1, 4.1, 14.1]
-        for i in xrange(14):
+        for i in range(14):
             self.assertAlmostEqual(expected1[i],b.getIJ(0,i),14);
             pass
         #
@@ -1135,7 +1138,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertTrue(d.getInfoOnComponent(0)=="toto");
         self.assertTrue(d.getInfoOnComponent(1)=="tata");
         expected2=[3, 13, 2, 12, 7, 17, 1, 11, 6, 16, 5, 15, 4, 14]
-        for i in xrange(14):
+        for i in range(14):
             self.assertEqual(expected2[i],d.getIJ(0,i));
             pass
         pass
@@ -1154,7 +1157,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertTrue(b.getInfoOnComponent(0)=="toto");
         self.assertTrue(b.getInfoOnComponent(1)=="tata");
         expected1=[5.1,15.1,3.1,13.1,1.1,11.1,7.1,17.1,6.1,16.1]
-        for i in xrange(10):
+        for i in range(10):
             self.assertAlmostEqual(expected1[i],b.getIJ(0,i),14);
             pass
         #
@@ -1169,7 +1172,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertTrue(d.getInfoOnComponent(0)=="toto");
         self.assertTrue(d.getInfoOnComponent(1)=="tata");
         expected2=[5,15,3,13,1,11,7,17,6,16]
-        for i in xrange(10):
+        for i in range(10):
             self.assertEqual(expected2[i],d.getIJ(0,i));
             pass
         pass
@@ -1184,7 +1187,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(7,a.getNumberOfTuples());
         self.assertEqual(2,a.getNumberOfComponents());
         expected1=[3.1, 13.1, 2.1, 12.1, 7.1, 17.1, 1.1, 11.1, 6.1, 16.1, 5.1, 15.1, 4.1, 14.1]
-        for i in xrange(14):
+        for i in range(14):
             self.assertAlmostEqual(expected1[i],a.getIJ(0,i),14);
             pass
         #
@@ -1195,7 +1198,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(7,c.getNumberOfTuples());
         self.assertEqual(2,c.getNumberOfComponents());
         expected2=[3, 13, 2, 12, 7, 17, 1, 11, 6, 16, 5, 15, 4, 14]
-        for i in xrange(14):
+        for i in range(14):
             self.assertEqual(expected2[i],c.getIJ(0,i));
             pass
         pass
@@ -1214,7 +1217,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertTrue(b.getInfoOnComponent(0)=="toto");
         self.assertTrue(b.getInfoOnComponent(1)=="tata");
         expected1=[4.1, 14.1, 2.1, 12.1, 1.1, 11.1, 7.1, 17.1, 6.1, 16.1, 5.1, 15.1, 3.1, 13.1]
-        for i in xrange(14):
+        for i in range(14):
             self.assertAlmostEqual(expected1[i],b.getIJ(0,i),14);
             pass
         #
@@ -1229,7 +1232,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertTrue(d.getInfoOnComponent(0)=="toto");
         self.assertTrue(d.getInfoOnComponent(1)=="tata");
         expected2=[4, 14, 2, 12, 1, 11, 7, 17, 6, 16, 5, 15, 3, 13]
-        for i in xrange(14):
+        for i in range(14):
             self.assertEqual(expected2[i],d.getIJ(0,i));
             pass
         pass
@@ -1244,7 +1247,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(7,a.getNumberOfTuples());
         self.assertEqual(2,a.getNumberOfComponents());
         expected1=[4.1, 14.1, 2.1, 12.1, 1.1, 11.1, 7.1, 17.1, 6.1, 16.1, 5.1, 15.1, 3.1, 13.1]
-        for i in xrange(14):
+        for i in range(14):
             self.assertAlmostEqual(expected1[i],a.getIJ(0,i),14);
             pass
         #
@@ -1255,7 +1258,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(7,c.getNumberOfTuples());
         self.assertEqual(2,c.getNumberOfComponents());
         expected2=[4, 14, 2, 12, 1, 11, 7, 17, 6, 16, 5, 15, 3, 13]
-        for i in xrange(14):
+        for i in range(14):
             self.assertEqual(expected2[i],c.getIJ(0,i));
             pass
         pass
@@ -1274,7 +1277,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertTrue(b.getInfoOnComponent(0)=="toto");
         self.assertTrue(b.getInfoOnComponent(1)=="tata");
         expected1=[5.1,15.1,3.1,13.1,1.1,11.1,7.1,17.1,6.1,16.1]
-        for i in xrange(10):
+        for i in range(10):
             self.assertAlmostEqual(expected1[i],b.getIJ(0,i),14);
             pass
         #
@@ -1289,7 +1292,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertTrue(d.getInfoOnComponent(0)=="toto");
         self.assertTrue(d.getInfoOnComponent(1)=="tata");
         expected2=[5,15,3,13,1,11,7,17,6,16]
-        for i in xrange(10):
+        for i in range(10):
             self.assertEqual(expected2[i],d.getIJ(0,i));
             pass
         pass
@@ -1306,7 +1309,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(3,ws.getNumberOfTuples());
         self.assertEqual(1,ws.getNumberOfComponents());
         expected1=[1,4,8]
-        for i in xrange(3):
+        for i in range(3):
             self.assertEqual(expected1[i],ws.getIJ(i,0));
             pass
         a=DataArrayDouble.New();
@@ -1319,7 +1322,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertAlmostEqual(-4.56,m,12);
         self.assertEqual(3,ws.getNumberOfTuples());
         self.assertEqual(1,ws.getNumberOfComponents());
-        for i in xrange(3):
+        for i in range(3):
             self.assertEqual(expected1[i],ws.getIJ(i,0));
             pass
         pass
@@ -1342,7 +1345,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(4,ws.getNumberOfTuples());
         self.assertEqual(1,ws.getNumberOfComponents());
         expected1=[0,3,7,17]
-        for i in xrange(4):
+        for i in range(4):
             self.assertEqual(expected1[i],ws.getIJ(i,0));
             pass
         #
@@ -1355,7 +1358,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertAlmostEqual(-8.71,m,12);
         self.assertEqual(4,ws.getNumberOfTuples());
         self.assertEqual(1,ws.getNumberOfComponents());
-        for i in xrange(4):
+        for i in range(4):
             self.assertEqual(expected1[i],ws.getIJ(i,0));
             pass
         pass
@@ -1384,7 +1387,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(f2.getNumberOfTuples(),3);
         self.assertEqual(1,m2.getMeshDimension());
         self.assertEqual(1,m2.getSpaceDimension());
-        for i in xrange(3):
+        for i in range(3):
             self.assertAlmostEqual(f1.getIJ(i,0),f2.getIJ(i,0),10);
             pass
         da=DataArrayDouble.New();
@@ -1399,7 +1402,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(f2.getNumberOfTuples(),6);
         self.assertEqual(2,m2.getMeshDimension());
         self.assertEqual(2,m2.getSpaceDimension());
-        for i in xrange(6):
+        for i in range(6):
             self.assertAlmostEqual(f1.getIJ(i,0),f2.getIJ(i,0),10);
             pass
         #
@@ -1414,7 +1417,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(f2.getNumberOfTuples(),24);
         self.assertEqual(3,m2.getMeshDimension());
         self.assertEqual(3,m2.getSpaceDimension());
-        for i in xrange(24):
+        for i in range(24):
             self.assertAlmostEqual(f1.getIJ(i,0),f2.getIJ(i,0),10);
             pass
         #
@@ -1439,11 +1442,11 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(6,da2.getNumberOfTuples());
         self.assertEqual(1,da2.getNumberOfComponents());
         expected1=[1,3,0,5,2,4]
-        for i in xrange(6):
+        for i in range(6):
             self.assertEqual(expected1[i],da2.getIJ(i,0));
             pass
         da3=da2.invertArrayN2O2O2N(6);
-        for i in xrange(6):
+        for i in range(6):
             self.assertEqual(arr1[i],da3.getIJ(i,0));
             pass
         #
@@ -1454,11 +1457,11 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(6,da2.getNumberOfTuples());
         self.assertEqual(1,da2.getNumberOfComponents());
         expected2=[5,7,8,0,3,2]
-        for i in xrange(6):
+        for i in range(6):
             self.assertEqual(expected2[i],da2.getIJ(i,0));
             pass
         da3=da2.invertArrayN2O2O2N(10);
-        for i in xrange(10):
+        for i in range(10):
             self.assertEqual(arr2[i],da3.getIJ(i,0));
             pass
         pass
@@ -1469,7 +1472,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         a1.setValues(arr1,5,4);
         expp=[21.,22.,23.,24.]
         self.assertEqual(4,len(a1.getTuple(2)));
-        for i in xrange(4):
+        for i in range(4):
             self.assertAlmostEqual(expp[i],a1.getTuple(2)[i],12)
             pass
         a1.setInfoOnComponent(0,"aaaa");
@@ -1487,7 +1490,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertTrue(a2.getInfoOnComponent(4)=="aaaa");
         self.assertTrue(a2.getInfoOnComponent(5)=="aaaa");
         expected1=[2.,3.,2.,3.,1.,1., 12.,13.,12.,13.,11.,11., 22.,23.,22.,23.,21.,21., 32.,33.,32.,33.,31.,31., 42.,43.,42.,43.,41.,41.]
-        for i in xrange(30):
+        for i in range(30):
             self.assertAlmostEqual(expected1[i],a2.getIJ(0,i),14);
             pass
         a3=a1.convertToIntArr();
@@ -1501,7 +1504,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertTrue(a4.getInfoOnComponent(3)=="cccc");
         self.assertTrue(a4.getInfoOnComponent(4)=="aaaa");
         self.assertTrue(a4.getInfoOnComponent(5)=="aaaa");
-        for i in xrange(30):
+        for i in range(30):
             self.assertEqual(int(expected1[i]),a4.getIJ(0,i));
             pass
         # setSelectedComponents
@@ -1520,7 +1523,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertTrue(a2.getInfoOnComponent(4)=="aaaa");
         self.assertTrue(a2.getInfoOnComponent(5)=="aaaa");
         expected2=[2.,4.,3.,3.,1.,1., 12.,14.,13.,13.,11.,11., 22.,24.,23.,23.,21.,21., 32.,34.,33.,33.,31.,31., 42.,44.,43.,43.,41.,41.]
-        for i in xrange(30):
+        for i in range(30):
             self.assertAlmostEqual(expected2[i],a2.getIJ(0,i),14);
             pass
         a6=a5.convertToIntArr();
@@ -1535,7 +1538,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertTrue(a4.getInfoOnComponent(3)=="cccc");
         self.assertTrue(a4.getInfoOnComponent(4)=="aaaa");
         self.assertTrue(a4.getInfoOnComponent(5)=="aaaa");
-        for i in xrange(30):
+        for i in range(30):
             self.assertEqual(int(expected2[i]),a4.getIJ(0,i));
             pass
         # test of throw
@@ -1583,7 +1586,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertTrue(f2.getArray().getInfoOnComponent(4)=="aaaa");
         self.assertTrue(f2.getArray().getInfoOnComponent(5)=="aaaa");
         expected1=[2.,3.,2.,3.,1.,1., 12.,13.,12.,13.,11.,11., 22.,23.,22.,23.,21.,21., 32.,33.,32.,33.,31.,31., 42.,43.,42.,43.,41.,41.]
-        for i in xrange(30):
+        for i in range(30):
             self.assertAlmostEqual(expected1[i],f2.getIJ(0,i),14);
             pass
         #setSelectedComponents
@@ -1609,7 +1612,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertTrue(f2.getArray().getInfoOnComponent(4)=="aaaa");
         self.assertTrue(f2.getArray().getInfoOnComponent(5)=="aaaa");
         expected2=[2.,4.,3.,3.,1.,1., 12.,14.,13.,13.,11.,11., 22.,24.,23.,23.,21.,21., 32.,34.,33.,33.,31.,31., 42.,44.,43.,43.,41.,41.]
-        for i in xrange(30):
+        for i in range(30):
             self.assertAlmostEqual(expected2[i],f2.getIJ(0,i),14);
             pass
         #
@@ -1831,7 +1834,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         da4=da3.fromNoInterlace();
         self.assertEqual(5,da4.getNumberOfTuples());
         self.assertEqual(3,da4.getNumberOfComponents());# it's not a bug. Avoid to have 1 million components !
-        for i in xrange(15):
+        for i in range(15):
             self.assertAlmostEqual(expected1[i],da4.getIJ(0,i),14);
             pass
         pass
@@ -1849,7 +1852,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         da4=da3.toNoInterlace();
         self.assertEqual(5,da4.getNumberOfTuples());
         self.assertEqual(3,da4.getNumberOfComponents());# it's not a bug. Avoid to have 1 million components !
-        for i in xrange(15):
+        for i in range(15):
             self.assertAlmostEqual(expected1[i],da4.getIJ(0,i),14);
             pass
         pass
@@ -1890,7 +1893,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         da.setValues(tab1,2,2);
         da2=da.fromPolarToCart();
         expected1=[1.9601331556824833,0.39733866159012243, 1.9121054682112213,1.6105442180942275]
-        for i in xrange(4):
+        for i in range(4):
             self.assertAlmostEqual(expected1[i],da2.getIJ(0,i),13);
             pass
         pass
@@ -1901,7 +1904,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         da.setValues(tab1,2,3);
         da2=da.fromCylToCart();
         expected1=[1.9601331556824833,0.39733866159012243,4., 1.9121054682112213,1.6105442180942275,9.]
-        for i in xrange(6):
+        for i in range(6):
             self.assertAlmostEqual(expected1[i],da2.getIJ(0,i),13);
             pass
         pass
@@ -1912,7 +1915,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         da.setValues(tab1,2,3);
         da2=da.fromSpherToCart();
         expected1=[0.37959212195737485,0.11742160338765303,1.9601331556824833, 1.1220769624465328,1.1553337045129035,1.9121054682112213]
-        for i in xrange(6):
+        for i in range(6):
             self.assertAlmostEqual(expected1[i],da2.getIJ(0,i),13);
             pass
         pass
@@ -1982,7 +1985,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(NORM_PYRA5,mesh.getTypeOfCell(1));
         self.assertEqual(NORM_TETRA4,mesh.getTypeOfCell(2));
         self.assertEqual(NORM_PYRA5,mesh.getTypeOfCell(3));
-        for i in xrange(4):
+        for i in range(4):
             self.assertAlmostEqual(f1.getArray().getIJ(0,i),f2.getArray().getIJ(0,i),5);
             pass
         pass
@@ -2131,14 +2134,14 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(24,i.getNumberOfCellsWithType(NORM_QUAD4));
         expected1=[0.25,0.75,2.0625]
         j=i.getMeasureField(True);
-        for ii in xrange(12):
-            for k in xrange(3):
+        for ii in range(12):
+            for k in range(3):
                 self.assertAlmostEqual(expected1[k],j.getIJ(0,ii*3+k),10);
                 pass
             pass
         expected2=[0.62200846792814113, 0.16666666666681595, 1.4513530918323276, 0.38888888888923495, 2.6293994326053212, 0.7045454545460802, 0.45534180126145435, 0.45534180126150181, 1.0624642029433926, 1.0624642029435025, 1.9248539780597826, 1.9248539780599816, 0.16666666666661334, 0.62200846792815856, 0.38888888888876294, 1.4513530918323678, 0.70454545454522521, 2.629399432605394, -0.16666666666674007, 0.62200846792812436, -0.38888888888906142, 1.4513530918322881, -0.70454545454576778, 2.6293994326052488, -0.45534180126154766, 0.45534180126140844, -1.0624642029436118, 1.0624642029432834, -1.9248539780601803, 1.9248539780595841, -0.62200846792817499, 0.1666666666665495, -1.451353091832408, 0.388888888888613, -2.6293994326054668, 0.70454545454495332, -0.62200846792810593, -0.16666666666680507, -1.451353091832247, -0.38888888888921297, -2.6293994326051746, -0.70454545454604123, -0.45534180126135926, -0.45534180126159562, -1.0624642029431723, -1.0624642029437235, -1.9248539780593836, -1.9248539780603811, -0.1666666666664828, -0.62200846792819242, -0.38888888888846079, -1.4513530918324489, -0.70454545454467987, -2.6293994326055397, 0.16666666666687083, -0.62200846792808862, 0.38888888888936374, -1.4513530918322073, 0.70454545454631357, -2.6293994326051022, 0.45534180126164348, -0.45534180126131207, 1.0624642029438327, -1.0624642029430627, 1.9248539780605791, -1.9248539780591853, 0.62200846792821063, -0.16666666666641802, 1.4513530918324888, -0.38888888888831086, 2.6293994326056125, -0.70454545454440853]
         m=i.computeCellCenterOfMass();
-        for i in xrange(72):
+        for i in range(72):
             self.assertAlmostEqual(expected2[i],m.getIJ(0,i),10);
             pass
         #
@@ -2170,12 +2173,12 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         g.checkConsistencyLight();
         expected1=[ 0.4330127018922193, 0.4330127018922193, 0.649519052838329, 1.2990381056766578, 1.299038105676658, 1.948557158514987, 2.1650635094610955, 2.1650635094610964, 3.2475952641916446, 3.031088913245533, 3.0310889132455352, 4.546633369868303 ]
         f1=g.getMeasureField(True);
-        for i in xrange(12):
+        for i in range(12):
             self.assertAlmostEqual(expected1[i],f1.getIJ(0,i),12);
             pass
         expected2=[0.625, 0.21650635094610962, 1.625, 0.21650635094610959, 2.8750000000000004, 0.21650635094610965, 1.1250000000000002, 1.0825317547305482, 2.125, 1.0825317547305482, 3.3750000000000004, 1.0825317547305484, 2.125, 2.8145825622994254, 3.125, 2.8145825622994254, 4.375, 2.8145825622994254, 3.6250000000000009, 5.4126587736527414, 4.625, 5.4126587736527414, 5.875, 5.4126587736527414]
         f2=g.computeCellCenterOfMass();
-        for i in xrange(24):
+        for i in range(24):
             self.assertAlmostEqual(expected2[i],f2.getIJ(0,i),12);
             pass
         pass
@@ -2216,8 +2219,8 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertTrue(tmp2);
         self.assertEqual(444,tmp3);
         expected1=[1.327751058489274, 4.2942574094314701, 13.024068164857139, 1.3069177251569044, 4.1484240761012954, 12.297505664866796, 1.270833333332571, 3.8958333333309674, 11.039062499993179, 1.2291666666659207, 3.6041666666644425, 9.585937499993932, 1.1930822748415895, 3.3515759238941376, 8.3274943351204556, 1.1722489415082769, 3.2057425905609289, 7.6009318351210622, 1.1722489415082862, 3.2057425905609884, 7.6009318351213713, 1.1930822748416161, 3.3515759238943001, 8.3274943351212727, 1.2291666666659564, 3.6041666666646734, 9.5859374999950777, 1.2708333333326081, 3.8958333333311868, 11.039062499994293, 1.3069177251569224, 4.1484240761014384, 12.297505664867627, 1.3277510584902354, 4.2942574094346071, 13.024068164866796]
-        for ii in xrange(12):
-            for jj in xrange(36):
+        for ii in range(12):
+            for jj in range(36):
                 self.assertAlmostEqual(expected1[jj],f2.getIJ(0,ii*36+jj),9);
                 pass
         #
@@ -2230,7 +2233,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(7,da.getNumberOfTuples());
         self.assertEqual(1,da.getNumberOfComponents());
         expected2=[0,0,1,2,3,4,4]
-        for i in xrange(7):
+        for i in range(7):
             self.assertEqual(expected2[i],da.getIJ(i,0));
             pass
         m.checkConsistencyLight();
@@ -2244,7 +2247,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(NORM_TRI3,m.getTypeOfCell(6));
         expected1=[0.125,0.125,0.125,0.125,0.25,0.125,0.125]
         f=m.getMeasureField(False);
-        for i in xrange(7):
+        for i in range(7):
             self.assertAlmostEqual(expected1[i]*sqrt(2.),f.getIJ(i,0),10);
             pass
         types=m.getAllGeoTypes();
@@ -2255,7 +2258,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         da=m.simplexize(1);
         self.assertEqual(7,da.getNumberOfTuples());
         self.assertEqual(1,da.getNumberOfComponents());
-        for i in xrange(7):
+        for i in range(7):
             self.assertEqual(expected2[i],da.getIJ(i,0));
             pass
         m.checkConsistencyLight();
@@ -2270,7 +2273,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(NORM_TRI3,m.getTypeOfCell(5));
         self.assertEqual(NORM_TRI3,m.getTypeOfCell(6));
         f=m.getMeasureField(False);
-        for i in xrange(7):
+        for i in range(7):
             self.assertAlmostEqual(expected1[i]*sqrt(2.),f.getIJ(i,0),10);
             pass
         pass
@@ -2289,11 +2292,11 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertTrue(f1.simplexize(0));
         f1.checkConsistencyLight();
         expected1=[10.,110.,10.,110.,20.,120.,30.,130.,40.,140.,50.,150.,50.,150.]
-        for i in xrange(14):
+        for i in range(14):
             self.assertAlmostEqual(expected1[i],f1.getIJ(0,i),10);
             pass
         self.assertTrue(not f1.simplexize(0));
-        for i in xrange(14):
+        for i in range(14):
             self.assertAlmostEqual(expected1[i],f1.getIJ(0,i),10);
             pass
         #
@@ -2326,7 +2329,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertTrue(da1.getInfoOnComponent(4)=="c2da3");
         #
         expected1=[7.,7.,0.,0.,0., 7.,7.,10.,100.,1000., 7.,7.,20.,200.,2000., 7.,7.,30.,300.,3000., 7.,7.,40.,400.,4000.,7.,7.,50.,500.,5000.,7.,7.,60.,600.,6000.]
-        for i in xrange(35):
+        for i in range(35):
             self.assertAlmostEqual(expected1[i],da1.getIJ(0,i),10);
             pass
         #
@@ -2340,7 +2343,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertTrue(dai1.getInfoOnComponent(2)=="c0da3");
         self.assertTrue(dai1.getInfoOnComponent(3)=="c1da3");
         self.assertTrue(dai1.getInfoOnComponent(4)=="c2da3");
-        for i in xrange(35):
+        for i in range(35):
             self.assertEqual(int(expected1[i]),dai1.getIJ(0,i));
             pass
         # test of static method DataArrayDouble::meld
@@ -2354,7 +2357,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertTrue(da4.getInfoOnComponent(2)=="c0da3");
         self.assertTrue(da4.getInfoOnComponent(3)=="c1da3");
         self.assertTrue(da4.getInfoOnComponent(4)=="c2da3");
-        for i in xrange(35):
+        for i in range(35):
             self.assertAlmostEqual(expected1[i],da4.getIJ(0,i),10);
             pass
         # test of static method DataArrayInt::meld
@@ -2369,7 +2372,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertTrue(dai4.getInfoOnComponent(2)=="c0da3");
         self.assertTrue(dai4.getInfoOnComponent(3)=="c1da3");
         self.assertTrue(dai4.getInfoOnComponent(4)=="c2da3");
-        for i in xrange(35):
+        for i in range(35):
             self.assertEqual(int(expected1[i]),dai4.getIJ(0,i));
             pass
         pass
@@ -2403,7 +2406,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertTrue(f3.getArray().getInfoOnComponent(1)=="ccc");
         self.assertTrue(f3.getArray().getInfoOnComponent(2)=="aaa");
         expected1=[5.,5.,12.,5.,5.,23.,5.,5.,34.,5.,5.,45.,5.,5.,56.]
-        for i in xrange(15):
+        for i in range(15):
             self.assertAlmostEqual(expected1[i],f3.getIJ(0,i),12);
             pass
         time,dt,it=f3.getTime();
@@ -2420,7 +2423,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertTrue(f6.getArray().getInfoOnComponent(0)=="bbb");
         self.assertTrue(f6.getArray().getInfoOnComponent(1)=="ccc");
         self.assertTrue(f6.getArray().getInfoOnComponent(2)=="aaa");
-        for i in xrange(15):
+        for i in range(15):
             self.assertAlmostEqual(expected1[i],f6.getIJ(0,i),12);
             pass
         #
@@ -2436,7 +2439,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         da,b,newNbOfNodes=m3.mergeNodesCenter(0.01);
         self.assertEqual(9,m3.getNumberOfNodes());
         expected1=[-0.299,-0.3, 0.201,-0.3, 0.701,-0.3, -0.299,0.2, 0.201,0.2, 0.701,0.2, -0.299,0.7, 0.201,0.7, 0.701,0.7]
-        for i in xrange(18):
+        for i in range(18):
             self.assertAlmostEqual(expected1[i],m3.getCoords().getIJ(0,i),13);
             pass
         #
@@ -2466,7 +2469,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         f4=MEDCouplingFieldDouble.MergeFields([f1,f2,f3]);
         self.assertEqual(15,f4.getMesh().getNumberOfCells());
         expected1=[2.,2.,2.,2.,2.,2.,2.,2.,2.,2., 5.,5.,5.,5.,5.,5.,5.,5.,5.,5., 7.,7.,7.,7.,7.,7.,7.,7.,7.,7.]
-        for i in xrange(30):
+        for i in range(30):
             self.assertAlmostEqual(expected1[i],f4.getIJ(0,i),13);
             pass
         #
@@ -2480,7 +2483,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(8,b.getNumberOfTuples());
         self.assertEqual(1,b.getNumberOfComponents());
         expected1=[0,2,4,5,6,9,10,11]
-        for i in xrange(8):
+        for i in range(8):
             self.assertEqual(expected1[i],b.getIJ(0,i));
             pass
         pass
@@ -2496,14 +2499,14 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(7,b.getNumberOfTuples());
         self.assertEqual(1,b.getNumberOfComponents());
         expected1=[0,1,3,5,7,8,18]
-        for i in xrange(7):
+        for i in range(7):
             self.assertEqual(expected1[i],b.getIJ(0,i));
             pass
         b=DataArrayInt.BuildUnion([a,c]);
         self.assertEqual(7,b.getNumberOfTuples());
         self.assertEqual(1,b.getNumberOfComponents());
         expected1=[0,1,3,5,7,8,18]
-        for i in xrange(7):
+        for i in range(7):
             self.assertEqual(expected1[i],b.getIJ(0,i));
             pass
         pass
@@ -2519,14 +2522,14 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(2,b.getNumberOfTuples());
         self.assertEqual(1,b.getNumberOfComponents());
         expected1=[3,8]
-        for i in xrange(2):
+        for i in range(2):
             self.assertEqual(expected1[i],b.getIJ(0,i));
             pass
         b=DataArrayInt.BuildIntersection([a,c]);
         self.assertEqual(2,b.getNumberOfTuples());
         self.assertEqual(1,b.getNumberOfComponents());
         expected1=[3,8]
-        for i in xrange(2):
+        for i in range(2):
             self.assertEqual(expected1[i],b.getIJ(0,i));
             pass
         pass
@@ -2539,7 +2542,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(6,b.getNumberOfTuples());
         self.assertEqual(1,b.getNumberOfComponents());
         expected1=[2,3,1,0,2,6]
-        for i in xrange(6):
+        for i in range(6):
             self.assertEqual(expected1[i],b.getIJ(0,i));
             pass
         pass
@@ -2558,7 +2561,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertTrue(b.getInfoOnComponent(0)=="toto");
         self.assertTrue(b.getInfoOnComponent(1)=="tata");
         expected1=[5.1,15.1,3.1,13.1,1.1,11.1,7.1,17.1,6.1,16.1]
-        for i in xrange(10):
+        for i in range(10):
             self.assertAlmostEqual(expected1[i],b.getIJ(0,i),14);
             pass
         arr4=[4,-1,0,6,5]
@@ -2577,7 +2580,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertTrue(d.getInfoOnComponent(0)=="toto");
         self.assertTrue(d.getInfoOnComponent(1)=="tata");
         expected2=[5,15,3,13,1,11,7,17,6,16]
-        for i in xrange(10):
+        for i in range(10):
             self.assertEqual(expected2[i],d.getIJ(0,i));
             pass
         self.assertRaises(InterpKernelException,c.selectByTupleIdSafe,arr4);
@@ -2643,7 +2646,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(13,da1.getNumberOfTuples());
         #
         expected1=[-1.,0.,0.,1.,1.,0.,0.,-1.,0.707106781186548,0.707106781186548,0.,-1.,0.,1.,1.,0.,0.,1.,1.,0.,-1.,0.,0.,1.,1.,0.];
-        for i in xrange(26):
+        for i in range(26):
             self.assertAlmostEqual(expected1[i],da1.getIJ(0,i),14);
             pass
         pass
@@ -2721,7 +2724,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         #self.assertRaises(InterpKernelException,f2.__idiv__,f1) # mem leaks
         self.assertTrue(f1.isEqual(f3,1e-10,1e-10));
         expected1=[-0.5, 0.0, 0.0, 0.33333333333333331, 0.25, 0.0, 0.0, -0.20000000000000001, 0.117851130197758, 0.117851130197758, 0.0, -0.14285714285714285, 0.0, 0.125, 0.1111111111111111, 0.0, 0.0, 0.10000000000000001, 0.090909090909090912, 0.0, -0.083333333333333329, 0.0, 0.0, 0.076923076923076927, 0.071428571428571425, 0.0]
-        for i in xrange(26):
+        for i in range(26):
             self.assertAlmostEqual(expected1[i],f3.getIJ(0,i),10);
             pass
         pass
@@ -2738,14 +2741,14 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(12,da1.getNbOfElems());
         self.assertEqual(4,da1.getNumberOfComponents());
         self.assertEqual(3,da1.getNumberOfTuples());
-        for i in xrange(12):
+        for i in range(12):
             self.assertEqual(i,da1.getIJ(0,i));
         #
         da1.rearrange(6);
         self.assertEqual(12,da1.getNbOfElems());
         self.assertEqual(6,da1.getNumberOfComponents());
         self.assertEqual(2,da1.getNumberOfTuples());
-        for i in xrange(12):
+        for i in range(12):
             self.assertEqual(i,da1.getIJ(0,i));
         #
         self.assertRaises(InterpKernelException,da1.rearrange,7);
@@ -2754,14 +2757,14 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(12,da1.getNbOfElems());
         self.assertEqual(12,da1.getNumberOfComponents());
         self.assertEqual(1,da1.getNumberOfTuples());
-        for i in xrange(12):
+        for i in range(12):
             self.assertEqual(i,da1.getIJ(0,i));
         #
         da1.rearrange(3);
         self.assertEqual(12,da1.getNbOfElems());
         self.assertEqual(3,da1.getNumberOfComponents());
         self.assertEqual(4,da1.getNumberOfTuples());
-        for i in xrange(12):
+        for i in range(12):
             self.assertEqual(i,da1.getIJ(0,i));
         #double
         da2=da1.convertToDblArr();
@@ -2774,14 +2777,14 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(12,da2.getNbOfElems());
         self.assertEqual(4,da2.getNumberOfComponents());
         self.assertEqual(3,da2.getNumberOfTuples());
-        for i in xrange(12):
+        for i in range(12):
             self.assertAlmostEqual(float(i),da2.getIJ(0,i),14);
         #
         da2.rearrange(6);
         self.assertEqual(12,da2.getNbOfElems());
         self.assertEqual(6,da2.getNumberOfComponents());
         self.assertEqual(2,da2.getNumberOfTuples());
-        for i in xrange(12):
+        for i in range(12):
             self.assertAlmostEqual(float(i),da2.getIJ(0,i),14);
         #
         self.assertRaises(InterpKernelException,da2.rearrange,7);
@@ -2791,14 +2794,14 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(12,da2.getNbOfElems());
         self.assertEqual(1,da2.getNumberOfComponents());
         self.assertEqual(12,da2.getNumberOfTuples());
-        for i in xrange(12):
+        for i in range(12):
             self.assertAlmostEqual(float(i),da2.getIJ(0,i),14);
         #
         da2.rearrange(3);
         self.assertEqual(12,da2.getNbOfElems());
         self.assertEqual(3,da2.getNumberOfComponents());
         self.assertEqual(4,da2.getNumberOfTuples());
-        for i in xrange(12):
+        for i in range(12):
             self.assertAlmostEqual(float(i),da2.getIJ(0,i),14);
         pass
 
@@ -2867,7 +2870,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         d.sort()
         self.assertEqual(5,d.getNumberOfTuples());
         self.assertEqual(1,d.getNumberOfComponents());
-        for i in xrange(5):
+        for i in range(5):
             self.assertAlmostEqual(float(expect3[i]),d.getIJ(i,0),14);
             pass
         pass
@@ -2896,7 +2899,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(2,b.getNumberOfComponents());
         self.assertEqual(3,b.getNumberOfTuples());
         expected1=[0.36666666666666665,-0.13333333333333333,-0.05,-0.05,0.45,0.45];
-        for i in xrange(6):
+        for i in range(6):
             self.assertAlmostEqual(expected1[i],b.getIJ(0,i),14);
             pass
         pass
@@ -2910,7 +2913,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(1,b.getNumberOfComponents());
         self.assertEqual(3,b.getNumberOfTuples());
         expected1=[0.125,0.25,0.25];
-        for i in xrange(3):
+        for i in range(3):
             self.assertAlmostEqual(expected1[i],b.getIJ(0,i),14);
             pass
         pass
@@ -2925,7 +2928,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase):
         self.assertEqual(3,b.getArray().getNumberOfComponents());
         self.assertEqual(3,b.getArray().getNumberOfTuples());
         expected1=[0.,0.,-1.,0.,0.,-1.,0.,0.,-1.];
-        for i in xrange(9):
+        for i in range(9):
             self.assertAlmostEqual(expected1[i],b.getArray().getIJ(0,i),14);
             pass
         pass
index e5d75e5c354f50e40c0d40dad5d7e0371f16001d..f3675188521523101a07a4898f1395c47be37611 100644 (file)
 #
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
+from __future__ import division
+# Uncomment to be coherent with Python 3
+# from __future__ import unicode_literals
+
+import sys
+if sys.version_info.major < 3:
+  def next(it):
+    return it.next()
 
 from MEDCoupling import *
 import unittest
@@ -130,7 +138,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         da.iota(7)
         da.rearrange(5)
         da.setInfoOnComponent(0,"X [m]") ; da.setInfoOnComponent(1,"Y [km]") ; da.setInfoOnComponent(2,"Y [m]")
-        da.setInfoOnComponent(3,"Z [W]") ; da.setInfoOnComponent(4,"ZZ [km]") ;
+        da.setInfoOnComponent(3,"Z [W]") ; da.setInfoOnComponent(4,"ZZ [km]") ; 
         da[:,2]=3
         self.assertEqual([7, 8, 3, 10, 11, 12, 13, 3, 15, 16, 17, 18, 3, 20, 21, 22, 23, 3, 25, 26],da.getValues())
         da.rearrange(1) ; da.iota(7) ; da.rearrange(5)
@@ -186,7 +194,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         da.iota(7)
         da.rearrange(5)
         da.setInfoOnComponent(0,"X [m]") ; da.setInfoOnComponent(1,"Y [km]") ; da.setInfoOnComponent(2,"Y [m]")
-        da.setInfoOnComponent(3,"Z [W]") ; da.setInfoOnComponent(4,"ZZ [km]") ;
+        da.setInfoOnComponent(3,"Z [W]") ; da.setInfoOnComponent(4,"ZZ [km]") ; 
         da[:,2]=3.
         self.assertEqual([7., 8., 3., 10., 11., 12., 13., 3., 15., 16., 17., 18., 3., 20., 21., 22., 23., 3., 25., 26.],da.getValues())
         da.rearrange(1) ; da.iota(7) ; da.rearrange(5)
@@ -271,7 +279,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         da-=8
         st2=da.getHiddenCppPointer()
         self.assertEqual(st1,st2)
-        self.assertEqual(range(12),da.getValues())
+        self.assertEqual(list(range(12)), da.getValues())
         da+=da1
         st2=da.getHiddenCppPointer()
         self.assertEqual(st1,st2)
@@ -347,7 +355,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         da-=8
         st2=da.getHiddenCppPointer()
         self.assertEqual(st1,st2)
-        self.assertEqual(range(12),da.getValues())
+        self.assertEqual(list(range(12)), da.getValues())
         da+=da1
         st2=da.getHiddenCppPointer()
         self.assertEqual(st1,st2)
@@ -492,7 +500,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         it2=da2.__iter__()
         i=0
         for it in da:
-            pt=it2.next()
+            pt = next(it2)
             it[:]=pt
             pass
         self.assertTrue(da.isEqual(da2))
@@ -550,7 +558,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         it2=da2.__iter__()
         i=0
         for it in da:
-            pt=it2.next()
+            pt = next(it2)
             it[:]=pt
             pass
         self.assertTrue(da.isEqual(da2,1e-12))
@@ -616,12 +624,12 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
 
     def testDAIAggregateMulti1(self):
         a=DataArrayInt.New()
-        a.setValues(range(4),2,2)
+        a.setValues(list(range(4)), 2, 2)
         a.setName("aa")
         b=DataArrayInt.New()
-        b.setValues(range(6),3,2)
+        b.setValues(list(range(6)), 3, 2)
         c=DataArrayInt.Aggregate([a,b])
-        self.assertEqual(range(4)+range(6),c.getValues())
+        self.assertEqual(list(range(4)) + list(range(6)), c.getValues())
         self.assertEqual("aa",c.getName())
         self.assertEqual(5,c.getNumberOfTuples())
         self.assertEqual(2,c.getNumberOfComponents())
@@ -682,7 +690,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         self.assertEqual(0,m.getMeshDimension());
         types1=m.getAllGeoTypes();
         self.assertEqual([NORM_POINT1],types1);
-        for i in xrange(4):
+        for i in range(4):
             conn=m.getNodeIdsOfCell(i);
             self.assertEqual([i],conn);
             self.assertTrue(NORM_POINT1==m.getTypeOfCell(i));
@@ -741,7 +749,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         hs=dt.getHotSpotsTime();
         self.assertEqual(6,len(hs));
         expected1=[0.2,0.7,1.2,1.35,1.7,2.7]
-        for i in xrange(6):
+        for i in range(6):
             self.assertAlmostEqual(expected1[i],hs[i],12);
             pass
         meshId,arrId,arrIdInField,fieldId=dt.getIdsOnTimeRight(0.2);
@@ -805,7 +813,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         da2=da.checkAndPreparePermutation();
         self.assertEqual(8,da2.getNumberOfTuples());
         self.assertEqual(1,da2.getNumberOfComponents());
-        for i in xrange(8):
+        for i in range(8):
             self.assertEqual(expect1[i],da2.getIJ(i,0));
             pass
         #
@@ -940,12 +948,12 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         self.assertEqual(1,da2.getNumberOfComponents());
         self.assertEqual(5,da2.getNumberOfTuples());
         expected1=[32.,34.,36.,38.,40.]
-        for i in xrange(5):
+        for i in range(5):
             self.assertAlmostEqual(expected1[i],da2.getIJ(0,i),12);
             pass
         da2=da.applyFunc(1,"y+z");
         expected2=[12.,14.,16.,18.,20.]
-        for i in xrange(5):
+        for i in range(5):
             self.assertAlmostEqual(expected2[i],da2.getIJ(0,i),12);
             pass
         #
@@ -954,7 +962,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         f1.applyFuncCompo(1,"y+z");
         self.assertEqual(1,f1.getNumberOfComponents());
         self.assertEqual(5,f1.getNumberOfTuples());
-        for i in xrange(5):
+        for i in range(5):
             self.assertAlmostEqual(expected1[i],f1.getArray().getIJ(0,i),12);
             pass
         #
@@ -978,7 +986,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         vs[1]="y";
         da2=da.applyFuncNamedCompo(1,vs,"y+z");
         expected1=[32.,34.,36.,38.,40.]
-        for i in xrange(5):
+        for i in range(5):
             self.assertAlmostEqual(expected1[i],da2.getIJ(0,i),12);
             pass
         self.assertRaises(InterpKernelException, da.applyFuncNamedCompo, 1, ["x","y","z","a"],"x+a")
@@ -988,7 +996,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         f1.applyFuncNamedCompo(1,vs,"y+z");
         self.assertEqual(1,f1.getNumberOfComponents());
         self.assertEqual(5,f1.getNumberOfTuples());
-        for i in xrange(5):
+        for i in range(5):
             self.assertAlmostEqual(expected1[i],f1.getArray().getIJ(0,i),12);
             pass
         pass
@@ -1006,7 +1014,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         self.assertEqual(1,f1.getNumberOfComponents());
         self.assertEqual(9,f1.getNumberOfTuples());
         expected1=[0.2, 0.7, 1.2, 0.7, 1.2, 1.7, 1.2, 1.7, 2.2]
-        for i in xrange(9):
+        for i in range(9):
             self.assertAlmostEqual(expected1[i],f1.getArray().getIJ(0,i),12);
             pass
         pass
@@ -1024,7 +1032,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         self.assertEqual(1,f1.getNumberOfComponents());
         self.assertEqual(9,f1.getNumberOfTuples());
         expected1=[0.2, 0.7, 1.2, 0.7, 1.2, 1.7, 1.2, 1.7, 2.2]
-        for i in xrange(9):
+        for i in range(9):
             self.assertAlmostEqual(expected1[i],f1.getArray().getIJ(0,i),12);
             pass
         pass
@@ -1108,7 +1116,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         self.assertEqual(3,resToTest.getNumberOfComponents());
         self.assertEqual(2,resToTest.getNumberOfTuples());
         expected1=[0.6,0.6,0.6, 0.6,0.6,0.6]
-        for i in xrange(6):
+        for i in range(6):
             self.assertAlmostEqual(expected1[i],resToTest.getIJ(0,i),14);
             pass
         #
@@ -1148,7 +1156,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
                    2.32,1.52,0.0, 1.6,1.32,0.0, 3.52,1.26,0.0,#TRI6
                    2.6,1.6,0.0, 2.4,1.8,0.0, 2.4,1.2,0.0, 2.3,1.46,0.0,#QUAD4
                    2.32,2.68,0.0, 2.6,2.42,0.0, 2.8,2.46,0.0, 2.74,2.28,0.0 ];#QUAD8
-        for i in xrange(39):
+        for i in range(39):
             self.assertAlmostEqual(expected2[i],resToTest.getIJ(0,i),14);
             pass
         #
@@ -1210,7 +1218,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         self.assertEqual(3,resToTest.getNumberOfComponents());
         self.assertEqual(8,resToTest.getNumberOfTuples());#2+3+4+4 gauss points for resp TRI3,TRI6,QUAD4,QUAD8
         expected3=[1.312,3.15,1.02, 0.56,3.3,0.6, 2.18,1.1,0.2, 1.18,1.54,0.98, 1.56,0.3,3.6, 1.613,0.801,4.374, 2.6,2.4,2.3, 2.31232,2.3933985,1.553255]
-        for i in xrange(24):
+        for i in range(24):
             self.assertAlmostEqual(expected3[i],resToTest.getIJ(0,i),14);
             pass
         #
@@ -1237,7 +1245,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         loc=[2.27,1.3]
         locs=f.getValueOnMulti(loc);
         expected1=[6.0921164547752236, 7.1921164547752232, 8.2921164547752255]
-        for i in xrange(3):
+        for i in range(3):
             self.assertAlmostEqual(expected1[i],locs.getIJ(0,i),12);
             pass
         pass
@@ -1263,7 +1271,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         loc=[0.64637931739890486, -0.16185896817550552, 0.22678966365273748]
         locs=f.getValueOnMulti(loc);
         expected1=[10.0844021968047]
-        for i in xrange(1):
+        for i in range(1):
             self.assertAlmostEqual(expected1[i],locs.getIJ(0,i),12);
             pass
         pass
@@ -1282,7 +1290,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         locs=f.getValueOnMulti(loc);
         self.assertEqual(5,locs.getNumberOfTuples());
         self.assertEqual(3,locs.getNumberOfComponents());
-        for j in xrange(15):
+        for j in range(15):
             self.assertAlmostEqual(values1[j],locs.getIJ(0,j),12);
             pass
         # Testing ON_NODES
@@ -1301,7 +1309,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         locs=f.getValueOnMulti(loc3);
         self.assertEqual(4,locs.getNumberOfTuples());
         self.assertEqual(3,locs.getNumberOfComponents());
-        for i in xrange(12):
+        for i in range(12):
             self.assertAlmostEqual(expected2[i],locs.getIJ(0,i),12);
             pass
         #
@@ -1315,7 +1323,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         self.assertEqual(7,d2.getNumberOfTuples());
         self.assertEqual(1,d2.getNumberOfComponents());
         expected1=[0,1,3,4,7,8,9]
-        for i in xrange(7):
+        for i in range(7):
             self.assertEqual(expected1[i],d2.getIJ(0,i));
             pass
         d.rearrange(2);
@@ -1327,7 +1335,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         self.assertEqual(5,d3.getNumberOfTuples());
         self.assertEqual(1,d3.getNumberOfComponents());
         expected2=[0,1,4,8,9]
-        for i in xrange(5):
+        for i in range(5):
             self.assertEqual(expected2[i],d3.getIJ(0,i));
             pass
         pass
@@ -1340,7 +1348,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         d.computeOffsets();
         self.assertEqual(6,d.getNumberOfTuples());
         self.assertEqual(1,d.getNumberOfComponents());
-        for i in xrange(6):
+        for i in range(6):
             self.assertEqual(expected1[i],d.getIJ(0,i));
             pass
         pass
@@ -1366,7 +1374,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         self.assertEqual(1,bary.getNumberOfTuples());
         self.assertEqual(3,bary.getNumberOfComponents());
         expected1=[0.,0.,1.]
-        for i in xrange(3):
+        for i in range(3):
             self.assertAlmostEqual(expected1[i],bary.getIJ(0,i),12);
             pass
         d1=DataArrayInt.New();
@@ -1378,7 +1386,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         expected4=[[1,2,3,4,5,0],[7,6,11,10,9,8],[1,7,8,2],[2,8,9,3],[3,9,10,4],[4,10,11,5],[5,11,6,0],[0,6,7,1]];
         expected2=[NORM_POLYGON, NORM_POLYGON, NORM_QUAD4, NORM_QUAD4, NORM_QUAD4, NORM_QUAD4, NORM_QUAD4, NORM_QUAD4];
         expected3=[6,6,4,4,4,4,4,4]
-        for i in xrange(8):
+        for i in range(8):
             self.assertTrue(m2.getTypeOfCell(i)==expected2[i]);
             v=m2.getNodeIdsOfCell(i);
             self.assertTrue(len(v)==expected3[i]);
@@ -1519,7 +1527,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         d1.transformWithIndArr(d);
         self.assertEqual(12,d1.getNumberOfTuples());
         self.assertEqual(1,d1.getNumberOfComponents());
-        for i in xrange(12):
+        for i in range(12):
             self.assertEqual(expected[i],d1.getIJ(i,0));
             pass
         #
@@ -1527,7 +1535,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         d1.transformWithIndArr(tab1)
         self.assertEqual(12,d1.getNumberOfTuples());
         self.assertEqual(1,d1.getNumberOfComponents());
-        for i in xrange(12):
+        for i in range(12):
             self.assertEqual(expected[i],d1.getIJ(i,0));
             pass
         pass
@@ -1540,7 +1548,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         da2=da.buildPermArrPerLevel();
         self.assertEqual(12,da2.getNumberOfTuples());
         self.assertEqual(1,da2.getNumberOfComponents());
-        for i in xrange(12):
+        for i in range(12):
             self.assertEqual(expected1[i],da2.getIJ(i,0));
             pass
         pass
@@ -1558,17 +1566,17 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         self.assertEqual(4,da2.getNumberOfTuples());
         self.assertEqual(3,da2.getNumberOfComponents());
         expected1=[1,1,8,12,9,9,14,15,14,14,12,14]
-        for i in xrange(12):
+        for i in range(12):
             self.assertEqual(expected1[i],da2.getIJ(0,i));
             pass
         da1.substractEqual(da);
         expected2=[3,5,0,-2,3,5,2,3,6,8,12,12]
-        for i in xrange(12):
+        for i in range(12):
             self.assertEqual(expected2[i],da1.getIJ(0,i));
             pass
         da1.rearrange(1); da1.iota(2); da1.rearrange(3);
         da1.addEqual(da);
-        for i in xrange(12):
+        for i in range(12):
             self.assertEqual(expected1[i],da1.getIJ(0,i));
             pass
         da1.rearrange(1); da1.iota(2); da1.rearrange(3);
@@ -1576,53 +1584,53 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         self.assertEqual(4,da2.getNumberOfTuples());
         self.assertEqual(3,da2.getNumberOfComponents());
         expected3=[-2,-6,16,35,18,14,48,54,40,33,0,13]
-        for i in xrange(12):
+        for i in range(12):
             self.assertEqual(expected3[i],da2.getIJ(0,i));
             pass
         da.divideEqual(da1);
         self.assertEqual(4,da.getNumberOfTuples());
         self.assertEqual(3,da.getNumberOfComponents());
         expected4=[0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]
-        for i in xrange(12):
+        for i in range(12):
             self.assertEqual(expected4[i],da.getIJ(0,i));
             pass
         da.setValues(arr1,4,3);
         da1.multiplyEqual(da);
         self.assertEqual(4,da1.getNumberOfTuples());
         self.assertEqual(3,da1.getNumberOfComponents());
-        for i in xrange(12):
+        for i in range(12):
             self.assertEqual(expected3[i],da1.getIJ(0,i));
             pass
         da1.rearrange(1); da1.iota(2); da1.rearrange(3);
         da2=DataArrayInt.Divide(da,da1);
         self.assertEqual(4,da2.getNumberOfTuples());
         self.assertEqual(3,da2.getNumberOfComponents());
-        for i in xrange(12):
+        for i in range(12):
             self.assertEqual(expected4[i],da2.getIJ(0,i));
             pass
         da1.applyInv(321);
         self.assertEqual(4,da1.getNumberOfTuples());
         self.assertEqual(3,da1.getNumberOfComponents());
         expected5=[160,107,80,64,53,45,40,35,32,29,26,24]
-        for i in xrange(12):
+        for i in range(12):
             self.assertEqual(expected5[i],da1.getIJ(0,i));
             pass
         da1.applyDivideBy(2);
         self.assertEqual(4,da1.getNumberOfTuples());
         self.assertEqual(3,da1.getNumberOfComponents());
         expected6=[80,53,40,32,26,22,20,17,16,14,13,12]
-        for i in xrange(12):
+        for i in range(12):
             self.assertEqual(expected6[i],da1.getIJ(0,i));
             pass
         expected7=[3,4,5,4,5,1,6,3,2,0,6,5]
         da1.applyModulus(7);
-        for i in xrange(12):
+        for i in range(12):
             self.assertEqual(expected7[i],da1.getIJ(0,i));
             pass
         da1.applyLin(1,1);
         expected8=[3,3,3,3,3,1,3,3,0,0,3,3]
         da1.applyRModulus(3);
-        for i in xrange(12):
+        for i in range(12):
             self.assertEqual(expected8[i],da1.getIJ(0,i));
             pass
         pass
@@ -1634,37 +1642,37 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         expected1=[1,32,29,23,41,36]
         self.assertEqual(47,da0.getNumberOfTuples());
         self.assertEqual(1,da0.getNumberOfComponents());
-        for i in xrange(47):
+        for i in range(47):
             self.assertEqual(expected0[i],da0.getIJ(0,i));
             pass
         self.assertEqual(6,da5.getNumberOfTuples());
         self.assertEqual(1,da5.getNumberOfComponents());
-        for i in xrange(6):
+        for i in range(6):
             self.assertEqual(expected1[i],da5.getIJ(0,i));
             pass
         expected2=[0,1,2,3,4,0,5,6,7,4,8,9,1,7,10,11,12,13,14,5,15,16,17,8,18,19,20,10,21,22,23,2,13,24,25,21,16,26,27,12,19,28,29,15,22,30,31,18,36,26,28,30,24,37,32,33,34,35,38,36,39,40,41,42,37,38,43,44,45,46]
         self.assertEqual(70,da1.getNumberOfTuples());
         self.assertEqual(1,da1.getNumberOfComponents());
-        for i in xrange(70):
+        for i in range(70):
             self.assertEqual(expected2[i],da1.getIJ(0,i));
             pass
         expected3=[0,4,8,12,16,20,24,28,32,36,40,44,48,53,58,64,70]
         self.assertEqual(17,da2.getNumberOfTuples());
         self.assertEqual(1,da2.getNumberOfComponents());
-        for i in xrange(17):
+        for i in range(17):
             self.assertEqual(expected3[i],da2.getIJ(0,i));
             pass
         expected4=[0,2,4,6,7,9,11,12,14,16,17,19,20,22,24,25,27,29,30,32,34,35,37,39,40,42,43,45,46,48,49,51,52,53,54,55,56,58,60,62,63,64,65,66,67,68,69,70]
         #expected4=[0,2,4,6,7,9,11,12,14,16,17,19,20,22,24,25,27,29,30,32,34,35,37,39,40,42,43,45,46,48,49,51,52,54,56,57,58,59,60,62,63,64,65,66,67,68,69,70];
         self.assertEqual(48,da4.getNumberOfTuples());
         self.assertEqual(1,da4.getNumberOfComponents());
-        for i in xrange(48):
+        for i in range(48):
             self.assertEqual(expected4[i],da4.getIJ(0,i));
             pass
         expected5=[0,1,0,3,0,7,0,1,2,1,4,1,2,3,2,5,2,3,6,3,4,9,4,8,4,5,10,5,9,5,6,11,6,10,6,7,8,7,11,7,8,12,8,9,12,9,10,12,10,11,12,11,13,13,13,13,12,14,13,15,14,15,14,14,14,14,15,15,15,15]
         self.assertEqual(70,da3.getNumberOfTuples());
         self.assertEqual(1,da3.getNumberOfComponents());
-        for i in xrange(70):
+        for i in range(70):
             self.assertEqual(expected5[i],da3.getIJ(0,i));
             pass
         pass
@@ -1678,7 +1686,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         expected1=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,36,37,32,33,34,35,38,39,40,41,42,43,44,45,46]
         self.assertEqual(47,da0.getNumberOfTuples());
         self.assertEqual(1,da0.getNumberOfComponents());
-        for i in xrange(47):
+        for i in range(47):
             self.assertEqual(expected0[i],da0.getIJ(0,i));
             pass
         self.assertEqual(2,da1.getNumberOfTuples());
@@ -1690,7 +1698,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         #
         self.assertEqual(47,da2.getNumberOfTuples());
         self.assertEqual(1,da2.getNumberOfComponents());
-        for i in xrange(47):
+        for i in range(47):
             self.assertEqual(expected1[i],da2.getIJ(0,i));
             pass
         pass
@@ -1741,7 +1749,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         d3=d.transformWithIndArrR(d1);
         self.assertEqual(6,d3.getNumberOfTuples());
         self.assertEqual(1,d3.getNumberOfComponents());
-        for i in xrange(6):
+        for i in range(6):
             self.assertEqual(expected[i],d3.getIJ(i,0));
             pass
         #
@@ -1749,7 +1757,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         d3=d.transformWithIndArrR(tab2)
         self.assertEqual(6,d3.getNumberOfTuples());
         self.assertEqual(1,d3.getNumberOfComponents());
-        for i in xrange(6):
+        for i in range(6):
             self.assertEqual(expected[i],d3.getIJ(i,0));
             pass
         pass
@@ -1769,7 +1777,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         #
         expected1=[1,1,0,0,0,1,1,0,1]
         expected2=[2,1,0,3,2,3,4,1,0]
-        for i in xrange(9):
+        for i in range(9):
             self.assertEqual(expected1[i],e.getIJ(i,0));
             self.assertEqual(expected2[i],f.getIJ(i,0));
             pass
@@ -1888,7 +1896,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         self.assertEqual(11,f.getNumberOfTuples());
         self.assertEqual(1,f.getNumberOfComponents());
         expected1=[0,1,2,6,7,8,9,10,11,12,13]
-        for i in xrange(11):
+        for i in range(11):
             self.assertEqual(expected1[i],f.getIJ(i,0));
             pass
         pass
@@ -1901,7 +1909,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         d.computeOffsetsFull();
         self.assertEqual(7,d.getNumberOfTuples());
         self.assertEqual(1,d.getNumberOfComponents());
-        for i in xrange(7):
+        for i in range(7):
             self.assertEqual(expected1[i],d.getIJ(0,i));
             pass
         pass
@@ -1926,7 +1934,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         self.assertTrue(f1.isEqual(f2,1e-12,1e-12));
         #
         pass
-
+    
     def testGetDistributionOfTypes1(self):
         m=MEDCouplingDataForTest.build2DTargetMesh_1();
         tab1=[2,0,1,3,4]
@@ -2076,7 +2084,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         m3.setName(m.getName());
         self.assertTrue(m.isEqual(m3,1e-12));
         pass
-
+    
     def testChangeUnderlyingMeshWithCMesh1(self):
         mesh=MEDCouplingCMesh.New();
         coordsX=DataArrayDouble.New();
@@ -2154,7 +2162,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         self.assertEqual(0,c.getNbOfElems());
         self.assertEqual(1,cI.getNbOfElems());
         self.assertEqual([0],cI.getValues())
-
+        
         array12=[0.]*(6*5)
         da.setValues(array12,6,5) #bad NumberOfComponents
         self.assertRaises(InterpKernelException, da.findCommonTuples, 1e-2);
@@ -2188,14 +2196,14 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         expected1=[2.301,1.2,1.3,0.8]
         dv=da.getDifferentValues(1e-2);
         self.assertEqual(4,dv.getNbOfElems());
-        for i in xrange(4):
+        for i in range(4):
             self.assertAlmostEqual(expected1[i],dv.getIJ(i,0),14);
             pass
         #
         dv=da.getDifferentValues(2e-1);
         expected2=[2.301,1.3,0.8]
         self.assertEqual(3,dv.getNbOfElems());
-        for i in xrange(3):
+        for i in range(3):
             self.assertAlmostEqual(expected2[i],dv.getIJ(i,0),14);
             pass
         pass
@@ -2222,12 +2230,12 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         a.setValues(arr,6,1);
         self.assertEqual(2,a.back());
         a.reverse();
-        for i in xrange(6):
+        for i in range(6):
             self.assertEqual(arr[5-i],a.getIJ(i,0));
             pass
         a.setValues(arr[:-1],5,1);
         a.reverse();
-        for i in xrange(5):
+        for i in range(5):
             self.assertEqual(arr[4-i],a.getIJ(i,0));
             pass
         #
@@ -2235,13 +2243,13 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         b=DataArrayDouble.New();
         b.setValues(arr2,6,1);
         b.reverse();
-        for i in xrange(6):
+        for i in range(6):
             self.assertAlmostEqual(arr2[5-i],b.getIJ(i,0),14);
             pass
         b.setValues(arr2[:5],5,1);
         self.assertAlmostEqual(9.,b.back(),14)
         b.reverse();
-        for i in xrange(5):
+        for i in range(5):
             self.assertAlmostEqual(arr2[4-i],b.getIJ(i,0),14);
             pass
         pass
@@ -2288,6 +2296,44 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         self.assertEqual(expected6,conn.getValues());
         pass
 
+    def testIntersect2DMeshesTmp1(self):
+        m1c=MEDCouplingCMesh.New();
+        coordsX=DataArrayDouble.New();
+        arrX=[ -1., 1., 2., 4. ]
+        coordsX.setValues(arrX,4,1);
+        m1c.setCoordsAt(0,coordsX);
+        coordsY=DataArrayDouble.New();
+        arrY=[ -2., 2., 4., 8. ]
+        coordsY.setValues(arrY,4,1);
+        m1c.setCoordsAt(1,coordsY);
+        m1=m1c.buildUnstructured()
+        m1bis=m1.buildPartOfMySelf([3,4,5],False)
+        m2=m1.deepCopy()
+        m2=m2.buildPartOfMySelf([0,1,2],False)
+        m2.translate([0.5,0.5])
+        #
+        m3,d1,d2=MEDCouplingUMesh.Intersect2DMeshes(m1bis,m2,1e-10)
+        expected1=[0,0,1,1,1,2,2,2]
+        expected2=[0,-1,0,1,-1,1,2,-1]
+        self.assertEqual(8,d1.getNumberOfTuples());
+        self.assertEqual(8,d2.getNumberOfTuples());
+        self.assertEqual(8,m3.getNumberOfCells());
+        self.assertEqual(22,m3.getNumberOfNodes());
+        self.assertEqual(2,m3.getSpaceDimension());
+        self.assertEqual(expected1,d1.getValues());
+        self.assertEqual(expected2,d2.getValues());
+        expected3=[5,17,1,16,12,5,16,0,4,5,17,12,5,18,1,17,13,5,19,2,18,13,5,17,5,6,19,13,5,20,2,19,14,5,21,3,20,14,5,19,6,7,21,14]
+        expected4=[0,5,12,17,22,28,33,38,44]
+        expected5=[-1.0,2.0,1.0,2.0,2.0,2.0,4.0,2.0,-1.0,4.0,1.0,4.0,2.0,4.0,4.0,4.0,-0.5,-1.5,1.5,-1.5,2.5,-1.5,4.5,-1.5,-0.5,2.5,1.5,2.5,2.5,2.5,4.5,2.5,-0.5,2.0,1.0,2.5,1.5,2.0,2.0,2.5,2.5,2.0,4.0,2.5]
+        self.assertEqual(44,m3.getNodalConnectivity().getNumberOfTuples());
+        self.assertEqual(9,m3.getNodalConnectivityIndex().getNumberOfTuples());
+        self.assertEqual(expected3,m3.getNodalConnectivity().getValues());
+        self.assertEqual(expected4,m3.getNodalConnectivityIndex().getValues());
+        for i in range(44):
+            self.assertAlmostEqual(expected5[i],m3.getCoords().getIJ(0,i),12);
+            pass
+        pass
+
     def testFindNodesOnLine1(self):
         mesh=MEDCouplingDataForTest.build2DTargetMesh_1();
         pt=[-0.3,-0.3]
@@ -2308,12 +2354,113 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         self.assertEqual(expected1,res.getValues());
         pass
 
+    def testIntersect2DMeshesTmp2(self):
+        m1c=MEDCouplingCMesh.New();
+        coordsX1=DataArrayDouble.New();
+        arrX1=[ 0., 1., 1.5, 2. ]
+        coordsX1.setValues(arrX1,4,1);
+        m1c.setCoordsAt(0,coordsX1);
+        coordsY1=DataArrayDouble.New();
+        arrY1=[ 0., 1.5, 3.]
+        coordsY1.setValues(arrY1,3,1);
+        m1c.setCoordsAt(1,coordsY1);
+        m1=m1c.buildUnstructured();
+        m2c=MEDCouplingCMesh.New();
+        coordsX2=DataArrayDouble.New();
+        arrX2=[ 0., 1., 2. ]
+        coordsX2.setValues(arrX2,3,1);
+        m2c.setCoordsAt(0,coordsX2);
+        coordsY2=DataArrayDouble.New();
+        arrY2=[ 0., 1., 3.]
+        coordsY2.setValues(arrY2,3,1);
+        m2c.setCoordsAt(1,coordsY2);
+        m2=m2c.buildUnstructured();
+        #
+        m3,d1,d2=MEDCouplingUMesh.Intersect2DMeshes(m1,m2,1e-10)
+        #
+        expected1=[0,0,1,1,2,2,3,4,5]
+        expected2=[0,2,1,3,1,3,2,3,3]
+        self.assertEqual(9,d1.getNumberOfTuples());
+        self.assertEqual(9,d2.getNumberOfTuples());
+        self.assertEqual(9,m3.getNumberOfCells());
+        self.assertEqual(22,m3.getNumberOfNodes());
+        self.assertEqual(2,m3.getSpaceDimension());
+        self.assertEqual(expected1,d1.getValues());
+        self.assertEqual(expected2,d2.getValues());
+        expected3=[5,16,13,12,15,5,15,4,5,16,5,21,2,13,16,5,16,5,6,21,5,17,14,2,21,5,21,6,7,17,5,4,18,19,5,5,5,19,10,6,5,6,10,20,7]
+        expected4=[0,5,10,15,20,25,30,35,40,45]
+        expected5=[0.0,0.0,1.0,0.0,1.5,0.0,2.0,0.0,0.0,1.5,1.0,1.5,1.5,1.5,2.0,1.5,0.0,3.0,1.0,3.0,1.5,3.0,2.0,3.0,0.0,0.0,1.0,0.0,2.0,0.0,0.0,1.0,1.0,1.0,2.0,1.0,0.0,3.0,1.0,3.0,2.0,3.0,1.5,1.0]
+        self.assertEqual(45,m3.getNodalConnectivity().getNumberOfTuples());
+        self.assertEqual(10,m3.getNodalConnectivityIndex().getNumberOfTuples());
+        self.assertEqual(expected3,m3.getNodalConnectivity().getValues());
+        self.assertEqual(expected4,m3.getNodalConnectivityIndex().getValues());
+        for i in range(44):
+            self.assertAlmostEqual(expected5[i],m3.getCoords().getIJ(0,i),12);
+            pass
+        pass
+    
     def testBuildPartOfMySelfSafe1(self):
         mesh=MEDCouplingDataForTest.build2DTargetMesh_1()
         self.assertRaises(InterpKernelException,mesh.buildPartOfMySelf,[0,-1,4,2],True)
         self.assertRaises(InterpKernelException,mesh.buildPartOfMySelf,[0,4,5,4],True)
         pass
 
+    def testIntersect2DMeshesTmp3(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];
+        m1=MEDCouplingUMesh.New();
+        m1.setMeshDimension(2);
+        m1.allocateCells(8);
+        m1.insertNextCell(NORM_TRI6,6,m1Conn[0:6]);
+        m1.insertNextCell(NORM_QUAD8,8,m1Conn[6:14]);
+        m1.insertNextCell(NORM_TRI6,6,m1Conn[14:20]);
+        m1.insertNextCell(NORM_QUAD8,8,m1Conn[20:28]);
+        m1.insertNextCell(NORM_TRI6,6,m1Conn[28:34]);
+        m1.insertNextCell(NORM_QUAD8,8,m1Conn[34:42]);
+        m1.insertNextCell(NORM_TRI6,6,m1Conn[42:48]);
+        m1.insertNextCell(NORM_QUAD8,8,m1Conn[48:56]);
+        m1.finishInsertingCells();
+        myCoords1=DataArrayDouble.New();
+        myCoords1.setValues(m1Coords,25,2);
+        m1.setCoords(myCoords1);
+        #
+        m2Coords=[0.,0.,1.1,0.,1.1,1.,0.,1.,1.7,0.,1.7,1.,-1.1,1.,-1.1,0.,-1.7,0.,-1.7,1.,-1.7,-1,-1.1,-1.,0.,-1.,1.1,-1,1.7,-1.]
+        m2Conn=[0,3,2,1, 1,2,5,4, 7,6,3,0, 8,9,6,7, 7,0,12,11, 8,7,11,10, 0,1,13,12, 1,4,14,13]
+        m2=MEDCouplingUMesh.New();
+        m2.setMeshDimension(2);
+        m2.allocateCells(8);
+        for i in range(8):
+            m2.insertNextCell(NORM_QUAD4,4,m2Conn[4*i:4*(i+1)])
+            pass
+        m2.finishInsertingCells();
+        myCoords2=DataArrayDouble.New();
+        myCoords2.setValues(m2Coords,15,2);
+        m2.setCoords(myCoords2);
+        #
+        m3,d1,d2=MEDCouplingUMesh.Intersect2DMeshes(m1,m2,1e-10)
+        m3.unPolyze()
+        #
+        expected1=[0,1,1,1,2,3,3,3,4,5,5,5,6,7,7,7]
+        expected2=[0,0,1,-1,2,2,3,-1,4,4,5,-1,6,6,7,-1]
+        self.assertEqual(16,d1.getNumberOfTuples());
+        self.assertEqual(16,d2.getNumberOfTuples());
+        self.assertEqual(16,m3.getNumberOfCells());
+        self.assertEqual(104,m3.getNumberOfNodes());
+        self.assertEqual(2,m3.getSpaceDimension());
+        self.assertEqual(expected1,d1.getValues());
+        self.assertEqual(expected2,d2.getValues());
+        expected3=[6,28,1,25,44,45,46,8,26,1,28,27,47,48,49,50,8,40,2,26,27,51,52,53,54,8,28,4,40,27,55,56,57,58,6,28,25,5,59,60,61,8,28,5,32,31,62,63,64,65,8,32,6,41,31,66,67,68,69,8,41,4,28,31,70,71,72,73,6,25,37,5,74,75,76,8,32,5,37,36,77,78,79,80,8,42,6,32,36,81,82,83,84,8,37,8,42,36,85,86,87,88,6,1,37,25,89,90,91,8,37,1,26,38,92,93,94,95,8,26,2,43,38,96,97,98,99,8,43,8,37,38,100,101,102,103]
+        expected4=[0,7,16,25,34,41,50,59,68,75,84,93,102,109,118,127,136]
+        expected5=[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.7071067811865476,0.7071067811865476,1.0606601717798214,1.0606601717798214,0.,0.5,0.,1.25,-0.7071067811865476,0.7071067811865476,-1.0606601717798214,1.0606601717798214,-0.5,0.,-1.25,0.,-0.7071067811865476,-0.7071067811865476,-1.0606601717798214,-1.0606601717798214,0.,-0.5,0.,-1.25,0.7071067811865476,-0.7071067811865476,1.0606601717798214,-1.0606601717798214,0.,0.,1.1,0.,1.1,1.,0.,1.,1.7,0.,1.7,1.,-1.1,1.,-1.1,0.,-1.7,0.,-1.7,1.,-1.7,-1.,-1.1,-1.,0.,-1.,1.1,-1.,1.7,-1.,1.118033988749895,1.,-1.118033988749895,1.,-1.118033988749895,-1.,1.118033988749895,-1.,0.7071067811865477,0.7071067811865476,0.5,0.,0.,0.5,1.05,0.,0.7071067811865475,0.7071067811865477,0.55,1.,1.1,0.5,1.4012585384440737,0.535233134659635,1.3,0.,1.1,0.5,1.1090169943749475,1.,0.,1.25,0.6123724356957946,1.369306393762915,1.1090169943749475,1.,0.55,1.,0.,0.5,-0.5,0.,-0.7071067811865477,0.7071067811865476,-0.7071067811865475,0.7071067811865477,-1.05,0.,-1.1,0.5,-0.55,1.,-1.3,0.,-1.4012585384440737,0.5352331346596344,-1.1090169943749475,1.,-1.1,0.5,-0.6123724356957941,1.3693063937629155,0.,1.25,-0.55,1.,-1.1090169943749475,1.,0.,-0.5,-0.7071067811865475,-0.7071067811865477,-0.5,0.,-1.05,0.,-0.7071067811865478,-0.7071067811865475,-0.55,-1.,-1.1,-0.5,-1.4012585384440734,-0.5352331346596354,-1.3,0.,-1.1,-0.5,-1.1090169943749475,-1.,0.,-1.25,-0.6123724356957945,-1.369306393762915,-1.1090169943749475,-1.,-0.55,-1.,0.7071067811865475,-0.7071067811865477,0.,-0.5,0.5,0.,0.7071067811865477,-0.7071067811865475,1.05,0.,1.1,-0.5,0.55,-1.,1.3,0.,1.4012585384440737,-0.535233134659635,1.1090169943749475,-1.,1.1,-0.5,0.6123724356957946,-1.369306393762915,0.,-1.25,0.55,-1.,1.1090169943749475,-1.0]
+        self.assertEqual(136,m3.getNodalConnectivity().getNumberOfTuples());
+        self.assertEqual(17,m3.getNodalConnectivityIndex().getNumberOfTuples());
+        self.assertEqual(expected3,m3.getNodalConnectivity().getValues());
+        self.assertEqual(expected4,m3.getNodalConnectivityIndex().getValues());
+        for i in range(208):
+            self.assertAlmostEqual(expected5[i],m3.getCoords().getIJ(0,i),12);
+            pass
+        pass
+
     def testUMeshTessellate2D1(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];
@@ -2349,7 +2496,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         expected3=[5,0,3,25,26,1,5,3,4,27,28,2,1,26,25,5,5,29,30,3,0,5,6,31,32,4,3,30,29,5,5,5,0,7,33,34,5,6,5,34,33,7,8,35,36,5,0,1,37,38,7,5,1,2,39,40,8,7,38,37]
         expected4=[0,6,15,21,30,36,45,51,60]
         expected5=[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.7071067811865476,0.7071067811865476,1.0606601717798214,1.0606601717798214,0.,0.5,0.,1.25,-0.7071067811865476,0.7071067811865476,-1.0606601717798214,1.0606601717798214,-0.5,0.,-1.25,0.,-0.7071067811865476,-0.7071067811865476,-1.0606601717798214,-1.0606601717798214,0.,-0.5,0.,-1.25,0.7071067811865476,-0.7071067811865476,1.0606601717798214,-1.0606601717798214,0.479425538604203,0.8775825618903728,0.8414709848078964,0.54030230586814,0.7191383079063044,1.3163738428355591,1.2622064772118446,0.8104534588022099,-0.877582561890373,0.4794255386042027,-0.5403023058681399,0.8414709848078964,-1.3163738428355596,0.7191383079063038,-0.8104534588022098,1.2622064772118446,-0.4794255386042031,-0.8775825618903728,-0.8414709848078965,-0.5403023058681399,-0.7191383079063045,-1.3163738428355591,-1.2622064772118449,-0.8104534588022098,0.8775825618903729,-0.47942553860420295,0.54030230586814,-0.8414709848078964,1.3163738428355594,-0.7191383079063043,0.8104534588022099,-1.2622064772118446]
-        for i in xrange(82):
+        for i in range(82):
             self.assertAlmostEqual(expected5[i],m12.getCoords().getIJ(0,i),12);
             pass
         self.assertEqual(60,m12.getNodalConnectivity().getNumberOfTuples());
@@ -2370,12 +2517,68 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
 
         myCoords = DataArrayDouble.New(mcoords, 3, 2)
         m1.setCoords(myCoords)
-
+        
         m2 = m1.deepCopy()
         m2.tessellate2D(0.1)
         # If the following raises, the test will fail automatically:
         m2.checkConsistency(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];
+        m1=MEDCouplingUMesh.New();
+        m1.setMeshDimension(2);
+        m1.allocateCells(8);
+        m1.insertNextCell(NORM_TRI6,6,m1Conn[0:6]);
+        m1.insertNextCell(NORM_QUAD8,8,m1Conn[6:14]);
+        m1.insertNextCell(NORM_TRI6,6,m1Conn[14:20]);
+        m1.insertNextCell(NORM_QUAD8,8,m1Conn[20:28]);
+        m1.insertNextCell(NORM_TRI6,6,m1Conn[28:34]);
+        m1.insertNextCell(NORM_QUAD8,8,m1Conn[34:42]);
+        m1.insertNextCell(NORM_TRI6,6,m1Conn[42:48]);
+        m1.insertNextCell(NORM_QUAD8,8,m1Conn[48:56]);
+        m1.finishInsertingCells();
+        myCoords1=DataArrayDouble.New();
+        myCoords1.setValues(m1Coords,25,2);
+        m1.setCoords(myCoords1);
+        #
+        m2Coords=[0.,0.,1.1,0.,1.1,1.,0.,1.,1.7,0.,1.7,1.,-1.1,1.,-1.1,0.,-1.7,0.,-1.7,1.,-1.7,-1,-1.1,-1.,0.,-1.,1.1,-1,1.7,-1.]
+        m2Conn=[0,3,2,1, 1,2,5,4, 7,6,3,0, 8,9,6,7, 7,0,12,11, 8,7,11,10, 0,1,13,12, 1,4,14,13]
+        m2=MEDCouplingUMesh.New();
+        m2.setMeshDimension(2);
+        m2.allocateCells(8);
+        for i in range(8):
+            m2.insertNextCell(NORM_QUAD4,4,m2Conn[4*i:4*(i+1)])
+            pass
+        m2.finishInsertingCells();
+        myCoords2=DataArrayDouble.New();
+        myCoords2.setValues(m2Coords,15,2);
+        m2.setCoords(myCoords2);
+        #
+        m3,d1,d2=MEDCouplingUMesh.Intersect2DMeshes(m2,m1,1e-10)
+        m3.unPolyze()
+        #
+        expected1=[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
+        expected2=[0,1,1,-1,2,3,3,-1,4,5,5,-1,6,7,7,-1]
+        self.assertEqual(16,d1.getNumberOfTuples());
+        self.assertEqual(16,d2.getNumberOfTuples());
+        self.assertEqual(16,m3.getNumberOfCells());
+        self.assertEqual(104,m3.getNumberOfNodes());
+        self.assertEqual(2,m3.getSpaceDimension());
+        self.assertEqual(expected1,d1.getValues());
+        self.assertEqual(expected2,d2.getValues());
+        expected3=[6,16,15,18,44,45,46,8,18,2,1,16,47,48,49,50,8,17,1,2,40,51,52,53,54,8,40,5,4,17,55,56,57,58,6,18,15,20,59,60,61,8,20,7,6,18,62,63,64,65,8,41,6,7,21,66,67,68,69,8,21,8,9,41,70,71,72,73,6,20,15,22,74,75,76,8,22,11,7,20,77,78,79,80,8,21,7,11,42,81,82,83,84,8,42,10,8,21,85,86,87,88,6,22,15,16,89,90,91,8,16,1,13,22,92,93,94,95,8,43,13,1,17,96,97,98,99,8,17,4,14,43,100,101,102,103]
+        expected4=[0,7,16,25,34,41,50,59,68,75,84,93,102,109,118,127,136]
+        expected5=[0.,0.,1.1, 0.,1.1,1.,0.,1.,1.7,0.,1.7,1.,-1.1,1.,-1.1,0.,-1.7,0.,-1.7,1.,-1.7,-1.,-1.1,-1.,0.,-1.,1.1,-1.,1.7,-1.,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.7071067811865476,0.7071067811865476,1.0606601717798214,1.0606601717798214,0.,0.5,0.,1.25,-0.7071067811865476,0.7071067811865476,-1.0606601717798214,1.0606601717798214,-0.5,0.,-1.25,0.,-0.7071067811865476,-0.7071067811865476,-1.0606601717798214,-1.0606601717798214,0.,-0.5,0.,-1.25,0.7071067811865476,-0.7071067811865476,1.0606601717798214,-1.0606601717798214,1.1180339887498951,1.,-1.1180339887498951,1.,-1.1180339887498951,-1.,1.1180339887498951,-1.,0.5,0.,0.,0.5,0.7071067811865477,0.7071067811865476,0.55,1.,1.1,0.5,1.05,0.,0.7071067811865477,0.7071067811865475,1.3,0.,1.1,0.5,1.1090169943749475,1.,1.4012585384440737,0.535233134659635,1.4090169943749475,1.,1.7,0.5,1.6,0.,1.4012585384440737,0.535233134659635,0.,0.5,-0.5,0.,-0.7071067811865477,0.7071067811865476,-1.05,0.,-1.1,0.5,-0.55,1.,-0.7071067811865478,0.7071067811865475,-1.1090169943749475,1.,-1.1,0.5,-1.3,0.,-1.4012585384440737,0.5352331346596344,-1.6,0.,-1.7,0.5,-1.4090169943749475,1.,-1.4012585384440737,0.5352331346596344,-0.5,0.,0.,-0.5,-0.7071067811865475,-0.7071067811865477,-0.55,-1.,-1.1,-0.5,-1.05,0.,-0.7071067811865475,-0.7071067811865477,-1.3,0.,-1.1,-0.5,-1.1090169943749475,-1.,-1.4012585384440734,-0.5352331346596354,-1.4090169943749475,-1.,-1.7,-0.5,-1.6,0.,-1.4012585384440732,-0.5352331346596354,0.,-0.5,0.5,0.,0.7071067811865475,-0.7071067811865477,1.05,0.,1.1,-0.5,0.55,-1.,0.7071067811865475,-0.7071067811865477,1.1090169943749475,-1.,1.1,-0.5,1.3,0.,1.4012585384440737,-0.535233134659635,1.6,0.,1.7,-0.5,1.4090169943749475,-1.,1.4012585384440737,-0.535233134659635]
+        self.assertEqual(136,m3.getNodalConnectivity().getNumberOfTuples());
+        self.assertEqual(17,m3.getNodalConnectivityIndex().getNumberOfTuples());
+        self.assertEqual(expected3,m3.getNodalConnectivity().getValues());
+        self.assertEqual(expected4,m3.getNodalConnectivityIndex().getValues());
+        for i in range(208):
+            self.assertAlmostEqual(expected5[i],m3.getCoords().getIJ(0,i),12);
+            pass
+        pass
+
     def testGetCellIdsCrossingPlane1(self):
         mesh3D,mesh2D=MEDCouplingDataForTest.build3DExtrudedUMesh_1();
         vec=[-0.07,1.,0.07]
@@ -2406,7 +2609,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         self.assertEqual(expected1,ids.getValues());
         self.assertEqual(expected2,slice1.getNodalConnectivity().getValues());
         self.assertEqual(expected3,slice1.getNodalConnectivityIndex().getValues());
-        for i in xrange(171):
+        for i in range(171):
             self.assertAlmostEqual(expected4[i],slice1.getCoords().getIJ(0,i),12);
             pass
         # 2nd slice based on already existing nodes of mesh3D.
@@ -2426,7 +2629,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         self.assertEqual(expected1,ids.getValues());
         self.assertEqual(expected5,slice1.getNodalConnectivity().getValues());
         self.assertEqual(expected6,slice1.getNodalConnectivityIndex().getValues());
-        for i in xrange(180):
+        for i in range(180):
             self.assertAlmostEqual(expected7[i],slice1.getCoords().getIJ(0,i),12);
             pass
         # 3rd slice based on shared face of mesh3D.
@@ -2447,7 +2650,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         self.assertEqual(expected8,ids.getValues());
         self.assertEqual(expected9,slice1.getNodalConnectivity().getValues());
         self.assertEqual(expected10,slice1.getNodalConnectivityIndex().getValues());
-        for i in xrange(135):
+        for i in range(135):
             self.assertAlmostEqual(expected11[i],slice1.getCoords().getIJ(0,i),12);
             pass
         pass
@@ -2472,7 +2675,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         self.assertEqual(expected1,ids.getValues());
         self.assertEqual(expected2,slice1.getNodalConnectivity().getValues());
         self.assertEqual(expected3,slice1.getNodalConnectivityIndex().getValues());
-        for i in xrange(171):
+        for i in range(171):
             self.assertAlmostEqual(expected4[i],slice1.getCoords().getIJ(0,i),12);
             pass
         #
@@ -2493,7 +2696,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         self.assertEqual(expected5,ids.getValues());
         self.assertEqual(expected6,slice1.getNodalConnectivity().getValues());
         self.assertEqual(expected7,slice1.getNodalConnectivityIndex().getValues());
-        for i in xrange(135):
+        for i in range(135):
             self.assertAlmostEqual(expected8[i],slice1.getCoords().getIJ(0,i),12);
             pass
         pass
@@ -2518,7 +2721,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         expected1=[1.,11.,2.,12.,4.,14.,6.,16.,7.,17.]
         self.assertEqual(5,tmp.getNumberOfTuples());
         self.assertEqual(2,tmp.getNumberOfComponents());
-        for i in xrange(10):
+        for i in range(10):
             self.assertAlmostEqual(expected1[i],tmp.getIJ(0,i),14);
             pass
         p=[(0,2),(0,2),(5,6)]
@@ -2526,7 +2729,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         expected2=[1.,11.,2.,12.,1.,11.,2.,12.,6.,16.]
         self.assertEqual(5,tmp.getNumberOfTuples());
         self.assertEqual(2,tmp.getNumberOfComponents());
-        for i in xrange(10):
+        for i in range(10):
             self.assertAlmostEqual(expected2[i],tmp.getIJ(0,i),14);
             pass
         p=[(0,2),(-1,2),(5,6)]
@@ -2540,7 +2743,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         dac=da.deepCopy();
         dac.setContigPartOfSelectedValuesSlice(1,da2,2,4,1);
         expected3=[1.,11.,0.,30.,11.,41.,4.,14.,5.,15.,6.,16.,7.,17.]
-        for i in xrange(14):
+        for i in range(14):
             self.assertAlmostEqual(expected3[i],dac.getIJ(0,i),14);
             pass
         #
@@ -2550,7 +2753,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         self.assertRaises(InterpKernelException,dac.setContigPartOfSelectedValuesSlice,3,da2,5,0,1);
         dac.setContigPartOfSelectedValuesSlice(3,da2,1,5,1);
         expected4=[1.,11.,2.,12.,3.,13.,9.,39.,0.,30.,11.,41.,12.,42.]
-        for i in xrange(14):
+        for i in range(14):
             self.assertAlmostEqual(expected4[i],dac.getIJ(0,i),14);
             pass
         #
@@ -2560,7 +2763,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         ids.setIJ(0,0,2); ids.setIJ(1,0,0); ids.setIJ(2,0,4);
         dac.setContigPartOfSelectedValues(2,da2,ids);
         expected5=[1.,11.,2.,12.,0.,30.,8.,38.,12.,42.,6.,16.,7.,17.]
-        for i in xrange(14):
+        for i in range(14):
             self.assertAlmostEqual(expected5[i],dac.getIJ(0,i),14);
             pass
         #
@@ -2576,7 +2779,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         dac=da.deepCopy();
         dac.setContigPartOfSelectedValues(4,da2,ids);
         expected6=[1.,11.,2.,12.,3.,13.,4.,14.,0.,30.,0.,30.,9.,39.]
-        for i in xrange(14):
+        for i in range(14):
             self.assertAlmostEqual(expected6[i],dac.getIJ(0,i),14);
             pass
         pass
@@ -2601,7 +2804,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         expected1=[1,11,2,12,4,14,6,16,7,17]
         self.assertEqual(5,tmp.getNumberOfTuples());
         self.assertEqual(2,tmp.getNumberOfComponents());
-        for i in xrange(10):
+        for i in range(10):
             self.assertEqual(expected1[i],tmp.getIJ(0,i));
             pass
         p=[(0,2),(0,2),(5,6)]
@@ -2609,7 +2812,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         expected2=[1,11,2,12,1,11,2,12,6,16]
         self.assertEqual(5,tmp.getNumberOfTuples());
         self.assertEqual(2,tmp.getNumberOfComponents());
-        for i in xrange(10):
+        for i in range(10):
             self.assertEqual(expected2[i],tmp.getIJ(0,i));
             pass
         p=[(0,2),(-1,2),(5,6)]
@@ -2623,7 +2826,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         dac=da.deepCopy();
         dac.setContigPartOfSelectedValuesSlice(1,da2,2,4,1);
         expected3=[1,11,0,30,11,41,4,14,5,15,6,16,7,17]
-        for i in xrange(14):
+        for i in range(14):
             self.assertEqual(expected3[i],dac.getIJ(0,i));
             pass
         #
@@ -2633,7 +2836,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         self.assertRaises(InterpKernelException,dac.setContigPartOfSelectedValuesSlice,3,da2,5,0,1);
         dac.setContigPartOfSelectedValuesSlice(3,da2,1,5,1);
         expected4=[1,11,2,12,3,13,9,39,0,30,11,41,12,42]
-        for i in xrange(14):
+        for i in range(14):
             self.assertEqual(expected4[i],dac.getIJ(0,i));
             pass
         #
@@ -2643,7 +2846,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         ids.setIJ(0,0,2); ids.setIJ(1,0,0); ids.setIJ(2,0,4);
         dac.setContigPartOfSelectedValues(2,da2,ids);
         expected5=[1,11,2,12,0,30,8,38,12,42,6,16,7,17]
-        for i in xrange(14):
+        for i in range(14):
             self.assertEqual(expected5[i],dac.getIJ(0,i));
             pass
         #
@@ -2659,7 +2862,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         dac=da.deepCopy();
         dac.setContigPartOfSelectedValues(4,da2,ids);
         expected6=[1,11,2,12,3,13,4,14,0,30,0,30,9,39]
-        for i in xrange(14):
+        for i in range(14):
             self.assertEqual(expected6[i],dac.getIJ(0,i));
             pass
         pass
@@ -2704,7 +2907,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         m1.setCoords(myCoords1);
         #
         vec1=[0.,0.,1.]
-        for i in xrange(18):
+        for i in range(18):
             vec2=[3.*cos(pi/9.*i),3.*sin(pi/9.*i)];
             m1Cpy=m1.deepCopy();
             m1Cpy.translate(vec2);
@@ -2723,13 +2926,13 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         d2=d1.convertToIntArr();
         #
         d1.abs();
-        for i in xrange(12):
+        for i in range(12):
             self.assertAlmostEqual(expected1[i],d1.getIJ(0,i),14);
             pass
         #
         expected2=[2,3,5,6,7,8,9,10,11,12,13,15]
         d2.abs();
-        for i in xrange(12):
+        for i in range(12):
             self.assertEqual(expected2[i],d2.getIJ(0,i));
             pass
         #
@@ -2758,7 +2961,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         self.assertEqual(5,arr1.getNumberOfTuples());
         self.assertEqual(3,arr1.getNumberOfComponents());
         expected1=[5.7,57.,570.,6.5,65.,650.,5.,50.,500.,8.,80.,800.,7.,70.,700.]
-        for i in xrange(15):
+        for i in range(15):
             self.assertAlmostEqual(expected1[i],arr1.getIJ(0,i),14);
             pass
         pass
@@ -2778,7 +2981,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         m1c.setCoordsAt(0,coordsX);
         expected1=[[0,1],[1,2],[2,3],[3,4]]
         self.assertEqual(4,m1c.getNumberOfCells())
-        for i in xrange(m1c.getNumberOfCells()):
+        for i in range(m1c.getNumberOfCells()):
             self.assertEqual(expected1[i],m1c.getNodeIdsOfCell(i))
             pass
         # test in 2D
@@ -2786,7 +2989,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         self.assertEqual(12,m1c.getNumberOfCells())
         self.assertEqual(20,m1c.getNumberOfNodes())
         expected2=[[0,1,6,5],[1,2,7,6],[2,3,8,7],[3,4,9,8],[5,6,11,10],[6,7,12,11],[7,8,13,12],[8,9,14,13],[10,11,16,15],[11,12,17,16],[12,13,18,17],[13,14,19,18]]
-        for i in xrange(m1c.getNumberOfCells()):
+        for i in range(m1c.getNumberOfCells()):
             self.assertEqual(expected2[i],m1c.getNodeIdsOfCell(i))
             pass
         # test in 3D
@@ -2795,11 +2998,11 @@ class MEDCouplingBasicsTest3(unittest.TestCase):
         self.assertEqual(60,m1c.getNumberOfNodes())
         expected3=[[0,1,6,5,20,21,26,25],[1,2,7,6,21,22,27,26],[2,3,8,7,22,23,28,27],[3,4,9,8,23,24,29,28],[5,6,11,10,25,26,31,30],[6,7,12,11,26,27,32,31],[7,8,13,12,27,28,33,32],[8,9,14,13,28,29,34,33],[10,11,16,15,30,31,36,35],[11,12,17,16,31,32,37,36],[12,13,18,17,32,33,38,37],[13,14,19,18,33,34,39,38],[20,21,26,25,40,41,46,45],[21,22,27,26,41,42,47,46],[22,23,28,27,42,43,48,47],[23,24,29,28,43,44,49,48],[25,26,31,30,45,46,51,50],[26,27,32,31,46,47,52,51],[27,28,33,32,47,48,53,52],[28,29,34,33,48,49,54,53],[30,31,36,35,50,51,56,55],[31,32,37,36,51,52,57,56],[32,33,38,37,52,53,58,57],[33,34,39,38,53,54,59,58]]
         self.assertEqual(24,m1c.getNumberOfCells())
-        for i in xrange(m1c.getNumberOfCells()):
+        for i in range(m1c.getNumberOfCells()):
             self.assertEqual(expected3[i],m1c.getNodeIdsOfCell(i))
             pass
         pass
-
+          
     pass
 
 if __name__ == '__main__':
index 5bb897cea8e94dd98c244a62f4e10488c445a75b..9e38b003b76bf764cfadeff771d0d6d558a61276 100644 (file)
@@ -17,6 +17,9 @@
 #
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
+from __future__ import division
+# Uncomment to be coherent with Python 3
+# from __future__ import unicode_literals
 
 from MEDCoupling import *
 import unittest
@@ -44,23 +47,23 @@ def checkFreeMemory(size):
             dic['free'] = tmp
             dic['used'] = int(dic['total']) - int(dic['free'])
             ret = dic['free'] > size
-    #TODO: extend this method for Windows OS
+    #TODO: extend this method for Windows OS            
     return ret
 
 
 class MEDCouplingBasicsTest4(unittest.TestCase):
     def testSwigDADOp4(self):
-        da=DataArrayDouble.New(range(6,30),12,2)
+        da = DataArrayDouble.New(list(range(6, 30)), 12, 2)
         self.assertEqual(12,da.getNumberOfTuples());
         self.assertEqual(2,da.getNumberOfComponents());
-        for i in xrange(24):
+        for i in range(24):
             self.assertAlmostEqual(da.getIJ(0,i),float(i+6),13)
             pass
         # operator transpose
         da.transpose()
         self.assertEqual(2,da.getNumberOfTuples());
         self.assertEqual(12,da.getNumberOfComponents());
-        for i in xrange(24):
+        for i in range(24):
             self.assertAlmostEqual(da.getIJ(0,i),float(i+6),13)
             pass
         da.transpose()
@@ -68,13 +71,13 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         da2=DataArrayDouble.New(12,1)
         da2.iota(0.)
         dabis=-da
-        for i in xrange(24):
+        for i in range(24):
             self.assertAlmostEqual(dabis.getIJ(0,i),-float(i+6),13)
             pass
         # operator+=
         da+=da2
         expected1=[6.,7.,9.,10.,12.,13.,15.,16.,18.,19.,21.,22.,24.,25.,27.,28.,30.,31.,33.,34.,36.,37.,39.,40.]
-        for i in xrange(24):
+        for i in range(24):
             self.assertAlmostEqual(da.getIJ(0,i),expected1[i],13)
             pass
         da=-dabis
@@ -82,7 +85,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         expected2=[106.,108.,108.,110.,110.,112.,112.,114.,114.,116.,116.,118.,118.,120.,120.,122.,122.,124.,124.,126.,126.,128.,128.,130.]
         self.assertEqual(12,da.getNumberOfTuples());
         self.assertEqual(2,da.getNumberOfComponents());
-        for i in xrange(24):
+        for i in range(24):
             self.assertAlmostEqual(da.getIJ(0,i),expected2[i],13)
             pass
         for pos,elt in enumerate(dabis):
@@ -95,12 +98,12 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
             self.assertAlmostEqual(li[0],100.,13) ; self.assertAlmostEqual(li[1],101.,13)
             pass
         # operator-=
-        da=DataArrayDouble.New(range(6,30),12,2)
-        da2=DataArrayDouble.New(range(12),12,1)
+        da = DataArrayDouble.New(list(range(6, 30)), 12, 2)
+        da2 = DataArrayDouble.New(list(range(12)), 12, 1)
         dabis=-da
         da-=da2
         expected1=[6.,7.,7.,8.,8.,9.,9.,10.,10.,11.,11.,12.,12.,13.,13.,14.,14.,15.,15.,16.,16.,17.,17.,18.]
-        for i in xrange(24):
+        for i in range(24):
             self.assertAlmostEqual(da.getIJ(0,i),expected1[i],13)
             pass
         da=-dabis
@@ -108,7 +111,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         expected2=[-94.,-94.,-92.,-92.,-90.,-90.,-88.,-88.,-86.,-86.,-84.,-84.,-82.,-82.,-80.,-80.,-78.,-78.,-76.,-76.,-74.,-74.,-72.,-72.]
         self.assertEqual(12,da.getNumberOfTuples());
         self.assertEqual(2,da.getNumberOfComponents());
-        for i in xrange(24):
+        for i in range(24):
             self.assertAlmostEqual(da.getIJ(0,i),expected2[i],13)
             pass
         for pos,elt in enumerate(dabis):
@@ -117,16 +120,16 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         self.assertEqual(12,da.getNumberOfTuples());
         self.assertEqual(2,da.getNumberOfComponents());
         expected3=[-88.,-87.,-84.,-83.,-80.,-79.,-76.,-75.,-72.,-71.,-68.,-67.,-64.,-63.,-60.,-59.,-56.,-55.,-52.,-51.,-48.,-47.,-44.,-43.]
-        for i in xrange(24):
+        for i in range(24):
             self.assertAlmostEqual(da.getIJ(0,i),expected3[i],13)
             pass
         # operator*=
-        da=DataArrayDouble.New(range(6,30),12,2)
-        da2=DataArrayDouble.New(range(12),12,1)
+        da = DataArrayDouble.New(list(range(6, 30)), 12, 2)
+        da2 = DataArrayDouble.New(list(range(12)), 12, 1)
         dabis=-da
         da*=da2
         expected1=[0.,0.,8.,9.,20.,22.,36.,39.,56.,60.,80.,85.,108.,114.,140.,147.,176.,184.,216.,225.,260.,270.,308.,319.]
-        for i in xrange(24):
+        for i in range(24):
             self.assertAlmostEqual(da.getIJ(0,i),expected1[i],13)
             pass
         da=-dabis
@@ -134,7 +137,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         expected2=[600.,707.,800.,909.,1000.,1111.,1200.,1313.,1400.,1515.,1600.,1717.,1800.,1919.,2000.,2121.,2200.,2323.,2400.,2525.,2600.,2727.,2800.,2929.]
         self.assertEqual(12,da.getNumberOfTuples());
         self.assertEqual(2,da.getNumberOfComponents());
-        for i in xrange(24):
+        for i in range(24):
             self.assertAlmostEqual(da.getIJ(0,i),expected2[i],13)
             pass
         for pos,elt in enumerate(dabis):
@@ -143,16 +146,16 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         self.assertEqual(12,da.getNumberOfTuples());
         self.assertEqual(2,da.getNumberOfComponents());
         expected3=[-3600.,-4949.,-6400.,-8181.,-10000.,-12221.,-14400.,-17069.,-19600.,-22725.,-25600.,-29189.,-32400.,-36461.,-40000.,-44541.,-48400.,-53429.,-57600.,-63125.,-67600.,-73629.,-78400.,-84941.0]
-        for i in xrange(24):
+        for i in range(24):
             self.assertAlmostEqual(da.getIJ(0,i),expected3[i],13)
             pass
         # operator/=
-        da=DataArrayDouble.New(range(6,30),12,2)
-        da2=DataArrayDouble.New(range(1,13),12,1)
+        da = DataArrayDouble.New(list(range(6, 30)), 12, 2)
+        da2 = DataArrayDouble.New(list(range(1, 13)), 12, 1)
         dabis=-da
         da/=da2
         expected1=[6.0,7.0,4.0,4.5,3.3333333333333335,3.6666666666666665,3.0,3.25,2.8,3.0,2.6666666666666665,2.8333333333333335,2.5714285714285716,2.7142857142857144,2.5,2.625,2.4444444444444446,2.5555555555555554,2.4,2.5,2.3636363636363638,2.4545454545454546,2.3333333333333335,2.4166666666666665]
-        for i in xrange(24):
+        for i in range(24):
             self.assertAlmostEqual(da.getIJ(0,i),expected1[i],13)
             pass
         da=-dabis
@@ -160,7 +163,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         expected2=[0.06,0.06930693069306931,0.08,0.0891089108910891,0.1,0.10891089108910891,0.12,0.12871287128712872,0.14,0.1485148514851485,0.16,0.16831683168316833,0.18,0.18811881188118812,0.2,0.2079207920792079,0.22,0.22772277227722773,0.24,0.24752475247524752,0.26,0.26732673267326734,0.28,0.2871287128712871]
         self.assertEqual(12,da.getNumberOfTuples());
         self.assertEqual(2,da.getNumberOfComponents());
-        for i in xrange(24):
+        for i in range(24):
             self.assertAlmostEqual(da.getIJ(0,i),expected2[i],13)
             pass
         for pos,elt in enumerate(dabis):
@@ -169,23 +172,23 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         self.assertEqual(12,da.getNumberOfTuples());
         self.assertEqual(2,da.getNumberOfComponents());
         expected3=[-0.01, -0.009900990099009901, -0.01, -0.009900990099009901, -0.01, -0.009900990099009901, -0.01, -0.009900990099009901, -0.01, -0.009900990099009901, -0.01, -0.009900990099009901, -0.01, -0.009900990099009901, -0.01, -0.009900990099009901, -0.01, -0.009900990099009901, -0.01, -0.009900990099009901, -0.01, -0.009900990099009901, -0.01, -0.0099009900990099]
-        for i in xrange(24):
+        for i in range(24):
             self.assertAlmostEqual(da.getIJ(0,i),expected3[i],13)
             pass
         pass
 
     def testSwigDAIOp4(self):
-        da=DataArrayInt.New(range(6,30),12,2)
+        da = DataArrayInt.New(list(range(6, 30)), 12, 2)
         self.assertEqual(12,da.getNumberOfTuples());
         self.assertEqual(2,da.getNumberOfComponents());
-        for i in xrange(24):
+        for i in range(24):
             self.assertEqual(da.getIJ(0,i),i+6)
             pass
         # operator transpose
         da.transpose()
         self.assertEqual(2,da.getNumberOfTuples());
         self.assertEqual(12,da.getNumberOfComponents());
-        for i in xrange(24):
+        for i in range(24):
             self.assertEqual(da.getIJ(0,i),i+6)
             pass
         da.transpose()
@@ -193,13 +196,13 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         da2=DataArrayInt.New(12,1)
         da2.iota(0)
         dabis=-da
-        for i in xrange(24):
+        for i in range(24):
             self.assertEqual(dabis.getIJ(0,i),-(i+6))
             pass
         # operator+=
         da+=da2
         expected1=[6,7,9,10,12,13,15,16,18,19,21,22,24,25,27,28,30,31,33,34,36,37,39,40]
-        for i in xrange(24):
+        for i in range(24):
             self.assertEqual(da.getIJ(0,i),expected1[i])
             pass
         da=-dabis
@@ -207,7 +210,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         expected2=[106,108,108,110,110,112,112,114,114,116,116,118,118,120,120,122,122,124,124,126,126,128,128,130]
         self.assertEqual(12,da.getNumberOfTuples());
         self.assertEqual(2,da.getNumberOfComponents());
-        for i in xrange(24):
+        for i in range(24):
             self.assertEqual(da.getIJ(0,i),expected2[i])
             pass
         for pos,elt in enumerate(dabis):
@@ -220,12 +223,12 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
             self.assertEqual(li[0],100) ; self.assertEqual(li[1],101)
             pass
         # operator-=
-        da=DataArrayInt.New(range(6,30),12,2)
-        da2=DataArrayInt.New(range(12),12,1)
+        da = DataArrayInt.New(list(range(6, 30)), 12, 2)
+        da2 = DataArrayInt.New(list(range(12)), 12, 1)
         dabis=-da
         da-=da2
         expected1=[6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18]
-        for i in xrange(24):
+        for i in range(24):
             self.assertEqual(da.getIJ(0,i),expected1[i])
             pass
         da=-dabis
@@ -233,7 +236,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         expected2=[-94,-94,-92,-92,-90,-90,-88,-88,-86,-86,-84,-84,-82,-82,-80,-80,-78,-78,-76,-76,-74,-74,-72,-72]
         self.assertEqual(12,da.getNumberOfTuples());
         self.assertEqual(2,da.getNumberOfComponents());
-        for i in xrange(24):
+        for i in range(24):
             self.assertEqual(da.getIJ(0,i),expected2[i])
             pass
         for pos,elt in enumerate(dabis):
@@ -242,16 +245,16 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         self.assertEqual(12,da.getNumberOfTuples());
         self.assertEqual(2,da.getNumberOfComponents());
         expected3=[-88,-87,-84,-83,-80,-79,-76,-75,-72,-71,-68,-67,-64,-63,-60,-59,-56,-55,-52,-51,-48,-47,-44,-43]
-        for i in xrange(24):
+        for i in range(24):
             self.assertEqual(da.getIJ(0,i),expected3[i])
             pass
         # operator*=
-        da=DataArrayInt.New(range(6,30),12,2)
-        da2=DataArrayInt.New(range(12),12,1)
+        da = DataArrayInt.New(list(range(6, 30)), 12, 2)
+        da2 = DataArrayInt.New(list(range(12)), 12, 1)
         dabis=-da
         da*=da2
         expected1=[0,0,8,9,20,22,36,39,56,60,80,85,108,114,140,147,176,184,216,225,260,270,308,319]
-        for i in xrange(24):
+        for i in range(24):
             self.assertEqual(da.getIJ(0,i),expected1[i])
             pass
         da=-dabis
@@ -259,7 +262,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         expected2=[600,707,800,909,1000,1111,1200,1313,1400,1515,1600,1717,1800,1919,2000,2121,2200,2323,2400,2525,2600,2727,2800,2929]
         self.assertEqual(12,da.getNumberOfTuples());
         self.assertEqual(2,da.getNumberOfComponents());
-        for i in xrange(24):
+        for i in range(24):
             self.assertEqual(da.getIJ(0,i),expected2[i])
             pass
         for pos,elt in enumerate(dabis):
@@ -268,16 +271,16 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         self.assertEqual(12,da.getNumberOfTuples());
         self.assertEqual(2,da.getNumberOfComponents());
         expected3=[-3600,-4949,-6400,-8181,-10000,-12221,-14400,-17069,-19600,-22725,-25600,-29189,-32400,-36461,-40000,-44541,-48400,-53429,-57600,-63125,-67600,-73629,-78400,-84941.0]
-        for i in xrange(24):
+        for i in range(24):
             self.assertEqual(da.getIJ(0,i),expected3[i])
             pass
         # operator/=
-        da=DataArrayInt.New(range(6,30),12,2)
-        da2=DataArrayInt.New(range(1,13),12,1)
+        da = DataArrayInt.New(list(range(6, 30)), 12, 2)
+        da2 = DataArrayInt.New(list(range(1, 13)), 12, 1)
         dabis=-da
         da/=da2
         expected1=[6,7,4,4,3,3,3,3,2,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2]
-        for i in xrange(24):
+        for i in range(24):
             self.assertEqual(da.getIJ(0,i),expected1[i])
             pass
         da=-dabis
@@ -285,7 +288,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         self.assertEqual(12,da.getNumberOfTuples());
         self.assertEqual(2,da.getNumberOfComponents());
         expected2=[3,2,4,3,5,3,6,4,7,5,8,5,9,6,10,7,11,7,12,8,13,9,14,9]
-        for i in xrange(24):
+        for i in range(24):
             self.assertEqual(da.getIJ(0,i),expected2[i])
             pass
         pass
@@ -300,13 +303,13 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         self.assertEqual(4,da3.getNumberOfTuples());
         self.assertEqual(3,da3.getNumberOfComponents());
         expected1=[10.,11.,12.,16.,17.,14.,17.,8.,13.,21.,20.,22.]
-        for i in xrange(12):
+        for i in range(12):
             self.assertAlmostEqual(da3.getIJ(0,i),expected1[i],13)
             pass
         da3=da2+da
         self.assertEqual(4,da3.getNumberOfTuples());
         self.assertEqual(3,da3.getNumberOfComponents());
-        for i in xrange(12):
+        for i in range(12):
             self.assertAlmostEqual(da3.getIJ(0,i),expected1[i],13)
             pass
         # Test new API of classmethod DataArrayDouble.New
@@ -314,31 +317,31 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         da=DataArrayDouble.New(vals)
         self.assertEqual(12,da.getNumberOfTuples());
         self.assertEqual(1,da.getNumberOfComponents());
-        for i in xrange(12):
+        for i in range(12):
             self.assertAlmostEqual(da.getIJ(0,i),vals[i],13)
             pass
         da=DataArrayDouble.New(vals,12)
         self.assertEqual(12,da.getNumberOfTuples());
         self.assertEqual(1,da.getNumberOfComponents());
-        for i in xrange(12):
+        for i in range(12):
             self.assertAlmostEqual(da.getIJ(0,i),vals[i],13)
             pass
         da=DataArrayDouble.New(vals,1,12)
         self.assertEqual(1,da.getNumberOfTuples());
         self.assertEqual(12,da.getNumberOfComponents());
-        for i in xrange(12):
+        for i in range(12):
             self.assertAlmostEqual(da.getIJ(0,i),vals[i],13)
             pass
         da=DataArrayDouble.New(vals,6,2)
         self.assertEqual(6,da.getNumberOfTuples());
         self.assertEqual(2,da.getNumberOfComponents());
-        for i in xrange(12):
+        for i in range(12):
             self.assertAlmostEqual(da.getIJ(0,i),vals[i],13)
             pass
         da=DataArrayDouble.New(vals,4,3)
         self.assertEqual(4,da.getNumberOfTuples());
         self.assertEqual(3,da.getNumberOfComponents());
-        for i in xrange(12):
+        for i in range(12):
             self.assertAlmostEqual(da.getIJ(0,i),vals[i],13)
             pass
         self.assertRaises(InterpKernelException,DataArrayDouble.New,vals,11);
@@ -357,13 +360,13 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         self.assertEqual(4,da3.getNumberOfTuples());
         self.assertEqual(3,da3.getNumberOfComponents());
         expected1=[10,11,12,16,17,14,17,8,13,21,20,22]
-        for i in xrange(12):
+        for i in range(12):
             self.assertEqual(da3.getIJ(0,i),expected1[i])
             pass
         da3=da2+da
         self.assertEqual(4,da3.getNumberOfTuples());
         self.assertEqual(3,da3.getNumberOfComponents());
-        for i in xrange(12):
+        for i in range(12):
             self.assertEqual(da3.getIJ(0,i),expected1[i])
             pass
         da3=da+DataArrayInt.New(da2.getValues())
@@ -372,31 +375,31 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         da=DataArrayDouble.New(vals)
         self.assertEqual(12,da.getNumberOfTuples());
         self.assertEqual(1,da.getNumberOfComponents());
-        for i in xrange(12):
+        for i in range(12):
             self.assertEqual(da.getIJ(0,i),vals[i])
             pass
         da=DataArrayDouble.New(vals,12)
         self.assertEqual(12,da.getNumberOfTuples());
         self.assertEqual(1,da.getNumberOfComponents());
-        for i in xrange(12):
+        for i in range(12):
             self.assertEqual(da.getIJ(0,i),vals[i])
             pass
         da=DataArrayDouble.New(vals,1,12)
         self.assertEqual(1,da.getNumberOfTuples());
         self.assertEqual(12,da.getNumberOfComponents());
-        for i in xrange(12):
+        for i in range(12):
             self.assertEqual(da.getIJ(0,i),vals[i])
             pass
         da=DataArrayDouble.New(vals,6,2)
         self.assertEqual(6,da.getNumberOfTuples());
         self.assertEqual(2,da.getNumberOfComponents());
-        for i in xrange(12):
+        for i in range(12):
             self.assertEqual(da.getIJ(0,i),vals[i])
             pass
         da=DataArrayDouble.New(vals,4,3)
         self.assertEqual(4,da.getNumberOfTuples());
         self.assertEqual(3,da.getNumberOfComponents());
-        for i in xrange(12):
+        for i in range(12):
             self.assertEqual(da.getIJ(0,i),vals[i])
             pass
         self.assertRaises(InterpKernelException,DataArrayDouble.New,vals,11);
@@ -502,7 +505,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         self.assertEqual(8,da2.getNumberOfTuples());
         self.assertEqual(1,da2.getNumberOfComponents());
         expected1=[8,11,12,9,4,5,6,7]
-        for i in xrange(8):
+        for i in range(8):
             self.assertEqual(expected1[i],da2.getIJ(i,0));
             pass
         #
@@ -510,7 +513,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         self.assertTrue(da1==None);
         self.assertEqual(9,da2.getNumberOfTuples());
         self.assertEqual(1,da2.getNumberOfComponents());
-        for i in xrange(9):
+        for i in range(9):
             self.assertEqual(8+i,da2.getIJ(i,0));
             pass
         #
@@ -533,7 +536,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         self.assertEqual(expected2,mesh3D_4.getNodalConnectivity().getValues());
         self.assertEqual(expected3,mesh2D_4.getNodalConnectivity().getValues());
         self.assertEqual(expected4,mesh2D_5.getNodalConnectivity().getValues());
-        for i in xrange(78):
+        for i in range(78):
             self.assertAlmostEqual(expected5[i],mesh3D_4.getCoords().getIJ(0,i),12);
             pass
         #
@@ -555,12 +558,12 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         self.assertEqual(expected6,mesh3D_4.getNodalConnectivity().getValues());
         self.assertEqual(expected7,mesh2D_4.getNodalConnectivity().getValues());
         self.assertEqual(expected8,mesh2D_5.getNodalConnectivity().getValues());
-        for i in xrange(57):
+        for i in range(57):
             self.assertAlmostEqual(expected9[i],mesh3D_4.getCoords().getIJ(0,i),12);
             pass
         #
         pass
-
+    
     def testComputeNeighborsOfCells1(self):
         m=MEDCouplingDataForTest.build2DTargetMesh_1();
         d1,d2=m.computeNeighborsOfCells();
@@ -666,7 +669,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         self.assertTrue(subMesh.isEqual(m5,1e-12))
         self.assertRaises(InterpKernelException,m.buildPartOfMySelf,[1,5],True);
         pass
-
+    
     def testSwigGetItem3(self):
         da=DataArrayInt.New([4,5,6])
         self.assertEqual(5,da[1])
@@ -754,45 +757,45 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         res=d1.getMinMaxPerComponent();
         self.assertTrue(isinstance(res,list))
         self.assertEqual(3,len(res))
-        for i in xrange(3):
+        for i in range(3):
             self.assertTrue(isinstance(res[i],tuple))
             self.assertEqual(2,len(res[i]))
             pass
         expected1=[-0.9,1.3,1.7,2.1,3.,3.]
-        for i in xrange(6):
-            self.assertAlmostEqual(expected1[i],res[i/2][i%2],14)
+        for i in range(6):
+            self.assertAlmostEqual(expected1[i], res[i // 2][i % 2], 14)
             pass
         #
         d1.rearrange(2);
         res=d1.getMinMaxPerComponent();
         self.assertTrue(isinstance(res,list))
         self.assertEqual(2,len(res))
-        for i in xrange(2):
+        for i in range(2):
             self.assertTrue(isinstance(res[i],tuple))
             self.assertEqual(2,len(res[i]))
             pass
         expected2=[1.,3.,-0.9,3.]
-        for i in xrange(4):
-            self.assertAlmostEqual(expected2[i],res[i/2][i%2],14)
+        for i in range(4):
+            self.assertAlmostEqual(expected2[i], res[i // 2][i % 2], 14)
             pass
         #
         d1.rearrange(1);
         res=d1.getMinMaxPerComponent();
         self.assertTrue(isinstance(res,list))
         self.assertEqual(1,len(res))
-        for i in xrange(1):
+        for i in range(1):
             self.assertTrue(isinstance(res[i],tuple))
             self.assertEqual(2,len(res[i]))
             pass
         expected3=[-0.9,3.]
-        for i in xrange(2):
-            self.assertAlmostEqual(expected3[i],res[i/2][i%2],14)
+        for i in range(2):
+            self.assertAlmostEqual(expected3[i], res[i // 2][i % 2], 14)
             pass
         pass
 
     def testDataArrayIntGetHashCode1(self):
-        d1=DataArrayInt.New(range(3545))
-        d2=DataArrayInt.New(range(3545))
+        d1 = DataArrayInt.New(list(range(3545)))
+        d2 = DataArrayInt.New(list(range(3545)))
         self.assertEqual(d2.getHashCode(),d1.getHashCode())
         self.assertEqual(232341068,d1.getHashCode())
         d1[886]=6
@@ -921,14 +924,14 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         d-=2
         d%=7
         pass
-
+        
     def testSwigDAIOp5(self):
         d=DataArrayInt.New([4,5,6,10,3,-1],2,3)
         self.toSeeIfDaIIopsAreOK(d)
         dExp=DataArrayInt.New([2,4,6,0,0,6],2,3)
         self.assertTrue(d.isEqual(dExp));
         pass
-
+    
     def toSeeIfDaDIopsAreOK(self,d):
         d+=5
         d*=6
@@ -950,7 +953,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         #
         m=MEDCouplingUMesh.New("convexhull",2);
         m.allocateCells(331);
-        for i in xrange(331):
+        for i in range(331):
             m.insertNextCell(NORM_POLYGON,conn[connI[i]:connI[i+1]]);
             pass
         m.finishInsertingCells();
@@ -1028,18 +1031,18 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         expected3=[1.,2.,4.,5.,6.,7.]
         self.assertEqual(6,ard1.getNumberOfTuples());
         self.assertEqual(1,ard1.getNumberOfComponents());
-        for i in xrange(6):
+        for i in range(6):
             self.assertAlmostEqual(expected3[i],ard1.getIJ(i,0),12)
             pass
         ard2.sort(False);
         expected4=[7.,6.,5.,4.,2.,1.]
         self.assertEqual(6,ard2.getNumberOfTuples());
         self.assertEqual(1,ard2.getNumberOfComponents());
-        for i in xrange(6):
+        for i in range(6):
             self.assertAlmostEqual(expected4[i],ard2.getIJ(i,0),12)
             pass
         pass
-
+    
     def testPartitionBySpreadZone1(self):
         m=MEDCouplingDataForTest.build2DTargetMesh_1();
         m4=MEDCouplingUMesh.MergeUMeshes([m,m[-3:],m[0:2]]);
@@ -1165,7 +1168,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         pass
 
     def testSwigBugNonRegressionZipDA(self):
-        angles=map(lambda x:pi/3*x,xrange(6))
+        angles = [pi / 3 * x for x in range(6)]
         radius=3
         #
         dad=DataArrayDouble.New(6, 2)
@@ -1348,7 +1351,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         valuesToTest=f.getValueOnMulti(targetPointCoordsX);
         self.assertEqual(40,valuesToTest.getNumberOfTuples());
         self.assertEqual(1,valuesToTest.getNumberOfComponents());
-        for i in xrange(40):
+        for i in range(40):
             self.assertAlmostEqual(targetFieldValsExpected[i],valuesToTest.getIJ(i,0),10)
             pass
         fd=f.getDiscretization()
@@ -1458,15 +1461,15 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         coords=DataArrayDouble([0.,0.,0.,1.,1.,1.,1.,0.,0.,0.5,0.5,1.,1.,0.5,0.5,0.],8,2)
         mQ8=MEDCouplingUMesh("",2) ; mQ8.setCoords(coords)
         mQ8.allocateCells(1)
-        mQ8.insertNextCell(NORM_QUAD8,range(8))
+        mQ8.insertNextCell(NORM_QUAD8, list(range(8)))
         mQ8.finishInsertingCells()
         mQ4=MEDCouplingUMesh("",2) ; mQ4.setCoords(coords)
         mQ4.allocateCells(1)
-        mQ4.insertNextCell(NORM_QUAD4,range(4))
+        mQ4.insertNextCell(NORM_QUAD4, list(range(4)))
         mQ4.finishInsertingCells()
         mT3=MEDCouplingUMesh("",2) ; mT3.setCoords(coords)
         mT3.allocateCells(1)
-        mT3.insertNextCell(NORM_TRI3,range(3))
+        mT3.insertNextCell(NORM_TRI3, list(range(3)))
         mT3.finishInsertingCells()
 
         tr=[[0.,0.],[2.,0.], [0.,2.],[2.,2.],[4.,2.],[6.,2.],[8.,2.],[10.,2.],[12.,2.],[0.,4.],[2.,4.],[4.,4.],[6.,4.],[8.,4.],[10.,4.],[12.,4.],[14.,4.],[16.,4.],[18.,4.],[20.,4.],[22.,4.]]
@@ -1595,9 +1598,45 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         self.assertRaises(InterpKernelException,arr.transformWithIndArr,d)
         pass
 
+    def testIntersect2DMeshesTmp6(self):
+        # coordinates
+        coords=DataArrayDouble.New([2.7554552980815448e-15,45,-45,5.5109105961630896e-15,-31.819805153394636,31.81980515339464,2.8779199779962799e-15,47,2.8166876380389124e-15,46,-47,5.7558399559925599e-15,-33.234018715767732,33.234018715767739,-46,5.6333752760778247e-15],8,2);
+        # connectivity
+        conn=DataArrayInt.New([8,0,3,5,1,4,6,7,2])
+        connI=DataArrayInt.New([0,9]);
+        m1=MEDCouplingUMesh.New("Fixe",2);
+        m1.setCoords(coords);
+        m1.setConnectivity(conn,connI,True);
+        #
+        coords=DataArrayDouble.New([-7.3800475508445391,41.854329503018846,-3.7041190667754655,42.338274668899189,-3.7041190667754655,45.338274668899189,-7.3800475508445382,44.854329503018839,-5.5473631693521845,42.136406608386956,-3.7041190667754655,43.838274668899189,-5.5420833088100014,45.09630208595901,-7.3800475508445382,43.354329503018839,-3.7041190667754651,52.338274668899189,-7.3800475508445382,51.854329503018839,-3.7041190667754655,48.838274668899189,-5.5420833088100014,52.09630208595901,-7.3800475508445382,48.354329503018839],13,2);
+        # connectivity
+        conn=DataArrayInt.New([8,0,1,2,3,4,5,6,7,8,3,2,8,9,6,10,11,12]);
+        connI=DataArrayInt.New([0,9,18]);
+        #
+        m2=MEDCouplingUMesh.New("Mobile",2);
+        m2.setCoords(coords);
+        m2.setConnectivity(conn,connI,True);
+        #
+        m3,d1,d2=MEDCouplingUMesh.Intersect2DMeshes(m1,m2,1e-10);
+        self.assertTrue(d1.isEqual(DataArrayInt([0,0,0,0])));
+        self.assertTrue(d2.isEqual(DataArrayInt([0,1,-1,-1])));
+        self.assertEqual(4,m3.getNumberOfCells());
+        self.assertEqual(4,d1.getNumberOfTuples());
+        self.assertEqual(4,d2.getNumberOfTuples());
+        self.assertEqual(43,m3.getNumberOfNodes());
+        dI,areMerged,newNbOfNodes=m3.mergeNodes(1e-12)
+        self.assertEqual(35,m3.getNumberOfNodes());
+        m3.zipCoords();
+        self.assertEqual(23,m3.getNumberOfNodes());
+        #
+        f=m3.getMeasureField(True);
+        valuesExpected=DataArrayDouble([1.6603638692585716,5.747555728471923,129.68907101754394,7.4162714498559694])
+        self.assertTrue(f.getArray().isEqual(valuesExpected,1e-12))
+        pass
+
     def testDAPushBack(self):
         d=DataArrayDouble(0,1)
-        for i in xrange(8):
+        for i in range(8):
             d.pushBackSilent(i)
             pass
         self.assertEqual(d.getNumberOfTuples(),8)
@@ -1631,7 +1670,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         self.assertTrue(d.isEqual(DataArrayDouble([4.44,5.55,6.66]),1e-12))
         #
         d=DataArrayInt(0,1)
-        for i in xrange(8):
+        for i in range(8):
             d.pushBackSilent(i)
             pass
         self.assertEqual(d.getNumberOfTuples(),8)
@@ -1821,7 +1860,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         #
         m0=MEDCouplingUMesh("m",3) ; m0.allocateCells(0); m0.insertNextCell(NORM_TETRA4,[0,1,2,3]); #Well oriented
         m1=MEDCouplingUMesh("m",3) ; m1.allocateCells(0); m1.insertNextCell(NORM_PYRA5,[0,1,2,3,4]); #Well oriented
-        m2=MEDCouplingUMesh("m",3) ; m2.allocateCells(0); m2.insertNextCell(NORM_PENTA6,[0,1,2,3,4,5]); #Well oriented
+        m2=MEDCouplingUMesh("m",3) ; m2.allocateCells(0); m2.insertNextCell(NORM_PENTA6,[0,1,2,3,4,5]); #Well oriented 
         m3=MEDCouplingUMesh("m",3) ; m3.allocateCells(0); m3.insertNextCell(NORM_HEXA8,[0,1,2,3,4,5,6,7]); #Well oriented
         m4=MEDCouplingUMesh("m",3) ; m4.allocateCells(0)
         self.assertRaises(InterpKernelException,m4.insertNextCell,NORM_HEXGP12,[0,1,2,3,4,5,6,7,8,9,10,11,12]);
@@ -1834,7 +1873,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         m=MEDCouplingMesh.MergeMeshes([m0,m1,m2,m3,m4])
         expected1=DataArrayDouble([0.16666666666666666,0.3333333333333333,0.5,1.,1.])
         for v in vects:
-            for i in xrange(nbOfDisc):
+            for i in range(nbOfDisc):
                 mm=m.deepCopy()
                 mm.rotate([0.,0.,0.],[0.3,0.7,0.2],float(i)/float(nbOfDisc)*2*pi)
                 mm2=mm.deepCopy()
@@ -1849,15 +1888,15 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         #
         mOK=m.deepCopy()
         m0=MEDCouplingUMesh("m",3) ; m0.allocateCells(0); m0.insertNextCell(NORM_TETRA4,[0,2,1,3]); #Not well oriented
-        m1=MEDCouplingUMesh("m",3) ; m1.allocateCells(0); m1.insertNextCell(NORM_PYRA5,[0,1,2,3,4]); #Well oriented
-        m2=MEDCouplingUMesh("m",3) ; m2.allocateCells(0); m2.insertNextCell(NORM_PENTA6,[0,1,2,3,4,5]); #Well oriented
+        m1=MEDCouplingUMesh("m",3) ; m1.allocateCells(0); m1.insertNextCell(NORM_PYRA5,[0,1,2,3,4]); #Well oriented 
+        m2=MEDCouplingUMesh("m",3) ; m2.allocateCells(0); m2.insertNextCell(NORM_PENTA6,[0,1,2,3,4,5]); #Well oriented 
         m3=MEDCouplingUMesh("m",3) ; m3.allocateCells(0); m3.insertNextCell(NORM_HEXA8,[0,3,2,1,4,7,6,5]); #Not well oriented
         m4=MEDCouplingUMesh("m",3) ; m4.allocateCells(0); m4.insertNextCell(NORM_HEXGP12,[0,5,4,3,2,1,6,11,10,9,8,7]); #Not well oriented
         m0.setCoords(c0) ; m1.setCoords(c1) ; m2.setCoords(c2) ; m3.setCoords(c3) ; m4.setCoords(c4)
         m=MEDCouplingMesh.MergeMeshes([m0,m1,m2,m3,m4])
         expected2=DataArrayDouble([-0.16666666666666666,0.3333333333333333,0.5,-1.,-1.])
         for v in vects:
-            for i in xrange(nbOfDisc):
+            for i in range(nbOfDisc):
                 mm=m.deepCopy()
                 mm.rotate([0.,0.,0.],[0.3,0.7,0.2],float(i)/float(nbOfDisc)*2*pi)
                 mm2=mm.deepCopy() ; mm3=mm.deepCopy() ; mm3.convertAllToPoly()
@@ -1875,15 +1914,15 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
             pass
         #
         m0=MEDCouplingUMesh("m",3) ; m0.allocateCells(0); m0.insertNextCell(NORM_TETRA4,[0,1,2,3]); #Well oriented
-        m1=MEDCouplingUMesh("m",3) ; m1.allocateCells(0); m1.insertNextCell(NORM_PYRA5,[0,3,2,1,4]); #Not well oriented
-        m2=MEDCouplingUMesh("m",3) ; m2.allocateCells(0); m2.insertNextCell(NORM_PENTA6,[0,2,1,3,5,4]); #Not well oriented
+        m1=MEDCouplingUMesh("m",3) ; m1.allocateCells(0); m1.insertNextCell(NORM_PYRA5,[0,3,2,1,4]); #Not well oriented 
+        m2=MEDCouplingUMesh("m",3) ; m2.allocateCells(0); m2.insertNextCell(NORM_PENTA6,[0,2,1,3,5,4]); #Not well oriented 
         m3=MEDCouplingUMesh("m",3) ; m3.allocateCells(0); m3.insertNextCell(NORM_HEXA8,[0,1,2,3,4,5,6,7]); #Well oriented
-        m4=MEDCouplingUMesh("m",3) ; m4.allocateCells(0); m4.insertNextCell(NORM_HEXGP12,range(12)); #Well oriented
+        m4 = MEDCouplingUMesh("m", 3) ; m4.allocateCells(0); m4.insertNextCell(NORM_HEXGP12, list(range(12)));  # Well oriented
         m0.setCoords(c0) ; m1.setCoords(c1) ; m2.setCoords(c2) ; m3.setCoords(c3) ; m4.setCoords(c4)
         m=MEDCouplingMesh.MergeMeshes([m0,m1,m2,m3,m4])
         expected3=DataArrayDouble([0.16666666666666666,-0.3333333333333333,-0.5,1.,1.])
         for v in vects:
-            for i in xrange(nbOfDisc):
+            for i in range(nbOfDisc):
                 mm=m.deepCopy()
                 mm.rotate([0.,0.,0.],[0.3,0.7,0.2],float(i)/float(nbOfDisc)*2*pi)
                 mm2=mm.deepCopy() ; mm3=mm.deepCopy() ; mm3.convertAllToPoly()
@@ -1904,7 +1943,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
     def testSwig2CellOrientation1(self):
         coords=DataArrayDouble([-0.21606,-0.10803,0.29999999999999999,-0.21606,-0.10803,0.37700000000000006,0,-0.10803,0.29999999999999999,0,-0.10803,0.37700000000000006,0,0.10803,0.29999999999999999,0,0.10803,0.37700000000000006,-0.21606,0.10803,0.29999999999999999,-0.21606,0.10803,0.37700000000000006,0,0.03601,0.29999999999999999,0,0.03601,0.37700000000000006,0,-0.03601,0.29999999999999999,0,-0.03601,0.37700000000000006],12,3)
         conn=[[0,2,10,8,4,6],[1,3,11,9,5,7],[0,1,3,2],[2,3,11,10],[10,11,9,8],[8,9,5,4],[4,5,7,6],[6,7,1,0]]
-        for i in xrange(256):
+        for i in range(256):
             mesh=MEDCouplingUMesh("FluidMesh_1",3);
             mesh.allocateCells(0)
             conn2=[elt[:] for elt in conn]
@@ -2035,7 +2074,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         coords=DataArrayDouble([0.,0.,1.,1.,1.,0.]) ; m.setCoords(coords)
         da=DataArrayInt([0,1,2])
         m.allocateCells(0)
-        for i in xrange(5):
+        for i in range(5):
             m.insertNextCell(NORM_TRI3,da)
             pass
         self.assertTrue(m.getNodalConnectivity().isEqual(DataArrayInt([3,0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,0,1,2])))
@@ -2043,7 +2082,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         #
         da=DataArrayInt([0,1,2,3])
         m.allocateCells(0)
-        for i in xrange(5):
+        for i in range(5):
             m.insertNextCell(NORM_TRI3,3,da)
             pass
         self.assertTrue(m.getNodalConnectivity().isEqual(DataArrayInt([3,0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,0,1,2])))
@@ -2210,7 +2249,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         pass
 
     def testSwigSetItem3(self):
-        # 1-2
+        # 1-2 
         d=DataArrayDouble([0,0,0,0,0,0,0,0,0,0,0,0],6,2)
         d[3]=[1,2]
         self.assertTrue(d.isEqual(DataArrayDouble([0,0,0,0,0,0,1,2,0,0,0,0],6,2),1e-14))
@@ -2270,7 +2309,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         d=DataArrayDouble([0,0,0,0,0,0,0,0,0,0,0,0],6,2)
         d[1::2,:]=[3,9]
         self.assertTrue(d.isEqual(DataArrayDouble([0,0,3,9,0,0,3,9,0,0,3,9],6,2),1e-14))
-        # 1-2
+        # 1-2 
         d=DataArrayInt([0,0,0,0,0,0,0,0,0,0,0,0],6,2)
         d[3]=[1,2]
         self.assertTrue(d.isEqual(DataArrayInt([0,0,0,0,0,0,1,2,0,0,0,0],6,2)))
@@ -2359,8 +2398,8 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         m3D.convertLinearCellsToQuadratic(0)
         m3D.checkConsistency()
         # check of new m3D content
-        coordsExp2=[coordsExp.changeNbOfComponents(3,i) for i in xrange(4)]
-        coordsExp3=[DataArrayDouble.Meld(cooTmp[:,[0,1]],cooTmp[:,2]+(0.5+float(i))) for i in xrange(3)]
+        coordsExp2 = [coordsExp.changeNbOfComponents(3, i) for i in range(4)]
+        coordsExp3 = [DataArrayDouble.Meld(cooTmp[:, [0, 1]], cooTmp[:, 2] + (0.5 + float(i))) for i in range(3)]
         coordsExp4=DataArrayDouble.Aggregate([coordsExp2[0],coordsExp3[0],coordsExp2[1],coordsExp3[1],coordsExp2[2],coordsExp3[2],coordsExp2[3]])
         c=DataArrayDouble.Aggregate(m3D.getCoords(),coordsExp4)
         self.assertEqual(len(coordsExp4),115)
@@ -2566,7 +2605,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
     def testSwig2DataArrayAsciiChar1(self):
         alpha=DataArrayInt(26) ; alpha.iota(ord("A"))
         d=DataArrayAsciiChar(alpha.getValues(),2,13)
-        d.setInfoOnComponents(["c%i"%(v) for v in xrange(13)])
+        d.setInfoOnComponents(["c%i" % (v) for v in range(13)])
         self.assertEqual('ABCDEFGHIJKLM',d.getTuple(0))
         self.assertEqual('NOPQRSTUVWXYZ',d.getTuple(1))
         self.assertEqual(2,d.getNumberOfTuples())
@@ -2699,8 +2738,8 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         self.assertTrue(mea.getArray().isEqual(DataArrayDouble([-0.08504076274779823,-0.06378057206084897,-0.08504076274779869,-0.10630095343474463,-0.12756114412169625,-0.10630095343474734,-0.0637805720608491,-0.0850407627477968,-0.1063009534347449,-0.0850407627477994,-0.10630095343474809,-0.1275611441216954,-0.037205333702161475,-0.037205333702161475,-0.037205333702161475,-0.037205333702161475,-0.047835429045636084,-0.047835429045636084,-0.047835429045636084,-0.047835429045636084,-0.05846552438911087,-0.05846552438911087,-0.05846552438911087,-0.05846552438911087,-0.037205333702161725,-0.037205333702161725,-0.037205333702161725,-0.037205333702161725,-0.047835429045635834,-0.047835429045635834,-0.047835429045635834,-0.047835429045635834,-0.05846552438911058,-0.05846552438911058,-0.05846552438911058,-0.05846552438911058,-0.03879154890291829,-0.03879154890291829,-0.03879154890291829,-0.04120270848015563,-0.04120270848015563,-0.04120270848015563,-0.03393028948486933,-0.03393028948486933,-0.03393028948486933,-0.03151955746491709,-0.03151955746491709,-0.03151955746491709,-0.02424752187358276,-0.02424752187358276,-0.02424752187358276,-0.026657914642918758,-0.026657914642918758,-0.026657914642918758,-0.04120270848015456,-0.04120270848015456,-0.04120270848015456,-0.03879154890291757,-0.03879154890291757,-0.03879154890291757,-0.031519557464916595,-0.031519557464916595,-0.031519557464916595,-0.03393028948487046,-0.03393028948487046,-0.03393028948487046,-0.0266579146429191,-0.0266579146429191,-0.0266579146429191,-0.024247521873582645,-0.024247521873582645,-0.024247521873582645,-0.01851718920904466,-0.01851718920904466,-0.01851718920904466,-0.01851718920904466,-0.029627502734471456,-0.029627502734471456,-0.029627502734471456,-0.029627502734471456,-0.04740400437515433,-0.015150427534672922,-0.015150427534672922,-0.015150427534672922,-0.015150427534672922,-0.024240684055476674,-0.024240684055476674,-0.024240684055476674,-0.024240684055476674,-0.038785094488762675,-0.011783665860301345,-0.011783665860301345,-0.011783665860301345,-0.011783665860301345,-0.018853865376482152,-0.018853865376482152,-0.018853865376482152,-0.018853865376482152,-0.030166184602371443,-0.018517189209044892,-0.018517189209044892,-0.018517189209044892,-0.018517189209044892,-0.029627502734471827,-0.029627502734471827,-0.029627502734471827,-0.029627502734471827,-0.04740400437515492,-0.015150427534672776,-0.015150427534672776,-0.015150427534672776,-0.015150427534672776,-0.02424068405547644,-0.02424068405547644,-0.02424068405547644,-0.02424068405547644,-0.03878509448876231,-0.011783665860301277,-0.011783665860301277,-0.011783665860301277,-0.011783665860301277,-0.01885386537648204,-0.01885386537648204,-0.01885386537648204,-0.01885386537648204,-0.030166184602371266]),1e-14))
         f=MEDCouplingFieldDouble(ft)
         arr=DataArrayDouble(126,2)
-        arr[:,0]=range(126)
-        arr[:,1]=range(126)
+        arr[:, 0] = list(range(126))
+        arr[:, 1] = list(range(126))
         arr[:,1]+=1000
         f.setArray(arr)
         f.checkConsistencyLight()
@@ -2761,24 +2800,24 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
 
     def testSwig2DAReverseMultiCompo1(self):
         d=DataArrayDouble(6,2)
-        d[:,0]=range(6)
-        d[:,1]=range(10,16)
+        d[:, 0] = list(range(6))
+        d[:, 1] = list(range(10, 16))
         d.reverse()
         self.assertTrue(d.isEqual(DataArrayDouble([5.,15.,4.,14.,3.,13.,2.,12.,1.,11.,0.,10.],6,2),1e-14))
         d=DataArrayDouble(7,2)
-        d[:,0]=range(7)
-        d[:,1]=range(10,17)
+        d[:, 0] = list(range(7))
+        d[:, 1] = list(range(10, 17))
         d.reverse()
         self.assertTrue(d.isEqual(DataArrayDouble([6.,16.,5.,15.,4.,14.,3.,13.,2.,12.,1.,11.,0.,10.],7,2),1e-14))
         #
         d=DataArrayInt(6,2)
-        d[:,0]=range(6)
-        d[:,1]=range(10,16)
+        d[:, 0] = list(range(6))
+        d[:, 1] = list(range(10, 16))
         d.reverse()
         self.assertTrue(d.isEqual(DataArrayInt([5,15,4,14,3,13,2,12,1,11,0,10],6,2)))
         d=DataArrayInt(7,2)
-        d[:,0]=range(7)
-        d[:,1]=range(10,17)
+        d[:, 0] = list(range(7))
+        d[:, 1] = list(range(10, 17))
         d.reverse()
         self.assertTrue(d.isEqual(DataArrayInt([6,16,5,15,4,14,3,13,2,12,1,11,0,10],7,2)))
         pass
@@ -2827,7 +2866,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         d4**=d3
         self.assertTrue(d4.isEqual(DataArrayDouble([1.,sqrt(2.),1.4422495703074083,sqrt(2.)]),1e-14))
         pass
-
+    
     def testSwig2Baryenter3DForCellsWithVolumeZero1(self):
         coo=DataArrayDouble([0.,0.,0.,1.,0.,0.,0.,1.,0.],3,3)
         m2=MEDCouplingUMesh("mesh",2)
@@ -2855,16 +2894,16 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         d=DataArrayDouble()
         self.assertTrue(len(d.__repr__())<120)
         d.alloc(1000,0) ; self.assertTrue(len(d.__repr__())<100)
-        for i in xrange(100):
+        for i in range(100):
             d.alloc(i,1) ; d.iota(1.1234567890123456) ; d*=1e123
             self.assertTrue(len(d.__repr__())<500)
             pass
-        for i in xrange(50):
+        for i in range(50):
             d.alloc(i,2) ; d.rearrange(1) ; d.iota(1.1234567890123456) ; d.rearrange(2) ; d*=1e123
             self.assertTrue(len(d.__repr__())<500)
             pass
         d.alloc(4000,1) ; d.iota() ; self.assertTrue(len(d.__repr__())<500)
-        for i in xrange(2,4):
+        for i in range(2, 4):
             d.alloc(362880,1) ; d.iota() ; d.rearrange(i) ; self.assertTrue(len(d.__repr__())<500)
             pass
         d.alloc(0,9)
@@ -2873,16 +2912,16 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         d=DataArrayInt()
         self.assertTrue(len(d.__repr__())<100)
         d.alloc(1000,0) ; self.assertTrue(len(d.__repr__())<100)
-        for i in xrange(100):
+        for i in range(100):
             d.alloc(i,1) ; d.iota(123456789)
             self.assertTrue(len(d.__repr__())<500)
             pass
-        for i in xrange(50):
+        for i in range(50):
             d.alloc(i,2) ; d.rearrange(1) ; d.iota(123456789) ; d.rearrange(2)
             self.assertTrue(len(d.__repr__())<500)
             pass
         d.alloc(4000,1) ; d.iota() ; self.assertTrue(len(d.__repr__())<500)
-        for i in xrange(2,10):
+        for i in range(2, 10):
             d.alloc(362880,1) ; d.iota() ; d.rearrange(i) ; self.assertTrue(len(d.__repr__())<500)
             pass
         d.alloc(0,9)
@@ -2908,7 +2947,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         d.alloc(1000,3) ; d.fillWithValue(127)
         self.assertTrue(len(d.__repr__())<500)
         pass
-
+    
     def testSwig2MeshComputeIsoBarycenterOfNodesPerCell1(self):
         coo=DataArrayDouble([26.17509821414239,5.0374,200.,26.175098214142388,-5.0374,200.,17.450065476094927,20.1496,200.,8.725032738047464,25.187,200.,43.62516369023732,5.0374,200.,34.90013095218986,10.0748,200.,34.900130952189855,-10.0748,200.,43.625163690237315,-5.0374,200.,26.175098214142402,25.187,200.,26.175098214142395,35.2618,200.,17.45006547609493,40.2992,200.,8.725032738047469,35.2618,200.,26.17509821414239,5.0374,200.,26.175098214142388,-5.0374,200.,17.450065476094927,20.1496,200.,8.725032738047464,25.187,200.,43.62516369023732,5.0374,200.,34.90013095218986,10.0748,200.,34.900130952189855,-10.0748,200.,43.625163690237315,-5.0374,200.,26.175098214142402,25.187,200.,26.175098214142395,35.2618,200.,17.45006547609493,40.2992,200.,8.725032738047469,35.2618,200.],24,3)
         m=MEDCouplingUMesh.New("toto",3)
@@ -2948,7 +2987,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         m2.allocateCells(0)
         m2.setCoords(coo)
         conn2=[[0,3,5,1,7,4,6,2],[12,14,16,18,13,15,17,19],[0,12,18,3,8,19,11,7],[3,18,16,5,11,17,10,4],[5,16,14,1,10,15,9,6],[1,14,12,0,9,13,8,2]]
-        for i in xrange(6):
+        for i in range(6):
             m2.insertNextCell(NORM_QUAD8,conn2[i])
             pass
         self.assertTrue(m2.isEqual(a,1e-12))
@@ -2971,7 +3010,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         conn4=[[0,2,3,1,8,9,10,11,20],[4,5,6,7,15,14,13,12,25],[0,4,7,2,16,12,17,8,21],[2,7,6,3,17,13,18,9,22],[3,6,5,1,18,14,19,10,23],[1,5,4,0,19,15,16,11,24]]
         m4=MEDCouplingUMesh("mesh",2)
         m4.allocateCells(0)
-        for i in xrange(6):
+        for i in range(6):
             m4.insertNextCell(NORM_QUAD9,conn4[i])
             pass
         m4.setCoords(coo2)
@@ -2981,7 +3020,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         self.assertTrue(d.isEqual(DataArrayInt([0,0,0,0,0,0])))
         self.assertTrue(e.isEqual(DataArrayInt([0,1,2,3,4,5,6])))
         pass
-
+    
     def testSwigAdvGauss(self):
         f=MEDCouplingFieldTemplate(ON_GAUSS_PT)
         f.setDiscretization(None)
@@ -3048,20 +3087,20 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         f=MEDCouplingFieldDouble(ON_CELLS)
         f.setMesh(m)
         arr=DataArrayDouble(5,2)
-        arr[:,0]=range(5) ; arr[:,1]=2*arr[:,0]
+        arr[:, 0] = list(range(5)) ; arr[:, 1] = 2 * arr[:, 0]
         f2=f.clone(True)
         self.assertRaises(InterpKernelException,f.__add__,2)
-        self.assertRaises(InterpKernelException,f.__add__,range(5))
+        self.assertRaises(InterpKernelException, f.__add__, list(range(5)))
         self.assertRaises(InterpKernelException,f.__add__,arr)
         self.assertRaises(InterpKernelException,f.__add__,f2)
         f.setArray(DataArrayDouble())
         self.assertRaises(InterpKernelException,f.__add__,2)
-        self.assertRaises(InterpKernelException,f.__add__,range(5))
+        self.assertRaises(InterpKernelException, f.__add__, list(range(5)))
         self.assertRaises(InterpKernelException,f.__add__,arr)
         self.assertRaises(InterpKernelException,f.__add__,f2)
         self.assertRaises(InterpKernelException,f.__getitem__,(slice(None),0))
         f.getArray().alloc(5,2)
-        f.getArray()[:,0]=range(5) ; f.getArray()[:,1]=f.getArray()[:,0]+7
+        f.getArray()[:, 0] = list(range(5)) ; f.getArray()[:, 1] = f.getArray()[:, 0] + 7
         ff=f+2
         ff.checkConsistencyLight()
         self.assertTrue(ff.getArray().isEqual(DataArrayDouble([(2,9),(3,10),(4,11),(5,12),(6,13)]),1e-12))
@@ -3080,20 +3119,20 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         f=MEDCouplingFieldDouble(ON_CELLS)
         f.setMesh(m)
         arr=DataArrayDouble(5,2)
-        arr[:,0]=range(5) ; arr[:,1]=2*arr[:,0]
+        arr[:, 0] = list(range(5)) ; arr[:, 1] = 2 * arr[:, 0]
         f2=f.clone(True)
         self.assertRaises(InterpKernelException,f.__sub__,2)
-        self.assertRaises(InterpKernelException,f.__sub__,range(5))
+        self.assertRaises(InterpKernelException, f.__sub__, list(range(5)))
         self.assertRaises(InterpKernelException,f.__sub__,arr)
         self.assertRaises(InterpKernelException,f.__sub__,f2)
         f.setArray(DataArrayDouble())
         self.assertRaises(InterpKernelException,f.__sub__,2)
-        self.assertRaises(InterpKernelException,f.__sub__,range(5))
+        self.assertRaises(InterpKernelException, f.__sub__, list(range(5)))
         self.assertRaises(InterpKernelException,f.__sub__,arr)
         self.assertRaises(InterpKernelException,f.__sub__,f2)
         self.assertRaises(InterpKernelException,f.__getitem__,(slice(None),0))
         f.getArray().alloc(5,2)
-        f.getArray()[:,0]=range(5) ; f.getArray()[:,1]=f.getArray()[:,0]+7
+        f.getArray()[:, 0] = list(range(5)) ; f.getArray()[:, 1] = f.getArray()[:, 0] + 7
         ff=f-2
         ff.checkConsistencyLight()
         self.assertTrue(ff.getArray().isEqual(DataArrayDouble([(-2,5),(-1,6),(0,7),(1,8),(2,9)]),1e-12))
@@ -3112,20 +3151,20 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         f=MEDCouplingFieldDouble(ON_CELLS)
         f.setMesh(m)
         arr=DataArrayDouble(5,2)
-        arr[:,0]=range(5) ; arr[:,1]=2*arr[:,0]
+        arr[:, 0] = list(range(5)) ; arr[:, 1] = 2 * arr[:, 0]
         f2=f.clone(True)
         self.assertRaises(InterpKernelException,f.__mul__,2)
-        self.assertRaises(InterpKernelException,f.__mul__,range(5))
+        self.assertRaises(InterpKernelException, f.__mul__, list(range(5)))
         self.assertRaises(InterpKernelException,f.__mul__,arr)
         self.assertRaises(InterpKernelException,f.__mul__,f2)
         f.setArray(DataArrayDouble())
         self.assertRaises(InterpKernelException,f.__mul__,2)
-        self.assertRaises(InterpKernelException,f.__mul__,range(5))
+        self.assertRaises(InterpKernelException, f.__mul__, list(range(5)))
         self.assertRaises(InterpKernelException,f.__mul__,arr)
         self.assertRaises(InterpKernelException,f.__mul__,f2)
         self.assertRaises(InterpKernelException,f.__getitem__,(slice(None),0))
         f.getArray().alloc(5,2)
-        f.getArray()[:,0]=range(5) ; f.getArray()[:,1]=f.getArray()[:,0]+7
+        f.getArray()[:, 0] = list(range(5)) ; f.getArray()[:, 1] = f.getArray()[:, 0] + 7
         ff=f*2
         ff.checkConsistencyLight()
         self.assertTrue(ff.getArray().isEqual(DataArrayDouble([(0,14),(2,16),(4,18),(6,20),(8,22)]),1e-12))
@@ -3144,20 +3183,20 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         f=MEDCouplingFieldDouble(ON_CELLS)
         f.setMesh(m)
         arr=DataArrayDouble(5,2)
-        arr[:,0]=range(1,6) ; arr[:,1]=2*arr[:,0]
+        arr[:, 0] = list(range(1, 6)) ; arr[:, 1] = 2 * arr[:, 0]
         f2=f.clone(True)
         self.assertRaises(InterpKernelException,f.__div__,2)
-        self.assertRaises(InterpKernelException,f.__div__,range(5))
+        self.assertRaises(InterpKernelException, f.__div__, list(range(5)))
         self.assertRaises(InterpKernelException,f.__div__,arr)
         self.assertRaises(InterpKernelException,f.__div__,f2)
         f.setArray(DataArrayDouble())
         self.assertRaises(InterpKernelException,f.__div__,2)
-        self.assertRaises(InterpKernelException,f.__div__,range(5))
+        self.assertRaises(InterpKernelException, f.__div__, list(range(5)))
         self.assertRaises(InterpKernelException,f.__div__,arr)
         self.assertRaises(InterpKernelException,f.__div__,f2)
         self.assertRaises(InterpKernelException,f.__getitem__,(slice(None),0))
         f.getArray().alloc(5,2)
-        f.getArray()[:,0]=range(5) ; f.getArray()[:,1]=f.getArray()[:,0]+7
+        f.getArray()[:, 0] = list(range(5)) ; f.getArray()[:, 1] = f.getArray()[:, 0] + 7
         self.assertRaises(InterpKernelException,f.__div__,0)
         ff=f/2
         ff.checkConsistencyLight()
@@ -3180,17 +3219,17 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         arr[:]=[1,1,3,2,0]
         f2=f.clone(True)
         self.assertRaises(InterpKernelException,f.__div__,2)
-        self.assertRaises(InterpKernelException,f.__div__,range(5))
+        self.assertRaises(InterpKernelException, f.__div__, list(range(5)))
         self.assertRaises(InterpKernelException,f.__div__,arr)
         self.assertRaises(InterpKernelException,f.__div__,f2)
         f.setArray(DataArrayDouble())
         self.assertRaises(InterpKernelException,f.__div__,2)
-        self.assertRaises(InterpKernelException,f.__div__,range(5))
+        self.assertRaises(InterpKernelException, f.__div__, list(range(5)))
         self.assertRaises(InterpKernelException,f.__div__,arr)
         self.assertRaises(InterpKernelException,f.__div__,f2)
         self.assertRaises(InterpKernelException,f.__getitem__,(slice(None),0))
         f.getArray().alloc(5,1)
-        f.getArray()[:]=range(2,7)
+        f.getArray()[:] = list(range(2, 7))
         ff=f**2
         ff.checkConsistencyLight()
         self.assertTrue(ff.getArray().isEqual(DataArrayDouble([4,9,16,25,36]),1e-12))
@@ -3206,19 +3245,19 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         f=MEDCouplingFieldDouble(ON_CELLS)
         f.setMesh(m)
         arr=DataArrayDouble(5,2)
-        arr[:,0]=range(5) ; arr[:,1]=2*arr[:,0]
+        arr[:, 0] = list(range(5)) ; arr[:, 1] = 2 * arr[:, 0]
         f2=f.clone(True)
         self.assertRaises(InterpKernelException,f.__iadd__,2)
-        self.assertRaises(InterpKernelException,f.__iadd__,range(5))
+        self.assertRaises(InterpKernelException, f.__iadd__, list(range(5)))
         self.assertRaises(InterpKernelException,f.__iadd__,arr)
         self.assertRaises(InterpKernelException,f.__iadd__,f2)
         f.setArray(DataArrayDouble())
         self.assertRaises(InterpKernelException,f.__iadd__,2)
-        self.assertRaises(InterpKernelException,f.__iadd__,range(5))
+        self.assertRaises(InterpKernelException, f.__iadd__, list(range(5)))
         self.assertRaises(InterpKernelException,f.__iadd__,arr)
         self.assertRaises(InterpKernelException,f.__iadd__,f2)
         f.getArray().alloc(5,2)
-        f.getArray()[:,0]=range(5) ; f.getArray()[:,1]=f.getArray()[:,0]+7
+        f.getArray()[:, 0] = list(range(5)) ; f.getArray()[:, 1] = f.getArray()[:, 0] + 7
         f.checkConsistencyLight()
         f+=2
         f.checkConsistencyLight()
@@ -3238,19 +3277,19 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         f=MEDCouplingFieldDouble(ON_CELLS)
         f.setMesh(m)
         arr=DataArrayDouble(5,2)
-        arr[:,0]=range(5) ; arr[:,1]=2*arr[:,0]
+        arr[:, 0] = list(range(5)) ; arr[:, 1] = 2 * arr[:, 0]
         f2=f.clone(True)
         self.assertRaises(InterpKernelException,f.__isub__,2)
-        self.assertRaises(InterpKernelException,f.__isub__,range(5))
+        self.assertRaises(InterpKernelException, f.__isub__, list(range(5)))
         self.assertRaises(InterpKernelException,f.__isub__,arr)
         self.assertRaises(InterpKernelException,f.__isub__,f2)
         f.setArray(DataArrayDouble())
         self.assertRaises(InterpKernelException,f.__isub__,2)
-        self.assertRaises(InterpKernelException,f.__isub__,range(5))
+        self.assertRaises(InterpKernelException, f.__isub__, list(range(5)))
         self.assertRaises(InterpKernelException,f.__isub__,arr)
         self.assertRaises(InterpKernelException,f.__isub__,f2)
         f.getArray().alloc(5,2)
-        f.getArray()[:,0]=range(5) ; f.getArray()[:,1]=f.getArray()[:,0]+7
+        f.getArray()[:, 0] = list(range(5)) ; f.getArray()[:, 1] = f.getArray()[:, 0] + 7
         f.checkConsistencyLight()
         f-=2
         f.checkConsistencyLight()
@@ -3270,19 +3309,19 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         f=MEDCouplingFieldDouble(ON_CELLS)
         f.setMesh(m)
         arr=DataArrayDouble(5,2)
-        arr[:,0]=range(5) ; arr[:,1]=2*arr[:,0]
+        arr[:, 0] = list(range(5)) ; arr[:, 1] = 2 * arr[:, 0]
         f2=f.clone(True)
         self.assertRaises(InterpKernelException,f.__imul__,2)
-        self.assertRaises(InterpKernelException,f.__imul__,range(5))
+        self.assertRaises(InterpKernelException, f.__imul__, list(range(5)))
         self.assertRaises(InterpKernelException,f.__imul__,arr)
         self.assertRaises(InterpKernelException,f.__imul__,f2)
         f.setArray(DataArrayDouble())
         self.assertRaises(InterpKernelException,f.__imul__,2)
-        self.assertRaises(InterpKernelException,f.__imul__,range(5))
+        self.assertRaises(InterpKernelException, f.__imul__, list(range(5)))
         self.assertRaises(InterpKernelException,f.__imul__,arr)
         self.assertRaises(InterpKernelException,f.__imul__,f2)
         f.getArray().alloc(5,2)
-        f.getArray()[:,0]=range(5) ; f.getArray()[:,1]=f.getArray()[:,0]+7
+        f.getArray()[:, 0] = list(range(5)) ; f.getArray()[:, 1] = f.getArray()[:, 0] + 7
         f.checkConsistencyLight()
         f*=2
         f.checkConsistencyLight()
@@ -3302,19 +3341,19 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         f=MEDCouplingFieldDouble(ON_CELLS)
         f.setMesh(m)
         arr=DataArrayDouble(5,2)
-        arr[:,0]=range(1,6) ; arr[:,1]=2*arr[:,0]
+        arr[:, 0] = list(range(1, 6)) ; arr[:, 1] = 2 * arr[:, 0]
         f2=f.clone(True)
         self.assertRaises(InterpKernelException,f.__idiv__,2)
-        self.assertRaises(InterpKernelException,f.__idiv__,range(5))
+        self.assertRaises(InterpKernelException, f.__idiv__, list(range(5)))
         self.assertRaises(InterpKernelException,f.__idiv__,arr)
         self.assertRaises(InterpKernelException,f.__idiv__,f2)
         f.setArray(DataArrayDouble())
         self.assertRaises(InterpKernelException,f.__idiv__,2)
-        self.assertRaises(InterpKernelException,f.__idiv__,range(5))
+        self.assertRaises(InterpKernelException, f.__idiv__, list(range(5)))
         self.assertRaises(InterpKernelException,f.__idiv__,arr)
         self.assertRaises(InterpKernelException,f.__idiv__,f2)
         f.getArray().alloc(5,2)
-        f.getArray()[:,0]=range(5) ; f.getArray()[:,1]=f.getArray()[:,0]+7
+        f.getArray()[:, 0] = list(range(5)) ; f.getArray()[:, 1] = f.getArray()[:, 0] + 7
         f.checkConsistencyLight()
         f/=2
         f.checkConsistencyLight()
@@ -3334,19 +3373,19 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         f=MEDCouplingFieldDouble(ON_CELLS)
         f.setMesh(m)
         arr=DataArrayDouble(5,2)
-        arr[:,0]=range(1,6) ; arr[:,1]=2*arr[:,0]
+        arr[:, 0] = list(range(1, 6)) ; arr[:, 1] = 2 * arr[:, 0]
         f2=f.clone(True)
         self.assertRaises(InterpKernelException,f.__ipow__,2)
-        self.assertRaises(InterpKernelException,f.__ipow__,range(5))
+        self.assertRaises(InterpKernelException, f.__ipow__, list(range(5)))
         self.assertRaises(InterpKernelException,f.__ipow__,arr)
         self.assertRaises(InterpKernelException,f.__ipow__,f2)
         f.setArray(DataArrayDouble())
         self.assertRaises(InterpKernelException,f.__ipow__,2)
-        self.assertRaises(InterpKernelException,f.__ipow__,range(5))
+        self.assertRaises(InterpKernelException, f.__ipow__, list(range(5)))
         self.assertRaises(InterpKernelException,f.__ipow__,arr)
         self.assertRaises(InterpKernelException,f.__ipow__,f2)
         f.getArray().alloc(5,2)
-        f.getArray()[:,0]=range(5) ; f.getArray()[:,1]=f.getArray()[:,0]+7
+        f.getArray()[:, 0] = list(range(5)) ; f.getArray()[:, 1] = f.getArray()[:, 0] + 7
         f.checkConsistencyLight()
         f**=2
         f.checkConsistencyLight()
@@ -3356,20 +3395,20 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         f=MEDCouplingFieldDouble(ON_CELLS)
         f.setMesh(m)
         arr=DataArrayDouble(5,2)
-        arr[:,0]=range(5) ; arr[:,1]=2*arr[:,0]
+        arr[:, 0] = list(range(5)) ; arr[:, 1] = 2 * arr[:, 0]
         f2=f.clone(True)
         self.assertRaises(InterpKernelException,f.__radd__,2)
-        self.assertRaises(InterpKernelException,f.__radd__,range(5))
+        self.assertRaises(InterpKernelException, f.__radd__, list(range(5)))
         self.assertRaises(InterpKernelException,f.__radd__,arr)
         self.assertRaises(InterpKernelException,f.__radd__,f2)
         f.setArray(DataArrayDouble())
         self.assertRaises(InterpKernelException,f.__radd__,2)
-        self.assertRaises(InterpKernelException,f.__radd__,range(5))
+        self.assertRaises(InterpKernelException, f.__radd__, list(range(5)))
         self.assertRaises(InterpKernelException,f.__radd__,arr)
         self.assertRaises(InterpKernelException,f.__radd__,f2)
         self.assertRaises(InterpKernelException,f.__getitem__,(slice(None),0))
         f.getArray().alloc(5,2)
-        f.getArray()[:,0]=range(5) ; f.getArray()[:,1]=f.getArray()[:,0]+7
+        f.getArray()[:, 0] = list(range(5)) ; f.getArray()[:, 1] = f.getArray()[:, 0] + 7
         ff=2+f
         ff.checkConsistencyLight()
         self.assertTrue(ff.getArray().isEqual(DataArrayDouble([(2,9),(3,10),(4,11),(5,12),(6,13)]),1e-12))
@@ -3384,20 +3423,20 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         f=MEDCouplingFieldDouble(ON_CELLS)
         f.setMesh(m)
         arr=DataArrayDouble(5,2)
-        arr[:,0]=range(5) ; arr[:,1]=2*arr[:,0]
+        arr[:, 0] = list(range(5)) ; arr[:, 1] = 2 * arr[:, 0]
         f2=f.clone(True)
         self.assertRaises(InterpKernelException,f.__rsub__,2)
-        self.assertRaises(InterpKernelException,f.__rsub__,range(5))
+        self.assertRaises(InterpKernelException, f.__rsub__, list(range(5)))
         self.assertRaises(InterpKernelException,f.__rsub__,arr)
         self.assertRaises(InterpKernelException,f.__rsub__,f2)
         f.setArray(DataArrayDouble())
         self.assertRaises(InterpKernelException,f.__rsub__,2)
-        self.assertRaises(InterpKernelException,f.__rsub__,range(5))
+        self.assertRaises(InterpKernelException, f.__rsub__, list(range(5)))
         self.assertRaises(InterpKernelException,f.__rsub__,arr)
         self.assertRaises(InterpKernelException,f.__rsub__,f2)
         self.assertRaises(InterpKernelException,f.__getitem__,(slice(None),0))
         f.getArray().alloc(5,2)
-        f.getArray()[:,0]=range(5) ; f.getArray()[:,1]=f.getArray()[:,0]+7
+        f.getArray()[:, 0] = list(range(5)) ; f.getArray()[:, 1] = f.getArray()[:, 0] + 7
         ff=2-f
         ff.checkConsistencyLight()
         self.assertTrue(ff.getArray().isEqual(DataArrayDouble([(2,-5),(1,-6),(0,-7),(-1,-8),(-2,-9)]),1e-12))
@@ -3410,20 +3449,20 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         f=MEDCouplingFieldDouble(ON_CELLS)
         f.setMesh(m)
         arr=DataArrayDouble(5,2)
-        arr[:,0]=range(5) ; arr[:,1]=2*arr[:,0]
+        arr[:, 0] = list(range(5)) ; arr[:, 1] = 2 * arr[:, 0]
         f2=f.clone(True)
         self.assertRaises(InterpKernelException,f.__rmul__,2)
-        self.assertRaises(InterpKernelException,f.__rmul__,range(5))
+        self.assertRaises(InterpKernelException, f.__rmul__, list(range(5)))
         self.assertRaises(InterpKernelException,f.__rmul__,arr)
         self.assertRaises(InterpKernelException,f.__rmul__,f2)
         f.setArray(DataArrayDouble())
         self.assertRaises(InterpKernelException,f.__rmul__,2)
-        self.assertRaises(InterpKernelException,f.__rmul__,range(5))
+        self.assertRaises(InterpKernelException, f.__rmul__, list(range(5)))
         self.assertRaises(InterpKernelException,f.__rmul__,arr)
         self.assertRaises(InterpKernelException,f.__rmul__,f2)
         self.assertRaises(InterpKernelException,f.__getitem__,(slice(None),0))
         f.getArray().alloc(5,2)
-        f.getArray()[:,0]=range(5) ; f.getArray()[:,1]=f.getArray()[:,0]+7
+        f.getArray()[:, 0] = list(range(5)) ; f.getArray()[:, 1] = f.getArray()[:, 0] + 7
         ff=2*f
         ff.checkConsistencyLight()
         self.assertTrue(ff.getArray().isEqual(DataArrayDouble([(0,14),(2,16),(4,18),(6,20),(8,22)]),1e-12))
@@ -3438,20 +3477,20 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         f=MEDCouplingFieldDouble(ON_CELLS)
         f.setMesh(m)
         arr=DataArrayDouble(5,2)
-        arr[:,0]=range(1,6) ; arr[:,1]=2*arr[:,0]
+        arr[:, 0] = list(range(1, 6)) ; arr[:, 1] = 2 * arr[:, 0]
         f2=f.clone(True)
         self.assertRaises(InterpKernelException,f.__rdiv__,2)
-        self.assertRaises(InterpKernelException,f.__rdiv__,range(5))
+        self.assertRaises(InterpKernelException, f.__rdiv__, list(range(5)))
         self.assertRaises(InterpKernelException,f.__rdiv__,arr)
         self.assertRaises(InterpKernelException,f.__rdiv__,f2)
         f.setArray(DataArrayDouble())
         self.assertRaises(InterpKernelException,f.__rdiv__,2)
-        self.assertRaises(InterpKernelException,f.__rdiv__,range(5))
+        self.assertRaises(InterpKernelException, f.__rdiv__, list(range(5)))
         self.assertRaises(InterpKernelException,f.__rdiv__,arr)
         self.assertRaises(InterpKernelException,f.__rdiv__,f2)
         self.assertRaises(InterpKernelException,f.__getitem__,(slice(None),0))
         f.getArray().alloc(5,2)
-        f.getArray()[:,0]=range(1,6) ; f.getArray()[:,1]=f.getArray()[:,0]+7
+        f.getArray()[:, 0] = list(range(1, 6)) ; f.getArray()[:, 1] = f.getArray()[:, 0] + 7
         ff=2/f
         ff.checkConsistencyLight()
         self.assertTrue(ff.getArray().isEqual(DataArrayDouble([(2,0.25),(1,0.22222222222222221),(0.66666666666666663,0.20000000000000001),(0.5,0.18181818181818182),(0.40000000000000002,0.16666666666666666)]),1e-12))
index 9c1ae7c6b10f38adc8eafd739b10484386501b43..96b4365eb2cfc01d99b1282adb672bdc041c8f7f 100644 (file)
 #
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
+from __future__ import division
+# Uncomment to be coherent with Python 3
+# from __future__ import unicode_literals
+
+import sys
+if sys.version_info.major < 3:
+  range = xrange
+  def next(it):
+    return it.next()
 
 from MEDCoupling import *
 import unittest
 from math import pi,e,sqrt,cos,sin
 from datetime import datetime
 from MEDCouplingDataForTest import MEDCouplingDataForTest
-import rlcompleter,readline # this line has to be here, to ensure a usability of MEDCoupling/MEDLoader. B4 removing it please notify to anthony.geay@cea.fr
+import rlcompleter,readline # this line has to be here, to ensure a usability of MEDCoupling/MEDLoader. B4 removing it please notify to anthony.geay@edf.fr
 
 class MEDCouplingBasicsTest5(unittest.TestCase):
     def testSwig2FieldDoubleBuildSubPartRange1(self):
@@ -31,7 +40,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         m=MEDCouplingDataForTest.build2DTargetMesh_1()
         f=MEDCouplingFieldDouble(ON_CELLS)
         f.setMesh(m)
-        arr=DataArrayDouble(5,2) ; arr[:,0]=range(7,12) ; arr[:,1]=100+arr[:,0]
+        arr = DataArrayDouble(5, 2) ; arr[:, 0] = list(range(7, 12)) ; arr[:, 1] = 100 + arr[:, 0]
         f.setArray(arr)
         f.checkConsistencyLight()
         ff=f[1:-1:2]
@@ -61,7 +70,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         #ON_NODES
         f=MEDCouplingFieldDouble(ON_NODES)
         f.setMesh(m)
-        arr=DataArrayDouble(9,2) ; arr[:,0]=range(7,16) ; arr[:,1]=100+arr[:,0]
+        arr = DataArrayDouble(9, 2) ; arr[:, 0] = list(range(7, 16)) ; arr[:, 1] = 100 + arr[:, 0]
         f.setArray(arr)
         f.checkConsistencyLight()
         ff=f[1:-1:2]
@@ -96,7 +105,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         #ON_GAUSS_NE
         f=MEDCouplingFieldDouble(ON_GAUSS_NE)
         f.setMesh(m)
-        arr=DataArrayDouble(18,2) ; arr[:,0]=range(7,25) ; arr[:,1]=100+arr[:,0]
+        arr = DataArrayDouble(18, 2) ; arr[:, 0] = list(range(7, 25)) ; arr[:, 1] = 100 + arr[:, 0]
         f.setArray(arr)
         f.checkConsistencyLight()
         ff=f[1:-1:2]
@@ -130,7 +139,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         f.setGaussLocalizationOnCells([3],[0,0,1,0,1,1,1,0],[1.1,1.1,2.2,2.2,3.,3.],[0.2,0.4,0.4]);
         f.setGaussLocalizationOnCells([1],[0,0,1,0,1,0],[1.1,1.1,2.2,2.2,3.,3.,4.,4.],[0.1,0.1,0.4,0.4]);
         f.setGaussLocalizationOnCells([2],[0,0,1,0,1,0],[1.1,1.1,2.2,2.2,3.,3.,4.,4.,5.,5.],[0.1,0.1,0.4,0.3,0.1]);
-        arr=DataArrayDouble(16,2) ; arr[:,0]=range(7,23) ; arr[:,1]=100+arr[:,0]
+        arr = DataArrayDouble(16, 2) ; arr[:, 0] = list(range(7, 23)) ; arr[:, 1] = 100 + arr[:, 0]
         f.setArray(arr)
         f.checkConsistencyLight()
         ff=f[1:-1:2]
@@ -230,7 +239,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         time_deb = datetime.now()
         a1=DataArrayDouble(len(d))
         b1=DataArrayInt(len(d))
-        m1s=[m1[i] for i in xrange(m1.getNumberOfCells())]
+        m1s = [m1[i] for i in range(m1.getNumberOfCells())]
         for j,pt in enumerate(d):
             eter=1e308
             fter=-1
@@ -258,7 +267,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         m=MEDCouplingUMesh("mesh",2)
         m.setCoords(coo)
         m.allocateCells()
-        for i in xrange(24):
+        for i in range(24):
             m.insertNextCell(NORM_QUAD4,conn[4*i:4*i+4])
             pass
         m.checkConsistency()
@@ -288,7 +297,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         d[:,1]*=pi/180. # angle in radian
         d=d.fromPolarToCart()
         d+=zeBary
-        m=MEDCouplingUMesh("quad8",2) ; m.allocateCells() ; m.insertNextCell(NORM_QUAD8,range(8)) ; m.setCoords(d)
+        m = MEDCouplingUMesh("quad8", 2) ; m.allocateCells() ; m.insertNextCell(NORM_QUAD8, list(range(8))) ; m.setCoords(d)
         self.assertTrue(m.computeCellCenterOfMass().isEqual(DataArrayDouble(zeBary,1,2),1e-13))
         self.assertAlmostEqual(float(m.getMeasureField(False).getArray()),pi*zeRadius*zeRadius,12)
         tri32D=m.buildDescendingConnectivity()[0][0] ; tri32D.zipCoords()
@@ -307,7 +316,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         d[:,1]*=pi/180. # angle in radian
         d=d.fromPolarToCart()
         d+=zeBary
-        m=MEDCouplingUMesh("tri6",2) ; m.allocateCells() ; m.insertNextCell(NORM_TRI6,range(6)) ; m.setCoords(d)
+        m = MEDCouplingUMesh("tri6", 2) ; m.allocateCells() ; m.insertNextCell(NORM_TRI6, list(range(6))) ; m.setCoords(d)
         self.assertTrue(m.computeCellCenterOfMass().isEqual(DataArrayDouble(zeBary,1,2),1e-13))
         self.assertAlmostEqual(float(m.getMeasureField(False).getArray()),pi*zeRadius*zeRadius,12)
         # spaceDim=3 TRI6 becomes TRI3 ... for the moment
@@ -325,7 +334,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         d[:,1]*=pi/180. # angle in radian
         d=d.fromPolarToCart()
         d+=zeBary
-        m=MEDCouplingUMesh("qpolyg",2) ; m.allocateCells() ; m.insertNextCell(NORM_QPOLYG,range(10)) ; m.setCoords(d)
+        m = MEDCouplingUMesh("qpolyg", 2) ; m.allocateCells() ; m.insertNextCell(NORM_QPOLYG, list(range(10))) ; m.setCoords(d)
         self.assertTrue(m.computeCellCenterOfMass().isEqual(DataArrayDouble(zeBary,1,2),1e-13))
         self.assertAlmostEqual(float(m.getMeasureField(False).getArray()),pi*zeRadius*zeRadius,12)
         # spaceDim=3 QPOLYG becomes POLYG ... for the moment
@@ -469,7 +478,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         s=slice(18,1,-2)
         self.assertEqual(DataArray.GetNumberOfItemGivenBESRelative(s),9)
         self.assertRaises(InterpKernelException,DataArray.GetNumberOfItemGivenBES,s)
-        self.assertEqual(sum([DataArray.GetNumberOfItemGivenBESRelative(DataArray.GetSlice(s,i,4)) for i in xrange(4)]),DataArray.GetNumberOfItemGivenBESRelative(s))
+        self.assertEqual(sum([DataArray.GetNumberOfItemGivenBESRelative(DataArray.GetSlice(s, i, 4)) for i in range(4)]), DataArray.GetNumberOfItemGivenBESRelative(s))
         self.assertEqual(DataArray.GetSlice(s,0,4),slice(18,14,-2))
         self.assertEqual(DataArray.GetSlice(s,1,4),slice(14,10,-2))
         self.assertEqual(DataArray.GetSlice(s,2,4),slice(10,6,-2))
@@ -537,7 +546,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         #
         maxNbCSN=nbOfCellsSharingNodes.getMaxValue()[0]
         arr3=DataArrayDouble(f.getMesh().getNumberOfNodes(),f.getArray().getNumberOfComponents()) ; arr3[:]=0.
-        for i in xrange(1,maxNbCSN+1):
+        for i in range(1, maxNbCSN + 1):
             ids=nbOfCellsSharingNodes.findIdsEqual(i)
             if len(ids)==0:
                 continue
@@ -601,7 +610,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         m=MEDCoupling1SGTUMesh("m",NORM_QUAD4)
         mem_m=m.getHeapMemorySize()
         m.allocateCells(5)
-        self.assertIn(m.getHeapMemorySize()-mem_m,xrange(5*4*4,5*4*4+32))
+        self.assertIn(m.getHeapMemorySize() - mem_m, list(range(5 * 4 * 4, 5 * 4 * 4 + 32)))
         self.assertEqual(m.getNodalConnectivity().getNbOfElemAllocated(),20)
         m.setCoords(um.getCoords())
         m.insertNextCell([1,0,6,7])
@@ -1405,7 +1414,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         valuesToTest=f.getValueOnMulti(targetPointCoordsXY);
         self.assertEqual(196,valuesToTest.getNumberOfTuples());
         self.assertEqual(1,valuesToTest.getNumberOfComponents());
-        for i in xrange(40):
+        for i in range(40):
             self.assertAlmostEqual(targetFieldValsExpected[i],valuesToTest.getIJ(i,0),10)
             pass
         fd=f.getDiscretization()
@@ -1552,7 +1561,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         #
         trs=[[0.,0.,-1.],[0.,0.,1.],[1.,0.,0.],[0.,-1.,0.],[-1.,0.,0.],[0.,1.,0.]]
         for i,t in enumerate(trs):
-            for j in xrange(64):
+            for j in range(64):
                 j2=(j//16) ; j1=((j%16)//4) ; j0=(j%4)
                 m11=m1.deepCopy()
                 m11.rotate([0.,0.,0.],[0.,0.,1.],float(j0)*pi/2)
@@ -1899,7 +1908,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         m=MEDCouplingUMesh("mesh",2) ; m.setCoords(coo)
         m.allocateCells()
         # the cell description is exactly those described in the description of TRI7 in MED file 3.0.7 documentation
-        m.insertNextCell(NORM_TRI7,range(7))
+        m.insertNextCell(NORM_TRI7, list(range(7)))
         refCoords=[0.,0.,1.,0.,0.,1.,0.5,0.,0.5,0.5,0.,0.5,0.3333333333333333,0.3333333333333333]
         gaussCoords=[0.3333333333333333,0.3333333333333333,0.470142064105115,0.470142064105115,0.05971587178977,0.470142064105115,0.470142064105115,0.05971587178977,0.101286507323456,0.101286507323456,0.797426985353088,0.101286507323456,0.101286507323456,0.797426985353088]
         weights=[0.062969590272413,0.062969590272413,0.062969590272413,0.066197076394253,0.066197076394253,0.066197076394253,0.1125]
@@ -2204,34 +2213,34 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
     def testSwigBugOnUnpackingTuplesInDataArray1(self):
         inp=DataArrayDouble([(1,2,3),(4,5,6),(7,8,9),(10,11,12)])
         it=inp.__iter__()
-        r=it.next()
+        r = next(it)
         self.assertRaises(StopIteration,r.__getitem__,4)
         self.assertEqual(len(r),3)
         a,b,c=r
-        r=it.next()
+        r = next(it)
         self.assertEqual(len(r),3)
         d,e,f=r
-        r=it.next()
+        r = next(it)
         self.assertEqual(len(r),3)
         g,h,i=r
-        r=it.next()
+        r = next(it)
         self.assertEqual(len(r),3)
         j,k,l=r
         self.assertTrue(inp.isEqual(DataArrayDouble([a,b,c,d,e,f,g,h,i,j,k,l],4,3),1e-12))
         ########
         inp=DataArrayInt([(1,2,3),(4,5,6),(7,8,9),(10,11,12)])
         it=inp.__iter__()
-        r=it.next()
+        r = next(it)
         self.assertRaises(StopIteration,r.__getitem__,4)
         self.assertEqual(len(r),3)
         a,b,c=r
-        r=it.next()
+        r = next(it)
         self.assertEqual(len(r),3)
         d,e,f=r
-        r=it.next()
+        r = next(it)
         self.assertEqual(len(r),3)
         g,h,i=r
-        r=it.next()
+        r = next(it)
         self.assertEqual(len(r),3)
         j,k,l=r
         self.assertTrue(inp.isEqual(DataArrayInt([a,b,c,d,e,f,g,h,i,j,k,l],4,3)))
@@ -2667,7 +2676,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         self.assertTrue(isinstance(g0[0],MEDCouplingCartesianAMRPatchGF))
         g1=amr.retrieveGridsAt(1)
         self.assertEqual(5,len(g1))
-        for i in xrange(5):
+        for i in range(5):
             self.assertTrue(isinstance(g1[i],MEDCouplingCartesianAMRPatch))
             pass
         pass
@@ -3087,7 +3096,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
                                NORM_SEG2,11,12,NORM_SEG2,12,13,
                                NORM_SEG2,14,15])
         cI = DataArrayInt([0,3,7,10,14,18,21,24,27,30])
-        coords2 = DataArrayDouble([float(i) for i in range(32)], 16,2)
+        coords2 = DataArrayDouble([float(i) for i in range(32)], 16, 2)
         m2.setCoords(coords2);
         m2.setConnectivity(c, cI);
         m2.checkConsistency(1.0e-8);
@@ -3310,7 +3319,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         li=[]
         liExp3D=[(0,0,0),(1,0,0),(2,0,0),(3,0,0),(0,1,0),(1,1,0),(2,1,0),(3,1,0),(0,2,0),(1,2,0),(2,2,0),(3,2,0),(0,0,1),(1,0,1),(2,0,1),(3,0,1),(0,1,1),(1,1,1),(2,1,1),(3,1,1),(0,2,1),(1,2,1),(2,2,1),(3,2,1)]
         self.assertEqual(24,m.getNumberOfCells())
-        for i in xrange(m.getNumberOfCells()):
+        for i in range(m.getNumberOfCells()):
             li.append(m.getLocationFromCellId(i))
             pass
         self.assertEqual(liExp3D,li)
@@ -3323,7 +3332,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         li=[]
         liExp2D=[(0,0),(1,0),(2,0),(3,0),(0,1),(1,1),(2,1),(3,1),(0,2),(1,2),(2,2),(3,2)]
         self.assertEqual(12,m.getNumberOfCells())
-        for i in xrange(m.getNumberOfCells()):
+        for i in range(m.getNumberOfCells()):
             li.append(m.getLocationFromCellId(i))
             pass
         self.assertEqual(liExp2D,li)
@@ -3333,7 +3342,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         arrX=DataArrayDouble(5) ; arrX.iota()
         m=MEDCouplingCMesh() ; m.setCoords(arrX)
         self.assertEqual(4,m.getNumberOfCells())
-        for i in xrange(m.getNumberOfCells()):
+        for i in range(m.getNumberOfCells()):
             self.assertEqual((i,),m.getLocationFromCellId(i))
             pass
         self.assertRaises(InterpKernelException,m.getLocationFromCellId,4)
@@ -3349,7 +3358,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         li=[]
         liExp3D=[(0,0,0),(1,0,0),(2,0,0),(3,0,0),(4,0,0),(0,1,0),(1,1,0),(2,1,0),(3,1,0),(4,1,0),(0,2,0),(1,2,0),(2,2,0),(3,2,0),(4,2,0),(0,3,0),(1,3,0),(2,3,0),(3,3,0),(4,3,0),(0,0,1),(1,0,1),(2,0,1),(3,0,1),(4,0,1),(0,1,1),(1,1,1),(2,1,1),(3,1,1),(4,1,1),(0,2,1),(1,2,1),(2,2,1),(3,2,1),(4,2,1),(0,3,1),(1,3,1),(2,3,1),(3,3,1),(4,3,1),(0,0,2),(1,0,2),(2,0,2),(3,0,2),(4,0,2),(0,1,2),(1,1,2),(2,1,2),(3,1,2),(4,1,2),(0,2,2),(1,2,2),(2,2,2),(3,2,2),(4,2,2),(0,3,2),(1,3,2),(2,3,2),(3,3,2),(4,3,2)]
         self.assertEqual(60,m.getNumberOfNodes())
-        for i in xrange(m.getNumberOfNodes()):
+        for i in range(m.getNumberOfNodes()):
             li.append(m.getLocationFromNodeId(i))
             pass
         self.assertEqual(liExp3D,li)
@@ -3362,7 +3371,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         li=[]
         liExp2D=[(0,0),(1,0),(2,0),(3,0),(4,0),(0,1),(1,1),(2,1),(3,1),(4,1),(0,2),(1,2),(2,2),(3,2),(4,2),(0,3),(1,3),(2,3),(3,3),(4,3)]
         self.assertEqual(20,m.getNumberOfNodes())
-        for i in xrange(m.getNumberOfNodes()):
+        for i in range(m.getNumberOfNodes()):
             li.append(m.getLocationFromNodeId(i))
             pass
         self.assertEqual(liExp2D,li)
@@ -3372,7 +3381,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         arrX=DataArrayDouble(5) ; arrX.iota()
         m=MEDCouplingCMesh() ; m.setCoords(arrX)
         self.assertEqual(5,m.getNumberOfNodes())
-        for i in xrange(m.getNumberOfNodes()):
+        for i in range(m.getNumberOfNodes()):
             self.assertEqual((i,),m.getLocationFromNodeId(i))
             pass
         self.assertRaises(InterpKernelException,m.getLocationFromCellId,5)
@@ -3390,7 +3399,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         st0=d.repr() ; st1=str(d) ; st2=d.reprNotTooLong()
         self.assertNotEqual(st0,st1) # 1001 tuples ( > 1000) -> str(d)==d.reprNotTooLong()
         self.assertEqual(st1,st2)
-        self.assertIn(len(st2),xrange(0,1000)) # no more than 1000 characters
+        self.assertIn(len(st2), list(range(0, 1000)))  # no more than 1000 characters
         ## Now for DataArrayInt
         d=DataArrayInt(2000) ; d.iota() ; d.rearrange(2)
         st0=d.repr() ; st1=str(d) ; st2=d.reprNotTooLong()
@@ -3401,7 +3410,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         st0=d.repr() ; st1=str(d) ; st2=d.reprNotTooLong()
         self.assertNotEqual(st0,st1) # 1001 tuples ( > 1000) -> str(d)==d.reprNotTooLong()
         self.assertEqual(st1,st2)
-        self.assertIn(len(st2),xrange(0,1000)) # no more than 1000 characters
+        self.assertIn(len(st2), list(range(0, 1000)))  # no more than 1000 characters
         pass
 
     def testExtrudedMeshWithoutZipCoords1(self):
@@ -3475,8 +3484,8 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         coo=DataArrayDouble([(0,2),(2,0),(6,4),(4,9)])
         m=MEDCoupling1SGTUMesh("mesh",NORM_QUAD4) ; m.setCoords(coo)
         exp3=sqrt(85.)
-        for delta in xrange(4):
-            c=[(elt+delta)%4 for elt in xrange(4)]
+        for delta in range(4):
+            c = [(elt + delta) % 4 for elt in range(4)]
             m.setNodalConnectivity(DataArrayInt(c))
             self.assertAlmostEqual(m.computeDiameterField().getArray()[0],exp3,12)
             m2=m.buildUnstructured() ; m2.convertLinearCellsToQuadratic(0)
@@ -3493,8 +3502,8 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         # QUAD4 - spacedim = 3
         coo=DataArrayDouble([(0.26570992384234871,2.0405889913271817,-0.079134238105786903),(2.3739976619218064,0.15779148692781009,0.021842842914139737),(6.1207841448393197,4.3755532938679655,0.43666375769970678),(3.8363255342943359,9.2521096041694229,0.41551170895942313)])
         m=MEDCoupling1SGTUMesh("mesh",NORM_QUAD4) ; m.setCoords(coo)
-        for delta in xrange(4):
-            c=[(elt+delta)%4 for elt in xrange(4)]
+        for delta in range(4):
+            c = [(elt + delta) % 4 for elt in range(4)]
             m.setNodalConnectivity(DataArrayInt(c))
             self.assertAlmostEqual(m.computeDiameterField().getArray()[0],exp3,12)
             m2=m.buildUnstructured() ; m2.convertLinearCellsToQuadratic(0)
@@ -3514,8 +3523,8 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         m=MEDCoupling1SGTUMesh("mesh",NORM_PENTA6) ; m.setCoords(coo)
         exp4=2.5041256256889888
         self.assertAlmostEqual(exp4,coo.buildEuclidianDistanceDenseMatrix().getMaxValue()[0],12)# <- the definition of diameter
-        for delta in xrange(3):
-            c=[(elt+delta)%3 for elt in xrange(3)]
+        for delta in range(3):
+            c = [(elt + delta) % 3 for elt in range(3)]
             c+=[elt+3 for elt in c]
             m.setNodalConnectivity(DataArrayInt(c))
             self.assertAlmostEqual(m.computeDiameterField().getArray()[0],exp4,12)
@@ -3532,8 +3541,8 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         m=MEDCoupling1SGTUMesh("mesh",NORM_HEXA8) ; m.setCoords(coo)
         exp5=2.5366409441884215
         self.assertAlmostEqual(exp5,coo.buildEuclidianDistanceDenseMatrix().getMaxValue()[0],12)# <- the definition of diameter
-        for delta in xrange(4):
-            c=[(elt+delta)%4 for elt in xrange(4)]
+        for delta in range(4):
+            c = [(elt + delta) % 4 for elt in range(4)]
             c+=[elt+4 for elt in c]
             m.setNodalConnectivity(DataArrayInt(c))
             self.assertAlmostEqual(m.computeDiameterField().getArray()[0],exp5,12)
@@ -3550,8 +3559,8 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         m=MEDCoupling1SGTUMesh("mesh",NORM_PYRA5) ; m.setCoords(coo)
         exp6=2.1558368027391386
         self.assertAlmostEqual(exp6,coo.buildEuclidianDistanceDenseMatrix().getMaxValue()[0],12)# <- the definition of diameter
-        for delta in xrange(4):
-            c=[(elt+delta)%4 for elt in xrange(4)]
+        for delta in range(4):
+            c = [(elt + delta) % 4 for elt in range(4)]
             c+=[4]
             m.setNodalConnectivity(DataArrayInt(c))
             self.assertAlmostEqual(m.computeDiameterField().getArray()[0],exp6,12)
@@ -3564,8 +3573,8 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         m=MEDCoupling1SGTUMesh("mesh",NORM_PYRA5) ; m.setCoords(coo)
         exp7=1.4413563787228953
         self.assertAlmostEqual(exp7,coo.buildEuclidianDistanceDenseMatrix().getMaxValue()[0],12)# <- the definition of diameter
-        for delta in xrange(4):
-            c=[(elt+delta)%4 for elt in xrange(4)]
+        for delta in range(4):
+            c = [(elt + delta) % 4 for elt in range(4)]
             c+=[4]
             m.setNodalConnectivity(DataArrayInt(c))
             self.assertAlmostEqual(m.computeDiameterField().getArray()[0],exp7,12)
@@ -3579,7 +3588,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         exp8=1.7131322579364157
         self.assertAlmostEqual(exp8,coo.buildEuclidianDistanceDenseMatrix().getMaxValue()[0],12)# <- the definition of diameter
         for c in [[0,1,2,3],[0,3,2,1],[0,1,3,2],[0,2,3,1],[0,3,1,2],[0,2,1,3]]:
-            for i in xrange(4):
+            for i in range(4):
                 m.setNodalConnectivity(DataArrayInt([(elt+i)%4 for elt in c]))
                 self.assertAlmostEqual(m.computeDiameterField().getArray()[0],exp8,12)
                 m2=m.buildUnstructured() ; m2.convertLinearCellsToQuadratic(0)
index a1a557ecc487f7d8059e1240bd00d53a7d244b70..221b99fef051a131d9bbabdb61cbda44483133b0 100644 (file)
@@ -2478,13 +2478,12 @@ namespace MEDCoupling
         if(!PySlice_Check(slic))
           throw INTERP_KERNEL::Exception("ExtractFromIndexedArraysSlice (wrap) : the first param is not a pyslice !");
         Py_ssize_t strt=2,stp=2,step=2;
-        PySliceObject *sliC=reinterpret_cast<PySliceObject *>(slic);
         if(!arrIndxIn)
           throw INTERP_KERNEL::Exception("ExtractFromIndexedArraysSlice (wrap) : last array is null !");
         arrIndxIn->checkAllocated();
         if(arrIndxIn->getNumberOfComponents()!=1)
           throw INTERP_KERNEL::Exception("ExtractFromIndexedArraysSlice (wrap) : number of components of last argument must be equal to one !");
-        GetIndicesOfSlice(sliC,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step,"ExtractFromIndexedArraysSlice (wrap) : Invalid slice regarding nb of elements !");
+        GetIndicesOfSlice(slic,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step,"ExtractFromIndexedArraysSlice (wrap) : Invalid slice regarding nb of elements !");
         DataArrayInt *arrOut=0,*arrIndexOut=0;
         MEDCouplingUMesh::ExtractFromIndexedArraysSlice(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
         PyObject *ret=PyTuple_New(2);
@@ -6016,6 +6015,6 @@ namespace MEDCoupling
 import os
 __filename=os.environ.get('PYTHONSTARTUP')
 if __filename and os.path.isfile(__filename):
-  execfile(__filename)
+  exec(open(__filename).read())
   pass
 %}
index 8cb326457a0aecbfe9be8f1a0e537dd50298ecf2..00ec3d71d33633333523f22f88ea2b996c961a95 100644 (file)
 #ifndef __MEDCOUPLINGDATAARRAYTYPEMAPS_I__
 #define __MEDCOUPLINGDATAARRAYTYPEMAPS_I__
 
+#if PY_VERSION_HEX >= 0x03000000
+#define PyInt_AS_LONG PyLong_AS_LONG
+#endif
+
 #include "InterpKernelAutoPtr.hxx"
 
 #include <sstream>
  * This method is an extention of PySlice_GetIndices but less
  * open than PySlice_GetIndicesEx that accepts too many situations.
  */
-void GetIndicesOfSlice(PySliceObject *slice, Py_ssize_t length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, const char *msgInCaseOfFailure)
+void GetIndicesOfSlice(PyObject *slice, Py_ssize_t length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, const char *msgInCaseOfFailure)
 {
-  int ret(PySlice_GetIndices(slice,length,start,stop,step));
+  int ret(PySlice_GetIndices(
+#if PY_VERSION_HEX >= 0x03000000
+        slice,
+#else
+        reinterpret_cast<PySliceObject *>(slice),
+#endif
+        length,start,stop,step));
   if(ret==0)
     return ;
   if(*step>0 && *start==*stop && length==*start)
@@ -42,9 +52,15 @@ void GetIndicesOfSlice(PySliceObject *slice, Py_ssize_t length, Py_ssize_t *star
 /*!
  * This method allows to retrieve slice info from \a slice.
  */
-void GetIndicesOfSliceExplicitely(PySliceObject *slice, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, const char *msgInCaseOfFailure)
+void GetIndicesOfSliceExplicitely(PyObject *slice, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, const char *msgInCaseOfFailure)
 {
-  int ret(PySlice_GetIndices(slice,std::numeric_limits<int>::max(),start,stop,step));
+  int ret(PySlice_GetIndices(
+#if PY_VERSION_HEX >= 0x03000000
+        slice,
+#else
+        reinterpret_cast<PySliceObject *>(slice),
+#endif
+        std::numeric_limits<int>::max(),start,stop,step));
   if(ret==0)
     {
       if(*start!=std::numeric_limits<int>::max() && *stop!=std::numeric_limits<int>::max())
@@ -801,12 +817,17 @@ static void convertPyToVectorPairStringInt(PyObject *pyLi, std::vector< std::pai
               if(sz2!=2)
                 throw INTERP_KERNEL::Exception(msg);
               PyObject *o_0=PyTuple_GetItem(o,0);
-              if(!PyString_Check(o_0))
-                throw INTERP_KERNEL::Exception(msg);
               PyObject *o_1=PyTuple_GetItem(o,1);
+              if(PyString_Check(o_0))
+                arr[i].first=PyString_AsString(o_0);
+#if PY_VERSION_HEX >= 0x03000000
+              else if(PyUnicode_Check(o_0))
+                arr[i].first=PyUnicode_AsUTF8(o_0);
+#endif
+              else
+                throw INTERP_KERNEL::Exception(msg);
               if(!PyInt_Check(o_1))
                 throw INTERP_KERNEL::Exception(msg);
-              arr[i].first=PyString_AsString(o_0);
               arr[i].second=(int)PyInt_AS_LONG(o_1);
             }
           else
@@ -826,12 +847,17 @@ static void convertPyToVectorPairStringInt(PyObject *pyLi, std::vector< std::pai
               if(sz2!=2)
                 throw INTERP_KERNEL::Exception(msg);
               PyObject *o_0=PyTuple_GetItem(o,0);
-              if(!PyString_Check(o_0))
-                throw INTERP_KERNEL::Exception(msg);
               PyObject *o_1=PyTuple_GetItem(o,1);
+              if(PyString_Check(o_0))
+                arr[i].first=PyString_AsString(o_0);
+#if PY_VERSION_HEX >= 0x03000000
+              else if(PyUnicode_Check(o_0))
+                arr[i].first=PyUnicode_AsUTF8(o_0);
+#endif
+              else
+                throw INTERP_KERNEL::Exception(msg);
               if(!PyInt_Check(o_1))
                 throw INTERP_KERNEL::Exception(msg);
-              arr[i].first=PyString_AsString(o_0);
               arr[i].second=(int)PyInt_AS_LONG(o_1);
             }
           else
@@ -1078,6 +1104,10 @@ static bool fillStringVector(PyObject *pyLi, std::vector<std::string>& vec) thro
           PyObject *o=PyList_GetItem(pyLi,i);
           if(PyString_Check(o))
             vec[i]=PyString_AsString(o);
+#if PY_VERSION_HEX >= 0x03000000
+          else if(PyUnicode_Check(o))
+            vec[i]=PyUnicode_AsUTF8(o);
+#endif
           else
             return false;
         }
@@ -1092,6 +1122,10 @@ static bool fillStringVector(PyObject *pyLi, std::vector<std::string>& vec) thro
           PyObject *o=PyTuple_GetItem(pyLi,i);
           if(PyString_Check(o))
             vec[i]=PyString_AsString(o);
+#if PY_VERSION_HEX >= 0x03000000
+          else if(PyUnicode_Check(o))
+            vec[i]=PyUnicode_AsUTF8(o);
+#endif
           else
             return false;
         }
@@ -1209,9 +1243,14 @@ static void convertPyToVectorPairStringVecString(PyObject *pyLi, std::vector< st
                 throw INTERP_KERNEL::Exception(msg);
               std::pair<std::string, std::vector<std::string> > item;
               PyObject *o_0=PyTuple_GetItem(o,0);
-              if(!PyString_Check(o_0))
+              if(PyString_Check(o_0))
+                item.first=PyString_AsString(o_0);
+#if PY_VERSION_HEX >= 0x03000000
+              else if(PyUnicode_Check(o_0))
+                item.first=PyUnicode_AsUTF8(o_0);
+#endif
+              else
                 throw INTERP_KERNEL::Exception(msg);
-              item.first=PyString_AsString(o_0);
               PyObject *o_1=PyTuple_GetItem(o,1);
               if(!fillStringVector(o_1,item.second))
                 throw INTERP_KERNEL::Exception(msg);
@@ -1235,9 +1274,14 @@ static void convertPyToVectorPairStringVecString(PyObject *pyLi, std::vector< st
                 throw INTERP_KERNEL::Exception(msg);
               std::pair<std::string, std::vector<std::string> > item;
               PyObject *o_0=PyTuple_GetItem(o,0);
-              if(!PyString_Check(o_0))
+              if(PyString_Check(o_0))
+                item.first=PyString_AsString(o_0);
+#if PY_VERSION_HEX >= 0x03000000
+              else if(PyUnicode_Check(o_0))
+                item.first=PyUnicode_AsUTF8(o_0);
+#endif
+              else
                 throw INTERP_KERNEL::Exception(msg);
-              item.first=PyString_AsString(o_0);
               PyObject *o_1=PyTuple_GetItem(o,1);
               if(!fillStringVector(o_1,item.second))
                 throw INTERP_KERNEL::Exception(msg);
@@ -1777,8 +1821,7 @@ static void convertObjToPossibleCpp2(PyObject *value, int nbelem, int& sw, int&
   if(PySlice_Check(value))
     {
       Py_ssize_t strt=2,stp=2,step=2;
-      PySliceObject *oC=reinterpret_cast<PySliceObject *>(value);
-      GetIndicesOfSlice(oC,nbelem,&strt,&stp,&step,"Slice in subscriptable object DataArray invalid !");
+      GetIndicesOfSlice(value,nbelem,&strt,&stp,&step,"Slice in subscriptable object DataArray invalid !");
       p.first=strt;
       p.second.first=stp;
       p.second.second=step;
@@ -1882,8 +1925,7 @@ static void convertObjToPossibleCpp22(PyObject *value, int nbelem, int& sw, int&
   if(PySlice_Check(value))
     {
       Py_ssize_t strt=2,stp=2,step=2;
-      PySliceObject *oC=reinterpret_cast<PySliceObject *>(value);
-      GetIndicesOfSlice(oC,nbelem,&strt,&stp,&step,"Slice in subscriptable object DataArray invalid !");
+      GetIndicesOfSlice(value,nbelem,&strt,&stp,&step,"Slice in subscriptable object DataArray invalid !");
       p.first=strt;
       p.second.first=stp;
       p.second.second=step;
@@ -1926,6 +1968,25 @@ static void convertObjToPossibleCpp6(PyObject *value, int& sw, char& cTyp, std::
           return;
         }
     }
+#if PY_VERSION_HEX >= 0x03000000
+  if(PyUnicode_Check(value))
+    {
+      Py_ssize_t sz;
+      const char *pt = PyUnicode_AsUTF8AndSize(value, &sz);
+      if(sz==1)
+        {
+          cTyp=pt[0];
+          sw=1;
+          return;
+        }
+      else
+        {
+          sType=pt;
+          sw=2;
+          return;
+        }
+    }
+#endif
   if(PyTuple_Check(value))
     {
       int size=PyTuple_Size(value);
@@ -1935,6 +1996,10 @@ static void convertObjToPossibleCpp6(PyObject *value, int& sw, char& cTyp, std::
           PyObject *o=PyTuple_GetItem(value,i);
           if(PyString_Check(o))
             vsType[i]=PyString_AsString(o);
+#if PY_VERSION_HEX >= 0x03000000
+          else if(PyUnicode_Check(o))
+            vsType[i]=PyUnicode_AsUTF8(o);
+#endif
           else
             {
               std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not a string ! only tuples of strings accepted !";
@@ -1953,6 +2018,10 @@ static void convertObjToPossibleCpp6(PyObject *value, int& sw, char& cTyp, std::
           PyObject *o=PyList_GetItem(value,i);
           if(PyString_Check(o))
             vsType[i]=PyString_AsString(o);
+#if PY_VERSION_HEX >= 0x03000000
+          else if(PyUnicode_Check(o))
+            vsType[i]=PyUnicode_AsUTF8(o);
+#endif
           else
             {
               std::ostringstream oss; oss << "List as been detected but element #" << i << " is not string ! only lists of strings accepted !";
index 9d68678e4340ee545bfb50dc01d6e40a0ac02469..d39042b1e6ac9b47aa239cff489c926b7489e74e 100644 (file)
@@ -17,6 +17,9 @@
 #
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
+from __future__ import division
+# Uncomment to be coherent with Python 3
+# from __future__ import unicode_literals
 
 from MEDCoupling import *
 
@@ -60,7 +63,7 @@ class MEDCouplingDataForTest:
         targetMesh=MEDCouplingUMesh.New();
         targetMesh.setMeshDimension(3);
         targetMesh.allocateCells(12);
-        for i in xrange(8):
+        for i in range(8):
             targetMesh.insertNextCell(NORM_HEXA8,8,targetConn[8*i:8*i+8]);
             pass
         targetMesh.finishInsertingCells();
@@ -225,7 +228,7 @@ class MEDCouplingDataForTest:
         targetMesh=MEDCouplingUMesh.New();
         targetMesh.setMeshDimension(3);
         targetMesh.allocateCells(12);
-        for i in xrange(8):
+        for i in range(8):
             targetMesh.insertNextCell(NORM_HEXA8,8,targetConn[8*i:8*(i+1)]);
             pass
         targetMesh.finishInsertingCells();
@@ -284,7 +287,7 @@ class MEDCouplingDataForTest:
         ret=MEDCouplingUMesh.New("1DSourceMesh",1);
         ret.allocateCells(4);
         conn=[0,1,2,3,1,2,3,4]
-        for i in xrange(4):
+        for i in range(4):
             ret.insertNextCell(NORM_SEG2,2,conn[2*i:2*i+2]);
             pass
         ret.finishInsertingCells();
@@ -541,7 +544,7 @@ class MEDCouplingDataForTest:
               15,24,25,16,12,21,22,13,
               16,25,26,17,13,22,23,14];
         mesh.allocateCells(8);
-        for i in xrange(8):
+        for i in range(8):
             mesh.insertNextCell(NORM_HEXA8,8,conn[8*i:8*(i+1)])
             pass
         mesh.finishInsertingCells();
@@ -558,7 +561,7 @@ class MEDCouplingDataForTest:
         mesh.setCoords(coo);
         mesh2.setCoords(coo);
         mesh.allocateCells(16);
-        for i in xrange(12):
+        for i in range(12):
             mesh.insertNextCell(NORM_TETRA4,4,conn[4*i:4*i+4])
             pass
         mesh.insertNextCell(NORM_PYRA5,5,conn[48:53])
@@ -569,7 +572,7 @@ class MEDCouplingDataForTest:
         #[1,34,29,23,41,32]
         conn2=[0,5,1,14,18,17,8,7,4,9,5,2, 12,8,9,13,6,7,8,9]
         mesh2.allocateCells(6);
-        for i in xrange(4):
+        for i in range(4):
             mesh2.insertNextCell(NORM_TRI3,3,conn2[3*i:3*i+3])
             pass
         mesh2.insertNextCell(NORM_QUAD4,4,conn2[12:16])
@@ -586,24 +589,24 @@ class MEDCouplingDataForTest:
         m.setCoords(coo)
         m.allocateCells()
         conn=[[11,8,13],[11,13,12],[8,9,13],[9,14,13],[9,10,15],[9,15,14],[12,13,19],[13,16,19],[13,14,17],[13,17,16],[14,15,17],[15,18,17],[0,1,4,3],[1,2,5,4],[2,6,7,5],[3,4,8,11],[4,5,9,8],[5,7,10,9],[20,22,21,28,41,51],[21,25,20,29,42,51],[22,23,21,30,43,41],[23,27,21,31,35,43],[23,38,24,32,44,52],[24,27,23,33,31,52],[25,21,50,29,45,53],[21,39,50,34,46,45],[21,27,26,35,47,54],[26,39,21,36,34,54],[27,24,26,33,48,47],[24,40,26,37,49,48],[50,39,56,55,46,62,58,71],[39,26,57,56,36,63,59,62],[26,40,61,57,49,64,60,63],[55,56,17,18,58,65,68,72],[56,57,16,17,59,66,69,65],[57,61,19,16,60,67,70,66]]
-        for i in xrange(0,12):
+        for i in range(0, 12):
             m.insertNextCell(NORM_TRI3,conn[i])
             pass
-        for i in xrange(12,18):
+        for i in range(12, 18):
             m.insertNextCell(NORM_QUAD4,conn[i])
             pass
-        for i in xrange(18,30):
+        for i in range(18, 30):
             m.insertNextCell(NORM_TRI6,conn[i])
             pass
-        for i in xrange(30,36):
+        for i in range(30, 36):
             m.insertNextCell(NORM_QUAD8,conn[i])
             pass
         fff=MEDCouplingFieldDouble.New(ON_GAUSS_PT) ; fff.setName("CH1RB") ; fff.setNature(IntensiveMaximum)
         fff.setMesh(m)
-        fff.setGaussLocalizationOnCells(range(0,12),[0.,0.,1.,0.,0.,1.],[0.3333333333333333,0.3333333333333333],[0.5])
-        fff.setGaussLocalizationOnCells(range(12,18),[-1.,-1.,1.,-1.,1.,1.,-1.,1.],[-0.577350269189626,-0.577350269189626,0.577350269189626,-0.577350269189626,0.577350269189626,0.577350269189626,-0.577350269189626,0.577350269189626],[1.,1.,1.,1.])
-        fff.setGaussLocalizationOnCells(range(18,30),[0.,0.,1.,0.,0.,1.,0.5, 0.,0.5, 0.5, 0.,0.5],[0.16666666666666666,0.16666666666666666,0.6666666666666666,0.16666666666666666,0.16666666666666666,0.6666666666666666],[0.16666666666666666,0.16666666666666666,0.16666666666666666])
-        fff.setGaussLocalizationOnCells(range(30,36),[-1.,-1.,1.,-1.,1.,1.,-1.,1.,0.,-1.,1.,0.,0.,1.,-1.,0.],[-0.774596669241483,-0.774596669241483,0.774596669241483,-0.774596669241483,0.774596669241483,0.774596669241483,-0.774596669241483,0.774596669241483,0.0,-0.774596669241483,0.774596669241483,0.0,0.0,0.774596669241483,-0.774596669241483,0.0,0.0,0.0],[0.30864197530864196,0.30864197530864196,0.30864197530864196,0.30864197530864196,0.49382716049382713,0.49382716049382713,0.49382716049382713,0.49382716049382713,0.7901234567901234])
+        fff.setGaussLocalizationOnCells(list(range(0, 12)), [0., 0., 1., 0., 0., 1.], [0.3333333333333333, 0.3333333333333333], [0.5])
+        fff.setGaussLocalizationOnCells(list(range(12, 18)), [-1., -1., 1., -1., 1., 1., -1., 1.], [-0.577350269189626, -0.577350269189626, 0.577350269189626, -0.577350269189626, 0.577350269189626, 0.577350269189626, -0.577350269189626, 0.577350269189626], [1., 1., 1., 1.])
+        fff.setGaussLocalizationOnCells(list(range(18, 30)), [0., 0., 1., 0., 0., 1., 0.5, 0., 0.5, 0.5, 0., 0.5], [0.16666666666666666, 0.16666666666666666, 0.6666666666666666, 0.16666666666666666, 0.16666666666666666, 0.6666666666666666], [0.16666666666666666, 0.16666666666666666, 0.16666666666666666])
+        fff.setGaussLocalizationOnCells(list(range(30, 36)), [-1., -1., 1., -1., 1., 1., -1., 1., 0., -1., 1., 0., 0., 1., -1., 0.], [-0.774596669241483, -0.774596669241483, 0.774596669241483, -0.774596669241483, 0.774596669241483, 0.774596669241483, -0.774596669241483, 0.774596669241483, 0.0, -0.774596669241483, 0.774596669241483, 0.0, 0.0, 0.774596669241483, -0.774596669241483, 0.0, 0.0, 0.0], [0.30864197530864196, 0.30864197530864196, 0.30864197530864196, 0.30864197530864196, 0.49382716049382713, 0.49382716049382713, 0.49382716049382713, 0.49382716049382713, 0.7901234567901234])
         return MEDCouplingFieldTemplate(fff)
 
     # 2D usecase2 for interpolation Gauss Pt-> Gauss Pt. Coming from ASTER : Please, do not touch
@@ -615,24 +618,24 @@ class MEDCouplingDataForTest:
         m.setCoords(coo)
         m.allocateCells(0)
         conn=[[198,194,200],[198,200,199],[194,195,200],[195,201,200],[195,196,202],[195,202,201],[196,197,202],[197,203,202],[199,200,205],[199,205,204],[200,201,205],[201,206,205],[201,202,207],[201,207,206],[202,203,207],[203,208,207],[204,205,210],[204,210,209],[205,206,210],[206,211,210],[206,207,212],[206,212,211],[207,208,212],[208,213,212],[209,210,215],[209,215,214],[210,211,215],[211,216,215],[211,212,217],[211,217,216],[212,213,217],[213,218,217],[214,215,157],[214,157,158],[215,216,157],[216,156,157],[216,217,155],[216,155,156],[217,218,155],[218,163,155],[169,170,174,173],[170,171,175,174],[171,172,176,175],[172,189,190,176],[173,174,178,177],[174,175,179,178],[175,176,180,179],[176,190,191,180],[177,178,182,181],[178,179,183,182],[179,180,184,183],[180,191,192,184],[181,182,186,185],[182,183,187,186],[183,184,188,187],[184,192,193,188],[185,186,194,198],[186,187,195,194],[187,188,196,195],[188,193,197,196],[0,2,1,27,62,89],[1,7,0,28,63,89],[2,3,1,29,64,62],[3,9,1,30,36,64],[3,5,4,31,65,90],[4,9,3,32,30,90],[5,6,4,33,66,65],[6,11,4,34,39,66],[7,1,8,28,67,91],[8,12,7,35,68,91],[1,9,8,36,69,67],[9,14,8,37,42,69],[9,4,10,32,70,92],[10,14,9,38,37,92],[4,11,10,39,71,70],[11,16,10,40,45,71],[12,8,13,35,72,93],[13,17,12,41,73,93],[8,14,13,42,74,72],[14,19,13,43,48,74],[14,10,15,38,75,94],[15,19,14,44,43,94],[10,16,15,45,76,75],[16,21,15,46,51,76],[17,13,18,41,77,95],[18,22,17,47,78,95],[13,19,18,48,79,77],[19,24,18,49,54,79],[19,15,20,44,80,96],[20,24,19,50,49,96],[15,21,20,51,81,80],[21,26,20,52,57,81],[22,18,23,47,82,97],[23,59,22,53,83,97],[18,24,23,54,84,82],[24,60,23,55,85,84],[24,20,25,50,86,98],[25,60,24,56,55,98],[20,26,25,57,87,86],[26,61,25,58,88,87],[59,23,100,99,53,135,115,164],[23,60,101,100,85,136,116,135],[60,25,102,101,56,137,117,136],[25,61,131,102,88,138,118,137],[99,100,104,103,115,139,119,165],[100,101,105,104,116,140,120,139],[101,102,106,105,117,141,121,140],[102,131,132,106,118,142,122,141],[103,104,108,107,119,143,123,166],[104,105,109,108,120,144,124,143],[105,106,110,109,121,145,125,144],[106,132,133,110,122,146,126,145],[107,108,112,111,123,147,127,167],[108,109,113,112,124,148,128,147],[109,110,114,113,125,149,129,148],[110,133,134,114,126,150,130,149],[111,112,155,163,127,151,159,168],[112,113,156,155,128,152,160,151],[113,114,157,156,129,153,161,152],[114,134,158,157,130,154,162,153]]
-        for i in xrange(0,40):
+        for i in range(0, 40):
             m.insertNextCell(NORM_TRI3,conn[i])
             pass
-        for i in xrange(40,60):
+        for i in range(40, 60):
             m.insertNextCell(NORM_QUAD4,conn[i])
             pass
-        for i in xrange(60,100):
+        for i in range(60, 100):
             m.insertNextCell(NORM_TRI6,conn[i])
             pass
-        for i in xrange(100,120):
+        for i in range(100, 120):
             m.insertNextCell(NORM_QUAD8,conn[i])
             pass
         fff=MEDCouplingFieldDouble.New(ON_GAUSS_PT) ; fff.setName("CH2RB") ; fff.setNature(IntensiveMaximum)
         fff.setMesh(m)
-        fff.setGaussLocalizationOnCells(range(0,40),[0.,0.,1.,0.,0.,1.],[0.3333333333333333,0.3333333333333333],[0.5])
-        fff.setGaussLocalizationOnCells(range(40,60),[-1.,-1.,1.,-1.,1.,1.,-1.,1.],[-0.577350269189626,-0.577350269189626,0.577350269189626,-0.577350269189626,0.577350269189626,0.577350269189626,-0.577350269189626,0.577350269189626],[1.,1.,1.,1.])
-        fff.setGaussLocalizationOnCells(range(60,100),[0.,0.,1.,0.,0.,1.,0.5, 0.,0.5, 0.5, 0.,0.5],[0.16666666666666666,0.16666666666666666,0.6666666666666666,0.16666666666666666,0.16666666666666666,0.6666666666666666],[0.16666666666666666,0.16666666666666666,0.16666666666666666])
-        fff.setGaussLocalizationOnCells(range(100,120),[-1.,-1.,1.,-1.,1.,1.,-1.,1.,0.,-1.,1.,0.,0.,1.,-1.,0.],[-0.774596669241483,-0.774596669241483,0.774596669241483,-0.774596669241483,0.774596669241483,0.774596669241483,-0.774596669241483,0.774596669241483,0.0,-0.774596669241483,0.774596669241483,0.0,0.0,0.774596669241483,-0.774596669241483,0.0,0.0,0.0],[0.30864197530864196,0.30864197530864196,0.30864197530864196,0.30864197530864196,0.49382716049382713,0.49382716049382713,0.49382716049382713,0.49382716049382713,0.7901234567901234])
+        fff.setGaussLocalizationOnCells(list(range(0, 40)), [0., 0., 1., 0., 0., 1.], [0.3333333333333333, 0.3333333333333333], [0.5])
+        fff.setGaussLocalizationOnCells(list(range(40, 60)), [-1., -1., 1., -1., 1., 1., -1., 1.], [-0.577350269189626, -0.577350269189626, 0.577350269189626, -0.577350269189626, 0.577350269189626, 0.577350269189626, -0.577350269189626, 0.577350269189626], [1., 1., 1., 1.])
+        fff.setGaussLocalizationOnCells(list(range(60, 100)), [0., 0., 1., 0., 0., 1., 0.5, 0., 0.5, 0.5, 0., 0.5], [0.16666666666666666, 0.16666666666666666, 0.6666666666666666, 0.16666666666666666, 0.16666666666666666, 0.6666666666666666], [0.16666666666666666, 0.16666666666666666, 0.16666666666666666])
+        fff.setGaussLocalizationOnCells(list(range(100, 120)), [-1., -1., 1., -1., 1., 1., -1., 1., 0., -1., 1., 0., 0., 1., -1., 0.], [-0.774596669241483, -0.774596669241483, 0.774596669241483, -0.774596669241483, 0.774596669241483, 0.774596669241483, -0.774596669241483, 0.774596669241483, 0.0, -0.774596669241483, 0.774596669241483, 0.0, 0.0, 0.774596669241483, -0.774596669241483, 0.0, 0.0, 0.0], [0.30864197530864196, 0.30864197530864196, 0.30864197530864196, 0.30864197530864196, 0.49382716049382713, 0.49382716049382713, 0.49382716049382713, 0.49382716049382713, 0.7901234567901234])
         return MEDCouplingFieldTemplate(fff)
 
     # 3D usecase1 for interpolation Gauss Pt-> Gauss Pt. Coming from ASTER : Please, do not touch
@@ -646,7 +649,7 @@ class MEDCouplingDataForTest:
         conn=[[3,10,8,4],[19,22,23,20,14],[0,6,1,3,8,4],[4,8,10,5,9,11],[12,16,17,14,19,20],[14,20,23,15,21,24],[1,2,5,4,6,7,9,8],[12,13,15,14,17,18,21,20]]
         m.insertNextCell(NORM_TETRA4,conn[0])
         m.insertNextCell(NORM_PYRA5,conn[1])
-        for i in xrange(2,6):
+        for i in range(2, 6):
             m.insertNextCell(NORM_PENTA6,conn[i])
             pass
         m.insertNextCell(NORM_HEXA8,conn[6])
@@ -670,7 +673,7 @@ class MEDCouplingDataForTest:
         conn=[[3,10,8,4],[19,22,23,20,14],[0,6,1,3,8,4],[4,8,10,5,9,11],[12,16,17,14,19,20],[14,20,23,15,21,24],[1,2,5,4,6,7,9,8],[12,13,15,14,17,18,21,20]]
         m.insertNextCell(NORM_TETRA4,conn[0])
         m.insertNextCell(NORM_PYRA5,conn[1])
-        for i in xrange(2,6):
+        for i in range(2, 6):
             m.insertNextCell(NORM_PENTA6,conn[i])
             pass
         m.insertNextCell(NORM_HEXA8,conn[6])
@@ -683,17 +686,17 @@ class MEDCouplingDataForTest:
         fff.setGaussLocalizationOnCells([6,7],[-1.,-1.,-1.,-1.,1.,-1.,1.,1.,-1.,1.,-1.,-1.,-1.,-1.,1.,-1.,1.,1.,1.,1.,1.,1.,-1.,1.],[-0.577350269189626,-0.577350269189626,-0.577350269189626,-0.577350269189626,-0.577350269189626,0.577350269189626,-0.577350269189626,0.577350269189626,-0.577350269189626,-0.577350269189626,0.577350269189626,0.577350269189626,0.577350269189626,-0.577350269189626,-0.577350269189626,0.577350269189626,-0.577350269189626,0.577350269189626,0.577350269189626,0.577350269189626,-0.577350269189626,0.577350269189626,0.577350269189626,0.577350269189626],[1.,1.,1.,1.,1.,1.,1.,1.])
         return MEDCouplingFieldTemplate(fff)
 
-    def buildCircle(self, center_X, center_Y, radius):  
+    def buildCircle(self, center_X, center_Y, radius):
       from cmath import rect
       from math import pi  
   
-      c = [rect(radius, i*pi/4.0) for i in range(8)]
+      c = [rect(radius, i * pi / 4.0) for i in range(8)]
       coords = [c[-1].real,c[-1].imag,  c[3].real,c[3].imag,
                  c[5].real,c[5].imag,  c[1].real,c[1].imag]
-      connec = range(4) 
+      connec = list(range(4))
       baseMesh = MEDCouplingUMesh.New("circle", 2)  
       baseMesh.allocateCells(1)
-      meshCoords = DataArrayDouble.New(coords, len(coords)/2, 2)
+      meshCoords = DataArrayDouble.New(coords, len(coords) // 2, 2)
       meshCoords += (center_X, center_Y)
       baseMesh.setCoords(meshCoords)
   
@@ -705,14 +708,14 @@ class MEDCouplingDataForTest:
       from cmath import rect
       from math import pi  
   
-      c = [rect(radius, i*pi/4.0) for i in range(8)]
+      c = [rect(radius, i * pi / 4.0) for i in range(8)]
       coords = []
       for i in range(8):
           coords.extend([c[i].real,c[i].imag])
       connec = [7,5,3,1,  6,4,2,0]
       baseMesh = MEDCouplingUMesh.New("circle", 2)  
       baseMesh.allocateCells(1)
-      meshCoords = DataArrayDouble.New(coords, len(coords)/2, 2)
+      meshCoords = DataArrayDouble.New(coords, len(coords) // 2, 2)
       meshCoords += (center_X, center_Y)
       baseMesh.setCoords(meshCoords)
   
index b174ff256c36ce52e8bf5203ef7c4ecb1f7cde0f..cf44dabeaa2d50a0b60e7a5d86a00dc09421d72a 100644 (file)
@@ -17,6 +17,9 @@
 #
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
+from __future__ import division
+# Uncomment to be coherent with Python 3
+# from __future__ import unicode_literals
 
 from MEDCoupling import *
 import unittest
@@ -43,7 +46,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         fileName = "testExample_MEDCouplingFieldDouble_WriteVTK"
         fs = [ field1, field2, field3 ] # field series
         writtenFileName=MEDCouplingFieldDouble.WriteVTK( fileName, fs )
-        print "The file name with correct extension is : %s"%(writtenFileName)
+        print("The file name with correct extension is : %s"%(writtenFileName))
         #! [PySnippet_MEDCouplingFieldDouble_WriteVTK_1]
         import os
         os.remove( writtenFileName )
@@ -1478,7 +1481,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
 #! [Snippet_DataArrayInt_getTuple_1]
 #! [Snippet_DataArrayInt_getTuple_2]
         for tpl in dv:
-            print tpl
+            print(tpl)
 #! [Snippet_DataArrayInt_getTuple_2]
         return
 
@@ -1500,7 +1503,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         da.setValues(arr1,6,1)
         da2=da.invertArrayO2N2N2O(6)
         expected1=[1,3,0,5,2,4]
-        for i in xrange(6):
+        for i in range(6):
             self.assertEqual(expected1[i],da2.getIJ(i,0))
             pass
 #! [PySnippet_DataArrayInt_invertArrayO2N2N2O_1]
@@ -1513,7 +1516,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         da.setValues(arr1,6,1)
         da2=da.invertArrayN2O2O2N(7)
         expected1=[1,3,0,5,2,4,-1]
-        for i in xrange(6):
+        for i in range(6):
             self.assertEqual(expected1[i],da2.getIJ(i,0))
             pass
 #! [PySnippet_DataArrayInt_invertArrayN2O2O2N_1]
@@ -1524,7 +1527,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
 #! [PySnippet_DataArrayDouble_getIdsInRange_1]
         da=DataArrayDouble()
         da.alloc( 10, 1 )
-        da[ :, :] = range(10)
+        da[ :, :] = list(range(10))
         da2 = da.findIdsInRange( 2.5, 6 )
 #! [PySnippet_DataArrayDouble_getIdsInRange_1]
         return
@@ -1890,7 +1893,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         dv=da.getDifferentValues(2e-1)
         expected2=[2.301,1.3,0.8]
         self.assertEqual(3,dv.getNbOfElems())
-        for i in xrange(3):
+        for i in range(3):
             self.assertAlmostEqual(expected2[i],dv.getIJ(i,0),14)
             pass
 #! [Snippet_DataArrayDouble_getDifferentValues1]
@@ -2009,7 +2012,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         self.assertEqual(3,f2.getNumberOfTuples())
         self.assertEqual(2,f2.getNumberOfComponents())
         expected1=[5.,105.,4.,104.,7.,107.]
-        for i in xrange(6):
+        for i in range(6):
             self.assertAlmostEqual(f2.getIJ(0,i),expected1[i],12)
             pass
         self.assertEqual(3,f2.getMesh().getNumberOfCells())
@@ -2019,7 +2022,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         m2C=f2.getMesh()
         self.assertEqual(13,m2C.getNodalConnectivityArrayLen())
         expected2=[0.2, -0.3, 0.7, -0.3, 0.2, 0.2, 0.7, 0.2, 0.2, 0.7, 0.7, 0.7]
-        for i in xrange(12):
+        for i in range(12):
             self.assertAlmostEqual(expected2[i],m2C.getCoords().getIJ(0,i),12)
             pass
         expected3=[3,2,3,1,3,0,2,1,4,4,5,3,2]
@@ -2042,7 +2045,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         self.assertEqual(4,f2.getNumberOfTuples())
         self.assertEqual(2,f2.getNumberOfComponents())
         expected5=[4.,104.,5.,105.,7.,107.,8.,108.]
-        for i in xrange(8):
+        for i in range(8):
             self.assertAlmostEqual(f2.getIJ(0,i),expected5[i],12)
             pass
         self.assertEqual(2,f2.getMesh().getNumberOfCells())
@@ -2051,7 +2054,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         self.assertEqual(2,f2.getMesh().getMeshDimension())
         m2C=f2.getMesh()
         self.assertEqual(8,m2C.getNodalConnectivityArrayLen())
-        for i in xrange(8):#8 is not an error
+        for i in range(8):  # 8 is not an error
             self.assertAlmostEqual(expected2[i],m2C.getCoords().getIJ(0,i),12)
             pass
         self.assertEqual(expected3[:4],[int(i) for i in m2C.getNodalConnectivity()][4:])
@@ -2064,7 +2067,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         f2=f1.buildSubPart(arrr)
         self.assertEqual(4,f2.getNumberOfTuples())
         self.assertEqual(2,f2.getNumberOfComponents())
-        for i in xrange(8):
+        for i in range(8):
             self.assertAlmostEqual(f2.getIJ(0,i),expected5[i],12)
             pass
         self.assertEqual(2,f2.getMesh().getNumberOfCells())
@@ -2073,7 +2076,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         self.assertEqual(2,f2.getMesh().getMeshDimension())
         m2C=f2.getMesh()
         self.assertEqual(8,m2C.getNodalConnectivityArrayLen())
-        for i in xrange(8):#8 is not an error
+        for i in range(8):  # 8 is not an error
             self.assertAlmostEqual(expected2[i],m2C.getCoords().getIJ(0,i),12)
             pass
         self.assertEqual(expected3[:4],[int(i) for i in m2C.getNodalConnectivity()][4:8])
@@ -2084,7 +2087,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         self.assertEqual(6,f2.getNumberOfTuples())
         self.assertEqual(2,f2.getNumberOfComponents())
         expected6=[4.,104.,5.,105.,7.,107.,8.,108.,10.,110.,11.,111.]
-        for i in xrange(12):
+        for i in range(12):
             self.assertAlmostEqual(f2.getIJ(0,i),expected6[i],12)
             pass
         self.assertEqual(3,f2.getMesh().getNumberOfCells())
@@ -2093,7 +2096,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         self.assertEqual(2,f2.getMesh().getMeshDimension())
         m2C=f2.getMesh()
         self.assertEqual(13,m2C.getNodalConnectivityArrayLen())
-        for i in xrange(12):
+        for i in range(12):
             self.assertAlmostEqual(expected2[i],m2C.getCoords().getIJ(0,i),12)
             pass
         self.assertEqual(expected3[0:4],m2C.getNodalConnectivity().getValues()[4:8])
index 1640bc63b7acd614831f4b58365c976636600d51..0f9a8c5a2e45a5fa9039cca64c476390c2e8ac52 100644 (file)
@@ -25,6 +25,12 @@ DataArrayDouble.__isub__=MEDCouplingDataArrayDoubleIsub
 DataArrayDouble.__imul__=MEDCouplingDataArrayDoubleImul
 DataArrayDouble.__idiv__=MEDCouplingDataArrayDoubleIdiv
 DataArrayDouble.__ipow__=MEDCouplingDataArrayDoubleIpow
+DataArrayDouble.__truediv__=DataArrayDouble.__div__
+DataArrayDouble.__itruediv__=MEDCouplingDataArrayDoubleIdiv
+DataArrayDouble.__rtruediv__=DataArrayDouble.__rdiv__
+DataArrayDouble.__floordiv__=DataArrayDouble.__div__
+DataArrayDouble.__ifloordiv__=MEDCouplingDataArrayDoubleIdiv
+DataArrayDouble.__rfloordiv__=DataArrayDouble.__rdiv__
 
 DataArrayInt.__new__=classmethod(MEDCouplingDataArrayIntnew)
 DataArrayInt.__iadd__=MEDCouplingDataArrayIntIadd
@@ -33,6 +39,12 @@ DataArrayInt.__imul__=MEDCouplingDataArrayIntImul
 DataArrayInt.__idiv__=MEDCouplingDataArrayIntIdiv
 DataArrayInt.__imod__=MEDCouplingDataArrayIntImod
 DataArrayInt.__ipow__=MEDCouplingDataArrayIntIpow
+DataArrayInt.__truediv__=DataArrayInt.__div__
+DataArrayInt.__itruediv__=MEDCouplingDataArrayIntIdiv
+DataArrayInt.__rtruediv__=DataArrayInt.__rdiv__
+DataArrayInt.__floordiv__=DataArrayInt.__div__
+DataArrayInt.__ifloordiv__=MEDCouplingDataArrayIntIdiv
+DataArrayInt.__rfloordiv__=DataArrayInt.__rdiv__
 
 DataArrayByte.__new__=classmethod(MEDCouplingDataArrayBytenew)
 
@@ -41,16 +53,26 @@ MEDCouplingFieldDouble.__isub__=MEDCouplingFieldDoubleIsub
 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
 
 DataArrayDoubleTuple.__iadd__=MEDCouplingDataArrayDoubleTupleIadd
 DataArrayDoubleTuple.__isub__=MEDCouplingDataArrayDoubleTupleIsub
 DataArrayDoubleTuple.__imul__=MEDCouplingDataArrayDoubleTupleImul
 DataArrayDoubleTuple.__idiv__=MEDCouplingDataArrayDoubleTupleIdiv
+DataArrayDoubleTuple.__itruediv__=MEDCouplingDataArrayDoubleTupleIdiv
+DataArrayDoubleTuple.__ifloordiv__=MEDCouplingDataArrayDoubleTupleIdiv
 
 DataArrayIntTuple.__iadd__=MEDCouplingDataArrayIntTupleIadd
 DataArrayIntTuple.__isub__=MEDCouplingDataArrayIntTupleIsub
 DataArrayIntTuple.__imul__=MEDCouplingDataArrayIntTupleImul
 DataArrayIntTuple.__idiv__=MEDCouplingDataArrayIntTupleIdiv
+DataArrayIntTuple.__itruediv__=MEDCouplingDataArrayIntTupleIdiv
+DataArrayIntTuple.__ifloordiv__=MEDCouplingDataArrayIntTupleIdiv
 DataArrayIntTuple.__imod__=MEDCouplingDataArrayIntTupleImod
 
 DenseMatrix.__iadd__=ParaMEDMEMDenseMatrixIadd
@@ -65,6 +87,12 @@ 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
index 4029b5db677a2ae527cb7f830243abd8325adf74..df097c026449bc2210dd03c9c7262843bf6b25e8 100644 (file)
@@ -17,6 +17,7 @@
 #
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
+from __future__ import division
 
 from MEDCoupling import *
 import unittest
@@ -25,6 +26,10 @@ from datetime import datetime
 from MEDCouplingDataForTest import MEDCouplingDataForTest
 import rlcompleter,readline # this line has to be here, to ensure a usability of MEDCoupling/MEDLoader. B4 removing it please notify to anthony.geay@cea.fr
 
+import sys
+if sys.version_info.major < 3:
+  range = xrange
+
 class MEDCouplingIntersectTest(unittest.TestCase):
     def testSwig2NonRegressionBugIntersectMeshes1(self):
         src=MEDCouplingUMesh("src",2)
@@ -79,7 +84,7 @@ class MEDCouplingIntersectTest(unittest.TestCase):
         self.assertEqual(9,m3.getNodalConnectivityIndex().getNumberOfTuples());
         self.assertEqual(expected3,m3.getNodalConnectivity().getValues());
         self.assertEqual(expected4,m3.getNodalConnectivityIndex().getValues());
-        for i in xrange(44):
+        for i in range(44):
             self.assertAlmostEqual(expected5[i],m3.getCoords().getIJ(0,i),12);
             pass
         pass
@@ -124,7 +129,7 @@ class MEDCouplingIntersectTest(unittest.TestCase):
         self.assertEqual(10,m3.getNodalConnectivityIndex().getNumberOfTuples());
         self.assertEqual(expected3,m3.getNodalConnectivity().getValues());
         self.assertEqual(expected4,m3.getNodalConnectivityIndex().getValues());
-        for i in xrange(44):
+        for i in range(44):
             self.assertAlmostEqual(expected5[i],m3.getCoords().getIJ(0,i),12);
             pass
         pass
@@ -153,7 +158,7 @@ class MEDCouplingIntersectTest(unittest.TestCase):
         m2=MEDCouplingUMesh.New();
         m2.setMeshDimension(2);
         m2.allocateCells(8);
-        for i in xrange(8):
+        for i in range(8):
             m2.insertNextCell(NORM_QUAD4,4,m2Conn[4*i:4*(i+1)])
             pass
         m2.finishInsertingCells();
@@ -180,7 +185,7 @@ class MEDCouplingIntersectTest(unittest.TestCase):
         self.assertEqual(17,m3.getNodalConnectivityIndex().getNumberOfTuples());
         self.assertEqual(expected3,m3.getNodalConnectivity().getValues());
         self.assertEqual(expected4,m3.getNodalConnectivityIndex().getValues());
-        for i in xrange(208):
+        for i in range(208):
             self.assertAlmostEqual(expected5[i],m3.getCoords().getIJ(0,i),12);
             pass
         pass
@@ -209,7 +214,7 @@ class MEDCouplingIntersectTest(unittest.TestCase):
         m2=MEDCouplingUMesh.New();
         m2.setMeshDimension(2);
         m2.allocateCells(8);
-        for i in xrange(8):
+        for i in range(8):
             m2.insertNextCell(NORM_QUAD4,4,m2Conn[4*i:4*(i+1)])
             pass
         m2.finishInsertingCells();
@@ -236,7 +241,7 @@ class MEDCouplingIntersectTest(unittest.TestCase):
         self.assertEqual(17,m3.getNodalConnectivityIndex().getNumberOfTuples());
         self.assertEqual(expected3,m3.getNodalConnectivity().getValues());
         self.assertEqual(expected4,m3.getNodalConnectivityIndex().getValues());
-        for i in xrange(208):
+        for i in range(208):
             self.assertAlmostEqual(expected5[i],m3.getCoords().getIJ(0,i),12);
             pass
         pass
@@ -269,7 +274,7 @@ class MEDCouplingIntersectTest(unittest.TestCase):
         expected1=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,16,16,17,18,19,19,20,20,20,20,20,21,21,22,23,23,24,24,24,24,24,25,25,26,27,27,28,28,28,28,28,29,29,30,31,31,32,32,32,32,32,32,32,32,32,33,33,33,34,35,35,35,36,36,36,36,36,37,37,38,39,39,40,40,40,40,40,41,41,42,43,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59]
         expected2=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,2,-1,-1,-1,0,-1,0,2,4,5,-1,4,-1,-1,0,-1,0,2,4,5,-1,4,-1,-1,0,-1,0,2,4,5,-1,4,-1,-1,0,-1,0,1,2,3,4,5,6,7,-1,4,6,-1,-1,0,1,-1,1,3,6,7,-1,6,-1,-1,1,-1,1,3,6,7,-1,6,-1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]
         f3=m3.getMeasureField(False).getArray().getValues();
-        for i in xrange(105):
+        for i in range(105):
             self.assertAlmostEqual(areaExpected[i],f3[i],10)
             pass
         self.assertEqual(expected1,d1.getValues())
@@ -340,7 +345,7 @@ class MEDCouplingIntersectTest(unittest.TestCase):
 
             baseMesh = MEDCouplingUMesh.New("box_circle", 2)
             baseMesh.allocateCells(2)
-            meshCoords = DataArrayDouble.New(coords, len(coords)/2, 2)
+            meshCoords = DataArrayDouble.New(coords, len(coords) // 2, 2)
             meshCoords.setInfoOnComponents(["X [au]", "Y [au]"])
             baseMesh.setCoords(meshCoords)
 
@@ -368,10 +373,10 @@ class MEDCouplingIntersectTest(unittest.TestCase):
     def testIntersect2DMeshesTmp7(self):
         eps = 1.0e-8
         coords = [-0.5,-0.5,   -0.5, 0.5, 0.5, 0.5,    0.5,-0.5]
-        connec = range(4)
+        connec = list(range(4))
         m1 = MEDCouplingUMesh.New("box", 2)
         m1.allocateCells(1)
-        meshCoords = DataArrayDouble.New(coords, len(coords)/2, 2)
+        meshCoords = DataArrayDouble.New(coords, len(coords) // 2, 2)
         m1.setCoords(meshCoords)
         m1.insertNextCell(NORM_POLYGON, connec)
         m1.finishInsertingCells()
@@ -417,7 +422,7 @@ class MEDCouplingIntersectTest(unittest.TestCase):
         i=MEDCouplingIMesh("mesh",2,[5,5],[0.,0.],[1.,1.])
         m1=i.buildUnstructured()
         m2=MEDCouplingUMesh("mesh",1) ; m2.setCoords(DataArrayDouble([0.5,2.,2.25,2.,2.5,2.,2.75,2.,3.,2.,4.,2.,5.,2.],7,2)) ; m2.allocateCells()
-        for i in xrange(6):
+        for i in range(6):
             m2.insertNextCell(NORM_SEG2,[i,i+1])
             pass
         a,b,c,d=MEDCouplingUMesh.Intersect2DMeshWith1DLine(m1,m2,1e-12)
@@ -437,7 +442,7 @@ class MEDCouplingIntersectTest(unittest.TestCase):
         i=MEDCouplingIMesh("mesh",2,[5,5],[0.,0.],[1.,1.])
         m1=i.buildUnstructured()
         m2=MEDCouplingUMesh("mesh",1) ; m2.setCoords(DataArrayDouble([(0.75,3.25),(0.5,3.5),(0.25,3.25)])) ; m2.allocateCells()
-        for i in xrange(2):
+        for i in range(2):
             m2.insertNextCell(NORM_SEG2,[i,i+1])
             pass
         a,b,c,d=MEDCouplingUMesh.Intersect2DMeshWith1DLine(m1,m2,1e-12)
@@ -480,7 +485,7 @@ class MEDCouplingIntersectTest(unittest.TestCase):
         i=MEDCouplingIMesh("mesh",2,[5,5],[0.,0.],[1.,1.])
         m1=i.buildUnstructured()
         m2=MEDCouplingUMesh("mesh",1) ; m2.setCoords(DataArrayDouble([(1.,0.),(3.,2.),(1.,4.)])) ; m2.allocateCells()
-        for i in xrange(2):
+        for i in range(2):
             m2.insertNextCell(NORM_SEG2,[i,i+1])
             pass
         a,b,c,d=MEDCouplingUMesh.Intersect2DMeshWith1DLine(m1,m2,1e-12)
@@ -612,7 +617,7 @@ class MEDCouplingIntersectTest(unittest.TestCase):
         connec = [0,1]
         m_line = MEDCouplingUMesh("seg", 1)
         m_line.allocateCells(1)
-        meshCoords = DataArrayDouble.New(coords, len(coords)/2, 2)
+        meshCoords = DataArrayDouble.New(coords, len(coords) // 2, 2)
         m_line.setCoords(meshCoords)
         m_line.insertNextCell(NORM_SEG2, connec)
         a, b, c, d = MEDCouplingUMesh.Intersect2DMeshWith1DLine(m_circ, m_line, eps)
@@ -643,7 +648,7 @@ class MEDCouplingIntersectTest(unittest.TestCase):
         coords2 = [0., 1.3, -1.3, 0., -0.6, 0.6, 0., -1.3, -0.5, -0.5]
         connec2, cI2 = [NORM_SEG3, 0, 1, 2, NORM_SEG3, 1, 3, 4], [0,4,8]
         m_line = MEDCouplingUMesh("seg", 1)
-        m_line.setCoords(DataArrayDouble(coords2, len(coords2)/2, 2))
+        m_line.setCoords(DataArrayDouble(coords2, len(coords2) // 2, 2))
         m_line.setConnectivity(DataArrayInt(connec2), DataArrayInt(cI2))
         a, b, c, d = MEDCouplingUMesh.Intersect2DMeshWith1DLine(m, m_line, eps)
         self.assertTrue(a.getCoords().getHiddenCppPointer()==b.getCoords().getHiddenCppPointer())
@@ -672,7 +677,7 @@ class MEDCouplingIntersectTest(unittest.TestCase):
         coords2 = [-1., 0.25, 1., 0.25]
         connec2, cI2 = [NORM_SEG2, 0, 1], [0,3]
         m_line = MEDCouplingUMesh.New("seg", 1)
-        m_line.setCoords(DataArrayDouble(coords2, len(coords2)/2, 2))
+        m_line.setCoords(DataArrayDouble(coords2, len(coords2) // 2, 2))
         m_line.setConnectivity(DataArrayInt(connec2), DataArrayInt(cI2))
         m_line2 = m_line.deepCopy()
         m2 = m.deepCopy()
@@ -707,7 +712,7 @@ class MEDCouplingIntersectTest(unittest.TestCase):
         coords2 = [-2., 1., 2., 1.0]
         connec2, cI2 = [NORM_SEG2, 0, 1], [0,3]
         m_line = MEDCouplingUMesh("seg", 1)
-        m_line.setCoords(DataArrayDouble(coords2, len(coords2)/2, 2))
+        m_line.setCoords(DataArrayDouble(coords2, len(coords2) // 2, 2))
         m_line.setConnectivity(DataArrayInt(connec2), DataArrayInt(cI2))
         a, b, c, d = MEDCouplingUMesh.Intersect2DMeshWith1DLine(m, m_line, eps)
         self.assertTrue(a.getCoords().getHiddenCppPointer()==b.getCoords().getHiddenCppPointer())
@@ -738,7 +743,7 @@ class MEDCouplingIntersectTest(unittest.TestCase):
         coords2 = [-2., 0., 2., 0.]
         connec2, cI2 = [NORM_SEG2, 0, 1], [0,3]
         m_line = MEDCouplingUMesh.New("seg", 1)
-        m_line.setCoords(DataArrayDouble(coords2, len(coords2)/2, 2))
+        m_line.setCoords(DataArrayDouble(coords2, len(coords2) // 2, 2))
         m_line.setConnectivity(DataArrayInt(connec2), DataArrayInt(cI2))
         a, b, c, d = MEDCouplingUMesh.Intersect2DMeshWith1DLine(m, m_line, eps)
         self.assertTrue(a.getCoords().getHiddenCppPointer()==b.getCoords().getHiddenCppPointer())
@@ -804,7 +809,7 @@ class MEDCouplingIntersectTest(unittest.TestCase):
         coords2 = [1., 2., 1., -2.]
         connec2, cI2 = [NORM_SEG2, 0, 1], [0,3]
         m_line = MEDCouplingUMesh("seg", 1)
-        m_line.setCoords(DataArrayDouble(coords2, len(coords2)/2, 2))
+        m_line.setCoords(DataArrayDouble(coords2, len(coords2) // 2, 2))
         m_line.setConnectivity(DataArrayInt(connec2), DataArrayInt(cI2))
         a, b, c, d = MEDCouplingUMesh.Intersect2DMeshWith1DLine(m, m_line, eps)
         self.assertTrue(a.getCoords().getHiddenCppPointer()==b.getCoords().getHiddenCppPointer())
@@ -826,7 +831,7 @@ class MEDCouplingIntersectTest(unittest.TestCase):
         conn = [5,5,2,6,4,5,6,3,0,1,5,4,5,10,8,11,9,5,11,2,1,7,10,9]
         connI = [0,5,12,17,24]
         m = MEDCouplingUMesh("box",2)
-        cooArr = DataArrayDouble(coo,len(coo)/2,2)
+        cooArr = DataArrayDouble(coo, len(coo) // 2, 2)
         m.setCoords(cooArr)
         m.setConnectivity(DataArrayInt(conn),DataArrayInt(connI))
         m.mergeNodes(eps)
index 397712f5d8666b668385c02c562585be7fbccc94..7991cc0c5c95777d6a66481b6bc380ec84478ef3 100644 (file)
@@ -549,8 +549,7 @@ namespace MEDCoupling
         if(!PySlice_Check(slic))
           throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
         Py_ssize_t strt=2,stp=2,step=2;
-        PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
-        GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !");
+        GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !");
         int a,b;
         DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
         return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
@@ -561,8 +560,7 @@ namespace MEDCoupling
         if(!PySlice_Check(slic))
           throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
         Py_ssize_t strt=2,stp=2,step=2;
-        PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
-        GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getSlice (wrap) : the input slice is invalid !");
+        GetIndicesOfSlice(slic,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getSlice (wrap) : the input slice is invalid !");
         int a,b;
         DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
         return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
@@ -573,8 +571,7 @@ namespace MEDCoupling
         if(!PySlice_Check(slic))
           throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
         Py_ssize_t strt=2,stp=2,step=2;
-        PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
-        GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
+        GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
         return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
       }
 
@@ -583,8 +580,7 @@ namespace MEDCoupling
         if(!PySlice_Check(slic))
           throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
         Py_ssize_t strt=2,stp=2,step=2;
-        PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
-        GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
+        GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
         return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
       }
       
@@ -600,8 +596,7 @@ namespace MEDCoupling
         if(!PySlice_Check(slic))
           throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
         Py_ssize_t strt=2,stp=2,step=2;
-        PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
-        GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
+        GetIndicesOfSlice(slic,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
         return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
       }
 
@@ -610,8 +605,7 @@ namespace MEDCoupling
         if(!PySlice_Check(slic))
           throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
         Py_ssize_t strt=2,stp=2,step=2;
-        PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
-        GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
+        GetIndicesOfSlice(slic,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
         return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
       }
 
@@ -640,13 +634,18 @@ namespace MEDCoupling
         if(sz!=2)
           throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid tuple in input ! Should be of size 2 ! Invalid overwrite of __getstate__ ?");
         PyObject *a0(PyTuple_GetItem(inp,0));
-        if(!PyString_Check(a0))
+        if(PyString_Check(a0))
+          self->setName(PyString_AsString(a0));
+%#if PY_VERSION_HEX >= 0x03000000
+        else if(PyUnicode_Check(a0))
+          self->setName(PyUnicode_AsUTF8(a0));
+%#endif
+        else
           throw INTERP_KERNEL::Exception(MSG);
         PyObject *a1(PyTuple_GetItem(inp,1));
         std::vector<std::string> a1cpp;
         if(!fillStringVector(a1,a1cpp))
           throw INTERP_KERNEL::Exception(MSG);
-        self->setName(PyString_AsString(a0));
         self->setInfoOnComponents(a1cpp);
       }
     }
@@ -3051,8 +3050,7 @@ namespace MEDCoupling
         if(!PySlice_Check(slic))
           throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
         Py_ssize_t strt=2,stp=2,step=2;
-        PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
-        GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
+        GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
         if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
           throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice contains some unknowns that can't be determined in static method ! Call DataArray::getSlice (non static) instead !");
         return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
@@ -4853,7 +4851,6 @@ namespace MEDCoupling
         Py_XINCREF(trueSelf);
         return trueSelf;
       }
-
       PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
       {
         MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
@@ -5889,6 +5886,19 @@ namespace MEDCoupling
                     else
                       throw INTERP_KERNEL::Exception(msg);
                   }
+%#if PY_VERSION_HEX >= 0x03000000
+                else if(PyUnicode_Check(nbOfTuples))
+                  {
+                    if(PyUnicode_GET_LENGTH(nbOfTuples)!=1)
+                      throw INTERP_KERNEL::Exception(msg);
+                    //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
+                    std::vector<std::string> tmp;
+                    if(fillStringVector(elt0,tmp))
+                      return DataArrayAsciiChar::New(tmp,PyUnicode_AsUTF8(nbOfTuples)[0]);
+                    else
+                      throw INTERP_KERNEL::Exception(msg);
+                  }
+%#endif
                 else
                   throw INTERP_KERNEL::Exception(msg);
               }
@@ -5997,6 +6007,15 @@ namespace MEDCoupling
             std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
             return self->presenceOfTuple(vals);
           }
+%#if PY_VERSION_HEX >= 0x03000000
+        else if(PyUnicode_Check(tupl))
+          {
+            Py_ssize_t sz=PyUnicode_GET_LENGTH(tupl);
+            std::vector<char> vals(sz);
+            std::copy(PyUnicode_AsUTF8(tupl),PyUnicode_AsUTF8(tupl)+sz,vals.begin());
+            return self->presenceOfTuple(vals);
+          }
+%#endif
         else
           throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
       }
@@ -6010,6 +6029,15 @@ namespace MEDCoupling
             std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
             return self->presenceOfValue(vals2);
           }
+%#if PY_VERSION_HEX >= 0x03000000
+        if(PyUnicode_Check(vals))
+          {
+            Py_ssize_t sz=PyUnicode_GET_LENGTH(vals);
+            std::vector<char> vals2(sz);
+            std::copy(PyUnicode_AsUTF8(vals),PyUnicode_AsUTF8(vals)+sz,vals2.begin());
+            return self->presenceOfValue(vals2);
+          }
+%#endif
         else
           throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
       }
@@ -6023,6 +6051,15 @@ namespace MEDCoupling
             std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
             return self->findIdFirstEqual(vals2);
           }
+%#if PY_VERSION_HEX >= 0x03000000
+        if(PyUnicode_Check(vals))
+          {
+            Py_ssize_t sz=PyUnicode_GET_LENGTH(vals);
+            std::vector<char> vals2(sz);
+            std::copy(PyUnicode_AsUTF8(vals),PyUnicode_AsUTF8(vals)+sz,vals2.begin());
+            return self->findIdFirstEqual(vals2);
+          }
+%#endif
         else
           throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqual : only strings in input supported !");
       }
@@ -6036,6 +6073,15 @@ namespace MEDCoupling
             std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
             return self->findIdFirstEqualTuple(vals);
           }
+%#if PY_VERSION_HEX >= 0x03000000
+        if(PyUnicode_Check(tupl))
+          {
+            Py_ssize_t sz=PyUnicode_GET_LENGTH(tupl);
+            std::vector<char> vals(sz);
+            std::copy(PyUnicode_AsUTF8(tupl),PyUnicode_AsUTF8(tupl)+sz,vals.begin());
+            return self->findIdFirstEqualTuple(vals);
+          }
+%#endif
         else
           throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqualTuple : only strings in input supported !");
       }
@@ -6049,6 +6095,15 @@ namespace MEDCoupling
             std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
             return self->findIdSequence(vals);
           }
+%#if PY_VERSION_HEX >= 0x03000000
+        else if(PyUnicode_Check(strOrListOfInt))
+          {
+            Py_ssize_t sz=PyUnicode_GET_LENGTH(strOrListOfInt);
+            std::vector<char> vals(sz);
+            std::copy(PyUnicode_AsUTF8(strOrListOfInt),PyUnicode_AsUTF8(strOrListOfInt)+sz,vals.begin());
+            return self->findIdSequence(vals);
+          }
+%#endif
         else
           throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
       }
@@ -6099,6 +6154,17 @@ namespace MEDCoupling
                   else
                     throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
                 }
+%#if PY_VERSION_HEX >= 0x03000000
+              if(PyUnicode_Check(obj))
+                {
+                  Py_ssize_t sz;
+                  char *pt=PyUnicode_AsUTF8AndSize(obj, &sz);
+                  if(sz==1)
+                    return self->findIdFirstEqual(pt[0]);
+                  else
+                    throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
+                }
+%#endif
               else
                 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
             }
@@ -6125,6 +6191,17 @@ namespace MEDCoupling
                   else
                     throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
                 }
+%#if PY_VERSION_HEX >= 0x03000000
+              if(PyUnicode_Check(obj))
+                {
+                  Py_ssize_t sz;
+                  char *pt=PyUnicode_AsUTF8AndSize(obj, &sz);
+                  if(sz==1)
+                    return self->presenceOfValue(pt[0]);
+                  else
+                    throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
+                }
+%#endif
               else
                 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
             }
index 7b20363432c3aaaffe837482311f8fc2ae60a322..129b6d6135d4fc3a56d819308956024574b1c4df 100644 (file)
@@ -17,6 +17,9 @@
 #
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
+from __future__ import division
+# Uncomment to be coherent with Python 3
+# from __future__ import unicode_literals
 
 from MEDCoupling import *
 
@@ -668,11 +671,11 @@ class MEDCouplingNumPyTest(unittest.TestCase):
         """Test on DataArrayBytes"""
         # use case 1
         d=DataArrayByte(256)
-        for i in xrange(len(d)):
+        for i in range(len(d)):
             d[i]=-128+i
             pass
         arr=d.toNumPyArray()
-        for i in xrange(len(d)):
+        for i in range(len(d)):
             self.assertEqual(int(arr[i]),-128+i)
             pass
         d[0]=7
@@ -685,11 +688,11 @@ class MEDCouplingNumPyTest(unittest.TestCase):
         gc.collect()
         # use case 2
         d=DataArrayByte(256)
-        for i in xrange(len(d)):
+        for i in range(len(d)):
             d[i]=-128+i
             pass
         arr=d.toNumPyArray()
-        for i in xrange(len(d)):
+        for i in range(len(d)):
             self.assertEqual(int(arr[i]),-128+i)
             pass
         del d
@@ -698,7 +701,7 @@ class MEDCouplingNumPyTest(unittest.TestCase):
         gc.collect()
         # use case 3
         d=DataArrayByte(256)
-        for i in xrange(len(d)):
+        for i in range(len(d)):
             d[i]=-128+i
             pass
         arr1=d.toNumPyArray()
@@ -708,20 +711,20 @@ class MEDCouplingNumPyTest(unittest.TestCase):
         self.assertEqual(int(arr1[0]),10) ; self.assertEqual(int(arr2[0]),10) ; self.assertEqual(int(arr3[0]),10)
         arr2[0]=15 ; self.assertEqual(int(d.getIJ(0,0)),15) ; self.assertEqual(int(arr1[0]),15) ; self.assertEqual(int(arr3[0]),15)
         arr1[0]=-128
-        for i in xrange(len(d)):
+        for i in range(len(d)):
             self.assertEqual(int(arr1[i]),-128+i)
             self.assertEqual(int(arr2[i]),-128+i)
             self.assertEqual(int(arr3[i]),-128+i)
             pass
         del arr2
         gc.collect()
-        for i in xrange(len(d)):
+        for i in range(len(d)):
             self.assertEqual(int(arr1[i]),-128+i)
             self.assertEqual(int(arr3[i]),-128+i)
             pass
         del arr1
         gc.collect()
-        for i in xrange(len(d)):
+        for i in range(len(d)):
             self.assertEqual(int(arr3[i]),-128+i)
             pass
         del arr3
@@ -729,11 +732,11 @@ class MEDCouplingNumPyTest(unittest.TestCase):
         # use case 4
         arr=array(0,dtype=int8)
         arr.resize(256)
-        for i in xrange(256):
+        for i in range(256):
             arr[i]=-128+i
             pass
         d=DataArrayByte(arr)
-        for i in xrange(256):
+        for i in range(256):
             self.assertEqual(int(d.getIJ(i,0)),-128+i)
             pass
         del arr
@@ -743,11 +746,11 @@ class MEDCouplingNumPyTest(unittest.TestCase):
         # use case 5
         arr=array(0,dtype=int8)
         arr.resize(256)
-        for i in xrange(256):
+        for i in range(256):
             arr[i]=-128+i
             pass
         d=DataArrayByte(arr)
-        for i in xrange(256):
+        for i in range(256):
             self.assertEqual(int(d.getIJ(i,0)),-128+i)
             pass
         del d
index a34420d8a2580c073fe36a85ef08efefc77d9f96..c6927593f6c3885ca21a9515c24ea7ce1fb682f9 100644 (file)
@@ -17,6 +17,9 @@
 #
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
+from __future__ import division
+# Uncomment to be coherent with Python 3
+# from __future__ import unicode_literals
 
 from MEDCoupling import *
 from MEDCouplingDataForTest import MEDCouplingDataForTest
@@ -28,7 +31,11 @@ if MEDCouplingHasNumPyBindings():
 from platform import architecture
 from sys import getrefcount
 
-import os,gc,weakref,cPickle,unittest
+import os, gc, weakref, unittest
+try:
+  import cPickle as pickle
+except ImportError:
+  import pickle
 
 class MEDCouplingPickleTest(unittest.TestCase):
     @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
@@ -36,14 +43,14 @@ class MEDCouplingPickleTest(unittest.TestCase):
         """ Test of a simple DataArrayDouble."""
         x=DataArrayDouble(10,1) ; x.iota() ; x.rearrange(2) ; x.setInfoOnComponents(["aa","bbb"])
         x.setName("toto")
-        pickled=cPickle.dumps(x,cPickle.HIGHEST_PROTOCOL)
-        xx=cPickle.loads(pickled)
+        pickled=pickle.dumps(x,pickle.HIGHEST_PROTOCOL)
+        xx=pickle.loads(pickled)
         self.assertTrue(xx.isEqual(x,1e-16))
         # Bigger to check that the behavior is OK for large strings.
         x=DataArrayDouble(1200) ; x.iota() ; x.setInfoOnComponents(["aa"])
         x.setName("titi")
-        pickled=cPickle.dumps(x,cPickle.HIGHEST_PROTOCOL)
-        xx=cPickle.loads(pickled)
+        pickled=pickle.dumps(x,pickle.HIGHEST_PROTOCOL)
+        xx=pickle.loads(pickled)
         self.assertTrue(xx.isEqual(x,1e-16))
         pass
 
@@ -52,14 +59,14 @@ class MEDCouplingPickleTest(unittest.TestCase):
         """ Test of a simple DataArrayInt."""
         x=DataArrayInt(10) ; x.iota() ; x.rearrange(2) ; x.setInfoOnComponents(["aa","bbb"])
         x.setName("toto")
-        pickled=cPickle.dumps(x,cPickle.HIGHEST_PROTOCOL)
-        xx=cPickle.loads(pickled)
+        pickled=pickle.dumps(x,pickle.HIGHEST_PROTOCOL)
+        xx=pickle.loads(pickled)
         self.assertTrue(xx.isEqual(x))
         # Bigger to check that the behavior is OK for large strings.
         x=DataArrayInt(1200) ; x.iota() ; x.setInfoOnComponents(["aa"])
         x.setName("titi")
-        pickled=cPickle.dumps(x,cPickle.HIGHEST_PROTOCOL)
-        xx=cPickle.loads(pickled)
+        pickled=pickle.dumps(x,pickle.HIGHEST_PROTOCOL)
+        xx=pickle.loads(pickled)
         self.assertTrue(xx.isEqual(x))
         pass
     
@@ -72,8 +79,8 @@ class MEDCouplingPickleTest(unittest.TestCase):
         m.setName("mesh")
         m.getCoords().setInfoOnComponents(["aa","bbb","ddddd"])
         m.checkConsistencyLight()
-        st=cPickle.dumps(m,cPickle.HIGHEST_PROTOCOL)
-        m2=cPickle.loads(st)
+        st=pickle.dumps(m,pickle.HIGHEST_PROTOCOL)
+        m2=pickle.loads(st)
         self.assertTrue(m2.isEqual(m,1e-16))
         pass
 
@@ -104,8 +111,8 @@ class MEDCouplingPickleTest(unittest.TestCase):
         m=MEDCouplingCMesh() ; m.setCoords(arrX,arrY,arrZ)
         m.setName("mesh")
         m.checkConsistencyLight()
-        st=cPickle.dumps(m,cPickle.HIGHEST_PROTOCOL)
-        m2=cPickle.loads(st)
+        st=pickle.dumps(m,pickle.HIGHEST_PROTOCOL)
+        m2=pickle.loads(st)
         self.assertTrue(m2.isEqual(m,1e-16))
         self.assertTrue(m2.getCoordsAt(0).isEqual(arrX,1e-16))
         pass
@@ -117,8 +124,8 @@ class MEDCouplingPickleTest(unittest.TestCase):
         m=MEDCouplingCMesh() ; m.setCoords(arr,arr)
         m=m.build1SGTUnstructured()
         self.assertTrue(isinstance(m,MEDCoupling1SGTUMesh))
-        st=cPickle.dumps(m,cPickle.HIGHEST_PROTOCOL)
-        m2=cPickle.loads(st)
+        st=pickle.dumps(m,pickle.HIGHEST_PROTOCOL)
+        m2=pickle.loads(st)
         self.assertTrue(m2.isEqual(m,1e-16))
         pass
     
@@ -130,8 +137,8 @@ class MEDCouplingPickleTest(unittest.TestCase):
         m=m.buildUnstructured() ; m.convertAllToPoly()
         m=MEDCoupling1DGTUMesh(m)
         self.assertTrue(isinstance(m,MEDCoupling1DGTUMesh))
-        st=cPickle.dumps(m,cPickle.HIGHEST_PROTOCOL)
-        m2=cPickle.loads(st)
+        st=pickle.dumps(m,pickle.HIGHEST_PROTOCOL)
+        m2=pickle.loads(st)
         self.assertTrue(m2.isEqual(m,1e-16))
         pass
 
@@ -150,8 +157,8 @@ class MEDCouplingPickleTest(unittest.TestCase):
         mesh2D.setCoords(mesh3D.getCoords())
         mesh=MEDCouplingMappedExtrudedMesh(mesh3D,mesh2D,0) ; del mesh3D,mesh2D
         self.assertTrue(isinstance(mesh,MEDCouplingMappedExtrudedMesh))
-        st=cPickle.dumps(mesh,cPickle.HIGHEST_PROTOCOL)
-        m2=cPickle.loads(st)
+        st=pickle.dumps(mesh,pickle.HIGHEST_PROTOCOL)
+        m2=pickle.loads(st)
         self.assertTrue(m2.isEqual(mesh,1e-16))
         pass
 
@@ -165,8 +172,8 @@ class MEDCouplingPickleTest(unittest.TestCase):
         #
         mesh=MEDCouplingCurveLinearMesh() ; mesh.setCoords(m.getCoords()) ; del m
         mesh.setNodeGridStructure([10,5])
-        st=cPickle.dumps(mesh,cPickle.HIGHEST_PROTOCOL)
-        m2=cPickle.loads(st)
+        st=pickle.dumps(mesh,pickle.HIGHEST_PROTOCOL)
+        m2=pickle.loads(st)
         self.assertTrue(m2.isEqual(mesh,1e-16))
         pass
 
@@ -175,8 +182,8 @@ class MEDCouplingPickleTest(unittest.TestCase):
         """ Test of a MEDCouplingIMesh pickeling."""
         m=MEDCouplingIMesh("mesh",3,DataArrayInt([3,1,4]),DataArrayDouble([1.5,2.5,3.5]),DataArrayDouble((0.5,1.,0.25))) ; m.setAxisUnit("km")
         m.checkConsistencyLight()
-        st=cPickle.dumps(m,cPickle.HIGHEST_PROTOCOL)
-        m2=cPickle.loads(st)
+        st=pickle.dumps(m,pickle.HIGHEST_PROTOCOL)
+        m2=pickle.loads(st)
         self.assertTrue(m2.isEqual(m,1e-16))
         self.assertEqual(m2.getName(),m.getName())
         pass
@@ -195,8 +202,8 @@ class MEDCouplingPickleTest(unittest.TestCase):
         f.getArray().setInfoOnComponents(["u1","vv2"])
         f.checkConsistencyLight();
         #
-        st=cPickle.dumps(f,cPickle.HIGHEST_PROTOCOL)
-        f2=cPickle.loads(st)
+        st=pickle.dumps(f,pickle.HIGHEST_PROTOCOL)
+        f2=pickle.loads(st)
         self.assertTrue(f2.isEqual(f,1e-16,1e-16))
         self.assertTrue(f2.getMesh().isEqual(f.getMesh(),1e-16))
         pass
@@ -233,7 +240,7 @@ class MEDCouplingPickleTest(unittest.TestCase):
         self.assertEqual(2,f.getNbOfGaussLocalization());
         array=DataArrayDouble.New();
         ptr=18*2*[None]
-        for i in xrange(18*2):
+        for i in range(18 * 2):
             ptr[i]=float(i+1)
         array.setValues(ptr,18,2);
         ptr=array.getPointer();
@@ -275,8 +282,8 @@ class MEDCouplingPickleTest(unittest.TestCase):
         f.setArray(array2);
         f.checkConsistencyLight();
         ####
-        st=cPickle.dumps(f,cPickle.HIGHEST_PROTOCOL)
-        f2=cPickle.loads(st)
+        st=pickle.dumps(f,pickle.HIGHEST_PROTOCOL)
+        f2=pickle.loads(st)
         self.assertTrue(f2.isEqual(f,1e-16,1e-16))
         self.assertTrue(f2.getMesh().isEqual(f.getMesh(),1e-16))
         pass
@@ -285,8 +292,8 @@ class MEDCouplingPickleTest(unittest.TestCase):
         eStr="This is an exception."
         e=InterpKernelException(eStr)
         self.assertEqual(e.what(),eStr)
-        st=cPickle.dumps(e,cPickle.HIGHEST_PROTOCOL)
-        e2=cPickle.loads(st)
+        st=pickle.dumps(e,pickle.HIGHEST_PROTOCOL)
+        e2=pickle.loads(st)
         self.assertTrue(e is not e2)
         self.assertTrue(isinstance(e2,InterpKernelException))
         self.assertEqual(e2.what(),eStr)
@@ -296,13 +303,13 @@ class MEDCouplingPickleTest(unittest.TestCase):
     def test14(self):
         """Pickelization of DataArrayBytes"""
         x=DataArrayByte(256,1)
-        for i in xrange(256):
+        for i in range(256):
             x[i]=-128+i
             pass
         x.rearrange(2) ; x.setInfoOnComponents(["aa","bbb"])
         x.setName("toto")
-        st=cPickle.dumps(x,cPickle.HIGHEST_PROTOCOL)
-        x2=cPickle.loads(st)
+        st=pickle.dumps(x,pickle.HIGHEST_PROTOCOL)
+        x2=pickle.loads(st)
         self.assertTrue(x2.isEqual(x))
         pass
 
index 5ff24cd86d147141fe78149e47ae5405309e19f5..73d3105a8d6060c406a2dede63599756b6dc0efe 100644 (file)
@@ -17,6 +17,9 @@
 #
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
+from __future__ import division
+# Uncomment to be coherent with Python 3
+# from __future__ import unicode_literals
 
 from MEDCouplingDataForTest import MEDCouplingDataForTest
 from MEDCouplingRemapper import *
@@ -30,13 +33,13 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         remapper=MEDCouplingRemapper()
         remapper.setPrecision(1e-12);
         remapper.setIntersectionType(Triangulation);
-        self.failUnless(remapper.prepare(sourceMesh,targetMesh,"P0P0")==1);
+        self.assertTrue(remapper.prepare(sourceMesh,targetMesh,"P0P0")==1);
         srcField=MEDCouplingFieldDouble.New(ON_CELLS);
         srcField.setNature(IntensiveMaximum);
         srcField.setMesh(sourceMesh);
         array=DataArrayDouble.New();
         ptr=sourceMesh.getNumberOfCells()*[None]
-        for i in xrange(sourceMesh.getNumberOfCells()):
+        for i in range(sourceMesh.getNumberOfCells()):
             ptr[i]=float(i+7)
             pass
         array.setValues(ptr,sourceMesh.getNumberOfCells(),1);
@@ -52,10 +55,10 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         self.assertEqual(c,10)
         values=trgfield.getArray().getValues();
         valuesExpected=[7.5 ,7. ,7.,8.,7.5];
-        for i in xrange(targetMesh.getNumberOfCells()):
-            self.failUnless(abs(values[i]-valuesExpected[i])<1e-12);
+        for i in range(targetMesh.getNumberOfCells()):
+            self.assertTrue(abs(values[i]-valuesExpected[i])<1e-12);
             pass
-        self.failUnless(1==trgfield.getArray().getNumberOfComponents());
+        self.assertTrue(1==trgfield.getArray().getNumberOfComponents());
         pass
 
     def testPrepareEx1(self):
@@ -75,7 +78,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         srcField.setMesh(sourceMesh);
         array=DataArrayDouble.New();
         ptr=sourceMesh.getNumberOfCells()*[None]
-        for i in xrange(sourceMesh.getNumberOfCells()):
+        for i in range(sourceMesh.getNumberOfCells()):
             ptr[i]=float(i+7);
             pass
         array.setValues(ptr,sourceMesh.getNumberOfCells(),1);
@@ -85,7 +88,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         valuesExpected=[7.75, 7.0625, 4.220173,8.0]
         self.assertEqual(4,trgfield.getArray().getNumberOfTuples());
         self.assertEqual(1,trgfield.getArray().getNumberOfComponents());
-        for i0 in xrange(4):
+        for i0 in range(4):
             self.assertAlmostEqual(valuesExpected[i0],values[i0],12);
             pass
         pass
@@ -107,7 +110,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         srcField.setMesh(sourceMesh);
         array=DataArrayDouble.New();
         ptr=sourceMesh.getNumberOfCells()*[None]
-        for i in xrange(sourceMesh.getNumberOfCells()):
+        for i in range(sourceMesh.getNumberOfCells()):
             ptr[i]=float(i+7);
             pass
         array.setValues(ptr,sourceMesh.getNumberOfCells(),1);
@@ -117,7 +120,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         trgfield.setMesh(targetMesh);
         array=DataArrayDouble.New();
         ptr=targetMesh.getNumberOfCells()*[None]
-        for i in xrange(targetMesh.getNumberOfCells()):
+        for i in range(targetMesh.getNumberOfCells()):
             ptr[i]=4.220173;
             pass
         array.setValues(ptr,targetMesh.getNumberOfCells(),1);
@@ -127,7 +130,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         valuesExpected=[7.75, 7.0625, 4.220173,8.0]
         self.assertEqual(4,trgfield.getArray().getNumberOfTuples());
         self.assertEqual(1,trgfield.getArray().getNumberOfComponents());
-        for i0 in xrange(4):
+        for i0 in range(4):
             self.assertAlmostEqual(valuesExpected[i0],values[i0],12);
             pass
         pass
@@ -308,7 +311,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         rem2=MEDCouplingRemapper() ; rem2.setSplittingPolicy(PLANAR_FACE_5) ; rem2.prepare(src1,trg,"P0P0")
         mat1=rem1.getCrudeMatrix() ; mat2=rem2.getCrudeMatrix()
         self.assertEqual(1,len(mat1)) ; self.assertEqual(1,len(mat2))
-        self.assertEqual(mat1[0].keys(),mat2[0].keys()) ; self.assertEqual([0,1],mat1[0].keys())
+        self.assertEqual(list(mat1[0].keys()),list(mat2[0].keys())) ; self.assertEqual([0,1],list(mat1[0].keys()))
         self.assertAlmostEqual(1.25884108122e-06,mat1[0][0],16) ; self.assertAlmostEqual(1.25884108122e-06,mat2[0][0],16)
         self.assertAlmostEqual(1.25884086663e-06,mat1[0][1],16) ; self.assertAlmostEqual(1.25884086663e-06,mat2[0][1],16)
         #
@@ -570,7 +573,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         self.assertEqual(aRemapper.prepare(s,t,'P1P1'),1)
         m=aRemapper.getCrudeMatrix()
         self.assertEqual(len(m),28)
-        for i in xrange(28):
+        for i in range(28):
             if i not in [5,6]:
                 self.assertEqual(len(m[i]),0)
                 pass
@@ -727,7 +730,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         rem=MEDCouplingRemapper()
         rem.prepare(src,trg,"P0P0")
         # Internal crude sparse matrix computed. Let's manipulate it using CSR matrix in scipy.
-        for i in xrange(10):
+        for i in range(10):
             m=rem.getCrudeCSRMatrix()
             pass
         m2=rem.getCrudeCSRMatrix()
@@ -776,7 +779,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         a.allocateCells()
         conna=[0,1,3,2,1,4,5,3,4,6,7,5,6,8,9,7,8,10,11,9,10,12,13,11,12,14,15,13,14,16,17,15,16,18,19,17,18,20,21,19,20,22,23,21,22,24,25,23,24,26,27,25]
         a.setCoords(DataArrayDouble([1.54,0,-0.01,1.54,0.02,-0.01,1.54,0,0.01,1.54,0.02,0.01,1.54,0.04,-0.01,1.54,0.04,0.01,1.54,0.06,-0.01,1.54,0.06,0.01,1.54,0.08,-0.01,1.54,0.08,0.01,1.54,0.1,-0.01,1.54,0.1,0.01,1.54,0.12,-0.01,1.54,0.12,0.01,1.54,0.14,-0.01,1.54,0.14,0.01,1.54,0.16,-0.01,1.54,0.16,0.01,1.54,0.18,-0.01,1.54,0.18,0.01,1.54,0.2,-0.01,1.54,0.2,0.01,1.54,0.22,-0.01,1.54,0.22,0.01,1.54,0.24,-0.01,1.54,0.24,0.01,1.54,0.26,-0.01,1.54,0.26,0.01],28,3))
-        for i in xrange(13):
+        for i in range(13):
             a.insertNextCell(NORM_QUAD4,conna[4*i:4*(i+1)])
             pass
         a.finishInsertingCells() ; a.simplexize(0)
@@ -784,7 +787,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         connb=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,0,2,39,3,5,40,6,8,41,9,11,42,12,14,43,15,17,44,18,20,45,21,23,46,24,26,47,27,29,48,30,32,49,33,35,50,36,38,51,52,2,39,53,5,40,54,8,41,55,11,42,56,14,43,57,17,44,58,20,45,59,23,46,60,26,47,61,29,48,62,32,49,63,35,50,64,38,51,52,2,65,53,5,66,54,8,67,55,11,68,56,14,69,57,17,70,58,20,71,59,23,72,60,26,73,61,29,74,62,32,75,63,35,76,64,38,77,53,2,65,54,5,66,55,8,67,56,11,68,57,14,69,58,17,70,59,20,71,60,23,72,61,26,73,62,29,74,63,32,75,64,35,76,78,38,77,53,2,40,54,5,41,55,8,42,56,11,43,57,14,44,58,17,45,59,20,46,60,23,47,61,26,48,62,29,49,63,32,50,64,35,51,78,38,79,3,2,40,6,5,41,9,8,42,12,11,43,15,14,44,18,17,45,21,20,46,24,23,47,27,26,48,30,29,49,33,32,50,36,35,51,80,38,79,3,2,1,6,5,4,9,8,7,12,11,10,15,14,13,18,17,16,21,20,19,24,23,22,27,26,25,30,29,28,33,32,31,36,35,34,80,38,37]
         b=MEDCouplingUMesh("b",2)
         b.allocateCells()
-        for i in xrange(104):
+        for i in range(104):
             b.insertNextCell(NORM_TRI3,connb[3*i:3*(i+1)])
             pass
         b.setCoords(DataArrayDouble([1.54,0,-0.01,1.54,0.01,-0.01,1.54,0.01,0,1.54,0.02,-0.01,1.54,0.03,-0.01,1.54,0.03,0,1.54,0.04,-0.01,1.54,0.05,-0.01,1.54,0.05,0,1.54,0.06,-0.01,1.54,0.07,-0.01,1.54,0.07,0,1.54,0.08,-0.01,1.54,0.09,-0.01,1.54,0.09,0,1.54,0.1,-0.01,1.54,0.11,-0.01,1.54,0.11,0,1.54,0.12,-0.01,1.54,0.13,-0.01,1.54,0.13,0,1.54,0.14,-0.01,1.54,0.15,-0.01,1.54,0.15,0,1.54,0.16,-0.01,1.54,0.17,-0.01,1.54,0.17,0,1.54,0.18,-0.01,1.54,0.19,-0.01,1.54,0.19,0,1.54,0.2,-0.01,1.54,0.21,-0.01,1.54,0.21,0,1.54,0.22,-0.01,1.54,0.23,-0.01,1.54,0.23,0,1.54,0.24,-0.01,1.54,0.25,-0.01,1.54,0.25,0,1.54,0,0,1.54,0.02,0,1.54,0.04,0,1.54,0.06,0,1.54,0.08,0,1.54,0.1,0,1.54,0.12,0,1.54,0.14,0,1.54,0.16,0,1.54,0.18,0,1.54,0.2,0,1.54,0.22,0,1.54,0.24,0,1.54,0,0.01,1.54,0.02,0.01,1.54,0.04,0.01,1.54,0.06,0.01,1.54,0.08,0.01,1.54,0.1,0.01,1.54,0.12,0.01,1.54,0.14,0.01,1.54,0.16,0.01,1.54,0.18,0.01,1.54,0.2,0.01,1.54,0.22,0.01,1.54,0.24,0.01,1.54,0.01,0.01,1.54,0.03,0.01,1.54,0.05,0.01,1.54,0.07,0.01,1.54,0.09,0.01,1.54,0.11,0.01,1.54,0.13,0.01,1.54,0.15,0.01,1.54,0.17,0.01,1.54,0.19,0.01,1.54,0.21,0.01,1.54,0.23,0.01,1.54,0.25,0.01,1.54,0.26,0.01,1.54,0.26,0,1.54,0.26,-0.01],81,3))
@@ -860,7 +863,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         source=MEDCoupling1SGTUMesh("SourcePrimaire",NORM_SEG2)
         source.setCoords(sourceCoo)
         source.allocateCells()
-        for i in xrange(len(sourceCoo)-1):
+        for i in range(len(sourceCoo) - 1):
             source.insertNextCell([i,i+1])
             pass
         source=source.buildUnstructured()
@@ -1118,8 +1121,8 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         cI2 = [0, 44]
         mTgt = MEDCouplingUMesh("target", 3)
         mSrc = MEDCouplingUMesh("src", 3)
-        mTgt.setCoords(DataArrayDouble(coo1, len(coo1)/3, 3))
-        mSrc.setCoords(DataArrayDouble(coo2, len(coo2)/3, 3))
+        mTgt.setCoords(DataArrayDouble(coo1, len(coo1) // 3, 3))
+        mSrc.setCoords(DataArrayDouble(coo2, len(coo2) // 3, 3))
         mTgt.setConnectivity(DataArrayInt(conn1), DataArrayInt(cI1))
         mSrc.setConnectivity(DataArrayInt(conn2), DataArrayInt(cI2))
 
@@ -1157,7 +1160,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
 
     def checkMatrix(self,mat1,mat2,nbCols,eps):
         self.assertEqual(len(mat1),len(mat2))
-        for i in xrange(len(mat1)):
+        for i in range(len(mat1)):
             self.assertTrue(max(mat2[i].keys())<nbCols)
             self.assertTrue(max(mat1[i].keys())<nbCols)
             self.assertTrue(min(mat2[i].keys())>=0)
@@ -1211,7 +1214,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         targetMesh=MEDCouplingUMesh.New();
         targetMesh.setMeshDimension(2);
         targetMesh.allocateCells(4);
-        for i in xrange(4):
+        for i in range(4):
             targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[4*i:4*(i+1)])
             pass
         targetMesh.finishInsertingCells();
index 14d39353a3645a2dbbf5af115cdfc17cd398ae1e..dc4145e04709cc1bb9c6c14ee1aef06648db97bc 100644 (file)
@@ -24,7 +24,11 @@ INCLUDE(${SWIG_USE_FILE})
 ADD_DEFINITIONS(${PYTHON_DEFINITIONS} ${NUMPY_DEFINITIONS} ${SCIPY_DEFINITIONS})
 
 SET_SOURCE_FILES_PROPERTIES(MEDLoader.i PROPERTIES CPLUSPLUS ON)
-SET_SOURCE_FILES_PROPERTIES(MEDLoader.i PROPERTIES SWIG_DEFINITIONS "-shadow")
+IF ("${PYTHON_VERSION_MAJOR}" STREQUAL "3")
+  SET_SOURCE_FILES_PROPERTIES(MEDLoader.i PROPERTIES SWIG_FLAGS "-py3")
+ELSE()
+  SET_SOURCE_FILES_PROPERTIES(MEDLoader.i PROPERTIES SWIG_DEFINITIONS "-shadow")
+ENDIF()
 SET(SWIG_MODULE_MEDLoader_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS}")
 
 SET (MEDLoader_SWIG_DPYS_FILES
index 1b71cc54faa9588344f001b7785b33ecf4d34dd4..fa61441de3362338b222195ad94e54dc5db828c6 100644 (file)
@@ -25,7 +25,7 @@ class CaseIO:
     dictMCTyp={NORM_HEXA8:"hexa8",NORM_POLYHED:"nfaced",NORM_QUAD4:"quad4",NORM_POLYGON:"nsided",NORM_POINT1:"point",NORM_SEG2:"bar2",NORM_SEG3:"bar3",NORM_TRI3:"tria3",NORM_TRI6:"tria6",NORM_QUAD8:"quad8",NORM_TETRA4:"tetra4",NORM_TETRA10:"tetra10",NORM_PYRA5:"pyramid5",NORM_PYRA13:"pyramid13",NORM_PENTA6:"penta6",NORM_PENTA15:"penta15",NORM_HEXA20:"hexa20"}
     discSpatial={ON_CELLS:"element",ON_NODES:"node"}
     dictCompo={1:"scalar",3:"vector",6:"tensor",9:"tensor9"}
-    dictMCTyp2=dict((v,k) for k,v in dictMCTyp.iteritems())
-    discSpatial2=dict((v,k) for k,v in discSpatial.iteritems())
-    dictCompo2=dict((v,k) for k,v in dictCompo.iteritems())
+    dictMCTyp2 = {v:k for k, v in dictMCTyp.items()}
+    discSpatial2 = {v:k for k, v in discSpatial.items()}
+    dictCompo2 = {v:k for k, v in dictCompo.items()}
     pass
index ea266d3fc74daeaea6596c606f5c3d3cc8789a57..b36b7b700a8a7c05798622e9f793138da7e6af99 100644 (file)
@@ -166,7 +166,7 @@ class CaseReader(CaseIO):
             pos+=nbNodes*3*4 ; fd.seek(pos)#np.array(0,dtype='float%i'%(typeOfCoo)).nbytes
             typ=fd.read(80).strip() ; pos=fd.tell()
             zeK=""
-            for k in self.dictMCTyp2.keys():
+            for k in self.dictMCTyp2:
                 if k in typ:
                     zeK=k
                     break
@@ -327,7 +327,7 @@ class CaseReader(CaseIO):
             nbOfValsOfTyp=np.memmap(fd,dtype='>i4',mode='r',offset=pos,shape=(1)).tolist()[0]/4
             pos+=4
             vals=np.zeros(dtype=">f4",shape=(nbOfValsOfTyp*nbCompo))
-            for iii in xrange(nbCompo):
+            for iii in range(nbCompo):
                 valsTmp=np.memmap(fd,dtype='>f4',mode='r',offset=int(pos),shape=(nbOfValsOfTyp))
                 vals[iii*nbOfValsOfTyp:(iii+1)*nbOfValsOfTyp]=valsTmp
                 pos+=nbOfValsOfTyp*4
@@ -368,7 +368,7 @@ class CaseReader(CaseIO):
             if "TIME\n" in lines:
                 end=lines.index("TIME\n")
                 pass
-            for i in xrange(ind+1,end):
+            for i in range(ind + 1, end):
                 m=re.match("^([\w]+)[\s]+\per[\s]+([\w]+)[\s]*\:[\s]*([\w]+)[\s]+([\S]+)$",lines[i])
                 if m:
                     if m.groups()[0]=="constant":
@@ -379,13 +379,13 @@ class CaseReader(CaseIO):
                 pass
             
             expr=re.compile("number[\s]+of[\s]+steps[\s]*\:[\s]*([\d]+)")
-            tmp=filter(expr.search,lines)
-            if len(tmp)!=0:
-                nbOfTimeSteps=int(expr.search(filter(expr.search,lines)[0]).group(1))
+            tmp = [line for line in lines if expr.search(line)]
+            if tmp:
+                nbOfTimeSteps = int(expr.search(tmp[0]).group(1))
                 expr=re.compile("filename[\s]+start[\s]+number[\s]*\:[\s]*([\d]+)")
-                startIt=int(expr.search(filter(expr.search,lines)[0]).group(1))
+                startIt = int(expr.search([line for line in lines if expr.search(line)][0]).group(1))
                 expr=re.compile("filename[\s]+increment[\s]*\:[\s]*([\d]+)")
-                incrIt=int(expr.search(filter(expr.search,lines)[0]).group(1))
+                incrIt = int(expr.search([line for line in lines if expr.search(line)][0]).group(1))
             else:
                 nbOfTimeSteps=1
                 startIt=0
@@ -402,7 +402,7 @@ class CaseReader(CaseIO):
                 i+=1
                 pass
             pass
-        for ts in xrange(nbOfTimeSteps):
+        for ts in range(nbOfTimeSteps):
             i=0
             for field in fieldsInfo:
                 if typeOfFile:
@@ -416,7 +416,7 @@ class CaseReader(CaseIO):
             pass
         ret=MEDFileData()
         ret.setMeshes(m2)
-        del mlfields[filter(lambda x: len(mlfields[x])==0,range(len(mlfields)))]
+        del mlfields[[x for x in range(len(mlfields)) if len(mlfields[x]) == 0]]
         ret.setFields(mlfields)
         return ret
 
index 7d23153ad3fa24e6c6de8498628ebce3eaf9114e..557527738362f7b7e1891c4b49b887f219d5aefe 100644 (file)
@@ -201,7 +201,7 @@ time values:
         self._ze_top_dict={}
         its,areForgottenTS=mdfs.getCommonIterations()
         if areForgottenTS:
-            print "WARNING : some iterations are NOT present in all fields ! Kept iterations are : %s !"%(str(its))
+            print("WARNING : some iterations are NOT present in all fields ! Kept iterations are : %s !"%(str(its)))
             pass
         TimeValues=""
         for it in its:
@@ -211,12 +211,12 @@ time values:
         for mdf in mdfs:
             nbCompo=mdf.getNumberOfComponents()
             if nbCompo not in self.dictCompo:
-                l=filter(lambda x:x-nbCompo>0,self.dictCompo.keys())
+                l = [x for x in self.dictCompo if x - nbCompo > 0]
                 if len(l)==0:
-                    print "Field \"%s\" will be ignored because number of components (%i) is too big to be %s supported by case files !"%(mdf.getName(),nbCompo,str(self.dictCompo.keys()))
+                    print("Field \"%s\" will be ignored because number of components (%i) is too big to be %s supported by case files !"%(mdf.getName(),nbCompo,str(list(self.dictCompo.keys()))))
                     continue
                     pass
-                print "WARNING : Field \"%s\" will have its number of components (%i) set to %i, in order to be supported by case files (must be in %s) !"%(mdf.getName(),nbCompo,l[0],str(self.dictCompo.keys()))
+                print("WARNING : Field \"%s\" will have its number of components (%i) set to %i, in order to be supported by case files (must be in %s) !"%(mdf.getName(),nbCompo,l[0],str(list(self.dictCompo.keys()))))
                 nbCompo=l[0]
                 pass
             if nbCompo in dictVars:
@@ -229,7 +229,7 @@ time values:
         for mdf in mdfs:
             nbCompo=mdf.getNumberOfComponents()
             if nbCompo not in self.dictCompo:
-                l=filter(lambda x:x-nbCompo>0,self.dictCompo.keys())
+                l = [x for x in self.dictCompo if x - nbCompo > 0]
                 if len(l)==0:
                     continue;
                 nbCompo=l[0]
@@ -276,7 +276,7 @@ time values:
                                 mm.write(self.__str80("coordinates"))
                                 pass
                             else:
-                                print "UnManaged type of field for field \"%s\" !"%(mdf.getName())
+                                print("UnManaged type of field for field \"%s\" !"%(mdf.getName()))
                                 pass
                             a=np.memmap(f,dtype='float32',mode='w+',offset=mm.tell(),shape=(nbCompo,end-bg))
                             b=arr.toNumPyArray() ; b=b.reshape(nbCompo,end-bg)
index 88f52335405dbf64a6ff1022db7d8bcea8a18783..3501af902f841040685a839a52c09839fb7388a7 100644 (file)
@@ -35,12 +35,12 @@ def ConvertTo30(nameOfMEDFile):
     #
     finalVersion=ml.MEDFileVersionOfFileStr(realFnOut)
     #
-    print("File \"%s\" has been converted to 3.0 successfuly ( %s -> %s ) !\nOutput file is here : \"%s\" !"%(fn,initalVersion,finalVersion,realFnOut))
+    print(("File \"%s\" has been converted to 3.0 successfuly ( %s -> %s ) !\nOutput file is here : \"%s\" !"%(fn,initalVersion,finalVersion,realFnOut)))
     pass
 
 if __name__=="__main__":
     import argparse
-    parser=argparse.ArgumentParser(description=u'Convert a MED file into a MED file with 3.0 version (3.0.8)')
+    parser=argparse.ArgumentParser(description='Convert a MED file into a MED file with 3.0 version (3.0.8)')
     parser.add_argument('nameOfMEDFile', type=str, nargs=1,help='File name of the MED file to be converted into 3.0.')
     args=parser.parse_args()
     nameOfMEDFile=args.nameOfMEDFile[0]
index 7add2d533890d2d68827860152f3bb48767d9d5a..1d7e9b76469c44f3d7a2caba7cc0bae0ae315d35 100644 (file)
@@ -175,6 +175,12 @@ def MEDCouplingMEDFileParametersnew(cls,*args):
 
 %include "MEDCouplingFinalize.i"
 
+%pythoncode %{
+MEDFileMeshesIterator.__next__ = MEDFileMeshesIterator.next
+MEDFileAnyTypeFieldMultiTSIterator.__next__ = MEDFileAnyTypeFieldMultiTSIterator.next
+MEDFileFieldsIterator.__next__ = MEDFileFieldsIterator.next
+%}
+
 %pythoncode %{
 MEDFileUMesh.__new__=classmethod(MEDCouplingMEDFileUMeshnew)
 del MEDCouplingMEDFileUMeshnew
index c205a3e7832ba82a0844c2538553f369afd22bce..671e3f1a84628bd4fc09709e637e3c16a4701ab2 100644 (file)
@@ -826,6 +826,15 @@ namespace MEDCoupling
               ret->incrRef();
             return ret;
           }
+%#if PY_VERSION_HEX >= 0x03000000
+        else if(PyUnicode_Check(obj))
+          {
+            MEDFileJoint *ret=self->getJointWithName(PyUnicode_AsUTF8(obj));
+            if(ret)
+              ret->incrRef();
+            return ret;
+          }
+%#endif
         else
           throw INTERP_KERNEL::Exception("MEDFileJoints::__getitem__ : only integer or string with meshname supported !");
       }
@@ -1837,6 +1846,15 @@ namespace MEDCoupling
                  ret->incrRef();
                return ret;
              }
+%#if PY_VERSION_HEX >= 0x03000000
+           else if(PyUnicode_Check(obj))
+            {
+               MEDFileMesh *ret=self->getMeshWithName(PyUnicode_AsUTF8(obj));
+               if(ret)
+                 ret->incrRef();
+               return ret;
+            }
+%#endif
            else
              throw INTERP_KERNEL::Exception("MEDFileMeshes::__getitem__ : only integer or string with meshname supported !");
          }
@@ -2622,8 +2640,7 @@ namespace MEDCoupling
         if(PySlice_Check(elts))
           {
             Py_ssize_t strt=2,stp=2,step=2;
-            PySliceObject *oC=reinterpret_cast<PySliceObject *>(elts);
-            GetIndicesOfSlice(oC,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__delitem__ : error in input slice !");
+            GetIndicesOfSlice(elts,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__delitem__ : error in input slice !");
             self->eraseTimeStepIds2(strt,stp,step);
           }
         else
@@ -2688,8 +2705,7 @@ namespace MEDCoupling
         else if(elt0 && PySlice_Check(elt0))
           {
             Py_ssize_t strt=2,stp=2,step=2;
-            PySliceObject *oC=reinterpret_cast<PySliceObject *>(elt0);
-            GetIndicesOfSlice(oC,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__getitem__ : error in input slice !");
+            GetIndicesOfSlice(elt0,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__getitem__ : error in input slice !");
             return convertMEDFileFieldMultiTS(self->buildSubPartSlice(strt,stp,step),SWIG_POINTER_OWN | 0);
           }
         else
@@ -3263,6 +3279,10 @@ namespace MEDCoupling
              }
            else if(elt0 && PyString_Check(elt0))
              return self->getPosFromFieldName(PyString_AsString(elt0));
+%#if PY_VERSION_HEX >= 0x03000000
+           else if(elt0 && PyUnicode_Check(elt0))
+             return self->getPosFromFieldName(PyUnicode_AsUTF8(elt0));
+%#endif
            else
              throw INTERP_KERNEL::Exception("MEDFileFields::getPosOfField : invalid input params ! expected fields[int], fields[string_of_field_name] !");
          }
@@ -3300,8 +3320,7 @@ namespace MEDCoupling
            if(elts && PySlice_Check(elts))
              {
                Py_ssize_t strt=2,stp=2,step=2;
-               PySliceObject *oC=reinterpret_cast<PySliceObject *>(elts);
-               GetIndicesOfSlice(oC,self->getNumberOfFields(),&strt,&stp,&step,"MEDFileFields.__delitem__ : error in input slice !");
+               GetIndicesOfSlice(elts,self->getNumberOfFields(),&strt,&stp,&step,"MEDFileFields.__delitem__ : error in input slice !");
                self->destroyFieldsAtPos2(strt,stp,step);
              }
            else
@@ -3664,6 +3683,15 @@ namespace MEDCoupling
               ret->incrRef();
             return ret;
           }
+%#if PY_VERSION_HEX >= 0x03000000
+        else if(PyUnicode_Check(obj))
+          {
+            MEDFileParameterMultiTS *ret=self->getParamWithName(PyUnicode_AsUTF8(obj));
+            if(ret)
+              ret->incrRef();
+            return ret;
+          }
+%#endif
         else
           throw INTERP_KERNEL::Exception("MEDFileParameters::__getitem__ : only integer or string with meshname supported !");
       }
index e301dd71a08183de82a047829c3b69cd3656ce95..2b036cbfb18f89d0331076480bd2087d88b5b395 100644 (file)
@@ -25,13 +25,13 @@ import math, os
 
 d=DataArrayDouble.New(6,2)
 d[:,0]=3.
-d[:,1]=range(6)
+d[:, 1] = list(range(6))
 d[:,1]*=math.pi/3.
 d=d.fromPolarToCart()
 d.setInfoOnComponents(["X [m]","Y [m]"])
-print d.getValues()
-print d
-print d.magnitude().isUniform(3.,1e-12)
+print(d.getValues())
+print(d)
+print(d.magnitude().isUniform(3.,1e-12))
 #
 radius=3.
 translationToPerform=[[0.,0.],[3./2.*radius,-radius*math.sqrt(3.)/2],[3./2.*radius,radius*math.sqrt(3.)/2],[0.,radius*math.sqrt(3.)],[-3./2.*radius,radius*math.sqrt(3.)/2],[-3./2.*radius,-radius*math.sqrt(3.)/2],[0.,-radius*math.sqrt(3.)]]
@@ -45,24 +45,24 @@ d2=DataArrayDouble.Aggregate(ds)
 oldNbOfTuples=d2.getNumberOfTuples()
 c,cI=d2.findCommonTuples(1e-12)
 tmp=c[cI[0]:cI[0+1]]
-print tmp
+print(tmp)
 a=cI.deltaShiftIndex()
 b=a-1
 myNewNbOfTuples=oldNbOfTuples-sum(b.getValues())
 o2n,newNbOfTuples=DataArrayInt.ConvertIndexArrayToO2N(oldNbOfTuples,c,cI)
-print "Ai je trouve le bon resultat ? %s"%(str(myNewNbOfTuples==newNbOfTuples)) ; assert myNewNbOfTuples==newNbOfTuples
+print("Ai je trouve le bon resultat ? %s"%(str(myNewNbOfTuples==newNbOfTuples))) ; assert myNewNbOfTuples==newNbOfTuples
 #
 d3=d2.renumberAndReduce(o2n,newNbOfTuples)
 n2o=o2n.invertArrayO2N2N2O(newNbOfTuples)
 d3_bis=d2[n2o]
-print "Ai je trouve le bon resultat (2) ? %s"%(str(d3.isEqual(d3_bis,1e-12))) ; assert d3.isEqual(d3_bis,1e-12)
+print("Ai je trouve le bon resultat (2) ? %s"%(str(d3.isEqual(d3_bis,1e-12)))) ; assert d3.isEqual(d3_bis,1e-12)
 #
 d3+=[3.3,4.4]
 # d3 contains coordinates
 m=MEDCouplingUMesh.New("My7hexagons",2)
 m.setCoords(d3)
 m.allocateCells(7)
-for i in xrange(7):
+for i in range(7):
   m.insertNextCell(NORM_POLYGON,o2n[6*i:6*(i+1)].getValues())
   pass
 m.finishInsertingCells()
@@ -99,14 +99,14 @@ mesh3D.setCoords(myCoords);
 mesh3D.orientCorrectlyPolyhedrons()
 mesh3D.sortCellsInMEDFileFrmt()
 mesh3D.checkConsistencyLight()
-renum=DataArrayInt.New(60) ; renum[:15]=range(15,30) ; renum[15:30]=range(15) ; renum[30:45]=range(45,60) ; renum[45:]=range(30,45)
+renum = DataArrayInt.New(60) ; renum[:15] = list(range(15, 30)) ; renum[15:30] = list(range(15)) ; renum[30:45] = list(range(45, 60)) ; renum[45:] = list(range(30, 45))
 mesh3D.renumberNodes(renum,60)
 #
 mesh3D.getCoords()[:]*=100.
 mesh3D.getCoords().setInfoOnComponents(["X [cm]","Y [cm]","Z [cm]"])
 #
 zLev=mesh3D.getCoords()[:,2]
-zLev=zLev.getDifferentValues(1e-12)
+zLev = zLev.getDifferentValues(1e-12)
 zLev.sort()
 #
 tmp,cellIdsSol1=mesh3D.buildSlice3D([0.,0.,(zLev[1]+zLev[2])/2],[0.,0.,1.],1e-12)
@@ -117,13 +117,13 @@ nodeIds=mesh3D.findNodesOnPlane([0.,0.,zLev[0]],[0.,0.,1.],1e-10)
 mesh2D=mesh3D.buildFacePartOfMySelfNode(nodeIds,True)
 extMesh=MEDCouplingMappedExtrudedMesh.New(mesh3D,mesh2D,0)
 cellIdsSol3=extMesh.getMesh3DIds()[mesh2D.getNumberOfCells():2*mesh2D.getNumberOfCells()]
-for i in xrange(3):
-  exec("print cellIdsSol%s.getValues()"%(i+1))
+for i in range(3):
+  exec("print( cellIdsSol%s.getValues())"%(i+1))
 #
 mesh3DPart=mesh3D[cellIdsSol2] # equivalent to mesh3DPart=mesh3D.buildPartOfMySelf(cellIdsSol2,True)
 mesh3DPart.zipCoords()
-print mesh3DPart.checkConsecutiveCellTypesAndOrder([NORM_HEXA8,NORM_POLYHED]) ; assert mesh3DPart.checkConsecutiveCellTypesAndOrder([NORM_HEXA8,NORM_POLYHED])
-print mesh3DPart.checkConsecutiveCellTypes() ; assert mesh3DPart.checkConsecutiveCellTypes()
+print(mesh3DPart.checkConsecutiveCellTypesAndOrder([NORM_HEXA8,NORM_POLYHED])) ; assert mesh3DPart.checkConsecutiveCellTypesAndOrder([NORM_HEXA8,NORM_POLYHED])
+print(mesh3DPart.checkConsecutiveCellTypes()) ; assert mesh3DPart.checkConsecutiveCellTypes()
 #print mesh3DPart.advancedRepr()
 #
 baryXY=bary[:,[0,1]]
@@ -136,7 +136,7 @@ bary2-=[250.,150.]
 magn=bary2.magnitude()
 ids=magn.findIdsInRange(0.,1e-12)
 idStart=int(ids) # ids is assumed to contain only one value, if not an exception is thrown
-cellIds2Sol2=extMesh.getMesh3DIds()[range(idStart,mesh3D.getNumberOfCells(),mesh2D.getNumberOfCells())]
+cellIds2Sol2 = extMesh.getMesh3DIds()[list(range(idStart, mesh3D.getNumberOfCells(), mesh2D.getNumberOfCells()))]
 #
 mesh3DSlice2=mesh3D[cellIds2Sol1]
 mesh3DSlice2.zipCoords()
@@ -169,7 +169,7 @@ f2=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME)
 f2.setMesh(mesh)
 f2.setName("MyField2")
 f2.fillFromAnalytic(1,"(x-5.)*(x-5.)+(y-5.)*(y-5.)+(z-5.)*(z-5.)")
-print "f and f2 are equal : %s"%(f.isEqualWithoutConsideringStr(f2,1e-13,1e-12)) ; assert f.isEqualWithoutConsideringStr(f2,1e-13,1e-12)
+print("f and f2 are equal : %s"%(f.isEqualWithoutConsideringStr(f2,1e-13,1e-12))) ; assert f.isEqualWithoutConsideringStr(f2,1e-13,1e-12)
 #
 ids1=f.getArray().findIdsInRange(0.,5.)
 fPart1=f.buildSubPart(ids1)
@@ -182,7 +182,7 @@ fPart1Cpy.getArray().renumberInPlace(o2n)
 #Check that fPart1Cpy and fPart1 are the same
 fPart1Cpy.substractInPlaceDM(fPart1,12,1e-12)
 fPart1Cpy.getArray().abs()
-print "Fields are the same ? %s"%(fPart1Cpy.getArray().accumulate()[0]<1e-12) ; assert fPart1Cpy.getArray().accumulate()[0]<1e-12
+print("Fields are the same ? %s"%(fPart1Cpy.getArray().accumulate()[0]<1e-12)) ; assert fPart1Cpy.getArray().accumulate()[0]<1e-12
 #
 fPart12=MEDCouplingFieldDouble.MergeFields([fPart1,fPart2])
 # evaluation on points
@@ -191,11 +191,11 @@ arr1=fPart12.getValueOnMulti(bary)
 arr2=f.getValueOnMulti(bary)
 delta=arr1-arr2
 delta.abs()
-print "Check OK : %s"%(delta.accumulate()[0]<1e-12) ; assert delta.accumulate()[0]<1e-12
+print("Check OK : %s"%(delta.accumulate()[0]<1e-12)) ; assert delta.accumulate()[0]<1e-12
 #
-print abs(fPart12.integral(0,True)-fPart12.getArray().accumulate()[0])<1e-10 ; assert abs(fPart12.integral(0,True)-fPart12.getArray().accumulate()[0])<1e-10
+print(abs(fPart12.integral(0,True)-fPart12.getArray().accumulate()[0])<1e-10) ; assert abs(fPart12.integral(0,True)-fPart12.getArray().accumulate()[0])<1e-10
 fPart12.getMesh().scale([0.,0.,0.],1.2)
-print abs(fPart12.integral(0,True)-fPart12.getArray().accumulate()[0]*1.2*1.2*1.2)<1e-8 ; assert abs(fPart12.integral(0,True)-fPart12.getArray().accumulate()[0]*1.2*1.2*1.2)<1e-8
+print(abs(fPart12.integral(0,True)-fPart12.getArray().accumulate()[0]*1.2*1.2*1.2)<1e-8) ; assert abs(fPart12.integral(0,True)-fPart12.getArray().accumulate()[0]*1.2*1.2*1.2)<1e-8
 # Explosion of field
 fVec=mesh.fillFromAnalytic(ON_CELLS,3,"(x-5.)*IVec+(y-5.)*JVec+(z-5.)*KVec")
 fVecPart1=fVec.buildSubPart(ids1)
@@ -229,7 +229,7 @@ targetMesh.setCoords(myCoords);
 WriteUMesh("TargetMesh.med",targetMesh,True)
 #
 meshRead=ReadUMeshFromFile("TargetMesh.med",targetMesh.getName(),0)
-print "Is the mesh read in file equals targetMesh ? %s"%(meshRead.isEqual(targetMesh,1e-12)) ; assert meshRead.isEqual(targetMesh,1e-12)
+print("Is the mesh read in file equals targetMesh ? %s"%(meshRead.isEqual(targetMesh,1e-12))) ; assert meshRead.isEqual(targetMesh,1e-12)
 #
 f=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME)
 f.setTime(5.6,7,8)
@@ -239,7 +239,7 @@ f.setName("AFieldName")
 WriteField("MyFirstField.med",f,True)
 #
 f2=ReadFieldCell("MyFirstField.med",f.getMesh().getName(),0,f.getName(),7,8)
-print "Is the field read in file equals f ? %s"%(f2.isEqual(f,1e-12,1e-12)) ; assert f2.isEqual(f,1e-12,1e-12)
+print("Is the field read in file equals f ? %s"%(f2.isEqual(f,1e-12,1e-12))) ; assert f2.isEqual(f,1e-12,1e-12)
 #
 WriteUMesh("MySecondField.med",f.getMesh(),True)
 WriteFieldUsingAlreadyWrittenMesh("MySecondField.med",f)
@@ -250,9 +250,9 @@ f2.setTime(7.8,9,10)
 WriteFieldUsingAlreadyWrittenMesh("MySecondField.med",f2)
 #
 f3=ReadFieldCell("MySecondField.med",f.getMesh().getName(),0,f.getName(),7,8)
-print "Is the field read in file equals f ? %s"%(f.isEqual(f3,1e-12,1e-12)) ; assert f.isEqual(f3,1e-12,1e-12)
+print("Is the field read in file equals f ? %s"%(f.isEqual(f3,1e-12,1e-12))) ; assert f.isEqual(f3,1e-12,1e-12)
 f4=ReadFieldCell("MySecondField.med",f.getMesh().getName(),0,f.getName(),9,10)
-print "Is the field read in file equals f ? %s"%(f2.isEqual(f4,1e-12,1e-12)) ; assert f2.isEqual(f4,1e-12,1e-12)
+print("Is the field read in file equals f ? %s"%(f2.isEqual(f4,1e-12,1e-12))) ; assert f2.isEqual(f4,1e-12,1e-12)
 
 #####
 
@@ -292,12 +292,12 @@ meshMEDFile.write("TargetMesh2.med",2) # 2 stands for write from scratch
 meshMEDFileRead=MEDFileMesh.New("TargetMesh2.med")
 meshRead0=meshMEDFileRead.getMeshAtLevel(0)
 meshRead1=meshMEDFileRead.getMeshAtLevel(-1)
-print "Is the mesh at level 0 read in file equals targetMesh ? %s"%(meshRead0.isEqual(targetMesh,1e-12)) ; assert meshRead0.isEqual(targetMesh,1e-12)
-print "Is the mesh at level -1 read in file equals targetMesh ? %s"%(meshRead1.isEqual(targetMesh1,1e-12)) ; assert meshRead1.isEqual(targetMesh1,1e-12)
+print("Is the mesh at level 0 read in file equals targetMesh ? %s"%(meshRead0.isEqual(targetMesh,1e-12))) ; assert meshRead0.isEqual(targetMesh,1e-12)
+print("Is the mesh at level -1 read in file equals targetMesh ? %s"%(meshRead1.isEqual(targetMesh1,1e-12))) ; assert meshRead1.isEqual(targetMesh1,1e-12)
 #
-print meshMEDFileRead.getGrpNonEmptyLevels("grp0_Lev0")
+print(meshMEDFileRead.getGrpNonEmptyLevels("grp0_Lev0"))
 grp0_0_read=meshMEDFileRead.getGroupArr(0,"grp0_Lev0")
-print "Is group \"grp0_Lev0\" are the same ? %s"%(grp0_0_read.isEqual(grp0_0)) ; assert grp0_0_read.isEqual(grp0_0)
+print("Is group \"grp0_Lev0\" are the same ? %s"%(grp0_0_read.isEqual(grp0_0))) ; assert grp0_0_read.isEqual(grp0_0)
 #
 # Fields
 #
@@ -315,8 +315,8 @@ fMEDFile.write("TargetMesh2.med",0) # 0 is very important here because we want t
 fMEDFileRead=MEDFileField1TS.New("TargetMesh2.med",f.getName(),7,8)
 fRead1=fMEDFileRead.getFieldOnMeshAtLevel(ON_CELLS,0,meshMEDFileRead) # fastest method. No read in file.
 fRead2=fMEDFileRead.getFieldAtLevel(ON_CELLS,0) # basic method like, mesh is reread in file...
-print "Does the field f remains the same using fast method ? %s"%(fRead1.isEqual(f,1e-12,1e-12)) ; assert fRead1.isEqual(f,1e-12,1e-12)
-print "Does the field f remains the same using slow method ? %s"%(fRead2.isEqual(f,1e-12,1e-12)) ; assert fRead2.isEqual(f,1e-12,1e-12)
+print("Does the field f remains the same using fast method ? %s"%(fRead1.isEqual(f,1e-12,1e-12))) ; assert fRead1.isEqual(f,1e-12,1e-12)
+print("Does the field f remains the same using slow method ? %s"%(fRead2.isEqual(f,1e-12,1e-12))) ; assert fRead2.isEqual(f,1e-12,1e-12)
 #
 # Writing and Reading fields on profile using MEDLoader advanced API
 #
@@ -330,8 +330,8 @@ fMEDFile2.write("TargetMesh2.med",0) # 0 is very important here because we want
 #
 fMEDFileRead2=MEDFileField1TS.New("TargetMesh2.med",fPart.getName(),7,8)
 fPartRead,pflRead=fMEDFileRead2.getFieldWithProfile(ON_CELLS,0,meshMEDFileRead)
-print fPartRead.isEqualWithoutConsideringStr(fPart.getArray(),1e-12) ; assert fPartRead.isEqualWithoutConsideringStr(fPart.getArray(),1e-12)
-print pflRead.isEqualWithoutConsideringStr(pfl) ; assert pflRead.isEqualWithoutConsideringStr(pfl)
+print(fPartRead.isEqualWithoutConsideringStr(fPart.getArray(),1e-12)) ; assert fPartRead.isEqualWithoutConsideringStr(fPart.getArray(),1e-12)
+print(pflRead.isEqualWithoutConsideringStr(pfl)) ; assert pflRead.isEqualWithoutConsideringStr(pfl)
 
 #####
 
@@ -370,7 +370,7 @@ CellField_read=MEDCouplingFieldDouble.MergeFields([CellField0_read,CellField1_re
 CellFieldCpy=CellField.deepCopy()
 CellFieldCpy.substractInPlaceDM(CellField_read,10,1e-12)
 CellFieldCpy.getArray().abs()
-print CellFieldCpy.getArray().isUniform(0.,1e-12)
+print(CellFieldCpy.getArray().isUniform(0.,1e-12))
 #
 NodeField0_read=ReadFieldNode("proc0.med","mesh",0,"NodeField",5,6)
 NodeField1_read=ReadFieldNode("proc1.med","mesh",0,"NodeField",5,6)
@@ -379,7 +379,7 @@ NodeField_read.mergeNodes(1e-10)
 NodeFieldCpy=NodeField.deepCopy()
 NodeFieldCpy.mergeNodes(1e-10)
 NodeFieldCpy.substractInPlaceDM(NodeField_read,10,1e-12)
-print NodeFieldCpy.getArray().isUniform(0.,1e-12) ; assert NodeFieldCpy.getArray().isUniform(0.,1e-12)
+print(NodeFieldCpy.getArray().isUniform(0.,1e-12)) ; assert NodeFieldCpy.getArray().isUniform(0.,1e-12)
 #
 fileNames=["proc0.med","proc1.med"]
 msML=[MEDFileMesh.New(fname) for fname in fileNames]
@@ -408,7 +408,7 @@ for fieldName in fsML[0].getFieldsNames():
                for ft in fts:
                    for geoTyp,smth in ft.getFieldSplitedByType():
                        if geoTyp!=NORM_ERROR:
-                           smth1=filter(lambda x:x[0]==ON_CELLS,smth)
+                           smth1=[x for x in smth if x[0]==ON_CELLS]
                            arr2s=[ft.getUndergroundDataArray()[elt[1][0]:elt[1][1]] for elt in smth1]
                            arr1s.append(DataArrayDouble.Aggregate(arr2s))
                            pass
@@ -417,7 +417,7 @@ for fieldName in fsML[0].getFieldsNames():
                pass
             else:
                 for ft in fts:
-                    smth=filter(lambda x:x[0]==NORM_ERROR,ft.getFieldSplitedByType())
+                    smth=[x for x in ft.getFieldSplitedByType() if x[0]==NORM_ERROR]
                     arr2=DataArrayDouble.Aggregate([ft.getUndergroundDataArray()[elt[1][0][1][0]:elt[1][0][1][1]] for elt in smth])
                     arr1s.append(arr2)
                     pass
@@ -450,14 +450,14 @@ remap=MEDCouplingRemapper()
 remap.prepare(srcMesh,trgMesh,"P0P0")
 #
 myMatrix=remap.getCrudeMatrix()
-print myMatrix # pour voir a quoi elle ressemble
+print(myMatrix) # pour voir a quoi elle ressemble
 sumByRows=DataArrayDouble(len(myMatrix))
 for i,wIt in enumerate(sumByRows):
   su=0.
   for it in myMatrix[i]:
     su+=myMatrix[i][it]
   wIt[0]=su
-print "Does interpolation look OK ? %s"%(str(sumByRows.isUniform(1.,1e-12))) ; assert sumByRows.isUniform(1.,1e-12)
+print("Does interpolation look OK ? %s"%(str(sumByRows.isUniform(1.,1e-12)))) ; assert sumByRows.isUniform(1.,1e-12)
 #
 srcField=MEDCouplingFieldDouble(ON_CELLS,ONE_TIME) ; srcField.setMesh(srcMesh)
 srcField.fillFromAnalytic(1,"7-sqrt((x-5.)*(x-5.)+(y-5.)*(y-5.))") ; CellField.getArray().setInfoOnComponent(0,"powercell [W]")
@@ -466,14 +466,14 @@ srcField.fillFromAnalytic(1,"7-sqrt((x-5.)*(x-5.)+(y-5.)*(y-5.))") ; CellField.g
 srcField.setNature(IntensiveMaximum)
 trgFieldCV=remap.transferField(srcField,1e300)
 #
-print "IntensiveMaximum %lf == %lf"%(srcField.integral(True)[0],trgFieldCV.integral(True)[0]) ; assert abs(srcField.integral(True)[0]-trgFieldCV.integral(True)[0])<1e-6
-print "IntensiveMaximum %lf != %lf"%(srcField.getArray().accumulate()[0],trgFieldCV.getArray().accumulate()[0]) ; assert abs(srcField.getArray().accumulate()[0]-trgFieldCV.getArray().accumulate()[0])>1e-6
+print("IntensiveMaximum %lf == %lf"%(srcField.integral(True)[0],trgFieldCV.integral(True)[0])) ; assert abs(srcField.integral(True)[0]-trgFieldCV.integral(True)[0])<1e-6
+print("IntensiveMaximum %lf != %lf"%(srcField.getArray().accumulate()[0],trgFieldCV.getArray().accumulate()[0])) ; assert abs(srcField.getArray().accumulate()[0]-trgFieldCV.getArray().accumulate()[0])>1e-6
 #
 srcField.setNature(ExtensiveMaximum)
 trgFieldI=remap.transferField(srcField,1e300)
 #
-print "ExtensiveConservation %lf != %lf"%(srcField.integral(True)[0],trgFieldI.integral(True)[0]) ; assert abs(srcField.integral(True)[0]-trgFieldI.integral(True)[0])>1e-6
-print "ExtensiveConservation %lf == %lf"%(srcField.getArray().accumulate()[0],trgFieldI.getArray().accumulate()[0]) ; assert abs(srcField.getArray().accumulate()[0]-trgFieldI.getArray().accumulate()[0])<1e-6
+print("ExtensiveConservation %lf != %lf"%(srcField.integral(True)[0],trgFieldI.integral(True)[0])) ; assert abs(srcField.integral(True)[0]-trgFieldI.integral(True)[0])>1e-6
+print("ExtensiveConservation %lf == %lf"%(srcField.getArray().accumulate()[0],trgFieldI.getArray().accumulate()[0])) ; assert abs(srcField.getArray().accumulate()[0]-trgFieldI.getArray().accumulate()[0])<1e-6
 
 ######
 
@@ -490,7 +490,7 @@ if not os.path.exists(agitateur_file):
 pass
 data=MEDFileData(agitateur_file)
 ts=data.getFields()[0].getTimeSteps()
-print ts
+print(ts)
 #
 fMts=data.getFields()["DISTANCE_INTERFACE_ELEM_BODY_ELEM_DOM"]
 f1ts=fMts[(2,-1)]
@@ -534,7 +534,7 @@ posSkin=barySkin-centerOfMass
 torquePerCellOnSkin=DataArrayDouble.CrossProduct(posSkin,forceVectSkin)
 
 zeTorque=torquePerCellOnSkin.accumulate()
-print "couple = %r N.m"%(zeTorque[2]) ; assert abs(zeTorque[2]-0.37)<1e-2
+print("couple = %r N.m"%(zeTorque[2])) ; assert abs(zeTorque[2]-0.37)<1e-2
 
 speedMts=data.getFields()["VITESSE_ELEM_DOM"]
 speed1ts=speedMts[(2,-1)]
@@ -542,7 +542,7 @@ speedMc=speed1ts.getFieldAtLevel(ON_CELLS,0)
 speedOnSkin=speedMc.getArray()[tupleIdsInField]
 powerSkin=DataArrayDouble.Dot(forceVectSkin,speedOnSkin)
 power=powerSkin.accumulate()[0]
-print "power = %r W"%(power) ; assert abs(power-4.22)<1e-2
+print("power = %r W"%(power)) ; assert abs(power-4.22)<1e-2
 
 x2=posSkin[:,0]*posSkin[:,0] ; x2=x2.accumulate()[0]
 y2=posSkin[:,1]*posSkin[:,1] ; y2=y2.accumulate()[0]
@@ -551,7 +551,7 @@ inertiaSkin=matrix([[x2,xy],[xy,y2]])
 inertiaSkinValues,inertiaSkinVects=linalg.eig(inertiaSkin)
 pos=max(enumerate(inertiaSkinValues),key=lambda x: x[1])[0]
 vect0=inertiaSkinVects[pos].tolist()[0]
-print vect0
+print(vect0)
 
 def computeAngle(locAgitateur1ts):
     fMc=locAgitateur1ts.getFieldAtLevel(ON_CELLS,0)
@@ -584,7 +584,7 @@ for itts,locAgitateur1ts in zip(ts,data.getFields()["DISTANCE_INTERFACE_ELEM_BOD
     pass
 
 angle2=len(ts)*[0.]
-for pos in xrange(2,len(vects)):
+for pos in range(2, len(vects)):
     norm1=sqrt(vects[pos-1][0]*vects[pos-1][0]+vects[pos-1][1]*vects[pos-1][1])
     norm2=sqrt(vects[pos][0]*vects[pos][0]+vects[pos][1]*vects[pos][1])
     crs=vects[pos-1][0]*vects[pos][0]+vects[pos-1][1]*vects[pos][1]
@@ -593,6 +593,6 @@ for pos in xrange(2,len(vects)):
     pass
 
 omega=sum(angle2)/(ts[-1][2]-ts[0][2])
-print sum(angle2) ; assert abs(sum(angle2)-1.12)<1e-2
-print "Au pdt (%d,%d) a %r s le couple est de : %r N.m, power/omega=%r N.m"%(ts[2][0],ts[2][1],ts[2][2],zeTorque[2],power/omega)
+print(sum(angle2)) ; assert abs(sum(angle2)-1.12)<1e-2
+print("Au pdt (%d,%d) a %r s le couple est de : %r N.m, power/omega=%r N.m"%(ts[2][0],ts[2][1],ts[2][2],zeTorque[2],power/omega))
 assert abs(power/omega-0.37)<1e-2
index 369ccb266b76a77b2ef21a25c4316cc9a5382d5b..ea9f94b24d23efcb83cc38ada8462b3a738993b5 100644 (file)
@@ -18,6 +18,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 # Author : Anthony Geay (CEA/DEN)
+from __future__ import division
 
 from MEDLoader import *
 from math import pi,e,sqrt
@@ -242,12 +243,12 @@ class MEDLoaderDataForTest:
         m2=MEDCouplingUMesh.New("ma",2)
         m2.setCoords(coo2)
         m2.allocateCells(128)
-        nbTri=len(c2tri)/3
-        for i in xrange(nbTri):
+        nbTri = len(c2tri) // 3
+        for i in range(nbTri):
             m2.insertNextCell(NORM_TRI3,3,c2tri[3*i:3*i+3])
             pass
-        nbQua=len(c2quad4)/4
-        for i in xrange(nbQua):
+        nbQua = len(c2quad4) // 4
+        for i in range(nbQua):
             m2.insertNextCell(NORM_QUAD4,4,c2quad4[4*i:4*i+4])
             pass
         m2.finishInsertingCells()
@@ -256,7 +257,7 @@ class MEDLoaderDataForTest:
         m1.setCoords(coo2)
         c1seg=[0,1,1,2,2,3,3,4,4,9,9,14,14,19,19,24,24,29,29,34,34,39,39,43,43,42,42,41,41,40,40,44,44,35,35,30,30,25,25,20,20,15,15,10,10,5,5,0,43,39,39,34,34,29,29,24,24,19,19,14,14,9,9,4,45,53,53,54,54,55,55,56,56,57,57,58,58,59,59,49,49,60,60,61,61,62,62,52,52,63,63,64,64,65,65,66,66,67,67,68,68,69,69,47,47,70,70,71,71,72,72,45,50,94,94,95,95,96,96,97,97,98,98,99,99,100,100,46,46,101,101,102,102,103,103,48,48,104,104,105,105,106,106,107,107,108,108,109,109,110,110,51,51,111,111,112,112,113,113,50]
         m1.allocateCells(80)
-        for i in xrange(80):
+        for i in range(80):
             m1.insertNextCell(NORM_SEG2,2,c1seg[2*i:2*i+2])
             pass
         m1.finishInsertingCells()
@@ -265,7 +266,7 @@ class MEDLoaderDataForTest:
         m0.setCoords(coo2)
         c0pt=[44,0,47,48]
         m0.allocateCells(4)
-        for i in xrange(4):
+        for i in range(4):
             m0.insertNextCell(NORM_POINT1,1,[c0pt[i]])
             pass
         m0.finishInsertingCells()
@@ -437,7 +438,7 @@ class MEDLoaderDataForTest:
         array=DataArrayDouble.New();
         array.alloc(19,2);
         ptr=array.getPointer();
-        for i in xrange(19*2):
+        for i in range(19 * 2):
             array.setIJ(0,i,float(i+7));
             pass
         f.setArray(array);
@@ -486,7 +487,7 @@ class MEDLoaderDataForTest:
         array=DataArrayDouble.New();
         array.alloc(53,2);
         ptr=array.getPointer();
-        for i in xrange(53*2):
+        for i in range(53 * 2):
             array.setIJ(0,i,float(i+7));
             pass
         f.setArray(array);
@@ -536,7 +537,7 @@ class MEDLoaderDataForTest:
         array=DataArrayDouble.New();
         array.alloc(53,2);
         ptr=array.getPointer();
-        for i in xrange(53*2):
+        for i in range(53 * 2):
             array.setIJ(0,i,float(i+7));
             pass
         f.setArray(array);
@@ -553,7 +554,7 @@ class MEDLoaderDataForTest:
         f.setMesh(m);
         array=DataArrayDouble.New();
         array.alloc(20,2);
-        for i in xrange(2*20):
+        for i in range(2 * 20):
             array.setIJ(0,i,float(i+8));
         f.setArray(array);
         array.setInfoOnComponent(0,"power [W]");
index cdb17921c66501065ba4f2ccf958316497d02ffd..575f7a0e939d9dbe8c637d992e682d48c004833f 100644 (file)
@@ -232,7 +232,7 @@ class MEDLoaderBasicsTest(unittest.TestCase):
 #! [PySnippetMeshAdvAPI1_6]
         m0D=ReadUMeshFromFile("file2.med","Example2",-3)
 #! [PySnippetMeshAdvAPI1_6]
-        for i in xrange(4):
+        for i in range(4):
             mm.removeMeshAtLevel(-i)
             pass
         mm.setMeshAtLevel(0,myMesh1)
index 62319a5715ce0c5a35009fd9f48c09fa5a548bd0..060ef8b4deef9d1ef78bf911c03d6c6a707f2d60 100644 (file)
@@ -38,7 +38,7 @@ class MEDLoaderSplitter:
         mfflds=mfflds.partOfThisLyingOnSpecifiedMeshName(mfmsh[0].getName())
         retf=self.__splitFields(mfmsh[0],mfflds,idsLst)
         retm=self.__splitMesh(mfmsh[0],idsLst)
-        self._mfd_splitted=[MEDFileData() for i in xrange(len(idsLst))]
+        self._mfd_splitted = [MEDFileData() for i in range(len(idsLst))]
         for a,b,c in zip(self._mfd_splitted,retf,retm):
             a.setFields(b) ; a.setMeshes(c)
             pass
@@ -62,7 +62,7 @@ class MEDLoaderSplitter:
         pass
     
     def __splitMEDFileField1TS(self,mm,f1ts,idsLst):
-        ret=[MEDFileField1TS() for i in xrange(len(idsLst))]
+        ret = [MEDFileField1TS() for i in range(len(idsLst))]
         dico={ON_CELLS:self.__splitMEDFileField1TSCell,
               ON_NODES:self.__splitMEDFileField1TSNode,
               ON_GAUSS_PT:self.__splitMEDFileField1TSCell,
@@ -76,13 +76,13 @@ class MEDLoaderSplitter:
         return ret
     
     def __splitFields(self,mm,mfflds,idsLst):
-        ret0=[MEDFileFields() for i in xrange(len(idsLst))]
+        ret0 = [MEDFileFields() for i in range(len(idsLst))]
         for fmts in mfflds:
             if len(fmts.getPflsReallyUsed())!=0:
-                print "Field \"%s\" contains profiles ! Not supported yet ! This field will be ignored !"%(fmts.getName())
+                print("Field \"%s\" contains profiles ! Not supported yet ! This field will be ignored !"%(fmts.getName()))
                 continue
             pass
-            ret1=[MEDFileFieldMultiTS() for i in xrange(len(idsLst))]
+            ret1 = [MEDFileFieldMultiTS() for i in range(len(idsLst))]
             for f1ts in fmts:
                 for fmtsPart,f1tsPart in zip(ret1,self.__splitMEDFileField1TS(mm,f1ts,idsLst)):
                     fmtsPart.pushBackTimeStep(f1tsPart)
@@ -95,7 +95,7 @@ class MEDLoaderSplitter:
         return ret0
 
     def __splitMesh(self,mfm,idsLst):
-        ret0=[MEDFileMeshes() for i in xrange(len(idsLst))]
+        ret0 = [MEDFileMeshes() for i in range(len(idsLst))]
         m=mfm.getMeshAtLevel(0)
         for ret,ids in zip(ret0,idsLst):
             mlPart=mfm.createNewEmpty()
index 94f21b14ee74218ae46690cba3649926985d8a5f..6bb2790738e18cdfadc53470b0ca1c44982b49e4 100644 (file)
@@ -556,7 +556,7 @@ class MEDLoaderTest1(unittest.TestCase):
         nbOfCompo=4100
         arr=MEDLoader.DataArrayDouble(nbOfCompo*3) ; arr.iota()
         arr.rearrange(nbOfCompo)
-        arr.setInfoOnComponents(["c%i"%(i) for i in xrange(nbOfCompo)])
+        arr.setInfoOnComponents(["c%i" % (i) for i in range(nbOfCompo)])
         f.setArray(arr)
         f.setName("FieldBigCompo")
         MEDLoader.WriteField(fileName,f,True)
@@ -570,7 +570,7 @@ class MEDLoaderTest1(unittest.TestCase):
         m.insertNextCell([0,2,1,3])
         m.setCoords(MEDLoader.DataArrayDouble([0.,0.,1.,1.,1.,0.,0.,1.],4,2))
         #
-        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
@@ -619,7 +619,7 @@ class MEDLoaderTest1(unittest.TestCase):
         m.insertNextCell([0,2,1,3])
         m.setCoords(MEDLoader.DataArrayDouble([0.,0.,1.,1.,1.,0.,0.,1.],4,2))
         #
-        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
@@ -811,7 +811,7 @@ class MEDLoaderTest1(unittest.TestCase):
         mm[0]=m
         mm.write(fname,2)
         #
-        pfl=MEDLoader.DataArrayInt(range(8))
+        pfl = MEDLoader.DataArrayInt(list(range(8)))
         pfl.setName("PFL")
         #
         f=MEDLoader.MEDCouplingFieldDouble(MEDLoader.ON_CELLS)
index c1c0156919e9054f255e9fc61c45a9dcb3e6062a..f5a10e70397e9ec66db32ecb27a0af0f8d1006cb 100644 (file)
@@ -18,6 +18,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 # Author : Anthony Geay (CEA/DEN)
+from __future__ import division
 
 from MEDLoader import *
 import unittest
@@ -26,6 +27,12 @@ from math import pi,e,sqrt
 from MEDLoaderDataForTest import MEDLoaderDataForTest
 from distutils.version import LooseVersion
 
+import sys
+if sys.version_info.major < 3:
+  range = xrange
+  def next(it):
+    return it.next()
+
 class MEDLoaderTest3(unittest.TestCase):
     def testMEDMesh1(self):
         fileName="Pyfile18.med"
@@ -145,10 +152,10 @@ class MEDLoaderTest3(unittest.TestCase):
         g2_1.setName("G2")
         mm.setGroupsAtLevel(-1,[g1_1,g2_1],False)
         g1_N=DataArrayInt.New()
-        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(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")
@@ -167,7 +174,7 @@ class MEDLoaderTest3(unittest.TestCase):
         self.assertTrue(g2_N.isEqual(t));
         self.assertTrue(mm.existsGroup("GrpOnAllCell"));
         t=mm.getGroupArr(0,"GrpOnAllCell")
-        self.assertTrue(t.getValues()==range(5))
+        self.assertTrue(t.getValues() == list(range(5)))
         #
         mmCpy=mm.deepCopy()
         self.assertTrue(mm.isEqual(mmCpy,1e-12)[0]) ; del mm
@@ -302,7 +309,7 @@ class MEDLoaderTest3(unittest.TestCase):
         self.assertTrue(not mm2.existsFamily("Family_-8"))
         mm2.createGroupOnAll(-1,"GrpOnAllFace")
         self.assertTrue(mm2.existsFamily("Family_-8"))
-        self.assertEqual(range(3),mm2.getGroupArr(-1,"GrpOnAllFace").getValues())
+        self.assertEqual(list(range(3)), mm2.getGroupArr(-1, "GrpOnAllFace").getValues())
         pass
 
     #testing persistence of retrieved arrays
@@ -382,11 +389,11 @@ class MEDLoaderTest3(unittest.TestCase):
         m.setRenumFieldArr(-1,n1)
         m.setRenumFieldArr(-2,n0)
         nbOfFams=len(fns)
-        for i in xrange(nbOfFams):
+        for i in range(nbOfFams):
             m.addFamily(fns[i],fids[i])
             pass
         nbOfGrps=len(grpns)
-        for i in xrange(nbOfGrps):
+        for i in range(nbOfGrps):
             m.setFamiliesIdsOnGroup(grpns[i],famIdsPerGrp[i])
             pass
         m.setName(m2.getName())
@@ -813,7 +820,7 @@ class MEDLoaderTest3(unittest.TestCase):
         m1=MEDLoaderDataForTest.build2DMesh_1()
         m1.renumberCells([0,1,4,2,3,5],False)
         tmp=m1.getName();
-        m1=m1.buildPartOfMySelf(range(5),True) ; m1.setName(tmp) # suppression of last cell that is a polygon
+        m1 = m1.buildPartOfMySelf(list(range(5)), True) ; m1.setName(tmp)  # suppression of last cell that is a polygon
         mm1=MEDFileUMesh.New() ; mm1.setCoords(m1.getCoords()) ; mm1.setMeshAtLevel(0,m1) ;
         mm1.write(fname,2)
         ff1=MEDFileField1TS.New()
@@ -840,7 +847,7 @@ class MEDLoaderTest3(unittest.TestCase):
         m1=MEDLoaderDataForTest.build2DMesh_1()
         m1.renumberCells([0,1,4,2,3,5],False)
         tmp=m1.getName();
-        m1=m1.buildPartOfMySelf(range(5),True) ; m1.setName(tmp) # suppression of last cell that is a polygon
+        m1 = m1.buildPartOfMySelf(list(range(5)), True) ; m1.setName(tmp)  # suppression of last cell that is a polygon
         mm1=MEDFileUMesh.New() ; mm1.setCoords(m1.getCoords()) ; mm1.setMeshAtLevel(0,m1) ;
         mm1.write(fname,2)
         ff1=MEDFileFieldMultiTS.New()
@@ -887,7 +894,7 @@ class MEDLoaderTest3(unittest.TestCase):
         da=DataArrayInt.New(); da.setValues([0,1,3,4,6],5,1) ; da.setName("sup1NodeElt")
         #
         ff1.setFieldProfile(f1,mm1,0,da)
-        m1=m0.buildPartOfMySelf(range(5),True) ; m1.setName(tmp) ; mm1.setMeshAtLevel(0,m1) ;
+        m1 = m0.buildPartOfMySelf(list(range(5)), True) ; m1.setName(tmp) ; mm1.setMeshAtLevel(0, m1) ;
         mm1.write(fname,2)
         ff1.write(fname,0)
         f1=ff1.getFieldOnMeshAtLevel(ON_GAUSS_NE,m1,0)
@@ -1173,11 +1180,11 @@ class MEDLoaderTest3(unittest.TestCase):
         expected1=[1.,10.,100.,2.,20.,200.]
         nodeCoordsWithValue1=[10.,2.5,0.]
         nodeCoordsWithValue2=[10.,3.75,0.]
-        for i in xrange(3):
+        for i in range(3):
             self.assertAlmostEqual(nodeCoordsWithValue1[i],tes0.getMesh().getCoordinatesOfNode(0)[i],13);
             self.assertAlmostEqual(nodeCoordsWithValue2[i],tes0.getMesh().getCoordinatesOfNode(1)[i],13);
             pass
-        for i in xrange(6):
+        for i in range(6):
             self.assertAlmostEqual(expected1[i],tes0.getArray().getIJ(0,i),13);
             pass
         del tes0
@@ -1191,7 +1198,7 @@ class MEDLoaderTest3(unittest.TestCase):
         self.assertEqual([0,2,4],tes1.getMesh().getNodalConnectivityIndex().getValues())
         self.assertEqual(2,tes1.getArray().getNumberOfTuples())
         self.assertEqual(3,tes1.getArray().getNumberOfComponents())
-        for i in xrange(6):
+        for i in range(6):
             self.assertAlmostEqual(expected1[i],tes1.getArray().getIJ(0,i),13);
             pass
         m.write(fname,2)
@@ -1210,11 +1217,11 @@ class MEDLoaderTest3(unittest.TestCase):
         self.assertEqual(2,tes2.getArray().getNumberOfTuples())
         self.assertEqual(3,tes2.getArray().getNumberOfComponents())
         expected2=[2.,20.,200.,1.,10.,100.]
-        for i in xrange(3):
+        for i in range(3):
             self.assertAlmostEqual(nodeCoordsWithValue1[i],tes2.getMesh().getCoordinatesOfNode(0)[i],13);
             self.assertAlmostEqual(nodeCoordsWithValue2[i],tes2.getMesh().getCoordinatesOfNode(1)[i],13);
             pass
-        for i in xrange(6):
+        for i in range(6):
             self.assertAlmostEqual(expected2[i],tes2.getArray().getIJ(0,i),13);#compare tes2 and tes3
             pass
         #
@@ -1227,7 +1234,7 @@ class MEDLoaderTest3(unittest.TestCase):
         self.assertEqual([0,2,4],tes3.getMesh().getNodalConnectivityIndex().getValues())
         self.assertEqual(2,tes3.getArray().getNumberOfTuples())
         self.assertEqual(3,tes3.getArray().getNumberOfComponents())
-        for i in xrange(6):
+        for i in range(6):
             self.assertAlmostEqual(expected1[i],tes3.getArray().getIJ(0,i),13);
             pass
         pass
@@ -1644,15 +1651,15 @@ class MEDLoaderTest3(unittest.TestCase):
         coords=DataArrayDouble([0.,0.,0.,1.,1.,1.,1.,0.,0.,0.5,0.5,1.,1.,0.5,0.5,0.],8,2)
         mQ8=MEDCouplingUMesh("",2) ; mQ8.setCoords(coords)
         mQ8.allocateCells(1)
-        mQ8.insertNextCell(NORM_QUAD8,range(8))
+        mQ8.insertNextCell(NORM_QUAD8, list(range(8)))
         mQ8.finishInsertingCells()
         mQ4=MEDCouplingUMesh("",2) ; mQ4.setCoords(coords)
         mQ4.allocateCells(1)
-        mQ4.insertNextCell(NORM_QUAD4,range(4))
+        mQ4.insertNextCell(NORM_QUAD4, list(range(4)))
         mQ4.finishInsertingCells()
         mT3=MEDCouplingUMesh("",2) ; mT3.setCoords(coords)
         mT3.allocateCells(1)
-        mT3.insertNextCell(NORM_TRI3,range(3))
+        mT3.insertNextCell(NORM_TRI3, list(range(3)))
         mT3.finishInsertingCells()
         
         tr=[[0.,4.],[2.,4.],[4.,4.],[6.,4.],[8.,4.],[10.,4.],[12.,4.],[14.,4.],[16.,4.],[18.,4.],[20.,4.],[0.,0.],[2.,0.], [0.,2.],[2.,2.],[4.,2.],[6.,2.],[8.,2.],[10.,2.],[12.,2.]]
@@ -1685,7 +1692,7 @@ class MEDLoaderTest3(unittest.TestCase):
         mm.write(fname,2)
         #
         f1ts=MEDFileField1TS.New()
-        pfl=DataArrayInt(range(13)) ; pfl.setName("pfl")
+        pfl = DataArrayInt(list(range(13))) ; pfl.setName("pfl")
         self.assertRaises(InterpKernelException,f1ts.setFieldProfile,fInvalid,mm,0,pfl) # fails because no Gauss localization per cell set !
         self.assertRaises(InterpKernelException,f1ts.setFieldProfile,fInvalid2,mm,0,pfl) # fails because no Gauss localization set whereas gauss locid per cell given !
         f1ts.setFieldProfile(f,mm,0,pfl)
@@ -1809,7 +1816,7 @@ class MEDLoaderTest3(unittest.TestCase):
         m1=MEDCouplingUMesh(m0.getName(),1)
         m1.allocateCells(9)
         conn1=[0,1,0,3,3,4,4,1,5,4,2,4,1,2,3,6,5,8]
-        for i in xrange(9):
+        for i in range(9):
             m1.insertNextCell(NORM_SEG2,conn1[2*i:2*i+2])
             pass
         m1.finishInsertingCells()
@@ -1899,7 +1906,7 @@ class MEDLoaderTest3(unittest.TestCase):
         m1=MEDCouplingUMesh(m0.getName(),1)
         m1.allocateCells(9)
         conn1=[0,1,0,3,3,4,4,1,5,4,2,4,1,2,3,6,5,8]
-        for i in xrange(9):
+        for i in range(9):
             m1.insertNextCell(NORM_SEG2,conn1[2*i:2*i+2])
             pass
         m1.finishInsertingCells()
@@ -2066,13 +2073,13 @@ class MEDLoaderTest3(unittest.TestCase):
         m=MEDFileUMesh()
         coo=DataArrayDouble(9) ; coo.iota(1.) ; coo.rearrange(3) ; coo.setInfoOnComponents(["aaa [b]","cc [dd]", "e [fff]"])
         m0=MEDCouplingUMesh("toto",2) ; m0.allocateCells(0)
-        for i in xrange(7):
+        for i in range(7):
             m0.insertNextCell(NORM_TRI3,[1,2,1])
             pass
-        for i in xrange(4):
+        for i in range(4):
             m0.insertNextCell(NORM_QUAD4,[1,1,2,0])
             pass
-        for i in xrange(2):
+        for i in range(2):
             m0.insertNextCell(NORM_POLYGON,[0,0,1,1,2,2])
             pass
         m1=MEDCouplingUMesh("toto",1) ; m1.allocateCells(0) ; m1.insertNextCell(NORM_SEG2,[1,6]) ; m1.insertNextCell(NORM_SEG2,[7,3])
@@ -2143,30 +2150,30 @@ class MEDLoaderTest3(unittest.TestCase):
         m=m.buildUnstructured()
         m.setName("mm")
         f=m.getMeasureField(False)
-        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(), list(range(3552 - 100, 3552 + 100 + 4 * strMulFac)))
+        self.assertIn(f.getHeapMemorySize(), list(range(4215 - 100, 4215 + 100 + 8 * strMulFac)))
         #
         mm=MEDFileUMesh()
         mm.setMeshAtLevel(0,m)
-        self.assertIn(mm.getHeapMemorySize(),xrange(3889-100,4225+100+10*strMulFac))
+        self.assertIn(mm.getHeapMemorySize(), list(range(3889 - 100, 4225 + 100 + 10 * strMulFac)))
         ff=MEDFileField1TS()
         ff.setFieldNoProfileSBT(f)
-        self.assertIn(ff.getHeapMemorySize(),xrange(771-40,871+21+(4+1)*strMulFac))
+        self.assertIn(ff.getHeapMemorySize(), list(range(771 - 40, 871 + 21 + (4 + 1) * strMulFac)))
         #
         fff=MEDFileFieldMultiTS()
         fff.appendFieldNoProfileSBT(f)
-        self.assertIn(fff.getHeapMemorySize(),xrange(815-50,915+30+(6+2)*strMulFac))
+        self.assertIn(fff.getHeapMemorySize(), list(range(815 - 50, 915 + 30 + (6 + 2) * strMulFac)))
         f.setTime(1.,0,-1)
         fff.appendFieldNoProfileSBT(f)
-        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(), list(range(1594 - 90, 1794 + 50 + (10 + 1) * strMulFac)))
+        self.assertIn(fff[0, -1].getHeapMemorySize(), list(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(),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(), 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)))
         pass
 
     def testCurveLinearMesh1(self):
@@ -2274,20 +2281,20 @@ class MEDLoaderTest3(unittest.TestCase):
         mm.setMeshAtLevel(0,m)
         mm.setMeshAtLevel(-1,m1)
         namesCellL0=DataArrayAsciiChar(6,16)
-        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 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 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 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])
@@ -2304,7 +2311,7 @@ class MEDLoaderTest3(unittest.TestCase):
         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 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()
@@ -2313,12 +2320,12 @@ class MEDLoaderTest3(unittest.TestCase):
         c.setName("cmesh")
         cc=MEDFileCMesh()
         cc.setMesh(c)
-        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 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])
@@ -2545,11 +2552,11 @@ class MEDLoaderTest3(unittest.TestCase):
         m.setFamilyFieldArr(-2,f0)
         m.setFamilyFieldArr(1,p)
         nbOfFams=len(fns)
-        for i in xrange(nbOfFams):
+        for i in range(nbOfFams):
             m.addFamily(fns[i],fids[i])
             pass
         nbOfGrps=len(grpns)
-        for i in xrange(nbOfGrps):
+        for i in range(nbOfGrps):
             m.setFamiliesIdsOnGroup(grpns[i],famIdsPerGrp[i])
             pass
         m.setName(m2.getName())
@@ -2610,7 +2617,7 @@ class MEDLoaderTest3(unittest.TestCase):
         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__() ; 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
@@ -2624,7 +2631,7 @@ class MEDLoaderTest3(unittest.TestCase):
         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]=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)
@@ -2635,7 +2642,7 @@ class MEDLoaderTest3(unittest.TestCase):
         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]=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")
@@ -2694,7 +2701,7 @@ class MEDLoaderTest3(unittest.TestCase):
         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]=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()
@@ -2728,13 +2735,13 @@ class MEDLoaderTest3(unittest.TestCase):
         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 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 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)
@@ -2743,7 +2750,7 @@ class MEDLoaderTest3(unittest.TestCase):
         fmts0_0=MEDFileFieldMultiTS()
         fmts0_1=MEDFileFieldMultiTS()
         # time steps
-        for i in xrange(10):
+        for i in range(10):
             infos1=["aa [bb]","ccc [ddd]"] ; name1="1stField"
             d=DataArrayDouble(18) ; d.iota(i*10) ; d.rearrange(2) ; d.setInfoOnComponents(infos1)
             f=MEDCouplingFieldDouble(ON_CELLS) ; f.setName(name1) ; f.setArray(d) ; f.setMesh(m)
@@ -2806,13 +2813,13 @@ class MEDLoaderTest3(unittest.TestCase):
         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 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 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)
@@ -2825,7 +2832,7 @@ class MEDLoaderTest3(unittest.TestCase):
         fmts0_0=MEDFileFieldMultiTS()
         fmts0_1=MEDFileFieldMultiTS()
         # time steps
-        for i in xrange(10):
+        for i in range(10):
             infos1=["aa [bb]","ccc [ddd]"] ; name1="1stField"
             d=DataArrayDouble(14) ; d.iota(i*10) ; d.rearrange(2) ; d.setInfoOnComponents(infos1)
             f=MEDCouplingFieldDouble(ON_CELLS) ; f.setName(name1) ; f.setArray(d) ; f.setMesh(m)
@@ -2852,7 +2859,7 @@ class MEDLoaderTest3(unittest.TestCase):
         self.assertEqual(fs0.getPfls(),('pfl_NORM_QUAD4',))
         #
         fmts0_5=MEDFileFieldMultiTS()
-        for i in xrange(7):
+        for i in range(7):
             infos1=["aa [bb]","ccc [ddd]"] ; name1="1stField"
             d=DataArrayDouble(16) ; d.iota(i*10) ; d.rearrange(2) ; d.setInfoOnComponents(infos1)
             f=MEDCouplingFieldDouble(ON_CELLS) ; f.setName(name1) ; f.setArray(d) ; f.setMesh(m)
@@ -2871,13 +2878,13 @@ class MEDLoaderTest3(unittest.TestCase):
         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 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 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)
@@ -2891,7 +2898,7 @@ class MEDLoaderTest3(unittest.TestCase):
         fmts0_1=MEDFileFieldMultiTS()
         # time steps
         infos1=['aa [bb]','ccc [ddd]',"ZZZZ [MW*s]"]
-        for i in xrange(10):
+        for i in range(10):
             name1="1stField"
             d=DataArrayDouble(21) ; d.iota(i*10) ; d.rearrange(3) ; d.setInfoOnComponents(infos1)
             f=MEDCouplingFieldDouble(ON_CELLS) ; f.setName(name1) ; f.setArray(d) ; f.setMesh(m)
@@ -2920,7 +2927,7 @@ class MEDLoaderTest3(unittest.TestCase):
         self.assertEqual(fs1.getPfls(),('pfl_NORM_QUAD4',))
         self.assertEqual(fs1.getPflsReallyUsed(),('pfl_NORM_QUAD4',))
         self.assertEqual(4,len(fs1))
-        for i in xrange(10):
+        for i in range(10):
             for j,fieldName in enumerate(['1stField_aa','1stField_ccc','1stField_ZZZZ']):
                 f1ts=fs1[fieldName][i]
                 f=f1ts.getFieldOnMeshAtLevel(ON_CELLS,0,mm)
@@ -2940,13 +2947,13 @@ class MEDLoaderTest3(unittest.TestCase):
         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 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 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)
@@ -3042,13 +3049,13 @@ class MEDLoaderTest3(unittest.TestCase):
         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 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 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)
@@ -3078,7 +3085,7 @@ class MEDLoaderTest3(unittest.TestCase):
         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,xrange(182,465+3*strMulFac))
+        self.assertIn(heap_memory_ref, list(range(182, 465 + 3 * strMulFac)))
         ff0.loadArrays() ##
         arr=DataArrayDouble(140) ; arr.iota() ; arr.rearrange(2)
         self.assertTrue(ff0.getUndergroundDataArray().isEqualWithoutConsideringStr(arr,1e-14))
@@ -3087,7 +3094,7 @@ class MEDLoaderTest3(unittest.TestCase):
         ff0=MEDFileField1TS(fname,"FieldCellPfl",False)
         self.assertEqual(ff0.getUndergroundDataArray().getInfoOnComponents(),["XX [pm]","YYY [hm]"])
         heap_memory_ref=ff0.getHeapMemorySize()
-        self.assertIn(heap_memory_ref,xrange(350,520+7*strMulFac))
+        self.assertIn(heap_memory_ref, list(range(350, 520 + 7 * strMulFac)))
         ff0.loadArrays() ##
         arr=DataArrayDouble(100) ; arr.iota() ; arr.rearrange(2)
         self.assertTrue(ff0.getUndergroundDataArray().isEqualWithoutConsideringStr(arr,1e-14))
@@ -3105,7 +3112,7 @@ class MEDLoaderTest3(unittest.TestCase):
         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,xrange(1100,1384+3*strMulFac))
+        self.assertIn(heap_memory_ref, list(range(1100, 1384 + 3 * strMulFac)))
         ff0.unloadArrays()
         hmd=ff0.getHeapMemorySize()-heap_memory_ref
         self.assertEqual(hmd,-800) # -50*8*2
@@ -3114,14 +3121,14 @@ class MEDLoaderTest3(unittest.TestCase):
         #
         ff0=MEDFileField1TS(fname,"FieldCellPfl",-1,-1,False)
         heap_memory_ref=ff0.getHeapMemorySize()
-        self.assertIn(heap_memory_ref,xrange(299,520+7*strMulFac))
+        self.assertIn(heap_memory_ref, list(range(299, 520 + 7 * strMulFac)))
         ff0.loadArrays() ##
         self.assertTrue(ff0.getUndergroundDataArray().isEqualWithoutConsideringStr(arr,1e-14))
         self.assertEqual(ff0.getHeapMemorySize()-heap_memory_ref,50*8*2)
         #
         fieldName="FieldCellMultiTS"
         ff0=MEDFileFieldMultiTS()
-        for t in xrange(20):
+        for t in range(20):
             f0=MEDCouplingFieldDouble(ON_CELLS,ONE_TIME) ; f0.setMesh(m) ; arr=DataArrayDouble(m.getNumberOfCells()*2) ; arr.iota(float(t+1000)) ; arr.rearrange(2) ; arr.setInfoOnComponents(["X [km]","YY [mm]"]) ; f0.setArray(arr) ; f0.setName(fieldName)
             f0.setTime(float(t)+0.1,t,100+t)
             f0.checkConsistencyLight()
@@ -3131,14 +3138,14 @@ class MEDLoaderTest3(unittest.TestCase):
         #
         ff0=MEDFileAnyTypeFieldMultiTS.New(fname,fieldName,False)
         heap_memory_ref=ff0.getHeapMemorySize()
-        self.assertIn(heap_memory_ref,xrange(5536,8212+(80+26+1+len(ff0))*strMulFac))
+        self.assertIn(heap_memory_ref,list(range(5536,8212+(80+26+1+len(ff0))*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,xrange(5335,9031+(80+50+24+len(ffs))*strMulFac))
+        self.assertIn(heap_memory_ref,list(range(5335,9031+(80+50+24+len(ffs))*strMulFac)))
         ffs.loadArrays()
         self.assertEqual(ffs.getHeapMemorySize()-heap_memory_ref,20*70*8*2+70*8*2+50*8*2)
         pass
@@ -3310,13 +3317,13 @@ class MEDLoaderTest3(unittest.TestCase):
         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 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 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)
@@ -3425,13 +3432,13 @@ class MEDLoaderTest3(unittest.TestCase):
         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 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 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)
@@ -3509,7 +3516,7 @@ class MEDLoaderTest3(unittest.TestCase):
         m00=MEDCouplingUMesh("mesh",1) ; m00.setCoords(m0.getCoords()) ; m00.allocateCells(0)
         m=MEDFileUMesh()
         m.setMeshAtLevel(0,m00)
-        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
@@ -3517,7 +3524,7 @@ class MEDLoaderTest3(unittest.TestCase):
         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(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
 
@@ -3527,14 +3534,14 @@ class MEDLoaderTest3(unittest.TestCase):
         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 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 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
@@ -3752,7 +3759,7 @@ class MEDLoaderTest3(unittest.TestCase):
         #
         fmts=MEDFileFieldMultiTS()
         #
-        for i in xrange(nbCells):
+        for i in range(nbCells):
             t=(float(i)+0.1,i+1,-i-2)
             f.setTime(*t)
             arr2=DataArrayDouble(nbCells)
@@ -3821,7 +3828,7 @@ class MEDLoaderTest3(unittest.TestCase):
         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 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)
@@ -3832,7 +3839,7 @@ class MEDLoaderTest3(unittest.TestCase):
         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 xrange(36)]
+        namesNodes[:] = ["Node#%.3d        " % (i) for i in range(36)]
         mm.setRenumFieldArr(1,renum1)
         mm.setFamilyFieldArr(1,famField1)
         mm.setNameFieldAtLevel(1,namesNodes)
@@ -3900,15 +3907,15 @@ class MEDLoaderTest3(unittest.TestCase):
         f=MEDCouplingFieldDouble(ON_CELLS,ONE_TIME) ; f.setMesh(m)
         f.setName("Field")
         arr=DataArrayDouble(25,2) ; arr.setInfoOnComponents(compos)
-        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]=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)
@@ -3925,11 +3932,11 @@ class MEDLoaderTest3(unittest.TestCase):
         fs=MEDFileFields.LoadPartOf(fileName,False,ms)
         fs=fs.deepCopy()
         fs[0][0].loadArrays()
-        arr=DataArrayDouble(12,2) ; arr[:,0]=range(3,15) ; arr[:,1]=range(103,115)
+        arr = DataArrayDouble(12, 2) ; arr[:, 0] = list(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]=range(203,224) ; arr[:,1]=range(303,324)
+        arr = DataArrayDouble(21, 2) ; arr[:, 0] = list(range(203, 224)) ; arr[:, 1] = list(range(303, 324))
         arr.setInfoOnComponents(compos)
         self.assertTrue(fs[1][0].getUndergroundDataArray().isEqual(arr,1e-12))
         pass
@@ -3965,15 +3972,15 @@ class MEDLoaderTest3(unittest.TestCase):
         f=MEDCouplingFieldDouble(ON_CELLS,ONE_TIME) ; f.setMesh(m)
         f.setName("Field")
         arr=DataArrayDouble(25,2) ; arr.setInfoOnComponents(compos)
-        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]=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)
@@ -4097,7 +4104,10 @@ class MEDLoaderTest3(unittest.TestCase):
 
     @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
     def testMEDFileUMeshPickeling1(self):
-        import cPickle
+        try:
+          import cPickle as pickle
+        except ImportError:
+          import pickle
         outFileName="Pyfile86.med"
         c=DataArrayDouble([-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 ],9,2)
         c.setInfoOnComponents(["aa","bbb"])
@@ -4159,10 +4169,10 @@ class MEDLoaderTest3(unittest.TestCase):
         g2_1.setName("G2")
         mm.setGroupsAtLevel(-1,[g1_1,g2_1],False)
         g1_N=DataArrayInt.New()
-        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(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")
@@ -4182,14 +4192,14 @@ class MEDLoaderTest3(unittest.TestCase):
         self.assertTrue(mm.existsGroup("GrpOnAllCell"));
         t=mm.getGroupArr(0,"GrpOnAllCell")
         #
-        st=cPickle.dumps(mm,cPickle.HIGHEST_PROTOCOL)
-        mm2=cPickle.loads(st)
+        st=pickle.dumps(mm,pickle.HIGHEST_PROTOCOL)
+        mm2=pickle.loads(st)
         self.assertTrue(mm.isEqual(mm2,1e-12)[0])
         self.assertEqual(mm.getAxisType(),AX_CART)
         #
         mm.setAxisType(AX_CYL)
-        st=cPickle.dumps(mm,cPickle.HIGHEST_PROTOCOL)
-        mm2=cPickle.loads(st)
+        st=pickle.dumps(mm,pickle.HIGHEST_PROTOCOL)
+        mm2=pickle.loads(st)
         self.assertTrue(mm.isEqual(mm2,1e-12)[0])
         self.assertEqual(mm2.getAxisType(),AX_CYL)
         pass
@@ -4208,7 +4218,7 @@ class MEDLoaderTest3(unittest.TestCase):
         m.setName(meshName)
         #
         fmts=MEDFileFieldMultiTS()
-        for i in xrange(nbPdt):
+        for i in range(nbPdt):
             f=MEDCouplingFieldDouble(ON_NODES)
             f.setMesh(m)
             arr=DataArrayDouble(nbNodes) ; arr.iota() ; arr*=i
@@ -4226,14 +4236,14 @@ class MEDLoaderTest3(unittest.TestCase):
         fs2=MEDFileFields.LoadSpecificEntities(fileName,[(ON_NODES,NORM_ERROR)],False)
         fs.loadArraysIfNecessary()
         fs2.loadArraysIfNecessary()
-        for i in xrange(nbPdt):
+        for i in range(nbPdt):
             self.assertTrue(fs[fieldName][i].getUndergroundDataArray().isEqual(fs2[fieldName][i].getUndergroundDataArray(),1e-12))
             pass
         m1=MEDCouplingCMesh() ; m1.setCoords(DataArrayDouble([0,1,2,3]),DataArrayDouble([0,1])) ; m1=m1.buildUnstructured() ; m1.simplexize(0)
         m2=MEDCouplingCMesh() ; m2.setCoords(DataArrayDouble([3,4,5]),DataArrayDouble([0,1])) ; m2=m2.buildUnstructured()
         m3=MEDCouplingUMesh.MergeUMeshes(m1,m2) ; m3.setName(meshName)
         fmts=MEDFileFieldMultiTS()
-        for i in xrange(nbPdt):
+        for i in range(nbPdt):
             f=MEDCouplingFieldDouble(ON_CELLS)
             f.setMesh(m3)
             arr=DataArrayDouble(8) ; arr.iota() ; arr*=i
@@ -4256,7 +4266,7 @@ class MEDLoaderTest3(unittest.TestCase):
         fs2.loadArraysIfNecessary()
         fs3.loadArraysIfNecessary()
         fs4.loadArraysIfNecessary()
-        for i in xrange(nbPdt):
+        for i in range(nbPdt):
             self.assertTrue(fs[fieldName][i].getUndergroundDataArray()[:6].isEqual(fs2[fieldName][i].getUndergroundDataArray(),1e-12))
             self.assertTrue(fs[fieldName][i].getUndergroundDataArray()[6:8].isEqual(fs3[i].getUndergroundDataArray(),1e-12))
             self.assertTrue(fs[fieldName][i].getUndergroundDataArray().isEqual(fs4[fieldName][i].getUndergroundDataArray(),1e-12))
@@ -4277,12 +4287,12 @@ class MEDLoaderTest3(unittest.TestCase):
         m=m.buildUnstructured()
         m.setName(meshName)
         #
-        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 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
@@ -4330,13 +4340,13 @@ class MEDLoaderTest3(unittest.TestCase):
             fmts2.reverse()
             zeResu=fmts2.pop()
             nbIter=len(fmts2)
-            for ii in xrange(nbIter):
+            for ii in range(nbIter):
                 zeResu.pushBackTimeSteps(fmts2.pop())
                 pass
             zeResu.setName(k)
             fs2.pushField(zeResu)
             pass
-        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):
@@ -4672,6 +4682,7 @@ class MEDLoaderTest3(unittest.TestCase):
                 sys.stderr=FlushFile(os.fdopen(self.fdOfSinkFile,"w"))
             def __del__(self):
                 import os,sys
+                self.fdOfSinkFile.close()
                 sys.stderr=self.origPyVal
                 #os.fsync(self.fdOfSinkFile)
                 os.fsync(2)
@@ -4691,7 +4702,7 @@ class MEDLoaderTest3(unittest.TestCase):
         mm.setName("mesh")
         mm.write(fname,2)
         # third : change permissions to remove write access on created file
-        os.chmod(fname,0444)
+        os.chmod(fname,0o444)
         # four : try to append data on file -> check that it raises Exception
         f=MEDCouplingFieldDouble(ON_CELLS)
         f.setName("field")
@@ -4760,11 +4771,14 @@ class MEDLoaderTest3(unittest.TestCase):
       grp2=bary1.findIdsInRange(0.-1e-12,0.+1e-12) ; grp2.setName(grpName2)
       mesh.setGroupsAtLevel(-1,[grp1,grp2])
       
-      import cPickle
-      st=cPickle.dumps(mesh,2)
-      mm=cPickle.loads(st)
-      st2=cPickle.dumps(mm,2)
-      mm2=cPickle.loads(st2)
+      try:
+        import cPickle as pickle
+      except ImportError:
+        import pickle
+      st=pickle.dumps(mesh,2)
+      mm=pickle.loads(st)
+      st2=pickle.dumps(mm,2)
+      mm2=pickle.loads(st2)
       self.assertTrue(mesh.isEqual(mm2,1e-12)[0])
       pass
 
@@ -5560,7 +5574,7 @@ class MEDLoaderTest3(unittest.TestCase):
         mm1[-1]=mm1_1
         mm1.setFamilyFieldArr(-1,DataArrayInt([6,7,8,9,10,11]))
         mm1.setRenumFieldArr(-1,DataArrayInt([16,17,18,19,20,21]))
-        for i in range(1,10):
+        for i in range(1, 10):
             mm1.setFamilyId("F%d"%i,i)
         mm1.setFamilyId("FAMILLE_ZERO",0)
         mm1.setFamilyId("H1",100)
@@ -5595,7 +5609,7 @@ class MEDLoaderTest3(unittest.TestCase):
         mm2[-1]=mm2_1
         mm2.setFamilyFieldArr(-1,DataArrayInt([200,201,202,203,204,205,206,207]))
         mm2.setRenumFieldArr(-1,DataArrayInt([300,301,302,303,304,305,306,307]))
-        for i in range(1,12):
+        for i in range(1, 12):
             mm2.setFamilyId("G%d"%i,i+30)
         mm2.setFamilyId("H1",100)
         mm2.setFamilyId("FAMILLE_ZERO",0)
@@ -5792,7 +5806,7 @@ class MEDLoaderTest3(unittest.TestCase):
         m1=MEDCouplingUMesh(m0.getName(),1)
         m1.allocateCells(9)
         conn1=[0,1,0,3,3,4,4,1,5,4,2,4,1,2,3,6,5,8]
-        for i in xrange(9):
+        for i in range(9):
             m1.insertNextCell(NORM_SEG2,conn1[2*i:2*i+2])
             pass
         m1.finishInsertingCells()
@@ -5835,9 +5849,12 @@ class MEDLoaderTest3(unittest.TestCase):
         ff =mfd.getFields()[0][0].field(mfd.getMeshes()[0])
         self.assertTrue(ff2.isEqual(ff,1e-12,1e-12))
         # OK now end of joke -> serialization of MEDFileData
-        import cPickle
-        st=cPickle.dumps(mfd,cPickle.HIGHEST_PROTOCOL)
-        mfd3=cPickle.loads(st)
+        try:
+          import cPickle as pickle
+        except ImportError:
+          import pickle
+        st=pickle.dumps(mfd,pickle.HIGHEST_PROTOCOL)
+        mfd3=pickle.loads(st)
         # check of object
         self.assertEqual(len(mfd3.getMeshes()),1)
         self.assertEqual(len(mfd3.getFields()),1)
@@ -5846,23 +5863,23 @@ class MEDLoaderTest3(unittest.TestCase):
         ff3=mfd3.getFields()[0][0].field(mfd3.getMeshes()[0])
         self.assertTrue(ff3.isEqual(ff,1e-12,1e-12))
         # serialization of MEDFileFields
-        st=cPickle.dumps(mfd.getFields(),cPickle.HIGHEST_PROTOCOL)
-        fs4=cPickle.loads(st)
+        st=pickle.dumps(mfd.getFields(),pickle.HIGHEST_PROTOCOL)
+        fs4=pickle.loads(st)
         ff4=fs4[0][0].field(mfd3.getMeshes()[0])
         self.assertTrue(ff4.isEqual(ff,1e-12,1e-12))
         # serialization of MEDFileFieldMulitTS
-        st=cPickle.dumps(mfd.getFields()[0],cPickle.HIGHEST_PROTOCOL)
-        fmts5=cPickle.loads(st)
+        st=pickle.dumps(mfd.getFields()[0],pickle.HIGHEST_PROTOCOL)
+        fmts5=pickle.loads(st)
         ff5=fmts5[0].field(mfd3.getMeshes()[0])
         self.assertTrue(ff5.isEqual(ff,1e-12,1e-12))
         # serialization of MEDFileField1TS
-        st=cPickle.dumps(mfd.getFields()[0][0],cPickle.HIGHEST_PROTOCOL)
-        f1ts6=cPickle.loads(st)
+        st=pickle.dumps(mfd.getFields()[0][0],pickle.HIGHEST_PROTOCOL)
+        f1ts6=pickle.loads(st)
         ff6=f1ts6.field(mfd3.getMeshes()[0])
         self.assertTrue(ff6.isEqual(ff,1e-12,1e-12))
         # serialization of MEDFileMeshes
-        st=cPickle.dumps(mfd.getMeshes(),cPickle.HIGHEST_PROTOCOL)
-        ms7=cPickle.loads(st)
+        st=pickle.dumps(mfd.getMeshes(),pickle.HIGHEST_PROTOCOL)
+        ms7=pickle.loads(st)
         self.assertEqual(len(ms7),1)
         self.assertTrue(ms7[0].isEqual(mfd.getMeshes()[0],1e-12))
         pass
@@ -5873,17 +5890,20 @@ class MEDLoaderTest3(unittest.TestCase):
         self.testMEDMesh6() # generates MEDFileMesh5.med file
         mm=MEDFileMesh.New("MEDFileMesh5.med")
         self.assertTrue(isinstance(mm,MEDFileCMesh))
-        import cPickle
-        st=cPickle.dumps(mm,cPickle.HIGHEST_PROTOCOL)
-        mm2=cPickle.loads(st)
+        try:
+          import cPickle as pickle
+        except ImportError:
+          import pickle
+        st=pickle.dumps(mm,pickle.HIGHEST_PROTOCOL)
+        mm2=pickle.loads(st)
         self.assertTrue(isinstance(mm2,MEDFileCMesh))
         self.assertTrue(mm.getMesh().isEqual(mm2.getMesh(),1e-12))
         # CurveLinear
         self.testCurveLinearMesh1() # generates Pyfile55.med
         mm=MEDFileMesh.New("Pyfile55.med")
         self.assertTrue(isinstance(mm,MEDFileCurveLinearMesh))
-        st=cPickle.dumps(mm,cPickle.HIGHEST_PROTOCOL)
-        mm3=cPickle.loads(st)
+        st=pickle.dumps(mm,pickle.HIGHEST_PROTOCOL)
+        mm3=pickle.loads(st)
         self.assertTrue(isinstance(mm3,MEDFileCurveLinearMesh))
         self.assertTrue(mm.getMesh().isEqual(mm3.getMesh(),1e-12))
         self.testInt32InMEDFileFieldStar1()# generates Pyfile63.med
@@ -5891,23 +5911,23 @@ class MEDLoaderTest3(unittest.TestCase):
         fs4=MEDFileFields("Pyfile63.med")
         ms4=MEDFileMeshes("Pyfile63.med")
         self.assertTrue(isinstance(fs4[0],MEDFileIntFieldMultiTS))
-        st=cPickle.dumps(fs4[0],cPickle.HIGHEST_PROTOCOL)
-        fmts5=cPickle.loads(st)
+        st=pickle.dumps(fs4[0],pickle.HIGHEST_PROTOCOL)
+        fmts5=pickle.loads(st)
         self.assertEqual(len(fs4[0]),len(fmts5))
         self.assertTrue(isinstance(fmts5,MEDFileIntFieldMultiTS))
         self.assertTrue(fmts5[0].field(ms4[0]).isEqual((fs4[0][0]).field(ms4[0]),1e-12,1e-12))
         # MEDFileIntField1TS
-        st=cPickle.dumps(fs4[0][0],cPickle.HIGHEST_PROTOCOL)
-        f1ts6=cPickle.loads(st)
+        st=pickle.dumps(fs4[0][0],pickle.HIGHEST_PROTOCOL)
+        f1ts6=pickle.loads(st)
         self.assertTrue(isinstance(f1ts6,MEDFileIntField1TS))
         self.assertTrue(f1ts6.field(ms4[0]).isEqual((fs4[0][0]).field(ms4[0]),1e-12,1e-12))
         # MEDFileParameters
         self.testParameters1()# generates Pyfile56.med
         params=MEDFileParameters("Pyfile56.med")
-        st=cPickle.dumps(params,cPickle.HIGHEST_PROTOCOL)
-        params7=cPickle.loads(st)
+        st=pickle.dumps(params,pickle.HIGHEST_PROTOCOL)
+        params7=pickle.loads(st)
         self.assertEqual(len(params),len(params7))
-        for i in xrange(len(params)):
+        for i in range(len(params)):
             self.assertTrue(params[i].isEqual(params7[i],1e-12)[0])
             pass
         pass
index 669c71c901f9240981a95171b47be5a081210540..1efc267ebce4cbe81bc0974a4b82dc7200870ec1 100644 (file)
@@ -37,13 +37,13 @@ class MEDLoaderTest4(unittest.TestCase):
         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 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 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)
@@ -181,7 +181,7 @@ class MEDLoaderTest4(unittest.TestCase):
         mml=fcscp.buildFromScratchDataSetSupport(0,fields)
         mml2=mml.prepare()
         self.assertTrue(isinstance(mml2,MEDUMeshMultiLev))
-        for i in xrange(1,5):
+        for i in range(1, 5):
             self.assertTrue(fcscp.isDataSetSupportEqualToThePreviousOne(i,fields))
             pass
         ncc,a0,a1,a2,a3,a4,a5=mml2.buildVTUArrays()
@@ -199,7 +199,7 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(a8.isEqual(DataArrayInt([120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,100,101,102,103,104,105,106,107,108])))
         self.assertTrue(not a9)
         self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
-        for i in xrange(5):
+        for i in range(5):
             fsst=MEDFileField1TSStructItem.BuildItemFrom(fields[0][i],mst)
             fields[0][i].loadArraysIfNecessary()
             tmpMem=fields.getHeapMemorySize()
@@ -222,13 +222,13 @@ class MEDLoaderTest4(unittest.TestCase):
         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 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 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)
@@ -399,7 +399,7 @@ class MEDLoaderTest4(unittest.TestCase):
         mml=fcscp.buildFromScratchDataSetSupport(0,fields)
         mml2=mml.prepare()
         assert isinstance(mml2,MEDUMeshMultiLev)
-        for i in xrange(1,5):
+        for i in range(1, 5):
             self.assertTrue(fcscp.isDataSetSupportEqualToThePreviousOne(i,fields))
             pass
         ncc,a0,a1,a2,a3,a4,a5=mml2.buildVTUArrays()
@@ -412,7 +412,7 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(a5 is None)
         self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
         # for cells
-        for i in xrange(5):
+        for i in range(5):
             f=allFMTSLeavesPerCommonSupport[0][0][0][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)# Second 0 is for cells
             f.loadArraysIfNecessary()
@@ -421,7 +421,7 @@ class MEDLoaderTest4(unittest.TestCase):
             vExp=DataArrayDouble([200.,201.,202.,203.,204.,205.,206.,207.,208.,209.,210.,211.,212.,213.,214.,215.,216.,217.,218.,219.,220.,221.,222.,223.,224.,225.,226.,227.,228.,229.,230.,231.,232.,233.,234.,235.,236.,237.,238.,239.,240.,241.,242.,243.,244.,245.,246.,247.,248.,249.,250.,251.,252.,253.,254.,255.,256.,257.,258.,259.,260.,261.,262.,263.,100.,101.,102.,103.,104.,105.,106.,107.,108.,109.,110.,111.,112.,113.,114.,115.,116.,117.],41,2) ; vExp.setInfoOnComponents(['Comp1 [m]','Com2 [s^2]']) ; vExp+=i*1000
             self.assertTrue(v.isEqual(vExp,1e-12))
             pass
-        for i in xrange(5):
+        for i in range(5):
             f=allFMTSLeavesPerCommonSupport[0][0][1][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)# Second 0 is for cells
             f.loadArraysIfNecessary()
@@ -441,13 +441,13 @@ class MEDLoaderTest4(unittest.TestCase):
         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 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 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)
@@ -564,7 +564,7 @@ class MEDLoaderTest4(unittest.TestCase):
         mml=fcscp.buildFromScratchDataSetSupport(0,fields)
         mml2=mml.prepare()
         self.assertTrue(isinstance(mml2,MEDUMeshMultiLev))
-        for i in xrange(1,3):
+        for i in range(1, 3):
             self.assertTrue(fcscp.isDataSetSupportEqualToThePreviousOne(i,fields))
             pass
         ncc,a0,a1,a2,a3,a4,a5=mml2.buildVTUArrays()
@@ -577,7 +577,7 @@ class MEDLoaderTest4(unittest.TestCase):
         assert a5 is None
         self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
         # for cells
-        for i in xrange(3):
+        for i in range(3):
             f=allFMTSLeavesPerCommonSupport[0][0][0][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)# Second 0 is for cells
             f.loadArraysIfNecessary()
@@ -595,7 +595,7 @@ class MEDLoaderTest4(unittest.TestCase):
         mml=fcscp.buildFromScratchDataSetSupport(0,fields)
         mml2=mml.prepare()
         self.assertTrue(isinstance(mml2,MEDUMeshMultiLev))
-        for i in xrange(1,2):
+        for i in range(1, 2):
             self.assertTrue(fcscp.isDataSetSupportEqualToThePreviousOne(i,fields))
             pass
         ncc,a0,a1,a2,a3,a4,a5=mml2.buildVTUArrays()
@@ -607,7 +607,7 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(a4 is None)
         self.assertTrue(a5 is None)
         self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
-        for i in xrange(2):
+        for i in range(2):
             f=allFMTSLeavesPerCommonSupport[0][0][0][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)# Second 0 is for cells
             f.loadArraysIfNecessary()
@@ -627,13 +627,13 @@ class MEDLoaderTest4(unittest.TestCase):
         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 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 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)
@@ -823,7 +823,7 @@ class MEDLoaderTest4(unittest.TestCase):
         mml=fcscp.buildFromScratchDataSetSupport(0,fields)
         mml2=mml.prepare()
         self.assertTrue(isinstance(mml2,MEDUMeshMultiLev))
-        for i in xrange(1,5):
+        for i in range(1, 5):
             self.assertTrue(fcscp.isDataSetSupportEqualToThePreviousOne(i,fields))
             pass
         ncc,a0,a1,a2,a3,a4,a5=mml2.buildVTUArrays()
@@ -836,7 +836,7 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(a5 is None)
         self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
         # test all the time steps of the 1/1 time step serie, on field 1
-        for i in xrange(5):
+        for i in range(5):
             f=allFMTSLeavesPerCommonSupport[0][0][0][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
             f.loadArraysIfNecessary()
@@ -847,7 +847,7 @@ class MEDLoaderTest4(unittest.TestCase):
             self.assertTrue(v.isEqual(vExp,1e-12))
             pass
         # test all the time steps of the 1/1 time step serie, on field 2
-        for i in xrange(5):
+        for i in range(5):
             f=allFMTSLeavesPerCommonSupport[0][0][1][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
             f.loadArraysIfNecessary()
@@ -858,7 +858,7 @@ class MEDLoaderTest4(unittest.TestCase):
             self.assertTrue(v.isEqual(vExp,1e-12))
             pass
         # test all the time steps of the 1/1 time step serie, on field 3
-        for i in xrange(5):
+        for i in range(5):
             f=allFMTSLeavesPerCommonSupport[0][0][2][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
             f.loadArraysIfNecessary()
@@ -893,7 +893,7 @@ class MEDLoaderTest4(unittest.TestCase):
         fieldName3="zeField3" ; pfl3=DataArrayInt([0,1,2,3,4,5,9,10]) ; pfl3.setName("pfl3") # on cells but different support
         fs1=MEDFileFieldMultiTS() ; fs2=MEDFileFieldMultiTS() ; fs3=MEDFileFieldMultiTS()
         #
-        for i in xrange(5):
+        for i in range(5):
             f=MEDFileField1TS()
             fNode=MEDCouplingFieldDouble(ON_CELLS) ; fNode.setTime(float(i),i,0)
             fNode.setName(fieldName1)
@@ -955,7 +955,7 @@ class MEDLoaderTest4(unittest.TestCase):
         mml=fcscp.buildFromScratchDataSetSupport(0,fields)
         mml2=mml.prepare()
         self.assertTrue(isinstance(mml2,MEDUMeshMultiLev))
-        for i in xrange(1,5):
+        for i in range(1, 5):
             self.assertTrue((fcscp.isDataSetSupportEqualToThePreviousOne(i,fields)))
             pass
         ncc,a0,a1,a2,a3,a4,a5=mml2.buildVTUArrays()
@@ -973,10 +973,10 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(a8.isEqual(DataArrayInt([100,101,102,103,104,105])))
         self.assertTrue(not a9)
         self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
-        for i in xrange(5):
+        for i in range(5):
             nbOfT=[6,8]
             fieldNames=[fieldName1,fieldName2]
-            for j in xrange(2):
+            for j in range(2):
                 m={"i":j}
                 f=allFMTSLeavesPerCommonSupport[0][0][j][i]
                 fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
@@ -993,7 +993,7 @@ class MEDLoaderTest4(unittest.TestCase):
         mml=fcscp.buildFromScratchDataSetSupport(0,fields)
         mml2=mml.prepare()
         self.assertTrue(isinstance(mml2,MEDUMeshMultiLev))
-        for i in xrange(1,5):
+        for i in range(1, 5):
             self.assertTrue(fcscp.isDataSetSupportEqualToThePreviousOne(i,fields))
             pass
         ncc,a0,a1,a2,a3,a4,a5=mml2.buildVTUArrays()
@@ -1011,7 +1011,7 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(a8.isEqual(DataArrayInt([100,101,102,103,104,105,109,110])))
         self.assertTrue(not a9)
         self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
-        for i in xrange(5):
+        for i in range(5):
             f=allFMTSLeavesPerCommonSupport[1][0][0][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
             f.loadArraysIfNecessary()
@@ -1043,7 +1043,7 @@ class MEDLoaderTest4(unittest.TestCase):
         fieldName4="zeField4" ;# on nodes
         fs0=MEDFileFieldMultiTS() ; fs1=MEDFileFieldMultiTS() ; fs2=MEDFileFieldMultiTS() ; fs3=MEDFileFieldMultiTS() ; fs4=MEDFileFieldMultiTS()
         #
-        for i in xrange(5):
+        for i in range(5):
             f=MEDFileField1TS()
             fNode=MEDCouplingFieldDouble(ON_CELLS) ; fNode.setTime(float(i),i,0)
             fNode.setName(fieldName0) ; fNode.setMesh(m)
@@ -1128,7 +1128,7 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(a.isEqual(coordsX,1e-12))
         self.assertTrue(b.isEqual(coordsY,1e-12))
         self.assertTrue(isinstance(mml2,MEDCMeshMultiLev))
-        for i in xrange(1,5):
+        for i in range(1, 5):
             self.assertTrue((fcscp.isDataSetSupportEqualToThePreviousOne(i,fields)))
             pass
         a6,a7=mml2.retrieveFamilyIdsOnCells()
@@ -1141,7 +1141,7 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(a10.isEqual(DataArrayInt([200,201,202,203,204,205,206,207,208,209,210,211,212,213,214])))
         self.assertTrue(a11) # True because no copy
         self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
-        for i in xrange(5):
+        for i in range(5):
             f=allFMTSLeavesPerCommonSupport[0][0][0][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
             f.loadArraysIfNecessary()
@@ -1179,10 +1179,10 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(a10.isEqual(DataArrayInt([202,203,204,207,208,209,212,213,214])))
         self.assertTrue(not a11) # False because copy
         self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
-        for i in xrange(1,5):
+        for i in range(1, 5):
             self.assertTrue((fcscp.isDataSetSupportEqualToThePreviousOne(i,fields)))
             pass
-        for i in xrange(5):
+        for i in range(5):
             f=allFMTSLeavesPerCommonSupport[1][0][0][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
             f.loadArraysIfNecessary()
@@ -1223,7 +1223,7 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(a8.isEqual(DataArrayInt([102,103,105,107])))
         self.assertTrue(not a9) # False because copy
         self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
-        for i in xrange(5):
+        for i in range(5):
             f=allFMTSLeavesPerCommonSupport[2][0][0][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
             f.loadArraysIfNecessary()
@@ -1255,7 +1255,7 @@ class MEDLoaderTest4(unittest.TestCase):
         fieldName4="zeField4" ;# on nodes
         fs0=MEDFileFieldMultiTS() ; fs1=MEDFileFieldMultiTS() ; fs2=MEDFileFieldMultiTS() ; fs3=MEDFileFieldMultiTS() ; fs4=MEDFileFieldMultiTS()
         #
-        for i in xrange(5):
+        for i in range(5):
             f=MEDFileField1TS()
             fNode=MEDCouplingFieldDouble(ON_CELLS) ; fNode.setTime(float(i),i,0)
             fNode.setName(fieldName0) ; fNode.setMesh(m)
@@ -1347,10 +1347,10 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(a8.isEqual(DataArrayInt([100,101,102,103,104,105,106,107])))
         self.assertTrue(a9) # True because no copy
         self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
-        for i in xrange(1,5):
+        for i in range(1, 5):
             self.assertTrue((fcscp.isDataSetSupportEqualToThePreviousOne(i,fields)))
             pass
-        for i in xrange(5):
+        for i in range(5):
             f=allFMTSLeavesPerCommonSupport[0][0][0][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
             f.loadArraysIfNecessary()
@@ -1385,10 +1385,10 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(a8.isEqual(DataArrayInt([102,103,106,107])))
         self.assertTrue(not a9) # False because copy
         self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
-        for i in xrange(1,5):
+        for i in range(1, 5):
             self.assertTrue((fcscp.isDataSetSupportEqualToThePreviousOne(i,fields)))
             pass
-        for i in xrange(5):
+        for i in range(5):
             f=allFMTSLeavesPerCommonSupport[1][0][0][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
             f.loadArraysIfNecessary()
@@ -1429,7 +1429,7 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(a8.isEqual(DataArrayInt([102,103,105,107])))
         self.assertTrue(not a9) # False because copy
         self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
-        for i in xrange(5):
+        for i in range(5):
             f=allFMTSLeavesPerCommonSupport[2][0][0][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
             f.loadArraysIfNecessary()
@@ -1461,7 +1461,7 @@ class MEDLoaderTest4(unittest.TestCase):
         fieldName2="zeField2"
         fieldName3="zeField3"
         fs0=MEDFileFieldMultiTS() ; fs1=MEDFileFieldMultiTS() ; fs2=MEDFileFieldMultiTS() ; fs3=MEDFileFieldMultiTS()
-        for i in xrange(5):
+        for i in range(5):
             f=MEDFileField1TS()
             fNode=MEDCouplingFieldDouble(ON_GAUSS_NE) ; fNode.setTime(float(i),i,0)
             fNode.setName(fieldName0) ; fNode.setMesh(m)
@@ -1545,10 +1545,10 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(a4 is None)
         self.assertTrue(a5 is None)
         self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
-        for i in xrange(1,5):
+        for i in range(1, 5):
             self.assertTrue((fcscp.isDataSetSupportEqualToThePreviousOne(i,fields)))
             pass
-        for i in xrange(5):
+        for i in range(5):
             f=allFMTSLeavesPerCommonSupport[0][0][0][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
             f.loadArraysIfNecessary()
@@ -1610,7 +1610,7 @@ class MEDLoaderTest4(unittest.TestCase):
         pfl1=DataArrayInt([0,1,7,9,10]) ; pfl1.setName("pfl1") # on cells
         pfl2=DataArrayInt([1,2,3,6,7,8,11,12,13]) ; pfl2.setName("pfl2") # on nodes
         fs0=MEDFileFieldMultiTS() ; fs1=MEDFileFieldMultiTS() ; fs2=MEDFileFieldMultiTS() ; fs3=MEDFileFieldMultiTS()
-        for i in xrange(5):
+        for i in range(5):
             f=MEDFileField1TS()
             fNode=MEDCouplingFieldDouble(ON_GAUSS_NE) ; fNode.setTime(float(i),i,0)
             fNode.setName(fieldName0)
@@ -1694,10 +1694,10 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(a4 is None)
         self.assertTrue(a5 is None)
         self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
-        for i in xrange(1,5):
+        for i in range(1, 5):
             self.assertTrue((fcscp.isDataSetSupportEqualToThePreviousOne(i,fields)))
             pass
-        for i in xrange(5):
+        for i in range(5):
             f=allFMTSLeavesPerCommonSupport[0][0][0][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
             f.loadArraysIfNecessary()
@@ -1756,7 +1756,7 @@ class MEDLoaderTest4(unittest.TestCase):
         fieldName2="zeField2"
         pfl1=DataArrayInt([1,2,3,6,7,8,11,12,13]) ; pfl1.setName("pfl1") # on nodes
         fs0=MEDFileFieldMultiTS() ; fs1=MEDFileFieldMultiTS() ; fs2=MEDFileFieldMultiTS()
-        for i in xrange(5):
+        for i in range(5):
             f=MEDFileField1TS()
             fNode=MEDCouplingFieldDouble(ON_NODES) ; fNode.setTime(float(i),i,0)
             fNode.setName(fieldName0)
@@ -1828,10 +1828,10 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(a4 is None)
         self.assertTrue(a5 is None)
         self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
-        for i in xrange(1,5):
+        for i in range(1, 5):
             self.assertTrue((fcscp.isDataSetSupportEqualToThePreviousOne(i,fields)))
             pass
-        for i in xrange(5):
+        for i in range(5):
             f=allFMTSLeavesPerCommonSupport[0][0][0][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
             f.loadArraysIfNecessary()
@@ -1874,7 +1874,7 @@ class MEDLoaderTest4(unittest.TestCase):
         #
         fieldName0="zeField0"
         fs0=MEDFileFieldMultiTS()
-        for i in xrange(5):
+        for i in range(5):
             f=MEDFileField1TS()
             fNode=MEDCouplingFieldDouble(ON_GAUSS_PT) ; fNode.setTime(float(i),i,0)
             fNode.setName(fieldName0) ; fNode.setMesh(m)
@@ -1932,10 +1932,10 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(a4 is None)
         self.assertTrue(a5 is None)
         self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
-        for i in xrange(1,5):
+        for i in range(1, 5):
             self.assertTrue((fcscp.isDataSetSupportEqualToThePreviousOne(i,fields)))
             pass
-        for i in xrange(5):
+        for i in range(5):
             f=allFMTSLeavesPerCommonSupport[0][0][0][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
             f.loadArraysIfNecessary()
@@ -1962,7 +1962,7 @@ class MEDLoaderTest4(unittest.TestCase):
         fieldName0="zeField0"
         fieldName1="zeField1"
         fs0=MEDFileFieldMultiTS() ; fs1=MEDFileFieldMultiTS()
-        for i in xrange(5):
+        for i in range(5):
             f=MEDFileField1TS()
             fNode=MEDCouplingFieldDouble(ON_GAUSS_PT) ; fNode.setTime(float(i),i,0)
             fNode.setName(fieldName0) ; fNode.setMesh(m)
@@ -2028,10 +2028,10 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(a4 is None)
         self.assertTrue(a5 is None)
         self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
-        for i in xrange(1,5):
+        for i in range(1, 5):
             self.assertTrue((fcscp.isDataSetSupportEqualToThePreviousOne(i,fields)))
             pass
-        for i in xrange(5):
+        for i in range(5):
             f=allFMTSLeavesPerCommonSupport[0][0][0][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
             f.loadArraysIfNecessary()
@@ -2068,7 +2068,7 @@ class MEDLoaderTest4(unittest.TestCase):
             fieldName1="zeField1"
             fieldName2="zeField2" ; pfl1=DataArrayInt([2,3]) ; pfl1.setName("pfl1")
             fieldName3="zefield3" ; pfl2=DataArrayInt([2,3,4]) ; pfl2.setName("pfl2")
-            for i in xrange(5):
+            for i in range(5):
                 f=MEDFileField1TS()
                 fNode=MEDCouplingFieldDouble(ON_CELLS) ; fNode.setTime(float(i),i,0)
                 fNode.setName(fieldName0) ; fNode.setMesh(m)
@@ -2148,11 +2148,11 @@ class MEDLoaderTest4(unittest.TestCase):
             self.assertTrue(a4.isEqual(DataArrayInt([-1,-1,0,31,62])))
             self.assertTrue(a5.isEqual(DataArrayInt([6,4,3,2,8,9,4,15,21,20,14,4,3,15,14,2,4,2,14,20,8,4,8,20,21,9,4,9,21,15,3,6,4,4,3,9,10,4,16,22,21,15,4,4,16,15,3,4,3,15,21,9,4,9,21,22,10,4,10,22,16,4,6,4,5,4,10,11,4,17,23,22,16,4,5,17,16,4,4,4,16,22,10,4,10,22,23,11,4,11,23,17,5])))
             self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
-            for i in xrange(1,5):
+            for i in range(1, 5):
                 self.assertTrue((fcscp.isDataSetSupportEqualToThePreviousOne(i,fields)))
                 pass
             pass
-            for i in xrange(5):
+            for i in range(5):
                 f=allFMTSLeavesPerCommonSupport[0][0][0][i]
                 fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
                 f.loadArraysIfNecessary()
@@ -2185,11 +2185,11 @@ class MEDLoaderTest4(unittest.TestCase):
             self.assertTrue(a4.isEqual(DataArrayInt([0,31])))
             self.assertTrue(a5.isEqual(DataArrayInt([6,4,3,2,8,9,4,15,21,20,14,4,3,15,14,2,4,2,14,20,8,4,8,20,21,9,4,9,21,15,3,6,4,4,3,9,10,4,16,22,21,15,4,4,16,15,3,4,3,15,21,9,4,9,21,22,10,4,10,22,16,4])))
             self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
-            for i in xrange(1,5):
+            for i in range(1, 5):
                 self.assertTrue((fcscp.isDataSetSupportEqualToThePreviousOne(i,fields)))
                 pass
             pass
-            for i in xrange(5):
+            for i in range(5):
                 f=allFMTSLeavesPerCommonSupport[1][0][0][i]
                 fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
                 f.loadArraysIfNecessary()
@@ -2212,11 +2212,11 @@ class MEDLoaderTest4(unittest.TestCase):
             self.assertTrue(a3.isEqual(DataArrayInt([8,2,3,8,9,14,15,20,21,8,3,4,9,10,15,16,21,22,8,4,5,10,11,16,17,22,23])))
             self.assertTrue(a4.isEqual(DataArrayInt([0,31,62])))
             self.assertTrue(a5.isEqual(DataArrayInt([6,4,3,2,8,9,4,15,21,20,14,4,3,15,14,2,4,2,14,20,8,4,8,20,21,9,4,9,21,15,3,6,4,4,3,9,10,4,16,22,21,15,4,4,16,15,3,4,3,15,21,9,4,9,21,22,10,4,10,22,16,4,6,4,5,4,10,11,4,17,23,22,16,4,5,17,16,4,4,4,16,22,10,4,10,22,23,11,4,11,23,17,5])))
-            for i in xrange(1,5):
+            for i in range(1, 5):
                 self.assertTrue((fcscp.isDataSetSupportEqualToThePreviousOne(i,fields)))
                 pass
             pass
-            for i in xrange(5):
+            for i in range(5):
                 f=allFMTSLeavesPerCommonSupport[2][0][0][i]
                 fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
                 f.loadArraysIfNecessary()
@@ -2242,7 +2242,7 @@ class MEDLoaderTest4(unittest.TestCase):
             fs0=MEDFileFieldMultiTS() ; fs1=MEDFileFieldMultiTS()
             fieldName0="zeField0"
             fieldName1="zeField1"
-            for i in xrange(5):
+            for i in range(5):
                 f=MEDFileField1TS()
                 fNode=MEDCouplingFieldDouble(ON_CELLS) ; fNode.setTime(float(i),i,0)
                 fNode.setName(fieldName0) ; fNode.setMesh(m)
@@ -2304,7 +2304,7 @@ class MEDLoaderTest4(unittest.TestCase):
             self.assertTrue(a4.isEqual(DataArrayInt([0,31,62])))
             self.assertTrue(a5.isEqual(DataArrayInt([6,4,3,2,8,9,4,15,21,20,14,4,3,15,14,2,4,2,14,20,8,4,8,20,21,9,4,9,21,15,3,6,4,4,3,9,10,4,16,22,21,15,4,4,16,15,3,4,3,15,21,9,4,9,21,22,10,4,10,22,16,4,6,4,5,4,10,11,4,17,23,22,16,4,5,17,16,4,4,4,16,22,10,4,10,22,23,11,4,11,23,17,5])))
             self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
-            for i in xrange(1,5):
+            for i in range(1, 5):
                 self.assertTrue((fcscp.isDataSetSupportEqualToThePreviousOne(i,fields)))
                 pass
             a6,a7=mml2.retrieveFamilyIdsOnCells()
@@ -2313,7 +2313,7 @@ class MEDLoaderTest4(unittest.TestCase):
             a8,a9=mml2.retrieveNumberIdsOnCells()
             self.assertTrue(a8 is None)
             self.assertTrue(a9)
-            for i in xrange(5):
+            for i in range(5):
                 f=allFMTSLeavesPerCommonSupport[0][0][0][i]
                 fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
                 f.loadArraysIfNecessary()
@@ -2742,12 +2742,12 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(a8.isEqual(DataArrayInt([0,1])))
         self.assertTrue(a9) # no copy here
         self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
-        for i in xrange(1,2):
+        for i in range(1, 2):
             self.assertTrue((fcscp.isDataSetSupportEqualToThePreviousOne(i,fields)))
             pass
         vExp0=[DataArrayDouble([7.,11.]),DataArrayDouble([11.,7.])]
         vExp1=[DataArrayDouble([3.,5.,7.,6.,2.,3.,11.,8.]),DataArrayDouble([7.,6.,3.,5.,11.,8.,2.,3.])]
-        for i in xrange(2):
+        for i in range(2):
             f=allFMTSLeavesPerCommonSupport1[0][0][0][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
             f.loadArraysIfNecessary()
@@ -2860,12 +2860,12 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(a8.isEqual(DataArrayInt([0,1])))
         self.assertTrue(a9) # no copy here
         self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
-        for i in xrange(1,2):
+        for i in range(1, 2):
             self.assertTrue((fcscp.isDataSetSupportEqualToThePreviousOne(i,fields)))
             pass
         vExp0=[DataArrayDouble([7.,11.]),DataArrayDouble([11.,7.])]
         vExp1=[DataArrayDouble([3.,5.,4.,6.]),DataArrayDouble([5.,3.,6.,4.])]
-        for i in xrange(2):
+        for i in range(2):
             f=allFMTSLeavesPerCommonSupport1[0][0][0][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
             f.loadArraysIfNecessary()
@@ -2929,12 +2929,12 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(a8.isEqual(DataArrayInt([0,1])))
         self.assertTrue(a9) # no copy here
         self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
-        for i in xrange(1,2):
+        for i in range(1, 2):
             self.assertTrue((fcscp.isDataSetSupportEqualToThePreviousOne(i,fields)))
             pass
         vExp0=[DataArrayDouble([7.,11.]),DataArrayDouble([11.,7.])]
         vExp1=[DataArrayDouble([3.,5.,4.,6.]),DataArrayDouble([5.,3.,6.,4.])]
-        for i in xrange(2):
+        for i in range(2):
             f=allFMTSLeavesPerCommonSupport1[0][0][0][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst) # no load needed here
             v=mml.buildDataArray(fsst,fields,f.getUndergroundDataArray())
@@ -3041,10 +3041,10 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(not a12)
         self.assertTrue(a13) # no copy here
         self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
-        for i in xrange(1,2):
+        for i in range(1, 2):
             self.assertTrue((fcscp.isDataSetSupportEqualToThePreviousOne(i,fields)))
             pass
-        for i in xrange(2):
+        for i in range(2):
             f=allFMTSLeavesPerCommonSupport1[0][0][0][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
             f.loadArraysIfNecessary()
@@ -3227,10 +3227,10 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(a12.isEqual(DataArrayInt([0,10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200,210,220,230,240])))
         self.assertTrue(a13) # no copy here
         self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
-        for i in xrange(1,2):
+        for i in range(1, 2):
             self.assertTrue((fcscp.isDataSetSupportEqualToThePreviousOne(i,fields)))
             pass
-        for i in xrange(2):
+        for i in range(2):
             f=allFMTSLeavesPerCommonSupport1[0][0][0][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
             f.loadArraysIfNecessary()
@@ -3280,7 +3280,7 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(a12.isEqual(DataArrayInt([50,60,70,100,110,120,150,160,170,200,210,220])))
         self.assertTrue(not a13) # copy here
         self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
-        for i in xrange(2):
+        for i in range(2):
             f=allFMTSLeavesPerCommonSupport1[1][0][0][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
             f.loadArraysIfNecessary()
@@ -3633,7 +3633,7 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(b.isEqual(arr1,1e-12))
         self.assertTrue(c.isEqual(arr2,1e-12))
         self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
-        for i in xrange(2):
+        for i in range(2):
             f=allFMTSLeavesPerCommonSupport[0][0][0][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
             f.loadArraysIfNecessary()
@@ -4388,7 +4388,7 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
         self.assertEqual(v.getHiddenCppPointer(),ffGauss.getUndergroundDataArray().getHiddenCppPointer())
         self.assertEqual(ffGauss.getName(),"fGauss")
-        self.assertTrue(v.isEqual(arrGauss,1e-12)) ; self.assertTrue(v.isEqualWithoutConsideringStr(DataArrayDouble(range(27)),1e-12)) ; self.assertEqual(v.getInfoOnComponents(),["gaussc"])
+        self.assertTrue(v.isEqual(arrGauss, 1e-12)) ; self.assertTrue(v.isEqualWithoutConsideringStr(DataArrayDouble(list(range(27))), 1e-12)) ; self.assertEqual(v.getInfoOnComponents(), ["gaussc"])
         ffGauss=allFMTSLeavesPerCommonSupport1[0][0][1][0]
         pass
 
@@ -4417,7 +4417,7 @@ class MEDLoaderTest4(unittest.TestCase):
         #
         fmts0=MEDFileFieldMultiTS()
         fmts1=MEDFileFieldMultiTS()
-        for i in xrange(30):
+        for i in range(30):
             f1ts=MEDFileField1TS()
             fFaces=MEDCouplingFieldDouble(ON_CELLS) ; fFaces.setName("FieldOnFaces")
             arr=DataArrayDouble(98) ; arr.iota() ; arr[i]=100.
@@ -4480,7 +4480,7 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(b.isEqual(arrY,1e-12))
         self.assertTrue(c.isEqual(arrZ,1e-12))
         self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
-        for i in xrange(30):
+        for i in range(30):
             ffCell=allFMTSLeavesPerCommonSupport1[0][0][0][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(ffCell,mst)
             ffCell.loadArraysIfNecessary()
@@ -4504,7 +4504,7 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(a3.isEqual(DataArrayInt([4,0,12,15,3,4,12,24,27,15,4,24,36,39,27,4,36,48,51,39,4,3,15,18,6,4,15,27,30,18,4,27,39,42,30,4,39,51,54,42,4,6,18,21,9,4,18,30,33,21,4,30,42,45,33,4,42,54,57,45,4,1,13,16,4,4,13,25,28,16,4,25,37,40,28,4,37,49,52,40,4,4,16,19,7,4,16,28,31,19,4,28,40,43,31,4,40,52,55,43,4,7,19,22,10,4,19,31,34,22,4,31,43,46,34,4,43,55,58,46,4,2,14,17,5,4,14,26,29,17,4,26,38,41,29,4,38,50,53,41,4,5,17,20,8,4,17,29,32,20,4,29,41,44,32,4,41,53,56,44,4,8,20,23,11,4,20,32,35,23,4,32,44,47,35,4,44,56,59,47,4,0,12,13,1,4,12,24,25,13,4,24,36,37,25,4,36,48,49,37,4,1,13,14,2,4,13,25,26,14,4,25,37,38,26,4,37,49,50,38,4,3,15,16,4,4,15,27,28,16,4,27,39,40,28,4,39,51,52,40,4,4,16,17,5,4,16,28,29,17,4,28,40,41,29,4,40,52,53,41,4,6,18,19,7,4,18,30,31,19,4,30,42,43,31,4,42,54,55,43,4,7,19,20,8,4,19,31,32,20,4,31,43,44,32,4,43,55,56,44,4,9,21,22,10,4,21,33,34,22,4,33,45,46,34,4,45,57,58,46,4,10,22,23,11,4,22,34,35,23,4,34,46,47,35,4,46,58,59,47,4,0,1,4,3,4,3,4,7,6,4,6,7,10,9,4,1,2,5,4,4,4,5,8,7,4,7,8,11,10,4,12,13,16,15,4,15,16,19,18,4,18,19,22,21,4,13,14,17,16,4,16,17,20,19,4,19,20,23,22,4,24,25,28,27,4,27,28,31,30,4,30,31,34,33,4,25,26,29,28,4,28,29,32,31,4,31,32,35,34,4,36,37,40,39,4,39,40,43,42,4,42,43,46,45,4,37,38,41,40,4,40,41,44,43,4,43,44,47,46,4,48,49,52,51,4,51,52,55,54,4,54,55,58,57,4,49,50,53,52,4,52,53,56,55,4,55,56,59,58])))
         self.assertTrue(a4 is None)
         self.assertTrue(a5 is None)
-        for i in xrange(30):
+        for i in range(30):
             ffCell=allFMTSLeavesPerCommonSupport1[1][0][0][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(ffCell,mst)
             ffCell.loadArraysIfNecessary()
@@ -4537,7 +4537,7 @@ class MEDLoaderTest4(unittest.TestCase):
         fmts0=MEDFileFieldMultiTS()
         fmts1=MEDFileFieldMultiTS()
         pfl=DataArrayInt(11) ; pfl.iota() ; pfl.setName("PflOnHECA8")
-        for i in xrange(30):
+        for i in range(30):
             f1ts=MEDFileField1TS()
             fFaces=MEDCouplingFieldDouble(ON_CELLS) ; fFaces.setName("FieldOnCells")
             arr=DataArrayDouble(11) ; arr.iota() ; arr[i%11]=100.
@@ -4593,7 +4593,7 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(a3.isEqual(DataArrayInt([8,1,0,3,4,13,12,15,16,8,2,1,4,5,14,13,16,17,8,4,3,6,7,16,15,18,19,8,5,4,7,8,17,16,19,20,8,7,6,9,10,19,18,21,22,8,8,7,10,11,20,19,22,23,8,13,12,15,16,25,24,27,28,8,14,13,16,17,26,25,28,29,8,16,15,18,19,28,27,30,31,8,17,16,19,20,29,28,31,32,8,19,18,21,22,31,30,33,34])))
         self.assertTrue(a4 is None)
         self.assertTrue(a5 is None)
-        for i in xrange(30):
+        for i in range(30):
             ffCell=allFMTSLeavesPerCommonSupport1[0][0][0][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(ffCell,mst)
             ffCell.loadArraysIfNecessary()
@@ -4628,7 +4628,7 @@ class MEDLoaderTest4(unittest.TestCase):
         fmts0=MEDFileFieldMultiTS()
         fmts1=MEDFileFieldMultiTS()
         pfl=DataArrayInt(31) ; pfl.iota() ; pfl.setName("PflOnQUAD4")
-        for i in xrange(30):
+        for i in range(30):
             f1ts=MEDFileField1TS()
             fFaces=MEDCouplingFieldDouble(ON_CELLS) ; fFaces.setName("FieldOnFaces")
             arr=DataArrayDouble(31) ; arr.iota() ; arr[i]=100.
@@ -4692,7 +4692,7 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(b.isEqual(arrY,1e-12))
         self.assertTrue(c.isEqual(arrZ,1e-12))
         self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
-        for i in xrange(30):
+        for i in range(30):
             ffCell=allFMTSLeavesPerCommonSupport1[0][0][0][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(ffCell,mst)
             ffCell.loadArraysIfNecessary()
@@ -4719,7 +4719,7 @@ class MEDLoaderTest4(unittest.TestCase):
         a6,a7=mml2.retrieveFamilyIdsOnCells()
         self.assertTrue(a6 is None)
         self.assertTrue(a7)
-        for i in xrange(30):
+        for i in range(30):
             ffCell=allFMTSLeavesPerCommonSupport1[1][0][0][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(ffCell,mst)
             ffCell.loadArraysIfNecessary()
@@ -4751,7 +4751,7 @@ class MEDLoaderTest4(unittest.TestCase):
         mm=MEDFileUMesh()
         mm.setMeshAtLevel(0,m)
         mm.write(fname,2)
-        for i in xrange(15):
+        for i in range(15):
             fCell0=MEDCouplingFieldDouble(ON_CELLS) ; fCell0.setTime(float(i)+0.1,i,0)
             fCell0.setName(fieldName) ; fCell0.setMesh(m)
             arr=DataArrayDouble(m.getNumberOfCells()) ; arr.iota(0) ; arr[i%10]=100.
@@ -4800,7 +4800,7 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(a4 is None)
         self.assertTrue(a5 is None)
         self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
-        for i in xrange(15):
+        for i in range(15):
             ffCell=allFMTSLeavesPerCommonSupport1[0][0][0][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(ffCell,mst)
             ffCell.loadArraysIfNecessary()
@@ -4827,7 +4827,7 @@ class MEDLoaderTest4(unittest.TestCase):
         fieldName0="zeField0"
         fieldName1="zeField1"
         fs0=MEDFileFieldMultiTS() ; fs1=MEDFileFieldMultiTS()
-        for i in xrange(5):
+        for i in range(5):
             f=MEDFileField1TS()
             fNode=MEDCouplingFieldDouble(ON_GAUSS_PT) ; fNode.setTime(float(i),i,0)
             fNode.setName(fieldName0) ; fNode.setMesh(m)
@@ -4885,7 +4885,7 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertEqual(len(allFMTSLeavesPerTimeSeries[0]),5)
         allFMTSLeavesPerCommonSupport=MEDFileAnyTypeFieldMultiTS.SplitPerCommonSupport(allFMTSLeavesPerTimeSeries[0],ms[ms.getMeshesNames()[0]])
         self.assertEqual(len(allFMTSLeavesPerCommonSupport),5)
-        for i in xrange(5):
+        for i in range(5):
             self.assertEqual(len(allFMTSLeavesPerCommonSupport[i][0]),1)
         #
         mst=MEDFileMeshStruct.New(ms[0])
@@ -4903,10 +4903,10 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(a4 is None)
         self.assertTrue(a5 is None)
         self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
-        for i in xrange(1,5):
+        for i in range(1, 5):
             self.assertTrue((fcscp.isDataSetSupportEqualToThePreviousOne(i,fields)))
             pass
-        for i in xrange(5):
+        for i in range(5):
             f=allFMTSLeavesPerCommonSupport[0][0][0][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
             f.loadArraysIfNecessary()
@@ -5133,7 +5133,7 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(a4 is None)
         self.assertTrue(a5 is None)
         self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
-        for i in xrange(1):
+        for i in range(1):
             ffCell=allFMTSLeavesPerCommonSupport1[0][0][0][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(ffCell,mst)
             ffCell.loadArraysIfNecessary()
@@ -5161,7 +5161,7 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(a4 is None)
         self.assertTrue(a5 is None)
         self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
-        for i in xrange(1):
+        for i in range(1):
             ffCell=allFMTSLeavesPerCommonSupport1[1][0][0][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(ffCell,mst)
             ffCell.loadArraysIfNecessary()
@@ -5231,7 +5231,7 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(a.isEqual(ref_a,1e-14))
         self.assertEqual(b,[3,4,5])
         self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
-        for i in xrange(1):
+        for i in range(1):
             ffCell=allFMTSLeavesPerCommonSupport1[0][0][0][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(ffCell,mst)
             ffCell.loadArraysIfNecessary()
@@ -5301,7 +5301,7 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(a.isEqual(ref_a,1e-14))
         self.assertEqual(b,[3,4,5])
         self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
-        for i in xrange(1):
+        for i in range(1):
             ffCell=allFMTSLeavesPerCommonSupport1[0][0][0][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(ffCell,mst)
             ffCell.loadArraysIfNecessary()
@@ -5371,7 +5371,7 @@ class MEDLoaderTest4(unittest.TestCase):
         ref_a.setInfoOnComponents(comps)
         self.assertTrue(a0.isEqual(ref_a,1e-14))#<- Test is here
         self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
-        for i in xrange(1):
+        for i in range(1):
             ffCell=allFMTSLeavesPerCommonSupport1[0][0][0][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(ffCell,mst)
             ffCell.loadArraysIfNecessary()
@@ -5437,7 +5437,7 @@ class MEDLoaderTest4(unittest.TestCase):
         self.assertTrue(a.isEqual(ref_a,1e-14))#<- Test is here
         self.assertEqual(b,[3,4,5])
         self.assertTrue(mml2.retrieveGlobalNodeIdsIfAny() is None)
-        for i in xrange(1):
+        for i in range(1):
             ffCell=allFMTSLeavesPerCommonSupport1[0][0][0][i]
             fsst=MEDFileField1TSStructItem.BuildItemFrom(ffCell,mst)
             ffCell.loadArraysIfNecessary()
index 0cf84bc094fdc263e1cbfc8ff88fa3d3c1efdd23..71fe6505094ac906efa15837e38bed837346acbd 100644 (file)
@@ -155,10 +155,14 @@ static void converPyListToVecString(PyObject *pyLi, std::vector<std::string>& v)
       for(int i=0;i<size;i++)
         {
           PyObject *o=PyList_GetItem(pyLi,i);
-          if(!PyString_Check(o))
+          if(PyString_Check(o))
+            v[i]=PyString_AsString(o);
+#if PY_VERSION_HEX >= 0x03000000
+          else if(PyUnicode_Check(o))
+            v[i]=PyUnicode_AsUTF8(o);
+#endif
+          else
             throw INTERP_KERNEL::Exception("In list passed in argument some elements are NOT strings ! Expected a list containing only strings !");
-          const char *st=PyString_AsString(o);
-          v[i]=std::string(st);
         }
     }
   else if(PyTuple_Check(pyLi))
@@ -168,10 +172,14 @@ static void converPyListToVecString(PyObject *pyLi, std::vector<std::string>& v)
       for(int i=0;i<size;i++)
         {
           PyObject *o=PyTuple_GetItem(pyLi,i);
-          if(!PyString_Check(o))
+          if(PyString_Check(o))
+            v[i]=std::string(PyString_AsString(o));
+#if PY_VERSION_HEX >= 0x03000000
+          else if(PyUnicode_Check(o))
+            v[i]=std::string(PyUnicode_AsUTF8(o));
+#endif
+          else
             throw INTERP_KERNEL::Exception("In tuple passed in argument some elements are NOT strings ! Expected a tuple containing only strings !");
-          const char *st=PyString_AsString(o);
-          v[i]=std::string(st);
         }
     }
   else if(PyString_Check(pyLi))
@@ -179,6 +187,13 @@ static void converPyListToVecString(PyObject *pyLi, std::vector<std::string>& v)
       v.resize(1);
       v[0]=std::string((const char *)PyString_AsString(pyLi));
     }
+#if PY_VERSION_HEX >= 0x03000000
+  else if(PyUnicode_Check(pyLi))
+    {
+      v.resize(1);
+      v[0]=std::string(PyUnicode_AsUTF8(pyLi));
+    }
+#endif
   else
     {
       throw INTERP_KERNEL::Exception("Unrecognized python argument : expected a list of string or tuple of string or string !");
@@ -263,11 +278,19 @@ std::vector< std::pair<std::string, std::string > > convertVecPairStStFromPy(PyO
               PyObject *o0=PyTuple_GetItem(o,0);
               if(PyString_Check(o0))
                 p.first=std::string(PyString_AsString(o0));
+#if PY_VERSION_HEX >= 0x03000000
+              else if(PyUnicode_Check(o0))
+                p.first=std::string(PyUnicode_AsUTF8(o0));
+#endif
               else
                 throw INTERP_KERNEL::Exception(msg);
               PyObject *o1=PyTuple_GetItem(o,1);
               if(PyString_Check(o1))
                 p.second=std::string(PyString_AsString(o1));
+#if PY_VERSION_HEX >= 0x03000000
+              else if(PyUnicode_Check(o1))
+                p.second=std::string(PyUnicode_AsUTF8(o1));
+#endif
               else
                 throw INTERP_KERNEL::Exception(msg);
               ret[i]=p;
@@ -309,6 +332,12 @@ std::vector< std::pair<std::vector<std::string>, std::string > > convertVecPairV
                         {
                           p.first[j]=std::string(PyString_AsString(o0j));
                         }
+#if PY_VERSION_HEX >= 0x03000000
+                      else if(PyUnicode_Check(o0j))
+                        {
+                          p.first[j]=std::string(PyUnicode_AsUTF8(o0j));
+                        }
+#endif
                       else
                         throw INTERP_KERNEL::Exception(msg);
                     }
@@ -318,6 +347,10 @@ std::vector< std::pair<std::vector<std::string>, std::string > > convertVecPairV
               PyObject *o1=PyTuple_GetItem(o,1);
               if(PyString_Check(o1))
                 p.second=std::string(PyString_AsString(o1));
+#if PY_VERSION_HEX >= 0x03000000
+              if(PyUnicode_Check(o1))
+                p.second=std::string(PyUnicode_AsUTF8(o1));
+#endif
               else
                 throw INTERP_KERNEL::Exception(msg);
               ret[i]=p;
@@ -381,6 +414,12 @@ int MEDFileFieldsgetitemSingleTS__(const MEDFileFields *self, PyObject *obj) thr
     {
       return self->getPosFromFieldName(PyString_AsString(obj));
     }
+#if PY_VERSION_HEX >= 0x03000000
+  else if(PyUnicode_Check(obj))
+    {
+      return self->getPosFromFieldName(PyUnicode_AsUTF8(obj));
+    }
+#endif
   else
     throw INTERP_KERNEL::Exception("MEDFileFields::__getitem__ : only integer or string with fieldname supported !");
 }
index ffa9364e00be4794ec906f555a1fc424ad40181e..5b2559385472219d018e33f2dc3e05ddc4ee0ce1 100644 (file)
@@ -97,7 +97,7 @@ class SauvLoaderTest(unittest.TestCase):
 
         #remove fieldnodeint
         pointeFields = pointeMed.getFields()
-        for i in range( pointeFields.getNumberOfFields() ):
+        for i in range(pointeFields.getNumberOfFields()):
             if pointeFields.getFieldAtPos(i).getName() == "fieldnodeint":
                 pointeFields.destroyFieldAtPos( i )
                 break
@@ -144,7 +144,7 @@ class SauvLoaderTest(unittest.TestCase):
         self.assertEqual( fieldnodedoubleTS1.getNumberOfTS(), fieldnodedoubleTS2.getNumberOfTS())
         io1 = fieldnodedoubleTS1.getIterations()
         io2 = fieldnodedoubleTS2.getIterations()
-        for i in range(fieldnodedoubleTS1.getNumberOfTS() ):
+        for i in range(fieldnodedoubleTS1.getNumberOfTS()):
             fnd1 = fieldnodedoubleTS1.getFieldOnMeshAtLevel(ON_NODES, io1[i][0],io1[i][1],pointeUM0)
             fnd2 = fieldnodedoubleTS2.getFieldOnMeshAtLevel(ON_NODES, io2[i][0],io2[i][1],um0)
             self.assertTrue( fnd1.getArray().isEqual( fnd2.getArray(), 1e-12 ))
@@ -155,7 +155,7 @@ class SauvLoaderTest(unittest.TestCase):
         self.assertEqual( fieldnodedoubleTS1.getNumberOfTS(), fieldnodedoubleTS2.getNumberOfTS())
         io1 = fieldnodedoubleTS1.getIterations()
         io2 = fieldnodedoubleTS2.getIterations()
-        for i in range(fieldnodedoubleTS1.getNumberOfTS() ):
+        for i in range(fieldnodedoubleTS1.getNumberOfTS()):
             fnd1 = fieldnodedoubleTS1.getFieldOnMeshAtLevel(ON_CELLS, io1[i][0],io1[i][1],pointeUM0)
             fnd2 = fieldnodedoubleTS2.getFieldOnMeshAtLevel(ON_CELLS, io2[i][0],io2[i][1],um0)
             self.assertAlmostEqual( fnd1.accumulate(0), fnd2.accumulate(0) )
index 48368bd7c62c77713547555b23c8d0840ccc4df1..d66efe01b9f06dfec07e89e11828c0e8a5a83be9 100644 (file)
@@ -105,7 +105,7 @@ class PVTUReader:
                     self._tmp=3
                     return
                 if name=="PDataArray":
-                    if self._tmp in self._data_array.keys():
+                    if self._tmp in self._data_array:
                         self._data_array[self._tmp](attrs)
                         pass
                     return
@@ -270,7 +270,7 @@ class VTURawReader:
         except self.NormalException as e:
             isOK=True
             fd.seek(0)
-            for i in xrange(e.getLineNb()): fd.readline()
+            for i in range(e.getLineNb()): fd.readline()
             ref=fd.tell()+5
             pass
         if not isOK:
@@ -285,11 +285,11 @@ class VTURawReader:
 
     def __init__(self,fileName,tim=(0.,0)):
         msg="The time specified in constructor as 2nd arg should be a tuple containing 2 values 1 float and 1 int !"
-        if type(tim)!=tuple:
+        if not isinstance(tim, tuple):
             raise Exception(msg)
         if len(tim)!=2:
             raise Exception(msg)
-        if type(tim[0])!=float or type(tim[1])!=int:
+        if not isinstance(tim[0], float) or not isinstance(tim[1], int):
             raise Exception(msg)
         self._fileName=fileName
         self._time=tim
index 84eccadb6935d34a6dc9e15900a626805c738aca..e0a3d3fb654c42c57f05453c24f8d8dbf09109b5 100644 (file)
@@ -33,7 +33,7 @@ def my_remove(f):
 
 def convert(file_in, driver_in, driver_out, format=1, file_out=None):
     #
-    print file_in
+    print(file_in)
     #
     if file_out is None:
         file_out = file_in
@@ -45,7 +45,7 @@ def convert(file_in, driver_in, driver_out, format=1, file_out=None):
             msg = "Driver out %s is unknown"%(driver_out)
             raise NotImplementedError(msg)
         pass
-    print file_out
+    print(file_out)
     #
     if driver_in == "GIBI":
         sr = SauvReader.New(file_in)
index 0c622da76f9f8833ad41d9609e09e7990db72112..1acc2668ae9e255ca9c8730b05ecdb0ede33461c 100644 (file)
@@ -22,7 +22,11 @@ INCLUDE(${SWIG_USE_FILE})
 ADD_DEFINITIONS(${PYTHON_DEFINITIONS} ${HDF5_DEFINITIONS} ${MEDFILE_DEFINITIONS} ${NUMPY_DEFINITIONS} ${SCIPY_DEFINITIONS})
 
 SET_SOURCE_FILES_PROPERTIES(MEDPartitioner.i PROPERTIES CPLUSPLUS ON)
-SET_SOURCE_FILES_PROPERTIES(MEDPartitioner.i PROPERTIES SWIG_DEFINITIONS "-shadow")
+IF ("${PYTHON_VERSION_MAJOR}" STREQUAL "3")
+  SET_SOURCE_FILES_PROPERTIES(MEDPartitioner.i PROPERTIES SWIG_FLAGS "-py3")
+ELSE()
+  SET_SOURCE_FILES_PROPERTIES(MEDPartitioner.i PROPERTIES SWIG_DEFINITIONS "-shadow")
+ENDIF()
 SET(SWIG_MODULE_MEDPartitioner_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS};-DWITHOUT_AUTOFIELD")
 
 SET (MEDPartitioner_SWIG_DPYS_FILES
index 030759f2d145848c80758b1629964d3e2d44caec..93657cabf1d3cdd763a2bf8f00e6226669c07e7e 100644 (file)
@@ -78,7 +78,7 @@ class MEDPartitionerTest(unittest.TestCase):
         self.assertEqual( 2, joints.getJointAtPos(1).getStepAtPos(0).getNumberOfCorrespondences())
         self.assertEqual( 1, joints.getJointAtPos(2).getStepAtPos(0).getNumberOfCorrespondences())
         found=0
-        for ii in xrange(joints.getJointAtPos(0).getStepAtPos(0).getNumberOfCorrespondences()):
+        for ii in range(joints.getJointAtPos(0).getStepAtPos(0).getNumberOfCorrespondences()):
             correspond=joints.getJointAtPos(0).getStepAtPos(0).getCorrespondenceAtPos(ii)
             #VSR (10/05/2016): changed to work with metis 5.1... to be confirmed!
             #if correspond.getCorrespondence().isEqual(DataArrayInt([1,3,2,4])):
index 603a63ad3f6cc40086318f9268db5483c6cc7f2f..1ef76433796fce1155ee03d83634bc484a5f9534 100644 (file)
@@ -23,7 +23,11 @@ FIND_PACKAGE(SWIG REQUIRED)
 INCLUDE(${SWIG_USE_FILE})
 
 SET_SOURCE_FILES_PROPERTIES(ParaMEDMEM.i PROPERTIES CPLUSPLUS ON)
-SET_SOURCE_FILES_PROPERTIES(ParaMEDMEM.i PROPERTIES SWIG_DEFINITIONS "-shadow")
+IF ("${PYTHON_VERSION_MAJOR}" STREQUAL "3")
+  SET_SOURCE_FILES_PROPERTIES(ParaMEDMEM.i PROPERTIES SWIG_FLAGS "-py3")
+ELSE()
+  SET_SOURCE_FILES_PROPERTIES(ParaMEDMEM.i PROPERTIES SWIG_DEFINITIONS "-shadow")
+ENDIF()
 SET(SWIG_MODULE_ParaMEDMEM_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS}")
 
 SET (ParaMEDMEM_SWIG_DPYS_FILES
@@ -55,9 +59,6 @@ SET (SWIG_MODULE_ParaMEDMEM_EXTRA_DEPS ${ParaMEDMEM_SWIG_DPYS_FILES}
 SWIG_ADD_MODULE(ParaMEDMEM python ParaMEDMEM.i)
 SWIG_LINK_LIBRARIES(ParaMEDMEM ${PYTHON_LIBRARIES} paramedmem medloader)
 
-SET_SOURCE_FILES_PROPERTIES(ParaMEDMEM.i PROPERTIES CPLUSPLUS ON)
-SET_SOURCE_FILES_PROPERTIES(ParaMEDMEM.i PROPERTIES SWIG_DEFINITIONS "-shadow")
-
 INSTALL(TARGETS _ParaMEDMEM DESTINATION ${MEDCOUPLING_INSTALL_PYTHON})
 INSTALL(FILES ParaMEDMEM.i DESTINATION ${MEDCOUPLING_INSTALL_HEADERS})
 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/ParaMEDMEM.py test_InterpKernelDEC.py test_NonCoincidentDEC.py test_StructuredCoincidentDEC.py DESTINATION ${MEDCOUPLING_INSTALL_SCRIPT_PYTHON})
index 9971ed8b59dc74341880098318f59b455725a9aa..fa2a0ed98e312e5a855998368be84d836b5e5b89 100644 (file)
   char** aStrs = (char **) malloc((aSize+1)*sizeof(char *));
   for (i = 0; i < aSize; i++) {
     PyObject *s = PyList_GetItem($input,i);
-    if (!PyString_Check(s)) {
+    if (PyString_Check(s))
+      aStrs[i] = PyString_AsString(s);
+%#if PY_VERSION_HEX >= 0x03000000
+    else if (PyUnicode_Check(s))
+      aStrs[i] = PyUnicode_AsUTF8(s);
+%#endif
+    else {
         free(aStrs);
         PyErr_SetString(PyExc_ValueError, "List items must be strings");
         return NULL;
     }
-    aStrs[i] = PyString_AsString(s);
   }
   aStrs[i] = 0;
   $2 = &aStrs;
index abf8c958962e74c5783197a805a6739f729e0f29..056fd751f02102c9ae60a351dcfa3c823e914595 100755 (executable)
@@ -30,11 +30,11 @@ class ParaMEDMEMBasicsTest(unittest.TestCase):
         size = MPI_Comm_size(MPI_COMM_WORLD)
         rank = MPI_Comm_rank(MPI_COMM_WORLD)
         if size != 5:
-            raise RuntimeError, "Expect MPI_COMM_WORLD size == 5"
-        print rank
+            raise RuntimeError("Expect MPI_COMM_WORLD size == 5")
+        print(rank)
         nproc_source = 3
-        procs_source = range( nproc_source )
-        procs_target = range( size - nproc_source + 1, size)
+        procs_source = list(range(nproc_source))
+        procs_target = list(range(size - nproc_source + 1, size))
 
         interface = CommInterface()
         target_group = MPIProcessorGroup(interface, procs_target)
@@ -95,7 +95,7 @@ class ParaMEDMEMBasicsTest(unittest.TestCase):
             dec.sendData()
             dec.recvData()
             field_after_int=parafield.getVolumeIntegral(0,True);
-            self.failUnless(math.fabs(field_after_int-field_before_int)<1e-8)
+            self.assertTrue(math.fabs(field_after_int-field_before_int)<1e-8)
             pass
         else:
             dec.synchronize()
index 3d78a496b4709dea6e6c1860c6e1d94ac8fae316..5df6ca3637c1f32d548b20e19f7c939a509868b0 100755 (executable)
@@ -27,11 +27,11 @@ MPI_Init(sys.argv)
 size = MPI_Comm_size(MPI_COMM_WORLD)
 rank = MPI_Comm_rank(MPI_COMM_WORLD)
 if size != 5:
-    raise RuntimeError, "Expect MPI_COMM_WORLD size == 5"
+    raise RuntimeError("Expect MPI_COMM_WORLD size == 5")
 
 nproc_source = 3
-procs_source = range( nproc_source )
-procs_target = range( size - nproc_source + 1, size)
+procs_source = list(range(nproc_source))
+procs_target = list(range(size - nproc_source + 1, size))
 
 interface = CommInterface()
 
@@ -114,7 +114,7 @@ if source_group.containsMyRank():
     field_before_int = [parafield.getVolumeIntegral(1)]
     MPI_Bcast(field_before_int, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD);
     dec.synchronize()
-    print "DEC usage"
+    print("DEC usage")
     dec.setForcedRenormalization(False)
 
     dec.sendData()
@@ -134,11 +134,11 @@ MPI_Bcast(field_after_int , 1, MPI_DOUBLE, size-1, MPI_COMM_WORLD)
 
 epsilon = 1e-6
 if abs(field_before_int[0] - field_after_int[0]) > epsilon:
-    print "Field before is not equal field after: %s != %s"%\
-          (field_before_int[0],field_after_int[0])
+    print("Field before is not equal field after: %s != %s"%\
+          (field_before_int[0],field_after_int[0]))
     pass
 
 
 MPI_Barrier(MPI_COMM_WORLD)
 MPI_Finalize()
-print "# End of testNonCoincidentDEC"
+print("# End of testNonCoincidentDEC")
index e577ef8a8ac5442073c8d795e63bd38d447ad123..48cfb7c2116339896184eba93b7690f743eb9a64 100755 (executable)
@@ -32,7 +32,7 @@ class ParaMEDMEMBasicsTest2(unittest.TestCase):
         rank = MPI_Comm_rank(MPI_COMM_WORLD)
         #
         if size < 4:
-            raise RuntimeError, "Expect MPI_COMM_WORLD size >= 4"
+            raise RuntimeError("Expect MPI_COMM_WORLD size >= 4")
         #
         interface = CommInterface()
         #
@@ -103,7 +103,7 @@ class ParaMEDMEMBasicsTest2(unittest.TestCase):
             for i in range(nb_local):
                 first=comptopo.firstLocalComponent()
                 for icomp in range(comptopo.nbLocalComponents()):
-                    self.failUnless(math.fabs(recv_value[i*comptopo.nbLocalComponents()+icomp]-
+                    self.assertTrue(math.fabs(recv_value[i*comptopo.nbLocalComponents()+icomp]-
                                               (float)(i*6+icomp+first))<1e-12)
                     pass
                 pass
@@ -121,7 +121,7 @@ class ParaMEDMEMBasicsTest2(unittest.TestCase):
         source_group = 0
         MPI_Barrier(MPI_COMM_WORLD)
         MPI_Finalize()
-        print "End of test StructuredCoincidentDEC"
+        print("End of test StructuredCoincidentDEC")
         pass
 
 
index 95e83e3df7685b51fd7f35a3d16a72a444a47335..f237a55204f9bd1c64e5a99bc56e593cdc03b4f4 100644 (file)
@@ -22,7 +22,11 @@ INCLUDE(${SWIG_USE_FILE})
 ADD_DEFINITIONS(${PYTHON_DEFINITIONS} ${NUMPY_DEFINITIONS} ${SCIPY_DEFINITIONS})
 
 SET_SOURCE_FILES_PROPERTIES(MEDRenumber.i PROPERTIES CPLUSPLUS ON)
-SET_SOURCE_FILES_PROPERTIES(MEDRenumber.i PROPERTIES SWIG_DEFINITIONS "-shadow")
+IF ("${PYTHON_VERSION_MAJOR}" STREQUAL "3")
+  SET_SOURCE_FILES_PROPERTIES(MEDRenumber.i PROPERTIES SWIG_FLAGS "-py3")
+ELSE()
+  SET_SOURCE_FILES_PROPERTIES(MEDRenumber.i PROPERTIES SWIG_DEFINITIONS "-shadow")
+ENDIF()
 SET(SWIG_MODULE_MEDRenumber_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS};-DWITHOUT_AUTOFIELD")
 
 IF(Boost_FOUND)
index 6f8782e8ba3a9e60aa39e4e6069c61fc02923e92..0f121ece8abc14cf0cff38539f380a19785dfb9d 100644 (file)
@@ -102,6 +102,6 @@ namespace MED_RENUMBER
 import os
 __filename=os.environ.get('PYTHONSTARTUP')
 if __filename and os.path.isfile(__filename):
-  execfile(__filename)
+  exec(open(__filename).read())
   pass
 %}
index a5f738e441aba59ea3477ca2a5a021916bd78770..b387e5303e739ea56fdf87fc98c3edcc175daf77 100644 (file)
@@ -30,7 +30,7 @@ def rep1(dirname,rep):
 dirs=["MEDCoupling","MEDCoupling/Test","MEDLoader","MEDLoader/Swig","MEDLoader/Test","MEDPartitioner","MEDPartitioner/Test","MEDPartitioner_Swig","RENUMBER","RENUMBER_Swig","INTERP_KERNELTest","ParaMEDMEM","ParaMEDLoader","ParaMEDMEMTest","ParaMEDMEM_Swig","doc/user/doxygen/fakesources","doc/user/doxygen/doxy2swig","doc/user/doxygen/doxfiles","/home/H87074/salome/DEV/modules/src/MED/src/MEDCouplingCorba","/home/H87074/salome/DEV/modules/src/MED/src/MEDCouplingCorba/Client","/home/H87074/salome/DEV/modules/src/MED/src/MEDCouplingCorba/Test","/home/H87074/salome/DEV/modules/src/MED/src/MEDCalc/cmp","/home/H87074/salome/DEV/modules/src/MED/src/MEDCalculator","/home/H87074/salome/DEV/modules/src/MED/src/MEDCalculator/Swig","/home/H87074/salome/DEV/modules/src/MED/src/MEDCalculator/Test","/home/H87074/salome/DEV/modules/src/PARAVIS/src/Plugins/MEDReader/IO"]
 dirname=dirs[-1]
 i=0
-print rep1(dirname,rep)
+print(rep1(dirname,rep))
 """for r,dirs,fis in os.walk(dirname):
     for fi in fis:
         if os.path.splitext(fi)[1] not in [".dox",".doxy"]:
index e577a546e8ff484e9cbdd1f1a128aab5fa8a7ad2..f3044a3b6700d0b1614d850ea3a8fd5170f3390f 100755 (executable)
@@ -108,7 +108,7 @@ def convert(root_dir, ext, quiet):
       # Skip this script!
       if fileName == __myName:
         if not quiet:
-          print "!!! Skipping script %s !!!" % __myName
+          print("!!! Skipping script %s !!!" % __myName)
         continue
       ok = False
       if fileName[-28:] != "MEDCouplingNatureOfFieldEnum":
@@ -119,7 +119,7 @@ def convert(root_dir, ext, quiet):
       else:
         ok = True
       if not ok: continue # skip file
-      if not quiet:  print "Handling %s ..." % fileName
+      if not quiet:  print("Handling %s ..." % fileName)
       for line in fileinput.input(fileName, inplace=1, backup='.bak'):
         for before, after in REPLACEMENTS:
           line = re.sub("(\W|^)(%s)(\W|$)" % before, r"\1%s\3" % after, line.rstrip('\r\n'))