Salome HOME
Merge rnv/win_swig_generation branch.
authorrnv <rnv@opencascade.com>
Tue, 30 May 2017 13:04:13 +0000 (16:04 +0300)
committerrnv <rnv@opencascade.com>
Tue, 30 May 2017 13:04:45 +0000 (16:04 +0300)
133 files changed:
CMakeLists.txt
doc/user/doxygen/BuildPyExamplesFromCPP.py
doc/user/doxygen/doxy2swig/doxy2swig.cmake
doc/user/doxygen/doxy2swig/doxy2swig.py
src/INTERP_KERNEL/BBTreeDst.txx
src/INTERP_KERNEL/CMakeLists.txt
src/INTERP_KERNEL/CellModel.cxx
src/INTERP_KERNEL/CellModel.hxx
src/INTERP_KERNEL/GaussPoints/CleanUpGauss.py
src/INTERP_KERNEL/InterpKernelMatrixTools.cxx
src/INTERP_KERNEL/OrientationInverter.cxx [new file with mode: 0644]
src/INTERP_KERNEL/OrientationInverter.hxx [new file with mode: 0644]
src/INTERP_KERNEL/VolSurfUser.cxx
src/INTERP_KERNELTest/TestInterpKernelUtils.cxx
src/MEDCoupling/CMakeLists.txt
src/MEDCoupling/MCType.hxx [new file with mode: 0644]
src/MEDCoupling/MEDCoupling1GTUMesh.cxx
src/MEDCoupling/MEDCoupling1GTUMesh.hxx
src/MEDCoupling/MEDCouplingCMesh.cxx
src/MEDCoupling/MEDCouplingCMesh.hxx
src/MEDCoupling/MEDCouplingCartesianAMRMesh.hxx
src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx
src/MEDCoupling/MEDCouplingCurveLinearMesh.hxx
src/MEDCoupling/MEDCouplingFieldDiscretization.cxx
src/MEDCoupling/MEDCouplingFieldDouble.cxx
src/MEDCoupling/MEDCouplingFieldDouble.hxx
src/MEDCoupling/MEDCouplingFieldFloat.cxx [new file with mode: 0644]
src/MEDCoupling/MEDCouplingFieldFloat.hxx [new file with mode: 0644]
src/MEDCoupling/MEDCouplingFieldInt.cxx
src/MEDCoupling/MEDCouplingFieldT.hxx
src/MEDCoupling/MEDCouplingFieldT.txx
src/MEDCoupling/MEDCouplingFieldTemplate.cxx
src/MEDCoupling/MEDCouplingFieldTemplate.hxx
src/MEDCoupling/MEDCouplingGaussLocalization.cxx
src/MEDCoupling/MEDCouplingIMesh.cxx
src/MEDCoupling/MEDCouplingMap.cxx [new file with mode: 0644]
src/MEDCoupling/MEDCouplingMap.hxx [new file with mode: 0644]
src/MEDCoupling/MEDCouplingMap.txx [new file with mode: 0644]
src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx
src/MEDCoupling/MEDCouplingMappedExtrudedMesh.hxx
src/MEDCoupling/MEDCouplingMemArray.cxx
src/MEDCoupling/MEDCouplingMemArray.hxx
src/MEDCoupling/MEDCouplingMemArray.txx
src/MEDCoupling/MEDCouplingMemArrayChar.cxx
src/MEDCoupling/MEDCouplingMemArrayFloat.cxx [new file with mode: 0644]
src/MEDCoupling/MEDCouplingMesh.hxx
src/MEDCoupling/MEDCouplingPointSet.cxx
src/MEDCoupling/MEDCouplingPointSet.hxx
src/MEDCoupling/MEDCouplingRefCountObject.cxx
src/MEDCoupling/MEDCouplingRefCountObject.hxx
src/MEDCoupling/MEDCouplingSkyLineArray.cxx
src/MEDCoupling/MEDCouplingStructuredMesh.cxx
src/MEDCoupling/MEDCouplingStructuredMesh.hxx
src/MEDCoupling/MEDCouplingTimeDiscretization.cxx
src/MEDCoupling/MEDCouplingTimeDiscretization.hxx
src/MEDCoupling/MEDCouplingTimeDiscretization.txx
src/MEDCoupling/MEDCouplingTraits.cxx
src/MEDCoupling/MEDCouplingTraits.hxx
src/MEDCoupling/MEDCouplingUMesh.cxx
src/MEDCoupling/MEDCouplingUMesh.hxx
src/MEDCoupling/MEDCouplingUMesh_intersection.cxx
src/MEDCoupling/MEDCouplingVoronoi.cxx
src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx
src/MEDCoupling/Test/MEDCouplingBasicsTest3.cxx
src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx
src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx
src/MEDCoupling_Swig/CMakeLists.txt
src/MEDCoupling_Swig/CTestTestfileInstall.cmake
src/MEDCoupling_Swig/MEDCoupling.i
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/MEDCouplingBasicsTest6.py [new file with mode: 0644]
src/MEDCoupling_Swig/MEDCouplingCommon.i
src/MEDCoupling_Swig/MEDCouplingDataArrayTraits.hxx [new file with mode: 0644]
src/MEDCoupling_Swig/MEDCouplingDataArrayTypemaps.i
src/MEDCoupling_Swig/MEDCouplingDataForTest.py
src/MEDCoupling_Swig/MEDCouplingExamplesTest.py
src/MEDCoupling_Swig/MEDCouplingFieldDiscretization.i
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/MEDCouplingRemapper.i
src/MEDCoupling_Swig/MEDCouplingRemapperTest.py
src/MEDCoupling_Swig/MEDCouplingTypemaps.i
src/MEDLoader/MEDFileField.cxx
src/MEDLoader/MEDFileField.hxx
src/MEDLoader/MEDFileField.txx
src/MEDLoader/MEDFileMesh.cxx
src/MEDLoader/MEDFileMesh.hxx
src/MEDLoader/MEDFileMeshLL.cxx
src/MEDLoader/MEDFileMeshLL.hxx
src/MEDLoader/MEDFileMeshReadSelector.cxx
src/MEDLoader/MEDFileMeshReadSelector.hxx
src/MEDLoader/MEDLoaderTraits.hxx
src/MEDLoader/SauvMedConvertor.hxx
src/MEDLoader/SauvWriter.hxx
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/MEDPartitionerCommon.i
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/RENUMBER_Renumbering.hxx
src/RENUMBER_Swig/CMakeLists.txt
src/RENUMBER_Swig/MEDRenumber.i
src/RENUMBER_Swig/MEDRenumberCommon.i
v8_work/ModifyNamespace.py
v8_work/medcoup7to8.py

index aad68421adb11cad754f017d8d449acc7c95be43..25e1d9fa60d1825f4609371e466b0ed6a8dca3ee 100644 (file)
@@ -153,6 +153,14 @@ 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 "2")
+    IF("${PYTHON_VERSION_MINOR}" LESS "7")
+      MESSAGE(FATAL_ERROR "MEDCoupling's Python requires at least Python 2.7 (you seem to have ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}). Upgrade your Python, or turn off MEDCOUPLING_ENABLE_PYTHON")
+    ENDIF()
+  ENDIF()
+  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 6391d24ef6b052965d9c3b60a6955602e9cdaf6a..2be19308324fabba460d19eb35e9a20f2c83832f 100644 (file)
@@ -34,7 +34,7 @@ SET(_classes_MEDCoupling
    MEDCoupling_1_1MEDCouplingCMesh
    MEDCoupling_1_1MEDCouplingRemapper
    MEDCoupling_1_1DataArray
-   MEDCoupling_1_1DataArrayInt
+   #MEDCoupling_1_1DataArrayInt
    MEDCoupling_1_1DataArrayDouble
     )
 
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 60c3084ced3364f7c302e095b10a17502cfd4664..9497070aad5a208d4c52b17a998beed754589460 100644 (file)
@@ -134,6 +134,10 @@ public:
       }
   }
   
+  /** Get the minimal (square) distance between a point and all the available bounding boxes in the tree.
+    The (square) distance to a bbox is the true geometric distance between the point and a face
+    (or an edge, or a corner) of the bbox.
+  */
   void getMinDistanceOfMax(const double *pt, double& minOfMaxDstsSq) const
   {
     if(_terminal)
index a3151d17054486d0fc185bcc2d9413a038981f34..7fe1bd1163a4b5b1a21a21c560a6bf4379271e6b 100644 (file)
@@ -27,6 +27,7 @@ SET(interpkernel_SOURCES
   TetraAffineTransform.cxx
   CellModel.cxx
   DiameterCalculator.cxx
+  OrientationInverter.cxx
   UnitTetraIntersectionBary.cxx
   InterpolationOptions.cxx
   BoxSplittingOptions.cxx
index 9632fb1ce470ee640398fa0e3b0f6ede5ffb9fda..ed473f8de7cd945bbd9b8fa516ed72eff84d87de 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "InterpKernelException.hxx"
 #include "DiameterCalculator.hxx"
+#include "OrientationInverter.hxx"
 
 #include <algorithm>
 #include <sstream>
@@ -952,4 +953,44 @@ namespace INTERP_KERNEL
         throw Exception("CellModel::buildInstanceOfDiameterCalulator : implemented only for TRI3, QUAD4, TETRA4, HEXA8, PENTA6, PYRA5 !");
       }
   }
+
+  OrientationInverter *CellModel::buildOrientationInverter() const
+  {
+    switch(_type)
+      {
+      case NORM_SEG2:
+        return new OrientationInverterSEG2;
+      case NORM_SEG3:
+        return new OrientationInverterSEG3;
+      case NORM_TRI3:
+      case NORM_QUAD4:
+        return new OrientationInverter2DLinear(getNumberOfNodes());
+      case NORM_TRI6:
+      case NORM_QUAD8:
+        return new OrientationInverter2DQuadratic(getNumberOfNodes());
+      case NORM_POLYGON:
+        return new OrientationInverterPolygon;
+      case NORM_QPOLYG:
+        return new OrientationInverterQPolygon;
+      case NORM_TETRA4:
+        return new OrientationInverterTetra4;
+      case NORM_PYRA5:
+        return new OrientationInverterPyra5;
+      case NORM_TETRA10:
+        return new OrientationInverterTetra10;
+      case NORM_PYRA13:
+        return new OrientationInverterPyra13;
+      case NORM_PENTA6:
+      case NORM_HEXA8:
+        return new OrientationInverter3DExtrusionLinear(getNumberOfNodes());
+      case NORM_PENTA15:
+      case NORM_HEXA20:
+        return new OrientationInverter3DExtrusionQuadratic(getNumberOfNodes());
+      default:
+        {
+          std::ostringstream oss; oss << "CellModel::buildOrientationInverter : not managed geometric type " << getRepr() << " yet !";
+          throw INTERP_KERNEL::Exception(oss.str());
+        }
+      }
+  }
 }
index cf839aa9e1ee985c18766cecb646dec10bb6c746..dd37f1b83e0b042148a10544a61a080139293e76 100644 (file)
@@ -30,6 +30,7 @@
 namespace INTERP_KERNEL
 {
   class DiameterCalculator;
+  class OrientationInverter;
   
   /*!
    * This class describes all static elements (different from polygons and polyhedron) 3D, 2D and 1D.
@@ -80,6 +81,7 @@ namespace INTERP_KERNEL
     INTERPKERNEL_EXPORT void changeOrientationOf2D(int *nodalConn, unsigned int sz) const;
     INTERPKERNEL_EXPORT void changeOrientationOf1D(int *nodalConn, unsigned int sz) const;
     INTERPKERNEL_EXPORT DiameterCalculator *buildInstanceOfDiameterCalulator(int spaceDim) const;
+    INTERPKERNEL_EXPORT OrientationInverter *buildOrientationInverter() const;
   private:
     bool _dyn;
     bool _quadratic;
index 7a2c28e53daf61bc30bdbcd20f8e774b0ccb6649..f4658728b4e705b02bae87f6413f21aaf7ca7f65 100644 (file)
@@ -18,6 +18,7 @@
 # Author : Anthony Geay (EDF R&D)
 
 import re
+import sys
 
 s1=2709
 s2=2848
@@ -39,7 +40,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 +49,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 +57,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 +69,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 80d5f1d022f7b1ec789588262739b9116d2cab1d..cc1c08130c03bf4e297a8486173272a681fd7382 100644 (file)
@@ -301,12 +301,12 @@ namespace INTERP_KERNEL
     for(int k=0;k<n-1;k++)
       {
         //  Find L=pivot index.
-        l=idamax(n-k-1,a+k+k*lda,1)+k;
+        l=idamax(n-k,a+k+k*lda,1)+k;
         ipvt[k]=l;
         // Zero pivot implies this column already triangularized.
         if(a[l+k*lda]==0.0)
           {
-            info=k+1;
+            info=k;
             continue;
           }
         //Interchange if necessary.
@@ -323,7 +323,7 @@ namespace INTERP_KERNEL
         for(int j=k+1;j<n;j++)
           {
             t=a[l+j*lda];
-            if(l!=k-1)
+            if(l!=k)
               {
                 a[l+j*lda]=a[k+j*lda];
                 a[k+j*lda]=t;
diff --git a/src/INTERP_KERNEL/OrientationInverter.cxx b/src/INTERP_KERNEL/OrientationInverter.cxx
new file mode 100644 (file)
index 0000000..36f675a
--- /dev/null
@@ -0,0 +1,157 @@
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay (EDF R&D)
+
+#include "OrientationInverter.hxx"
+#include "InterpKernelException.hxx"
+#include "CellModel.hxx"
+
+#include <sstream>
+#include <algorithm>
+
+using namespace INTERP_KERNEL;
+
+OrientationInverter *OrientationInverter::BuildInstanceFrom(NormalizedCellType gt)
+{
+  switch(gt)
+    {
+    case NORM_SEG2:
+      return new OrientationInverterSEG2;
+    case NORM_SEG3:
+      return new OrientationInverterSEG3;
+    case NORM_TRI3:
+      return new OrientationInverter2DLinear(3u);
+    case NORM_QUAD4:
+      return new OrientationInverter2DLinear(4u);
+    case NORM_POLYGON:
+      return new OrientationInverterPolygon;
+    case NORM_TRI6:
+      return new OrientationInverter2DQuadratic(6u);
+    case NORM_QUAD8:
+      return new OrientationInverter2DQuadratic(8u);
+    case NORM_QPOLYG:
+      return new OrientationInverterQPolygon;
+    case NORM_TETRA4:
+      return new OrientationInverterTetra4;
+    case NORM_PYRA5:
+      return new OrientationInverterPyra5;
+    case NORM_PENTA6:
+      return new OrientationInverter3DExtrusionLinear(6u);
+    case NORM_HEXA8:
+      return new OrientationInverter3DExtrusionLinear(8u);
+    case NORM_TETRA10:
+      return new OrientationInverterTetra10;
+    case NORM_PYRA13:
+      return new OrientationInverterPyra13;
+    case NORM_PENTA15:
+      return new OrientationInverter3DExtrusionQuadratic(15u);
+    case NORM_HEXA20:
+      return new OrientationInverter3DExtrusionQuadratic(20u);
+    default:
+      {
+        const CellModel& cm(CellModel::GetCellModel(gt));
+        std::ostringstream oss; oss << "OrientationInverter::BuildInstanceFrom : Sorry no inverter for geo type " << cm.getRepr() << " !";
+        throw INTERP_KERNEL::Exception(oss.str());
+      }
+    }
+}
+
+void OrientationInverterChecker::check(int *beginPt, int *endPt) const
+{
+  if(std::distance(beginPt,endPt)!=getNbNodes())
+    {
+      std::ostringstream oss; oss << "OrientationInverterChecker::check : length of nodal connectivity mismatches ! Expecting " << getNbNodes() << " having " << std::distance(beginPt,endPt) << " !";
+      throw INTERP_KERNEL::Exception(oss.str());
+    }
+}
+
+void OrientationInverterSEG2::operateAndShutUp(int *beginPt) const
+{
+  std::swap(beginPt[0],beginPt[1]);
+}
+
+void OrientationInverterSEG3::operateAndShutUp(int *beginPt) const
+{
+  std::swap(beginPt[0],beginPt[2]);
+}
+
+void OrientationInverter2DLinear::operateAndShutUp(int *beginPt) const
+{
+  std::reverse(beginPt+1,beginPt+getNbNodes());
+}
+
+void OrientationInverter2DQuadratic::operateAndShutUp(int *beginPt) const
+{
+  int nbNodes(getNbNodes());
+  std::reverse(beginPt+1,beginPt+nbNodes/2);
+  std::reverse(beginPt+nbNodes/2,beginPt+nbNodes);
+}
+
+void OrientationInverterPolygon::operate(int *beginPt, int *endPt) const
+{
+  std::reverse(beginPt+1,endPt);
+}
+
+void OrientationInverterQPolygon::operate(int *beginPt, int *endPt) const
+{
+  std::size_t sz(std::distance(beginPt,endPt));
+  std::reverse(beginPt+1,beginPt+sz/2);
+  std::reverse(beginPt+sz/2,endPt);
+}
+
+void OrientationInverterTetra4::operateAndShutUp(int *beginPt) const
+{
+  std::swap(beginPt[1],beginPt[2]);
+}
+
+void OrientationInverterTetra10::operateAndShutUp(int *beginPt) const
+{
+  std::swap(beginPt[1],beginPt[2]);
+  std::swap(beginPt[4],beginPt[6]);
+  std::swap(beginPt[8],beginPt[9]);
+}
+
+void OrientationInverterPyra5::operateAndShutUp(int *beginPt) const
+{
+  std::reverse(beginPt+1,beginPt+4);
+}
+
+void OrientationInverterPyra13::operateAndShutUp(int *beginPt) const
+{
+  std::reverse(beginPt+1,beginPt+4);
+  std::reverse(beginPt+5,beginPt+9);
+  std::swap(beginPt[10],beginPt[12]);
+}
+
+void OrientationInverter3DExtrusionLinear::operateAndShutUp(int *beginPt) const
+{
+  int nbNodes(getNbNodes());
+  std::reverse(beginPt+1,beginPt+nbNodes/2);
+  std::reverse(beginPt+nbNodes/2+1,beginPt+nbNodes);
+}
+
+void OrientationInverter3DExtrusionQuadratic::operateAndShutUp(int *beginPt) const
+{
+  int nbNodes(getNbNodes()),nbNodesLinearBase(nbNodes/5);
+  std::reverse(beginPt+1,beginPt+nbNodesLinearBase);
+  std::reverse(beginPt+nbNodesLinearBase+1,beginPt+2*nbNodesLinearBase);
+  std::reverse(beginPt+2*nbNodesLinearBase,beginPt+3*nbNodesLinearBase);
+  std::reverse(beginPt+3*nbNodesLinearBase,beginPt+4*nbNodesLinearBase);
+  std::reverse(beginPt+4*nbNodesLinearBase+1,beginPt+5*nbNodesLinearBase);
+}
diff --git a/src/INTERP_KERNEL/OrientationInverter.hxx b/src/INTERP_KERNEL/OrientationInverter.hxx
new file mode 100644 (file)
index 0000000..e5af19b
--- /dev/null
@@ -0,0 +1,134 @@
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay (EDF R&D)
+
+#ifndef __ORIENTATIONINVERTER_HXX__
+#define __ORIENTATIONINVERTER_HXX__
+
+#include "INTERPKERNELDefines.hxx"
+#include "NormalizedGeometricTypes"
+
+namespace INTERP_KERNEL
+{
+  class OrientationInverter
+  {
+  public:
+    INTERPKERNEL_EXPORT static OrientationInverter *BuildInstanceFrom(NormalizedCellType gt);
+    INTERPKERNEL_EXPORT virtual ~OrientationInverter() { }
+    INTERPKERNEL_EXPORT virtual void operate(int *beginPt, int *endPt) const = 0;
+  };
+
+  class OrientationInverterChecker : public OrientationInverter
+  {
+  public:
+    OrientationInverterChecker(unsigned nbNodes):_nb_nodes(nbNodes) { }
+    void operate(int *beginPt, int *endPt) const { check(beginPt,endPt); operateAndShutUp(beginPt); }
+    virtual void operateAndShutUp(int *beginPt) const = 0;
+  protected:
+    unsigned getNbNodes() const { return _nb_nodes; }
+  private:
+    void check(int *beginPt, int *endPt) const;
+  private:
+    unsigned _nb_nodes;
+  };
+
+  class OrientationInverterSEG2 : public OrientationInverterChecker
+  {
+  public:
+    OrientationInverterSEG2():OrientationInverterChecker(2u) { }
+    void operateAndShutUp(int *beginPt) const;
+  };
+
+  class OrientationInverterSEG3 : public OrientationInverterChecker
+  {
+  public:
+    OrientationInverterSEG3():OrientationInverterChecker(3u) { }
+    void operateAndShutUp(int *beginPt) const;
+  };
+
+  class OrientationInverter2DLinear : public OrientationInverterChecker
+  {
+  public:
+    OrientationInverter2DLinear(unsigned nbNodes):OrientationInverterChecker(nbNodes) { }
+    void operateAndShutUp(int *beginPt) const;
+  };
+
+  class OrientationInverter2DQuadratic : public OrientationInverterChecker
+  {
+  public:
+    OrientationInverter2DQuadratic(unsigned nbNodes):OrientationInverterChecker(nbNodes) { }
+    void operateAndShutUp(int *beginPt) const;
+  };
+
+  class OrientationInverterPolygon : public OrientationInverter
+  {
+  public:
+    void operate(int *beginPt, int *endPt) const;
+  };
+
+  class OrientationInverterQPolygon : public OrientationInverter
+  {
+  public:
+    void operate(int *beginPt, int *endPt) const;
+  };
+
+  class OrientationInverterTetra4 : public OrientationInverterChecker
+  {
+  public:
+    OrientationInverterTetra4():OrientationInverterChecker(4u) { }
+    void operateAndShutUp(int *beginPt) const;
+  };
+
+  class OrientationInverterTetra10 : public OrientationInverterChecker
+  {
+  public:
+    OrientationInverterTetra10():OrientationInverterChecker(10u) { }
+    void operateAndShutUp(int *beginPt) const;
+  };
+
+  class OrientationInverterPyra5 : public OrientationInverterChecker
+  {
+  public:
+    OrientationInverterPyra5():OrientationInverterChecker(5u) { }
+    void operateAndShutUp(int *beginPt) const;
+  };
+
+  class OrientationInverterPyra13 : public OrientationInverterChecker
+  {
+  public:
+    OrientationInverterPyra13():OrientationInverterChecker(13u) { }
+    void operateAndShutUp(int *beginPt) const;
+  };
+
+  class OrientationInverter3DExtrusionLinear : public OrientationInverterChecker
+  {
+  public:
+    OrientationInverter3DExtrusionLinear(unsigned nbNodes):OrientationInverterChecker(nbNodes) { }
+    void operateAndShutUp(int *beginPt) const;
+  };
+
+  class OrientationInverter3DExtrusionQuadratic : public OrientationInverterChecker
+  {
+  public:
+    OrientationInverter3DExtrusionQuadratic(unsigned nbNodes):OrientationInverterChecker(nbNodes) { }
+    void operateAndShutUp(int *beginPt) const;
+  };
+}
+
+#endif
index 2d06cdde06aa8e3720b14925de3421e44c065fb9..5877f0e31585f722b1f215e5aa993be8af38cdc8 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "VolSurfUser.hxx"
 #include "InterpKernelAutoPtr.hxx"
+#include "InterpolationUtils.hxx"
 
 #include <cmath>
 #include <limits>
@@ -63,29 +64,152 @@ namespace INTERP_KERNEL
     return (x-pt[0])*(x-pt[0])+(y-pt[1])*(y-pt[1]);
   }
 
+  /**
+   * See http://geomalgorithms.com/a02-_lines.html#Distance-to-Ray-or-Segment
+   */
+  double DistanceFromPtToSegInSpaceDim3(const double *pt, const double *pt0Seg2, const double *pt1Seg2)
+  {
+    double v[3], w[3];
+    for(int i=0; i < 3; i++) {
+        v[i]=pt1Seg2[i]-pt0Seg2[i];
+        w[i] = pt[i] - pt0Seg2[i];
+    }
+
+    double c1 = dotprod<3>(w,v);
+    if ( c1 <= 0 )
+      return norm<3>(w);
+    double c2 = dotprod<3>(v,v);
+    if ( c2 <= c1 )
+      {
+        for(int i=0; i < 3; i++)
+          w[i] = pt[i] - pt1Seg2[i];
+        return norm<3>(w);
+      }
+    double b = c1 / c2;
+    for(int i=0; i < 3; i++)
+      w[i] = pt0Seg2[i] + b * v[i] - pt[i];
+    return norm<3>(w);
+  }
+
+  /**
+     Helper for DistanceFromPtToTriInSpaceDim3
+   */
+  inline double _HelperDistancePtToTri3D_1(const double aXX, const double bX, const double c)
+  {
+    if (bX >= 0)
+      return c;
+    if (-bX >= aXX)
+      return aXX + 2*bX + c;
+    return bX*(-bX / aXX) + c;
+  }
+
+  /**
+    Helper for DistanceFromPtToTriInSpaceDim3
+   */
+  inline double _HelperDistancePtToTri3D_2(const double a01, const double aXX, const double aYY,
+                                           const double bX, const double bY, const double c)
+  {
+    double tmp0 = a01 + bX, tmp1 = aXX + bY;
+    if (tmp1 > tmp0) {
+        double numer = tmp1 - tmp0, denom = aXX - 2*a01 + aYY;
+        if (numer >= denom)
+          return aXX + 2*bX + c;
+        else {
+            double s, t;
+            s = numer / denom; t = 1 - s;
+            return s*(aXX*s + a01*t + 2*bX) + t*(a01*s + aYY*t + 2*bY) + c;
+        }
+    }
+    else
+      {
+        if (tmp1 <= 0)   return aYY + 2*bY + c;
+        else {
+            if (bY >= 0) return c;
+            else         return bY*(-bY / aYY) + c;
+        }
+      }
+  }
+
+  /**
+   * From https://www.geometrictools.com/Documentation/DistancePoint3Triangle3.pdf
+   */
   double DistanceFromPtToTriInSpaceDim3(const double *pt, const double *pt0Tri3, const double *pt1Tri3, const double *pt2Tri3)
   {
-    double matrix[12];
-    if(!ComputeRotTranslationMatrixToPut3PointsOnOXY(pt0Tri3,pt1Tri3,pt2Tri3,matrix))
-      return std::numeric_limits<double>::max();
-    double xy0[2],xy1[2],xy2[2],xy[2]; xy0[0]=0.; xy0[1]=0.;
-    xy1[0]=matrix[0]*pt1Tri3[0]+matrix[1]*pt1Tri3[1]+matrix[2]*pt1Tri3[2]+matrix[3]; xy1[1]=0.;
-    xy2[0]=matrix[0]*pt2Tri3[0]+matrix[1]*pt2Tri3[1]+matrix[2]*pt2Tri3[2]+matrix[3];
-    xy2[1]=matrix[4]*pt2Tri3[0]+matrix[5]*pt2Tri3[1]+matrix[6]*pt2Tri3[2]+matrix[7];
-    xy[0]=matrix[0]*pt[0]+matrix[1]*pt[1]+matrix[2]*pt[2]+matrix[3];
-    xy[1]=matrix[4]*pt[0]+matrix[5]*pt[1]+matrix[6]*pt[2]+matrix[7];
-    double z=matrix[8]*pt[0]+matrix[9]*pt[1]+matrix[10]*pt[2]+matrix[11];
-    double ret=std::numeric_limits<double>::max();
-    std::size_t nbOfHint=0;
-    if(xy[0]>0. && xy[0]<xy1[0])
-      { ret=std::min(ret,z*z+xy[1]*xy[1]); nbOfHint++; } //distance pt to edge [pt0Tri3,pt1Tri3]
-    double tmp=SquareDistanceFromPtToSegInSpaceDim2(xy,xy1,xy2,nbOfHint); //distance pt to edge [pt1Tri3,pt2Tri3]
-    ret=std::min(ret,z*z+tmp);
-    tmp=SquareDistanceFromPtToSegInSpaceDim2(xy,xy2,xy0,nbOfHint);//distance pt to edge [pt2Tri3,pt0Tri3]
-    ret=std::min(ret,z*z+tmp);
-    if(nbOfHint==3)
-      ret=std::min(ret,z*z);
-  return sqrt(ret);
+    double diff[3], edge0[3], edge1[3];
+    for(int i=0; i < 3; i++) diff[i]=pt0Tri3[i]-pt[i];
+    for(int i=0; i < 3; i++) edge0[i]=pt1Tri3[i]-pt0Tri3[i];
+    for(int i=0; i < 3; i++) edge1[i]=pt2Tri3[i]-pt0Tri3[i];
+
+    double a00=dotprod<3>(edge0, edge0), a01=dotprod<3>(edge0,edge1), a11=dotprod<3>(edge1,edge1);
+    double b0=dotprod<3>(diff, edge0), b1=dotprod<3>(diff, edge1), c=dotprod<3>(diff, diff);
+    double det = fabs(a00*a11 - a01*a01);
+    double s = a01*b1 - a11*b0, t = a01*b0 - a00*b1;
+    double sDist;
+
+    if (s + t <= det)
+      {
+        if (s < 0)  {
+            if (t < 0) { // region 4
+                if (b0 < 0) {
+                    if (-b0 >= a00)  sDist = a00 + 2*b0 + c;
+                    else             sDist = b0*(-b0 / a00) + c;
+                  }
+                else
+                  sDist = _HelperDistancePtToTri3D_1(a11, b1, c);
+              }
+            else  // region 3
+              sDist = _HelperDistancePtToTri3D_1(a11, b1, c);
+          }
+        else       {
+            if (t < 0)  // region 5
+              sDist = _HelperDistancePtToTri3D_1(a00, b0, c);
+            else  // region 0
+              {
+                // minimum at interior point
+                if (fabs(det) < 1.0e-12)
+                  {
+                    // points are colinear (degenerated triangle)
+                    // => Compute distance between segments
+                     double distance = std::min(DistanceFromPtToSegInSpaceDim3(pt, pt0Tri3, pt1Tri3),
+                                                DistanceFromPtToSegInSpaceDim3(pt, pt1Tri3, pt2Tri3));
+                     return distance;
+                  }
+
+                // else we can divide by non-zero
+                double invDet = 1 / det;
+                s *= invDet;    t *= invDet;
+                sDist = s*(a00*s + a01*t + 2*b0) + t*(a01*s + a11*t + 2*b1) + c;
+              }
+          }
+      }
+    else  // s+t > det
+      {
+        if (s < 0.0)  // region 2
+          sDist = _HelperDistancePtToTri3D_2(a01, a00, a11, b0, b1, c);
+        else {
+            if (t < 0.0)  // region 6
+              sDist = _HelperDistancePtToTri3D_2(a01, a11, a00, b1, b0, c);
+            else {  // region 1
+                double numer = a11 + b1 - a01 - b0;
+                if (numer <= 0.0)
+                  sDist = a11 + 2*b1 + c;
+                else {
+                    double denom = a00 - 2*a01 + a11;
+                    if (numer >= denom)
+                      sDist = a00 + 2*b0 + c;
+                    else {
+                        s = numer / denom; t = 1 - s;
+                        sDist = s*(a00*s + a01*t + 2*b0) + t*(a01*s + a11*t + 2*b1) + c;
+                    }
+                }
+            }
+        }
+      }
+    // Account for numerical round-off error.
+    if (sDist < 0)
+      sDist = 0.0;
+
+    return sqrt(sDist);
   }
 
   double DistanceFromPtToPolygonInSpaceDim3(const double *pt, const int *connOfPolygonBg, const int *connOfPolygonEnd, const double *coords)
index d325f6398feceed87a75e59bf01e3cde26b2b3a0..b0ee27d2413a3cf9c89932875c76b1e581715198 100644 (file)
@@ -45,7 +45,9 @@ namespace INTERP_TEST
         return resourceFile;
     }
     // else
-    resourceFile = getcwd(NULL, 0);
+    char * tmp_c = getcwd(NULL, 0);
+    resourceFile = tmp_c;
+    free(tmp_c);
     resourceFile += "/";
     for(int i=0; i<levelUp; i++)
       resourceFile += "../";
index 34ae94365739c5d7fd0f1fc605174c723d171c06..30695ac6fba1b85fdb5f8bd179a277e95bc62e12 100644 (file)
@@ -34,6 +34,7 @@ INCLUDE_DIRECTORIES(
 
 SET(medcoupling_SOURCES
   MEDCouplingField.cxx
+  MEDCouplingFieldFloat.cxx
   MEDCouplingFieldDouble.cxx
   MEDCouplingFieldInt.cxx
   MEDCouplingUMesh.cxx
@@ -41,7 +42,9 @@ SET(medcoupling_SOURCES
   MEDCouplingUMesh_intersection.cxx
   MEDCoupling1GTUMesh.cxx
   MEDCouplingMemArray.cxx
+  MEDCouplingMemArrayFloat.cxx
   MEDCouplingMemArrayChar.cxx
+  MEDCouplingMap.cxx
   MEDCouplingTraits.cxx
   MEDCouplingTimeLabel.cxx
   MEDCouplingCMesh.cxx
diff --git a/src/MEDCoupling/MCType.hxx b/src/MEDCoupling/MCType.hxx
new file mode 100644 (file)
index 0000000..a495733
--- /dev/null
@@ -0,0 +1,34 @@
+// Copyright (C) 2017  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay (EDF R&D)
+
+#ifndef __MEDCOUPLING_MCTYPE_HXX__
+#define __MEDCOUPLING_MCTYPE_HXX__
+
+namespace MEDCoupling
+{
+  typedef long Int64;
+  typedef int  Int32;
+}
+
+#define DataArrayInt DataArrayInt32
+
+#define DataArrayIntIterator DataArrayInt32Iterator
+
+#endif
index 7dda1671a544aeb7b8aa1848d581350bb3f5ae01..74ead711b4da655010f4f14c74b26d139e97be22 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "SplitterTetra.hxx"
 #include "DiameterCalculator.hxx"
+#include "OrientationInverter.hxx"
 #include "InterpKernelAutoPtr.hxx"
 
 using namespace MEDCoupling;
@@ -2138,6 +2139,22 @@ MEDCouplingFieldDouble *MEDCoupling1SGTUMesh::computeDiameterField() const
   return ret.retn();
 }
 
+/*!
+ * This method invert orientation of all cells in \a this. 
+ * After calling this method the absolute value of measure of cells in \a this are the same than before calling.
+ * This method only operates on the connectivity so coordinates are not touched at all.
+ */
+void MEDCoupling1SGTUMesh::invertOrientationOfAllCells()
+{
+  checkConsistencyOfConnectivity();
+  INTERP_KERNEL::AutoCppPtr<INTERP_KERNEL::OrientationInverter> oi(INTERP_KERNEL::OrientationInverter::BuildInstanceFrom(getCellModelEnum()));
+  int nbOfNodesPerCell((int)_cm->getNumberOfNodes()),nbCells(getNumberOfCells());
+  int *conn(_conn->getPointer());
+  for(int i=0;i<nbCells;i++)
+    oi->operate(conn+i*nbOfNodesPerCell,conn+(i+1)*nbOfNodesPerCell);
+  updateTime();
+}
+
 //== 
 
 MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::New()
@@ -3647,6 +3664,23 @@ std::vector<int> MEDCoupling1DGTUMesh::BuildAPolygonFromParts(const std::vector<
   return ret;
 }
 
+/*!
+ * This method invert orientation of all cells in \a this. 
+ * After calling this method the absolute value of measure of cells in \a this are the same than before calling.
+ * This method only operates on the connectivity so coordinates are not touched at all.
+ */
+void MEDCoupling1DGTUMesh::invertOrientationOfAllCells()
+{
+  checkConsistencyOfConnectivity();
+  INTERP_KERNEL::AutoCppPtr<INTERP_KERNEL::OrientationInverter> oi(INTERP_KERNEL::OrientationInverter::BuildInstanceFrom(getCellModelEnum()));
+  int nbCells(getNumberOfCells());
+  const int *connI(_conn_indx->begin());
+  int *conn(_conn->getPointer());
+  for(int i=0;i<nbCells;i++)
+    oi->operate(conn+connI[i],conn+connI[i+1]);
+  updateTime();
+}
+
 /*!
  * This method performs an aggregation of \a nodalConns (as DataArrayInt::Aggregate does) but in addition of that a shift is applied on the 
  * values contained in \a nodalConns using corresponding offset specified in input \a offsetInNodeIdsPerElt.
index c17ab296f3cc01ebdcb32bc7c68e3345119bfc69..e3c77064915956e0f161dc17b7b355f2412846fa 100644 (file)
@@ -22,6 +22,7 @@
 #define __PARAMEDMEM_MEDCOUPLING1GTUMESH_HXX__
 
 #include "MEDCoupling.hxx"
+#include "MCType.hxx"
 #include "MEDCouplingPointSet.hxx"
 #include "MEDCouplingMemArray.hxx"
 #include "MCAuto.hxx"
@@ -139,6 +140,7 @@ namespace MEDCoupling
     MEDCOUPLING_EXPORT int getNumberOfNodesInCell(int cellId) const;
     MEDCOUPLING_EXPORT DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const;
     MEDCOUPLING_EXPORT MEDCouplingFieldDouble *computeDiameterField() const;
+    MEDCOUPLING_EXPORT void invertOrientationOfAllCells();
     // overload of MEDCoupling1GTUMesh
     MEDCOUPLING_EXPORT void checkConsistencyOfConnectivity() const;
     MEDCOUPLING_EXPORT void allocateCells(int nbOfCells=0);
@@ -234,6 +236,7 @@ namespace MEDCoupling
     MEDCOUPLING_EXPORT int getNumberOfNodesInCell(int cellId) const;
     MEDCOUPLING_EXPORT DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const;
     MEDCOUPLING_EXPORT MEDCouplingFieldDouble *computeDiameterField() const;
+    MEDCOUPLING_EXPORT void invertOrientationOfAllCells();
     // overload of MEDCoupling1GTUMesh
     MEDCOUPLING_EXPORT void checkConsistencyOfConnectivity() const;
     MEDCOUPLING_EXPORT void allocateCells(int nbOfCells=0);
index f640504926209fefa8031892de5c73d5ee22faf5..066d39ac41ddd8af03adf5dd60c363b0b3753450 100644 (file)
@@ -36,9 +36,9 @@ MEDCouplingCMesh::MEDCouplingCMesh():_x_array(0),_y_array(0),_z_array(0)
 {
 }
 
-MEDCouplingCMesh::MEDCouplingCMesh(const MEDCouplingCMesh& other, bool deepCopy):MEDCouplingStructuredMesh(other,deepCopy)
+MEDCouplingCMesh::MEDCouplingCMesh(const MEDCouplingCMesh& other, bool deepCpy):MEDCouplingStructuredMesh(other,deepCpy)
 {
-  if(deepCopy)
+  if(deepCpy)
     {
       if(other._x_array)
         _x_array=other._x_array->deepCopy();
index 0af6ec29200d53fca57383cf1725aa978c001e27..8f17528ea43acb572c33dc0f4054786c01ccf8bc 100644 (file)
@@ -88,7 +88,7 @@ namespace MEDCoupling
     MEDCOUPLING_EXPORT std::string getVTKFileExtension() const;
   private:
     MEDCouplingCMesh();
-    MEDCouplingCMesh(const MEDCouplingCMesh& other, bool deepCopy);
+    MEDCouplingCMesh(const MEDCouplingCMesh& other, bool deepCpy);
     ~MEDCouplingCMesh();
     void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const;
     std::string getVTKDataSetType() const;
index 0476da20d57b481480e6231e5310b56919c10318..fdc4ceb8c58e76a8706b95b0a81c85074238c26e 100644 (file)
@@ -25,6 +25,7 @@
 #include "MEDCouplingTimeLabel.hxx"
 #include "MEDCouplingRefCountObject.hxx"
 #include "MCAuto.hxx"
+#include "MCType.hxx"
 
 #include "BoxSplittingOptions.hxx"
 #include "InterpKernelException.hxx"
index b8e76f68291900eec5609eb17bdaa3b89afff235..b321f93eca4f5662bcea762c4dd8ebf91a27d348 100644 (file)
@@ -16,7 +16,7 @@
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-// Author : Anthony Geay (CEA/DEN)
+// Author : Anthony Geay (EDF R&D)
 
 #include "MEDCouplingCurveLinearMesh.hxx"
 #include "MEDCouplingPointSet.hxx"
@@ -37,9 +37,9 @@ MEDCouplingCurveLinearMesh::MEDCouplingCurveLinearMesh():_coords(0),_structure(0
 {
 }
 
-MEDCouplingCurveLinearMesh::MEDCouplingCurveLinearMesh(const MEDCouplingCurveLinearMesh& other, bool deepCopy):MEDCouplingStructuredMesh(other,deepCopy),_structure(other._structure)
+MEDCouplingCurveLinearMesh::MEDCouplingCurveLinearMesh(const MEDCouplingCurveLinearMesh& other, bool deepCpy):MEDCouplingStructuredMesh(other,deepCpy),_structure(other._structure)
 {
-  if(deepCopy)
+  if(deepCpy)
     {
       if((const DataArrayDouble *)other._coords)
         _coords=other._coords->deepCopy();
index d9884d89c8a689a73f27c183a6b86f07f60e941d..616f6740705d8038ab284d0402bb4f328bf681c1 100644 (file)
@@ -94,7 +94,7 @@ namespace MEDCoupling
     void getBarycenterAndOwnerMeshDim1(DataArrayDouble *bary) const;
   private:
     MEDCouplingCurveLinearMesh();
-    MEDCouplingCurveLinearMesh(const MEDCouplingCurveLinearMesh& other, bool deepCopy);
+    MEDCouplingCurveLinearMesh(const MEDCouplingCurveLinearMesh& other, bool deepCpy);
     ~MEDCouplingCurveLinearMesh();
     void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const;
     std::string getVTKDataSetType() const;
index 6cb1d512a16834cb9de4e9d80da79db38738c8cc..eb719663d447f7c47800cf24995d01f5449306ac 100644 (file)
@@ -1701,7 +1701,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationGauss::getMeasureField(con
   _discr_per_cell->checkAllocated();
   if(_discr_per_cell->getNumberOfComponents()!=1)
     throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getMeasureField : no discr per cell array defined but with nb of components different from 1 !");
-  if(_discr_per_cell->getNumberOfTuples()!=vol->getNumberOfTuples())
+  if(_discr_per_cell->getNumberOfTuples()!=(int)vol->getNumberOfTuples())
     throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getMeasureField : no discr per cell array defined but mismatch between nb of cells of mesh and size of spatial disr array !");
   MCAuto<DataArrayInt> offset=getOffsetArr(mesh);
   MCAuto<DataArrayDouble> arr=DataArrayDouble::New(); arr->alloc(getNumberOfTuples(mesh),1);
index 3fef0349a7904199a877d96b4e33c9b96ec2c7c1..49bb8d44275b3c334b6e4c1ccb0b1c8d15498919 100644 (file)
@@ -174,9 +174,9 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::deepCopy() const
  * \endif
  * \sa clone()
  */
-MEDCouplingFieldDouble *MEDCouplingFieldDouble::buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCopy) const
+MEDCouplingFieldDouble *MEDCouplingFieldDouble::buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const
 {
-  MEDCouplingTimeDiscretization *tdo=timeDiscr()->buildNewTimeReprFromThis(td,deepCopy);
+  MEDCouplingTimeDiscretization *tdo=timeDiscr()->buildNewTimeReprFromThis(td,deepCpy);
   MCAuto<MEDCouplingFieldDiscretization> disc;
   if(_type)
     disc=_type->clone();
@@ -522,149 +522,6 @@ DataArrayInt *MEDCouplingFieldDouble::findIdsInRange(double vmin, double vmax) c
   return getArray()->findIdsInRange(vmin,vmax);
 }
 
-/*!
- * Builds a newly created field, that the caller will have the responsability to deal with (decrRef()).
- * This method makes the assumption that the field is correctly defined when this method is called, no check of this will be done.
- * This method returns a restriction of \a this so that only tuples with ids specified in \a part will be contained in the returned field.
- * Parameter \a part specifies **cell ids whatever the spatial discretization of this** (
- * \ref MEDCoupling::ON_CELLS "ON_CELLS", 
- * \ref MEDCoupling::ON_NODES "ON_NODES",
- * \ref MEDCoupling::ON_GAUSS_PT "ON_GAUSS_PT", 
- * \ref MEDCoupling::ON_GAUSS_NE "ON_GAUSS_NE",
- * \ref MEDCoupling::ON_NODES_KR "ON_NODES_KR").
- *
- * For example, \a this is a field on cells lying on a mesh that have 10 cells, \a part contains following cell ids [3,7,6].
- * Then the returned field will lie on mesh having 3 cells and the returned field will contain 3 tuples.<br>
- * Tuple #0 of the result field will refer to the cell #0 of returned mesh. The cell #0 of returned mesh will be equal to the cell #3 of \a this->getMesh().<br>
- * Tuple #1 of the result field will refer to the cell #1 of returned mesh. The cell #1 of returned mesh will be equal to the cell #7 of \a this->getMesh().<br>
- * Tuple #2 of the result field will refer to the cell #2 of returned mesh. The cell #2 of returned mesh will be equal to the cell #6 of \a this->getMesh().
- *
- * Let, for example, \a this be a field on nodes lying on a mesh that have 10 cells and 11 nodes, and \a part contains following cellIds [3,7,6].
- * Thus \a this currently contains 11 tuples. If the restriction of mesh to 3 cells leads to a mesh with 6 nodes, then the returned field
- * will contain 6 tuples and \a this field will lie on this restricted mesh. 
- *
- *  \param [in] part - an array of cell ids to include to the result field.
- *  \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The caller is to delete this field using decrRef() as it is no more needed.
- *
- *  \if ENABLE_EXAMPLES
- *  \ref cpp_mcfielddouble_subpart1 "Here is a C++ example".<br>
- *  \ref  py_mcfielddouble_subpart1 "Here is a Python example".
- *  \endif
- *  \sa MEDCouplingFieldDouble::buildSubPartRange
- */
-
-MEDCouplingFieldDouble *MEDCouplingFieldDouble::buildSubPart(const DataArrayInt *part) const
-{
-  if(part==0)
-    throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : not empty array must be passed to this method !");
-  return buildSubPart(part->begin(),part->end());
-}
-
-/*!
- * Builds a newly created field, that the caller will have the responsability to deal with.
- * \n This method makes the assumption that \a this field is correctly defined when this method is called (\a this->checkConsistencyLight() returns without any exception thrown), **no check of this will be done**.
- * \n This method returns a restriction of \a this so that only tuple ids specified in [ \a partBg , \a partEnd ) will be contained in the returned field.
- * \n Parameter [\a partBg, \a partEnd ) specifies **cell ids whatever the spatial discretization** of \a this (
- * \ref MEDCoupling::ON_CELLS "ON_CELLS", 
- * \ref MEDCoupling::ON_NODES "ON_NODES",
- * \ref MEDCoupling::ON_GAUSS_PT "ON_GAUSS_PT", 
- * \ref MEDCoupling::ON_GAUSS_NE "ON_GAUSS_NE",
- * \ref MEDCoupling::ON_NODES_KR "ON_NODES_KR").
- *
- * For example, \a this is a field on cells lying on a mesh that have 10 cells, \a partBg contains the following cell ids [3,7,6].
- * Then the returned field will lie on mesh having 3 cells and will contain 3 tuples.
- *- Tuple #0 of the result field will refer to the cell #0 of returned mesh. The cell #0 of returned mesh will be equal to the cell #3 of \a this->getMesh().
- *- Tuple #1 of the result field will refer to the cell #1 of returned mesh. The cell #1 of returned mesh will be equal to the cell #7 of \a this->getMesh().
- *- Tuple #2 of the result field will refer to the cell #2 of returned mesh. The cell #2 of returned mesh will be equal to the cell #6 of \a this->getMesh().
- *
- * Let, for example, \a this be a field on nodes lying on a mesh that have 10 cells and 11 nodes, and \a partBg contains following cellIds [3,7,6].
- * Thus \a this currently contains 11 tuples. If the restriction of mesh to 3 cells leads to a mesh with 6 nodes, then the returned field
- * will contain 6 tuples and \a this field will lie on this restricted mesh. 
- *
- * \param [in] partBg - start (included) of input range of cell ids to select [ \a partBg, \a partEnd )
- * \param [in] partEnd - end (not included) of input range of cell ids to select [ \a partBg, \a partEnd )
- * \return a newly allocated field the caller should deal with.
- * 
- * \throw if there is presence of an invalid cell id in [ \a partBg, \a partEnd ) regarding the number of cells of \a this->getMesh().
- *
- * \if ENABLE_EXAMPLES
- * \ref cpp_mcfielddouble_subpart1 "Here a C++ example."<br>
- * \ref py_mcfielddouble_subpart1 "Here a Python example."
- * \endif
- * \sa MEDCoupling::MEDCouplingFieldDouble::buildSubPart(const DataArrayInt *) const, MEDCouplingFieldDouble::buildSubPartRange
- */
-MEDCouplingFieldDouble *MEDCouplingFieldDouble::buildSubPart(const int *partBg, const int *partEnd) const
-{
-  if(_type.isNull())
-    throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : Expecting a not NULL spatial discretization !");
-  DataArrayInt *arrSelect;
-  MCAuto<MEDCouplingMesh> m=_type->buildSubMeshData(_mesh,partBg,partEnd,arrSelect);
-  MCAuto<DataArrayInt> arrSelect2(arrSelect);
-  MCAuto<MEDCouplingFieldDouble> ret(clone(false));//quick shallow copy.
-  const MEDCouplingFieldDiscretization *disc=getDiscretization();
-  if(disc)
-    ret->setDiscretization(MCAuto<MEDCouplingFieldDiscretization>(disc->clonePart(partBg,partEnd)));
-  ret->setMesh(m);
-  std::vector<DataArrayDouble *> arrays;
-  timeDiscr()->getArrays(arrays);
-  std::vector<DataArrayDouble *> arrs;
-  std::vector< MCAuto<DataArrayDouble> > arrsSafe;
-  const int *arrSelBg=arrSelect->begin();
-  const int *arrSelEnd=arrSelect->end();
-  for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
-    {
-      DataArrayDouble *arr=0;
-      if(*iter)
-        arr=(*iter)->selectByTupleIdSafe(arrSelBg,arrSelEnd);
-      arrs.push_back(arr); arrsSafe.push_back(arr);
-    }
-  ret->timeDiscr()->setArrays(arrs,0);
-  return ret.retn();
-}
-
-/*!
- * This method is equivalent to MEDCouplingFieldDouble::buildSubPart, the only difference is that the input range of cell ids is
- * given using a range given \a begin, \a end and \a step to optimize the part computation.
- * 
- * \sa MEDCouplingFieldDouble::buildSubPart
- */
-MEDCouplingFieldDouble *MEDCouplingFieldDouble::buildSubPartRange(int begin, int end, int step) const
-{
-  if(_type.isNull())
-    throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : Expecting a not NULL spatial discretization !");
-  DataArrayInt *arrSelect;
-  int beginOut,endOut,stepOut;
-  MCAuto<MEDCouplingMesh> m(_type->buildSubMeshDataRange(_mesh,begin,end,step,beginOut,endOut,stepOut,arrSelect));
-  MCAuto<DataArrayInt> arrSelect2(arrSelect);
-  MCAuto<MEDCouplingFieldDouble> ret(clone(false));//quick shallow copy.
-  const MEDCouplingFieldDiscretization *disc=getDiscretization();
-  if(disc)
-    ret->setDiscretization(MCAuto<MEDCouplingFieldDiscretization>(disc->clonePartRange(begin,end,step)));
-  ret->setMesh(m);
-  std::vector<DataArrayDouble *> arrays;
-  timeDiscr()->getArrays(arrays);
-  std::vector<DataArrayDouble *> arrs;
-  std::vector< MCAuto<DataArrayDouble> > arrsSafe;
-  for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
-    {
-      DataArrayDouble *arr=0;
-      if(*iter)
-        {
-          if(arrSelect)
-            {
-              const int *arrSelBg=arrSelect->begin();
-              const int *arrSelEnd=arrSelect->end();
-              arr=(*iter)->selectByTupleIdSafe(arrSelBg,arrSelEnd);
-            }
-          else
-            arr=(*iter)->selectByTupleIdSafeSlice(beginOut,endOut,stepOut);
-        }
-      arrs.push_back(arr); arrsSafe.push_back(arr);
-    }
-  ret->timeDiscr()->setArrays(arrs,0);
-  return ret.retn();
-}
-
 MEDCouplingFieldInt *MEDCouplingFieldDouble::convertToIntField() const
 {
   MCAuto<MEDCouplingFieldTemplate> tmp(MEDCouplingFieldTemplate::New(*this));
@@ -691,7 +548,7 @@ MEDCouplingFieldDouble::MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& f
 {
 }
 
-MEDCouplingFieldDouble::MEDCouplingFieldDouble(const MEDCouplingFieldDouble& other, bool deepCopy):MEDCouplingFieldT<double>(other,deepCopy)
+MEDCouplingFieldDouble::MEDCouplingFieldDouble(const MEDCouplingFieldDouble& other, bool deepCpy):MEDCouplingFieldT<double>(other,deepCpy)
 {
 }
 
@@ -1769,126 +1626,6 @@ double MEDCouplingFieldDouble::getIJK(int cellId, int nodeIdInCell, int compoId)
  */
 //void MEDCouplingFieldDouble::setArrays(const std::vector<DataArrayDouble *>& arrs)
 
-void MEDCouplingFieldDouble::getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const
-{
-  tinyInfo.clear();
-  timeDiscr()->getTinySerializationStrInformation(tinyInfo);
-  tinyInfo.push_back(_name);
-  tinyInfo.push_back(_desc);
-  tinyInfo.push_back(getTimeUnit());
-}
-
-/*!
- * This method retrieves some critical values to resize and prepare remote instance.
- * The first two elements returned in tinyInfo correspond to the parameters to give in constructor.
- * @param tinyInfo out parameter resized correctly after the call. The length of this vector is tiny.
- */
-void MEDCouplingFieldDouble::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
-{
-  if(_type.isNull())
-    throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform getTinySerializationIntInformation !");
-  tinyInfo.clear();
-  tinyInfo.push_back((int)_type->getEnum());
-  tinyInfo.push_back((int)timeDiscr()->getEnum());
-  tinyInfo.push_back((int)_nature);
-  timeDiscr()->getTinySerializationIntInformation(tinyInfo);
-  std::vector<int> tinyInfo2;
-  _type->getTinySerializationIntInformation(tinyInfo2);
-  tinyInfo.insert(tinyInfo.end(),tinyInfo2.begin(),tinyInfo2.end());
-  tinyInfo.push_back((int)tinyInfo2.size());
-}
-
-/*!
- * This method retrieves some critical values to resize and prepare remote instance.
- * @param tinyInfo out parameter resized correctly after the call. The length of this vector is tiny.
- */
-void MEDCouplingFieldDouble::getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const
-{
-  if(_type.isNull())
-    throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform getTinySerializationDbleInformation !");
-  tinyInfo.clear();
-  timeDiscr()->getTinySerializationDbleInformation(tinyInfo);
-  std::vector<double> tinyInfo2;
-  _type->getTinySerializationDbleInformation(tinyInfo2);
-  tinyInfo.insert(tinyInfo.end(),tinyInfo2.begin(),tinyInfo2.end());
-  tinyInfo.push_back((int)tinyInfo2.size());//very bad, lack of time to improve it
-}
-
-/*!
- * This method has to be called to the new instance filled by CORBA, MPI, File...
- * @param tinyInfoI is the value retrieves from distant result of getTinySerializationIntInformation on source instance to be copied.
- * @param dataInt out parameter. If not null the pointer is already owned by \a this after the call of this method. In this case no decrRef must be applied.
- * @param arrays out parameter is a vector resized to the right size. The pointers in the vector is already owned by \a this after the call of this method.
- *               No decrRef must be applied to every instances in returned vector.
- * \sa checkForUnserialization
- */
-void MEDCouplingFieldDouble::resizeForUnserialization(const std::vector<int>& tinyInfoI, DataArrayInt *&dataInt, std::vector<DataArrayDouble *>& arrays)
-{
-  if(_type.isNull())
-    throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform resizeForUnserialization !");
-  dataInt=0;
-  std::vector<int> tinyInfoITmp(tinyInfoI);
-  int sz=tinyInfoITmp.back();
-  tinyInfoITmp.pop_back();
-  std::vector<int> tinyInfoITmp2(tinyInfoITmp.begin(),tinyInfoITmp.end()-sz);
-  std::vector<int> tinyInfoI2(tinyInfoITmp2.begin()+3,tinyInfoITmp2.end());
-  timeDiscr()->resizeForUnserialization(tinyInfoI2,arrays);
-  std::vector<int> tinyInfoITmp3(tinyInfoITmp.end()-sz,tinyInfoITmp.end());
-  _type->resizeForUnserialization(tinyInfoITmp3,dataInt);
-}
-
-/*!
- * This method is extremely close to resizeForUnserialization except that here the arrays in \a dataInt and in \a arrays are attached in \a this
- * after having checked that size is correct. This method is used in python pickeling context to avoid copy of data.
- * \sa resizeForUnserialization
- */
-void MEDCouplingFieldDouble::checkForUnserialization(const std::vector<int>& tinyInfoI, const DataArrayInt *dataInt, const std::vector<DataArrayDouble *>& arrays)
-{
-  if(_type.isNull())
-    throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform resizeForUnserialization !");
-  std::vector<int> tinyInfoITmp(tinyInfoI);
-  int sz=tinyInfoITmp.back();
-  tinyInfoITmp.pop_back();
-  std::vector<int> tinyInfoITmp2(tinyInfoITmp.begin(),tinyInfoITmp.end()-sz);
-  std::vector<int> tinyInfoI2(tinyInfoITmp2.begin()+3,tinyInfoITmp2.end());
-  timeDiscr()->checkForUnserialization(tinyInfoI2,arrays);
-  std::vector<int> tinyInfoITmp3(tinyInfoITmp.end()-sz,tinyInfoITmp.end());
-  _type->checkForUnserialization(tinyInfoITmp3,dataInt);
-}
-
-void MEDCouplingFieldDouble::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
-{
-  if(_type.isNull())
-    throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform finishUnserialization !");
-  std::vector<int> tinyInfoI2(tinyInfoI.begin()+3,tinyInfoI.end());
-  //
-  std::vector<double> tmp(tinyInfoD);
-  int sz=(int)tinyInfoD.back();//very bad, lack of time to improve it
-  tmp.pop_back();
-  std::vector<double> tmp1(tmp.begin(),tmp.end()-sz);
-  std::vector<double> tmp2(tmp.end()-sz,tmp.end());
-  //
-  timeDiscr()->finishUnserialization(tinyInfoI2,tmp1,tinyInfoS);
-  _nature=(NatureOfField)tinyInfoI[2];
-  _type->finishUnserialization(tmp2);
-  int nbOfElemS=(int)tinyInfoS.size();
-  _name=tinyInfoS[nbOfElemS-3];
-  _desc=tinyInfoS[nbOfElemS-2];
-  setTimeUnit(tinyInfoS[nbOfElemS-1]);
-}
-
-/*!
- * Contrary to MEDCouplingPointSet class the returned arrays are \b not the responsabilities of the caller.
- * The values returned must be consulted only in readonly mode.
- */
-void MEDCouplingFieldDouble::serialize(DataArrayInt *&dataInt, std::vector<DataArrayDouble *>& arrays) const
-{
-  if(_type.isNull())
-    throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform serialize !");
-  timeDiscr()->getArrays(arrays);
-  _type->getSerializationIntArray(dataInt);
-}
-
 /*!
  * Tries to set an \a other mesh as the support of \a this field. An attempt fails, if
  * a current and the \a other meshes are different with use of specified equality
@@ -2279,7 +2016,6 @@ MCAuto<MEDCouplingFieldDouble> MEDCouplingFieldDouble::convertQuadraticCellsToLi
         if(!disc2)
           throw INTERP_KERNEL::Exception("convertQuadraticCellsToLinear : Not a ON_GAUSS_PT field");
         std::set<INTERP_KERNEL::NormalizedCellType> gt2(umesh->getAllGeoTypes());
-        const DataArrayDouble *arr(getArray());
         std::vector< MCAuto<DataArrayInt> > cellIdsV;
         std::vector< MCAuto<MEDCouplingUMesh> > meshesV;
         std::vector< MEDCouplingGaussLocalization > glV;
@@ -3243,12 +2979,12 @@ MCAuto<MEDCouplingFieldDouble> MEDCouplingFieldDouble::voronoizeGen(const Voroni
         ptsInReal=gl.localizePtsInRefCooForEachCell(vorCellsForCurDisc->getCoords(),subMesh);
       }
       int nbPtsPerCell(vorCellsForCurDisc->getNumberOfNodes());
-      for(std::size_t i=0;i<ids.size();i++)
+      for(std::size_t j=0;j<ids.size();j++)
         {
           MCAuto<MEDCouplingUMesh> elt(vorCellsForCurDisc->clone(false));
-          MCAuto<DataArrayDouble> coo(ptsInReal->selectByTupleIdSafeSlice(i*nbPtsPerCell,(i+1)*nbPtsPerCell,1));
-          elt->setCoords(coo);
-          cells[ids[i]]=elt;
+          MCAuto<DataArrayDouble> coo4(ptsInReal->selectByTupleIdSafeSlice(j*nbPtsPerCell,(j+1)*nbPtsPerCell,1));
+          elt->setCoords(coo4);
+          cells[ids[j]]=elt;
         }
     }
   std::vector< const MEDCouplingUMesh * > cellsPtr(VecAutoToVecOfCstPt(cells));
@@ -3291,4 +3027,3 @@ const MEDCouplingTimeDiscretization *MEDCouplingFieldDouble::timeDiscr() const
     throw INTERP_KERNEL::Exception("Field Double Null invalid type of time discr !");
   return retc;
 }
-
index d096f986486611a8066edc21624261235b939fb7..f12f4ed52a63d80defc7cb07711c7ef132f3e1ec 100644 (file)
@@ -46,12 +46,9 @@ namespace MEDCoupling
     MEDCOUPLING_EXPORT void renumberNodes(const int *old2NewBg, double eps=1e-15);
     MEDCOUPLING_EXPORT void renumberNodesWithoutMesh(const int *old2NewBg, int newNbOfNodes, double eps=1e-15);
     MEDCOUPLING_EXPORT DataArrayInt *findIdsInRange(double vmin, double vmax) const;
-    MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildSubPart(const DataArrayInt *part) const;
-    MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildSubPart(const int *partBg, const int *partEnd) const;
-    MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const;
     MEDCOUPLING_EXPORT MEDCouplingFieldDouble *deepCopy() const;
     MEDCOUPLING_EXPORT MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
-    MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCopy) const;
+    MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const;
     MEDCOUPLING_EXPORT MEDCouplingFieldDouble *nodeToCellDiscretization() const;
     MEDCOUPLING_EXPORT MEDCouplingFieldDouble *cellToNodeDiscretization() const;
     MEDCOUPLING_EXPORT MEDCouplingFieldInt *convertToIntField() const;
@@ -99,14 +96,6 @@ namespace MEDCoupling
     MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
     MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
     //
-    MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
-    MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
-    MEDCOUPLING_EXPORT void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
-    MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<int>& tinyInfoI, DataArrayInt *&dataInt, std::vector<DataArrayDouble *>& arrays);
-    MEDCOUPLING_EXPORT void checkForUnserialization(const std::vector<int>& tinyInfoI, const DataArrayInt *dataInt, const std::vector<DataArrayDouble *>& arrays);
-    MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
-    MEDCOUPLING_EXPORT void serialize(DataArrayInt *&dataInt, std::vector<DataArrayDouble *>& arrays) const;
-    //
     MEDCOUPLING_EXPORT void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15);
     MEDCOUPLING_EXPORT void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15);
     MEDCOUPLING_EXPORT bool mergeNodes(double eps, double epsOnVals=1e-15);
@@ -167,7 +156,7 @@ namespace MEDCoupling
   private:
     MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td);
     MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td);
-    MEDCouplingFieldDouble(const MEDCouplingFieldDouble& other, bool deepCopy);
+    MEDCouplingFieldDouble(const MEDCouplingFieldDouble& other, bool deepCpy);
     MEDCouplingFieldDouble(NatureOfField n, MEDCouplingTimeDiscretization *td, MEDCouplingFieldDiscretization *type);
     MCAuto<MEDCouplingFieldDouble> voronoizeGen(const Voronizer *vor, double eps) const;
     MEDCouplingTimeDiscretization *timeDiscr();
diff --git a/src/MEDCoupling/MEDCouplingFieldFloat.cxx b/src/MEDCoupling/MEDCouplingFieldFloat.cxx
new file mode 100644 (file)
index 0000000..2e7c7dd
--- /dev/null
@@ -0,0 +1,83 @@
+// Copyright (C) 2007-2017  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony GEAY (EDF R&D)
+
+#include "MEDCouplingFieldFloat.hxx"
+#include "MEDCouplingFieldT.txx"
+#include "MEDCouplingFieldDouble.hxx"
+#include "MEDCouplingFieldTemplate.hxx"
+#include "MEDCouplingMesh.hxx"
+
+using namespace MEDCoupling;
+
+template class MEDCoupling::MEDCouplingFieldT<float>;
+
+MEDCouplingFieldFloat *MEDCouplingFieldFloat::New(TypeOfField type, TypeOfTimeDiscretization td)
+{
+  return new MEDCouplingFieldFloat(type,td);
+}
+
+MEDCouplingFieldFloat *MEDCouplingFieldFloat::New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td)
+{
+  return new MEDCouplingFieldFloat(ft,td);
+}
+
+MEDCouplingFieldFloat::MEDCouplingFieldFloat(TypeOfField type, TypeOfTimeDiscretization td):MEDCouplingFieldT<float>(type,MEDCouplingTimeDiscretizationFloat::New(td))
+{
+}
+
+MEDCouplingFieldFloat::MEDCouplingFieldFloat(const MEDCouplingFieldFloat& other, bool deepCpy):MEDCouplingFieldT<float>(other,deepCpy)
+{
+}
+
+MEDCouplingFieldFloat::MEDCouplingFieldFloat(NatureOfField n, MEDCouplingTimeDiscretizationFloat *td, MEDCouplingFieldDiscretization *type):MEDCouplingFieldT<float>(type,n,td)
+{
+}
+
+/*!
+ * ** WARINING : This method do not deeply copy neither mesh nor spatial discretization. Only a shallow copy (reference) is done for mesh and spatial discretization ! **
+ */
+MEDCouplingFieldFloat::MEDCouplingFieldFloat(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td):MEDCouplingFieldT<float>(ft,MEDCouplingTimeDiscretizationFloat::New(td),false)
+{
+}
+
+MEDCouplingFieldFloat *MEDCouplingFieldFloat::deepCopy() const
+{
+  return cloneWithMesh(true);
+}
+
+MEDCouplingFieldFloat *MEDCouplingFieldFloat::clone(bool recDeepCpy) const
+{
+  return new MEDCouplingFieldFloat(*this,recDeepCpy);
+}
+
+MEDCouplingFieldDouble *MEDCouplingFieldFloat::convertToDblField() const
+{
+  MCAuto<MEDCouplingFieldTemplate> tmp(MEDCouplingFieldTemplate::New(*this));
+  int t1,t2;
+  double t0(getTime(t1,t2));
+  MCAuto<MEDCouplingFieldDouble> ret(MEDCouplingFieldDouble::New(*tmp,getTimeDiscretization()));
+  ret->setTime(t0,t1,t2);
+  if(getArray())
+    {
+      MCAuto<DataArrayDouble> arr(getArray()->convertToDblArr());
+      ret->setArray(arr);
+    }
+  return ret.retn();
+}
diff --git a/src/MEDCoupling/MEDCouplingFieldFloat.hxx b/src/MEDCoupling/MEDCouplingFieldFloat.hxx
new file mode 100644 (file)
index 0000000..043bc02
--- /dev/null
@@ -0,0 +1,52 @@
+// Copyright (C) 2007-2017  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony GEAY (EDF R&D)
+
+#ifndef __MEDCOUPLINGFIELDFLOAT_HXX__
+#define __MEDCOUPLINGFIELDFLOAT_HXX__
+
+#include "MEDCoupling.hxx"
+#include "MEDCouplingFieldT.hxx"
+#include "MEDCouplingMemArray.hxx"
+
+#include <string>
+
+namespace MEDCoupling
+{
+  class MEDCouplingFieldDouble;
+  class MEDCouplingFieldTemplate;
+  
+  class MEDCouplingFieldFloat : public MEDCouplingFieldT<float>
+  {
+  public:
+    MEDCOUPLING_EXPORT static MEDCouplingFieldFloat *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
+    MEDCOUPLING_EXPORT static MEDCouplingFieldFloat *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
+    MEDCOUPLING_EXPORT MEDCouplingFieldFloat *deepCopy() const;
+    MEDCOUPLING_EXPORT MEDCouplingFieldFloat *clone(bool recDeepCpy) const;
+    MEDCOUPLING_EXPORT MEDCouplingFieldDouble *convertToDblField() const;
+  protected:
+    MEDCouplingFieldFloat(TypeOfField type, TypeOfTimeDiscretization td);
+    MEDCouplingFieldFloat(const MEDCouplingFieldFloat& other, bool deepCpy);
+    MEDCouplingFieldFloat(NatureOfField n, MEDCouplingTimeDiscretizationFloat *td, MEDCouplingFieldDiscretization *type);
+    MEDCouplingFieldFloat(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td);
+    ~MEDCouplingFieldFloat() { }
+  };
+}
+
+#endif
index 51811f687a9f11f8f6dd99d2a59ab513e94ad754..f2b4bd089f8072c978f067ff8d4724e50db9f0ca 100644 (file)
@@ -42,7 +42,7 @@ MEDCouplingFieldInt::MEDCouplingFieldInt(TypeOfField type, TypeOfTimeDiscretizat
 {
 }
 
-MEDCouplingFieldInt::MEDCouplingFieldInt(const MEDCouplingFieldInt& other, bool deepCopy):MEDCouplingFieldT<int>(other,deepCopy)
+MEDCouplingFieldInt::MEDCouplingFieldInt(const MEDCouplingFieldInt& other, bool deepCpy):MEDCouplingFieldT<int>(other,deepCpy)
 {
 }
 
index 66f7843e964325c68e381d8f3be9fef3171aad56..6abd6f8fb2fe7fd1bb8b15a5b5c45a5c19396dad 100644 (file)
@@ -46,6 +46,9 @@ namespace MEDCoupling
     MEDCOUPLING_EXPORT virtual typename Traits<T>::FieldType *clone(bool recDeepCpy) const = 0;
     MEDCOUPLING_EXPORT void checkConsistencyLight() const;
     MEDCOUPLING_EXPORT typename Traits<T>::FieldType *cloneWithMesh(bool recDeepCpy) const;
+    MEDCOUPLING_EXPORT typename Traits<T>::FieldType *buildSubPart(const DataArrayInt *part) const;
+    MEDCOUPLING_EXPORT typename Traits<T>::FieldType *buildSubPart(const int *partBg, const int *partEnd) const;
+    MEDCOUPLING_EXPORT typename Traits<T>::FieldType *buildSubPartRange(int begin, int end, int step) const;
     MEDCOUPLING_EXPORT void setArray(typename Traits<T>::ArrayType *array) { _time_discr->setArray(array,this); }
     MEDCOUPLING_EXPORT void setEndArray(typename Traits<T>::ArrayType *array) { _time_discr->setEndArray(array,this); }
     MEDCOUPLING_EXPORT const typename Traits<T>::ArrayType *getArray() const { return _time_discr->getArray(); }
@@ -84,6 +87,17 @@ namespace MEDCoupling
     MEDCOUPLING_EXPORT bool areCompatibleForDiv(const MEDCouplingField *other) const;
     MEDCOUPLING_EXPORT void copyTinyAttrFrom(const MEDCouplingFieldT<T> *other);
     MEDCOUPLING_EXPORT void copyAllTinyAttrFrom(const MEDCouplingFieldT<T> *other);
+    //
+    MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
+    MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
+    MEDCOUPLING_EXPORT void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
+    MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<int>& tinyInfoI, DataArrayInt *&dataInt, std::vector<typename Traits<T>::ArrayType *>& arrays);
+    MEDCOUPLING_EXPORT void checkForUnserialization(const std::vector<int>& tinyInfoI, const DataArrayInt *dataInt, const std::vector<typename Traits<T>::ArrayType *>& arrays);
+    MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
+    MEDCOUPLING_EXPORT void serialize(DataArrayInt *&dataInt, std::vector<typename Traits<T>::ArrayType *>& arrays) const;
+    MEDCOUPLING_EXPORT const MEDCouplingTimeDiscretizationTemplate<T> *timeDiscrSafe() const;
+  protected:
+    MEDCouplingTimeDiscretizationTemplate<T> *timeDiscrSafe();
   protected:
     MEDCouplingTimeDiscretizationTemplate<T> *_time_discr;
   };
index 6df99f351cf3b0b18df5ad9747fa36efbd49ff13..61e2aa1bf8ffd1fecb0775650d7eb00cafb4dca2 100644 (file)
@@ -367,6 +367,296 @@ namespace MEDCoupling
   {
     return _time_discr->getEnum();
   }
+
+  /*!
+   * Builds a newly created field, that the caller will have the responsability to deal with.
+   * \n This method makes the assumption that \a this field is correctly defined when this method is called (\a this->checkConsistencyLight() returns without any exception thrown), **no check of this will be done**.
+   * \n This method returns a restriction of \a this so that only tuple ids specified in [ \a partBg , \a partEnd ) will be contained in the returned field.
+   * \n Parameter [\a partBg, \a partEnd ) specifies **cell ids whatever the spatial discretization** of \a this (
+   * \ref MEDCoupling::ON_CELLS "ON_CELLS", 
+   * \ref MEDCoupling::ON_NODES "ON_NODES",
+   * \ref MEDCoupling::ON_GAUSS_PT "ON_GAUSS_PT", 
+   * \ref MEDCoupling::ON_GAUSS_NE "ON_GAUSS_NE",
+   * \ref MEDCoupling::ON_NODES_KR "ON_NODES_KR").
+   *
+   * For example, \a this is a field on cells lying on a mesh that have 10 cells, \a partBg contains the following cell ids [3,7,6].
+   * Then the returned field will lie on mesh having 3 cells and will contain 3 tuples.
+   *- Tuple #0 of the result field will refer to the cell #0 of returned mesh. The cell #0 of returned mesh will be equal to the cell #3 of \a this->getMesh().
+   *- Tuple #1 of the result field will refer to the cell #1 of returned mesh. The cell #1 of returned mesh will be equal to the cell #7 of \a this->getMesh().
+   *- Tuple #2 of the result field will refer to the cell #2 of returned mesh. The cell #2 of returned mesh will be equal to the cell #6 of \a this->getMesh().
+   *
+   * Let, for example, \a this be a field on nodes lying on a mesh that have 10 cells and 11 nodes, and \a partBg contains following cellIds [3,7,6].
+   * Thus \a this currently contains 11 tuples. If the restriction of mesh to 3 cells leads to a mesh with 6 nodes, then the returned field
+   * will contain 6 tuples and \a this field will lie on this restricted mesh. 
+   *
+   * \param [in] partBg - start (included) of input range of cell ids to select [ \a partBg, \a partEnd )
+   * \param [in] partEnd - end (not included) of input range of cell ids to select [ \a partBg, \a partEnd )
+   * \return a newly allocated field the caller should deal with.
+   * 
+   * \throw if there is presence of an invalid cell id in [ \a partBg, \a partEnd ) regarding the number of cells of \a this->getMesh().
+   *
+   * \if ENABLE_EXAMPLES
+   * \ref cpp_mcfielddouble_subpart1 "Here a C++ example."<br>
+   * \ref py_mcfielddouble_subpart1 "Here a Python example."
+   * \endif
+   * \sa MEDCoupling::MEDCouplingFieldDouble::buildSubPart(const DataArrayInt *) const, MEDCouplingFieldDouble::buildSubPartRange
+   */
+  template<class T>
+  typename Traits<T>::FieldType *MEDCouplingFieldT<T>::buildSubPart(const int *partBg, const int *partEnd) const
+  {
+    if(_type.isNull())
+      throw INTERP_KERNEL::Exception("MEDCouplingFieldT::buildSubPart : Expecting a not NULL spatial discretization !");
+    DataArrayInt *arrSelect;
+    MCAuto<MEDCouplingMesh> m=_type->buildSubMeshData(_mesh,partBg,partEnd,arrSelect);
+    MCAuto<DataArrayInt> arrSelect2(arrSelect);
+    MCAuto< typename Traits<T>::FieldType > ret(clone(false));//quick shallow copy.
+    const MEDCouplingFieldDiscretization *disc=getDiscretization();
+    if(disc)
+      ret->setDiscretization(MCAuto<MEDCouplingFieldDiscretization>(disc->clonePart(partBg,partEnd)));
+    ret->setMesh(m);
+    std::vector<typename Traits<T>::ArrayType *> arrays;
+    timeDiscrSafe()->getArrays(arrays);
+    std::vector<typename Traits<T>::ArrayType *> arrs;
+    std::vector< MCAuto< typename Traits<T>::ArrayType > > arrsSafe;
+    const int *arrSelBg=arrSelect->begin();
+    const int *arrSelEnd=arrSelect->end();
+    for(typename std::vector<typename Traits<T>::ArrayType *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
+      {
+        typename Traits<T>::ArrayType *arr(0);
+        if(*iter)
+          arr=(*iter)->selectByTupleIdSafe(arrSelBg,arrSelEnd);
+        arrs.push_back(arr); arrsSafe.push_back(arr);
+      }
+    ret->timeDiscrSafe()->setArrays(arrs,0);
+    return ret.retn();
+  }
+
+  /*!
+   * Builds a newly created field, that the caller will have the responsability to deal with (decrRef()).
+   * This method makes the assumption that the field is correctly defined when this method is called, no check of this will be done.
+   * This method returns a restriction of \a this so that only tuples with ids specified in \a part will be contained in the returned field.
+   * Parameter \a part specifies **cell ids whatever the spatial discretization of this** (
+   * \ref MEDCoupling::ON_CELLS "ON_CELLS", 
+   * \ref MEDCoupling::ON_NODES "ON_NODES",
+   * \ref MEDCoupling::ON_GAUSS_PT "ON_GAUSS_PT", 
+   * \ref MEDCoupling::ON_GAUSS_NE "ON_GAUSS_NE",
+   * \ref MEDCoupling::ON_NODES_KR "ON_NODES_KR").
+   *
+   * For example, \a this is a field on cells lying on a mesh that have 10 cells, \a part contains following cell ids [3,7,6].
+   * Then the returned field will lie on mesh having 3 cells and the returned field will contain 3 tuples.<br>
+   * Tuple #0 of the result field will refer to the cell #0 of returned mesh. The cell #0 of returned mesh will be equal to the cell #3 of \a this->getMesh().<br>
+   * Tuple #1 of the result field will refer to the cell #1 of returned mesh. The cell #1 of returned mesh will be equal to the cell #7 of \a this->getMesh().<br>
+   * Tuple #2 of the result field will refer to the cell #2 of returned mesh. The cell #2 of returned mesh will be equal to the cell #6 of \a this->getMesh().
+   *
+   * Let, for example, \a this be a field on nodes lying on a mesh that have 10 cells and 11 nodes, and \a part contains following cellIds [3,7,6].
+   * Thus \a this currently contains 11 tuples. If the restriction of mesh to 3 cells leads to a mesh with 6 nodes, then the returned field
+   * will contain 6 tuples and \a this field will lie on this restricted mesh. 
+   *
+   *  \param [in] part - an array of cell ids to include to the result field.
+   *  \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The caller is to delete this field using decrRef() as it is no more needed.
+   *
+   *  \if ENABLE_EXAMPLES
+   *  \ref cpp_mcfielddouble_subpart1 "Here is a C++ example".<br>
+   *  \ref  py_mcfielddouble_subpart1 "Here is a Python example".
+   *  \endif
+   *  \sa MEDCouplingFieldDouble::buildSubPartRange
+   */
+  template<class T>
+  typename Traits<T>::FieldType *MEDCouplingFieldT<T>::buildSubPart(const DataArrayInt *part) const
+  {
+    if(part==0)
+      throw INTERP_KERNEL::Exception("MEDCouplingFieldT::buildSubPart : not empty array must be passed to this method !");
+    return buildSubPart(part->begin(),part->end());
+  }
+  
+  /*!
+   * This method is equivalent to MEDCouplingFieldDouble::buildSubPart, the only difference is that the input range of cell ids is
+   * given using a range given \a begin, \a end and \a step to optimize the part computation.
+   * 
+   * \sa MEDCouplingFieldDouble::buildSubPart
+   */
+  template<class T>
+  typename Traits<T>::FieldType *MEDCouplingFieldT<T>::buildSubPartRange(int begin, int end, int step) const
+  {
+    if(_type.isNull())
+      throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : Expecting a not NULL spatial discretization !");
+    DataArrayInt *arrSelect;
+    int beginOut,endOut,stepOut;
+    MCAuto<MEDCouplingMesh> m(_type->buildSubMeshDataRange(_mesh,begin,end,step,beginOut,endOut,stepOut,arrSelect));
+    MCAuto<DataArrayInt> arrSelect2(arrSelect);
+    MCAuto< typename Traits<T>::FieldType > ret(clone(false));//quick shallow copy.
+    const MEDCouplingFieldDiscretization *disc=getDiscretization();
+    if(disc)
+      ret->setDiscretization(MCAuto<MEDCouplingFieldDiscretization>(disc->clonePartRange(begin,end,step)));
+    ret->setMesh(m);
+    std::vector<typename Traits<T>::ArrayType *> arrays;
+    timeDiscrSafe()->getArrays(arrays);
+    std::vector<typename Traits<T>::ArrayType *> arrs;
+    std::vector< MCAuto< typename Traits<T>::ArrayType > > arrsSafe;
+    for(typename std::vector<typename Traits<T>::ArrayType *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
+      {
+        typename Traits<T>::ArrayType *arr(0);
+        if(*iter)
+          {
+            if(arrSelect)
+              {
+                const int *arrSelBg=arrSelect->begin();
+                const int *arrSelEnd=arrSelect->end();
+                arr=(*iter)->selectByTupleIdSafe(arrSelBg,arrSelEnd);
+              }
+            else
+              arr=(*iter)->selectByTupleIdSafeSlice(beginOut,endOut,stepOut);
+          }
+        arrs.push_back(arr); arrsSafe.push_back(arr);
+      }
+    ret->timeDiscrSafe()->setArrays(arrs,0);
+    return ret.retn();
+  }
+  
+  template<class T>
+  const MEDCouplingTimeDiscretizationTemplate<T> *MEDCouplingFieldT<T>::timeDiscrSafe() const
+  {
+    const MEDCouplingTimeDiscretizationTemplate<T> *ret(_time_discr);
+    if(!ret)
+      throw INTERP_KERNEL::Exception("const FieldT : Null type of time discr !");
+    return ret;
+  }
+  
+  template<class T>
+  MEDCouplingTimeDiscretizationTemplate<T> *MEDCouplingFieldT<T>::timeDiscrSafe()
+  {
+    MEDCouplingTimeDiscretizationTemplate<T> *ret(_time_discr);
+    if(!ret)
+      throw INTERP_KERNEL::Exception("const FieldT : Null type of time discr !");
+    return ret;
+  }
+
+  template<class T>
+  void MEDCouplingFieldT<T>::getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const
+  {
+    tinyInfo.clear();
+    timeDiscrSafe()->getTinySerializationStrInformation(tinyInfo);
+    tinyInfo.push_back(_name);
+    tinyInfo.push_back(_desc);
+    tinyInfo.push_back(getTimeUnit());
+  }
+
+  /*!
+   * This method retrieves some critical values to resize and prepare remote instance.
+   * The first two elements returned in tinyInfo correspond to the parameters to give in constructor.
+   * @param tinyInfo out parameter resized correctly after the call. The length of this vector is tiny.
+   */
+  template<class T>
+  void MEDCouplingFieldT<T>::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
+  {
+    if(_type.isNull())
+      throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform getTinySerializationIntInformation !");
+    tinyInfo.clear();
+    tinyInfo.push_back((int)_type->getEnum());
+    tinyInfo.push_back((int)timeDiscrSafe()->getEnum());
+    tinyInfo.push_back((int)_nature);
+    timeDiscrSafe()->getTinySerializationIntInformation(tinyInfo);
+    std::vector<int> tinyInfo2;
+    _type->getTinySerializationIntInformation(tinyInfo2);
+    tinyInfo.insert(tinyInfo.end(),tinyInfo2.begin(),tinyInfo2.end());
+    tinyInfo.push_back((int)tinyInfo2.size());
+  }
+
+  /*!
+   * This method retrieves some critical values to resize and prepare remote instance.
+   * @param tinyInfo out parameter resized correctly after the call. The length of this vector is tiny.
+   */
+  template<class T>
+  void MEDCouplingFieldT<T>::getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const
+  {
+    if(_type.isNull())
+      throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform getTinySerializationDbleInformation !");
+    tinyInfo.clear();
+    timeDiscrSafe()->getTinySerializationDbleInformation(tinyInfo);
+    std::vector<double> tinyInfo2;
+    _type->getTinySerializationDbleInformation(tinyInfo2);
+    tinyInfo.insert(tinyInfo.end(),tinyInfo2.begin(),tinyInfo2.end());
+    tinyInfo.push_back((int)tinyInfo2.size());//very bad, lack of time to improve it
+  }
+
+  /*!
+   * This method has to be called to the new instance filled by CORBA, MPI, File...
+   * @param tinyInfoI is the value retrieves from distant result of getTinySerializationIntInformation on source instance to be copied.
+   * @param dataInt out parameter. If not null the pointer is already owned by \a this after the call of this method. In this case no decrRef must be applied.
+   * @param arrays out parameter is a vector resized to the right size. The pointers in the vector is already owned by \a this after the call of this method.
+   *               No decrRef must be applied to every instances in returned vector.
+   * \sa checkForUnserialization
+   */
+  template<class T>
+  void MEDCouplingFieldT<T>::resizeForUnserialization(const std::vector<int>& tinyInfoI, DataArrayInt *&dataInt, std::vector<typename Traits<T>::ArrayType *>& arrays)
+  {
+    if(_type.isNull())
+      throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform resizeForUnserialization !");
+    dataInt=0;
+    std::vector<int> tinyInfoITmp(tinyInfoI);
+    int sz=tinyInfoITmp.back();
+    tinyInfoITmp.pop_back();
+    std::vector<int> tinyInfoITmp2(tinyInfoITmp.begin(),tinyInfoITmp.end()-sz);
+    std::vector<int> tinyInfoI2(tinyInfoITmp2.begin()+3,tinyInfoITmp2.end());
+    timeDiscrSafe()->resizeForUnserialization(tinyInfoI2,arrays);
+    std::vector<int> tinyInfoITmp3(tinyInfoITmp.end()-sz,tinyInfoITmp.end());
+    _type->resizeForUnserialization(tinyInfoITmp3,dataInt);
+  }
+
+  /*!
+   * This method is extremely close to resizeForUnserialization except that here the arrays in \a dataInt and in \a arrays are attached in \a this
+   * after having checked that size is correct. This method is used in python pickeling context to avoid copy of data.
+   * \sa resizeForUnserialization
+   */
+  template<class T>
+  void MEDCouplingFieldT<T>::checkForUnserialization(const std::vector<int>& tinyInfoI, const DataArrayInt *dataInt, const std::vector<typename Traits<T>::ArrayType *>& arrays)
+  {
+    if(_type.isNull())
+      throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform resizeForUnserialization !");
+    std::vector<int> tinyInfoITmp(tinyInfoI);
+    int sz=tinyInfoITmp.back();
+    tinyInfoITmp.pop_back();
+    std::vector<int> tinyInfoITmp2(tinyInfoITmp.begin(),tinyInfoITmp.end()-sz);
+    std::vector<int> tinyInfoI2(tinyInfoITmp2.begin()+3,tinyInfoITmp2.end());
+    timeDiscrSafe()->checkForUnserialization(tinyInfoI2,arrays);
+    std::vector<int> tinyInfoITmp3(tinyInfoITmp.end()-sz,tinyInfoITmp.end());
+    _type->checkForUnserialization(tinyInfoITmp3,dataInt);
+  }
+
+  template<class T>
+  void MEDCouplingFieldT<T>::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
+  {
+    if(_type.isNull())
+      throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform finishUnserialization !");
+    std::vector<int> tinyInfoI2(tinyInfoI.begin()+3,tinyInfoI.end());
+    //
+    std::vector<double> tmp(tinyInfoD);
+    int sz=(int)tinyInfoD.back();//very bad, lack of time to improve it
+    tmp.pop_back();
+    std::vector<double> tmp1(tmp.begin(),tmp.end()-sz);
+    std::vector<double> tmp2(tmp.end()-sz,tmp.end());
+    //
+    timeDiscrSafe()->finishUnserialization(tinyInfoI2,tmp1,tinyInfoS);
+    _nature=(NatureOfField)tinyInfoI[2];
+    _type->finishUnserialization(tmp2);
+    int nbOfElemS=(int)tinyInfoS.size();
+    _name=tinyInfoS[nbOfElemS-3];
+    _desc=tinyInfoS[nbOfElemS-2];
+    setTimeUnit(tinyInfoS[nbOfElemS-1]);
+  }
+
+  /*!
+   * Contrary to MEDCouplingPointSet class the returned arrays are \b not the responsabilities of the caller.
+   * The values returned must be consulted only in readonly mode.
+   */
+  template<class T>
+  void MEDCouplingFieldT<T>::serialize(DataArrayInt *&dataInt, std::vector<typename Traits<T>::ArrayType *>& arrays) const
+  {
+    if(_type.isNull())
+      throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform serialize !");
+    timeDiscrSafe()->getArrays(arrays);
+    _type->getSerializationIntArray(dataInt);
+  }
 }
 
 #endif
index 4f2893ab5d7945ffae5d83ca239b5fd41020e3a4..2e432b88a3b87fae9afdb40f8db90c8b0a6ea12e 100644 (file)
@@ -21,6 +21,7 @@
 #include "MEDCouplingFieldTemplate.hxx"
 #include "MEDCouplingMesh.hxx"
 #include "MEDCouplingFieldInt.hxx"
+#include "MEDCouplingFieldFloat.hxx"
 #include "MEDCouplingFieldDouble.hxx"
 #include "MEDCouplingFieldDiscretization.hxx"
 
@@ -30,12 +31,32 @@ using namespace MEDCoupling;
 
 MEDCouplingFieldTemplate *MEDCouplingFieldTemplate::New(const MEDCouplingFieldDouble& f)
 {
-  return new MEDCouplingFieldTemplate(f);
+  return new MEDCouplingFieldTemplate(f,true);
+}
+
+MEDCouplingFieldTemplate *MEDCouplingFieldTemplate::New(const MEDCouplingFieldFloat& f)
+{
+  return new MEDCouplingFieldTemplate(f,true);
 }
 
 MEDCouplingFieldTemplate *MEDCouplingFieldTemplate::New(const MEDCouplingFieldInt& f)
 {
-  return new MEDCouplingFieldTemplate(f);
+  return new MEDCouplingFieldTemplate(f,true);
+}
+
+MEDCouplingFieldTemplate *MEDCouplingFieldTemplate::NewWithoutCheck(const MEDCouplingFieldDouble& f)
+{
+  return new MEDCouplingFieldTemplate(f,false);
+}
+
+MEDCouplingFieldTemplate *MEDCouplingFieldTemplate::NewWithoutCheck(const MEDCouplingFieldFloat& f)
+{
+  return new MEDCouplingFieldTemplate(f,false);
+}
+
+MEDCouplingFieldTemplate *MEDCouplingFieldTemplate::NewWithoutCheck(const MEDCouplingFieldInt& f)
+{
+  return new MEDCouplingFieldTemplate(f,false);
 }
 
 /*!
@@ -46,22 +67,35 @@ MEDCouplingFieldTemplate *MEDCouplingFieldTemplate::New(TypeOfField type)
   return new MEDCouplingFieldTemplate(type);
 }
 
-MEDCouplingFieldTemplate::MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f):MEDCouplingField(f,false) 
+MEDCouplingFieldTemplate::MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f, bool isChecked):MEDCouplingField(f,false) 
+{
+  forceTimeOfThis(f);
+  if(isChecked)
+    checkConsistencyLight();
+}
+
+MEDCouplingFieldTemplate::MEDCouplingFieldTemplate(const MEDCouplingFieldFloat& f, bool isChecked):MEDCouplingField(f,false) 
 {
   forceTimeOfThis(f);
-  checkConsistencyLight();
+  if(isChecked)
+    checkConsistencyLight();
 }
 
-MEDCouplingFieldTemplate::MEDCouplingFieldTemplate(const MEDCouplingFieldInt& f):MEDCouplingField(f,false) 
+MEDCouplingFieldTemplate::MEDCouplingFieldTemplate(const MEDCouplingFieldInt& f, bool isChecked):MEDCouplingField(f,false) 
 {
   forceTimeOfThis(f);
-  checkConsistencyLight();
+  if(isChecked)
+    checkConsistencyLight();
 }
 
 MEDCouplingFieldTemplate::MEDCouplingFieldTemplate(TypeOfField type):MEDCouplingField(type)
 {
 }
 
+MEDCouplingFieldTemplate::MEDCouplingFieldTemplate(const MEDCouplingFieldTemplate& other, bool deepCopy):MEDCouplingField(other,deepCopy)
+{
+}
+
 void MEDCouplingFieldTemplate::checkConsistencyLight() const
 {
   if(_mesh==0)
@@ -169,3 +203,9 @@ void MEDCouplingFieldTemplate::reprQuickOverview(std::ostream& stream) const
       stream << "\nMesh info : " << tmp.substr(0,tmp.find('\n'));
     }
 }
+
+MCAuto<MEDCouplingFieldTemplate> MEDCouplingFieldTemplate::clone(bool recDeepCpy) const
+{
+  MCAuto<MEDCouplingFieldTemplate> ret(new MEDCouplingFieldTemplate(*this,recDeepCpy));
+  return ret;
+}
index a00ba79ff2406b484c6dec0df29db11e921e5c03..a12842f510a0d1f2df5b200c2e356d83788f75c2 100644 (file)
@@ -16,7 +16,7 @@
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-// Author : Anthony Geay (CEA/DEN)
+// Author : Anthony Geay (EDF R&D)
 
 #ifndef __PARAMEDMEM_MEDCOUPLINGFIELDTEMPLATE_HXX__
 #define __PARAMEDMEM_MEDCOUPLINGFIELDTEMPLATE_HXX__
@@ -26,6 +26,7 @@
 namespace MEDCoupling
 {
   class MEDCouplingFieldInt;
+  class MEDCouplingFieldFloat;
   class MEDCouplingFieldDouble;
   /*!
    * \brief A field template can be seen as a field without the array of values.
@@ -41,11 +42,16 @@ namespace MEDCoupling
   {
   public:
     MEDCOUPLING_EXPORT static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f);
+    MEDCOUPLING_EXPORT static MEDCouplingFieldTemplate *New(const MEDCouplingFieldFloat& f);
     MEDCOUPLING_EXPORT static MEDCouplingFieldTemplate *New(const MEDCouplingFieldInt& f);
     MEDCOUPLING_EXPORT static MEDCouplingFieldTemplate *New(TypeOfField type);
+    MEDCOUPLING_EXPORT static MEDCouplingFieldTemplate *NewWithoutCheck(const MEDCouplingFieldDouble& f);
+    MEDCOUPLING_EXPORT static MEDCouplingFieldTemplate *NewWithoutCheck(const MEDCouplingFieldFloat& f);
+    MEDCOUPLING_EXPORT static MEDCouplingFieldTemplate *NewWithoutCheck(const MEDCouplingFieldInt& f);
     MEDCOUPLING_EXPORT std::string simpleRepr() const;
     MEDCOUPLING_EXPORT std::string advancedRepr() const;
     MEDCOUPLING_EXPORT void checkConsistencyLight() const;
+    MEDCOUPLING_EXPORT MCAuto<MEDCouplingFieldTemplate> clone(bool recDeepCpy) const;
     //
     MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
     MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
@@ -56,9 +62,11 @@ namespace MEDCoupling
     //
     MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
   private:
-    MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f);
-    MEDCouplingFieldTemplate(const MEDCouplingFieldInt& f);
+    MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f, bool isChecked=true);
+    MEDCouplingFieldTemplate(const MEDCouplingFieldFloat& f, bool isChecked=true);
+    MEDCouplingFieldTemplate(const MEDCouplingFieldInt& f, bool isChecked=true);
     MEDCouplingFieldTemplate(TypeOfField type);
+    MEDCouplingFieldTemplate(const MEDCouplingFieldTemplate& other, bool deepCopy);
   };
 }
 
index 6c69fa0c6b87d0d2d4009b54ceb6fad5aabe263d..e5a5a413c001768ce071bbc6d8253b671f8561c1 100644 (file)
@@ -222,7 +222,7 @@ MCAuto<DataArrayDouble> MEDCouplingGaussLocalization::localizePtsInRefCooForEach
   MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
   ret->alloc(nbPts*nbCells,outDim);
   double *retPtr(ret->getPointer());
-  if(dim!=ptsInRefCoo->getNumberOfComponents())
+  if(dim!=(int)ptsInRefCoo->getNumberOfComponents())
     throw INTERP_KERNEL::Exception("MEDCouplingGaussLocalization::localizePtsInRefCooForEachCell : number of components of input coo is not equal to dim of element !");
   const std::vector<double>& wg(getWeights());
   INTERP_KERNEL::GaussCoords calculator;
@@ -240,7 +240,7 @@ MCAuto<MEDCouplingUMesh> MEDCouplingGaussLocalization::buildRefCell() const
 {
   MCAuto<DataArrayDouble> coo(DataArrayDouble::New());
   const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(getType()));
-  if(getDimension()!=cm.getDimension())
+  if(getDimension()!=(int)cm.getDimension())
     throw INTERP_KERNEL::Exception("BuildRefCell : dimension mistmatch !");
   coo->alloc(cm.getNumberOfNodes(),getDimension());
   std::copy(_ref_coord.begin(),_ref_coord.end(),coo->getPointer());
index 329c545842892ff659fd29508d5055ea01738a83..b61fac40c941873d4846d3c6c24fa03f6d1c0259 100644 (file)
@@ -16,7 +16,7 @@
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-// Author : Anthony Geay (CEA/DEN)
+// Author : Anthony Geay (EDF R&D)
 
 #include "MEDCouplingIMesh.hxx"
 #include "MEDCouplingCMesh.hxx"
@@ -37,7 +37,7 @@ MEDCouplingIMesh::MEDCouplingIMesh():_space_dim(-1)
   _structure[0]=0; _structure[1]=0; _structure[2]=0;
 }
 
-MEDCouplingIMesh::MEDCouplingIMesh(const MEDCouplingIMesh& other, bool deepCopy):MEDCouplingStructuredMesh(other,deepCopy),_space_dim(other._space_dim),_axis_unit(other._axis_unit)
+MEDCouplingIMesh::MEDCouplingIMesh(const MEDCouplingIMesh& other, bool deepCpy):MEDCouplingStructuredMesh(other,deepCpy),_space_dim(other._space_dim),_axis_unit(other._axis_unit)
 {
   _origin[0]=other._origin[0]; _origin[1]=other._origin[1]; _origin[2]=other._origin[2];
   _dxyz[0]=other._dxyz[0]; _dxyz[1]=other._dxyz[1]; _dxyz[2]=other._dxyz[2];
@@ -289,7 +289,7 @@ void MEDCouplingIMesh::CondenseFineToCoarse(const std::vector<int>& coarseSt, co
     throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : the parameters 1 or 3 are NULL or not allocated !");
   int meshDim((int)coarseSt.size()),nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseSt)),nbOfTuplesInFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(fineLocInCoarse));
   int nbCompo(fineDA->getNumberOfComponents());
-  if(coarseDA->getNumberOfComponents()!=nbCompo)
+  if((int)coarseDA->getNumberOfComponents()!=nbCompo)
     throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : the number of components of fine DA and coarse one mismatches !");
   if(meshDim!=(int)fineLocInCoarse.size() || meshDim!=(int)facts.size())
     throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : the size of fineLocInCoarse (4th param) and facts (5th param) must be equal to the sier of coarseSt (2nd param) !");
@@ -419,7 +419,7 @@ void MEDCouplingIMesh::CondenseFineToCoarseGhost(const std::vector<int>& coarseS
   std::vector<int> coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind2nd(std::plus<int>(),2*ghostSize));
   int meshDim((int)coarseSt.size()),nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG));
   int nbCompo(fineDA->getNumberOfComponents());
-  if(coarseDA->getNumberOfComponents()!=nbCompo)
+  if((int)coarseDA->getNumberOfComponents()!=nbCompo)
     throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarseGhost : the number of components of fine DA and coarse one mismatches !");
   if(meshDim!=(int)fineLocInCoarse.size() || meshDim!=(int)facts.size())
     throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarseGhost : the size of fineLocInCoarse (4th param) and facts (5th param) must be equal to the sier of coarseSt (2nd param) !");
@@ -548,7 +548,7 @@ void MEDCouplingIMesh::SpreadCoarseToFine(const DataArrayDouble *coarseDA, const
     throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : the parameters 1 or 3 are NULL or not allocated !");
   int meshDim((int)coarseSt.size()),nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseSt)),nbOfTuplesInFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(fineLocInCoarse));
   int nbCompo(fineDA->getNumberOfComponents());
-  if(coarseDA->getNumberOfComponents()!=nbCompo)
+  if((int)coarseDA->getNumberOfComponents()!=nbCompo)
     throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : the number of components of fine DA and coarse one mismatches !");
   if(meshDim!=(int)fineLocInCoarse.size() || meshDim!=(int)facts.size())
     throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : the size of fineLocInCoarse (4th param) and facts (5th param) must be equal to the sier of coarseSt (2nd param) !");
@@ -654,7 +654,7 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA,
   std::vector<int> coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind2nd(std::plus<int>(),2*ghostSize));
   int meshDim((int)coarseSt.size()),nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG));
   int nbCompo(fineDA->getNumberOfComponents());
-  if(coarseDA->getNumberOfComponents()!=nbCompo)
+  if((int)coarseDA->getNumberOfComponents()!=nbCompo)
     throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhost : the number of components of fine DA and coarse one mismatches !");
   if(meshDim!=(int)fineLocInCoarse.size() || meshDim!=(int)facts.size())
     throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhost : the size of fineLocInCoarse (4th param) and facts (5th param) must be equal to the sier of coarseSt (2nd param) !");
@@ -746,7 +746,7 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhostZone(const DataArrayDouble *coarse
   std::vector<int> coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind2nd(std::plus<int>(),2*ghostSize));
   int meshDim((int)coarseSt.size()),nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG));
   int nbCompo(fineDA->getNumberOfComponents());
-  if(coarseDA->getNumberOfComponents()!=nbCompo)
+  if((int)coarseDA->getNumberOfComponents()!=nbCompo)
     throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhostZone : the number of components of fine DA and coarse one mismatches !");
   if(meshDim!=(int)fineLocInCoarse.size() || meshDim!=(int)facts.size())
     throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhostZone : the size of fineLocInCoarse (4th param) and facts (5th param) must be equal to the sier of coarseSt (2nd param) !");
diff --git a/src/MEDCoupling/MEDCouplingMap.cxx b/src/MEDCoupling/MEDCouplingMap.cxx
new file mode 100644 (file)
index 0000000..47c10f1
--- /dev/null
@@ -0,0 +1,25 @@
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay (EDF R&D)
+
+#include "MEDCouplingMap.txx"
+
+using namespace MEDCoupling;
+
+template class MEDCoupling::MapKeyVal<int>;
diff --git a/src/MEDCoupling/MEDCouplingMap.hxx b/src/MEDCoupling/MEDCouplingMap.hxx
new file mode 100644 (file)
index 0000000..b63bd5c
--- /dev/null
@@ -0,0 +1,54 @@
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay (EDF R&D)
+
+#ifndef __MEDCOUPLING_MEDCOUPLINGMAP_HXX__
+#define __MEDCOUPLING_MEDCOUPLINGMAP_HXX__
+
+#include "MEDCoupling.hxx"
+#include "MCAuto.hxx"
+#include "MEDCouplingTimeLabel.hxx"
+#include "MEDCouplingRefCountObject.hxx"
+#include "InterpKernelException.hxx"
+
+#include <map>
+
+namespace MEDCoupling
+{  
+  template<class T>
+  class MapKeyVal : public RefCountObject, public TimeLabel
+  {
+  public:
+    static MCAuto< MapKeyVal<T> > New();
+    std::map<T,T>& data() { return _m; }
+    const std::map<T,T>& data() const { return _m; }
+    std::size_t getHeapMemorySizeWithoutChildren() const;
+    std::vector<const BigMemoryObject*> getDirectChildrenWithNull() const;
+    void updateTime() const { }
+  private:
+    MapKeyVal() { }
+    ~MapKeyVal() { }
+  private:
+    std::map<T,T> _m;
+  };
+
+  typedef MapKeyVal<int> MapII;
+}
+
+#endif
diff --git a/src/MEDCoupling/MEDCouplingMap.txx b/src/MEDCoupling/MEDCouplingMap.txx
new file mode 100644 (file)
index 0000000..1a43583
--- /dev/null
@@ -0,0 +1,48 @@
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay (EDF R&D)
+
+#ifndef __MEDCOUPLING_MEDCOUPLINGMAP_TXX__
+#define __MEDCOUPLING_MEDCOUPLINGMAP_TXX__
+
+#include "MEDCouplingMap.hxx"
+
+namespace MEDCoupling
+{
+  template<class T>
+  MCAuto< MapKeyVal<T> > MapKeyVal<T>::New()
+  {
+    MCAuto< MapKeyVal<T> > ret(new MapKeyVal<T>);
+    return ret;
+  }
+  
+  template<class T>
+  std::size_t MapKeyVal<T>::getHeapMemorySizeWithoutChildren() const
+  {
+    return _m.size()*sizeof(std::pair<T,T>);
+  }
+  
+  template<class T>
+  std::vector<const BigMemoryObject*> MapKeyVal<T>::getDirectChildrenWithNull() const
+  {
+    return std::vector<const BigMemoryObject*>();//not a bug no child. Leaf object !
+  }
+}
+
+#endif
index 9456bffcd7730493a9a19bbc37d151243f106e32..021b5add4feb842f36dcd884e53a3d269cae844a 100644 (file)
@@ -130,9 +130,9 @@ MEDCouplingMappedExtrudedMesh::MEDCouplingMappedExtrudedMesh():_mesh2D(0),_mesh1
 {
 }
 
-MEDCouplingMappedExtrudedMesh::MEDCouplingMappedExtrudedMesh(const MEDCouplingMappedExtrudedMesh& other, bool deepCopy):MEDCouplingMesh(other),_cell_2D_id(other._cell_2D_id)
+MEDCouplingMappedExtrudedMesh::MEDCouplingMappedExtrudedMesh(const MEDCouplingMappedExtrudedMesh& other, bool deepCpy):MEDCouplingMesh(other),_cell_2D_id(other._cell_2D_id)
 {
-  if(deepCopy)
+  if(deepCpy)
     {
       _mesh2D=other._mesh2D->clone(true);
       _mesh1D=other._mesh1D->clone(true);
index 807c2f2c1654d7d6507ec466466a34784b8effc8..1da334c1b548851fbb3cbeba6f071e14c8b3cf87 100644 (file)
@@ -113,7 +113,7 @@ namespace MEDCoupling
   private:
     MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId);
     MEDCouplingMappedExtrudedMesh(const MEDCouplingCMesh *mesh3D);
-    MEDCouplingMappedExtrudedMesh(const MEDCouplingMappedExtrudedMesh& other, bool deepCopy);
+    MEDCouplingMappedExtrudedMesh(const MEDCouplingMappedExtrudedMesh& other, bool deepCpy);
     MEDCouplingMappedExtrudedMesh();
     void computeExtrusion(const MEDCouplingUMesh *mesh3D);
     void computeExtrusionAlg(const MEDCouplingUMesh *mesh3D);
index 6609e9142c3ba262c40bf0ace31198103d9fea61..24142a4b285a0f35ef5055242e9b4dd5cfc83d9b 100644 (file)
@@ -16,7 +16,7 @@
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-// Author : Anthony Geay (CEA/DEN)
+// Author : Anthony Geay (EDF R&D)
 
 #include "MEDCouplingMemArray.txx"
 
@@ -40,6 +40,13 @@ template class MEDCoupling::MemArray<int>;
 template class MEDCoupling::MemArray<double>;
 template class MEDCoupling::DataArrayTemplate<int>;
 template class MEDCoupling::DataArrayTemplate<double>;
+template class MEDCoupling::DataArrayTemplateClassic<int>;
+template class MEDCoupling::DataArrayTemplateClassic<double>;
+template class MEDCoupling::DataArrayTemplateFP<double>;
+template class MEDCoupling::DataArrayIterator<double>;
+template class MEDCoupling::DataArrayIterator<int>;
+template class MEDCoupling::DataArrayDiscrete<Int32>;
+template class MEDCoupling::DataArrayDiscreteSigned<Int32>;
 
 template<int SPACEDIM>
 void DataArrayDouble::findCommonTuplesAlg(const double *bbox, int nbNodes, int limitNodeId, double prec, DataArrayInt *c, DataArrayInt *cI) const
@@ -189,12 +196,12 @@ void DataArray::copyPartOfStringInfoFrom(const DataArray& other, const std::vect
 
 void DataArray::copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other)
 {
-  int nbOfCompo=getNumberOfComponents();
+  std::size_t nbOfCompo(getNumberOfComponents());
   std::size_t partOfCompoToSet=compoIds.size();
-  if((int)partOfCompoToSet!=other.getNumberOfComponents())
+  if(partOfCompoToSet!=other.getNumberOfComponents())
     throw INTERP_KERNEL::Exception("Given compoIds has not the same size as number of components of given array !");
   for(std::size_t i=0;i<partOfCompoToSet;i++)
-    if(compoIds[i]>=nbOfCompo || compoIds[i]<0)
+    if(compoIds[i]>=(int)nbOfCompo || compoIds[i]<0)
       {
         std::ostringstream oss; oss << "Specified component id is out of range (" << compoIds[i] << ") compared with nb of actual components (" << nbOfCompo << ")";
         throw INTERP_KERNEL::Exception(oss.str().c_str());
@@ -266,7 +273,7 @@ std::string DataArray::cppRepr(const std::string& varName) const
  */
 void DataArray::setInfoOnComponents(const std::vector<std::string>& info)
 {
-  if(getNumberOfComponents()!=(int)info.size())
+  if(getNumberOfComponents()!=info.size())
     {
       std::ostringstream oss; oss << "DataArray::setInfoOnComponents : input is of size " << info.size() << " whereas number of components is equal to " << getNumberOfComponents() << " !";
       throw INTERP_KERNEL::Exception(oss.str().c_str());
@@ -549,7 +556,7 @@ void DataArray::setInfoOnComponent(int i, const std::string& info)
  */
 void DataArray::setInfoAndChangeNbOfCompo(const std::vector<std::string>& info)
 {
-  if(getNumberOfComponents()!=(int)info.size())
+  if(getNumberOfComponents()!=info.size())
     {
       if(!isAllocated())
         _info_on_compo=info;
@@ -574,7 +581,7 @@ void DataArray::checkNbOfTuples(int nbOfTuples, const std::string& msg) const
 
 void DataArray::checkNbOfComps(int nbOfCompo, const std::string& msg) const
 {
-  if(getNumberOfComponents()!=nbOfCompo)
+  if((int)getNumberOfComponents()!=nbOfCompo)
     {
       std::ostringstream oss; oss << msg << " : mismatch number of components : expected " << nbOfCompo << " having " << getNumberOfComponents() << " !";
       throw INTERP_KERNEL::Exception(oss.str().c_str());
@@ -802,24 +809,6 @@ DataArrayDouble *DataArrayDouble::deepCopy() const
   return new DataArrayDouble(*this);
 }
 
-/*!
- * Returns either a \a deep or \a shallow copy of this array. For more info see
- * \ref MEDCouplingArrayBasicsCopyDeep and \ref MEDCouplingArrayBasicsCopyShallow.
- *  \param [in] dCpy - if \a true, a deep copy is returned, else, a shallow one.
- *  \return DataArrayDouble * - either a new instance of DataArrayDouble (if \a dCpy
- *          == \a true) or \a this instance (if \a dCpy == \a false).
- */
-DataArrayDouble *DataArrayDouble::performCopyOrIncrRef(bool dCpy) const
-{
-  if(dCpy)
-    return deepCopy();
-  else
-    {
-      incrRef();
-      return const_cast<DataArrayDouble *>(this);
-    }
-}
-
 /*!
  * Assign zero to all values in \a this array. To know more on filling arrays see
  * \ref MEDCouplingArrayFill.
@@ -830,50 +819,6 @@ void DataArrayDouble::fillWithZero()
   fillWithValue(0.);
 }
 
-/*!
- * Set all values in \a this array so that the i-th element equals to \a init + i
- * (i starts from zero). To know more on filling arrays see \ref MEDCouplingArrayFill.
- *  \param [in] init - value to assign to the first element of array.
- *  \throw If \a this->getNumberOfComponents() != 1
- *  \throw If \a this is not allocated.
- */
-void DataArrayDouble::iota(double init)
-{
-  checkAllocated();
-  if(getNumberOfComponents()!=1)
-    throw INTERP_KERNEL::Exception("DataArrayDouble::iota : works only for arrays with only one component, you can call 'rearrange' method before !");
-  double *ptr=getPointer();
-  int ntuples=getNumberOfTuples();
-  for(int i=0;i<ntuples;i++)
-    ptr[i]=init+double(i);
-  declareAsNew();
-}
-
-/*!
- * Checks if all values in \a this array are equal to \a val at precision \a eps.
- *  \param [in] val - value to check equality of array values to.
- *  \param [in] eps - precision to check the equality.
- *  \return bool - \a true if all values are in range (_val_ - _eps_; _val_ + _eps_),
- *                 \a false else.
- *  \throw If \a this->getNumberOfComponents() != 1
- *  \throw If \a this is not allocated.
- */
-bool DataArrayDouble::isUniform(double val, double eps) const
-{
-  checkAllocated();
-  if(getNumberOfComponents()!=1)
-    throw INTERP_KERNEL::Exception("DataArrayDouble::isUniform : must be applied on DataArrayDouble with only one component, you can call 'rearrange' method before !");
-  int nbOfTuples=getNumberOfTuples();
-  const double *w=getConstPointer();
-  const double *end2=w+nbOfTuples;
-  const double vmin=val-eps;
-  const double vmax=val+eps;
-  for(;w!=end2;w++)
-    if(*w<vmin || *w>vmax)
-      return false;
-  return true;
-}
-
 /*!
  * Checks that \a this array is consistently **increasing** or **decreasing** in value,
  * with at least absolute difference value of |\a eps| at each step.
@@ -1051,8 +996,8 @@ void DataArrayDouble::reprNotTooLongWithoutNameStream(std::ostream& stream) cons
 
 void DataArrayDouble::reprCppStream(const std::string& varName, std::ostream& stream) const
 {
-  int nbTuples=getNumberOfTuples(),nbComp=getNumberOfComponents();
-  const double *data=getConstPointer();
+  int nbTuples(getNumberOfTuples()),nbComp(getNumberOfComponents());
+  const double *data(getConstPointer());
   stream.precision(17);
   stream << "DataArrayDouble *" << varName << "=DataArrayDouble::New();" << std::endl;
   if(nbTuples*nbComp>=1)
@@ -1168,102 +1113,6 @@ bool DataArrayDouble::isEqualWithoutConsideringStr(const DataArrayDouble& other,
   return _mem.isEqual(other._mem,prec,tmp);
 }
 
-/*!
- * Creates a new DataArrayInt and assigns all (textual and numerical) data of \a this
- * array to the new one.
- *  \return DataArrayInt * - the new instance of DataArrayInt.
- */
-DataArrayInt *DataArrayDouble::convertToIntArr() const
-{
-  DataArrayInt *ret=DataArrayInt::New();
-  ret->alloc(getNumberOfTuples(),getNumberOfComponents());
-  int *dest=ret->getPointer();
-  // to make Visual C++ happy : instead of std::size_t nbOfVals=getNbOfElems(); std::copy(src,src+nbOfVals,dest);
-  for(const double *src=begin();src!=end();src++,dest++)
-    *dest=(int)*src;
-  ret->copyStringInfoFrom(*this);
-  return ret;
-}
-
-/*!
- * Returns a new DataArrayDouble holding the same values as \a this array but differently
- * arranged in memory. If \a this array holds 2 components of 3 values:
- * \f$ x_0,x_1,x_2,y_0,y_1,y_2 \f$, then the result array holds these values arranged
- * as follows: \f$ x_0,y_0,x_1,y_1,x_2,y_2 \f$.
- *  \warning Do not confuse this method with transpose()!
- *  \return DataArrayDouble * - the new instance of DataArrayDouble that the caller
- *          is to delete using decrRef() as it is no more needed.
- *  \throw If \a this is not allocated.
- */
-DataArrayDouble *DataArrayDouble::fromNoInterlace() const
-{
-  if(_mem.isNull())
-    throw INTERP_KERNEL::Exception("DataArrayDouble::fromNoInterlace : Not defined array !");
-  double *tab=_mem.fromNoInterlace(getNumberOfComponents());
-  DataArrayDouble *ret=DataArrayDouble::New();
-  ret->useArray(tab,true,C_DEALLOC,getNumberOfTuples(),getNumberOfComponents());
-  return ret;
-}
-
-/*!
- * Returns a new DataArrayDouble holding the same values as \a this array but differently
- * arranged in memory. If \a this array holds 2 components of 3 values:
- * \f$ x_0,y_0,x_1,y_1,x_2,y_2 \f$, then the result array holds these values arranged
- * as follows: \f$ x_0,x_1,x_2,y_0,y_1,y_2 \f$.
- *  \warning Do not confuse this method with transpose()!
- *  \return DataArrayDouble * - the new instance of DataArrayDouble that the caller
- *          is to delete using decrRef() as it is no more needed.
- *  \throw If \a this is not allocated.
- */
-DataArrayDouble *DataArrayDouble::toNoInterlace() const
-{
-  if(_mem.isNull())
-    throw INTERP_KERNEL::Exception("DataArrayDouble::toNoInterlace : Not defined array !");
-  double *tab=_mem.toNoInterlace(getNumberOfComponents());
-  DataArrayDouble *ret=DataArrayDouble::New();
-  ret->useArray(tab,true,C_DEALLOC,getNumberOfTuples(),getNumberOfComponents());
-  return ret;
-}
-
-/*!
- * Appends components of another array to components of \a this one, tuple by tuple.
- * So that the number of tuples of \a this array remains the same and the number of 
- * components increases.
- *  \param [in] other - the DataArrayDouble to append to \a this one.
- *  \throw If \a this is not allocated.
- *  \throw If \a this and \a other arrays have different number of tuples.
- *
- *  \if ENABLE_EXAMPLES
- *  \ref cpp_mcdataarraydouble_meldwith "Here is a C++ example".
- *
- *  \ref py_mcdataarraydouble_meldwith "Here is a Python example".
- *  \endif
- */
-void DataArrayDouble::meldWith(const DataArrayDouble *other)
-{
-  checkAllocated();
-  other->checkAllocated();
-  int nbOfTuples=getNumberOfTuples();
-  if(nbOfTuples!=other->getNumberOfTuples())
-    throw INTERP_KERNEL::Exception("DataArrayDouble::meldWith : mismatch of number of tuples !");
-  int nbOfComp1=getNumberOfComponents();
-  int nbOfComp2=other->getNumberOfComponents();
-  double *newArr=(double *)malloc((nbOfTuples*(nbOfComp1+nbOfComp2))*sizeof(double));
-  double *w=newArr;
-  const double *inp1=getConstPointer();
-  const double *inp2=other->getConstPointer();
-  for(int i=0;i<nbOfTuples;i++,inp1+=nbOfComp1,inp2+=nbOfComp2)
-    {
-      w=std::copy(inp1,inp1+nbOfComp1,w);
-      w=std::copy(inp2,inp2+nbOfComp2,w);
-    }
-  useArray(newArr,true,C_DEALLOC,nbOfTuples,nbOfComp1+nbOfComp2);
-  std::vector<int> compIds(nbOfComp2);
-  for(int i=0;i<nbOfComp2;i++)
-    compIds[i]=nbOfComp1+i;
-  copyPartOfStringInfoFrom2(compIds,*other);
-}
-
 /*!
  * This method checks that all tuples in \a other are in \a this.
  * If true, the output param \a tupleIds contains the tuples ids of \a this that correspond to tupes in \a this.
@@ -1355,34 +1204,6 @@ void DataArrayDouble::findCommonTuples(double prec, int limitTupleId, DataArrayI
   commIndex=cI.retn();
 }
 
-/*!
- * 
- * \param [in] nbTimes specifies the nb of times each tuples in \a this will be duplicated contiguouly in returned DataArrayDouble instance.
- *             \a nbTimes  should be at least equal to 1.
- * \return a newly allocated DataArrayDouble having one component and number of tuples equal to \a nbTimes * \c this->getNumberOfTuples.
- * \throw if \a this is not allocated or if \a this has not number of components set to one or if \a nbTimes is lower than 1.
- */
-DataArrayDouble *DataArrayDouble::duplicateEachTupleNTimes(int nbTimes) const
-{
-  checkAllocated();
-  if(getNumberOfComponents()!=1)
-    throw INTERP_KERNEL::Exception("DataArrayDouble::duplicateEachTupleNTimes : this should have only one component !");
-  if(nbTimes<1)
-    throw INTERP_KERNEL::Exception("DataArrayDouble::duplicateEachTupleNTimes : nb times should be >= 1 !");
-  int nbTuples=getNumberOfTuples();
-  const double *inPtr=getConstPointer();
-  MCAuto<DataArrayDouble> ret=DataArrayDouble::New(); ret->alloc(nbTimes*nbTuples,1);
-  double *retPtr=ret->getPointer();
-  for(int i=0;i<nbTuples;i++,inPtr++)
-    {
-      double val=*inPtr;
-      for(int j=0;j<nbTimes;j++,retPtr++)
-        *retPtr=val;
-    }
-  ret->copyStringInfoFrom(*this);
-  return ret.retn();
-}
-
 /*!
  * This methods returns the minimal distance between the two set of points \a this and \a other.
  * So \a this and \a other have to have the same number of components. If not an INTERP_KERNEL::Exception will be thrown.
@@ -1425,7 +1246,7 @@ DataArrayInt *DataArrayDouble::findClosestTupleId(const DataArrayDouble *other)
   if(!other)
     throw INTERP_KERNEL::Exception("DataArrayDouble::findClosestTupleId : other instance is NULL !");
   checkAllocated(); other->checkAllocated();
-  int nbOfCompo=getNumberOfComponents();
+  std::size_t nbOfCompo(getNumberOfComponents());
   if(nbOfCompo!=other->getNumberOfComponents())
     {
       std::ostringstream oss; oss << "DataArrayDouble::findClosestTupleId : number of components in this is " << nbOfCompo;
@@ -1488,7 +1309,8 @@ DataArrayInt *DataArrayDouble::computeNbOfInteractionsWith(const DataArrayDouble
     throw INTERP_KERNEL::Exception("DataArrayDouble::computeNbOfInteractionsWith : input array is NULL !");
   if(!isAllocated() || !otherBBoxFrmt->isAllocated())
     throw INTERP_KERNEL::Exception("DataArrayDouble::computeNbOfInteractionsWith : this and input array must be allocated !");
-  int nbOfComp(getNumberOfComponents()),nbOfTuples(getNumberOfTuples());
+  std::size_t nbOfComp(getNumberOfComponents());
+  int nbOfTuples(getNumberOfTuples());
   if(nbOfComp!=otherBBoxFrmt->getNumberOfComponents())
     {
       std::ostringstream oss; oss << "DataArrayDouble::computeNbOfInteractionsWith : this number of components (" << nbOfComp << ") must be equal to the number of components of input array (" << otherBBoxFrmt->getNumberOfComponents() << ") !";
@@ -1594,27 +1416,6 @@ void DataArrayDouble::setSelectedComponents(const DataArrayDouble *a, const std:
       nc[nbOfCompo*i+compoIds[j]]=*ac;
 }
 
-void DataArrayDouble::SetArrayIn(DataArrayDouble *newArray, DataArrayDouble* &arrayToSet)
-{
-  if(newArray!=arrayToSet)
-    {
-      if(arrayToSet)
-        arrayToSet->decrRef();
-      arrayToSet=newArray;
-      if(arrayToSet)
-        arrayToSet->incrRef();
-    }
-}
-
-void DataArrayDouble::aggregate(const DataArrayDouble *other)
-{
-  if(!other)
-    throw INTERP_KERNEL::Exception("DataArrayDouble::aggregate : null pointer !");
-  if(getNumberOfComponents()!=other->getNumberOfComponents())
-    throw INTERP_KERNEL::Exception("DataArrayDouble::aggregate : mismatch number of components !");
-  _mem.insertAtTheEnd(other->begin(),other->end());
-}
-
 /*!
  * Checks if 0.0 value is present in \a this array. If it is the case, an exception
  * is thrown.
@@ -2055,6 +1856,27 @@ DataArrayDouble *DataArrayDouble::accumulatePerChunck(const int *bgOfIndex, cons
   return ret.retn();
 }
 
+/*!
+ * This method is close to numpy cumSum except that number of element is equal to \a this->getNumberOfTuples()+1. First element of DataArray returned is equal to 0.
+ * This method expects that \a this as only one component. The returned array will have \a this->getNumberOfTuples()+1 tuple with also one component.
+ * The ith element of returned array is equal to the sum of elements in \a this with rank strictly lower than i.
+ *
+ * \return DataArrayDouble - A newly built array containing cum sum of \a this.
+ */
+MCAuto<DataArrayDouble> DataArrayDouble::cumSum() const
+{
+  checkAllocated();
+  checkNbOfComps(1,"DataArrayDouble::cumSum : this is expected to be single component");
+  int nbOfTuple(getNumberOfTuples());
+  MCAuto<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(nbOfTuple+1,1);
+  double *ptr(ret->getPointer());
+  ptr[0]=0.;
+  const double *thisPtr(begin());
+  for(int i=0;i<nbOfTuple;i++)
+    ptr[i+1]=ptr[i]+thisPtr[i];
+  return ret;
+}
+
 /*!
  * Converts each 2D point defined by the tuple of \a this array from the Polar to the
  * Cartesian coordinate system. The two components of the tuple of \a this array are 
@@ -2772,86 +2594,6 @@ void DataArrayDouble::sortPerTuple(bool asc)
   declareAsNew();
 }
 
-/*!
- * Converts every value of \a this array to its absolute value.
- * \b WARNING this method is non const. If a new DataArrayDouble instance should be built containing the result of abs DataArrayDouble::computeAbs
- * should be called instead.
- *
- * \throw If \a this is not allocated.
- * \sa DataArrayDouble::computeAbs
- */
-void DataArrayDouble::abs()
-{
-  checkAllocated();
-  double *ptr(getPointer());
-  std::size_t nbOfElems(getNbOfElems());
-  std::transform(ptr,ptr+nbOfElems,ptr,std::ptr_fun<double,double>(fabs));
-  declareAsNew();
-}
-
-/*!
- * This method builds a new instance of \a this object containing the result of std::abs applied of all elements in \a this.
- * This method is a const method (that do not change any values in \a this) contrary to  DataArrayDouble::abs method.
- *
- * \return DataArrayDouble * - the new instance of DataArrayDouble containing the
- *         same number of tuples and component as \a this array.
- *         The caller is to delete this result array using decrRef() as it is no more
- *         needed.
- * \throw If \a this is not allocated.
- * \sa DataArrayDouble::abs
- */
-DataArrayDouble *DataArrayDouble::computeAbs() const
-{
-  checkAllocated();
-  DataArrayDouble *newArr(DataArrayDouble::New());
-  int nbOfTuples(getNumberOfTuples());
-  int nbOfComp(getNumberOfComponents());
-  newArr->alloc(nbOfTuples,nbOfComp);
-  std::transform(begin(),end(),newArr->getPointer(),std::ptr_fun<double,double>(fabs));
-  newArr->copyStringInfoFrom(*this);
-  return newArr;
-}
-
-/*!
- * Apply a linear function to a given component of \a this array, so that
- * an array element <em>(x)</em> becomes \f$ a * x + b \f$.
- *  \param [in] a - the first coefficient of the function.
- *  \param [in] b - the second coefficient of the function.
- *  \param [in] compoId - the index of component to modify.
- *  \throw If \a this is not allocated, or \a compoId is not in [0,\c this->getNumberOfComponents() ).
- */
-void DataArrayDouble::applyLin(double a, double b, int compoId)
-{
-  checkAllocated();
-  double *ptr(getPointer()+compoId);
-  int nbOfComp(getNumberOfComponents()),nbOfTuple(getNumberOfTuples());
-  if(compoId<0 || compoId>=nbOfComp)
-    {
-      std::ostringstream oss; oss << "DataArrayDouble::applyLin : The compoId requested (" << compoId << ") is not valid ! Must be in [0," << nbOfComp << ") !";
-      throw INTERP_KERNEL::Exception(oss.str().c_str());
-    }
-  for(int i=0;i<nbOfTuple;i++,ptr+=nbOfComp)
-    *ptr=a*(*ptr)+b;
-  declareAsNew();
-}
-
-/*!
- * Apply a linear function to all elements of \a this array, so that
- * an element _x_ becomes \f$ a * x + b \f$.
- *  \param [in] a - the first coefficient of the function.
- *  \param [in] b - the second coefficient of the function.
- *  \throw If \a this is not allocated.
- */
-void DataArrayDouble::applyLin(double a, double b)
-{
-  checkAllocated();
-  double *ptr=getPointer();
-  std::size_t nbOfElems=getNbOfElems();
-  for(std::size_t i=0;i<nbOfElems;i++,ptr++)
-    *ptr=a*(*ptr)+b;
-  declareAsNew();
-}
-
 /*!
  * Modify all elements of \a this array, so that
  * an element _x_ becomes \f$ numerator / x \f$.
@@ -2883,27 +2625,6 @@ void DataArrayDouble::applyInv(double numerator)
   declareAsNew();
 }
 
-/*!
- * Returns a full copy of \a this array except that sign of all elements is reversed.
- *  \return DataArrayDouble * - the new instance of DataArrayDouble containing the
- *          same number of tuples and component as \a this array.
- *          The caller is to delete this result array using decrRef() as it is no more
- *          needed.
- *  \throw If \a this is not allocated.
- */
-DataArrayDouble *DataArrayDouble::negate() const
-{
-  checkAllocated();
-  DataArrayDouble *newArr=DataArrayDouble::New();
-  int nbOfTuples=getNumberOfTuples();
-  int nbOfComp=getNumberOfComponents();
-  newArr->alloc(nbOfTuples,nbOfComp);
-  const double *cptr=getConstPointer();
-  std::transform(cptr,cptr+nbOfTuples*nbOfComp,newArr->getPointer(),std::negate<double>());
-  newArr->copyStringInfoFrom(*this);
-  return newArr;
-}
-
 /*!
  * Modify all elements of \a this array, so that
  * an element _x_ becomes <em> val ^ x </em>. Contrary to DataArrayInt::applyPow
@@ -3469,7 +3190,7 @@ DataArrayDouble *DataArrayDouble::Aggregate(const std::vector<const DataArrayDou
   if(a.empty())
     throw INTERP_KERNEL::Exception("DataArrayDouble::Aggregate : input list must contain at least one NON EMPTY DataArrayDouble !");
   std::vector<const DataArrayDouble *>::const_iterator it=a.begin();
-  int nbOfComp=(*it)->getNumberOfComponents();
+  std::size_t nbOfComp((*it)->getNumberOfComponents());
   int nbt=(*it++)->getNumberOfTuples();
   for(int i=1;it!=a.end();it++,i++)
     {
@@ -3486,85 +3207,6 @@ DataArrayDouble *DataArrayDouble::Aggregate(const std::vector<const DataArrayDou
   return ret.retn();
 }
 
-/*!
- * Returns a new DataArrayDouble by aggregating two given arrays, so that (1) the number
- * of components in the result array is a sum of the number of components of given arrays
- * and (2) the number of tuples in the result array is same as that of each of given
- * arrays. In other words the i-th tuple of result array includes all components of
- * i-th tuples of all given arrays.
- * Number of tuples in the given arrays must be  the same.
- *  \param [in] a1 - an array to include in the result array.
- *  \param [in] a2 - another array to include in the result array.
- *  \return DataArrayDouble * - the new instance of DataArrayDouble.
- *          The caller is to delete this result array using decrRef() as it is no more
- *          needed.
- *  \throw If both \a a1 and \a a2 are NULL.
- *  \throw If any given array is not allocated.
- *  \throw If \a a1->getNumberOfTuples() != \a a2->getNumberOfTuples()
- */
-DataArrayDouble *DataArrayDouble::Meld(const DataArrayDouble *a1, const DataArrayDouble *a2)
-{
-  std::vector<const DataArrayDouble *> arr(2);
-  arr[0]=a1; arr[1]=a2;
-  return Meld(arr);
-}
-
-/*!
- * Returns a new DataArrayDouble by aggregating all given arrays, so that (1) the number
- * of components in the result array is a sum of the number of components of given arrays
- * and (2) the number of tuples in the result array is same as that of each of given
- * arrays. In other words the i-th tuple of result array includes all components of
- * i-th tuples of all given arrays.
- * Number of tuples in the given arrays must be  the same.
- *  \param [in] arr - a sequence of arrays to include in the result array.
- *  \return DataArrayDouble * - the new instance of DataArrayDouble.
- *          The caller is to delete this result array using decrRef() as it is no more
- *          needed.
- *  \throw If all arrays within \a arr are NULL.
- *  \throw If any given array is not allocated.
- *  \throw If getNumberOfTuples() of arrays within \a arr is different.
- */
-DataArrayDouble *DataArrayDouble::Meld(const std::vector<const DataArrayDouble *>& arr)
-{
-  std::vector<const DataArrayDouble *> a;
-  for(std::vector<const DataArrayDouble *>::const_iterator it4=arr.begin();it4!=arr.end();it4++)
-    if(*it4)
-      a.push_back(*it4);
-  if(a.empty())
-    throw INTERP_KERNEL::Exception("DataArrayDouble::Meld : input list must contain at least one NON EMPTY DataArrayDouble !");
-  std::vector<const DataArrayDouble *>::const_iterator it;
-  for(it=a.begin();it!=a.end();it++)
-    (*it)->checkAllocated();
-  it=a.begin();
-  int nbOfTuples=(*it)->getNumberOfTuples();
-  std::vector<int> nbc(a.size());
-  std::vector<const double *> pts(a.size());
-  nbc[0]=(*it)->getNumberOfComponents();
-  pts[0]=(*it++)->getConstPointer();
-  for(int i=1;it!=a.end();it++,i++)
-    {
-      if(nbOfTuples!=(*it)->getNumberOfTuples())
-        throw INTERP_KERNEL::Exception("DataArrayDouble::Meld : mismatch of number of tuples !");
-      nbc[i]=(*it)->getNumberOfComponents();
-      pts[i]=(*it)->getConstPointer();
-    }
-  int totalNbOfComp=std::accumulate(nbc.begin(),nbc.end(),0);
-  DataArrayDouble *ret=DataArrayDouble::New();
-  ret->alloc(nbOfTuples,totalNbOfComp);
-  double *retPtr=ret->getPointer();
-  for(int i=0;i<nbOfTuples;i++)
-    for(int j=0;j<(int)a.size();j++)
-      {
-        retPtr=std::copy(pts[j],pts[j]+nbc[j],retPtr);
-        pts[j]+=nbc[j];
-      }
-  int k=0;
-  for(int i=0;i<(int)a.size();i++)
-    for(int j=0;j<nbc[i];j++,k++)
-      ret->setInfoOnComponent(k,a[i]->getInfoOnComponent(j));
-  return ret;
-}
-
 /*!
  * Returns a new DataArrayDouble containing a dot product of two given arrays, so that
  * the i-th tuple of the result array is a sum of products of j-th components of i-th
@@ -3587,7 +3229,7 @@ DataArrayDouble *DataArrayDouble::Dot(const DataArrayDouble *a1, const DataArray
     throw INTERP_KERNEL::Exception("DataArrayDouble::Dot : input DataArrayDouble instance is NULL !");
   a1->checkAllocated();
   a2->checkAllocated();
-  int nbOfComp=a1->getNumberOfComponents();
+  std::size_t nbOfComp(a1->getNumberOfComponents());
   if(nbOfComp!=a2->getNumberOfComponents())
     throw INTERP_KERNEL::Exception("Nb of components mismatch for array Dot !");
   int nbOfTuple=a1->getNumberOfTuples();
@@ -3601,7 +3243,7 @@ DataArrayDouble *DataArrayDouble::Dot(const DataArrayDouble *a1, const DataArray
   for(int i=0;i<nbOfTuple;i++)
     {
       double sum=0.;
-      for(int j=0;j<nbOfComp;j++)
+      for(std::size_t j=0;j<nbOfComp;j++)
         sum+=a1Ptr[i*nbOfComp+j]*a2Ptr[i*nbOfComp+j];
       retPtr[i]=sum;
     }
@@ -3631,7 +3273,7 @@ DataArrayDouble *DataArrayDouble::CrossProduct(const DataArrayDouble *a1, const
 {
   if(!a1 || !a2)
     throw INTERP_KERNEL::Exception("DataArrayDouble::CrossProduct : input DataArrayDouble instance is NULL !");
-  int nbOfComp=a1->getNumberOfComponents();
+  std::size_t nbOfComp(a1->getNumberOfComponents());
   if(nbOfComp!=a2->getNumberOfComponents())
     throw INTERP_KERNEL::Exception("Nb of components mismatch for array crossProduct !");
   if(nbOfComp!=3)
@@ -3671,7 +3313,7 @@ DataArrayDouble *DataArrayDouble::Max(const DataArrayDouble *a1, const DataArray
 {
   if(!a1 || !a2)
     throw INTERP_KERNEL::Exception("DataArrayDouble::Max : input DataArrayDouble instance is NULL !");
-  int nbOfComp=a1->getNumberOfComponents();
+  std::size_t nbOfComp(a1->getNumberOfComponents());
   if(nbOfComp!=a2->getNumberOfComponents())
     throw INTERP_KERNEL::Exception("Nb of components mismatch for array Max !");
   int nbOfTuple=a1->getNumberOfTuples();
@@ -3706,7 +3348,7 @@ DataArrayDouble *DataArrayDouble::Min(const DataArrayDouble *a1, const DataArray
 {
   if(!a1 || !a2)
     throw INTERP_KERNEL::Exception("DataArrayDouble::Min : input DataArrayDouble instance is NULL !");
-  int nbOfComp=a1->getNumberOfComponents();
+  std::size_t nbOfComp(a1->getNumberOfComponents());
   if(nbOfComp!=a2->getNumberOfComponents())
     throw INTERP_KERNEL::Exception("Nb of components mismatch for array min !");
   int nbOfTuple=a1->getNumberOfTuples();
@@ -3725,787 +3367,191 @@ DataArrayDouble *DataArrayDouble::Min(const DataArrayDouble *a1, const DataArray
 }
 
 /*!
- * Returns a new DataArrayDouble that is a sum of two given arrays. There are 3
+ * Returns a new DataArrayDouble that is the result of pow of two given arrays. There are 3
  * valid cases.
- * 1.  The arrays have same number of tuples and components. Then each value of
- *   the result array (_a_) is a sum of the corresponding values of \a a1 and \a a2,
- *   i.e.: _a_ [ i, j ] = _a1_ [ i, j ] + _a2_ [ i, j ].
- * 2.  The arrays have same number of tuples and one array, say _a2_, has one
- *   component. Then
- *   _a_ [ i, j ] = _a1_ [ i, j ] + _a2_ [ i, 0 ].
- * 3.  The arrays have same number of components and one array, say _a2_, has one
- *   tuple. Then
- *   _a_ [ i, j ] = _a1_ [ i, j ] + _a2_ [ 0, j ].
  *
- * Info on components is copied either from the first array (in the first case) or from
- * the array with maximal number of elements (getNbOfElems()).
- *  \param [in] a1 - an array to sum up.
+ *  \param [in] a1 - an array to pow up.
  *  \param [in] a2 - another array to sum up.
  *  \return DataArrayDouble * - the new instance of DataArrayDouble.
  *          The caller is to delete this result array using decrRef() as it is no more
  *          needed.
  *  \throw If either \a a1 or \a a2 is NULL.
- *  \throw If \a a1->getNumberOfTuples() != \a a2->getNumberOfTuples() and
- *         \a a1->getNumberOfComponents() != \a a2->getNumberOfComponents() and
- *         none of them has number of tuples or components equal to 1.
+ *  \throw If \a a1->getNumberOfTuples() != \a a2->getNumberOfTuples()
+ *  \throw If \a a1->getNumberOfComponents() != 1 or \a a2->getNumberOfComponents() != 1.
+ *  \throw If there is a negative value in \a a1.
  */
-DataArrayDouble *DataArrayDouble::Add(const DataArrayDouble *a1, const DataArrayDouble *a2)
+DataArrayDouble *DataArrayDouble::Pow(const DataArrayDouble *a1, const DataArrayDouble *a2)
 {
   if(!a1 || !a2)
-    throw INTERP_KERNEL::Exception("DataArrayDouble::Add : input DataArrayDouble instance is NULL !");
+    throw INTERP_KERNEL::Exception("DataArrayDouble::Pow : at least one of input instances is null !");
   int nbOfTuple=a1->getNumberOfTuples();
   int nbOfTuple2=a2->getNumberOfTuples();
   int nbOfComp=a1->getNumberOfComponents();
   int nbOfComp2=a2->getNumberOfComponents();
-  MCAuto<DataArrayDouble> ret=0;
-  if(nbOfTuple==nbOfTuple2)
+  if(nbOfTuple!=nbOfTuple2)
+    throw INTERP_KERNEL::Exception("DataArrayDouble::Pow : number of tuples mismatches !");
+  if(nbOfComp!=1 || nbOfComp2!=1)
+    throw INTERP_KERNEL::Exception("DataArrayDouble::Pow : number of components of both arrays must be equal to 1 !");
+  MCAuto<DataArrayDouble> ret=DataArrayDouble::New(); ret->alloc(nbOfTuple,1);
+  const double *ptr1(a1->begin()),*ptr2(a2->begin());
+  double *ptr=ret->getPointer();
+  for(int i=0;i<nbOfTuple;i++,ptr1++,ptr2++,ptr++)
     {
-      if(nbOfComp==nbOfComp2)
+      if(*ptr1>=0)
         {
-          ret=DataArrayDouble::New();
-          ret->alloc(nbOfTuple,nbOfComp);
-          std::transform(a1->begin(),a1->end(),a2->begin(),ret->getPointer(),std::plus<double>());
-          ret->copyStringInfoFrom(*a1);
+          *ptr=pow(*ptr1,*ptr2);
         }
       else
         {
-          int nbOfCompMin,nbOfCompMax;
-          const DataArrayDouble *aMin, *aMax;
-          if(nbOfComp>nbOfComp2)
-            {
-              nbOfCompMin=nbOfComp2; nbOfCompMax=nbOfComp;
-              aMin=a2; aMax=a1;
-            }
-          else
-            {
-              nbOfCompMin=nbOfComp; nbOfCompMax=nbOfComp2;
-              aMin=a1; aMax=a2;
-            }
-          if(nbOfCompMin==1)
-            {
-              ret=DataArrayDouble::New();
-              ret->alloc(nbOfTuple,nbOfCompMax);
-              const double *aMinPtr=aMin->getConstPointer();
-              const double *aMaxPtr=aMax->getConstPointer();
-              double *res=ret->getPointer();
-              for(int i=0;i<nbOfTuple;i++)
-                res=std::transform(aMaxPtr+i*nbOfCompMax,aMaxPtr+(i+1)*nbOfCompMax,res,std::bind2nd(std::plus<double>(),aMinPtr[i]));
-              ret->copyStringInfoFrom(*aMax);
-            }
-          else
-            throw INTERP_KERNEL::Exception("Nb of components mismatch for array Add !");
-        }
-    }
-  else if((nbOfTuple==1 && nbOfTuple2>1) || (nbOfTuple>1 && nbOfTuple2==1))
-    {
-      if(nbOfComp==nbOfComp2)
-        {
-          int nbOfTupleMax=std::max(nbOfTuple,nbOfTuple2);
-          const DataArrayDouble *aMin=nbOfTuple>nbOfTuple2?a2:a1;
-          const DataArrayDouble *aMax=nbOfTuple>nbOfTuple2?a1:a2;
-          const double *aMinPtr=aMin->getConstPointer(),*aMaxPtr=aMax->getConstPointer();
-          ret=DataArrayDouble::New();
-          ret->alloc(nbOfTupleMax,nbOfComp);
-          double *res=ret->getPointer();
-          for(int i=0;i<nbOfTupleMax;i++)
-            res=std::transform(aMaxPtr+i*nbOfComp,aMaxPtr+(i+1)*nbOfComp,aMinPtr,res,std::plus<double>());
-          ret->copyStringInfoFrom(*aMax);
+          std::ostringstream oss; oss << "DataArrayDouble::Pow : on tuple #" << i << " of a1 value is < 0 (" << *ptr1 << ") !";
+          throw INTERP_KERNEL::Exception(oss.str().c_str());
         }
-      else
-        throw INTERP_KERNEL::Exception("Nb of components mismatch for array Add !");
     }
-  else
-    throw INTERP_KERNEL::Exception("Nb of tuples mismatch for array Add !");
   return ret.retn();
 }
 
 /*!
- * Adds values of another DataArrayDouble to values of \a this one. There are 3
- * valid cases.
- * 1.  The arrays have same number of tuples and components. Then each value of
- *   \a other array is added to the corresponding value of \a this array, i.e.:
- *   _a_ [ i, j ] += _other_ [ i, j ].
- * 2.  The arrays have same number of tuples and \a other array has one component. Then
- *   _a_ [ i, j ] += _other_ [ i, 0 ].
- * 3.  The arrays have same number of components and \a other array has one tuple. Then
- *   _a_ [ i, j ] += _a2_ [ 0, j ].
+ * Apply pow on values of another DataArrayDouble to values of \a this one.
  *
- *  \param [in] other - an array to add to \a this one.
+ *  \param [in] other - an array to pow to \a this one.
  *  \throw If \a other is NULL.
- *  \throw If \a this->getNumberOfTuples() != \a other->getNumberOfTuples() and
- *         \a this->getNumberOfComponents() != \a other->getNumberOfComponents() and
- *         \a other has number of both tuples and components not equal to 1.
+ *  \throw If \a this->getNumberOfTuples() != \a other->getNumberOfTuples()
+ *  \throw If \a this->getNumberOfComponents() != 1 or \a other->getNumberOfComponents() != 1
+ *  \throw If there is a negative value in \a this.
  */
-void DataArrayDouble::addEqual(const DataArrayDouble *other)
+void DataArrayDouble::powEqual(const DataArrayDouble *other)
 {
   if(!other)
-    throw INTERP_KERNEL::Exception("DataArrayDouble::addEqual : input DataArrayDouble instance is NULL !");
-  const char *msg="Nb of tuples mismatch for DataArrayDouble::addEqual  !";
-  checkAllocated();
-  other->checkAllocated();
+    throw INTERP_KERNEL::Exception("DataArrayDouble::powEqual : input instance is null !");
   int nbOfTuple=getNumberOfTuples();
   int nbOfTuple2=other->getNumberOfTuples();
   int nbOfComp=getNumberOfComponents();
   int nbOfComp2=other->getNumberOfComponents();
-  if(nbOfTuple==nbOfTuple2)
+  if(nbOfTuple!=nbOfTuple2)
+    throw INTERP_KERNEL::Exception("DataArrayDouble::powEqual : number of tuples mismatches !");
+  if(nbOfComp!=1 || nbOfComp2!=1)
+    throw INTERP_KERNEL::Exception("DataArrayDouble::powEqual : number of components of both arrays must be equal to 1 !");
+  double *ptr=getPointer();
+  const double *ptrc=other->begin();
+  for(int i=0;i<nbOfTuple;i++,ptrc++,ptr++)
     {
-      if(nbOfComp==nbOfComp2)
-        {
-          std::transform(begin(),end(),other->begin(),getPointer(),std::plus<double>());
-        }
-      else if(nbOfComp2==1)
-        {
-          double *ptr=getPointer();
-          const double *ptrc=other->getConstPointer();
-          for(int i=0;i<nbOfTuple;i++)
-            std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptr+i*nbOfComp,std::bind2nd(std::plus<double>(),*ptrc++));
-        }
+      if(*ptr>=0)
+        *ptr=pow(*ptr,*ptrc);
       else
-        throw INTERP_KERNEL::Exception(msg);
-    }
-  else if(nbOfTuple2==1)
-    {
-      if(nbOfComp2==nbOfComp)
         {
-          double *ptr=getPointer();
-          const double *ptrc=other->getConstPointer();
-          for(int i=0;i<nbOfTuple;i++)
-            std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptrc,ptr+i*nbOfComp,std::plus<double>());
+          std::ostringstream oss; oss << "DataArrayDouble::powEqual : on tuple #" << i << " of this value is < 0 (" << *ptr << ") !";
+          throw INTERP_KERNEL::Exception(oss.str().c_str());
         }
-      else
-        throw INTERP_KERNEL::Exception(msg);
     }
-  else
-    throw INTERP_KERNEL::Exception(msg);
   declareAsNew();
 }
 
 /*!
- * Returns a new DataArrayDouble that is a subtraction of two given arrays. There are 3
- * valid cases.
- * 1.  The arrays have same number of tuples and components. Then each value of
- *   the result array (_a_) is a subtraction of the corresponding values of \a a1 and
- *   \a a2, i.e.: _a_ [ i, j ] = _a1_ [ i, j ] - _a2_ [ i, j ].
- * 2.  The arrays have same number of tuples and one array, say _a2_, has one
- *   component. Then
- *   _a_ [ i, j ] = _a1_ [ i, j ] - _a2_ [ i, 0 ].
- * 3.  The arrays have same number of components and one array, say _a2_, has one
- *   tuple. Then
- *   _a_ [ i, j ] = _a1_ [ i, j ] - _a2_ [ 0, j ].
+ * This method is \b NOT wrapped into python because it can be useful only for performance reasons in C++ context.
+ * All values in \a this must be 0. or 1. within eps error. 0 means false, 1 means true.
+ * If an another value than 0 or 1 appear (within eps precision) an INTERP_KERNEL::Exception will be thrown.
  *
- * Info on components is copied either from the first array (in the first case) or from
- * the array with maximal number of elements (getNbOfElems()).
- *  \param [in] a1 - an array to subtract from.
- *  \param [in] a2 - an array to subtract.
- *  \return DataArrayDouble * - the new instance of DataArrayDouble.
- *          The caller is to delete this result array using decrRef() as it is no more
- *          needed.
- *  \throw If either \a a1 or \a a2 is NULL.
- *  \throw If \a a1->getNumberOfTuples() != \a a2->getNumberOfTuples() and
- *         \a a1->getNumberOfComponents() != \a a2->getNumberOfComponents() and
- *         none of them has number of tuples or components equal to 1.
+ * \throw if \a this is not allocated.
+ * \throw if \a this has not exactly one component.
  */
-DataArrayDouble *DataArrayDouble::Substract(const DataArrayDouble *a1, const DataArrayDouble *a2)
+std::vector<bool> DataArrayDouble::toVectorOfBool(double eps) const
 {
-  if(!a1 || !a2)
-    throw INTERP_KERNEL::Exception("DataArrayDouble::Substract : input DataArrayDouble instance is NULL !");
-  int nbOfTuple1=a1->getNumberOfTuples();
-  int nbOfTuple2=a2->getNumberOfTuples();
-  int nbOfComp1=a1->getNumberOfComponents();
-  int nbOfComp2=a2->getNumberOfComponents();
-  if(nbOfTuple2==nbOfTuple1)
+  checkAllocated();
+  if(getNumberOfComponents()!=1)
+    throw INTERP_KERNEL::Exception("DataArrayDouble::toVectorOfBool : must be applied on single component array !");
+  int nbt(getNumberOfTuples());
+  std::vector<bool> ret(nbt);
+  const double *pt(begin());
+  for(int i=0;i<nbt;i++)
     {
-      if(nbOfComp1==nbOfComp2)
-        {
-          MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
-          ret->alloc(nbOfTuple2,nbOfComp1);
-          std::transform(a1->begin(),a1->end(),a2->begin(),ret->getPointer(),std::minus<double>());
-          ret->copyStringInfoFrom(*a1);
-          return ret.retn();
-        }
-      else if(nbOfComp2==1)
-        {
-          MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
-          ret->alloc(nbOfTuple1,nbOfComp1);
-          const double *a2Ptr=a2->getConstPointer();
-          const double *a1Ptr=a1->getConstPointer();
-          double *res=ret->getPointer();
-          for(int i=0;i<nbOfTuple1;i++)
-            res=std::transform(a1Ptr+i*nbOfComp1,a1Ptr+(i+1)*nbOfComp1,res,std::bind2nd(std::minus<double>(),a2Ptr[i]));
-          ret->copyStringInfoFrom(*a1);
-          return ret.retn();
-        }
+      if(fabs(pt[i])<eps)
+        ret[i]=false;
+      else if(fabs(pt[i]-1.)<eps)
+        ret[i]=true;
       else
         {
-          a1->checkNbOfComps(nbOfComp2,"Nb of components mismatch for array Substract !");
-          return 0;
+          std::ostringstream oss; oss << "DataArrayDouble::toVectorOfBool : the tuple #" << i << " has value " << pt[i] << " is invalid ! must be 0. or 1. !";
+          throw INTERP_KERNEL::Exception(oss.str().c_str());
         }
     }
-  else if(nbOfTuple2==1)
+  return ret;
+}
+
+/*!
+ * Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class.
+ * Server side.
+ */
+void DataArrayDouble::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
+{
+  tinyInfo.resize(2);
+  if(isAllocated())
     {
-      a1->checkNbOfComps(nbOfComp2,"Nb of components mismatch for array Substract !");
-      MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
-      ret->alloc(nbOfTuple1,nbOfComp1);
-      const double *a1ptr=a1->getConstPointer(),*a2ptr=a2->getConstPointer();
-      double *pt=ret->getPointer();
-      for(int i=0;i<nbOfTuple1;i++)
-        pt=std::transform(a1ptr+i*nbOfComp1,a1ptr+(i+1)*nbOfComp1,a2ptr,pt,std::minus<double>());
-      ret->copyStringInfoFrom(*a1);
-      return ret.retn();
+      tinyInfo[0]=getNumberOfTuples();
+      tinyInfo[1]=getNumberOfComponents();
     }
   else
     {
-      a1->checkNbOfTuples(nbOfTuple2,"Nb of tuples mismatch for array Substract !");//will always throw an exception
-      return 0;
+      tinyInfo[0]=-1;
+      tinyInfo[1]=-1;
     }
 }
 
 /*!
- * Subtract values of another DataArrayDouble from values of \a this one. There are 3
- * valid cases.
- * 1.  The arrays have same number of tuples and components. Then each value of
- *   \a other array is subtracted from the corresponding value of \a this array, i.e.:
- *   _a_ [ i, j ] -= _other_ [ i, j ].
- * 2.  The arrays have same number of tuples and \a other array has one component. Then
- *   _a_ [ i, j ] -= _other_ [ i, 0 ].
- * 3.  The arrays have same number of components and \a other array has one tuple. Then
- *   _a_ [ i, j ] -= _a2_ [ 0, j ].
- *
- *  \param [in] other - an array to subtract from \a this one.
- *  \throw If \a other is NULL.
- *  \throw If \a this->getNumberOfTuples() != \a other->getNumberOfTuples() and
- *         \a this->getNumberOfComponents() != \a other->getNumberOfComponents() and
- *         \a other has number of both tuples and components not equal to 1.
+ * Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class.
+ * Server side.
  */
-void DataArrayDouble::substractEqual(const DataArrayDouble *other)
+void DataArrayDouble::getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const
 {
-  if(!other)
-    throw INTERP_KERNEL::Exception("DataArrayDouble::substractEqual : input DataArrayDouble instance is NULL !");
-  const char *msg="Nb of tuples mismatch for DataArrayDouble::substractEqual  !";
-  checkAllocated();
-  other->checkAllocated();
-  int nbOfTuple=getNumberOfTuples();
-  int nbOfTuple2=other->getNumberOfTuples();
-  int nbOfComp=getNumberOfComponents();
-  int nbOfComp2=other->getNumberOfComponents();
-  if(nbOfTuple==nbOfTuple2)
+  if(isAllocated())
     {
-      if(nbOfComp==nbOfComp2)
-        {
-          std::transform(begin(),end(),other->begin(),getPointer(),std::minus<double>());
-        }
-      else if(nbOfComp2==1)
-        {
-          double *ptr=getPointer();
-          const double *ptrc=other->getConstPointer();
-          for(int i=0;i<nbOfTuple;i++)
-            std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptr+i*nbOfComp,std::bind2nd(std::minus<double>(),*ptrc++)); 
-        }
-      else
-        throw INTERP_KERNEL::Exception(msg);
+      int nbOfCompo=getNumberOfComponents();
+      tinyInfo.resize(nbOfCompo+1);
+      tinyInfo[0]=getName();
+      for(int i=0;i<nbOfCompo;i++)
+        tinyInfo[i+1]=getInfoOnComponent(i);
     }
-  else if(nbOfTuple2==1)
+  else
     {
-      if(nbOfComp2==nbOfComp)
-        {
-          double *ptr=getPointer();
-          const double *ptrc=other->getConstPointer();
-          for(int i=0;i<nbOfTuple;i++)
-            std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptrc,ptr+i*nbOfComp,std::minus<double>());
-        }
-      else
-        throw INTERP_KERNEL::Exception(msg);
+      tinyInfo.resize(1);
+      tinyInfo[0]=getName();
     }
-  else
-    throw INTERP_KERNEL::Exception(msg);
-  declareAsNew();
 }
 
 /*!
- * Returns a new DataArrayDouble that is a product of two given arrays. There are 3
- * valid cases.
- * 1.  The arrays have same number of tuples and components. Then each value of
- *   the result array (_a_) is a product of the corresponding values of \a a1 and
- *   \a a2, i.e. _a_ [ i, j ] = _a1_ [ i, j ] * _a2_ [ i, j ].
- * 2.  The arrays have same number of tuples and one array, say _a2_, has one
- *   component. Then
- *   _a_ [ i, j ] = _a1_ [ i, j ] * _a2_ [ i, 0 ].
- * 3.  The arrays have same number of components and one array, say _a2_, has one
- *   tuple. Then
- *   _a_ [ i, j ] = _a1_ [ i, j ] * _a2_ [ 0, j ].
- *
- * Info on components is copied either from the first array (in the first case) or from
- * the array with maximal number of elements (getNbOfElems()).
- *  \param [in] a1 - a factor array.
- *  \param [in] a2 - another factor array.
- *  \return DataArrayDouble * - the new instance of DataArrayDouble.
- *          The caller is to delete this result array using decrRef() as it is no more
- *          needed.
- *  \throw If either \a a1 or \a a2 is NULL.
- *  \throw If \a a1->getNumberOfTuples() != \a a2->getNumberOfTuples() and
- *         \a a1->getNumberOfComponents() != \a a2->getNumberOfComponents() and
- *         none of them has number of tuples or components equal to 1.
+ * Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class.
+ * This method returns if a feeding is needed.
  */
-DataArrayDouble *DataArrayDouble::Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2)
+bool DataArrayDouble::resizeForUnserialization(const std::vector<int>& tinyInfoI)
 {
-  if(!a1 || !a2)
-    throw INTERP_KERNEL::Exception("DataArrayDouble::Multiply : input DataArrayDouble instance is NULL !");
-  int nbOfTuple=a1->getNumberOfTuples();
-  int nbOfTuple2=a2->getNumberOfTuples();
-  int nbOfComp=a1->getNumberOfComponents();
-  int nbOfComp2=a2->getNumberOfComponents();
-  MCAuto<DataArrayDouble> ret=0;
-  if(nbOfTuple==nbOfTuple2)
+  int nbOfTuple=tinyInfoI[0];
+  int nbOfComp=tinyInfoI[1];
+  if(nbOfTuple!=-1 || nbOfComp!=-1)
     {
-      if(nbOfComp==nbOfComp2)
-        {
-          ret=DataArrayDouble::New();
-          ret->alloc(nbOfTuple,nbOfComp);
-          std::transform(a1->begin(),a1->end(),a2->begin(),ret->getPointer(),std::multiplies<double>());
-          ret->copyStringInfoFrom(*a1);
-        }
-      else
-        {
-          int nbOfCompMin,nbOfCompMax;
-          const DataArrayDouble *aMin, *aMax;
-          if(nbOfComp>nbOfComp2)
-            {
-              nbOfCompMin=nbOfComp2; nbOfCompMax=nbOfComp;
-              aMin=a2; aMax=a1;
-            }
-          else
-            {
-              nbOfCompMin=nbOfComp; nbOfCompMax=nbOfComp2;
-              aMin=a1; aMax=a2;
-            }
-          if(nbOfCompMin==1)
-            {
-              ret=DataArrayDouble::New();
-              ret->alloc(nbOfTuple,nbOfCompMax);
-              const double *aMinPtr=aMin->getConstPointer();
-              const double *aMaxPtr=aMax->getConstPointer();
-              double *res=ret->getPointer();
-              for(int i=0;i<nbOfTuple;i++)
-                res=std::transform(aMaxPtr+i*nbOfCompMax,aMaxPtr+(i+1)*nbOfCompMax,res,std::bind2nd(std::multiplies<double>(),aMinPtr[i]));
-              ret->copyStringInfoFrom(*aMax);
-            }
-          else
-            throw INTERP_KERNEL::Exception("Nb of components mismatch for array Multiply !");
-        }
+      alloc(nbOfTuple,nbOfComp);
+      return true;
     }
-  else if((nbOfTuple==1 && nbOfTuple2>1) || (nbOfTuple>1 && nbOfTuple2==1))
+  return false;
+}
+
+/*!
+ * Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class.
+ */
+void DataArrayDouble::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<std::string>& tinyInfoS)
+{
+  setName(tinyInfoS[0]);
+  if(isAllocated())
     {
-      if(nbOfComp==nbOfComp2)
-        {
-          int nbOfTupleMax=std::max(nbOfTuple,nbOfTuple2);
-          const DataArrayDouble *aMin=nbOfTuple>nbOfTuple2?a2:a1;
-          const DataArrayDouble *aMax=nbOfTuple>nbOfTuple2?a1:a2;
-          const double *aMinPtr=aMin->getConstPointer(),*aMaxPtr=aMax->getConstPointer();
-          ret=DataArrayDouble::New();
-          ret->alloc(nbOfTupleMax,nbOfComp);
-          double *res=ret->getPointer();
-          for(int i=0;i<nbOfTupleMax;i++)
-            res=std::transform(aMaxPtr+i*nbOfComp,aMaxPtr+(i+1)*nbOfComp,aMinPtr,res,std::multiplies<double>());
-          ret->copyStringInfoFrom(*aMax);
-        }
-      else
-        throw INTERP_KERNEL::Exception("Nb of components mismatch for array Multiply !");
+      int nbOfCompo=getNumberOfComponents();
+      for(int i=0;i<nbOfCompo;i++)
+        setInfoOnComponent(i,tinyInfoS[i+1]);
     }
-  else
-    throw INTERP_KERNEL::Exception("Nb of tuples mismatch for array Multiply !");
-  return ret.retn();
 }
 
 /*!
- * Multiply values of another DataArrayDouble to values of \a this one. There are 3
- * valid cases.
- * 1.  The arrays have same number of tuples and components. Then each value of
- *   \a other array is multiplied to the corresponding value of \a this array, i.e.
- *   _this_ [ i, j ] *= _other_ [ i, j ].
- * 2.  The arrays have same number of tuples and \a other array has one component. Then
- *   _this_ [ i, j ] *= _other_ [ i, 0 ].
- * 3.  The arrays have same number of components and \a other array has one tuple. Then
- *   _this_ [ i, j ] *= _a2_ [ 0, j ].
- *
- *  \param [in] other - an array to multiply to \a this one.
- *  \throw If \a other is NULL.
- *  \throw If \a this->getNumberOfTuples() != \a other->getNumberOfTuples() and
- *         \a this->getNumberOfComponents() != \a other->getNumberOfComponents() and
- *         \a other has number of both tuples and components not equal to 1.
+ * Low static method that operates 3D rotation of 'nbNodes' 3D nodes whose coordinates are arranged in \a coordsIn
+ * around an axe ( \a center, \a vect) and with angle \a angle.
  */
-void DataArrayDouble::multiplyEqual(const DataArrayDouble *other)
-{
-  if(!other)
-    throw INTERP_KERNEL::Exception("DataArrayDouble::multiplyEqual : input DataArrayDouble instance is NULL !");
-  const char *msg="Nb of tuples mismatch for DataArrayDouble::multiplyEqual !";
-  checkAllocated();
-  other->checkAllocated();
-  int nbOfTuple=getNumberOfTuples();
-  int nbOfTuple2=other->getNumberOfTuples();
-  int nbOfComp=getNumberOfComponents();
-  int nbOfComp2=other->getNumberOfComponents();
-  if(nbOfTuple==nbOfTuple2)
-    {
-      if(nbOfComp==nbOfComp2)
-        {
-          std::transform(begin(),end(),other->begin(),getPointer(),std::multiplies<double>());
-        }
-      else if(nbOfComp2==1)
-        {
-          double *ptr=getPointer();
-          const double *ptrc=other->getConstPointer();
-          for(int i=0;i<nbOfTuple;i++)
-            std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptr+i*nbOfComp,std::bind2nd(std::multiplies<double>(),*ptrc++));
-        }
-      else
-        throw INTERP_KERNEL::Exception(msg);
-    }
-  else if(nbOfTuple2==1)
-    {
-      if(nbOfComp2==nbOfComp)
-        {
-          double *ptr=getPointer();
-          const double *ptrc=other->getConstPointer();
-          for(int i=0;i<nbOfTuple;i++)
-            std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptrc,ptr+i*nbOfComp,std::multiplies<double>());
-        }
-      else
-        throw INTERP_KERNEL::Exception(msg);
-    }
-  else
-    throw INTERP_KERNEL::Exception(msg);
-  declareAsNew();
-}
-
-/*!
- * Returns a new DataArrayDouble that is a division of two given arrays. There are 3
- * valid cases.
- * 1.  The arrays have same number of tuples and components. Then each value of
- *   the result array (_a_) is a division of the corresponding values of \a a1 and
- *   \a a2, i.e.: _a_ [ i, j ] = _a1_ [ i, j ] / _a2_ [ i, j ].
- * 2.  The arrays have same number of tuples and one array, say _a2_, has one
- *   component. Then
- *   _a_ [ i, j ] = _a1_ [ i, j ] / _a2_ [ i, 0 ].
- * 3.  The arrays have same number of components and one array, say _a2_, has one
- *   tuple. Then
- *   _a_ [ i, j ] = _a1_ [ i, j ] / _a2_ [ 0, j ].
- *
- * Info on components is copied either from the first array (in the first case) or from
- * the array with maximal number of elements (getNbOfElems()).
- *  \warning No check of division by zero is performed!
- *  \param [in] a1 - a numerator array.
- *  \param [in] a2 - a denominator array.
- *  \return DataArrayDouble * - the new instance of DataArrayDouble.
- *          The caller is to delete this result array using decrRef() as it is no more
- *          needed.
- *  \throw If either \a a1 or \a a2 is NULL.
- *  \throw If \a a1->getNumberOfTuples() != \a a2->getNumberOfTuples() and
- *         \a a1->getNumberOfComponents() != \a a2->getNumberOfComponents() and
- *         none of them has number of tuples or components equal to 1.
- */
-DataArrayDouble *DataArrayDouble::Divide(const DataArrayDouble *a1, const DataArrayDouble *a2)
-{
-  if(!a1 || !a2)
-    throw INTERP_KERNEL::Exception("DataArrayDouble::Divide : input DataArrayDouble instance is NULL !");
-  int nbOfTuple1=a1->getNumberOfTuples();
-  int nbOfTuple2=a2->getNumberOfTuples();
-  int nbOfComp1=a1->getNumberOfComponents();
-  int nbOfComp2=a2->getNumberOfComponents();
-  if(nbOfTuple2==nbOfTuple1)
-    {
-      if(nbOfComp1==nbOfComp2)
-        {
-          MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
-          ret->alloc(nbOfTuple2,nbOfComp1);
-          std::transform(a1->begin(),a1->end(),a2->begin(),ret->getPointer(),std::divides<double>());
-          ret->copyStringInfoFrom(*a1);
-          return ret.retn();
-        }
-      else if(nbOfComp2==1)
-        {
-          MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
-          ret->alloc(nbOfTuple1,nbOfComp1);
-          const double *a2Ptr=a2->getConstPointer();
-          const double *a1Ptr=a1->getConstPointer();
-          double *res=ret->getPointer();
-          for(int i=0;i<nbOfTuple1;i++)
-            res=std::transform(a1Ptr+i*nbOfComp1,a1Ptr+(i+1)*nbOfComp1,res,std::bind2nd(std::divides<double>(),a2Ptr[i]));
-          ret->copyStringInfoFrom(*a1);
-          return ret.retn();
-        }
-      else
-        {
-          a1->checkNbOfComps(nbOfComp2,"Nb of components mismatch for array Divide !");
-          return 0;
-        }
-    }
-  else if(nbOfTuple2==1)
-    {
-      a1->checkNbOfComps(nbOfComp2,"Nb of components mismatch for array Divide !");
-      MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
-      ret->alloc(nbOfTuple1,nbOfComp1);
-      const double *a1ptr=a1->getConstPointer(),*a2ptr=a2->getConstPointer();
-      double *pt=ret->getPointer();
-      for(int i=0;i<nbOfTuple1;i++)
-        pt=std::transform(a1ptr+i*nbOfComp1,a1ptr+(i+1)*nbOfComp1,a2ptr,pt,std::divides<double>());
-      ret->copyStringInfoFrom(*a1);
-      return ret.retn();
-    }
-  else
-    {
-      a1->checkNbOfTuples(nbOfTuple2,"Nb of tuples mismatch for array Divide !");//will always throw an exception
-      return 0;
-    }
-}
-
-/*!
- * Divide values of \a this array by values of another DataArrayDouble. There are 3
- * valid cases.
- * 1.  The arrays have same number of tuples and components. Then each value of
- *    \a this array is divided by the corresponding value of \a other one, i.e.:
- *   _a_ [ i, j ] /= _other_ [ i, j ].
- * 2.  The arrays have same number of tuples and \a other array has one component. Then
- *   _a_ [ i, j ] /= _other_ [ i, 0 ].
- * 3.  The arrays have same number of components and \a other array has one tuple. Then
- *   _a_ [ i, j ] /= _a2_ [ 0, j ].
- *
- *  \warning No check of division by zero is performed!
- *  \param [in] other - an array to divide \a this one by.
- *  \throw If \a other is NULL.
- *  \throw If \a this->getNumberOfTuples() != \a other->getNumberOfTuples() and
- *         \a this->getNumberOfComponents() != \a other->getNumberOfComponents() and
- *         \a other has number of both tuples and components not equal to 1.
- */
-void DataArrayDouble::divideEqual(const DataArrayDouble *other)
-{
-  if(!other)
-    throw INTERP_KERNEL::Exception("DataArrayDouble::divideEqual : input DataArrayDouble instance is NULL !");
-  const char *msg="Nb of tuples mismatch for DataArrayDouble::divideEqual !";
-  checkAllocated();
-  other->checkAllocated();
-  int nbOfTuple=getNumberOfTuples();
-  int nbOfTuple2=other->getNumberOfTuples();
-  int nbOfComp=getNumberOfComponents();
-  int nbOfComp2=other->getNumberOfComponents();
-  if(nbOfTuple==nbOfTuple2)
-    {
-      if(nbOfComp==nbOfComp2)
-        {
-          std::transform(begin(),end(),other->begin(),getPointer(),std::divides<double>());
-        }
-      else if(nbOfComp2==1)
-        {
-          double *ptr=getPointer();
-          const double *ptrc=other->getConstPointer();
-          for(int i=0;i<nbOfTuple;i++)
-            std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptr+i*nbOfComp,std::bind2nd(std::divides<double>(),*ptrc++));
-        }
-      else
-        throw INTERP_KERNEL::Exception(msg);
-    }
-  else if(nbOfTuple2==1)
-    {
-      if(nbOfComp2==nbOfComp)
-        {
-          double *ptr=getPointer();
-          const double *ptrc=other->getConstPointer();
-          for(int i=0;i<nbOfTuple;i++)
-            std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptrc,ptr+i*nbOfComp,std::divides<double>());
-        }
-      else
-        throw INTERP_KERNEL::Exception(msg);
-    }
-  else
-    throw INTERP_KERNEL::Exception(msg);
-  declareAsNew();
-}
-
-/*!
- * Returns a new DataArrayDouble that is the result of pow of two given arrays. There are 3
- * valid cases.
- *
- *  \param [in] a1 - an array to pow up.
- *  \param [in] a2 - another array to sum up.
- *  \return DataArrayDouble * - the new instance of DataArrayDouble.
- *          The caller is to delete this result array using decrRef() as it is no more
- *          needed.
- *  \throw If either \a a1 or \a a2 is NULL.
- *  \throw If \a a1->getNumberOfTuples() != \a a2->getNumberOfTuples()
- *  \throw If \a a1->getNumberOfComponents() != 1 or \a a2->getNumberOfComponents() != 1.
- *  \throw If there is a negative value in \a a1.
- */
-DataArrayDouble *DataArrayDouble::Pow(const DataArrayDouble *a1, const DataArrayDouble *a2)
-{
-  if(!a1 || !a2)
-    throw INTERP_KERNEL::Exception("DataArrayDouble::Pow : at least one of input instances is null !");
-  int nbOfTuple=a1->getNumberOfTuples();
-  int nbOfTuple2=a2->getNumberOfTuples();
-  int nbOfComp=a1->getNumberOfComponents();
-  int nbOfComp2=a2->getNumberOfComponents();
-  if(nbOfTuple!=nbOfTuple2)
-    throw INTERP_KERNEL::Exception("DataArrayDouble::Pow : number of tuples mismatches !");
-  if(nbOfComp!=1 || nbOfComp2!=1)
-    throw INTERP_KERNEL::Exception("DataArrayDouble::Pow : number of components of both arrays must be equal to 1 !");
-  MCAuto<DataArrayDouble> ret=DataArrayDouble::New(); ret->alloc(nbOfTuple,1);
-  const double *ptr1(a1->begin()),*ptr2(a2->begin());
-  double *ptr=ret->getPointer();
-  for(int i=0;i<nbOfTuple;i++,ptr1++,ptr2++,ptr++)
-    {
-      if(*ptr1>=0)
-        {
-          *ptr=pow(*ptr1,*ptr2);
-        }
-      else
-        {
-          std::ostringstream oss; oss << "DataArrayDouble::Pow : on tuple #" << i << " of a1 value is < 0 (" << *ptr1 << ") !";
-          throw INTERP_KERNEL::Exception(oss.str().c_str());
-        }
-    }
-  return ret.retn();
-}
-
-/*!
- * Apply pow on values of another DataArrayDouble to values of \a this one.
- *
- *  \param [in] other - an array to pow to \a this one.
- *  \throw If \a other is NULL.
- *  \throw If \a this->getNumberOfTuples() != \a other->getNumberOfTuples()
- *  \throw If \a this->getNumberOfComponents() != 1 or \a other->getNumberOfComponents() != 1
- *  \throw If there is a negative value in \a this.
- */
-void DataArrayDouble::powEqual(const DataArrayDouble *other)
-{
-  if(!other)
-    throw INTERP_KERNEL::Exception("DataArrayDouble::powEqual : input instance is null !");
-  int nbOfTuple=getNumberOfTuples();
-  int nbOfTuple2=other->getNumberOfTuples();
-  int nbOfComp=getNumberOfComponents();
-  int nbOfComp2=other->getNumberOfComponents();
-  if(nbOfTuple!=nbOfTuple2)
-    throw INTERP_KERNEL::Exception("DataArrayDouble::powEqual : number of tuples mismatches !");
-  if(nbOfComp!=1 || nbOfComp2!=1)
-    throw INTERP_KERNEL::Exception("DataArrayDouble::powEqual : number of components of both arrays must be equal to 1 !");
-  double *ptr=getPointer();
-  const double *ptrc=other->begin();
-  for(int i=0;i<nbOfTuple;i++,ptrc++,ptr++)
-    {
-      if(*ptr>=0)
-        *ptr=pow(*ptr,*ptrc);
-      else
-        {
-          std::ostringstream oss; oss << "DataArrayDouble::powEqual : on tuple #" << i << " of this value is < 0 (" << *ptr << ") !";
-          throw INTERP_KERNEL::Exception(oss.str().c_str());
-        }
-    }
-  declareAsNew();
-}
-
-/*!
- * This method is \b NOT wrapped into python because it can be useful only for performance reasons in C++ context.
- * All values in \a this must be 0. or 1. within eps error. 0 means false, 1 means true.
- * If an another value than 0 or 1 appear (within eps precision) an INTERP_KERNEL::Exception will be thrown.
- *
- * \throw if \a this is not allocated.
- * \throw if \a this has not exactly one component.
- */
-std::vector<bool> DataArrayDouble::toVectorOfBool(double eps) const
-{
-  checkAllocated();
-  if(getNumberOfComponents()!=1)
-    throw INTERP_KERNEL::Exception("DataArrayDouble::toVectorOfBool : must be applied on single component array !");
-  int nbt(getNumberOfTuples());
-  std::vector<bool> ret(nbt);
-  const double *pt(begin());
-  for(int i=0;i<nbt;i++)
-    {
-      if(fabs(pt[i])<eps)
-        ret[i]=false;
-      else if(fabs(pt[i]-1.)<eps)
-        ret[i]=true;
-      else
-        {
-          std::ostringstream oss; oss << "DataArrayDouble::toVectorOfBool : the tuple #" << i << " has value " << pt[i] << " is invalid ! must be 0. or 1. !";
-          throw INTERP_KERNEL::Exception(oss.str().c_str());
-        }
-    }
-  return ret;
-}
-
-/*!
- * Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class.
- * Server side.
- */
-void DataArrayDouble::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
-{
-  tinyInfo.resize(2);
-  if(isAllocated())
-    {
-      tinyInfo[0]=getNumberOfTuples();
-      tinyInfo[1]=getNumberOfComponents();
-    }
-  else
-    {
-      tinyInfo[0]=-1;
-      tinyInfo[1]=-1;
-    }
-}
-
-/*!
- * Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class.
- * Server side.
- */
-void DataArrayDouble::getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const
-{
-  if(isAllocated())
-    {
-      int nbOfCompo=getNumberOfComponents();
-      tinyInfo.resize(nbOfCompo+1);
-      tinyInfo[0]=getName();
-      for(int i=0;i<nbOfCompo;i++)
-        tinyInfo[i+1]=getInfoOnComponent(i);
-    }
-  else
-    {
-      tinyInfo.resize(1);
-      tinyInfo[0]=getName();
-    }
-}
-
-/*!
- * Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class.
- * This method returns if a feeding is needed.
- */
-bool DataArrayDouble::resizeForUnserialization(const std::vector<int>& tinyInfoI)
-{
-  int nbOfTuple=tinyInfoI[0];
-  int nbOfComp=tinyInfoI[1];
-  if(nbOfTuple!=-1 || nbOfComp!=-1)
-    {
-      alloc(nbOfTuple,nbOfComp);
-      return true;
-    }
-  return false;
-}
-
-/*!
- * Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class.
- */
-void DataArrayDouble::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<std::string>& tinyInfoS)
-{
-  setName(tinyInfoS[0]);
-  if(isAllocated())
-    {
-      int nbOfCompo=getNumberOfComponents();
-      for(int i=0;i<nbOfCompo;i++)
-        setInfoOnComponent(i,tinyInfoS[i+1]);
-    }
-}
-
-/*!
- * Low static method that operates 3D rotation of 'nbNodes' 3D nodes whose coordinates are arranged in \a coordsIn
- * around an axe ( \a center, \a vect) and with angle \a angle.
- */
-void DataArrayDouble::Rotate3DAlg(const double *center, const double *vect, double angle, int nbNodes, const double *coordsIn, double *coordsOut)
+void DataArrayDouble::Rotate3DAlg(const double *center, const double *vect, double angle, int nbNodes, const double *coordsIn, double *coordsOut)
 {
   if(!center || !vect)
     throw INTERP_KERNEL::Exception("DataArrayDouble::Rotate3DAlg : null vector in input !");
@@ -4607,40 +3653,11 @@ void DataArrayDouble::Rotate2DAlg(const double *center, double angle, int nbNode
     }
 }
 
-DataArrayDoubleIterator::DataArrayDoubleIterator(DataArrayDouble *da):_da(da),_tuple_id(0),_nb_comp(0),_nb_tuple(0)
-{
-  if(_da)
-    {
-      _da->incrRef();
-      if(_da->isAllocated())
-        {
-          _nb_comp=da->getNumberOfComponents();
-          _nb_tuple=da->getNumberOfTuples();
-          _pt=da->getPointer();
-        }
-    }
-}
-
-DataArrayDoubleIterator::~DataArrayDoubleIterator()
+DataArrayDoubleIterator::DataArrayDoubleIterator(DataArrayDouble *da):DataArrayIterator<double>(da)
 {
-  if(_da)
-    _da->decrRef();
-}
-
-DataArrayDoubleTuple *DataArrayDoubleIterator::nextt()
-{
-  if(_tuple_id<_nb_tuple)
-    {
-      _tuple_id++;
-      DataArrayDoubleTuple *ret=new DataArrayDoubleTuple(_pt,_nb_comp);
-      _pt+=_nb_comp;
-      return ret;
-    }
-  else
-    return 0;
 }
 
-DataArrayDoubleTuple::DataArrayDoubleTuple(double *pt, int nbOfComp):_pt(pt),_nb_of_compo(nbOfComp)
+DataArrayDoubleTuple::DataArrayDoubleTuple(double *pt, int nbOfComp):DataArrayTuple<double>(pt,nbOfComp)
 {
 }
 
@@ -4656,9 +3673,7 @@ std::string DataArrayDoubleTuple::repr() const
 
 double DataArrayDoubleTuple::doubleValue() const
 {
-  if(_nb_of_compo==1)
-    return *_pt;
-  throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::doubleValue : DataArrayDoubleTuple instance has not exactly 1 component -> Not possible to convert it into a double precision float !");
+  return this->zeValue();
 }
 
 /*!
@@ -4669,18 +3684,7 @@ double DataArrayDoubleTuple::doubleValue() const
  */
 DataArrayDouble *DataArrayDoubleTuple::buildDADouble(int nbOfTuples, int nbOfCompo) const
 {
-  if((_nb_of_compo==nbOfCompo && nbOfTuples==1) || (_nb_of_compo==nbOfTuples && nbOfCompo==1))
-    {
-      DataArrayDouble *ret=DataArrayDouble::New();
-      ret->useExternalArrayWithRWAccess(_pt,nbOfTuples,nbOfCompo);
-      return ret;
-    }
-  else
-    {
-      std::ostringstream oss; oss << "DataArrayDoubleTuple::buildDADouble : unable to build a requested DataArrayDouble instance with nbofTuple=" << nbOfTuples << " and nbOfCompo=" << nbOfCompo;
-      oss << ".\nBecause the number of elements in this is " << _nb_of_compo << " !";
-      throw INTERP_KERNEL::Exception(oss.str().c_str());
-    }
+  return this->buildDA(nbOfTuples,nbOfCompo);
 }
 
 /*!
@@ -4739,27 +3743,9 @@ int DataArrayInt::getHashCode() const
  * \ref MEDCouplingArrayBasicsCopyDeep.
  *  \return DataArrayInt * - a new instance of DataArrayInt.
  */
-DataArrayInt *DataArrayInt::deepCopy() const
-{
-  return new DataArrayInt(*this);
-}
-
-/*!
- * Returns either a \a deep or \a shallow copy of this array. For more info see
- * \ref MEDCouplingArrayBasicsCopyDeep and \ref MEDCouplingArrayBasicsCopyShallow.
- *  \param [in] dCpy - if \a true, a deep copy is returned, else, a shallow one.
- *  \return DataArrayInt * - either a new instance of DataArrayInt (if \a dCpy
- *          == \a true) or \a this instance (if \a dCpy == \a false).
- */
-DataArrayInt *DataArrayInt::performCopyOrIncrRef(bool dCpy) const
+DataArrayInt32 *DataArrayInt32::deepCopy() const
 {
-  if(dCpy)
-    return deepCopy();
-  else
-    {
-      incrRef();
-      return const_cast<DataArrayInt *>(this);
-    }
+  return new DataArrayInt32(*this);
 }
 
 /*!
@@ -4977,38 +3963,6 @@ void DataArrayInt::reprQuickOverviewData(std::ostream& stream, std::size_t maxNb
   stream << "]";
 }
 
-/*!
- * Modifies in place \a this one-dimensional array so that each value \a v = \a indArrBg[ \a v ],
- * i.e. a current value is used as in index to get a new value from \a indArrBg.
- *  \param [in] indArrBg - pointer to the first element of array of new values to assign
- *         to \a this array.
- *  \param [in] indArrEnd - specifies the end of the array \a indArrBg, so that
- *              the last value of \a indArrBg is \a indArrEnd[ -1 ].
- *  \throw If \a this->getNumberOfComponents() != 1
- *  \throw If any value of \a this can't be used as a valid index for 
- *         [\a indArrBg, \a indArrEnd).
- *
- *  \sa changeValue
- */
-void DataArrayInt::transformWithIndArr(const int *indArrBg, const int *indArrEnd)
-{
-  checkAllocated();
-  if(getNumberOfComponents()!=1)
-    throw INTERP_KERNEL::Exception("Call transformWithIndArr method on DataArrayInt with only one component, you can call 'rearrange' method before !");
-  int nbElemsIn((int)std::distance(indArrBg,indArrEnd)),nbOfTuples(getNumberOfTuples()),*pt(getPointer());
-  for(int i=0;i<nbOfTuples;i++,pt++)
-    {
-      if(*pt>=0 && *pt<nbElemsIn)
-        *pt=indArrBg[*pt];
-      else
-        {
-          std::ostringstream oss; oss << "DataArrayInt::transformWithIndArr : error on tuple #" << i << " of this value is " << *pt << ", should be in [0," << nbElemsIn << ") !";
-          throw INTERP_KERNEL::Exception(oss.str().c_str());
-        }
-    }
-  declareAsNew();
-}
-
 /*!
  * Computes distribution of values of \a this one-dimensional array between given value
  * ranges (casts). This method is typically useful for entity number spliting by types,
@@ -5155,6 +4109,60 @@ bool DataArrayInt::isRange(int& strt, int& sttoopp, int& stteepp) const
     }
 }
 
+
+/*!
+ * Modifies in place \a this one-dimensional array so that each value \a v = \a indArrBg[ \a v ],
+ * i.e. a current value is used as in index to get a new value from \a indArrBg.
+ *  \param [in] indArrBg - pointer to the first element of array of new values to assign
+ *         to \a this array.
+ *  \param [in] indArrEnd - specifies the end of the array \a indArrBg, so that
+ *              the last value of \a indArrBg is \a indArrEnd[ -1 ].
+ *  \throw If \a this->getNumberOfComponents() != 1
+ *  \throw If any value of \a this can't be used as a valid index for 
+ *         [\a indArrBg, \a indArrEnd).
+ *
+ *  \sa changeValue
+ */
+void DataArrayInt::transformWithIndArr(const int *indArrBg, const int *indArrEnd)
+{
+  this->checkAllocated();
+  if(this->getNumberOfComponents()!=1)
+    throw INTERP_KERNEL::Exception("Call transformWithIndArr method on DataArrayInt with only one component, you can call 'rearrange' method before !");
+  int nbElemsIn((int)std::distance(indArrBg,indArrEnd)),nbOfTuples(getNumberOfTuples()),*pt(getPointer());
+  for(int i=0;i<nbOfTuples;i++,pt++)
+    {
+      if(*pt>=0 && *pt<nbElemsIn)
+        *pt=indArrBg[*pt];
+      else
+        {
+          std::ostringstream oss; oss << "DataArrayInt::transformWithIndArr : error on tuple #" << i << " of this value is " << *pt << ", should be in [0," << nbElemsIn << ") !";
+          throw INTERP_KERNEL::Exception(oss.str().c_str());
+        }
+    }
+  this->declareAsNew();
+}
+
+void DataArrayInt::transformWithIndArr(const MapKeyVal<int>& m)
+{
+  this->checkAllocated();
+  if(this->getNumberOfComponents()!=1)
+    throw INTERP_KERNEL::Exception("Call transformWithIndArr method on DataArrayInt with only one component, you can call 'rearrange' method before !");
+  const std::map<int,int> dat(m.data());
+  int nbOfTuples(getNumberOfTuples()),*pt(getPointer());
+  for(int i=0;i<nbOfTuples;i++,pt++)
+    {
+      std::map<int,int>::const_iterator it(dat.find(*pt));
+      if(it!=dat.end())
+        *pt=(*it).second;
+      else
+        {
+          std::ostringstream oss; oss << "DataArrayInt::transformWithIndArr : error on tuple #" << i << " of this value is " << *pt << " not in map !";
+          throw INTERP_KERNEL::Exception(oss.str().c_str());
+        }
+    }
+  this->declareAsNew();
+}
+
 /*!
  * Creates a one-dimensional DataArrayInt (\a res) whose contents are computed from 
  * values of \a this (\a a) and the given (\a indArr) arrays as follows:
@@ -5222,11 +4230,11 @@ DataArrayInt *DataArrayInt::transformWithIndArrR(const int *indArrBg, const int
  */
 DataArrayInt *DataArrayInt::invertArrayO2N2N2O(int newNbOfElem) const
 {
-  MCAuto<DataArrayInt> ret=DataArrayInt::New();
+  MCAuto<DataArrayInt> ret(DataArrayInt::New());
   ret->alloc(newNbOfElem,1);
-  int nbOfOldNodes=getNumberOfTuples();
-  const int *old2New=getConstPointer();
-  int *pt=ret->getPointer();
+  int nbOfOldNodes(this->getNumberOfTuples());
+  const int *old2New(begin());
+  int *pt(ret->getPointer());
   for(int i=0;i!=nbOfOldNodes;i++)
     {
       int newp(old2New[i]);
@@ -5266,192 +4274,80 @@ DataArrayInt *DataArrayInt::invertArrayO2N2N2OBis(int newNbOfElem) const
             {
               std::ostringstream oss; oss << "DataArrayInt::invertArrayO2N2N2OBis : At place #" << i << " the newplace is " << newp << " must be in [0," << newNbOfElem << ") !";
               throw INTERP_KERNEL::Exception(oss.str().c_str());
-            }
-        }
-    }
-  return ret.retn();
-}
-
-/*!
- * Creates a one-dimensional DataArrayInt of given length, whose contents are computed
- * from values of \a this array, which is supposed to contain a renumbering map in 
- * "New to Old" mode. The result array contains a renumbering map in "Old to New" mode.
- * To know how to use the renumbering maps see \ref numbering.
- *  \param [in] newNbOfElem - the number of tuples in the result array.
- *  \return DataArrayInt * - the new instance of DataArrayInt.
- *          The caller is to delete this result array using decrRef() as it is no more
- *          needed.
- * 
- *  \if ENABLE_EXAMPLES
- *  \ref cpp_mcdataarrayint_invertarrayn2o2o2n "Here is a C++ example".
- *
- *  \ref py_mcdataarrayint_invertarrayn2o2o2n "Here is a Python example".
- *  \endif
- */
-DataArrayInt *DataArrayInt::invertArrayN2O2O2N(int oldNbOfElem) const
-{
-  checkAllocated();
-  MCAuto<DataArrayInt> ret=DataArrayInt::New();
-  ret->alloc(oldNbOfElem,1);
-  const int *new2Old=getConstPointer();
-  int *pt=ret->getPointer();
-  std::fill(pt,pt+oldNbOfElem,-1);
-  int nbOfNewElems=getNumberOfTuples();
-  for(int i=0;i<nbOfNewElems;i++)
-    {
-      int v(new2Old[i]);
-      if(v>=0 && v<oldNbOfElem)
-        pt[v]=i;
-      else
-        {
-          std::ostringstream oss; oss << "DataArrayInt::invertArrayN2O2O2N : in new id #" << i << " old value is " << v << " expected to be in [0," << oldNbOfElem << ") !";
-          throw INTERP_KERNEL::Exception(oss.str().c_str());
-        }
-    }
-  return ret.retn();
-}
-
-/*!
- * Equivalent to DataArrayInt::isEqual except that if false the reason of
- * mismatch is given.
- * 
- * \param [in] other the instance to be compared with \a this
- * \param [out] reason In case of inequality returns the reason.
- * \sa DataArrayInt::isEqual
- */
-bool DataArrayInt::isEqualIfNotWhy(const DataArrayInt& other, std::string& reason) const
-{
-  if(!areInfoEqualsIfNotWhy(other,reason))
-    return false;
-  return _mem.isEqual(other._mem,0,reason);
-}
-
-/*!
- * Checks if \a this and another DataArrayInt are fully equal. For more info see
- * \ref MEDCouplingArrayBasicsCompare.
- *  \param [in] other - an instance of DataArrayInt to compare with \a this one.
- *  \return bool - \a true if the two arrays are equal, \a false else.
- */
-bool DataArrayInt::isEqual(const DataArrayInt& other) const
-{
-  std::string tmp;
-  return isEqualIfNotWhy(other,tmp);
-}
-
-/*!
- * Checks if values of \a this and another DataArrayInt are equal. For more info see
- * \ref MEDCouplingArrayBasicsCompare.
- *  \param [in] other - an instance of DataArrayInt to compare with \a this one.
- *  \return bool - \a true if the values of two arrays are equal, \a false else.
- */
-bool DataArrayInt::isEqualWithoutConsideringStr(const DataArrayInt& other) const
-{
-  std::string tmp;
-  return _mem.isEqual(other._mem,0,tmp);
-}
-
-/*!
- * Checks if values of \a this and another DataArrayInt are equal. Comparison is
- * performed on sorted value sequences.
- * For more info see\ref MEDCouplingArrayBasicsCompare.
- *  \param [in] other - an instance of DataArrayInt to compare with \a this one.
- *  \return bool - \a true if the sorted values of two arrays are equal, \a false else.
- */
-bool DataArrayInt::isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const
-{
-  MCAuto<DataArrayInt> a=deepCopy();
-  MCAuto<DataArrayInt> b=other.deepCopy();
-  a->sort();
-  b->sort();
-  return a->isEqualWithoutConsideringStr(*b);
-}
-
-/*!
- * This method compares content of input vector \a v and \a this.
- * If for each id in \a this v[id]==True and for all other ids id2 not in \a this v[id2]==False, true is returned.
- * For performance reasons \a this is expected to be sorted ascendingly. If not an exception will be thrown.
- *
- * \param [in] v - the vector of 'flags' to be compared with \a this.
- *
- * \throw If \a this is not sorted ascendingly.
- * \throw If \a this has not exactly one component.
- * \throw If \a this is not allocated.
- */
-bool DataArrayInt::isFittingWith(const std::vector<bool>& v) const
-{
-  checkAllocated();
-  if(getNumberOfComponents()!=1)
-    throw INTERP_KERNEL::Exception("DataArrayInt::isFittingWith : number of components of this should be equal to one !");
-  const int *w(begin()),*end2(end());
-  int refVal=-std::numeric_limits<int>::max();
-  int i=0;
-  std::vector<bool>::const_iterator it(v.begin());
-  for(;it!=v.end();it++,i++)
-    {
-      if(*it)
-        {
-          if(w!=end2)
-            {
-              if(*w++==i)
-                {
-                  if(i>refVal)
-                    refVal=i;
-                  else
-                    {
-                      std::ostringstream oss; oss << "DataArrayInt::isFittingWith : At pos #" << std::distance(begin(),w-1) << " this is not sorted ascendingly !";
-                      throw INTERP_KERNEL::Exception(oss.str().c_str());
-                    }
-                }
-              else
-                return false;
-            }
-          else
-            return false;
+            }
         }
     }
-  return w==end2;
+  return ret.retn();
 }
 
 /*!
- * This method assumes that \a this has one component and is allocated. This method scans all tuples in \a this and for all tuple equal to \a val
- * put True to the corresponding entry in \a vec.
- * \a vec is expected to be with the same size than the number of tuples of \a this.
+ * Creates a one-dimensional DataArrayInt of given length, whose contents are computed
+ * from values of \a this array, which is supposed to contain a renumbering map in 
+ * "New to Old" mode. The result array contains a renumbering map in "Old to New" mode.
+ * To know how to use the renumbering maps see \ref numbering.
+ *  \param [in] newNbOfElem - the number of tuples in the result array.
+ *  \return DataArrayInt * - the new instance of DataArrayInt.
+ *          The caller is to delete this result array using decrRef() as it is no more
+ *          needed.
+ * 
+ *  \if ENABLE_EXAMPLES
+ *  \ref cpp_mcdataarrayint_invertarrayn2o2o2n "Here is a C++ example".
  *
- *  \sa DataArrayInt::switchOnTupleNotEqualTo.
+ *  \ref py_mcdataarrayint_invertarrayn2o2o2n "Here is a Python example".
+ *  \sa invertArrayN2O2O2NOptimized
+ *  \endif
  */
-void DataArrayInt::switchOnTupleEqualTo(int val, std::vector<bool>& vec) const
+DataArrayInt *DataArrayInt::invertArrayN2O2O2N(int oldNbOfElem) const
 {
   checkAllocated();
-  if(getNumberOfComponents()!=1)
-    throw INTERP_KERNEL::Exception("DataArrayInt::switchOnTupleEqualTo : number of components of this should be equal to one !");
-  int nbOfTuples(getNumberOfTuples());
-  if(nbOfTuples!=(int)vec.size())
-    throw INTERP_KERNEL::Exception("DataArrayInt::switchOnTupleEqualTo : number of tuples of this should be equal to size of input vector of bool !");
-  const int *pt(begin());
-  for(int i=0;i<nbOfTuples;i++)
-    if(pt[i]==val)
-      vec[i]=true;
+  MCAuto<DataArrayInt> ret=DataArrayInt::New();
+  ret->alloc(oldNbOfElem,1);
+  const int *new2Old=getConstPointer();
+  int *pt=ret->getPointer();
+  std::fill(pt,pt+oldNbOfElem,-1);
+  int nbOfNewElems=getNumberOfTuples();
+  for(int i=0;i<nbOfNewElems;i++)
+    {
+      int v(new2Old[i]);
+      if(v>=0 && v<oldNbOfElem)
+        pt[v]=i;
+      else
+        {
+          std::ostringstream oss; oss << "DataArrayInt::invertArrayN2O2O2N : in new id #" << i << " old value is " << v << " expected to be in [0," << oldNbOfElem << ") !";
+          throw INTERP_KERNEL::Exception(oss.str().c_str());
+        }
+    }
+  return ret.retn();
 }
 
 /*!
- * This method assumes that \a this has one component and is allocated. This method scans all tuples in \a this and for all tuple different from \a val
- * put True to the corresponding entry in \a vec.
- * \a vec is expected to be with the same size than the number of tuples of \a this.
+ * Creates a map, whose contents are computed
+ * from values of \a this array, which is supposed to contain a renumbering map in 
+ * "New to Old" mode. The result array contains a renumbering map in "Old to New" mode.
+ * To know how to use the renumbering maps see \ref numbering.
+ *  \param [in] newNbOfElem - the number of tuples in the result array.
+ *  \return MapII  - the new instance of Map.
  * 
- *  \sa DataArrayInt::switchOnTupleEqualTo.
+ *  \if ENABLE_EXAMPLES
+ *  \ref cpp_mcdataarrayint_invertarrayn2o2o2n "Here is a C++ example".
+ *
+ *  \ref py_mcdataarrayint_invertarrayn2o2o2n "Here is a Python example".
+ *  \sa invertArrayN2O2O2N
+ *  \endif
  */
-void DataArrayInt::switchOnTupleNotEqualTo(int val, std::vector<bool>& vec) const
+MCAuto< MapKeyVal<int> > DataArrayInt::invertArrayN2O2O2NOptimized() const
 {
   checkAllocated();
-  if(getNumberOfComponents()!=1)
-    throw INTERP_KERNEL::Exception("DataArrayInt::switchOnTupleNotEqualTo : number of components of this should be equal to one !");
-  int nbOfTuples(getNumberOfTuples());
-  if(nbOfTuples!=(int)vec.size())
-    throw INTERP_KERNEL::Exception("DataArrayInt::switchOnTupleNotEqualTo : number of tuples of this should be equal to size of input vector of bool !");
-  const int *pt(begin());
-  for(int i=0;i<nbOfTuples;i++)
-    if(pt[i]!=val)
-      vec[i]=true;
+  MCAuto< MapKeyVal<int> > ret(MapKeyVal<int>::New());
+  std::map<int,int>& m(ret->data());
+  const int *new2Old(begin());
+  int nbOfNewElems(this->getNumberOfTuples());
+  for(int i=0;i<nbOfNewElems;i++)
+    {
+      int v(new2Old[i]);
+      m[v]=i;
+    }
+  return ret;
 }
 
 /*!
@@ -5664,7 +4560,7 @@ DataArrayInt *DataArrayInt::indicesOfSubPart(const DataArrayInt& partOfThis) con
   std::map<int,int> m;
   for(int i=0;i<thisNbTuples;i++,thisPt++)
     m[*thisPt]=i;
-  if(m.size()!=thisNbTuples)
+  if((int)m.size()!=thisNbTuples)
     throw INTERP_KERNEL::Exception("DataArrayInt::indicesOfSubPart : some elements appears more than once !");
   for(int i=0;i<nbTuples;i++,retPt++,pt++)
     {
@@ -5680,57 +4576,6 @@ DataArrayInt *DataArrayInt::indicesOfSubPart(const DataArrayInt& partOfThis) con
   return ret.retn();
 }
 
-void DataArrayInt::aggregate(const DataArrayInt *other)
-{
-  if(!other)
-    throw INTERP_KERNEL::Exception("DataArrayInt::aggregate : null pointer !");
-  if(getNumberOfComponents()!=other->getNumberOfComponents())
-    throw INTERP_KERNEL::Exception("DataArrayInt::aggregate : mismatch number of components !");
-  _mem.insertAtTheEnd(other->begin(),other->end());
-}
-
-/*!
- * Returns a new DataArrayInt holding the same values as \a this array but differently
- * arranged in memory. If \a this array holds 2 components of 3 values:
- * \f$ x_0,x_1,x_2,y_0,y_1,y_2 \f$, then the result array holds these values arranged
- * as follows: \f$ x_0,y_0,x_1,y_1,x_2,y_2 \f$.
- *  \warning Do not confuse this method with transpose()!
- *  \return DataArrayInt * - the new instance of DataArrayInt that the caller
- *          is to delete using decrRef() as it is no more needed.
- *  \throw If \a this is not allocated.
- */
-DataArrayInt *DataArrayInt::fromNoInterlace() const
-{
-  checkAllocated();
-  if(_mem.isNull())
-    throw INTERP_KERNEL::Exception("DataArrayInt::fromNoInterlace : Not defined array !");
-  int *tab=_mem.fromNoInterlace(getNumberOfComponents());
-  DataArrayInt *ret=DataArrayInt::New();
-  ret->useArray(tab,true,C_DEALLOC,getNumberOfTuples(),getNumberOfComponents());
-  return ret;
-}
-
-/*!
- * Returns a new DataArrayInt holding the same values as \a this array but differently
- * arranged in memory. If \a this array holds 2 components of 3 values:
- * \f$ x_0,y_0,x_1,y_1,x_2,y_2 \f$, then the result array holds these values arranged
- * as follows: \f$ x_0,x_1,x_2,y_0,y_1,y_2 \f$.
- *  \warning Do not confuse this method with transpose()!
- *  \return DataArrayInt * - the new instance of DataArrayInt that the caller
- *          is to delete using decrRef() as it is no more needed.
- *  \throw If \a this is not allocated.
- */
-DataArrayInt *DataArrayInt::toNoInterlace() const
-{
-  checkAllocated();
-  if(_mem.isNull())
-    throw INTERP_KERNEL::Exception("DataArrayInt::toNoInterlace : Not defined array !");
-  int *tab=_mem.toNoInterlace(getNumberOfComponents());
-  DataArrayInt *ret=DataArrayInt::New();
-  ret->useArray(tab,true,C_DEALLOC,getNumberOfTuples(),getNumberOfComponents());
-  return ret;
-}
-
 /*!
  * Returns a new DataArrayInt containing a renumbering map in "Old to New" mode.
  * This map, if applied to \a this array, would make it sorted. For example, if
@@ -6019,21 +4864,45 @@ bool DataArrayInt::isIota(int sizeExpected) const
  *  \return bool - \a true if all values are \a val.
  *  \throw If \a this is not allocated.
  *  \throw If \a this->getNumberOfComponents() != 1
+ *  \sa DataArrayInt::checkUniformAndGuess
  */
 bool DataArrayInt::isUniform(int val) const
 {
   checkAllocated();
   if(getNumberOfComponents()!=1)
     throw INTERP_KERNEL::Exception("DataArrayInt::isUniform : must be applied on DataArrayInt with only one component, you can call 'rearrange' method before !");
-  int nbOfTuples=getNumberOfTuples();
-  const int *w=getConstPointer();
-  const int *end2=w+nbOfTuples;
+  const int *w(begin()),*end2(end());
   for(;w!=end2;w++)
     if(*w!=val)
       return false;
   return true;
 }
 
+/*!
+ * This method checks that \a this is uniform. If not and exception will be thrown.
+ * In case of uniformity the corresponding value is returned.
+ *
+ * \return int - the unique value contained in this
+ * \throw If \a this is not allocated.
+ * \throw If \a this->getNumberOfComponents() != 1
+ * \throw If \a this is not uniform.
+ * \sa DataArrayInt::isUniform
+ */
+int DataArrayInt::checkUniformAndGuess() const
+{
+  checkAllocated();
+  if(getNumberOfComponents()!=1)
+    throw INTERP_KERNEL::Exception("DataArrayInt::checkUniformAndGuess : must be applied on DataArrayInt with only one component, you can call 'rearrange' method before !");
+  if(empty())
+    throw INTERP_KERNEL::Exception("DataArrayInt::checkUniformAndGuess : this is empty !");
+  const int *w(begin()),*end2(end());
+  int ret(*w);
+  for(;w!=end2;w++)
+    if(*w!=ret)
+      throw INTERP_KERNEL::Exception("DataArrayInt::checkUniformAndGuess : this is not uniform !");
+  return ret;
+}
+
 /*!
  * Checks if all values in \a this array are unique.
  *  \return bool - \a true if condition above is true
@@ -6047,70 +4916,11 @@ bool DataArrayInt::hasUniqueValues() const
     throw INTERP_KERNEL::Exception("DataArrayInt::hasOnlyUniqueValues: must be applied on DataArrayInt with only one component, you can call 'rearrange' method before !");
   int nbOfTuples(getNumberOfTuples());
   std::set<int> s(begin(),end());  // in C++11, should use unordered_set (O(1) complexity)
-  if (s.size() != nbOfTuples)
+  if ((int)s.size() != nbOfTuples)
     return false;
   return true;
 }
 
-/*!
- * Creates a new DataArrayDouble and assigns all (textual and numerical) data of \a this
- * array to the new one.
- *  \return DataArrayDouble * - the new instance of DataArrayInt.
- */
-DataArrayDouble *DataArrayInt::convertToDblArr() const
-{
-  checkAllocated();
-  DataArrayDouble *ret=DataArrayDouble::New();
-  ret->alloc(getNumberOfTuples(),getNumberOfComponents());
-  std::size_t nbOfVals=getNbOfElems();
-  const int *src=getConstPointer();
-  double *dest=ret->getPointer();
-  std::copy(src,src+nbOfVals,dest);
-  ret->copyStringInfoFrom(*this);
-  return ret;
-}
-
-/*!
- * Appends components of another array to components of \a this one, tuple by tuple.
- * So that the number of tuples of \a this array remains the same and the number of 
- * components increases.
- *  \param [in] other - the DataArrayInt to append to \a this one.
- *  \throw If \a this is not allocated.
- *  \throw If \a this and \a other arrays have different number of tuples.
- *
- *  \if ENABLE_EXAMPLES
- *  \ref cpp_mcdataarrayint_meldwith "Here is a C++ example".
- *
- *  \ref py_mcdataarrayint_meldwith "Here is a Python example".
- *  \endif
- */
-void DataArrayInt::meldWith(const DataArrayInt *other)
-{
-  if(!other)
-    throw INTERP_KERNEL::Exception("DataArrayInt::meldWith : DataArrayInt pointer in input is NULL !");
-  checkAllocated();
-  other->checkAllocated();
-  int nbOfTuples=getNumberOfTuples();
-  if(nbOfTuples!=other->getNumberOfTuples())
-    throw INTERP_KERNEL::Exception("DataArrayInt::meldWith : mismatch of number of tuples !");
-  int nbOfComp1=getNumberOfComponents();
-  int nbOfComp2=other->getNumberOfComponents();
-  int *newArr=(int *)malloc(nbOfTuples*(nbOfComp1+nbOfComp2)*sizeof(int));
-  int *w=newArr;
-  const int *inp1=getConstPointer();
-  const int *inp2=other->getConstPointer();
-  for(int i=0;i<nbOfTuples;i++,inp1+=nbOfComp1,inp2+=nbOfComp2)
-    {
-      w=std::copy(inp1,inp1+nbOfComp1,w);
-      w=std::copy(inp2,inp2+nbOfComp2,w);
-    }
-  useArray(newArr,true,C_DEALLOC,nbOfTuples,nbOfComp1+nbOfComp2);
-  std::vector<int> compIds(nbOfComp2);
-  for(int i=0;i<nbOfComp2;i++)
-    compIds[i]=nbOfComp1+i;
-  copyPartOfStringInfoFrom2(compIds,*other);
-}
-
 /*!
  * Copy all components in a specified order from another DataArrayInt.
  * The specified components become the first ones in \a this array.
@@ -6144,24 +4954,6 @@ void DataArrayInt::setSelectedComponents(const DataArrayInt *a, const std::vecto
       nc[nbOfCompo*i+compoIds[j]]=*ac;
 }
 
-/*!
- * Assign pointer to one array to a pointer to another appay. Reference counter of
- * \a arrayToSet is incremented / decremented.
- *  \param [in] newArray - the pointer to array to assign to \a arrayToSet.
- *  \param [in,out] arrayToSet - the pointer to array to assign to.
- */
-void DataArrayInt::SetArrayIn(DataArrayInt *newArray, DataArrayInt* &arrayToSet)
-{
-  if(newArray!=arrayToSet)
-    {
-      if(arrayToSet)
-        arrayToSet->decrRef();
-      arrayToSet=newArray;
-      if(arrayToSet)
-        arrayToSet->incrRef();
-    }
-}
-
 DataArrayIntIterator *DataArrayInt::iterator()
 {
   return new DataArrayIntIterator(this);
@@ -6231,7 +5023,7 @@ DataArrayInt *DataArrayInt::findIdsEqualTuple(const int *tupleBg, const int *tup
 {
   std::size_t nbOfCompoExp(std::distance(tupleBg,tupleEnd));
   checkAllocated();
-  if(getNumberOfComponents()!=(int)nbOfCompoExp)
+  if(getNumberOfComponents()!=nbOfCompoExp)
     {
       std::ostringstream oss; oss << "DataArrayInt::findIdsEqualTuple : mismatch of number of components. Input tuple has " << nbOfCompoExp << " whereas this array has " << getNumberOfComponents() << " components !";
       throw INTERP_KERNEL::Exception(oss.str().c_str());
@@ -6606,7 +5398,7 @@ DataArrayInt *DataArrayInt::Aggregate(const DataArrayInt *a1, const DataArrayInt
 {
   if(!a1 || !a2)
     throw INTERP_KERNEL::Exception("DataArrayInt::Aggregate : input DataArrayInt instance is NULL !");
-  int nbOfComp=a1->getNumberOfComponents();
+  std::size_t nbOfComp(a1->getNumberOfComponents());
   if(nbOfComp!=a2->getNumberOfComponents())
     throw INTERP_KERNEL::Exception("Nb of components mismatch for array Aggregation !");
   int nbOfTuple1=a1->getNumberOfTuples();
@@ -6643,7 +5435,7 @@ DataArrayInt *DataArrayInt::Aggregate(const std::vector<const DataArrayInt *>& a
   if(a.empty())
     throw INTERP_KERNEL::Exception("DataArrayInt::Aggregate : input list must be NON EMPTY !");
   std::vector<const DataArrayInt *>::const_iterator it=a.begin();
-  int nbOfComp=(*it)->getNumberOfComponents();
+  std::size_t nbOfComp((*it)->getNumberOfComponents());
   int nbt=(*it++)->getNumberOfTuples();
   for(int i=1;it!=a.end();it++,i++)
     {
@@ -6737,103 +5529,6 @@ void DataArrayInt::getMinMaxValues(int& minValue, int& maxValue) const
     }
 }
 
-/*!
- * Converts every value of \a this array to its absolute value.
- * \b WARNING this method is non const. If a new DataArrayInt instance should be built containing the result of abs DataArrayInt::computeAbs
- * should be called instead.
- *
- * \throw If \a this is not allocated.
- * \sa DataArrayInt::computeAbs
- */
-void DataArrayInt::abs()
-{
-  checkAllocated();
-  int *ptr(getPointer());
-  std::size_t nbOfElems(getNbOfElems());
-  std::transform(ptr,ptr+nbOfElems,ptr,std::ptr_fun<int,int>(std::abs));
-  declareAsNew();
-}
-
-/*!
- * This method builds a new instance of \a this object containing the result of std::abs applied of all elements in \a this.
- * This method is a const method (that do not change any values in \a this) contrary to  DataArrayInt::abs method.
- *
- * \return DataArrayInt * - the new instance of DataArrayInt containing the
- *         same number of tuples and component as \a this array.
- *         The caller is to delete this result array using decrRef() as it is no more
- *         needed.
- * \throw If \a this is not allocated.
- * \sa DataArrayInt::abs
- */
-DataArrayInt *DataArrayInt::computeAbs() const
-{
-  checkAllocated();
-  DataArrayInt *newArr(DataArrayInt::New());
-  int nbOfTuples(getNumberOfTuples());
-  int nbOfComp(getNumberOfComponents());
-  newArr->alloc(nbOfTuples,nbOfComp);
-  std::transform(begin(),end(),newArr->getPointer(),std::ptr_fun<int,int>(std::abs));
-  newArr->copyStringInfoFrom(*this);
-  return newArr;
-}
-
-/*!
- * Apply a liner function to a given component of \a this array, so that
- * an array element <em>(x)</em> becomes \f$ a * x + b \f$.
- *  \param [in] a - the first coefficient of the function.
- *  \param [in] b - the second coefficient of the function.
- *  \param [in] compoId - the index of component to modify.
- *  \throw If \a this is not allocated.
- */
-void DataArrayInt::applyLin(int a, int b, int compoId)
-{
-  checkAllocated();
-  int *ptr=getPointer()+compoId;
-  int nbOfComp=getNumberOfComponents();
-  int nbOfTuple=getNumberOfTuples();
-  for(int i=0;i<nbOfTuple;i++,ptr+=nbOfComp)
-    *ptr=a*(*ptr)+b;
-  declareAsNew();
-}
-
-/*!
- * Apply a liner function to all elements of \a this array, so that
- * an element _x_ becomes \f$ a * x + b \f$.
- *  \param [in] a - the first coefficient of the function.
- *  \param [in] b - the second coefficient of the function.
- *  \throw If \a this is not allocated.
- */
-void DataArrayInt::applyLin(int a, int b)
-{
-  checkAllocated();
-  int *ptr=getPointer();
-  std::size_t nbOfElems=getNbOfElems();
-  for(std::size_t i=0;i<nbOfElems;i++,ptr++)
-    *ptr=a*(*ptr)+b;
-  declareAsNew();
-}
-
-/*!
- * Returns a full copy of \a this array except that sign of all elements is reversed.
- *  \return DataArrayInt * - the new instance of DataArrayInt containing the
- *          same number of tuples and component as \a this array.
- *          The caller is to delete this result array using decrRef() as it is no more
- *          needed.
- *  \throw If \a this is not allocated.
- */
-DataArrayInt *DataArrayInt::negate() const
-{
-  checkAllocated();
-  DataArrayInt *newArr=DataArrayInt::New();
-  int nbOfTuples=getNumberOfTuples();
-  int nbOfComp=getNumberOfComponents();
-  newArr->alloc(nbOfTuples,nbOfComp);
-  const int *cptr=getConstPointer();
-  std::transform(cptr,cptr+nbOfTuples*nbOfComp,newArr->getPointer(),std::negate<int>());
-  newArr->copyStringInfoFrom(*this);
-  return newArr;
-}
-
 /*!
  * Modify all elements of \a this array, so that
  * an element _x_ becomes \f$ numerator / x \f$.
@@ -6914,15 +5609,8 @@ void DataArrayInt::applyModulus(int val)
  */
 DataArrayInt *DataArrayInt::findIdsInRange(int vmin, int vmax) const
 {
-  checkAllocated();
-  if(getNumberOfComponents()!=1)
-    throw INTERP_KERNEL::Exception("DataArrayInt::findIdsInRange : this must have exactly one component !");
-  const int *cptr(begin());
-  MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
-  int nbOfTuples(getNumberOfTuples());
-  for(int i=0;i<nbOfTuples;i++,cptr++)
-    if(*cptr>=vmin && *cptr<vmax)
-      ret->pushBackSilent(i);
+  InRange<int> ir(vmin,vmax);
+  MCAuto<DataArrayInt> ret(findIdsAdv(ir));
   return ret.retn();
 }
 
@@ -6939,35 +5627,8 @@ DataArrayInt *DataArrayInt::findIdsInRange(int vmin, int vmax) const
  */
 DataArrayInt *DataArrayInt::findIdsNotInRange(int vmin, int vmax) const
 {
-  checkAllocated();
-  if(getNumberOfComponents()!=1)
-    throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotInRange : this must have exactly one component !");
-  const int *cptr(getConstPointer());
-  MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
-  int nbOfTuples(getNumberOfTuples());
-  for(int i=0;i<nbOfTuples;i++,cptr++)
-    if(*cptr<vmin || *cptr>=vmax)
-      ret->pushBackSilent(i);
-  return ret.retn();
-}
-
-/*!
- * This method works only on data array with one component. This method returns a newly allocated array storing stored ascendantly of tuple ids in \a this so that this[id]<0.
- *
- * \return a newly allocated data array that the caller should deal with.
- * \sa DataArrayInt::findIdsInRange
- */
-DataArrayInt *DataArrayInt::findIdsStricltyNegative() const
-{
-  checkAllocated();
-  if(getNumberOfComponents()!=1)
-    throw INTERP_KERNEL::Exception("DataArrayInt::findIdsStricltyNegative : this must have exactly one component !");
-  const int *cptr(getConstPointer());
-  MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
-  int nbOfTuples(getNumberOfTuples());
-  for(int i=0;i<nbOfTuples;i++,cptr++)
-    if(*cptr<0)
-      ret->pushBackSilent(i);
+  NotInRange<int> nir(vmin,vmax);
+  MCAuto<DataArrayInt> ret(findIdsAdv(nir));
   return ret.retn();
 }
 
@@ -7085,91 +5746,12 @@ void DataArrayInt::applyRPow(int val)
         }
       else
         {
-          std::ostringstream oss; oss << "DataArrayInt::applyRPow : presence of negative value in tuple #" << i/getNumberOfComponents() << " component #" << i%getNumberOfComponents();
-          oss << " !";
-          throw INTERP_KERNEL::Exception(oss.str().c_str());
-        }
-    }
-  declareAsNew();
-}
-
-/*!
- * Returns a new DataArrayInt by aggregating two given arrays, so that (1) the number
- * of components in the result array is a sum of the number of components of given arrays
- * and (2) the number of tuples in the result array is same as that of each of given
- * arrays. In other words the i-th tuple of result array includes all components of
- * i-th tuples of all given arrays.
- * Number of tuples in the given arrays must be the same.
- *  \param [in] a1 - an array to include in the result array.
- *  \param [in] a2 - another array to include in the result array.
- *  \return DataArrayInt * - the new instance of DataArrayInt.
- *          The caller is to delete this result array using decrRef() as it is no more
- *          needed.
- *  \throw If both \a a1 and \a a2 are NULL.
- *  \throw If any given array is not allocated.
- *  \throw If \a a1->getNumberOfTuples() != \a a2->getNumberOfTuples()
- */
-DataArrayInt *DataArrayInt::Meld(const DataArrayInt *a1, const DataArrayInt *a2)
-{
-  std::vector<const DataArrayInt *> arr(2);
-  arr[0]=a1; arr[1]=a2;
-  return Meld(arr);
-}
-
-/*!
- * Returns a new DataArrayInt by aggregating all given arrays, so that (1) the number
- * of components in the result array is a sum of the number of components of given arrays
- * and (2) the number of tuples in the result array is same as that of each of given
- * arrays. In other words the i-th tuple of result array includes all components of
- * i-th tuples of all given arrays.
- * Number of tuples in the given arrays must be  the same.
- *  \param [in] arr - a sequence of arrays to include in the result array.
- *  \return DataArrayInt * - the new instance of DataArrayInt.
- *          The caller is to delete this result array using decrRef() as it is no more
- *          needed.
- *  \throw If all arrays within \a arr are NULL.
- *  \throw If any given array is not allocated.
- *  \throw If getNumberOfTuples() of arrays within \a arr is different.
- */
-DataArrayInt *DataArrayInt::Meld(const std::vector<const DataArrayInt *>& arr)
-{
-  std::vector<const DataArrayInt *> a;
-  for(std::vector<const DataArrayInt *>::const_iterator it4=arr.begin();it4!=arr.end();it4++)
-    if(*it4)
-      a.push_back(*it4);
-  if(a.empty())
-    throw INTERP_KERNEL::Exception("DataArrayInt::Meld : array must be NON empty !");
-  std::vector<const DataArrayInt *>::const_iterator it;
-  for(it=a.begin();it!=a.end();it++)
-    (*it)->checkAllocated();
-  it=a.begin();
-  int nbOfTuples=(*it)->getNumberOfTuples();
-  std::vector<int> nbc(a.size());
-  std::vector<const int *> pts(a.size());
-  nbc[0]=(*it)->getNumberOfComponents();
-  pts[0]=(*it++)->getConstPointer();
-  for(int i=1;it!=a.end();it++,i++)
-    {
-      if(nbOfTuples!=(*it)->getNumberOfTuples())
-        throw INTERP_KERNEL::Exception("DataArrayInt::meld : mismatch of number of tuples !");
-      nbc[i]=(*it)->getNumberOfComponents();
-      pts[i]=(*it)->getConstPointer();
+          std::ostringstream oss; oss << "DataArrayInt::applyRPow : presence of negative value in tuple #" << i/getNumberOfComponents() << " component #" << i%getNumberOfComponents();
+          oss << " !";
+          throw INTERP_KERNEL::Exception(oss.str().c_str());
+        }
     }
-  int totalNbOfComp=std::accumulate(nbc.begin(),nbc.end(),0);
-  DataArrayInt *ret=DataArrayInt::New();
-  ret->alloc(nbOfTuples,totalNbOfComp);
-  int *retPtr=ret->getPointer();
-  for(int i=0;i<nbOfTuples;i++)
-    for(int j=0;j<(int)a.size();j++)
-      {
-        retPtr=std::copy(pts[j],pts[j]+nbc[j],retPtr);
-        pts[j]+=nbc[j];
-      }
-  int k=0;
-  for(int i=0;i<(int)a.size();i++)
-    for(int j=0;j<nbc[i];j++,k++)
-      ret->setInfoOnComponent(k,a[i]->getInfoOnComponent(j));
-  return ret;
+  declareAsNew();
 }
 
 /*!
@@ -7435,1332 +6017,743 @@ DataArrayInt *DataArrayInt::buildComplement(int nbOfElement) const
     if(!tmp[i])
       retPtr[j++]=i;
   return ret;
-}
-
-/*!
- * Returns a new DataArrayInt containing elements of \a this one-dimensional missing
- * from an \a other one-dimensional array.
- *  \param [in] other - a DataArrayInt containing elements not to include in the result array.
- *  \return DataArrayInt * - a new instance of DataArrayInt with one component. The
- *         caller is to delete this array using decrRef() as it is no more needed.
- *  \throw If \a other is NULL.
- *  \throw If \a other is not allocated.
- *  \throw If \a other->getNumberOfComponents() != 1.
- *  \throw If \a this is not allocated.
- *  \throw If \a this->getNumberOfComponents() != 1.
- *  \sa DataArrayInt::buildSubstractionOptimized()
- */
-DataArrayInt *DataArrayInt::buildSubstraction(const DataArrayInt *other) const
-{
-  if(!other)
-    throw INTERP_KERNEL::Exception("DataArrayInt::buildSubstraction : DataArrayInt pointer in input is NULL !");
-  checkAllocated();
-  other->checkAllocated();
-  if(getNumberOfComponents()!=1)
-    throw INTERP_KERNEL::Exception("DataArrayInt::buildSubstraction : only single component allowed !");
-  if(other->getNumberOfComponents()!=1)
-    throw INTERP_KERNEL::Exception("DataArrayInt::buildSubstraction : only single component allowed for other type !");
-  const int *pt=getConstPointer();
-  int nbOfTuples=getNumberOfTuples();
-  std::set<int> s1(pt,pt+nbOfTuples);
-  pt=other->getConstPointer();
-  nbOfTuples=other->getNumberOfTuples();
-  std::set<int> s2(pt,pt+nbOfTuples);
-  std::vector<int> r;
-  std::set_difference(s1.begin(),s1.end(),s2.begin(),s2.end(),std::back_insert_iterator< std::vector<int> >(r));
-  DataArrayInt *ret=DataArrayInt::New();
-  ret->alloc((int)r.size(),1);
-  std::copy(r.begin(),r.end(),ret->getPointer());
-  return ret;
-}
-
-/*!
- * \a this is expected to have one component and to be sorted ascendingly (as for \a other).
- * \a other is expected to be a part of \a this. If not DataArrayInt::buildSubstraction should be called instead.
- * 
- * \param [in] other an array with one component and expected to be sorted ascendingly.
- * \ret list of ids in \a this but not in \a other.
- * \sa DataArrayInt::buildSubstraction
- */
-DataArrayInt *DataArrayInt::buildSubstractionOptimized(const DataArrayInt *other) const
-{
-  static const char *MSG="DataArrayInt::buildSubstractionOptimized : only single component allowed !";
-  if(!other) throw INTERP_KERNEL::Exception("DataArrayInt::buildSubstractionOptimized : NULL input array !");
-  checkAllocated(); other->checkAllocated();
-  if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception(MSG);
-  if(other->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception(MSG);
-  const int *pt1Bg(begin()),*pt1End(end()),*pt2Bg(other->begin()),*pt2End(other->end());
-  const int *work1(pt1Bg),*work2(pt2Bg);
-  MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
-  for(;work1!=pt1End;work1++)
-    {
-      if(work2!=pt2End && *work1==*work2)
-        work2++;
-      else
-        ret->pushBackSilent(*work1);
-    }
-  return ret.retn();
-}
-
-
-/*!
- * Returns a new DataArrayInt which contains all elements of \a this and a given
- * one-dimensional arrays. The result array does not contain any duplicates
- * and its values are sorted in ascending order.
- *  \param [in] other - an array to unite with \a this one.
- *  \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this
- *         array using decrRef() as it is no more needed.
- *  \throw If \a this or \a other is not allocated.
- *  \throw If \a this->getNumberOfComponents() != 1.
- *  \throw If \a other->getNumberOfComponents() != 1.
- */
-DataArrayInt *DataArrayInt::buildUnion(const DataArrayInt *other) const
-{
-  std::vector<const DataArrayInt *>arrs(2);
-  arrs[0]=this; arrs[1]=other;
-  return BuildUnion(arrs);
-}
-
-
-/*!
- * Returns a new DataArrayInt which contains elements present in both \a this and a given
- * one-dimensional arrays. The result array does not contain any duplicates
- * and its values are sorted in ascending order.
- *  \param [in] other - an array to intersect with \a this one.
- *  \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this
- *         array using decrRef() as it is no more needed.
- *  \throw If \a this or \a other is not allocated.
- *  \throw If \a this->getNumberOfComponents() != 1.
- *  \throw If \a other->getNumberOfComponents() != 1.
- */
-DataArrayInt *DataArrayInt::buildIntersection(const DataArrayInt *other) const
-{
-  std::vector<const DataArrayInt *>arrs(2);
-  arrs[0]=this; arrs[1]=other;
-  return BuildIntersection(arrs);
-}
-
-/*!
- * This method can be applied on allocated with one component DataArrayInt instance.
- * This method is typically relevant for sorted arrays. All consecutive duplicated items in \a this will appear only once in returned DataArrayInt instance.
- * Example : if \a this contains [1,2,2,3,3,3,3,4,5,5,7,7,7,19] the returned array will contain [1,2,3,4,5,7,19]
- * 
- * \return a newly allocated array that contain the result of the unique operation applied on \a this.
- * \throw if \a this is not allocated or if \a this has not exactly one component.
- * \sa DataArrayInt::buildUniqueNotSorted
- */
-DataArrayInt *DataArrayInt::buildUnique() const
-{
-  checkAllocated();
-  if(getNumberOfComponents()!=1)
-    throw INTERP_KERNEL::Exception("DataArrayInt::buildUnique : only single component allowed !");
-  int nbOfTuples=getNumberOfTuples();
-  MCAuto<DataArrayInt> tmp=deepCopy();
-  int *data=tmp->getPointer();
-  int *last=std::unique(data,data+nbOfTuples);
-  MCAuto<DataArrayInt> ret=DataArrayInt::New();
-  ret->alloc(std::distance(data,last),1);
-  std::copy(data,last,ret->getPointer());
-  return ret.retn();
-}
-
-/*!
- * This method can be applied on allocated with one component DataArrayInt instance.
- * This method keep elements only once by keeping the same order in \a this that is not expected to be sorted.
- *
- * \return a newly allocated array that contain the result of the unique operation applied on \a this.
- *
- * \throw if \a this is not allocated or if \a this has not exactly one component.
- *
- * \sa DataArrayInt::buildUnique
- */
-DataArrayInt *DataArrayInt::buildUniqueNotSorted() const
-{
-  checkAllocated();
-    if(getNumberOfComponents()!=1)
-      throw INTERP_KERNEL::Exception("DataArrayInt::buildUniqueNotSorted : only single component allowed !");
-  int minVal,maxVal;
-  getMinMaxValues(minVal,maxVal);
-  std::vector<bool> b(maxVal-minVal+1,false);
-  const int *ptBg(begin()),*endBg(end());
-  MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
-  for(const int *pt=ptBg;pt!=endBg;pt++)
-    {
-      if(!b[*pt-minVal])
-        {
-          ret->pushBackSilent(*pt);
-          b[*pt-minVal]=true;
-        }
-    }
-  ret->copyStringInfoFrom(*this);
-  return ret.retn();
-}
-
-/*!
- * Returns a new DataArrayInt which contains size of every of groups described by \a this
- * "index" array. Such "index" array is returned for example by 
- * \ref MEDCoupling::MEDCouplingUMesh::buildDescendingConnectivity
- * "MEDCouplingUMesh::buildDescendingConnectivity" and
- * \ref MEDCoupling::MEDCouplingUMesh::getNodalConnectivityIndex
- * "MEDCouplingUMesh::getNodalConnectivityIndex" etc.
- * This method preforms the reverse operation of DataArrayInt::computeOffsetsFull.
- *  \return DataArrayInt * - a new instance of DataArrayInt, whose number of tuples
- *          equals to \a this->getNumberOfComponents() - 1, and number of components is 1.
- *          The caller is to delete this array using decrRef() as it is no more needed. 
- *  \throw If \a this is not allocated.
- *  \throw If \a this->getNumberOfComponents() != 1.
- *  \throw If \a this->getNumberOfTuples() < 2.
- *
- *  \b Example: <br> 
- *         - this contains [1,3,6,7,7,9,15]
- *         - result array contains [2,3,1,0,2,6],
- *          where 2 = 3 - 1, 3 = 6 - 3, 1 = 7 - 6 etc.
- *
- * \sa DataArrayInt::computeOffsetsFull
- */
-DataArrayInt *DataArrayInt::deltaShiftIndex() const
-{
-  checkAllocated();
-  if(getNumberOfComponents()!=1)
-    throw INTERP_KERNEL::Exception("DataArrayInt::deltaShiftIndex : only single component allowed !");
-  int nbOfTuples=getNumberOfTuples();
-  if(nbOfTuples<2)
-    throw INTERP_KERNEL::Exception("DataArrayInt::deltaShiftIndex : 1 tuple at least must be present in 'this' !");
-  const int *ptr=getConstPointer();
-  DataArrayInt *ret=DataArrayInt::New();
-  ret->alloc(nbOfTuples-1,1);
-  int *out=ret->getPointer();
-  std::transform(ptr+1,ptr+nbOfTuples,ptr,out,std::minus<int>());
-  return ret;
-}
-
-/*!
- * Modifies \a this one-dimensional array so that value of each element \a x
- * of \a this array (\a a) is computed as \f$ x_i = \sum_{j=0}^{i-1} a[ j ] \f$.
- * Or: for each i>0 new[i]=new[i-1]+old[i-1] for i==0 new[i]=0. Number of tuples
- * and components remains the same.<br>
- * This method is useful for allToAllV in MPI with contiguous policy. This method
- * differs from computeOffsetsFull() in that the number of tuples is \b not changed by
- * this one.
- *  \throw If \a this is not allocated.
- *  \throw If \a this->getNumberOfComponents() != 1.
- *
- *  \b Example: <br>
- *          - Before \a this contains [3,5,1,2,0,8]
- *          - After \a this contains  [0,3,8,9,11,11]<br>
- *          Note that the last element 19 = 11 + 8 is missing because size of \a this
- *          array is retained and thus there is no space to store the last element.
- */
-void DataArrayInt::computeOffsets()
-{
-  checkAllocated();
-  if(getNumberOfComponents()!=1)
-    throw INTERP_KERNEL::Exception("DataArrayInt::computeOffsets : only single component allowed !");
-  int nbOfTuples=getNumberOfTuples();
-  if(nbOfTuples==0)
-    return ;
-  int *work=getPointer();
-  int tmp=work[0];
-  work[0]=0;
-  for(int i=1;i<nbOfTuples;i++)
-    {
-      int tmp2=work[i];
-      work[i]=work[i-1]+tmp;
-      tmp=tmp2;
-    }
-  declareAsNew();
-}
-
-
-/*!
- * Modifies \a this one-dimensional array so that value of each element \a x
- * of \a this array (\a a) is computed as \f$ x_i = \sum_{j=0}^{i-1} a[ j ] \f$.
- * Or: for each i>0 new[i]=new[i-1]+old[i-1] for i==0 new[i]=0. Number
- * components remains the same and number of tuples is inceamented by one.<br>
- * This method is useful for allToAllV in MPI with contiguous policy. This method
- * differs from computeOffsets() in that the number of tuples is changed by this one.
- * This method preforms the reverse operation of DataArrayInt::deltaShiftIndex.
+}
+
+/*!
+ * Returns a new DataArrayInt containing elements of \a this one-dimensional missing
+ * from an \a other one-dimensional array.
+ *  \param [in] other - a DataArrayInt containing elements not to include in the result array.
+ *  \return DataArrayInt * - a new instance of DataArrayInt with one component. The
+ *         caller is to delete this array using decrRef() as it is no more needed.
+ *  \throw If \a other is NULL.
+ *  \throw If \a other is not allocated.
+ *  \throw If \a other->getNumberOfComponents() != 1.
  *  \throw If \a this is not allocated.
  *  \throw If \a this->getNumberOfComponents() != 1.
- *
- *  \b Example: <br>
- *          - Before \a this contains [3,5,1,2,0,8]
- *          - After \a this contains  [0,3,8,9,11,11,19]<br>
- * \sa DataArrayInt::deltaShiftIndex
+ *  \sa DataArrayInt::buildSubstractionOptimized()
  */
-void DataArrayInt::computeOffsetsFull()
+DataArrayInt *DataArrayInt::buildSubstraction(const DataArrayInt *other) const
 {
+  if(!other)
+    throw INTERP_KERNEL::Exception("DataArrayInt::buildSubstraction : DataArrayInt pointer in input is NULL !");
   checkAllocated();
+  other->checkAllocated();
   if(getNumberOfComponents()!=1)
-    throw INTERP_KERNEL::Exception("DataArrayInt::computeOffsetsFull : only single component allowed !");
+    throw INTERP_KERNEL::Exception("DataArrayInt::buildSubstraction : only single component allowed !");
+  if(other->getNumberOfComponents()!=1)
+    throw INTERP_KERNEL::Exception("DataArrayInt::buildSubstraction : only single component allowed for other type !");
+  const int *pt=getConstPointer();
   int nbOfTuples=getNumberOfTuples();
-  int *ret=(int *)malloc((nbOfTuples+1)*sizeof(int));
-  const int *work=getConstPointer();
-  ret[0]=0;
-  for(int i=0;i<nbOfTuples;i++)
-    ret[i+1]=work[i]+ret[i];
-  useArray(ret,true,C_DEALLOC,nbOfTuples+1,1);
-  declareAsNew();
+  std::set<int> s1(pt,pt+nbOfTuples);
+  pt=other->getConstPointer();
+  nbOfTuples=other->getNumberOfTuples();
+  std::set<int> s2(pt,pt+nbOfTuples);
+  std::vector<int> r;
+  std::set_difference(s1.begin(),s1.end(),s2.begin(),s2.end(),std::back_insert_iterator< std::vector<int> >(r));
+  DataArrayInt *ret=DataArrayInt::New();
+  ret->alloc((int)r.size(),1);
+  std::copy(r.begin(),r.end(),ret->getPointer());
+  return ret;
 }
 
 /*!
- * Returns two new DataArrayInt instances whose contents is computed from that of \a this and \a listOfIds arrays as follows.
- * \a this is expected to be an offset format ( as returned by DataArrayInt::computeOffsetsFull ) that is to say with one component
- * and ** sorted strictly increasingly **. \a listOfIds is expected to be sorted ascendingly (not strictly needed for \a listOfIds).
- * This methods searches in \a this, considered as a set of contiguous \c this->getNumberOfComponents() ranges, all ids in \a listOfIds
- * filling completely one of the ranges in \a this.
- *
- * \param [in] listOfIds a list of ids that has to be sorted ascendingly.
- * \param [out] rangeIdsFetched the range ids fetched
- * \param [out] idsInInputListThatFetch contains the list of ids in \a listOfIds that are \b fully included in a range in \a this. So
- *              \a idsInInputListThatFetch is a part of input \a listOfIds.
- *
- * \sa DataArrayInt::computeOffsetsFull
- *
- *  \b Example: <br>
- *          - \a this : [0,3,7,9,15,18]
- *          - \a listOfIds contains  [0,1,2,3,7,8,15,16,17]
- *          - \a rangeIdsFetched result array: [0,2,4]
- *          - \a idsInInputListThatFetch result array: [0,1,2,7,8,15,16,17]
- * In this example id 3 in input \a listOfIds is alone so it do not appear in output \a idsInInputListThatFetch.
- * <br>
+ * \a this is expected to have one component and to be sorted ascendingly (as for \a other).
+ * \a other is expected to be a part of \a this. If not DataArrayInt::buildSubstraction should be called instead.
+ * 
+ * \param [in] other an array with one component and expected to be sorted ascendingly.
+ * \ret list of ids in \a this but not in \a other.
+ * \sa DataArrayInt::buildSubstraction
  */
-void DataArrayInt::findIdsRangesInListOfIds(const DataArrayInt *listOfIds, DataArrayInt *& rangeIdsFetched, DataArrayInt *& idsInInputListThatFetch) const
+DataArrayInt *DataArrayInt::buildSubstractionOptimized(const DataArrayInt *other) const
 {
-  if(!listOfIds)
-    throw INTERP_KERNEL::Exception("DataArrayInt::findIdsRangesInListOfIds : input list of ids is null !");
-  listOfIds->checkAllocated(); checkAllocated();
-  if(listOfIds->getNumberOfComponents()!=1)
-    throw INTERP_KERNEL::Exception("DataArrayInt::findIdsRangesInListOfIds : input list of ids must have exactly one component !");
-  if(getNumberOfComponents()!=1)
-    throw INTERP_KERNEL::Exception("DataArrayInt::findIdsRangesInListOfIds : this must have exactly one component !");
-  MCAuto<DataArrayInt> ret0=DataArrayInt::New(); ret0->alloc(0,1);
-  MCAuto<DataArrayInt> ret1=DataArrayInt::New(); ret1->alloc(0,1);
-  const int *tupEnd(listOfIds->end()),*offBg(begin()),*offEnd(end()-1);
-  const int *tupPtr(listOfIds->begin()),*offPtr(offBg);
-  while(tupPtr!=tupEnd && offPtr!=offEnd)
+  static const char *MSG="DataArrayInt::buildSubstractionOptimized : only single component allowed !";
+  if(!other) throw INTERP_KERNEL::Exception("DataArrayInt::buildSubstractionOptimized : NULL input array !");
+  checkAllocated(); other->checkAllocated();
+  if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception(MSG);
+  if(other->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception(MSG);
+  const int *pt1Bg(begin()),*pt1End(end()),*pt2Bg(other->begin()),*pt2End(other->end());
+  const int *work1(pt1Bg),*work2(pt2Bg);
+  MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
+  for(;work1!=pt1End;work1++)
     {
-      if(*tupPtr==*offPtr)
-        {
-          int i=offPtr[0];
-          while(i<offPtr[1] && *tupPtr==i && tupPtr!=tupEnd) { i++; tupPtr++; }
-          if(i==offPtr[1])
-            {
-              ret0->pushBackSilent((int)std::distance(offBg,offPtr));
-              ret1->pushBackValsSilent(tupPtr-(offPtr[1]-offPtr[0]),tupPtr);
-              offPtr++;
-            }
-        }
+      if(work2!=pt2End && *work1==*work2)
+        work2++;
       else
-        { if(*tupPtr<*offPtr) tupPtr++; else offPtr++; }
+        ret->pushBackSilent(*work1);
     }
-  rangeIdsFetched=ret0.retn();
-  idsInInputListThatFetch=ret1.retn();
+  return ret.retn();
 }
 
+
 /*!
- * Returns a new DataArrayInt whose contents is computed from that of \a this and \a
- * offsets arrays as follows. \a offsets is a one-dimensional array considered as an
- * "index" array of a "iota" array, thus, whose each element gives an index of a group
- * beginning within the "iota" array. And \a this is a one-dimensional array
- * considered as a selector of groups described by \a offsets to include into the result array.
- *  \throw If \a offsets is NULL.
- *  \throw If \a offsets is not allocated.
- *  \throw If \a offsets->getNumberOfComponents() != 1.
- *  \throw If \a offsets is not monotonically increasing.
- *  \throw If \a this is not allocated.
+ * Returns a new DataArrayInt which contains all elements of \a this and a given
+ * one-dimensional arrays. The result array does not contain any duplicates
+ * and its values are sorted in ascending order.
+ *  \param [in] other - an array to unite with \a this one.
+ *  \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this
+ *         array using decrRef() as it is no more needed.
+ *  \throw If \a this or \a other is not allocated.
  *  \throw If \a this->getNumberOfComponents() != 1.
- *  \throw If any element of \a this is not a valid index for \a offsets array.
- *
- *  \b Example: <br>
- *          - \a this: [0,2,3]
- *          - \a offsets: [0,3,6,10,14,20]
- *          - result array: [0,1,2,6,7,8,9,10,11,12,13] == <br>
- *            \c range(0,3) + \c range(6,10) + \c range(10,14) ==<br>
- *            \c range( \a offsets[ \a this[0] ], offsets[ \a this[0]+1 ]) + 
- *            \c range( \a offsets[ \a this[1] ], offsets[ \a this[1]+1 ]) + 
- *            \c range( \a offsets[ \a this[2] ], offsets[ \a this[2]+1 ])
+ *  \throw If \a other->getNumberOfComponents() != 1.
  */
-DataArrayInt *DataArrayInt::buildExplicitArrByRanges(const DataArrayInt *offsets) const
+DataArrayInt *DataArrayInt::buildUnion(const DataArrayInt *other) const
 {
-  if(!offsets)
-    throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrByRanges : DataArrayInt pointer in input is NULL !");
-  checkAllocated();
-  if(getNumberOfComponents()!=1)
-    throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrByRanges : only single component allowed !");
-  offsets->checkAllocated();
-  if(offsets->getNumberOfComponents()!=1)
-    throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrByRanges : input array should have only single component !");
-  int othNbTuples=offsets->getNumberOfTuples()-1;
-  int nbOfTuples=getNumberOfTuples();
-  int retNbOftuples=0;
-  const int *work=getConstPointer();
-  const int *offPtr=offsets->getConstPointer();
-  for(int i=0;i<nbOfTuples;i++)
-    {
-      int val=work[i];
-      if(val>=0 && val<othNbTuples)
-        {
-          int delta=offPtr[val+1]-offPtr[val];
-          if(delta>=0)
-            retNbOftuples+=delta;
-          else
-            {
-              std::ostringstream oss; oss << "DataArrayInt::buildExplicitArrByRanges : Tuple #" << val << " of offset array has a delta < 0 !";
-              throw INTERP_KERNEL::Exception(oss.str().c_str());
-            }
-        }
-      else
-        {
-          std::ostringstream oss; oss << "DataArrayInt::buildExplicitArrByRanges : Tuple #" << i << " in this contains " << val;
-          oss << " whereas offsets array is of size " << othNbTuples+1 << " !";
-          throw INTERP_KERNEL::Exception(oss.str().c_str());
-        }
-    }
-  MCAuto<DataArrayInt> ret=DataArrayInt::New();
-  ret->alloc(retNbOftuples,1);
-  int *retPtr=ret->getPointer();
-  for(int i=0;i<nbOfTuples;i++)
-    {
-      int val=work[i];
-      int start=offPtr[val];
-      int off=offPtr[val+1]-start;
-      for(int j=0;j<off;j++,retPtr++)
-        *retPtr=start+j;
-    }
-  return ret.retn();
+  std::vector<const DataArrayInt *>arrs(2);
+  arrs[0]=this; arrs[1]=other;
+  return BuildUnion(arrs);
 }
 
+
 /*!
- * Returns a new DataArrayInt whose contents is computed using \a this that must be a 
- * scaled array (monotonically increasing).
-from that of \a this and \a
- * offsets arrays as follows. \a offsets is a one-dimensional array considered as an
- * "index" array of a "iota" array, thus, whose each element gives an index of a group
- * beginning within the "iota" array. And \a this is a one-dimensional array
- * considered as a selector of groups described by \a offsets to include into the result array.
- *  \throw If \a  is NULL.
- *  \throw If \a this is not allocated.
+ * Returns a new DataArrayInt which contains elements present in both \a this and a given
+ * one-dimensional arrays. The result array does not contain any duplicates
+ * and its values are sorted in ascending order.
+ *  \param [in] other - an array to intersect with \a this one.
+ *  \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this
+ *         array using decrRef() as it is no more needed.
+ *  \throw If \a this or \a other is not allocated.
  *  \throw If \a this->getNumberOfComponents() != 1.
- *  \throw If \a this->getNumberOfTuples() == 0.
- *  \throw If \a this is not monotonically increasing.
- *  \throw If any element of ids in ( \a bg \a stop \a step ) points outside the scale in \a this.
- *
- *  \b Example: <br>
- *          - \a bg , \a stop and \a step : (0,5,2)
- *          - \a this: [0,3,6,10,14,20]
- *          - result array: [0,0,0, 2,2,2,2, 4,4,4,4,4,4] == <br>
- */
-DataArrayInt *DataArrayInt::buildExplicitArrOfSliceOnScaledArr(int bg, int stop, int step) const
-{
-  if(!isAllocated())
-    throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr : not allocated array !");
-  if(getNumberOfComponents()!=1)
-    throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr : number of components is expected to be equal to one !");
-  int nbOfTuples(getNumberOfTuples());
-  if(nbOfTuples==0)
-    throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr : number of tuples must be != 0 !");
-  const int *ids(begin());
-  int nbOfEltsInSlc(GetNumberOfItemGivenBESRelative(bg,stop,step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr")),sz(0),pos(bg);
-  for(int i=0;i<nbOfEltsInSlc;i++,pos+=step)
-    {
-      if(pos>=0 && pos<nbOfTuples-1)
-        {
-          int delta(ids[pos+1]-ids[pos]);
-          sz+=delta;
-          if(delta<0)
-            {
-              std::ostringstream oss; oss << "DataArrayInt::buildExplicitArrOfSliceOnScaledArr : At pos #" << i << " of input slice, value is " << pos << " and at this pos this is not monotonically increasing !";
-              throw INTERP_KERNEL::Exception(oss.str().c_str());
-            }          
-        }
-      else
-        {
-          std::ostringstream oss; oss << "DataArrayInt::buildExplicitArrOfSliceOnScaledArr : At pos #" << i << " of input slice, value is " << pos << " should be in [0," << nbOfTuples-1 << ") !";  
-          throw INTERP_KERNEL::Exception(oss.str().c_str());
-        }
-    }
-  MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(sz,1);
-  int *retPtr(ret->getPointer());
-  pos=bg;
-  for(int i=0;i<nbOfEltsInSlc;i++,pos+=step)
-    {
-      int delta(ids[pos+1]-ids[pos]);
-      for(int j=0;j<delta;j++,retPtr++)
-        *retPtr=pos;
-    }
-  return ret.retn();
+ *  \throw If \a other->getNumberOfComponents() != 1.
+ */
+DataArrayInt *DataArrayInt::buildIntersection(const DataArrayInt *other) const
+{
+  std::vector<const DataArrayInt *>arrs(2);
+  arrs[0]=this; arrs[1]=other;
+  return BuildIntersection(arrs);
 }
 
 /*!
- * Given in input ranges \a ranges, it returns a newly allocated DataArrayInt instance having one component and the same number of tuples than \a this.
- * For each tuple at place **i** in \a this it tells which is the first range in \a ranges that contains value \c this->getIJ(i,0) and put the result
- * in tuple **i** of returned DataArrayInt.
- * If ranges overlapped (in theory it should not) this method do not detect it and always returns the first range.
- *
- * For example if \a this contains : [1,24,7,8,10,17] and \a ranges contains [(0,3),(3,8),(8,15),(15,22),(22,30)]
- * The return DataArrayInt will contain : **[0,4,1,2,2,3]**
- * 
- * \param [in] ranges typically come from output of MEDCouplingUMesh::ComputeRangesFromTypeDistribution. Each range is specified like this : 1st component is
- *             for lower value included and 2nd component is the upper value of corresponding range **excluded**.
- * \throw If offsets is a null pointer or does not have 2 components or if \a this is not allocated or \a this do not have exactly one component. To finish an exception
- *        is thrown if no ranges in \a ranges contains value in \a this.
+ * This method can be applied on allocated with one component DataArrayInt instance.
+ * This method is typically relevant for sorted arrays. All consecutive duplicated items in \a this will appear only once in returned DataArrayInt instance.
+ * Example : if \a this contains [1,2,2,3,3,3,3,4,5,5,7,7,7,19] the returned array will contain [1,2,3,4,5,7,19]
  * 
- * \sa DataArrayInt::findIdInRangeForEachTuple
+ * \return a newly allocated array that contain the result of the unique operation applied on \a this.
+ * \throw if \a this is not allocated or if \a this has not exactly one component.
+ * \sa DataArrayInt::buildUniqueNotSorted
  */
-DataArrayInt *DataArrayInt::findRangeIdForEachTuple(const DataArrayInt *ranges) const
+DataArrayInt *DataArrayInt::buildUnique() const
 {
-  if(!ranges)
-    throw INTERP_KERNEL::Exception("DataArrayInt::findRangeIdForEachTuple : null input pointer !");
-  if(ranges->getNumberOfComponents()!=2)
-    throw INTERP_KERNEL::Exception("DataArrayInt::findRangeIdForEachTuple : input DataArrayInt instance should have 2 components !");
   checkAllocated();
   if(getNumberOfComponents()!=1)
-    throw INTERP_KERNEL::Exception("DataArrayInt::findRangeIdForEachTuple : this should have only one component !");
-  int nbTuples=getNumberOfTuples();
-  MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(nbTuples,1);
-  int nbOfRanges=ranges->getNumberOfTuples();
-  const int *rangesPtr=ranges->getConstPointer();
-  int *retPtr=ret->getPointer();
-  const int *inPtr=getConstPointer();
-  for(int i=0;i<nbTuples;i++,retPtr++)
-    {
-      int val=inPtr[i];
-      bool found=false;
-      for(int j=0;j<nbOfRanges && !found;j++)
-        if(val>=rangesPtr[2*j] && val<rangesPtr[2*j+1])
-          { *retPtr=j; found=true; }
-      if(found)
-        continue;
-      else
-        {
-          std::ostringstream oss; oss << "DataArrayInt::findRangeIdForEachTuple : tuple #" << i << " not found by any ranges !";
-          throw INTERP_KERNEL::Exception(oss.str().c_str());
-        }
-    }
+    throw INTERP_KERNEL::Exception("DataArrayInt::buildUnique : only single component allowed !");
+  int nbOfTuples=getNumberOfTuples();
+  MCAuto<DataArrayInt> tmp=deepCopy();
+  int *data=tmp->getPointer();
+  int *last=std::unique(data,data+nbOfTuples);
+  MCAuto<DataArrayInt> ret=DataArrayInt::New();
+  ret->alloc(std::distance(data,last),1);
+  std::copy(data,last,ret->getPointer());
   return ret.retn();
 }
 
 /*!
- * Given in input ranges \a ranges, it returns a newly allocated DataArrayInt instance having one component and the same number of tuples than \a this.
- * For each tuple at place **i** in \a this it tells which is the sub position of the first range in \a ranges that contains value \c this->getIJ(i,0) and put the result
- * in tuple **i** of returned DataArrayInt.
- * If ranges overlapped (in theory it should not) this method do not detect it and always returns the sub position of the first range.
+ * This method can be applied on allocated with one component DataArrayInt instance.
+ * This method keep elements only once by keeping the same order in \a this that is not expected to be sorted.
  *
- * For example if \a this contains : [1,24,7,8,10,17] and \a ranges contains [(0,3),(3,8),(8,15),(15,22),(22,30)]
- * The return DataArrayInt will contain : **[1,2,4,0,2,2]**
- * This method is often called in pair with DataArrayInt::findRangeIdForEachTuple method.
- * 
- * \param [in] ranges typically come from output of MEDCouplingUMesh::ComputeRangesFromTypeDistribution. Each range is specified like this : 1st component is
- *             for lower value included and 2nd component is the upper value of corresponding range **excluded**.
- * \throw If offsets is a null pointer or does not have 2 components or if \a this is not allocated or \a this do not have exactly one component. To finish an exception
- *        is thrown if no ranges in \a ranges contains value in \a this.
- * \sa DataArrayInt::findRangeIdForEachTuple
+ * \return a newly allocated array that contain the result of the unique operation applied on \a this.
+ *
+ * \throw if \a this is not allocated or if \a this has not exactly one component.
+ *
+ * \sa DataArrayInt::buildUnique
  */
-DataArrayInt *DataArrayInt::findIdInRangeForEachTuple(const DataArrayInt *ranges) const
+DataArrayInt *DataArrayInt::buildUniqueNotSorted() const
 {
-  if(!ranges)
-    throw INTERP_KERNEL::Exception("DataArrayInt::findIdInRangeForEachTuple : null input pointer !");
-  if(ranges->getNumberOfComponents()!=2)
-    throw INTERP_KERNEL::Exception("DataArrayInt::findIdInRangeForEachTuple : input DataArrayInt instance should have 2 components !");
   checkAllocated();
-  if(getNumberOfComponents()!=1)
-    throw INTERP_KERNEL::Exception("DataArrayInt::findIdInRangeForEachTuple : this should have only one component !");
-  int nbTuples=getNumberOfTuples();
-  MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(nbTuples,1);
-  int nbOfRanges=ranges->getNumberOfTuples();
-  const int *rangesPtr=ranges->getConstPointer();
-  int *retPtr=ret->getPointer();
-  const int *inPtr=getConstPointer();
-  for(int i=0;i<nbTuples;i++,retPtr++)
+    if(getNumberOfComponents()!=1)
+      throw INTERP_KERNEL::Exception("DataArrayInt::buildUniqueNotSorted : only single component allowed !");
+  int minVal,maxVal;
+  getMinMaxValues(minVal,maxVal);
+  std::vector<bool> b(maxVal-minVal+1,false);
+  const int *ptBg(begin()),*endBg(end());
+  MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
+  for(const int *pt=ptBg;pt!=endBg;pt++)
     {
-      int val=inPtr[i];
-      bool found=false;
-      for(int j=0;j<nbOfRanges && !found;j++)
-        if(val>=rangesPtr[2*j] && val<rangesPtr[2*j+1])
-          { *retPtr=val-rangesPtr[2*j]; found=true; }
-      if(found)
-        continue;
-      else
+      if(!b[*pt-minVal])
         {
-          std::ostringstream oss; oss << "DataArrayInt::findIdInRangeForEachTuple : tuple #" << i << " not found by any ranges !";
-          throw INTERP_KERNEL::Exception(oss.str().c_str());
+          ret->pushBackSilent(*pt);
+          b[*pt-minVal]=true;
         }
     }
+  ret->copyStringInfoFrom(*this);
   return ret.retn();
 }
 
 /*!
- * \b WARNING this method is a \b non \a const \b method. This method works tuple by tuple. Each tuple is expected to be pairs (number of components must be equal to 2).
- * This method rearrange each pair in \a this so that, tuple with id \b tid will be after the call \c this->getIJ(tid,0)==this->getIJ(tid-1,1) and \c this->getIJ(tid,1)==this->getIJ(tid+1,0).
- * If it is impossible to reach such condition an exception will be thrown ! \b WARNING In case of throw \a this can be partially modified !
- * If this method has correctly worked, \a this will be able to be considered as a linked list.
- * This method does nothing if number of tuples is lower of equal to 1.
+ * Returns a new DataArrayInt which contains size of every of groups described by \a this
+ * "index" array. Such "index" array is returned for example by 
+ * \ref MEDCoupling::MEDCouplingUMesh::buildDescendingConnectivity
+ * "MEDCouplingUMesh::buildDescendingConnectivity" and
+ * \ref MEDCoupling::MEDCouplingUMesh::getNodalConnectivityIndex
+ * "MEDCouplingUMesh::getNodalConnectivityIndex" etc.
+ * This method preforms the reverse operation of DataArrayInt::computeOffsetsFull.
+ *  \return DataArrayInt * - a new instance of DataArrayInt, whose number of tuples
+ *          equals to \a this->getNumberOfComponents() - 1, and number of components is 1.
+ *          The caller is to delete this array using decrRef() as it is no more needed. 
+ *  \throw If \a this is not allocated.
+ *  \throw If \a this->getNumberOfComponents() != 1.
+ *  \throw If \a this->getNumberOfTuples() < 2.
  *
- * This method is useful for users having an unstructured mesh having only SEG2 to rearrange internaly the connectibity without any coordinates consideration.
+ *  \b Example: <br> 
+ *         - this contains [1,3,6,7,7,9,15]
+ *         - result array contains [2,3,1,0,2,6],
+ *          where 2 = 3 - 1, 3 = 6 - 3, 1 = 7 - 6 etc.
  *
- * \sa MEDCouplingUMesh::orderConsecutiveCells1D
+ * \sa DataArrayInt::computeOffsetsFull
  */
-void DataArrayInt::sortEachPairToMakeALinkedList()
+DataArrayInt *DataArrayInt::deltaShiftIndex() const
 {
   checkAllocated();
-  if(getNumberOfComponents()!=2)
-    throw INTERP_KERNEL::Exception("DataArrayInt::sortEachPairToMakeALinkedList : Only works on DataArrayInt instance with nb of components equal to 2 !");
-  int nbOfTuples(getNumberOfTuples());
-  if(nbOfTuples<=1)
-    return ;
-  int *conn(getPointer());
-  for(int i=1;i<nbOfTuples;i++,conn+=2)
-    {
-      if(i>1)
-        {
-          if(conn[2]==conn[3])
-            {
-              std::ostringstream oss; oss << "DataArrayInt::sortEachPairToMakeALinkedList : In the tuple #" << i << " presence of a pair filled with same ids !";
-              throw INTERP_KERNEL::Exception(oss.str().c_str());
-            }
-          if(conn[2]!=conn[1] && conn[3]==conn[1] && conn[2]!=conn[0])
-            std::swap(conn[2],conn[3]);
-          //not(conn[2]==conn[1] && conn[3]!=conn[1] && conn[3]!=conn[0])
-          if(conn[2]!=conn[1] || conn[3]==conn[1] || conn[3]==conn[0])
-            {
-              std::ostringstream oss; oss << "DataArrayInt::sortEachPairToMakeALinkedList : In the tuple #" << i << " something is invalid !";
-              throw INTERP_KERNEL::Exception(oss.str().c_str());
-            }
-        }
-      else
-        {
-          if(conn[0]==conn[1] || conn[2]==conn[3])
-            throw INTERP_KERNEL::Exception("DataArrayInt::sortEachPairToMakeALinkedList : In the 2 first tuples presence of a pair filled with same ids !");
-          int tmp[4];
-          std::set<int> s;
-          s.insert(conn,conn+4);
-          if(s.size()!=3)
-            throw INTERP_KERNEL::Exception("DataArrayInt::sortEachPairToMakeALinkedList : This can't be considered as a linked list regarding 2 first tuples !");
-          if(std::count(conn,conn+4,conn[0])==2)
-            {
-              tmp[0]=conn[1];
-              tmp[1]=conn[0];
-              tmp[2]=conn[0];
-              if(conn[2]==conn[0])
-                { tmp[3]=conn[3]; }
-              else
-                { tmp[3]=conn[2];}
-              std::copy(tmp,tmp+4,conn);
-            }
-          else
-            {//here we are sure to have (std::count(conn,conn+4,conn[1])==2)
-              if(conn[1]==conn[3])
-                std::swap(conn[2],conn[3]);
-            }
-        }
-    }
+  if(getNumberOfComponents()!=1)
+    throw INTERP_KERNEL::Exception("DataArrayInt::deltaShiftIndex : only single component allowed !");
+  int nbOfTuples=getNumberOfTuples();
+  if(nbOfTuples<2)
+    throw INTERP_KERNEL::Exception("DataArrayInt::deltaShiftIndex : 1 tuple at least must be present in 'this' !");
+  const int *ptr=getConstPointer();
+  DataArrayInt *ret=DataArrayInt::New();
+  ret->alloc(nbOfTuples-1,1);
+  int *out=ret->getPointer();
+  std::transform(ptr+1,ptr+nbOfTuples,ptr,out,std::minus<int>());
+  return ret;
 }
 
 /*!
- * 
- * \param [in] nbTimes specifies the nb of times each tuples in \a this will be duplicated contiguouly in returned DataArrayInt instance.
- *             \a nbTimes  should be at least equal to 1.
- * \return a newly allocated DataArrayInt having one component and number of tuples equal to \a nbTimes * \c this->getNumberOfTuples.
- * \throw if \a this is not allocated or if \a this has not number of components set to one or if \a nbTimes is lower than 1.
+ * Modifies \a this one-dimensional array so that value of each element \a x
+ * of \a this array (\a a) is computed as \f$ x_i = \sum_{j=0}^{i-1} a[ j ] \f$.
+ * Or: for each i>0 new[i]=new[i-1]+old[i-1] for i==0 new[i]=0. Number of tuples
+ * and components remains the same.<br>
+ * This method is useful for allToAllV in MPI with contiguous policy. This method
+ * differs from computeOffsetsFull() in that the number of tuples is \b not changed by
+ * this one.
+ *  \throw If \a this is not allocated.
+ *  \throw If \a this->getNumberOfComponents() != 1.
+ *
+ *  \b Example: <br>
+ *          - Before \a this contains [3,5,1,2,0,8]
+ *          - After \a this contains  [0,3,8,9,11,11]<br>
+ *          Note that the last element 19 = 11 + 8 is missing because size of \a this
+ *          array is retained and thus there is no space to store the last element.
  */
-DataArrayInt *DataArrayInt::duplicateEachTupleNTimes(int nbTimes) const
+void DataArrayInt::computeOffsets()
 {
   checkAllocated();
   if(getNumberOfComponents()!=1)
-    throw INTERP_KERNEL::Exception("DataArrayInt::duplicateEachTupleNTimes : this should have only one component !");
-  if(nbTimes<1)
-    throw INTERP_KERNEL::Exception("DataArrayInt::duplicateEachTupleNTimes : nb times should be >= 1 !");
-  int nbTuples=getNumberOfTuples();
-  const int *inPtr=getConstPointer();
-  MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(nbTimes*nbTuples,1);
-  int *retPtr=ret->getPointer();
-  for(int i=0;i<nbTuples;i++,inPtr++)
+    throw INTERP_KERNEL::Exception("DataArrayInt::computeOffsets : only single component allowed !");
+  int nbOfTuples=getNumberOfTuples();
+  if(nbOfTuples==0)
+    return ;
+  int *work=getPointer();
+  int tmp=work[0];
+  work[0]=0;
+  for(int i=1;i<nbOfTuples;i++)
     {
-      int val=*inPtr;
-      for(int j=0;j<nbTimes;j++,retPtr++)
-        *retPtr=val;
+      int tmp2=work[i];
+      work[i]=work[i-1]+tmp;
+      tmp=tmp2;
     }
-  ret->copyStringInfoFrom(*this);
-  return ret.retn();
-}
-
-/*!
- * This method returns all different values found in \a this. This method throws if \a this has not been allocated.
- * But the number of components can be different from one.
- * \return a newly allocated array (that should be dealt by the caller) containing different values in \a this.
- */
-DataArrayInt *DataArrayInt::getDifferentValues() const
-{
-  checkAllocated();
-  std::set<int> ret;
-  ret.insert(begin(),end());
-  MCAuto<DataArrayInt> ret2=DataArrayInt::New(); ret2->alloc((int)ret.size(),1);
-  std::copy(ret.begin(),ret.end(),ret2->getPointer());
-  return ret2.retn();
+  declareAsNew();
 }
 
+
 /*!
- * This method is a refinement of DataArrayInt::getDifferentValues because it returns not only different values in \a this but also, for each of
- * them it tells which tuple id have this id.
- * This method works only on arrays with one component (if it is not the case call DataArrayInt::rearrange(1) ).
- * This method returns two arrays having same size.
- * The instances of DataArrayInt in the returned vector have be specially allocated and computed by this method. Each of them should be dealt by the caller of this method.
- * Example : if this is equal to [1,0,1,2,0,2,2,-3,2] -> differentIds=[-3,0,1,2] and returned array will be equal to [[7],[1,4],[0,2],[3,5,6,8]]
+ * Modifies \a this one-dimensional array so that value of each element \a x
+ * of \a this array (\a a) is computed as \f$ x_i = \sum_{j=0}^{i-1} a[ j ] \f$.
+ * Or: for each i>0 new[i]=new[i-1]+old[i-1] for i==0 new[i]=0. Number
+ * components remains the same and number of tuples is inceamented by one.<br>
+ * This method is useful for allToAllV in MPI with contiguous policy. This method
+ * differs from computeOffsets() in that the number of tuples is changed by this one.
+ * This method preforms the reverse operation of DataArrayInt::deltaShiftIndex.
+ *  \throw If \a this is not allocated.
+ *  \throw If \a this->getNumberOfComponents() != 1.
+ *
+ *  \b Example: <br>
+ *          - Before \a this contains [3,5,1,2,0,8]
+ *          - After \a this contains  [0,3,8,9,11,11,19]<br>
+ * \sa DataArrayInt::deltaShiftIndex
  */
-std::vector<DataArrayInt *> DataArrayInt::partitionByDifferentValues(std::vector<int>& differentIds) const
+void DataArrayInt::computeOffsetsFull()
 {
   checkAllocated();
   if(getNumberOfComponents()!=1)
-    throw INTERP_KERNEL::Exception("DataArrayInt::partitionByDifferentValues : this should have only one component !");
-  int id=0;
-  std::map<int,int> m,m2,m3;
-  for(const int *w=begin();w!=end();w++)
-    m[*w]++;
-  differentIds.resize(m.size());
-  std::vector<DataArrayInt *> ret(m.size());
-  std::vector<int *> retPtr(m.size());
-  for(std::map<int,int>::const_iterator it=m.begin();it!=m.end();it++,id++)
-    {
-      m2[(*it).first]=id;
-      ret[id]=DataArrayInt::New();
-      ret[id]->alloc((*it).second,1);
-      retPtr[id]=ret[id]->getPointer();
-      differentIds[id]=(*it).first;
-    }
-  id=0;
-  for(const int *w=begin();w!=end();w++,id++)
-    {
-      retPtr[m2[*w]][m3[*w]++]=id;
-    }
-  return ret;
+    throw INTERP_KERNEL::Exception("DataArrayInt::computeOffsetsFull : only single component allowed !");
+  int nbOfTuples=getNumberOfTuples();
+  int *ret=(int *)malloc((nbOfTuples+1)*sizeof(int));
+  const int *work=getConstPointer();
+  ret[0]=0;
+  for(int i=0;i<nbOfTuples;i++)
+    ret[i+1]=work[i]+ret[i];
+  useArray(ret,true,C_DEALLOC,nbOfTuples+1,1);
+  declareAsNew();
 }
 
 /*!
- * This method split ids in [0, \c this->getNumberOfTuples() ) using \a this array as a field of weight (>=0 each).
- * The aim of this method is to return a set of \a nbOfSlices chunk of contiguous ids as balanced as possible.
+ * Returns two new DataArrayInt instances whose contents is computed from that of \a this and \a listOfIds arrays as follows.
+ * \a this is expected to be an offset format ( as returned by DataArrayInt::computeOffsetsFull ) that is to say with one component
+ * and ** sorted strictly increasingly **. \a listOfIds is expected to be sorted ascendingly (not strictly needed for \a listOfIds).
+ * This methods searches in \a this, considered as a set of contiguous \c this->getNumberOfComponents() ranges, all ids in \a listOfIds
+ * filling completely one of the ranges in \a this.
  *
- * \param [in] nbOfSlices - number of slices expected.
- * \return - a vector having a size equal to \a nbOfSlices giving the start (included) and the stop (excluded) of each chunks.
- * 
- * \sa DataArray::GetSlice
- * \throw If \a this is not allocated or not with exactly one component.
- * \throw If an element in \a this if < 0.
+ * \param [in] listOfIds a list of ids that has to be sorted ascendingly.
+ * \param [out] rangeIdsFetched the range ids fetched
+ * \param [out] idsInInputListThatFetch contains the list of ids in \a listOfIds that are \b fully included in a range in \a this. So
+ *              \a idsInInputListThatFetch is a part of input \a listOfIds.
+ *
+ * \sa DataArrayInt::computeOffsetsFull
+ *
+ *  \b Example: <br>
+ *          - \a this : [0,3,7,9,15,18]
+ *          - \a listOfIds contains  [0,1,2,3,7,8,15,16,17]
+ *          - \a rangeIdsFetched result array: [0,2,4]
+ *          - \a idsInInputListThatFetch result array: [0,1,2,7,8,15,16,17]
+ * In this example id 3 in input \a listOfIds is alone so it do not appear in output \a idsInInputListThatFetch.
+ * <br>
  */
-std::vector< std::pair<int,int> > DataArrayInt::splitInBalancedSlices(int nbOfSlices) const
+void DataArrayInt::findIdsRangesInListOfIds(const DataArrayInt *listOfIds, DataArrayInt *& rangeIdsFetched, DataArrayInt *& idsInInputListThatFetch) const
 {
-  if(!isAllocated() || getNumberOfComponents()!=1)
-    throw INTERP_KERNEL::Exception("DataArrayInt::splitInBalancedSlices : this array should have number of components equal to one and must be allocated !");
-  if(nbOfSlices<=0)
-    throw INTERP_KERNEL::Exception("DataArrayInt::splitInBalancedSlices : number of slices must be >= 1 !");
-  int sum(accumulate(0)),nbOfTuples(getNumberOfTuples());
-  int sumPerSlc(sum/nbOfSlices),pos(0);
-  const int *w(begin());
-  std::vector< std::pair<int,int> > ret(nbOfSlices);
-  for(int i=0;i<nbOfSlices;i++)
+  if(!listOfIds)
+    throw INTERP_KERNEL::Exception("DataArrayInt::findIdsRangesInListOfIds : input list of ids is null !");
+  listOfIds->checkAllocated(); checkAllocated();
+  if(listOfIds->getNumberOfComponents()!=1)
+    throw INTERP_KERNEL::Exception("DataArrayInt::findIdsRangesInListOfIds : input list of ids must have exactly one component !");
+  if(getNumberOfComponents()!=1)
+    throw INTERP_KERNEL::Exception("DataArrayInt::findIdsRangesInListOfIds : this must have exactly one component !");
+  MCAuto<DataArrayInt> ret0=DataArrayInt::New(); ret0->alloc(0,1);
+  MCAuto<DataArrayInt> ret1=DataArrayInt::New(); ret1->alloc(0,1);
+  const int *tupEnd(listOfIds->end()),*offBg(begin()),*offEnd(end()-1);
+  const int *tupPtr(listOfIds->begin()),*offPtr(offBg);
+  while(tupPtr!=tupEnd && offPtr!=offEnd)
     {
-      std::pair<int,int> p(pos,-1);
-      int locSum(0);
-      while(locSum<sumPerSlc && pos<nbOfTuples) { pos++; locSum+=*w++; }
-      if(i!=nbOfSlices-1)
-        p.second=pos;
+      if(*tupPtr==*offPtr)
+        {
+          int i=offPtr[0];
+          while(i<offPtr[1] && *tupPtr==i && tupPtr!=tupEnd) { i++; tupPtr++; }
+          if(i==offPtr[1])
+            {
+              ret0->pushBackSilent((int)std::distance(offBg,offPtr));
+              ret1->pushBackValsSilent(tupPtr-(offPtr[1]-offPtr[0]),tupPtr);
+              offPtr++;
+            }
+        }
       else
-        p.second=nbOfTuples;
-      ret[i]=p;
+        { if(*tupPtr<*offPtr) tupPtr++; else offPtr++; }
     }
-  return ret;
+  rangeIdsFetched=ret0.retn();
+  idsInInputListThatFetch=ret1.retn();
 }
 
 /*!
- * Returns a new DataArrayInt that is a sum of two given arrays. There are 3
- * valid cases.
- * 1.  The arrays have same number of tuples and components. Then each value of
- *   the result array (_a_) is a sum of the corresponding values of \a a1 and \a a2,
- *   i.e.: _a_ [ i, j ] = _a1_ [ i, j ] + _a2_ [ i, j ].
- * 2.  The arrays have same number of tuples and one array, say _a2_, has one
- *   component. Then
- *   _a_ [ i, j ] = _a1_ [ i, j ] + _a2_ [ i, 0 ].
- * 3.  The arrays have same number of components and one array, say _a2_, has one
- *   tuple. Then
- *   _a_ [ i, j ] = _a1_ [ i, j ] + _a2_ [ 0, j ].
+ * Returns a new DataArrayInt whose contents is computed from that of \a this and \a
+ * offsets arrays as follows. \a offsets is a one-dimensional array considered as an
+ * "index" array of a "iota" array, thus, whose each element gives an index of a group
+ * beginning within the "iota" array. And \a this is a one-dimensional array
+ * considered as a selector of groups described by \a offsets to include into the result array.
+ *  \throw If \a offsets is NULL.
+ *  \throw If \a offsets is not allocated.
+ *  \throw If \a offsets->getNumberOfComponents() != 1.
+ *  \throw If \a offsets is not monotonically increasing.
+ *  \throw If \a this is not allocated.
+ *  \throw If \a this->getNumberOfComponents() != 1.
+ *  \throw If any element of \a this is not a valid index for \a offsets array.
  *
- * Info on components is copied either from the first array (in the first case) or from
- * the array with maximal number of elements (getNbOfElems()).
- *  \param [in] a1 - an array to sum up.
- *  \param [in] a2 - another array to sum up.
- *  \return DataArrayInt * - the new instance of DataArrayInt.
- *          The caller is to delete this result array using decrRef() as it is no more
- *          needed.
- *  \throw If either \a a1 or \a a2 is NULL.
- *  \throw If \a a1->getNumberOfTuples() != \a a2->getNumberOfTuples() and
- *         \a a1->getNumberOfComponents() != \a a2->getNumberOfComponents() and
- *         none of them has number of tuples or components equal to 1.
+ *  \b Example: <br>
+ *          - \a this: [0,2,3]
+ *          - \a offsets: [0,3,6,10,14,20]
+ *          - result array: [0,1,2,6,7,8,9,10,11,12,13] == <br>
+ *            \c range(0,3) + \c range(6,10) + \c range(10,14) ==<br>
+ *            \c range( \a offsets[ \a this[0] ], offsets[ \a this[0]+1 ]) + 
+ *            \c range( \a offsets[ \a this[1] ], offsets[ \a this[1]+1 ]) + 
+ *            \c range( \a offsets[ \a this[2] ], offsets[ \a this[2]+1 ])
  */
-DataArrayInt *DataArrayInt::Add(const DataArrayInt *a1, const DataArrayInt *a2)
+DataArrayInt *DataArrayInt::buildExplicitArrByRanges(const DataArrayInt *offsets) const
 {
-  if(!a1 || !a2)
-    throw INTERP_KERNEL::Exception("DataArrayInt::Add : input DataArrayInt instance is NULL !");
-  int nbOfTuple=a1->getNumberOfTuples();
-  int nbOfTuple2=a2->getNumberOfTuples();
-  int nbOfComp=a1->getNumberOfComponents();
-  int nbOfComp2=a2->getNumberOfComponents();
-  MCAuto<DataArrayInt> ret=0;
-  if(nbOfTuple==nbOfTuple2)
+  if(!offsets)
+    throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrByRanges : DataArrayInt pointer in input is NULL !");
+  checkAllocated();
+  if(getNumberOfComponents()!=1)
+    throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrByRanges : only single component allowed !");
+  offsets->checkAllocated();
+  if(offsets->getNumberOfComponents()!=1)
+    throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrByRanges : input array should have only single component !");
+  int othNbTuples=offsets->getNumberOfTuples()-1;
+  int nbOfTuples=getNumberOfTuples();
+  int retNbOftuples=0;
+  const int *work=getConstPointer();
+  const int *offPtr=offsets->getConstPointer();
+  for(int i=0;i<nbOfTuples;i++)
     {
-      if(nbOfComp==nbOfComp2)
-        {
-          ret=DataArrayInt::New();
-          ret->alloc(nbOfTuple,nbOfComp);
-          std::transform(a1->begin(),a1->end(),a2->begin(),ret->getPointer(),std::plus<int>());
-          ret->copyStringInfoFrom(*a1);
-        }
-      else
+      int val=work[i];
+      if(val>=0 && val<othNbTuples)
         {
-          int nbOfCompMin,nbOfCompMax;
-          const DataArrayInt *aMin, *aMax;
-          if(nbOfComp>nbOfComp2)
-            {
-              nbOfCompMin=nbOfComp2; nbOfCompMax=nbOfComp;
-              aMin=a2; aMax=a1;
-            }
+          int delta=offPtr[val+1]-offPtr[val];
+          if(delta>=0)
+            retNbOftuples+=delta;
           else
             {
-              nbOfCompMin=nbOfComp; nbOfCompMax=nbOfComp2;
-              aMin=a1; aMax=a2;
-            }
-          if(nbOfCompMin==1)
-            {
-              ret=DataArrayInt::New();
-              ret->alloc(nbOfTuple,nbOfCompMax);
-              const int *aMinPtr=aMin->getConstPointer();
-              const int *aMaxPtr=aMax->getConstPointer();
-              int *res=ret->getPointer();
-              for(int i=0;i<nbOfTuple;i++)
-                res=std::transform(aMaxPtr+i*nbOfCompMax,aMaxPtr+(i+1)*nbOfCompMax,res,std::bind2nd(std::plus<int>(),aMinPtr[i]));
-              ret->copyStringInfoFrom(*aMax);
+              std::ostringstream oss; oss << "DataArrayInt::buildExplicitArrByRanges : Tuple #" << val << " of offset array has a delta < 0 !";
+              throw INTERP_KERNEL::Exception(oss.str().c_str());
             }
-          else
-            throw INTERP_KERNEL::Exception("Nb of components mismatch for array Add !");
         }
-    }
-  else if((nbOfTuple==1 && nbOfTuple2>1) || (nbOfTuple>1 && nbOfTuple2==1))
-    {
-      if(nbOfComp==nbOfComp2)
+      else
         {
-          int nbOfTupleMax=std::max(nbOfTuple,nbOfTuple2);
-          const DataArrayInt *aMin=nbOfTuple>nbOfTuple2?a2:a1;
-          const DataArrayInt *aMax=nbOfTuple>nbOfTuple2?a1:a2;
-          const int *aMinPtr=aMin->getConstPointer(),*aMaxPtr=aMax->getConstPointer();
-          ret=DataArrayInt::New();
-          ret->alloc(nbOfTupleMax,nbOfComp);
-          int *res=ret->getPointer();
-          for(int i=0;i<nbOfTupleMax;i++)
-            res=std::transform(aMaxPtr+i*nbOfComp,aMaxPtr+(i+1)*nbOfComp,aMinPtr,res,std::plus<int>());
-          ret->copyStringInfoFrom(*aMax);
+          std::ostringstream oss; oss << "DataArrayInt::buildExplicitArrByRanges : Tuple #" << i << " in this contains " << val;
+          oss << " whereas offsets array is of size " << othNbTuples+1 << " !";
+          throw INTERP_KERNEL::Exception(oss.str().c_str());
         }
-      else
-        throw INTERP_KERNEL::Exception("Nb of components mismatch for array Add !");
     }
-  else
-    throw INTERP_KERNEL::Exception("Nb of tuples mismatch for array Add !");
+  MCAuto<DataArrayInt> ret=DataArrayInt::New();
+  ret->alloc(retNbOftuples,1);
+  int *retPtr=ret->getPointer();
+  for(int i=0;i<nbOfTuples;i++)
+    {
+      int val=work[i];
+      int start=offPtr[val];
+      int off=offPtr[val+1]-start;
+      for(int j=0;j<off;j++,retPtr++)
+        *retPtr=start+j;
+    }
   return ret.retn();
 }
 
 /*!
- * Adds values of another DataArrayInt to values of \a this one. There are 3
- * valid cases.
- * 1.  The arrays have same number of tuples and components. Then each value of
- *   \a other array is added to the corresponding value of \a this array, i.e.:
- *   _a_ [ i, j ] += _other_ [ i, j ].
- * 2.  The arrays have same number of tuples and \a other array has one component. Then
- *   _a_ [ i, j ] += _other_ [ i, 0 ].
- * 3.  The arrays have same number of components and \a other array has one tuple. Then
- *   _a_ [ i, j ] += _a2_ [ 0, j ].
+ * Returns a new DataArrayInt whose contents is computed using \a this that must be a 
+ * scaled array (monotonically increasing).
+from that of \a this and \a
+ * offsets arrays as follows. \a offsets is a one-dimensional array considered as an
+ * "index" array of a "iota" array, thus, whose each element gives an index of a group
+ * beginning within the "iota" array. And \a this is a one-dimensional array
+ * considered as a selector of groups described by \a offsets to include into the result array.
+ *  \throw If \a  is NULL.
+ *  \throw If \a this is not allocated.
+ *  \throw If \a this->getNumberOfComponents() != 1.
+ *  \throw If \a this->getNumberOfTuples() == 0.
+ *  \throw If \a this is not monotonically increasing.
+ *  \throw If any element of ids in ( \a bg \a stop \a step ) points outside the scale in \a this.
  *
- *  \param [in] other - an array to add to \a this one.
- *  \throw If \a other is NULL.
- *  \throw If \a this->getNumberOfTuples() != \a other->getNumberOfTuples() and
- *         \a this->getNumberOfComponents() != \a other->getNumberOfComponents() and
- *         \a other has number of both tuples and components not equal to 1.
+ *  \b Example: <br>
+ *          - \a bg , \a stop and \a step : (0,5,2)
+ *          - \a this: [0,3,6,10,14,20]
+ *          - result array: [0,0,0, 2,2,2,2, 4,4,4,4,4,4] == <br>
  */
-void DataArrayInt::addEqual(const DataArrayInt *other)
-{
-  if(!other)
-    throw INTERP_KERNEL::Exception("DataArrayInt::addEqual : input DataArrayInt instance is NULL !");
-  const char *msg="Nb of tuples mismatch for DataArrayInt::addEqual  !";
-  checkAllocated(); other->checkAllocated();
-  int nbOfTuple=getNumberOfTuples();
-  int nbOfTuple2=other->getNumberOfTuples();
-  int nbOfComp=getNumberOfComponents();
-  int nbOfComp2=other->getNumberOfComponents();
-  if(nbOfTuple==nbOfTuple2)
+DataArrayInt *DataArrayInt::buildExplicitArrOfSliceOnScaledArr(int bg, int stop, int step) const
+{
+  if(!isAllocated())
+    throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr : not allocated array !");
+  if(getNumberOfComponents()!=1)
+    throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr : number of components is expected to be equal to one !");
+  int nbOfTuples(getNumberOfTuples());
+  if(nbOfTuples==0)
+    throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr : number of tuples must be != 0 !");
+  const int *ids(begin());
+  int nbOfEltsInSlc(GetNumberOfItemGivenBESRelative(bg,stop,step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr")),sz(0),pos(bg);
+  for(int i=0;i<nbOfEltsInSlc;i++,pos+=step)
     {
-      if(nbOfComp==nbOfComp2)
+      if(pos>=0 && pos<nbOfTuples-1)
         {
-          std::transform(begin(),end(),other->begin(),getPointer(),std::plus<int>());
+          int delta(ids[pos+1]-ids[pos]);
+          sz+=delta;
+          if(delta<0)
+            {
+              std::ostringstream oss; oss << "DataArrayInt::buildExplicitArrOfSliceOnScaledArr : At pos #" << i << " of input slice, value is " << pos << " and at this pos this is not monotonically increasing !";
+              throw INTERP_KERNEL::Exception(oss.str().c_str());
+            }          
         }
-      else if(nbOfComp2==1)
+      else
         {
-          int *ptr=getPointer();
-          const int *ptrc=other->getConstPointer();
-          for(int i=0;i<nbOfTuple;i++)
-            std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptr+i*nbOfComp,std::bind2nd(std::plus<int>(),*ptrc++));
+          std::ostringstream oss; oss << "DataArrayInt::buildExplicitArrOfSliceOnScaledArr : At pos #" << i << " of input slice, value is " << pos << " should be in [0," << nbOfTuples-1 << ") !";  
+          throw INTERP_KERNEL::Exception(oss.str().c_str());
         }
-      else
-        throw INTERP_KERNEL::Exception(msg);
     }
-  else if(nbOfTuple2==1)
+  MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(sz,1);
+  int *retPtr(ret->getPointer());
+  pos=bg;
+  for(int i=0;i<nbOfEltsInSlc;i++,pos+=step)
     {
-      if(nbOfComp2==nbOfComp)
-        {
-          int *ptr=getPointer();
-          const int *ptrc=other->getConstPointer();
-          for(int i=0;i<nbOfTuple;i++)
-            std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptrc,ptr+i*nbOfComp,std::plus<int>());
-        }
-      else
-        throw INTERP_KERNEL::Exception(msg);
+      int delta(ids[pos+1]-ids[pos]);
+      for(int j=0;j<delta;j++,retPtr++)
+        *retPtr=pos;
     }
-  else
-    throw INTERP_KERNEL::Exception(msg);
-  declareAsNew();
+  return ret.retn();
 }
 
 /*!
- * Returns a new DataArrayInt that is a subtraction of two given arrays. There are 3
- * valid cases.
- * 1.  The arrays have same number of tuples and components. Then each value of
- *   the result array (_a_) is a subtraction of the corresponding values of \a a1 and
- *   \a a2, i.e.: _a_ [ i, j ] = _a1_ [ i, j ] - _a2_ [ i, j ].
- * 2.  The arrays have same number of tuples and one array, say _a2_, has one
- *   component. Then
- *   _a_ [ i, j ] = _a1_ [ i, j ] - _a2_ [ i, 0 ].
- * 3.  The arrays have same number of components and one array, say _a2_, has one
- *   tuple. Then
- *   _a_ [ i, j ] = _a1_ [ i, j ] - _a2_ [ 0, j ].
+ * Given in input ranges \a ranges, it returns a newly allocated DataArrayInt instance having one component and the same number of tuples than \a this.
+ * For each tuple at place **i** in \a this it tells which is the first range in \a ranges that contains value \c this->getIJ(i,0) and put the result
+ * in tuple **i** of returned DataArrayInt.
+ * If ranges overlapped (in theory it should not) this method do not detect it and always returns the first range.
  *
- * Info on components is copied either from the first array (in the first case) or from
- * the array with maximal number of elements (getNbOfElems()).
- *  \param [in] a1 - an array to subtract from.
- *  \param [in] a2 - an array to subtract.
- *  \return DataArrayInt * - the new instance of DataArrayInt.
- *          The caller is to delete this result array using decrRef() as it is no more
- *          needed.
- *  \throw If either \a a1 or \a a2 is NULL.
- *  \throw If \a a1->getNumberOfTuples() != \a a2->getNumberOfTuples() and
- *         \a a1->getNumberOfComponents() != \a a2->getNumberOfComponents() and
- *         none of them has number of tuples or components equal to 1.
+ * For example if \a this contains : [1,24,7,8,10,17] and \a ranges contains [(0,3),(3,8),(8,15),(15,22),(22,30)]
+ * The return DataArrayInt will contain : **[0,4,1,2,2,3]**
+ * 
+ * \param [in] ranges typically come from output of MEDCouplingUMesh::ComputeRangesFromTypeDistribution. Each range is specified like this : 1st component is
+ *             for lower value included and 2nd component is the upper value of corresponding range **excluded**.
+ * \throw If offsets is a null pointer or does not have 2 components or if \a this is not allocated or \a this do not have exactly one component. To finish an exception
+ *        is thrown if no ranges in \a ranges contains value in \a this.
+ * 
+ * \sa DataArrayInt::findIdInRangeForEachTuple
  */
-DataArrayInt *DataArrayInt::Substract(const DataArrayInt *a1, const DataArrayInt *a2)
+DataArrayInt *DataArrayInt::findRangeIdForEachTuple(const DataArrayInt *ranges) const
 {
-  if(!a1 || !a2)
-    throw INTERP_KERNEL::Exception("DataArrayInt::Substract : input DataArrayInt instance is NULL !");
-  int nbOfTuple1=a1->getNumberOfTuples();
-  int nbOfTuple2=a2->getNumberOfTuples();
-  int nbOfComp1=a1->getNumberOfComponents();
-  int nbOfComp2=a2->getNumberOfComponents();
-  if(nbOfTuple2==nbOfTuple1)
+  if(!ranges)
+    throw INTERP_KERNEL::Exception("DataArrayInt::findRangeIdForEachTuple : null input pointer !");
+  if(ranges->getNumberOfComponents()!=2)
+    throw INTERP_KERNEL::Exception("DataArrayInt::findRangeIdForEachTuple : input DataArrayInt instance should have 2 components !");
+  checkAllocated();
+  if(getNumberOfComponents()!=1)
+    throw INTERP_KERNEL::Exception("DataArrayInt::findRangeIdForEachTuple : this should have only one component !");
+  int nbTuples=getNumberOfTuples();
+  MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(nbTuples,1);
+  int nbOfRanges=ranges->getNumberOfTuples();
+  const int *rangesPtr=ranges->getConstPointer();
+  int *retPtr=ret->getPointer();
+  const int *inPtr=getConstPointer();
+  for(int i=0;i<nbTuples;i++,retPtr++)
     {
-      if(nbOfComp1==nbOfComp2)
-        {
-          MCAuto<DataArrayInt> ret=DataArrayInt::New();
-          ret->alloc(nbOfTuple2,nbOfComp1);
-          std::transform(a1->begin(),a1->end(),a2->begin(),ret->getPointer(),std::minus<int>());
-          ret->copyStringInfoFrom(*a1);
-          return ret.retn();
-        }
-      else if(nbOfComp2==1)
-        {
-          MCAuto<DataArrayInt> ret=DataArrayInt::New();
-          ret->alloc(nbOfTuple1,nbOfComp1);
-          const int *a2Ptr=a2->getConstPointer();
-          const int *a1Ptr=a1->getConstPointer();
-          int *res=ret->getPointer();
-          for(int i=0;i<nbOfTuple1;i++)
-            res=std::transform(a1Ptr+i*nbOfComp1,a1Ptr+(i+1)*nbOfComp1,res,std::bind2nd(std::minus<int>(),a2Ptr[i]));
-          ret->copyStringInfoFrom(*a1);
-          return ret.retn();
-        }
+      int val=inPtr[i];
+      bool found=false;
+      for(int j=0;j<nbOfRanges && !found;j++)
+        if(val>=rangesPtr[2*j] && val<rangesPtr[2*j+1])
+          { *retPtr=j; found=true; }
+      if(found)
+        continue;
       else
         {
-          a1->checkNbOfComps(nbOfComp2,"Nb of components mismatch for array Substract !");
-          return 0;
+          std::ostringstream oss; oss << "DataArrayInt::findRangeIdForEachTuple : tuple #" << i << " not found by any ranges !";
+          throw INTERP_KERNEL::Exception(oss.str().c_str());
         }
     }
-  else if(nbOfTuple2==1)
-    {
-      a1->checkNbOfComps(nbOfComp2,"Nb of components mismatch for array Substract !");
-      MCAuto<DataArrayInt> ret=DataArrayInt::New();
-      ret->alloc(nbOfTuple1,nbOfComp1);
-      const int *a1ptr=a1->getConstPointer(),*a2ptr=a2->getConstPointer();
-      int *pt=ret->getPointer();
-      for(int i=0;i<nbOfTuple1;i++)
-        pt=std::transform(a1ptr+i*nbOfComp1,a1ptr+(i+1)*nbOfComp1,a2ptr,pt,std::minus<int>());
-      ret->copyStringInfoFrom(*a1);
-      return ret.retn();
-    }
-  else
-    {
-      a1->checkNbOfTuples(nbOfTuple2,"Nb of tuples mismatch for array Substract !");//will always throw an exception
-      return 0;
-    }
+  return ret.retn();
 }
 
 /*!
- * Subtract values of another DataArrayInt from values of \a this one. There are 3
- * valid cases.
- * 1.  The arrays have same number of tuples and components. Then each value of
- *   \a other array is subtracted from the corresponding value of \a this array, i.e.:
- *   _a_ [ i, j ] -= _other_ [ i, j ].
- * 2.  The arrays have same number of tuples and \a other array has one component. Then
- *   _a_ [ i, j ] -= _other_ [ i, 0 ].
- * 3.  The arrays have same number of components and \a other array has one tuple. Then
- *   _a_ [ i, j ] -= _a2_ [ 0, j ].
+ * Given in input ranges \a ranges, it returns a newly allocated DataArrayInt instance having one component and the same number of tuples than \a this.
+ * For each tuple at place **i** in \a this it tells which is the sub position of the first range in \a ranges that contains value \c this->getIJ(i,0) and put the result
+ * in tuple **i** of returned DataArrayInt.
+ * If ranges overlapped (in theory it should not) this method do not detect it and always returns the sub position of the first range.
  *
- *  \param [in] other - an array to subtract from \a this one.
- *  \throw If \a other is NULL.
- *  \throw If \a this->getNumberOfTuples() != \a other->getNumberOfTuples() and
- *         \a this->getNumberOfComponents() != \a other->getNumberOfComponents() and
- *         \a other has number of both tuples and components not equal to 1.
+ * For example if \a this contains : [1,24,7,8,10,17] and \a ranges contains [(0,3),(3,8),(8,15),(15,22),(22,30)]
+ * The return DataArrayInt will contain : **[1,2,4,0,2,2]**
+ * This method is often called in pair with DataArrayInt::findRangeIdForEachTuple method.
+ * 
+ * \param [in] ranges typically come from output of MEDCouplingUMesh::ComputeRangesFromTypeDistribution. Each range is specified like this : 1st component is
+ *             for lower value included and 2nd component is the upper value of corresponding range **excluded**.
+ * \throw If offsets is a null pointer or does not have 2 components or if \a this is not allocated or \a this do not have exactly one component. To finish an exception
+ *        is thrown if no ranges in \a ranges contains value in \a this.
+ * \sa DataArrayInt::findRangeIdForEachTuple
  */
-void DataArrayInt::substractEqual(const DataArrayInt *other)
+DataArrayInt *DataArrayInt::findIdInRangeForEachTuple(const DataArrayInt *ranges) const
 {
-  if(!other)
-    throw INTERP_KERNEL::Exception("DataArrayInt::substractEqual : input DataArrayInt instance is NULL !");
-  const char *msg="Nb of tuples mismatch for DataArrayInt::substractEqual  !";
-  checkAllocated(); other->checkAllocated();
-  int nbOfTuple=getNumberOfTuples();
-  int nbOfTuple2=other->getNumberOfTuples();
-  int nbOfComp=getNumberOfComponents();
-  int nbOfComp2=other->getNumberOfComponents();
-  if(nbOfTuple==nbOfTuple2)
+  if(!ranges)
+    throw INTERP_KERNEL::Exception("DataArrayInt::findIdInRangeForEachTuple : null input pointer !");
+  if(ranges->getNumberOfComponents()!=2)
+    throw INTERP_KERNEL::Exception("DataArrayInt::findIdInRangeForEachTuple : input DataArrayInt instance should have 2 components !");
+  checkAllocated();
+  if(getNumberOfComponents()!=1)
+    throw INTERP_KERNEL::Exception("DataArrayInt::findIdInRangeForEachTuple : this should have only one component !");
+  int nbTuples=getNumberOfTuples();
+  MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(nbTuples,1);
+  int nbOfRanges=ranges->getNumberOfTuples();
+  const int *rangesPtr=ranges->getConstPointer();
+  int *retPtr=ret->getPointer();
+  const int *inPtr=getConstPointer();
+  for(int i=0;i<nbTuples;i++,retPtr++)
     {
-      if(nbOfComp==nbOfComp2)
-        {
-          std::transform(begin(),end(),other->begin(),getPointer(),std::minus<int>());
-        }
-      else if(nbOfComp2==1)
+      int val=inPtr[i];
+      bool found=false;
+      for(int j=0;j<nbOfRanges && !found;j++)
+        if(val>=rangesPtr[2*j] && val<rangesPtr[2*j+1])
+          { *retPtr=val-rangesPtr[2*j]; found=true; }
+      if(found)
+        continue;
+      else
         {
-          int *ptr=getPointer();
-          const int *ptrc=other->getConstPointer();
-          for(int i=0;i<nbOfTuple;i++)
-            std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptr+i*nbOfComp,std::bind2nd(std::minus<int>(),*ptrc++));
+          std::ostringstream oss; oss << "DataArrayInt::findIdInRangeForEachTuple : tuple #" << i << " not found by any ranges !";
+          throw INTERP_KERNEL::Exception(oss.str().c_str());
         }
-      else
-        throw INTERP_KERNEL::Exception(msg);
-    }
-  else if(nbOfTuple2==1)
-    {
-      int *ptr=getPointer();
-      const int *ptrc=other->getConstPointer();
-      for(int i=0;i<nbOfTuple;i++)
-        std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptrc,ptr+i*nbOfComp,std::minus<int>());
     }
-  else
-    throw INTERP_KERNEL::Exception(msg);
-  declareAsNew();
+  return ret.retn();
 }
 
 /*!
- * Returns a new DataArrayInt that is a product of two given arrays. There are 3
- * valid cases.
- * 1.  The arrays have same number of tuples and components. Then each value of
- *   the result array (_a_) is a product of the corresponding values of \a a1 and
- *   \a a2, i.e.: _a_ [ i, j ] = _a1_ [ i, j ] * _a2_ [ i, j ].
- * 2.  The arrays have same number of tuples and one array, say _a2_, has one
- *   component. Then
- *   _a_ [ i, j ] = _a1_ [ i, j ] * _a2_ [ i, 0 ].
- * 3.  The arrays have same number of components and one array, say _a2_, has one
- *   tuple. Then
- *   _a_ [ i, j ] = _a1_ [ i, j ] * _a2_ [ 0, j ].
+ * \b WARNING this method is a \b non \a const \b method. This method works tuple by tuple. Each tuple is expected to be pairs (number of components must be equal to 2).
+ * This method rearrange each pair in \a this so that, tuple with id \b tid will be after the call \c this->getIJ(tid,0)==this->getIJ(tid-1,1) and \c this->getIJ(tid,1)==this->getIJ(tid+1,0).
+ * If it is impossible to reach such condition an exception will be thrown ! \b WARNING In case of throw \a this can be partially modified !
+ * If this method has correctly worked, \a this will be able to be considered as a linked list.
+ * This method does nothing if number of tuples is lower of equal to 1.
  *
- * Info on components is copied either from the first array (in the first case) or from
- * the array with maximal number of elements (getNbOfElems()).
- *  \param [in] a1 - a factor array.
- *  \param [in] a2 - another factor array.
- *  \return DataArrayInt * - the new instance of DataArrayInt.
- *          The caller is to delete this result array using decrRef() as it is no more
- *          needed.
- *  \throw If either \a a1 or \a a2 is NULL.
- *  \throw If \a a1->getNumberOfTuples() != \a a2->getNumberOfTuples() and
- *         \a a1->getNumberOfComponents() != \a a2->getNumberOfComponents() and
- *         none of them has number of tuples or components equal to 1.
+ * This method is useful for users having an unstructured mesh having only SEG2 to rearrange internaly the connectibity without any coordinates consideration.
+ *
+ * \sa MEDCouplingUMesh::orderConsecutiveCells1D, DataArrayInt::fromLinkedListOfPairToList
  */
-DataArrayInt *DataArrayInt::Multiply(const DataArrayInt *a1, const DataArrayInt *a2)
+void DataArrayInt::sortEachPairToMakeALinkedList()
 {
-  if(!a1 || !a2)
-    throw INTERP_KERNEL::Exception("DataArrayInt::Multiply : input DataArrayInt instance is NULL !");
-  int nbOfTuple=a1->getNumberOfTuples();
-  int nbOfTuple2=a2->getNumberOfTuples();
-  int nbOfComp=a1->getNumberOfComponents();
-  int nbOfComp2=a2->getNumberOfComponents();
-  MCAuto<DataArrayInt> ret=0;
-  if(nbOfTuple==nbOfTuple2)
+  checkAllocated();
+  if(getNumberOfComponents()!=2)
+    throw INTERP_KERNEL::Exception("DataArrayInt::sortEachPairToMakeALinkedList : Only works on DataArrayInt instance with nb of components equal to 2 !");
+  int nbOfTuples(getNumberOfTuples());
+  if(nbOfTuples<=1)
+    return ;
+  int *conn(getPointer());
+  for(int i=1;i<nbOfTuples;i++,conn+=2)
     {
-      if(nbOfComp==nbOfComp2)
+      if(i>1)
         {
-          ret=DataArrayInt::New();
-          ret->alloc(nbOfTuple,nbOfComp);
-          std::transform(a1->begin(),a1->end(),a2->begin(),ret->getPointer(),std::multiplies<int>());
-          ret->copyStringInfoFrom(*a1);
+          if(conn[2]==conn[3])
+            {
+              std::ostringstream oss; oss << "DataArrayInt::sortEachPairToMakeALinkedList : In the tuple #" << i << " presence of a pair filled with same ids !";
+              throw INTERP_KERNEL::Exception(oss.str().c_str());
+            }
+          if(conn[2]!=conn[1] && conn[3]==conn[1] && conn[2]!=conn[0])
+            std::swap(conn[2],conn[3]);
+          //not(conn[2]==conn[1] && conn[3]!=conn[1] && conn[3]!=conn[0])
+          if(conn[2]!=conn[1] || conn[3]==conn[1] || conn[3]==conn[0])
+            {
+              std::ostringstream oss; oss << "DataArrayInt::sortEachPairToMakeALinkedList : In the tuple #" << i << " something is invalid !";
+              throw INTERP_KERNEL::Exception(oss.str().c_str());
+            }
         }
       else
         {
-          int nbOfCompMin,nbOfCompMax;
-          const DataArrayInt *aMin, *aMax;
-          if(nbOfComp>nbOfComp2)
+          if(conn[0]==conn[1] || conn[2]==conn[3])
+            throw INTERP_KERNEL::Exception("DataArrayInt::sortEachPairToMakeALinkedList : In the 2 first tuples presence of a pair filled with same ids !");
+          int tmp[4];
+          std::set<int> s;
+          s.insert(conn,conn+4);
+          if(s.size()!=3)
+            throw INTERP_KERNEL::Exception("DataArrayInt::sortEachPairToMakeALinkedList : This can't be considered as a linked list regarding 2 first tuples !");
+          if(std::count(conn,conn+4,conn[0])==2)
             {
-              nbOfCompMin=nbOfComp2; nbOfCompMax=nbOfComp;
-              aMin=a2; aMax=a1;
+              tmp[0]=conn[1];
+              tmp[1]=conn[0];
+              tmp[2]=conn[0];
+              if(conn[2]==conn[0])
+                { tmp[3]=conn[3]; }
+              else
+                { tmp[3]=conn[2];}
+              std::copy(tmp,tmp+4,conn);
             }
           else
-            {
-              nbOfCompMin=nbOfComp; nbOfCompMax=nbOfComp2;
-              aMin=a1; aMax=a2;
-            }
-          if(nbOfCompMin==1)
-            {
-              ret=DataArrayInt::New();
-              ret->alloc(nbOfTuple,nbOfCompMax);
-              const int *aMinPtr=aMin->getConstPointer();
-              const int *aMaxPtr=aMax->getConstPointer();
-              int *res=ret->getPointer();
-              for(int i=0;i<nbOfTuple;i++)
-                res=std::transform(aMaxPtr+i*nbOfCompMax,aMaxPtr+(i+1)*nbOfCompMax,res,std::bind2nd(std::multiplies<int>(),aMinPtr[i]));
-              ret->copyStringInfoFrom(*aMax);
+            {//here we are sure to have (std::count(conn,conn+4,conn[1])==2)
+              if(conn[1]==conn[3])
+                std::swap(conn[2],conn[3]);
             }
-          else
-            throw INTERP_KERNEL::Exception("Nb of components mismatch for array Multiply !");
         }
     }
-  else if((nbOfTuple==1 && nbOfTuple2>1) || (nbOfTuple>1 && nbOfTuple2==1))
-    {
-      if(nbOfComp==nbOfComp2)
-        {
-          int nbOfTupleMax=std::max(nbOfTuple,nbOfTuple2);
-          const DataArrayInt *aMin=nbOfTuple>nbOfTuple2?a2:a1;
-          const DataArrayInt *aMax=nbOfTuple>nbOfTuple2?a1:a2;
-          const int *aMinPtr=aMin->getConstPointer(),*aMaxPtr=aMax->getConstPointer();
-          ret=DataArrayInt::New();
-          ret->alloc(nbOfTupleMax,nbOfComp);
-          int *res=ret->getPointer();
-          for(int i=0;i<nbOfTupleMax;i++)
-            res=std::transform(aMaxPtr+i*nbOfComp,aMaxPtr+(i+1)*nbOfComp,aMinPtr,res,std::multiplies<int>());
-          ret->copyStringInfoFrom(*aMax);
-        }
-      else
-        throw INTERP_KERNEL::Exception("Nb of components mismatch for array Multiply !");
-    }
-  else
-    throw INTERP_KERNEL::Exception("Nb of tuples mismatch for array Multiply !");
-  return ret.retn();
 }
 
-
 /*!
- * Multiply values of another DataArrayInt to values of \a this one. There are 3
- * valid cases.
- * 1.  The arrays have same number of tuples and components. Then each value of
- *   \a other array is multiplied to the corresponding value of \a this array, i.e.:
- *   _a_ [ i, j ] *= _other_ [ i, j ].
- * 2.  The arrays have same number of tuples and \a other array has one component. Then
- *   _a_ [ i, j ] *= _other_ [ i, 0 ].
- * 3.  The arrays have same number of components and \a other array has one tuple. Then
- *   _a_ [ i, j ] *= _a2_ [ 0, j ].
- *
- *  \param [in] other - an array to multiply to \a this one.
- *  \throw If \a other is NULL.
- *  \throw If \a this->getNumberOfTuples() != \a other->getNumberOfTuples() and
- *         \a this->getNumberOfComponents() != \a other->getNumberOfComponents() and
- *         \a other has number of both tuples and components not equal to 1.
+ * \a this is expected to be a correctly linked list of pairs.
+ * 
+ * \sa DataArrayInt::sortEachPairToMakeALinkedList
  */
-void DataArrayInt::multiplyEqual(const DataArrayInt *other)
+MCAuto<DataArrayInt> DataArrayInt::fromLinkedListOfPairToList() const
 {
-  if(!other)
-    throw INTERP_KERNEL::Exception("DataArrayInt::multiplyEqual : input DataArrayInt instance is NULL !");
-  const char *msg="Nb of tuples mismatch for DataArrayInt::multiplyEqual !";
-  checkAllocated(); other->checkAllocated();
-  int nbOfTuple=getNumberOfTuples();
-  int nbOfTuple2=other->getNumberOfTuples();
-  int nbOfComp=getNumberOfComponents();
-  int nbOfComp2=other->getNumberOfComponents();
-  if(nbOfTuple==nbOfTuple2)
-    {
-      if(nbOfComp==nbOfComp2)
-        {
-          std::transform(begin(),end(),other->begin(),getPointer(),std::multiplies<int>());
-        }
-      else if(nbOfComp2==1)
-        {
-          int *ptr=getPointer();
-          const int *ptrc=other->getConstPointer();
-          for(int i=0;i<nbOfTuple;i++)
-            std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptr+i*nbOfComp,std::bind2nd(std::multiplies<int>(),*ptrc++));    
-        }
-      else
-        throw INTERP_KERNEL::Exception(msg);
-    }
-  else if(nbOfTuple2==1)
+  checkAllocated();
+  checkNbOfComps(2,"DataArrayInt::fromLinkedListOfPairToList : this is expected to have 2 components");
+  int nbTuples(getNumberOfTuples());
+  if(nbTuples<1)
+    throw INTERP_KERNEL::Exception("DataArrayInt::fromLinkedListOfPairToList : no tuples in this ! Not a linked list !");
+  MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(nbTuples+1,1);
+  const int *thisPtr(begin());
+  int *retPtr(ret->getPointer());
+  retPtr[0]=thisPtr[0];
+  for(int i=0;i<nbTuples;i++)
     {
-      if(nbOfComp2==nbOfComp)
-        {
-          int *ptr=getPointer();
-          const int *ptrc=other->getConstPointer();
-          for(int i=0;i<nbOfTuple;i++)
-            std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptrc,ptr+i*nbOfComp,std::multiplies<int>());
-        }
-      else
-        throw INTERP_KERNEL::Exception(msg);
+      retPtr[i+1]=thisPtr[2*i+1];
+      if(i<nbTuples-1)
+        if(thisPtr[2*i+1]!=thisPtr[2*(i+1)+0])
+          {
+            std::ostringstream oss; oss << "DataArrayInt::fromLinkedListOfPairToList : this is not a proper linked list of pair. The link is broken between tuple #" << i << " and tuple #" << i+1 << " ! Call sortEachPairToMakeALinkedList ?";
+            throw INTERP_KERNEL::Exception(oss.str());
+          }
     }
-  else
-    throw INTERP_KERNEL::Exception(msg);
-  declareAsNew();
+  return ret;
 }
 
+/*!
+ * This method returns all different values found in \a this. This method throws if \a this has not been allocated.
+ * But the number of components can be different from one.
+ * \return a newly allocated array (that should be dealt by the caller) containing different values in \a this.
+ */
+DataArrayInt *DataArrayInt::getDifferentValues() const
+{
+  checkAllocated();
+  std::set<int> ret;
+  ret.insert(begin(),end());
+  MCAuto<DataArrayInt> ret2=DataArrayInt::New(); ret2->alloc((int)ret.size(),1);
+  std::copy(ret.begin(),ret.end(),ret2->getPointer());
+  return ret2.retn();
+}
 
 /*!
- * Returns a new DataArrayInt that is a division of two given arrays. There are 3
- * valid cases.
- * 1.  The arrays have same number of tuples and components. Then each value of
- *   the result array (_a_) is a division of the corresponding values of \a a1 and
- *   \a a2, i.e.: _a_ [ i, j ] = _a1_ [ i, j ] / _a2_ [ i, j ].
- * 2.  The arrays have same number of tuples and one array, say _a2_, has one
- *   component. Then
- *   _a_ [ i, j ] = _a1_ [ i, j ] / _a2_ [ i, 0 ].
- * 3.  The arrays have same number of components and one array, say _a2_, has one
- *   tuple. Then
- *   _a_ [ i, j ] = _a1_ [ i, j ] / _a2_ [ 0, j ].
- *
- * Info on components is copied either from the first array (in the first case) or from
- * the array with maximal number of elements (getNbOfElems()).
- *  \warning No check of division by zero is performed!
- *  \param [in] a1 - a numerator array.
- *  \param [in] a2 - a denominator array.
- *  \return DataArrayInt * - the new instance of DataArrayInt.
- *          The caller is to delete this result array using decrRef() as it is no more
- *          needed.
- *  \throw If either \a a1 or \a a2 is NULL.
- *  \throw If \a a1->getNumberOfTuples() != \a a2->getNumberOfTuples() and
- *         \a a1->getNumberOfComponents() != \a a2->getNumberOfComponents() and
- *         none of them has number of tuples or components equal to 1.
+ * This method is a refinement of DataArrayInt::getDifferentValues because it returns not only different values in \a this but also, for each of
+ * them it tells which tuple id have this id.
+ * This method works only on arrays with one component (if it is not the case call DataArrayInt::rearrange(1) ).
+ * This method returns two arrays having same size.
+ * The instances of DataArrayInt in the returned vector have be specially allocated and computed by this method. Each of them should be dealt by the caller of this method.
+ * Example : if this is equal to [1,0,1,2,0,2,2,-3,2] -> differentIds=[-3,0,1,2] and returned array will be equal to [[7],[1,4],[0,2],[3,5,6,8]]
  */
-DataArrayInt *DataArrayInt::Divide(const DataArrayInt *a1, const DataArrayInt *a2)
+std::vector<DataArrayInt *> DataArrayInt::partitionByDifferentValues(std::vector<int>& differentIds) const
 {
-  if(!a1 || !a2)
-    throw INTERP_KERNEL::Exception("DataArrayInt::Divide : input DataArrayInt instance is NULL !");
-  int nbOfTuple1=a1->getNumberOfTuples();
-  int nbOfTuple2=a2->getNumberOfTuples();
-  int nbOfComp1=a1->getNumberOfComponents();
-  int nbOfComp2=a2->getNumberOfComponents();
-  if(nbOfTuple2==nbOfTuple1)
-    {
-      if(nbOfComp1==nbOfComp2)
-        {
-          MCAuto<DataArrayInt> ret=DataArrayInt::New();
-          ret->alloc(nbOfTuple2,nbOfComp1);
-          std::transform(a1->begin(),a1->end(),a2->begin(),ret->getPointer(),std::divides<int>());
-          ret->copyStringInfoFrom(*a1);
-          return ret.retn();
-        }
-      else if(nbOfComp2==1)
-        {
-          MCAuto<DataArrayInt> ret=DataArrayInt::New();
-          ret->alloc(nbOfTuple1,nbOfComp1);
-          const int *a2Ptr=a2->getConstPointer();
-          const int *a1Ptr=a1->getConstPointer();
-          int *res=ret->getPointer();
-          for(int i=0;i<nbOfTuple1;i++)
-            res=std::transform(a1Ptr+i*nbOfComp1,a1Ptr+(i+1)*nbOfComp1,res,std::bind2nd(std::divides<int>(),a2Ptr[i]));
-          ret->copyStringInfoFrom(*a1);
-          return ret.retn();
-        }
-      else
-        {
-          a1->checkNbOfComps(nbOfComp2,"Nb of components mismatch for array Divide !");
-          return 0;
-        }
-    }
-  else if(nbOfTuple2==1)
+  checkAllocated();
+  if(getNumberOfComponents()!=1)
+    throw INTERP_KERNEL::Exception("DataArrayInt::partitionByDifferentValues : this should have only one component !");
+  int id=0;
+  std::map<int,int> m,m2,m3;
+  for(const int *w=begin();w!=end();w++)
+    m[*w]++;
+  differentIds.resize(m.size());
+  std::vector<DataArrayInt *> ret(m.size());
+  std::vector<int *> retPtr(m.size());
+  for(std::map<int,int>::const_iterator it=m.begin();it!=m.end();it++,id++)
     {
-      a1->checkNbOfComps(nbOfComp2,"Nb of components mismatch for array Divide !");
-      MCAuto<DataArrayInt> ret=DataArrayInt::New();
-      ret->alloc(nbOfTuple1,nbOfComp1);
-      const int *a1ptr=a1->getConstPointer(),*a2ptr=a2->getConstPointer();
-      int *pt=ret->getPointer();
-      for(int i=0;i<nbOfTuple1;i++)
-        pt=std::transform(a1ptr+i*nbOfComp1,a1ptr+(i+1)*nbOfComp1,a2ptr,pt,std::divides<int>());
-      ret->copyStringInfoFrom(*a1);
-      return ret.retn();
+      m2[(*it).first]=id;
+      ret[id]=DataArrayInt::New();
+      ret[id]->alloc((*it).second,1);
+      retPtr[id]=ret[id]->getPointer();
+      differentIds[id]=(*it).first;
     }
-  else
+  id=0;
+  for(const int *w=begin();w!=end();w++,id++)
     {
-      a1->checkNbOfTuples(nbOfTuple2,"Nb of tuples mismatch for array Divide !");//will always throw an exception
-      return 0;
+      retPtr[m2[*w]][m3[*w]++]=id;
     }
+  return ret;
 }
 
 /*!
- * Divide values of \a this array by values of another DataArrayInt. There are 3
- * valid cases.
- * 1.  The arrays have same number of tuples and components. Then each value of
- *    \a this array is divided by the corresponding value of \a other one, i.e.:
- *   _a_ [ i, j ] /= _other_ [ i, j ].
- * 2.  The arrays have same number of tuples and \a other array has one component. Then
- *   _a_ [ i, j ] /= _other_ [ i, 0 ].
- * 3.  The arrays have same number of components and \a other array has one tuple. Then
- *   _a_ [ i, j ] /= _a2_ [ 0, j ].
+ * This method split ids in [0, \c this->getNumberOfTuples() ) using \a this array as a field of weight (>=0 each).
+ * The aim of this method is to return a set of \a nbOfSlices chunk of contiguous ids as balanced as possible.
  *
- *  \warning No check of division by zero is performed!
- *  \param [in] other - an array to divide \a this one by.
- *  \throw If \a other is NULL.
- *  \throw If \a this->getNumberOfTuples() != \a other->getNumberOfTuples() and
- *         \a this->getNumberOfComponents() != \a other->getNumberOfComponents() and
- *         \a other has number of both tuples and components not equal to 1.
+ * \param [in] nbOfSlices - number of slices expected.
+ * \return - a vector having a size equal to \a nbOfSlices giving the start (included) and the stop (excluded) of each chunks.
+ * 
+ * \sa DataArray::GetSlice
+ * \throw If \a this is not allocated or not with exactly one component.
+ * \throw If an element in \a this if < 0.
  */
-void DataArrayInt::divideEqual(const DataArrayInt *other)
+std::vector< std::pair<int,int> > DataArrayInt::splitInBalancedSlices(int nbOfSlices) const
 {
-  if(!other)
-    throw INTERP_KERNEL::Exception("DataArrayInt::divideEqual : input DataArrayInt instance is NULL !");
-  const char *msg="Nb of tuples mismatch for DataArrayInt::divideEqual !";
-  checkAllocated(); other->checkAllocated();
-  int nbOfTuple=getNumberOfTuples();
-  int nbOfTuple2=other->getNumberOfTuples();
-  int nbOfComp=getNumberOfComponents();
-  int nbOfComp2=other->getNumberOfComponents();
-  if(nbOfTuple==nbOfTuple2)
-    {
-      if(nbOfComp==nbOfComp2)
-        {
-          std::transform(begin(),end(),other->begin(),getPointer(),std::divides<int>());
-        }
-      else if(nbOfComp2==1)
-        {
-          int *ptr=getPointer();
-          const int *ptrc=other->getConstPointer();
-          for(int i=0;i<nbOfTuple;i++)
-            std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptr+i*nbOfComp,std::bind2nd(std::divides<int>(),*ptrc++));
-        }
-      else
-        throw INTERP_KERNEL::Exception(msg);
-    }
-  else if(nbOfTuple2==1)
+  if(!isAllocated() || getNumberOfComponents()!=1)
+    throw INTERP_KERNEL::Exception("DataArrayInt::splitInBalancedSlices : this array should have number of components equal to one and must be allocated !");
+  if(nbOfSlices<=0)
+    throw INTERP_KERNEL::Exception("DataArrayInt::splitInBalancedSlices : number of slices must be >= 1 !");
+  int sum(accumulate(0)),nbOfTuples(getNumberOfTuples());
+  int sumPerSlc(sum/nbOfSlices),pos(0);
+  const int *w(begin());
+  std::vector< std::pair<int,int> > ret(nbOfSlices);
+  for(int i=0;i<nbOfSlices;i++)
     {
-      if(nbOfComp2==nbOfComp)
-        {
-          int *ptr=getPointer();
-          const int *ptrc=other->getConstPointer();
-          for(int i=0;i<nbOfTuple;i++)
-            std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptrc,ptr+i*nbOfComp,std::divides<int>());
-        }
+      std::pair<int,int> p(pos,-1);
+      int locSum(0);
+      while(locSum<sumPerSlc && pos<nbOfTuples) { pos++; locSum+=*w++; }
+      if(i!=nbOfSlices-1)
+        p.second=pos;
       else
-        throw INTERP_KERNEL::Exception(msg);
+        p.second=nbOfTuples;
+      ret[i]=p;
     }
-  else
-    throw INTERP_KERNEL::Exception(msg);
-  declareAsNew();
+  return ret;
 }
 
-
 /*!
  * Returns a new DataArrayInt that is a modulus of two given arrays. There are 3
  * valid cases.
@@ -9131,40 +7124,11 @@ void DataArrayInt::finishUnserialization(const std::vector<int>& tinyInfoI, cons
     }
 }
 
-DataArrayIntIterator::DataArrayIntIterator(DataArrayInt *da):_da(da),_pt(0),_tuple_id(0),_nb_comp(0),_nb_tuple(0)
-{
-  if(_da)
-    {
-      _da->incrRef();
-      if(_da->isAllocated())
-        {
-          _nb_comp=da->getNumberOfComponents();
-          _nb_tuple=da->getNumberOfTuples();
-          _pt=da->getPointer();
-        }
-    }
-}
-
-DataArrayIntIterator::~DataArrayIntIterator()
-{
-  if(_da)
-    _da->decrRef();
-}
-
-DataArrayIntTuple *DataArrayIntIterator::nextt()
+DataArrayIntIterator::DataArrayIntIterator(DataArrayInt *da):DataArrayIterator<int>(da)
 {
-  if(_tuple_id<_nb_tuple)
-    {
-      _tuple_id++;
-      DataArrayIntTuple *ret=new DataArrayIntTuple(_pt,_nb_comp);
-      _pt+=_nb_comp;
-      return ret;
-    }
-  else
-    return 0;
 }
 
-DataArrayIntTuple::DataArrayIntTuple(int *pt, int nbOfComp):_pt(pt),_nb_of_compo(nbOfComp)
+DataArrayInt32Tuple::DataArrayInt32Tuple(int *pt, int nbOfComp):DataArrayTuple<int>(pt,nbOfComp)
 {
 }
 
@@ -9179,9 +7143,7 @@ std::string DataArrayIntTuple::repr() const
 
 int DataArrayIntTuple::intValue() const
 {
-  if(_nb_of_compo==1)
-    return *_pt;
-  throw INTERP_KERNEL::Exception("DataArrayIntTuple::intValue : DataArrayIntTuple instance has not exactly 1 component -> Not possible to convert it into an integer !");
+  return this->zeValue();
 }
 
 /*!
@@ -9192,16 +7154,5 @@ int DataArrayIntTuple::intValue() const
  */
 DataArrayInt *DataArrayIntTuple::buildDAInt(int nbOfTuples, int nbOfCompo) const
 {
-  if((_nb_of_compo==nbOfCompo && nbOfTuples==1) || (_nb_of_compo==nbOfTuples && nbOfCompo==1))
-    {
-      DataArrayInt *ret=DataArrayInt::New();
-      ret->useExternalArrayWithRWAccess(_pt,nbOfTuples,nbOfCompo);
-      return ret;
-    }
-  else
-    {
-      std::ostringstream oss; oss << "DataArrayIntTuple::buildDAInt : unable to build a requested DataArrayInt instance with nbofTuple=" << nbOfTuples << " and nbOfCompo=" << nbOfCompo;
-      oss << ".\nBecause the number of elements in this is " << _nb_of_compo << " !";
-      throw INTERP_KERNEL::Exception(oss.str().c_str());
-    }
+  return this->buildDA(nbOfTuples,nbOfCompo);
 }
index 5c075821c306231a6514441cba91e8329a9c6ef7..462cd534308c19be3bf6e135f375175914af2378 100644 (file)
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-// Author : Anthony Geay (CEA/DEN)
+// Author : Anthony Geay (EDF R&D)
 
 #ifndef __MEDCOUPLING_MEDCOUPLINGMEMARRAY_HXX__
 #define __MEDCOUPLING_MEDCOUPLINGMEMARRAY_HXX__
 
 #include "MEDCoupling.hxx"
+#include "MCType.hxx"
 #include "MCAuto.hxx"
 #include "MEDCouplingTimeLabel.hxx"
 #include "MEDCouplingRefCountObject.hxx"
 #include "InterpKernelException.hxx"
 #include "MEDCouplingTraits.hxx"
+#include "MEDCouplingMap.hxx"
 #include "BBTreePts.txx"
 
 #include <string>
@@ -76,7 +78,7 @@ namespace MEDCoupling
     std::size_t getNbOfElem() const { return _nb_of_elem; }
     std::size_t getNbOfElemAllocated() const { return _nb_of_elem_alloc; }
     T *getPointer() { return _pointer.getPointer(); }
-     MemArray<T> &operator=(const MemArray<T>& other);
+    MemArray<T> &operator=(const MemArray<T>& other);
     T operator[](std::size_t id) const { return _pointer.getConstPointer()[id]; }
     T& operator[](std::size_t id) { return _pointer.getPointer()[id]; }
     bool isEqual(const MemArray<T>& other, T prec, std::string& reason) const;
@@ -122,87 +124,87 @@ namespace MEDCoupling
     void *_param_for_deallocator;
   };
 
-  class DataArrayInt;
+  class DataArrayInt32;
   class DataArrayByte;
 
-  class MEDCOUPLING_EXPORT DataArray : public RefCountObject, public TimeLabel
+  class DataArray : public RefCountObject, public TimeLabel
   {
   public:
-     std::size_t getHeapMemorySizeWithoutChildren() const;
-     std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
-     void setName(const std::string& name);
-     void copyStringInfoFrom(const DataArray& other);
-     void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds);
-     void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other);
-     bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const;
-     bool areInfoEquals(const DataArray& other) const;
-     std::string cppRepr(const std::string& varName) const;
-     std::string getName() const { return _name; }
-     const std::vector<std::string> &getInfoOnComponents() const { return _info_on_compo; }
-     std::vector<std::string> &getInfoOnComponents() { return _info_on_compo; }
-     void setInfoOnComponents(const std::vector<std::string>& info);
-     void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info);
-     std::vector<std::string> getVarsOnComponent() const;
-     std::vector<std::string> getUnitsOnComponent() const;
-     std::string getInfoOnComponent(int i) const;
-     std::string getVarOnComponent(int i) const;
-     std::string getUnitOnComponent(int i) const;
-     void setInfoOnComponent(int i, const std::string& info);
-     std::size_t getNumberOfComponents() const { return _info_on_compo.size(); }
-     void setPartOfValuesBase3(const DataArray *aBase, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true);
-     virtual void *getVoidStarPointer() = 0;
-     virtual DataArray *deepCopy() const = 0;
-     virtual DataArray *buildNewEmptyInstance() const = 0;
-     virtual bool isAllocated() const = 0;
-     virtual void checkAllocated() const = 0;
-     virtual void desallocate() = 0;
-     virtual int getNumberOfTuples() const = 0;
-     virtual std::size_t getNbOfElems() const = 0;
-     virtual std::size_t getNbOfElemAllocated() const = 0;
-     virtual void alloc(std::size_t nbOfTuple, std::size_t nbOfCompo=1) = 0;
-     virtual void reAlloc(std::size_t newNbOfTuple) = 0;
-     virtual void renumberInPlace(const int *old2New) = 0;
-     virtual void renumberInPlaceR(const int *new2Old) = 0;
-     virtual void setContigPartOfSelectedValues(int tupleIdStart, const DataArray *aBase, const DataArrayInt *tuplesSelec) = 0;
-     virtual void setContigPartOfSelectedValuesSlice(int tupleIdStart, const DataArray *aBase, int bg, int end2, int step) = 0;
-     virtual DataArray *selectByTupleRanges(const std::vector<std::pair<int,int> >& ranges) const = 0;
-     virtual DataArray *keepSelectedComponents(const std::vector<int>& compoIds) const = 0;
-     virtual DataArray *selectByTupleId(const int *new2OldBg, const int *new2OldEnd) const = 0;
-     virtual DataArray *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const = 0;
-     virtual DataArray *selectByTupleIdSafeSlice(int bg, int end2, int step) const = 0;
-     virtual void rearrange(int newNbOfCompo) = 0;
-     virtual void circularPermutation(int nbOfShift=1) = 0;
-     virtual void circularPermutationPerTuple(int nbOfShift=1) = 0;
-     virtual void reversePerTuple() = 0;
-     void checkNbOfTuples(int nbOfTuples, const std::string& msg) const;
-     void checkNbOfComps(int nbOfCompo, const std::string& msg) const;
-     void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const;
-     void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const;
-     void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const;
-     static void GetSlice(int start, int stop, int step, int sliceId, int nbOfSlices, int& startSlice, int& stopSlice);
-     static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg);
-     static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg);
-     static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step);
-     static std::string GetVarNameFromInfo(const std::string& info);
-     static std::string GetUnitFromInfo(const std::string& info);
-     static std::string BuildInfoFromVarAndUnit(const std::string& var, const std::string& unit);
-     static std::string GetAxisTypeRepr(MEDCouplingAxisType at);
-     static DataArray *Aggregate(const std::vector<const DataArray *>& arrs);
-     virtual void reprStream(std::ostream& stream) const = 0;
-     virtual void reprZipStream(std::ostream& stream) const = 0;
-     virtual void reprWithoutNameStream(std::ostream& stream) const;
-     virtual void reprZipWithoutNameStream(std::ostream& stream) const = 0;
-     virtual void reprCppStream(const std::string& varName, std::ostream& stream) const = 0;
-     virtual void reprQuickOverview(std::ostream& stream) const = 0;
-     virtual void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const = 0;
+    MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+    MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
+    MEDCOUPLING_EXPORT void setName(const std::string& name);
+    MEDCOUPLING_EXPORT void copyStringInfoFrom(const DataArray& other);
+    MEDCOUPLING_EXPORT void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds);
+    MEDCOUPLING_EXPORT void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other);
+    MEDCOUPLING_EXPORT bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const;
+    MEDCOUPLING_EXPORT bool areInfoEquals(const DataArray& other) const;
+    MEDCOUPLING_EXPORT std::string cppRepr(const std::string& varName) const;
+    MEDCOUPLING_EXPORT std::string getName() const { return _name; }
+    MEDCOUPLING_EXPORT const std::vector<std::string> &getInfoOnComponents() const { return _info_on_compo; }
+    MEDCOUPLING_EXPORT std::vector<std::string> &getInfoOnComponents() { return _info_on_compo; }
+    MEDCOUPLING_EXPORT void setInfoOnComponents(const std::vector<std::string>& info);
+    MEDCOUPLING_EXPORT void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info);
+    MEDCOUPLING_EXPORT std::vector<std::string> getVarsOnComponent() const;
+    MEDCOUPLING_EXPORT std::vector<std::string> getUnitsOnComponent() const;
+    MEDCOUPLING_EXPORT std::string getInfoOnComponent(int i) const;
+    MEDCOUPLING_EXPORT std::string getVarOnComponent(int i) const;
+    MEDCOUPLING_EXPORT std::string getUnitOnComponent(int i) const;
+    MEDCOUPLING_EXPORT void setInfoOnComponent(int i, const std::string& info);
+    MEDCOUPLING_EXPORT std::size_t getNumberOfComponents() const { return _info_on_compo.size(); }
+    MEDCOUPLING_EXPORT void setPartOfValuesBase3(const DataArray *aBase, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true);
+    MEDCOUPLING_EXPORT virtual void *getVoidStarPointer() = 0;
+    MEDCOUPLING_EXPORT virtual DataArray *deepCopy() const = 0;
+    MEDCOUPLING_EXPORT virtual DataArray *buildNewEmptyInstance() const = 0;
+    MEDCOUPLING_EXPORT virtual bool isAllocated() const = 0;
+    MEDCOUPLING_EXPORT virtual void checkAllocated() const = 0;
+    MEDCOUPLING_EXPORT virtual void desallocate() = 0;
+    MEDCOUPLING_EXPORT virtual int getNumberOfTuples() const = 0;
+    MEDCOUPLING_EXPORT virtual std::size_t getNbOfElems() const = 0;
+    MEDCOUPLING_EXPORT virtual std::size_t getNbOfElemAllocated() const = 0;
+    MEDCOUPLING_EXPORT virtual void alloc(std::size_t nbOfTuple, std::size_t nbOfCompo=1) = 0;
+    MEDCOUPLING_EXPORT virtual void reAlloc(std::size_t newNbOfTuple) = 0;
+    MEDCOUPLING_EXPORT virtual void renumberInPlace(const int *old2New) = 0;
+    MEDCOUPLING_EXPORT virtual void renumberInPlaceR(const int *new2Old) = 0;
+    MEDCOUPLING_EXPORT virtual void setContigPartOfSelectedValues(int tupleIdStart, const DataArray *aBase, const DataArrayInt32 *tuplesSelec) = 0;
+    MEDCOUPLING_EXPORT virtual void setContigPartOfSelectedValuesSlice(int tupleIdStart, const DataArray *aBase, int bg, int end2, int step) = 0;
+    MEDCOUPLING_EXPORT virtual DataArray *selectByTupleRanges(const std::vector<std::pair<int,int> >& ranges) const = 0;
+    MEDCOUPLING_EXPORT virtual DataArray *keepSelectedComponents(const std::vector<int>& compoIds) const = 0;
+    MEDCOUPLING_EXPORT virtual DataArray *selectByTupleId(const int *new2OldBg, const int *new2OldEnd) const = 0;
+    MEDCOUPLING_EXPORT virtual DataArray *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const = 0;
+    MEDCOUPLING_EXPORT virtual DataArray *selectByTupleIdSafeSlice(int bg, int end2, int step) const = 0;
+    MEDCOUPLING_EXPORT virtual void rearrange(int newNbOfCompo) = 0;
+    MEDCOUPLING_EXPORT virtual void circularPermutation(int nbOfShift=1) = 0;
+    MEDCOUPLING_EXPORT virtual void circularPermutationPerTuple(int nbOfShift=1) = 0;
+    MEDCOUPLING_EXPORT virtual void reversePerTuple() = 0;
+    MEDCOUPLING_EXPORT void checkNbOfTuples(int nbOfTuples, const std::string& msg) const;
+    MEDCOUPLING_EXPORT void checkNbOfComps(int nbOfCompo, const std::string& msg) const;
+    MEDCOUPLING_EXPORT void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const;
+    MEDCOUPLING_EXPORT void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const;
+    MEDCOUPLING_EXPORT void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const;
+    MEDCOUPLING_EXPORT static void GetSlice(int start, int stop, int step, int sliceId, int nbOfSlices, int& startSlice, int& stopSlice);
+    MEDCOUPLING_EXPORT static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg);
+    MEDCOUPLING_EXPORT static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg);
+    MEDCOUPLING_EXPORT static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step);
+    MEDCOUPLING_EXPORT static std::string GetVarNameFromInfo(const std::string& info);
+    MEDCOUPLING_EXPORT static std::string GetUnitFromInfo(const std::string& info);
+    MEDCOUPLING_EXPORT static std::string BuildInfoFromVarAndUnit(const std::string& var, const std::string& unit);
+    MEDCOUPLING_EXPORT static std::string GetAxisTypeRepr(MEDCouplingAxisType at);
+    MEDCOUPLING_EXPORT static DataArray *Aggregate(const std::vector<const DataArray *>& arrs);
+    MEDCOUPLING_EXPORT virtual void reprStream(std::ostream& stream) const = 0;
+    MEDCOUPLING_EXPORT virtual void reprZipStream(std::ostream& stream) const = 0;
+    MEDCOUPLING_EXPORT virtual void reprWithoutNameStream(std::ostream& stream) const;
+    MEDCOUPLING_EXPORT virtual void reprZipWithoutNameStream(std::ostream& stream) const = 0;
+    MEDCOUPLING_EXPORT virtual void reprCppStream(const std::string& varName, std::ostream& stream) const = 0;
+    MEDCOUPLING_EXPORT virtual void reprQuickOverview(std::ostream& stream) const = 0;
+    MEDCOUPLING_EXPORT virtual void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const = 0;
   protected:
     DataArray() { }
     ~DataArray() { }
   protected:
-     static void CheckValueInRange(int ref, int value, const std::string& msg);
-     static void CheckValueInRangeEx(int value, int start, int end, const std::string& msg);
-     static void CheckClosingParInRange(int ref, int value, const std::string& msg);
-     static int EffectiveCircPerm(int nbOfShift, int nbOfTuples);
+    MEDCOUPLING_EXPORT static void CheckValueInRange(int ref, int value, const std::string& msg);
+    MEDCOUPLING_EXPORT static void CheckValueInRangeEx(int value, int start, int end, const std::string& msg);
+    MEDCOUPLING_EXPORT static void CheckClosingParInRange(int ref, int value, const std::string& msg);
+    MEDCOUPLING_EXPORT static int EffectiveCircPerm(int nbOfShift, int nbOfTuples);
   protected:
     std::string _name;
     std::vector<std::string> _info_on_compo;
@@ -211,80 +213,89 @@ namespace MEDCoupling
 
 namespace MEDCoupling
 {
-  class DataArrayInt;
+  class DataArrayInt32;
 
   template<class T>
   class DataArrayTemplate : public DataArray
   {
   public:
-     static MCAuto< typename Traits<T>::ArrayTypeCh > NewFromStdVector(const typename std::vector<T>& v);
-     std::vector< MCAuto< typename Traits<T>::ArrayTypeCh > > explodeComponents() const;
+    MEDCOUPLING_EXPORT static MCAuto< typename Traits<T>::ArrayTypeCh > NewFromStdVector(const typename std::vector<T>& v);
+    MEDCOUPLING_EXPORT std::vector< MCAuto< typename Traits<T>::ArrayTypeCh > > explodeComponents() const;
     //
-     std::size_t getHeapMemorySizeWithoutChildren() const;
+    std::size_t getHeapMemorySizeWithoutChildren() const;
+    MEDCOUPLING_EXPORT void updateTime() const { }
     //
-     int getNumberOfTuples() const { return _info_on_compo.empty()?0:_mem.getNbOfElem()/getNumberOfComponents(); }
-     std::size_t getNbOfElems() const { return _mem.getNbOfElem(); }
-     bool empty() const;
-     void *getVoidStarPointer() { return getPointer(); }
-     const T *getConstPointer() const { return _mem.getConstPointer(); }
-     const T *begin() const { return getConstPointer(); }
-     const T *end() const { return getConstPointer()+getNbOfElems(); }
-     void alloc(std::size_t nbOfTuple, std::size_t nbOfCompo=1);
-     void useArray(const T *array, bool ownership, DeallocType type, int nbOfTuple, int nbOfCompo);
-     void useExternalArrayWithRWAccess(const T *array, int nbOfTuple, int nbOfCompo);
-     T getIJSafe(int tupleId, int compoId) const;
-     T getIJ(int tupleId, int compoId) const { return _mem[tupleId*_info_on_compo.size()+compoId]; }
-     void setIJ(int tupleId, int compoId, T newVal) { _mem[tupleId*_info_on_compo.size()+compoId]=newVal; declareAsNew(); }
-     void setIJSilent(int tupleId, int compoId, T newVal) { _mem[tupleId*_info_on_compo.size()+compoId]=newVal; }
-     T *getPointer() { return _mem.getPointer(); declareAsNew(); }
-     void pack() const;
-     bool isAllocated() const;
-     void checkAllocated() const;
-     void desallocate();
-     void reserve(std::size_t nbOfElems);
-     void rearrange(int newNbOfCompo);
-     void transpose();
-     void pushBackSilent(T val);
-     void pushBackValsSilent(const T *valsBg, const T *valsEnd);
-     T popBackSilent();
-     T front() const;
-     T back() const;
-     std::size_t getNbOfElemAllocated() const { return _mem.getNbOfElemAllocated(); }
-     void allocIfNecessary(int nbOfTuple, int nbOfCompo);
-     void deepCopyFrom(const DataArrayTemplate<T>& other);
-     void reverse();
-     void fillWithValue(T val);
-     void reAlloc(std::size_t newNbOfTuple);
-     void renumberInPlace(const int *old2New);
-     void renumberInPlaceR(const int *new2Old);
-     void sort(bool asc=true);
-     typename Traits<T>::ArrayType *renumber(const int *old2New) const;
-     typename Traits<T>::ArrayType *renumberR(const int *new2Old) const;
-     typename Traits<T>::ArrayType *renumberAndReduce(const int *old2New, int newNbOfTuple) const;
-     typename Traits<T>::ArrayType *changeNbOfComponents(int newNbOfComp, T dftValue) const;
-     typename Traits<T>::ArrayType *subArray(int tupleIdBg, int tupleIdEnd=-1) const;
-     MCAuto<typename Traits<T>::ArrayTypeCh> selectPartDef(const PartDefinition* pd) const;
-     void circularPermutation(int nbOfShift=1);
-     void circularPermutationPerTuple(int nbOfShift=1);
-     void reversePerTuple();
-     void setPartOfValues1(const typename Traits<T>::ArrayType *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true);
-     void setPartOfValuesSimple1(T a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp);
-     void setPartOfValues2(const typename Traits<T>::ArrayType *a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp, bool strictCompoCompare=true);
-     void setPartOfValuesSimple2(T a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp);
-     void setPartOfValues3(const typename Traits<T>::ArrayType *a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true);
-     void setPartOfValuesSimple3(T a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp);
-     void setPartOfValues4(const typename Traits<T>::ArrayType *a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp, bool strictCompoCompare=true);
-     void setPartOfValuesSimple4(T a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp);
-     void setPartOfValuesAdv(const typename Traits<T>::ArrayType *a, const DataArrayInt *tuplesSelec);
-     void setContigPartOfSelectedValues(int tupleIdStart, const DataArray *aBase, const DataArrayInt *tuplesSelec);
-     void setContigPartOfSelectedValuesSlice(int tupleIdStart, const DataArray *aBase, int bg, int end2, int step);
-     T getMaxValue(int& tupleId) const;
-     T getMaxValueInArray() const;
-     T getMinValue(int& tupleId) const;
-     T getMinValueInArray() const;
+    MEDCOUPLING_EXPORT int getNumberOfTuples() const { return _info_on_compo.empty()?0:_mem.getNbOfElem()/getNumberOfComponents(); }
+    MEDCOUPLING_EXPORT std::size_t getNbOfElems() const { return _mem.getNbOfElem(); }
+    bool empty() const;
+    MEDCOUPLING_EXPORT void *getVoidStarPointer() { return getPointer(); }
+    MEDCOUPLING_EXPORT const T *getConstPointer() const { return _mem.getConstPointer(); }
+    MEDCOUPLING_EXPORT const T *begin() const { return getConstPointer(); }
+    MEDCOUPLING_EXPORT const T *end() const { return getConstPointer()+getNbOfElems(); }
+    void alloc(std::size_t nbOfTuple, std::size_t nbOfCompo=1);
+    void useArray(const T *array, bool ownership, DeallocType type, int nbOfTuple, int nbOfCompo);
+    void useExternalArrayWithRWAccess(const T *array, int nbOfTuple, int nbOfCompo);
+    T getIJSafe(int tupleId, int compoId) const;
+    MEDCOUPLING_EXPORT T getIJ(int tupleId, int compoId) const { return _mem[tupleId*_info_on_compo.size()+compoId]; }
+    MEDCOUPLING_EXPORT void setIJ(int tupleId, int compoId, T newVal) { _mem[tupleId*_info_on_compo.size()+compoId]=newVal; declareAsNew(); }
+    MEDCOUPLING_EXPORT void setIJSilent(int tupleId, int compoId, T newVal) { _mem[tupleId*_info_on_compo.size()+compoId]=newVal; }
+    MEDCOUPLING_EXPORT T *getPointer() { return _mem.getPointer(); declareAsNew(); }
+    void pack() const;
+    bool isAllocated() const;
+    void checkAllocated() const;
+    void desallocate();
+    void reserve(std::size_t nbOfElems);
+    void rearrange(int newNbOfCompo);
+    void transpose();
+    void pushBackSilent(T val);
+    void pushBackValsSilent(const T *valsBg, const T *valsEnd);
+    T popBackSilent();
+    T front() const;
+    T back() const;
+    std::size_t getNbOfElemAllocated() const { return _mem.getNbOfElemAllocated(); }
+    void allocIfNecessary(int nbOfTuple, int nbOfCompo);
+    void deepCopyFrom(const DataArrayTemplate<T>& other);
+    void reverse();
+    void fillWithValue(T val);
+    void reAlloc(std::size_t newNbOfTuple);
+    void renumberInPlace(const int *old2New);
+    void renumberInPlaceR(const int *new2Old);
+    void sort(bool asc=true);
+    typename Traits<T>::ArrayType *renumber(const int *old2New) const;
+    typename Traits<T>::ArrayType *renumberR(const int *new2Old) const;
+    typename Traits<T>::ArrayType *renumberAndReduce(const int *old2New, int newNbOfTuple) const;
+    typename Traits<T>::ArrayType *changeNbOfComponents(int newNbOfComp, T dftValue) const;
+    typename Traits<T>::ArrayType *subArray(int tupleIdBg, int tupleIdEnd=-1) const;
+    MCAuto<typename Traits<T>::ArrayTypeCh> selectPartDef(const PartDefinition* pd) const;
+    void circularPermutation(int nbOfShift=1);
+    void circularPermutationPerTuple(int nbOfShift=1);
+    void reversePerTuple();
+    void setPartOfValues1(const typename Traits<T>::ArrayType *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true);
+    void setPartOfValuesSimple1(T a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp);
+    void setPartOfValues2(const typename Traits<T>::ArrayType *a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp, bool strictCompoCompare=true);
+    void setPartOfValuesSimple2(T a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp);
+    void setPartOfValues3(const typename Traits<T>::ArrayType *a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true);
+    void setPartOfValuesSimple3(T a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp);
+    void setPartOfValues4(const typename Traits<T>::ArrayType *a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp, bool strictCompoCompare=true);
+    void setPartOfValuesSimple4(T a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp);
+    void setPartOfValuesAdv(const typename Traits<T>::ArrayType *a, const DataArrayInt32 *tuplesSelec);
+    void setContigPartOfSelectedValues(int tupleIdStart, const DataArray *aBase, const DataArrayInt32 *tuplesSelec);
+    void setContigPartOfSelectedValuesSlice(int tupleIdStart, const DataArray *aBase, int bg, int end2, int step);
+    T getMaxValue(int& tupleId) const;
+    T getMaxValueInArray() const;
+    T getMinValue(int& tupleId) const;
+    T getMinValueInArray() const;
+    MEDCOUPLING_EXPORT void getTuple(int tupleId, T *res) const { std::copy(_mem.getConstPointerLoc(tupleId*_info_on_compo.size()),_mem.getConstPointerLoc((tupleId+1)*_info_on_compo.size()),res); }
+    template<class InputIterator>
+    void insertAtTheEnd(InputIterator first, InputIterator last);
+    MEDCOUPLING_EXPORT static void SetArrayIn(typename Traits<T>::ArrayType *newArray, typename Traits<T>::ArrayType* &arrayToSet);
+    MEDCOUPLING_EXPORT void writeOnPlace(std::size_t id, T element0, const T *others, int sizeOfOthers) { _mem.writeOnPlace(id,element0,others,sizeOfOthers); }
+  public:
+    MEDCOUPLING_EXPORT MemArray<T>& accessToMemArray() { return _mem; }
+    MEDCOUPLING_EXPORT const MemArray<T>& accessToMemArray() const { return _mem; }
   protected:
     typename Traits<T>::ArrayType *mySelectByTupleId(const int *new2OldBg, const int *new2OldEnd) const;
-    typename Traits<T>::ArrayType *mySelectByTupleId(const DataArrayInt& di) const;
+    typename Traits<T>::ArrayType *mySelectByTupleId(const DataArrayInt32& di) const;
     typename Traits<T>::ArrayType *mySelectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const;
     typename Traits<T>::ArrayType *myKeepSelectedComponents(const std::vector<int>& compoIds) const;
     typename Traits<T>::ArrayType *mySelectByTupleIdSafeSlice(int bg, int end2, int step) const;
@@ -292,555 +303,646 @@ namespace MEDCoupling
   protected:
     MemArray<T> _mem;
   };
+
+  template<class T>
+  class DataArrayTemplateClassic : public DataArrayTemplate<T>
+  {
+  public:
+    MEDCOUPLING_EXPORT MCAuto<DataArrayDouble> convertToDblArr() const;
+    MEDCOUPLING_EXPORT MCAuto<DataArrayInt32> convertToIntArr() const;
+    MEDCOUPLING_EXPORT MCAuto<DataArrayFloat> convertToFloatArr() const;
+    MEDCOUPLING_EXPORT void applyLin(T a, T b, int compoId);
+    MEDCOUPLING_EXPORT void applyLin(T a, T b);
+    MEDCOUPLING_EXPORT typename Traits<T>::ArrayType *negate() const;
+    MEDCOUPLING_EXPORT void addEqual(const typename Traits<T>::ArrayType *other);
+    MEDCOUPLING_EXPORT void substractEqual(const typename Traits<T>::ArrayType *other);
+    MEDCOUPLING_EXPORT void multiplyEqual(const typename Traits<T>::ArrayType *other);
+    MEDCOUPLING_EXPORT void divideEqual(const typename Traits<T>::ArrayType *other);
+    MEDCOUPLING_EXPORT static typename Traits<T>::ArrayType *Substract(const typename Traits<T>::ArrayType *a1, const typename Traits<T>::ArrayType *a2);
+    MEDCOUPLING_EXPORT static typename Traits<T>::ArrayType *Divide(const typename Traits<T>::ArrayType *a1, const typename Traits<T>::ArrayType *a2);
+    MEDCOUPLING_EXPORT static typename Traits<T>::ArrayType *Add(const typename Traits<T>::ArrayType *a1, const typename Traits<T>::ArrayType *a2);
+    MEDCOUPLING_EXPORT static typename Traits<T>::ArrayType *Multiply(const typename Traits<T>::ArrayType *a1, const typename Traits<T>::ArrayType *a2);
+    MEDCOUPLING_EXPORT static typename Traits<T>::ArrayType *Meld(const typename Traits<T>::ArrayType *a1, const typename Traits<T>::ArrayType *a2);
+    MEDCOUPLING_EXPORT static typename Traits<T>::ArrayType *Meld(const std::vector<const typename Traits<T>::ArrayType *>& arr);
+    MEDCOUPLING_EXPORT MCAuto<DataArrayInt32> findIdsGreaterOrEqualTo(T val) const;
+    MEDCOUPLING_EXPORT MCAuto<DataArrayInt32> findIdsGreaterThan(T val) const;
+    MEDCOUPLING_EXPORT MCAuto<DataArrayInt32> findIdsLowerOrEqualTo(T val) const;
+    MEDCOUPLING_EXPORT MCAuto<DataArrayInt32> findIdsLowerThan(T val) const;
+    MEDCOUPLING_EXPORT DataArrayInt32 *findIdsStrictlyNegative() const;
+    MEDCOUPLING_EXPORT typename Traits<T>::ArrayType *fromNoInterlace() const;
+    MEDCOUPLING_EXPORT typename Traits<T>::ArrayType *toNoInterlace() const;
+    MEDCOUPLING_EXPORT void meldWith(const typename Traits<T>::ArrayType *other);
+    MEDCOUPLING_EXPORT typename Traits<T>::ArrayType *duplicateEachTupleNTimes(int nbTimes) const;
+    MEDCOUPLING_EXPORT void aggregate(const typename Traits<T>::ArrayType *other);
+    MEDCOUPLING_EXPORT void abs();
+    MEDCOUPLING_EXPORT typename Traits<T>::ArrayType *computeAbs() const;
+    MEDCOUPLING_EXPORT typename Traits<T>::ArrayType *performCopyOrIncrRef(bool dCpy) const;
+  protected:
+    static typename Traits<T>::ArrayType *PerformCopyOrIncrRef(bool dCpy, const typename Traits<T>::ArrayType& self);
+    template<class OP>
+    MCAuto<DataArrayInt32> findIdsAdv(const OP& op) const;
+  private:
+    template<class U>
+    MCAuto< typename Traits<U>::ArrayType > convertToOtherTypeOfArr() const;
+    template<class FCT>
+    void somethingEqual(const typename Traits<T>::ArrayType *other);
+  };
+  
+  template<class T>
+  class DataArrayTemplateFP : public DataArrayTemplateClassic<T>
+  {
+  public:
+    MEDCOUPLING_EXPORT bool isUniform(T val, T eps) const;
+    MEDCOUPLING_EXPORT void iota(T init=0.);
+  };
+}
+
+namespace MEDCoupling
+{
+  class DataArrayFloatIterator;
+  class DataArrayFloat : public DataArrayTemplateFP<float>
+  {
+  public:
+    MEDCOUPLING_EXPORT static DataArrayFloat *New();
+  public:// abstract method overload
+    MEDCOUPLING_EXPORT DataArrayFloat *deepCopy() const;
+    MEDCOUPLING_EXPORT DataArrayFloat *buildNewEmptyInstance() const { return DataArrayFloat::New(); }
+    MEDCOUPLING_EXPORT DataArrayFloat *selectByTupleRanges(const std::vector<std::pair<int,int> >& ranges) const { return DataArrayTemplateFP<float>::mySelectByTupleRanges(ranges); }
+    MEDCOUPLING_EXPORT DataArrayFloat *keepSelectedComponents(const std::vector<int>& compoIds) const { return DataArrayTemplateFP<float>::myKeepSelectedComponents(compoIds); }
+    MEDCOUPLING_EXPORT DataArrayFloat *selectByTupleId(const int *new2OldBg, const int *new2OldEnd) const { return DataArrayTemplateFP<float>::mySelectByTupleId(new2OldBg,new2OldEnd); }
+    MEDCOUPLING_EXPORT DataArrayFloat *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const { return DataArrayTemplateFP<float>::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); }
+    MEDCOUPLING_EXPORT DataArrayFloat *selectByTupleIdSafeSlice(int bg, int end2, int step) const { return DataArrayTemplateFP<float>::mySelectByTupleIdSafeSlice(bg,end2,step); }
+    MEDCOUPLING_EXPORT void reprStream(std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprZipStream(std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprZipWithoutNameStream(std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprCppStream(const std::string& varName, std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const;
+  public:// non abstract but essential
+    MEDCOUPLING_EXPORT std::string reprNotTooLong() const;
+    MEDCOUPLING_EXPORT void reprNotTooLongStream(std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprNotTooLongWithoutNameStream(std::ostream& stream) const;
+    MEDCOUPLING_EXPORT bool isEqual(const DataArrayFloat& other, float prec) const;
+    MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const DataArrayFloat& other, float prec, std::string& reason) const;
+    MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const DataArrayFloat& other, float prec) const;
+  public:
+    MEDCOUPLING_EXPORT DataArrayFloatIterator *iterator();
+  private:
+    ~DataArrayFloat() { }
+    DataArrayFloat() { }
+  };
 }
 
 namespace MEDCoupling
 {
   class DataArrayDoubleIterator;
-  class MEDCOUPLING_EXPORT DataArrayDouble : public DataArrayTemplate<double>
+  class DataArrayDouble : public DataArrayTemplateFP<double>
   {
   public:
-     static DataArrayDouble *New();
-     double doubleValue() const;
-     DataArrayDouble *deepCopy() const;
-     DataArrayDouble *buildNewEmptyInstance() const { return DataArrayDouble::New(); }
-     DataArrayDouble *performCopyOrIncrRef(bool deepCopy) const;
-     void fillWithZero();
-     void iota(double init=0.);
-     bool isUniform(double val, double eps) const;
-     void checkMonotonic(bool increasing, double eps) const;
-     bool isMonotonic(bool increasing, double eps) const;
-     std::string repr() const;
-     std::string reprZip() const;
-     std::string reprNotTooLong() const;
-     void writeVTK(std::ostream& ofs, int indent, const std::string& nameInFile, DataArrayByte *byteArr) const;
-     void reprStream(std::ostream& stream) const;
-     void reprZipStream(std::ostream& stream) const;
-     void reprNotTooLongStream(std::ostream& stream) const;
-     void reprWithoutNameStream(std::ostream& stream) const;
-     void reprZipWithoutNameStream(std::ostream& stream) const;
-     void reprNotTooLongWithoutNameStream(std::ostream& stream) const;
-     void reprCppStream(const std::string& varName, std::ostream& stream) const;
-     void reprQuickOverview(std::ostream& stream) const;
-     void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const;
-     bool isEqual(const DataArrayDouble& other, double prec) const;
-     bool isEqualIfNotWhy(const DataArrayDouble& other, double prec, std::string& reason) const;
-     bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const;
-     DataArrayInt *convertToIntArr() const;
-     DataArrayDouble *fromNoInterlace() const;
-     DataArrayDouble *toNoInterlace() const;
-     DataArrayDouble *selectByTupleId(const int *new2OldBg, const int *new2OldEnd) const { return DataArrayTemplate<double>::mySelectByTupleId(new2OldBg,new2OldEnd); }
-     DataArrayDouble *selectByTupleId(const DataArrayInt& di) const { return DataArrayTemplate<double>::mySelectByTupleId(di); }
-     DataArrayDouble *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const { return DataArrayTemplate<double>::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); }
-     DataArrayDouble *keepSelectedComponents(const std::vector<int>& compoIds) const { return DataArrayTemplate<double>::myKeepSelectedComponents(compoIds); }
-     DataArrayDouble *selectByTupleIdSafeSlice(int bg, int end2, int step) const { return DataArrayTemplate<double>::mySelectByTupleIdSafeSlice(bg,end2,step); }
-     DataArrayDouble *selectByTupleRanges(const std::vector<std::pair<int,int> >& ranges) const { return DataArrayTemplate<double>::mySelectByTupleRanges(ranges); }
-     void meldWith(const DataArrayDouble *other);
-     bool areIncludedInMe(const DataArrayDouble *other, double prec, DataArrayInt *&tupleIds) const;
-     void findCommonTuples(double prec, int limitTupleId, DataArrayInt *&comm, DataArrayInt *&commIndex) const;
-     double minimalDistanceTo(const DataArrayDouble *other, int& thisTupleId, int& otherTupleId) const;
-     DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const;
-     DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const;
-     DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const;
-     DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const;
-     void setSelectedComponents(const DataArrayDouble *a, const std::vector<int>& compoIds);
-     void getTuple(int tupleId, double *res) const { std::copy(_mem.getConstPointerLoc(tupleId*_info_on_compo.size()),_mem.getConstPointerLoc((tupleId+1)*_info_on_compo.size()),res); }
-     static void SetArrayIn(DataArrayDouble *newArray, DataArrayDouble* &arrayToSet);
-     DataArrayDoubleIterator *iterator();
-     template<class InputIterator>
-     void insertAtTheEnd(InputIterator first, InputIterator last);
-     void aggregate(const DataArrayDouble *other);
-     void writeOnPlace(std::size_t id, double element0, const double *others, int sizeOfOthers) { _mem.writeOnPlace(id,element0,others,sizeOfOthers); }
-     void checkNoNullValues() const;
-     void getMinMaxPerComponent(double *bounds) const;
-     DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const;
-     void computeTupleIdsNearTuples(const DataArrayDouble *other, double eps, DataArrayInt *& c, DataArrayInt *& cI) const;
-     void recenterForMaxPrecision(double eps);
-     double getMaxValue2(DataArrayInt*& tupleIds) const;
-     double getMinValue2(DataArrayInt*& tupleIds) const;
-     int count(double value, double eps) const;
-     double getAverageValue() const;
-     double norm2() const;
-     double normMax() const;
-     double normMin() const;
-     void accumulate(double *res) const;
-     double accumulate(int compId) const;
-     DataArrayDouble *accumulatePerChunck(const int *bgOfIndex, const int *endOfIndex) const;
-     double distanceToTuple(const double *tupleBg, const double *tupleEnd, int& tupleId) const;
-     DataArrayDouble *fromPolarToCart() const;
-     DataArrayDouble *fromCylToCart() const;
-     DataArrayDouble *fromSpherToCart() const;
-     DataArrayDouble *cartesianize(MEDCouplingAxisType atOfThis) const;
-     DataArrayDouble *fromCartToPolar() const;
-     DataArrayDouble *fromCartToCyl() const;
-     DataArrayDouble *fromCartToSpher() const;
-     DataArrayDouble *fromCartToCylGiven(const DataArrayDouble *coords, const double center[3], const double vect[3]) const;
-     DataArrayDouble *doublyContractedProduct() const;
-     DataArrayDouble *determinant() const;
-     DataArrayDouble *eigenValues() const;
-     DataArrayDouble *eigenVectors() const;
-     DataArrayDouble *inverse() const;
-     DataArrayDouble *trace() const;
-     DataArrayDouble *deviator() const;
-     DataArrayDouble *magnitude() const;
-     DataArrayDouble *sumPerTuple() const;
-     DataArrayDouble *maxPerTuple() const;
-     DataArrayDouble *maxPerTupleWithCompoId(DataArrayInt* &compoIdOfMaxPerTuple) const;
-     DataArrayDouble *buildEuclidianDistanceDenseMatrix() const;
-     DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const;
-     void sortPerTuple(bool asc);
-     void abs();
-     DataArrayDouble *computeAbs() const;
-     void applyLin(double a, double b, int compoId);
-     void applyLin(double a, double b);
-     void applyInv(double numerator);
-     void applyPow(double val);
-     void applyRPow(double val);
-     DataArrayDouble *negate() const;
-     DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const;
-     DataArrayDouble *applyFunc(int nbOfComp, const std::string& func, bool isSafe=true) const;
-     DataArrayDouble *applyFunc(const std::string& func, bool isSafe=true) const;
-     void applyFuncOnThis(const std::string& func, bool isSafe=true);
-     DataArrayDouble *applyFuncCompo(int nbOfComp, const std::string& func, bool isSafe=true) const;
-     DataArrayDouble *applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe=true) const;
-     void applyFuncFast32(const std::string& func);
-     void applyFuncFast64(const std::string& func);
-     MCAuto<DataArrayDouble> symmetry3DPlane(const double point[3], const double normalVector[3]) const;
-     DataArrayInt *findIdsInRange(double vmin, double vmax) const;
-     DataArrayInt *findIdsNotInRange(double vmin, double vmax) const;
-     static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2);
-     static DataArrayDouble *Aggregate(const std::vector<const DataArrayDouble *>& arr);
-     static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2);
-     static DataArrayDouble *Meld(const std::vector<const DataArrayDouble *>& arr);
-     static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2);
-     static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2);
-     static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2);
-     static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2);
-     static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2);
-     void addEqual(const DataArrayDouble *other);
-     static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2);
-     void substractEqual(const DataArrayDouble *other);
-     static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2);
-     void multiplyEqual(const DataArrayDouble *other);
-     static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2);
-     void divideEqual(const DataArrayDouble *other);
-     static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2);
-     void powEqual(const DataArrayDouble *other);
-     void updateTime() const { }
-     MemArray<double>& accessToMemArray() { return _mem; }
-     const MemArray<double>& accessToMemArray() const { return _mem; }
-     std::vector<bool> toVectorOfBool(double eps) const;
-     static void Rotate2DAlg(const double *center, double angle, int nbNodes, const double *coordsIn, double *coordsOut);
-     static void Rotate3DAlg(const double *center, const double *vect, double angle, int nbNodes, const double *coordsIn, double *coordsOut);
-     static void Symmetry3DPlane(const double point[3], const double normalVector[3], int nbNodes, const double *coordsIn, double *coordsOut);
-     static void GiveBaseForPlane(const double normalVector[3], double baseOfPlane[9]);
-  public:
-     void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
-     void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
-     bool resizeForUnserialization(const std::vector<int>& tinyInfoI);
-     void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<std::string>& tinyInfoS);
+    MEDCOUPLING_EXPORT static DataArrayDouble *New();
+    MEDCOUPLING_EXPORT double doubleValue() const;
+    MEDCOUPLING_EXPORT DataArrayDouble *deepCopy() const;
+    MEDCOUPLING_EXPORT DataArrayDouble *buildNewEmptyInstance() const { return DataArrayDouble::New(); }
+    MEDCOUPLING_EXPORT void fillWithZero();
+    MEDCOUPLING_EXPORT void checkMonotonic(bool increasing, double eps) const;
+    MEDCOUPLING_EXPORT bool isMonotonic(bool increasing, double eps) const;
+    MEDCOUPLING_EXPORT std::string repr() const;
+    MEDCOUPLING_EXPORT std::string reprZip() const;
+    MEDCOUPLING_EXPORT std::string reprNotTooLong() const;
+    MEDCOUPLING_EXPORT void writeVTK(std::ostream& ofs, int indent, const std::string& nameInFile, DataArrayByte *byteArr) const;
+    MEDCOUPLING_EXPORT void reprStream(std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprZipStream(std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprNotTooLongStream(std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprWithoutNameStream(std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprZipWithoutNameStream(std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprNotTooLongWithoutNameStream(std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprCppStream(const std::string& varName, std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const;
+    MEDCOUPLING_EXPORT bool isEqual(const DataArrayDouble& other, double prec) const;
+    MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const DataArrayDouble& other, double prec, std::string& reason) const;
+    MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const;
+    MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleId(const int *new2OldBg, const int *new2OldEnd) const { return DataArrayTemplateFP<double>::mySelectByTupleId(new2OldBg,new2OldEnd); }
+    MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleId(const DataArrayInt32& di) const { return DataArrayTemplateFP<double>::mySelectByTupleId(di); }
+    MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const { return DataArrayTemplateFP<double>::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); }
+    MEDCOUPLING_EXPORT DataArrayDouble *keepSelectedComponents(const std::vector<int>& compoIds) const { return DataArrayTemplateFP<double>::myKeepSelectedComponents(compoIds); }
+    MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleIdSafeSlice(int bg, int end2, int step) const { return DataArrayTemplateFP<double>::mySelectByTupleIdSafeSlice(bg,end2,step); }
+    MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleRanges(const std::vector<std::pair<int,int> >& ranges) const { return DataArrayTemplateFP<double>::mySelectByTupleRanges(ranges); }
+    MEDCOUPLING_EXPORT bool areIncludedInMe(const DataArrayDouble *other, double prec, DataArrayInt32 *&tupleIds) const;
+    MEDCOUPLING_EXPORT void findCommonTuples(double prec, int limitTupleId, DataArrayInt32 *&comm, DataArrayInt32 *&commIndex) const;
+    MEDCOUPLING_EXPORT double minimalDistanceTo(const DataArrayDouble *other, int& thisTupleId, int& otherTupleId) const;
+    MEDCOUPLING_EXPORT DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const;
+    MEDCOUPLING_EXPORT DataArrayInt32 *findClosestTupleId(const DataArrayDouble *other) const;
+    MEDCOUPLING_EXPORT DataArrayInt32 *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const;
+    MEDCOUPLING_EXPORT void setSelectedComponents(const DataArrayDouble *a, const std::vector<int>& compoIds);
+    MEDCOUPLING_EXPORT DataArrayDoubleIterator *iterator();
+    MEDCOUPLING_EXPORT void checkNoNullValues() const;
+    MEDCOUPLING_EXPORT void getMinMaxPerComponent(double *bounds) const;
+    MEDCOUPLING_EXPORT DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const;
+    MEDCOUPLING_EXPORT void computeTupleIdsNearTuples(const DataArrayDouble *other, double eps, DataArrayInt32 *& c, DataArrayInt32 *& cI) const;
+    MEDCOUPLING_EXPORT void recenterForMaxPrecision(double eps);
+    MEDCOUPLING_EXPORT double getMaxValue2(DataArrayInt32*& tupleIds) const;
+    MEDCOUPLING_EXPORT double getMinValue2(DataArrayInt32*& tupleIds) const;
+    MEDCOUPLING_EXPORT int count(double value, double eps) const;
+    MEDCOUPLING_EXPORT double getAverageValue() const;
+    MEDCOUPLING_EXPORT double norm2() const;
+    MEDCOUPLING_EXPORT double normMax() const;
+    MEDCOUPLING_EXPORT double normMin() const;
+    MEDCOUPLING_EXPORT void accumulate(double *res) const;
+    MEDCOUPLING_EXPORT double accumulate(int compId) const;
+    MEDCOUPLING_EXPORT DataArrayDouble *accumulatePerChunck(const int *bgOfIndex, const int *endOfIndex) const;
+    MEDCOUPLING_EXPORT MCAuto<DataArrayDouble> cumSum() const;
+    MEDCOUPLING_EXPORT double distanceToTuple(const double *tupleBg, const double *tupleEnd, int& tupleId) const;
+    MEDCOUPLING_EXPORT DataArrayDouble *fromPolarToCart() const;
+    MEDCOUPLING_EXPORT DataArrayDouble *fromCylToCart() const;
+    MEDCOUPLING_EXPORT DataArrayDouble *fromSpherToCart() const;
+    MEDCOUPLING_EXPORT DataArrayDouble *cartesianize(MEDCouplingAxisType atOfThis) const;
+    MEDCOUPLING_EXPORT DataArrayDouble *fromCartToPolar() const;
+    MEDCOUPLING_EXPORT DataArrayDouble *fromCartToCyl() const;
+    MEDCOUPLING_EXPORT DataArrayDouble *fromCartToSpher() const;
+    MEDCOUPLING_EXPORT DataArrayDouble *fromCartToCylGiven(const DataArrayDouble *coords, const double center[3], const double vect[3]) const;
+    MEDCOUPLING_EXPORT DataArrayDouble *doublyContractedProduct() const;
+    MEDCOUPLING_EXPORT DataArrayDouble *determinant() const;
+    MEDCOUPLING_EXPORT DataArrayDouble *eigenValues() const;
+    MEDCOUPLING_EXPORT DataArrayDouble *eigenVectors() const;
+    MEDCOUPLING_EXPORT DataArrayDouble *inverse() const;
+    MEDCOUPLING_EXPORT DataArrayDouble *trace() const;
+    MEDCOUPLING_EXPORT DataArrayDouble *deviator() const;
+    MEDCOUPLING_EXPORT DataArrayDouble *magnitude() const;
+    MEDCOUPLING_EXPORT DataArrayDouble *sumPerTuple() const;
+    MEDCOUPLING_EXPORT DataArrayDouble *maxPerTuple() const;
+    MEDCOUPLING_EXPORT DataArrayDouble *maxPerTupleWithCompoId(DataArrayInt32* &compoIdOfMaxPerTuple) const;
+    MEDCOUPLING_EXPORT DataArrayDouble *buildEuclidianDistanceDenseMatrix() const;
+    MEDCOUPLING_EXPORT DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const;
+    MEDCOUPLING_EXPORT void sortPerTuple(bool asc);
+    MEDCOUPLING_EXPORT void applyInv(double numerator);
+    MEDCOUPLING_EXPORT void applyPow(double val);
+    MEDCOUPLING_EXPORT void applyRPow(double val);
+    MEDCOUPLING_EXPORT DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const;
+    MEDCOUPLING_EXPORT DataArrayDouble *applyFunc(int nbOfComp, const std::string& func, bool isSafe=true) const;
+    MEDCOUPLING_EXPORT DataArrayDouble *applyFunc(const std::string& func, bool isSafe=true) const;
+    MEDCOUPLING_EXPORT void applyFuncOnThis(const std::string& func, bool isSafe=true);
+    MEDCOUPLING_EXPORT DataArrayDouble *applyFuncCompo(int nbOfComp, const std::string& func, bool isSafe=true) const;
+    MEDCOUPLING_EXPORT DataArrayDouble *applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe=true) const;
+    MEDCOUPLING_EXPORT void applyFuncFast32(const std::string& func);
+    MEDCOUPLING_EXPORT void applyFuncFast64(const std::string& func);
+    MEDCOUPLING_EXPORT MCAuto<DataArrayDouble> symmetry3DPlane(const double point[3], const double normalVector[3]) const;
+    MEDCOUPLING_EXPORT DataArrayInt32 *findIdsInRange(double vmin, double vmax) const;
+    MEDCOUPLING_EXPORT DataArrayInt32 *findIdsNotInRange(double vmin, double vmax) const;
+    MEDCOUPLING_EXPORT static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2);
+    MEDCOUPLING_EXPORT static DataArrayDouble *Aggregate(const std::vector<const DataArrayDouble *>& arr);
+    MEDCOUPLING_EXPORT static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2);
+    MEDCOUPLING_EXPORT static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2);
+    MEDCOUPLING_EXPORT static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2);
+    MEDCOUPLING_EXPORT static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2);
+    MEDCOUPLING_EXPORT static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2);
+    MEDCOUPLING_EXPORT void powEqual(const DataArrayDouble *other);
+    MEDCOUPLING_EXPORT std::vector<bool> toVectorOfBool(double eps) const;
+    MEDCOUPLING_EXPORT static void Rotate2DAlg(const double *center, double angle, int nbNodes, const double *coordsIn, double *coordsOut);
+    MEDCOUPLING_EXPORT static void Rotate3DAlg(const double *center, const double *vect, double angle, int nbNodes, const double *coordsIn, double *coordsOut);
+    MEDCOUPLING_EXPORT static void Symmetry3DPlane(const double point[3], const double normalVector[3], int nbNodes, const double *coordsIn, double *coordsOut);
+    MEDCOUPLING_EXPORT static void GiveBaseForPlane(const double normalVector[3], double baseOfPlane[9]);
+  public:
+    MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
+    MEDCOUPLING_EXPORT void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
+    MEDCOUPLING_EXPORT bool resizeForUnserialization(const std::vector<int>& tinyInfoI);
+    MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<std::string>& tinyInfoS);
   public:
     template<int SPACEDIM>
-    void findCommonTuplesAlg(const double *bbox, int nbNodes, int limitNodeId, double prec, DataArrayInt *c, DataArrayInt *cI) const;
+    void findCommonTuplesAlg(const double *bbox, int nbNodes, int limitNodeId, double prec, DataArrayInt32 *c, DataArrayInt32 *cI) const;
     template<int SPACEDIM>
     static void FindClosestTupleIdAlg(const BBTreePts<SPACEDIM,int>& myTree, double dist, const double *pos, int nbOfTuples, const double *thisPt, int thisNbOfTuples, int *res);
     template<int SPACEDIM>
     static void FindTupleIdsNearTuplesAlg(const BBTreePts<SPACEDIM,int>& myTree, const double *pos, int nbOfTuples, double eps,
-                                          DataArrayInt *c, DataArrayInt *cI);
+                                          DataArrayInt32 *c, DataArrayInt32 *cI);
   private:
     ~DataArrayDouble() { }
     DataArrayDouble() { }
   };
 
-  class DataArrayDoubleTuple;
+  template<class T>
+  class DataArrayDiscrete : public DataArrayTemplateClassic<T>
+  {
+  public:
+    MEDCOUPLING_EXPORT bool isEqual(const DataArrayDiscrete<T>& other) const;
+    MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const DataArrayDiscrete<T>& other, std::string& reason) const;
+    MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const DataArrayDiscrete<T>& other) const;
+    MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStrAndOrder(const typename Traits<T>::ArrayType& other) const;
+    MEDCOUPLING_EXPORT void switchOnTupleEqualTo(T val, std::vector<bool>& vec) const;
+    MEDCOUPLING_EXPORT void switchOnTupleNotEqualTo(T val, std::vector<bool>& vec) const;
+  protected:
+    template<class ALG>
+    void switchOnTupleAlg(T val, std::vector<bool>& vec, ALG algo) const;
+  protected:
+    ~DataArrayDiscrete() { }
+  };
+  
+  template<class T>
+  class DataArrayDiscreteSigned : public DataArrayDiscrete<T>
+  {
+  public:
+    MEDCOUPLING_EXPORT bool isFittingWith(const std::vector<bool>& v) const;
+  protected:
+    ~DataArrayDiscreteSigned() { }
+  };
 
-  class MEDCOUPLING_EXPORT DataArrayDoubleIterator
+  class DataArrayInt32Iterator;
+
+  class DataArrayInt32 : public DataArrayDiscreteSigned<Int32>
   {
   public:
-     DataArrayDoubleIterator(DataArrayDouble *da);
-     ~DataArrayDoubleIterator();
-     DataArrayDoubleTuple *nextt();
+    MEDCOUPLING_EXPORT static DataArrayInt32 *New();
+    MEDCOUPLING_EXPORT int intValue() const;
+    MEDCOUPLING_EXPORT int getHashCode() const;
+    MEDCOUPLING_EXPORT DataArrayInt32 *deepCopy() const;//ok
+    MEDCOUPLING_EXPORT DataArrayInt32 *buildNewEmptyInstance() const { return DataArrayInt32::New(); }//ok
+    MEDCOUPLING_EXPORT DataArrayInt32 *buildPermutationArr(const DataArrayInt32& other) const;
+    MEDCOUPLING_EXPORT DataArrayInt32 *indicesOfSubPart(const DataArrayInt32& partOfThis) const;
+    MEDCOUPLING_EXPORT DataArrayInt32 *sumPerTuple() const;
+    MEDCOUPLING_EXPORT void checkMonotonic(bool increasing) const;
+    MEDCOUPLING_EXPORT bool isMonotonic(bool increasing) const;
+    MEDCOUPLING_EXPORT void checkStrictlyMonotonic(bool increasing) const;
+    MEDCOUPLING_EXPORT bool isStrictlyMonotonic(bool increasing) const;
+    MEDCOUPLING_EXPORT void fillWithZero();
+    MEDCOUPLING_EXPORT void iota(int init=0);
+    MEDCOUPLING_EXPORT std::string repr() const;
+    MEDCOUPLING_EXPORT std::string reprZip() const;
+    MEDCOUPLING_EXPORT std::string reprNotTooLong() const;
+    MEDCOUPLING_EXPORT void writeVTK(std::ostream& ofs, int indent, const std::string& type, const std::string& nameInFile, DataArrayByte *byteArr) const;
+    MEDCOUPLING_EXPORT void reprStream(std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprZipStream(std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprNotTooLongStream(std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprWithoutNameStream(std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprZipWithoutNameStream(std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprNotTooLongWithoutNameStream(std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprCppStream(const std::string& varName, std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const;
+    MEDCOUPLING_EXPORT void transformWithIndArr(const int *indArrBg, const int *indArrEnd);
+    MEDCOUPLING_EXPORT void transformWithIndArr(const MapKeyVal<int>& m);
+    MEDCOUPLING_EXPORT DataArrayInt32 *transformWithIndArrR(const int *indArrBg, const int *indArrEnd) const;
+    MEDCOUPLING_EXPORT void splitByValueRange(const int *arrBg, const int *arrEnd,
+                                              DataArrayInt32 *& castArr, DataArrayInt32 *& rankInsideCast, DataArrayInt32 *& castsPresent) const;
+    MEDCOUPLING_EXPORT bool isRange(int& strt, int& sttoopp, int& stteepp) const;
+    MEDCOUPLING_EXPORT DataArrayInt32 *invertArrayO2N2N2O(int newNbOfElem) const;
+    MEDCOUPLING_EXPORT DataArrayInt32 *invertArrayN2O2O2N(int oldNbOfElem) const;
+    MEDCOUPLING_EXPORT MCAuto< MapKeyVal<int> > invertArrayN2O2O2NOptimized() const;
+    MEDCOUPLING_EXPORT DataArrayInt32 *invertArrayO2N2N2OBis(int newNbOfElem) const;
+    MEDCOUPLING_EXPORT DataArrayInt32 *selectByTupleId(const int *new2OldBg, const int *new2OldEnd) const { return DataArrayTemplate<int>::mySelectByTupleId(new2OldBg,new2OldEnd); }
+    MEDCOUPLING_EXPORT DataArrayInt32 *selectByTupleId(const DataArrayInt32& di) const { return DataArrayTemplate<int>::mySelectByTupleId(di); }
+    MEDCOUPLING_EXPORT DataArrayInt32 *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const { return DataArrayTemplate<int>::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); }
+    MEDCOUPLING_EXPORT DataArrayInt32 *keepSelectedComponents(const std::vector<int>& compoIds) const { return DataArrayTemplate<int>::myKeepSelectedComponents(compoIds); }
+    MEDCOUPLING_EXPORT DataArrayInt32 *selectByTupleIdSafeSlice(int bg, int end2, int step) const { return DataArrayTemplate<int>::mySelectByTupleIdSafeSlice(bg,end2,step); }
+    MEDCOUPLING_EXPORT DataArrayInt32 *selectByTupleRanges(const std::vector<std::pair<int,int> >& ranges) const { return DataArrayTemplate<int>::mySelectByTupleRanges(ranges); }
+    MEDCOUPLING_EXPORT DataArrayInt32 *checkAndPreparePermutation() const;
+    MEDCOUPLING_EXPORT static DataArrayInt32 *FindPermutationFromFirstToSecond(const DataArrayInt32 *ids1, const DataArrayInt32 *ids2);
+    MEDCOUPLING_EXPORT void changeSurjectiveFormat(int targetNb, DataArrayInt32 *&arr, DataArrayInt32 *&arrI) const;
+    MEDCOUPLING_EXPORT static DataArrayInt32 *ConvertIndexArrayToO2N(int nbOfOldTuples, const int *arr, const int *arrIBg, const int *arrIEnd, int &newNbOfTuples);
+    MEDCOUPLING_EXPORT DataArrayInt32 *buildPermArrPerLevel() const;
+    MEDCOUPLING_EXPORT bool isIota(int sizeExpected) const;
+    MEDCOUPLING_EXPORT bool isUniform(int val) const;
+    MEDCOUPLING_EXPORT int checkUniformAndGuess() const;
+    MEDCOUPLING_EXPORT bool hasUniqueValues() const;
+    MEDCOUPLING_EXPORT void setSelectedComponents(const DataArrayInt32 *a, const std::vector<int>& compoIds);
+    MEDCOUPLING_EXPORT DataArrayInt32Iterator *iterator();
+    MEDCOUPLING_EXPORT DataArrayInt32 *findIdsEqual(int val) const;
+    MEDCOUPLING_EXPORT DataArrayInt32 *findIdsNotEqual(int val) const;
+    MEDCOUPLING_EXPORT DataArrayInt32 *findIdsEqualList(const int *valsBg, const int *valsEnd) const;
+    MEDCOUPLING_EXPORT DataArrayInt32 *findIdsNotEqualList(const int *valsBg, const int *valsEnd) const;
+    MEDCOUPLING_EXPORT DataArrayInt32 *findIdsEqualTuple(const int *tupleBg, const int *tupleEnd) const;
+    MEDCOUPLING_EXPORT int changeValue(int oldValue, int newValue);
+    MEDCOUPLING_EXPORT int findIdFirstEqualTuple(const std::vector<int>& tupl) const;
+    MEDCOUPLING_EXPORT int findIdFirstEqual(int value) const;
+    MEDCOUPLING_EXPORT int findIdFirstEqual(const std::vector<int>& vals) const;
+    MEDCOUPLING_EXPORT int findIdSequence(const std::vector<int>& vals) const;
+    MEDCOUPLING_EXPORT bool presenceOfTuple(const std::vector<int>& tupl) const;
+    MEDCOUPLING_EXPORT bool presenceOfValue(int value) const;
+    MEDCOUPLING_EXPORT bool presenceOfValue(const std::vector<int>& vals) const;
+    MEDCOUPLING_EXPORT int count(int value) const;
+    MEDCOUPLING_EXPORT void accumulate(int *res) const;
+    MEDCOUPLING_EXPORT int accumulate(int compId) const;
+    MEDCOUPLING_EXPORT DataArrayInt32 *accumulatePerChunck(const int *bgOfIndex, const int *endOfIndex) const;
+    MEDCOUPLING_EXPORT void getMinMaxValues(int& minValue, int& maxValue) const;
+    MEDCOUPLING_EXPORT void applyInv(int numerator);
+    MEDCOUPLING_EXPORT void applyDivideBy(int val);
+    MEDCOUPLING_EXPORT void applyModulus(int val);
+    MEDCOUPLING_EXPORT void applyRModulus(int val);
+    MEDCOUPLING_EXPORT void applyPow(int val);
+    MEDCOUPLING_EXPORT void applyRPow(int val);
+    MEDCOUPLING_EXPORT DataArrayInt32 *findIdsInRange(int vmin, int vmax) const;
+    MEDCOUPLING_EXPORT DataArrayInt32 *findIdsNotInRange(int vmin, int vmax) const;
+    MEDCOUPLING_EXPORT bool checkAllIdsInRange(int vmin, int vmax) const;
+    MEDCOUPLING_EXPORT static DataArrayInt32 *Aggregate(const DataArrayInt32 *a1, const DataArrayInt32 *a2, int offsetA2);
+    MEDCOUPLING_EXPORT static DataArrayInt32 *Aggregate(const std::vector<const DataArrayInt32 *>& arr);
+    MEDCOUPLING_EXPORT static DataArrayInt32 *AggregateIndexes(const std::vector<const DataArrayInt32 *>& arrs);
+    MEDCOUPLING_EXPORT static DataArrayInt32 *MakePartition(const std::vector<const DataArrayInt32 *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups);
+    MEDCOUPLING_EXPORT static DataArrayInt32 *BuildUnion(const std::vector<const DataArrayInt32 *>& arr);
+    MEDCOUPLING_EXPORT static DataArrayInt32 *BuildIntersection(const std::vector<const DataArrayInt32 *>& arr);
+    MEDCOUPLING_EXPORT static DataArrayInt32 *BuildListOfSwitchedOn(const std::vector<bool>& v);
+    MEDCOUPLING_EXPORT static DataArrayInt32 *BuildListOfSwitchedOff(const std::vector<bool>& v);
+    MEDCOUPLING_EXPORT static void PutIntoToSkylineFrmt(const std::vector< std::vector<int> >& v, DataArrayInt32 *& data, DataArrayInt32 *& dataIndex);
+    MEDCOUPLING_EXPORT DataArrayInt32 *buildComplement(int nbOfElement) const;
+    MEDCOUPLING_EXPORT DataArrayInt32 *buildSubstraction(const DataArrayInt32 *other) const;
+    MEDCOUPLING_EXPORT DataArrayInt32 *buildSubstractionOptimized(const DataArrayInt32 *other) const;
+    MEDCOUPLING_EXPORT DataArrayInt32 *buildUnion(const DataArrayInt32 *other) const;
+    MEDCOUPLING_EXPORT DataArrayInt32 *buildIntersection(const DataArrayInt32 *other) const;
+    MEDCOUPLING_EXPORT DataArrayInt32 *buildUnique() const;
+    MEDCOUPLING_EXPORT DataArrayInt32 *buildUniqueNotSorted() const;
+    MEDCOUPLING_EXPORT DataArrayInt32 *deltaShiftIndex() const;
+    MEDCOUPLING_EXPORT void computeOffsets();
+    MEDCOUPLING_EXPORT void computeOffsetsFull();
+    MEDCOUPLING_EXPORT void findIdsRangesInListOfIds(const DataArrayInt32 *listOfIds, DataArrayInt32 *& rangeIdsFetched, DataArrayInt32 *& idsInInputListThatFetch) const;
+    MEDCOUPLING_EXPORT DataArrayInt32 *buildExplicitArrByRanges(const DataArrayInt32 *offsets) const;
+    MEDCOUPLING_EXPORT DataArrayInt32 *buildExplicitArrOfSliceOnScaledArr(int begin, int stop, int step) const;
+    MEDCOUPLING_EXPORT DataArrayInt32 *findRangeIdForEachTuple(const DataArrayInt32 *ranges) const;
+    MEDCOUPLING_EXPORT DataArrayInt32 *findIdInRangeForEachTuple(const DataArrayInt32 *ranges) const;
+    MEDCOUPLING_EXPORT void sortEachPairToMakeALinkedList();
+    MEDCOUPLING_EXPORT MCAuto<DataArrayInt32> fromLinkedListOfPairToList() const;
+    MEDCOUPLING_EXPORT DataArrayInt32 *getDifferentValues() const;
+    MEDCOUPLING_EXPORT std::vector<DataArrayInt32 *> partitionByDifferentValues(std::vector<int>& differentIds) const;
+    MEDCOUPLING_EXPORT std::vector< std::pair<int,int> > splitInBalancedSlices(int nbOfSlices) const;
+    MEDCOUPLING_EXPORT static DataArrayInt32 *Modulus(const DataArrayInt32 *a1, const DataArrayInt32 *a2);
+    MEDCOUPLING_EXPORT void modulusEqual(const DataArrayInt32 *other);
+    MEDCOUPLING_EXPORT static DataArrayInt32 *Pow(const DataArrayInt32 *a1, const DataArrayInt32 *a2);
+    MEDCOUPLING_EXPORT void powEqual(const DataArrayInt32 *other);
+    MEDCOUPLING_EXPORT MemArray<int>& accessToMemArray() { return _mem; }
+    MEDCOUPLING_EXPORT const MemArray<int>& accessToMemArray() const { return _mem; }
+  public:
+    MEDCOUPLING_EXPORT static int *CheckAndPreparePermutation(const int *start, const int *end);
+    MEDCOUPLING_EXPORT static DataArrayInt32 *Range(int begin, int end, int step);
+  public:
+    MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
+    MEDCOUPLING_EXPORT void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
+    MEDCOUPLING_EXPORT bool resizeForUnserialization(const std::vector<int>& tinyInfoI);
+    MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<std::string>& tinyInfoS);
   private:
-    DataArrayDouble *_da;
-    double *_pt;
-    int _tuple_id;
-    int _nb_comp;
-    int _nb_tuple;
+    ~DataArrayInt32() { }
+    DataArrayInt32() { }
   };
 
-  class MEDCOUPLING_EXPORT DataArrayDoubleTuple
+  class DataArrayInt64 : public DataArrayDiscrete<Int64>
+  {
+  };
+  
+  template<class T>
+  template<class OP>
+  MCAuto<DataArrayInt> DataArrayTemplateClassic<T>::findIdsAdv(const OP& op) const
+  {
+    this->checkAllocated();
+    if(this->getNumberOfComponents()!=1)
+      throw INTERP_KERNEL::Exception("DataArrayInt::findIdsAdv : this must have exactly one component !");
+    const T *cptr(this->begin());
+    MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
+    int nbOfTuples(this->getNumberOfTuples());
+    for(int i=0;i<nbOfTuples;i++,cptr++)
+      if(op(*cptr))
+        ret->pushBackSilent(i);
+    return ret;
+  }
+
+  class DataArrayChar : public DataArrayTemplate<char>
   {
   public:
-     DataArrayDoubleTuple(double *pt, int nbOfComp);
-     std::string repr() const;
-     int getNumberOfCompo() const { return _nb_of_compo; }
-     const double *getConstPointer() const { return  _pt; }
-     double *getPointer() { return _pt; }
-     double doubleValue() const;
-     DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const;
-  private:
-    double *_pt;
-    int _nb_of_compo;
+    MEDCOUPLING_EXPORT virtual DataArrayChar *buildEmptySpecializedDAChar() const = 0;
+    MEDCOUPLING_EXPORT int getHashCode() const;
+    MEDCOUPLING_EXPORT bool isEqual(const DataArrayChar& other) const;
+    MEDCOUPLING_EXPORT virtual bool isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const;
+    MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const DataArrayChar& other) const;
+    MEDCOUPLING_EXPORT void fillWithZero();
+    MEDCOUPLING_EXPORT std::string repr() const;
+    MEDCOUPLING_EXPORT std::string reprZip() const;
+    MEDCOUPLING_EXPORT DataArrayInt *convertToIntArr() const;
+    MEDCOUPLING_EXPORT DataArrayChar *selectByTupleId(const int *new2OldBg, const int *new2OldEnd) const { return DataArrayTemplate<char>::mySelectByTupleId(new2OldBg,new2OldEnd); }
+    MEDCOUPLING_EXPORT DataArrayChar *selectByTupleId(const DataArrayInt& di) const { return DataArrayTemplate<char>::mySelectByTupleId(di); }
+    MEDCOUPLING_EXPORT DataArrayChar *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const { return DataArrayTemplate<char>::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); }
+    MEDCOUPLING_EXPORT DataArrayChar *keepSelectedComponents(const std::vector<int>& compoIds) const { return DataArrayTemplate<char>::myKeepSelectedComponents(compoIds); }
+    MEDCOUPLING_EXPORT DataArrayChar *selectByTupleIdSafeSlice(int bg, int end2, int step) const { return DataArrayTemplate<char>::mySelectByTupleIdSafeSlice(bg,end2,step); }
+    MEDCOUPLING_EXPORT bool isUniform(char val) const;
+    MEDCOUPLING_EXPORT void meldWith(const DataArrayChar *other);
+    MEDCOUPLING_EXPORT DataArray *selectByTupleRanges(const std::vector<std::pair<int,int> >& ranges) const { return DataArrayTemplate<char>::mySelectByTupleRanges(ranges); }
+    MEDCOUPLING_EXPORT DataArrayInt *findIdsEqual(char val) const;
+    MEDCOUPLING_EXPORT DataArrayInt *findIdsNotEqual(char val) const;
+    MEDCOUPLING_EXPORT int findIdSequence(const std::vector<char>& vals) const;
+    MEDCOUPLING_EXPORT int findIdFirstEqualTuple(const std::vector<char>& tupl) const;
+    MEDCOUPLING_EXPORT int findIdFirstEqual(char value) const;
+    MEDCOUPLING_EXPORT int findIdFirstEqual(const std::vector<char>& vals) const;
+    MEDCOUPLING_EXPORT bool presenceOfTuple(const std::vector<char>& tupl) const;
+    MEDCOUPLING_EXPORT bool presenceOfValue(char value) const;
+    MEDCOUPLING_EXPORT bool presenceOfValue(const std::vector<char>& vals) const;
+    MEDCOUPLING_EXPORT DataArrayInt *findIdsInRange(char vmin, char vmax) const;
+    MEDCOUPLING_EXPORT static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2);
+    MEDCOUPLING_EXPORT static DataArrayChar *Aggregate(const std::vector<const DataArrayChar *>& arr);
+    MEDCOUPLING_EXPORT static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2);
+    MEDCOUPLING_EXPORT static DataArrayChar *Meld(const std::vector<const DataArrayChar *>& arr);
+    MEDCOUPLING_EXPORT MemArray<char>& accessToMemArray() { return _mem; }
+    MEDCOUPLING_EXPORT const MemArray<char>& accessToMemArray() const { return _mem; }
+  public:
+    //MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
+    //MEDCOUPLING_EXPORT void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
+    //MEDCOUPLING_EXPORT bool resizeForUnserialization(const std::vector<int>& tinyInfoI);
+    //MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<std::string>& tinyInfoS);
+  protected:
+    DataArrayChar() { }
   };
 
-  class DataArrayIntIterator;
+  class DataArrayByteIterator;
 
-  class MEDCOUPLING_EXPORT DataArrayInt : public DataArrayTemplate<int>
+  class DataArrayByte : public DataArrayChar
   {
   public:
-     static DataArrayInt *New();
-     int intValue() const;
-     int getHashCode() const;
-     DataArrayInt *deepCopy() const;
-     DataArrayInt *performCopyOrIncrRef(bool deepCopy) const;
-     DataArrayInt *buildNewEmptyInstance() const { return DataArrayInt::New(); }
-     bool isEqual(const DataArrayInt& other) const;
-     bool isEqualIfNotWhy(const DataArrayInt& other, std::string& reason) const;
-     bool isEqualWithoutConsideringStr(const DataArrayInt& other) const;
-     bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const;
-     bool isFittingWith(const std::vector<bool>& v) const;
-     void switchOnTupleEqualTo(int val, std::vector<bool>& vec) const;
-     void switchOnTupleNotEqualTo(int val, std::vector<bool>& vec) const;
-     DataArrayInt *buildPermutationArr(const DataArrayInt& other) const;
-     DataArrayInt *indicesOfSubPart(const DataArrayInt& partOfThis) const;
-     DataArrayInt *sumPerTuple() const;
-     void checkMonotonic(bool increasing) const;
-     bool isMonotonic(bool increasing) const;
-     void checkStrictlyMonotonic(bool increasing) const;
-     bool isStrictlyMonotonic(bool increasing) const;
-     void fillWithZero();
-     void iota(int init=0);
-     std::string repr() const;
-     std::string reprZip() const;
-     std::string reprNotTooLong() const;
-     void writeVTK(std::ostream& ofs, int indent, const std::string& type, const std::string& nameInFile, DataArrayByte *byteArr) const;
-     void reprStream(std::ostream& stream) const;
-     void reprZipStream(std::ostream& stream) const;
-     void reprNotTooLongStream(std::ostream& stream) const;
-     void reprWithoutNameStream(std::ostream& stream) const;
-     void reprZipWithoutNameStream(std::ostream& stream) const;
-     void reprNotTooLongWithoutNameStream(std::ostream& stream) const;
-     void reprCppStream(const std::string& varName, std::ostream& stream) const;
-     void reprQuickOverview(std::ostream& stream) const;
-     void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const;
-     void transformWithIndArr(const int *indArrBg, const int *indArrEnd);
-     DataArrayInt *transformWithIndArrR(const int *indArrBg, const int *indArrEnd) const;
-     void splitByValueRange(const int *arrBg, const int *arrEnd,
-                                              DataArrayInt *& castArr, DataArrayInt *& rankInsideCast, DataArrayInt *& castsPresent) const;
-     bool isRange(int& strt, int& sttoopp, int& stteepp) const;
-     DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const;
-     DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const;
-     DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const;
-     DataArrayDouble *convertToDblArr() const;
-     DataArrayInt *fromNoInterlace() const;
-     DataArrayInt *toNoInterlace() const;
-     DataArrayInt *selectByTupleId(const int *new2OldBg, const int *new2OldEnd) const { return DataArrayTemplate<int>::mySelectByTupleId(new2OldBg,new2OldEnd); }
-     DataArrayInt *selectByTupleId(const DataArrayInt& di) const { return DataArrayTemplate<int>::mySelectByTupleId(di); }
-     DataArrayInt *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const { return DataArrayTemplate<int>::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); }
-     DataArrayInt *keepSelectedComponents(const std::vector<int>& compoIds) const { return DataArrayTemplate<int>::myKeepSelectedComponents(compoIds); }
-     DataArrayInt *selectByTupleIdSafeSlice(int bg, int end2, int step) const { return DataArrayTemplate<int>::mySelectByTupleIdSafeSlice(bg,end2,step); }
-     DataArrayInt *selectByTupleRanges(const std::vector<std::pair<int,int> >& ranges) const { return DataArrayTemplate<int>::mySelectByTupleRanges(ranges); }
-     DataArrayInt *checkAndPreparePermutation() const;
-     static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2);
-     void changeSurjectiveFormat(int targetNb, DataArrayInt *&arr, DataArrayInt *&arrI) const;
-     static DataArrayInt *ConvertIndexArrayToO2N(int nbOfOldTuples, const int *arr, const int *arrIBg, const int *arrIEnd, int &newNbOfTuples);
-     DataArrayInt *buildPermArrPerLevel() const;
-     bool isIota(int sizeExpected) const;
-     bool isUniform(int val) const;
-     bool hasUniqueValues() const;
-     void meldWith(const DataArrayInt *other);
-     void setSelectedComponents(const DataArrayInt *a, const std::vector<int>& compoIds);
-     void getTuple(int tupleId, int *res) const { std::copy(_mem.getConstPointerLoc(tupleId*_info_on_compo.size()),_mem.getConstPointerLoc((tupleId+1)*_info_on_compo.size()),res); }
-     static void SetArrayIn(DataArrayInt *newArray, DataArrayInt* &arrayToSet);
-     DataArrayIntIterator *iterator();
-     DataArrayInt *findIdsEqual(int val) const;
-     DataArrayInt *findIdsNotEqual(int val) const;
-     DataArrayInt *findIdsEqualList(const int *valsBg, const int *valsEnd) const;
-     DataArrayInt *findIdsNotEqualList(const int *valsBg, const int *valsEnd) const;
-     DataArrayInt *findIdsEqualTuple(const int *tupleBg, const int *tupleEnd) const;
-     int changeValue(int oldValue, int newValue);
-     int findIdFirstEqualTuple(const std::vector<int>& tupl) const;
-     int findIdFirstEqual(int value) const;
-     int findIdFirstEqual(const std::vector<int>& vals) const;
-     int findIdSequence(const std::vector<int>& vals) const;
-     bool presenceOfTuple(const std::vector<int>& tupl) const;
-     bool presenceOfValue(int value) const;
-     bool presenceOfValue(const std::vector<int>& vals) const;
-     int count(int value) const;
-     void accumulate(int *res) const;
-     int accumulate(int compId) const;
-     DataArrayInt *accumulatePerChunck(const int *bgOfIndex, const int *endOfIndex) const;
-     void getMinMaxValues(int& minValue, int& maxValue) const;
-     void abs();
-     DataArrayInt *computeAbs() const;
-     void applyLin(int a, int b, int compoId);
-     void applyLin(int a, int b);
-     void applyInv(int numerator);
-     DataArrayInt *negate() const;
-     void applyDivideBy(int val);
-     void applyModulus(int val);
-     void applyRModulus(int val);
-     void applyPow(int val);
-     void applyRPow(int val);
-     DataArrayInt *findIdsInRange(int vmin, int vmax) const;
-     DataArrayInt *findIdsNotInRange(int vmin, int vmax) const;
-     DataArrayInt *findIdsStricltyNegative() const;
-     bool checkAllIdsInRange(int vmin, int vmax) const;
-     static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2);
-     static DataArrayInt *Aggregate(const std::vector<const DataArrayInt *>& arr);
-     static DataArrayInt *AggregateIndexes(const std::vector<const DataArrayInt *>& arrs);
-     static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2);
-     static DataArrayInt *Meld(const std::vector<const DataArrayInt *>& arr);
-     static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups);
-     static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr);
-     static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr);
-     static DataArrayInt *BuildListOfSwitchedOn(const std::vector<bool>& v);
-     static DataArrayInt *BuildListOfSwitchedOff(const std::vector<bool>& v);
-     static void PutIntoToSkylineFrmt(const std::vector< std::vector<int> >& v, DataArrayInt *& data, DataArrayInt *& dataIndex);
-     DataArrayInt *buildComplement(int nbOfElement) const;
-     DataArrayInt *buildSubstraction(const DataArrayInt *other) const;
-     DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const;
-     DataArrayInt *buildUnion(const DataArrayInt *other) const;
-     DataArrayInt *buildIntersection(const DataArrayInt *other) const;
-     DataArrayInt *buildUnique() const;
-     DataArrayInt *buildUniqueNotSorted() const;
-     DataArrayInt *deltaShiftIndex() const;
-     void computeOffsets();
-     void computeOffsetsFull();
-     void findIdsRangesInListOfIds(const DataArrayInt *listOfIds, DataArrayInt *& rangeIdsFetched, DataArrayInt *& idsInInputListThatFetch) const;
-     DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const;
-     DataArrayInt *buildExplicitArrOfSliceOnScaledArr(int begin, int stop, int step) const;
-     DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const;
-     DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const;
-     void sortEachPairToMakeALinkedList();
-     DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const;
-     DataArrayInt *getDifferentValues() const;
-     std::vector<DataArrayInt *> partitionByDifferentValues(std::vector<int>& differentIds) const;
-     std::vector< std::pair<int,int> > splitInBalancedSlices(int nbOfSlices) const;
-     template<class InputIterator>
-     void insertAtTheEnd(InputIterator first, InputIterator last);
-     void aggregate(const DataArrayInt *other);
-     void writeOnPlace(std::size_t id, int element0, const int *others, int sizeOfOthers) { _mem.writeOnPlace(id,element0,others,sizeOfOthers); }
-     static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2);
-     void addEqual(const DataArrayInt *other);
-     static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2);
-     void substractEqual(const DataArrayInt *other);
-     static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2);
-     void multiplyEqual(const DataArrayInt *other);
-     static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2);
-     void divideEqual(const DataArrayInt *other);
-     static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2);
-     void modulusEqual(const DataArrayInt *other);
-     static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2);
-     void powEqual(const DataArrayInt *other);
-     void updateTime() const { }
-     MemArray<int>& accessToMemArray() { return _mem; }
-     const MemArray<int>& accessToMemArray() const { return _mem; }
-  public:
-     static int *CheckAndPreparePermutation(const int *start, const int *end);
-     static DataArrayInt *Range(int begin, int end, int step);
-  public:
-     void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
-     void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
-     bool resizeForUnserialization(const std::vector<int>& tinyInfoI);
-     void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<std::string>& tinyInfoS);
+    MEDCOUPLING_EXPORT static DataArrayByte *New();
+    MEDCOUPLING_EXPORT DataArrayChar *buildEmptySpecializedDAChar() const;
+    MEDCOUPLING_EXPORT DataArrayByteIterator *iterator();
+    MEDCOUPLING_EXPORT DataArrayByte *deepCopy() const;
+    MEDCOUPLING_EXPORT DataArrayByte *performCopyOrIncrRef(bool deepCopy) const;
+    MEDCOUPLING_EXPORT DataArrayByte *buildNewEmptyInstance() const { return DataArrayByte::New(); }
+    MEDCOUPLING_EXPORT char byteValue() const;
+    MEDCOUPLING_EXPORT void reprStream(std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprZipStream(std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprWithoutNameStream(std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprZipWithoutNameStream(std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprCppStream(const std::string& varName, std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const;
+    MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const;
+    MEDCOUPLING_EXPORT std::vector<bool> toVectorOfBool() const;
   private:
-    ~DataArrayInt() { }
-    DataArrayInt() { }
+    ~DataArrayByte() { }
+    DataArrayByte() { }
   };
 
-  class DataArrayIntTuple;
+  class DataArrayAsciiCharIterator;
 
-  class MEDCOUPLING_EXPORT DataArrayIntIterator
+  class DataArrayAsciiChar : public DataArrayChar
+  {
+  public:
+    MEDCOUPLING_EXPORT static DataArrayAsciiChar *New();
+    MEDCOUPLING_EXPORT static DataArrayAsciiChar *New(const std::string& st);
+    MEDCOUPLING_EXPORT static DataArrayAsciiChar *New(const std::vector<std::string>& vst, char defaultChar);
+    MEDCOUPLING_EXPORT DataArrayChar *buildEmptySpecializedDAChar() const;
+    MEDCOUPLING_EXPORT DataArrayAsciiCharIterator *iterator();
+    MEDCOUPLING_EXPORT DataArrayAsciiChar *deepCopy() const;
+    MEDCOUPLING_EXPORT DataArrayAsciiChar *performCopyOrIncrRef(bool deepCopy) const;
+    MEDCOUPLING_EXPORT DataArrayAsciiChar *buildNewEmptyInstance() const { return DataArrayAsciiChar::New(); }
+    MEDCOUPLING_EXPORT char asciiCharValue() const;
+    MEDCOUPLING_EXPORT void reprStream(std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprZipStream(std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprWithoutNameStream(std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprZipWithoutNameStream(std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprCppStream(const std::string& varName, std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const;
+    MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const;
+  private:
+    ~DataArrayAsciiChar() { }
+    DataArrayAsciiChar() { }
+    DataArrayAsciiChar(const std::string& st);
+    DataArrayAsciiChar(const std::vector<std::string>& vst, char defaultChar);
+  };
+
+  template<class T>
+  class DataArrayIterator
   {
   public:
-     DataArrayIntIterator(DataArrayInt *da);
-     ~DataArrayIntIterator();
-     DataArrayIntTuple *nextt();
+    DataArrayIterator(typename Traits<T>::ArrayType *da);
+    ~DataArrayIterator();
+    MEDCOUPLING_EXPORT typename Traits<T>::ArrayTuple *nextt();
   private:
-    DataArrayInt *_da;
-    int *_pt;
+    typename Traits<T>::ArrayType *_da;
+    T *_pt;
     int _tuple_id;
     int _nb_comp;
     int _nb_tuple;
   };
 
-  class MEDCOUPLING_EXPORT DataArrayIntTuple
+  template<class T>
+  class DataArrayTuple
   {
   public:
-     DataArrayIntTuple(int *pt, int nbOfComp);
-     std::string repr() const;
-     int getNumberOfCompo() const { return _nb_of_compo; }
-     const int *getConstPointer() const { return  _pt; }
-     int *getPointer() { return _pt; }
-     int intValue() const;
-     DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const;
-  private:
-    int *_pt;
+    MEDCOUPLING_EXPORT DataArrayTuple(T *pt, int nbOfComp);
+    MEDCOUPLING_EXPORT std::string repr() const;
+    MEDCOUPLING_EXPORT int getNumberOfCompo() const { return _nb_of_compo; }
+    MEDCOUPLING_EXPORT const T *getConstPointer() const { return  _pt; }
+    MEDCOUPLING_EXPORT T *getPointer() { return _pt; }
+    MEDCOUPLING_EXPORT typename Traits<T>::ArrayType *buildDA(int nbOfTuples, int nbOfCompo) const;
+  protected:
+    T zeValue() const;
+  protected:
+    T *_pt;
     int _nb_of_compo;
   };
 
-  class MEDCOUPLING_EXPORT DataArrayChar : public DataArrayTemplate<char>
+  class DataArrayDoubleTuple;
+
+  class DataArrayDoubleIterator : public DataArrayIterator<double>
   {
   public:
-     virtual DataArrayChar *buildEmptySpecializedDAChar() const = 0;
-     int getHashCode() const;
-     bool isEqual(const DataArrayChar& other) const;
-     virtual bool isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const;
-     bool isEqualWithoutConsideringStr(const DataArrayChar& other) const;
-     void fillWithZero();
-     std::string repr() const;
-     std::string reprZip() const;
-     DataArrayInt *convertToIntArr() const;
-     DataArrayChar *selectByTupleId(const int *new2OldBg, const int *new2OldEnd) const { return DataArrayTemplate<char>::mySelectByTupleId(new2OldBg,new2OldEnd); }
-     DataArrayChar *selectByTupleId(const DataArrayInt& di) const { return DataArrayTemplate<char>::mySelectByTupleId(di); }
-     DataArrayChar *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const { return DataArrayTemplate<char>::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); }
-     DataArrayChar *keepSelectedComponents(const std::vector<int>& compoIds) const { return DataArrayTemplate<char>::myKeepSelectedComponents(compoIds); }
-     DataArrayChar *selectByTupleIdSafeSlice(int bg, int end2, int step) const { return DataArrayTemplate<char>::mySelectByTupleIdSafeSlice(bg,end2,step); }
-     bool isUniform(char val) const;
-     void meldWith(const DataArrayChar *other);
-     DataArray *selectByTupleRanges(const std::vector<std::pair<int,int> >& ranges) const { return DataArrayTemplate<char>::mySelectByTupleRanges(ranges); }
-     void getTuple(int tupleId, char *res) const { std::copy(_mem.getConstPointerLoc(tupleId*_info_on_compo.size()),_mem.getConstPointerLoc((tupleId+1)*_info_on_compo.size()),res); }
-     DataArrayInt *findIdsEqual(char val) const;
-     DataArrayInt *findIdsNotEqual(char val) const;
-     int findIdSequence(const std::vector<char>& vals) const;
-     int findIdFirstEqualTuple(const std::vector<char>& tupl) const;
-     int findIdFirstEqual(char value) const;
-     int findIdFirstEqual(const std::vector<char>& vals) const;
-     bool presenceOfTuple(const std::vector<char>& tupl) const;
-     bool presenceOfValue(char value) const;
-     bool presenceOfValue(const std::vector<char>& vals) const;
-     DataArrayInt *findIdsInRange(char vmin, char vmax) const;
-     static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2);
-     static DataArrayChar *Aggregate(const std::vector<const DataArrayChar *>& arr);
-     static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2);
-     static DataArrayChar *Meld(const std::vector<const DataArrayChar *>& arr);
-     template<class InputIterator>
-     void insertAtTheEnd(InputIterator first, InputIterator last);
-     void updateTime() const { }
-     MemArray<char>& accessToMemArray() { return _mem; }
-     const MemArray<char>& accessToMemArray() const { return _mem; }
-  public:
-    // void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
-    // void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
-    // bool resizeForUnserialization(const std::vector<int>& tinyInfoI);
-    // void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<std::string>& tinyInfoS);
-  protected:
-    DataArrayChar() { }
+    MEDCOUPLING_EXPORT DataArrayDoubleIterator(DataArrayDouble *da);
+    MEDCOUPLING_EXPORT ~DataArrayDoubleIterator() { }
   };
 
-  class DataArrayByteIterator;
+  class DataArrayDoubleTuple : public DataArrayTuple<double>
+  {
+  public:
+    MEDCOUPLING_EXPORT DataArrayDoubleTuple(double *pt, int nbOfComp);
+    MEDCOUPLING_EXPORT std::string repr() const;
+    MEDCOUPLING_EXPORT double doubleValue() const;
+    MEDCOUPLING_EXPORT DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const;
+  };
 
-  class MEDCOUPLING_EXPORT DataArrayByte : public DataArrayChar
+  class DataArrayFloatTuple;
+
+  class DataArrayFloatIterator : public DataArrayIterator<float>
   {
   public:
-     static DataArrayByte *New();
-     DataArrayChar *buildEmptySpecializedDAChar() const;
-     DataArrayByteIterator *iterator();
-     DataArrayByte *deepCopy() const;
-     DataArrayByte *performCopyOrIncrRef(bool deepCopy) const;
-     DataArrayByte *buildNewEmptyInstance() const { return DataArrayByte::New(); }
-     char byteValue() const;
-     void reprStream(std::ostream& stream) const;
-     void reprZipStream(std::ostream& stream) const;
-     void reprWithoutNameStream(std::ostream& stream) const;
-     void reprZipWithoutNameStream(std::ostream& stream) const;
-     void reprCppStream(const std::string& varName, std::ostream& stream) const;
-     void reprQuickOverview(std::ostream& stream) const;
-     void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const;
-     bool isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const;
-     std::vector<bool> toVectorOfBool() const;
-  private:
-    ~DataArrayByte() { }
-    DataArrayByte() { }
+    MEDCOUPLING_EXPORT DataArrayFloatIterator(DataArrayFloat *da);
+    MEDCOUPLING_EXPORT ~DataArrayFloatIterator() { }
   };
 
-  class DataArrayByteTuple;
+  class DataArrayFloatTuple : public DataArrayTuple<float>
+  {
+  public:
+    MEDCOUPLING_EXPORT DataArrayFloatTuple(float *pt, int nbOfComp);
+    MEDCOUPLING_EXPORT std::string repr() const;
+    MEDCOUPLING_EXPORT float floatValue() const;
+    MEDCOUPLING_EXPORT DataArrayFloat *buildDAFloat(int nbOfTuples, int nbOfCompo) const;
+  };
+  
+  class DataArrayIntIterator : public DataArrayIterator<int>
+  {
+  public:
+    MEDCOUPLING_EXPORT DataArrayIntIterator(DataArrayInt *da);
+    MEDCOUPLING_EXPORT ~DataArrayIntIterator() { }
+  };
+
+  class DataArrayInt32Tuple : public DataArrayTuple<Int32>
+  {
+  public:
+    MEDCOUPLING_EXPORT DataArrayInt32Tuple(int *pt, int nbOfComp);
+    MEDCOUPLING_EXPORT std::string repr() const;
+    MEDCOUPLING_EXPORT int intValue() const;
+    MEDCOUPLING_EXPORT DataArrayInt32 *buildDAInt(int nbOfTuples, int nbOfCompo) const;
+  };
+
+  typedef DataArrayInt32Tuple DataArrayIntTuple;
 
-  class MEDCOUPLING_EXPORT DataArrayByteIterator
+  class DataArrayAsciiCharTuple;
+
+  class DataArrayAsciiCharIterator
   {
   public:
-     DataArrayByteIterator(DataArrayByte *da);
-     ~DataArrayByteIterator();
-     DataArrayByteTuple *nextt();
+    MEDCOUPLING_EXPORT DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
+    MEDCOUPLING_EXPORT ~DataArrayAsciiCharIterator();
+    MEDCOUPLING_EXPORT DataArrayAsciiCharTuple *nextt();
   private:
-    DataArrayByte *_da;
+    DataArrayAsciiChar *_da;
     char *_pt;
     int _tuple_id;
     int _nb_comp;
     int _nb_tuple;
   };
 
-  class MEDCOUPLING_EXPORT DataArrayByteTuple
+  class DataArrayAsciiCharTuple
   {
   public:
-     DataArrayByteTuple(char *pt, int nbOfComp);
-     std::string repr() const;
-     int getNumberOfCompo() const { return _nb_of_compo; }
-     const char *getConstPointer() const { return  _pt; }
-     char *getPointer() { return _pt; }
-     char byteValue() const;
-     DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const;
+    MEDCOUPLING_EXPORT DataArrayAsciiCharTuple(char *pt, int nbOfComp);
+    MEDCOUPLING_EXPORT std::string repr() const;
+    MEDCOUPLING_EXPORT int getNumberOfCompo() const { return _nb_of_compo; }
+    MEDCOUPLING_EXPORT const char *getConstPointer() const { return  _pt; }
+    MEDCOUPLING_EXPORT char *getPointer() { return _pt; }
+    MEDCOUPLING_EXPORT char asciiCharValue() const;
+    MEDCOUPLING_EXPORT DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const;
   private:
     char *_pt;
     int _nb_of_compo;
   };
+  
+  class DataArrayByteTuple;
 
-  class DataArrayAsciiCharIterator;
-
-  class MEDCOUPLING_EXPORT DataArrayAsciiChar : public DataArrayChar
-  {
-  public:
-     static DataArrayAsciiChar *New();
-     static DataArrayAsciiChar *New(const std::string& st);
-     static DataArrayAsciiChar *New(const std::vector<std::string>& vst, char defaultChar);
-     DataArrayChar *buildEmptySpecializedDAChar() const;
-     DataArrayAsciiCharIterator *iterator();
-     DataArrayAsciiChar *deepCopy() const;
-     DataArrayAsciiChar *performCopyOrIncrRef(bool deepCopy) const;
-     DataArrayAsciiChar *buildNewEmptyInstance() const { return DataArrayAsciiChar::New(); }
-     char asciiCharValue() const;
-     void reprStream(std::ostream& stream) const;
-     void reprZipStream(std::ostream& stream) const;
-     void reprWithoutNameStream(std::ostream& stream) const;
-     void reprZipWithoutNameStream(std::ostream& stream) const;
-     void reprCppStream(const std::string& varName, std::ostream& stream) const;
-     void reprQuickOverview(std::ostream& stream) const;
-     void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const;
-     bool isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const;
-  private:
-    ~DataArrayAsciiChar() { }
-    DataArrayAsciiChar() { }
-    DataArrayAsciiChar(const std::string& st);
-    DataArrayAsciiChar(const std::vector<std::string>& vst, char defaultChar);
-  };
-
-  class DataArrayAsciiCharTuple;
-
-  class MEDCOUPLING_EXPORT DataArrayAsciiCharIterator
+  class DataArrayByteIterator
   {
   public:
-     DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
-     ~DataArrayAsciiCharIterator();
-     DataArrayAsciiCharTuple *nextt();
+    MEDCOUPLING_EXPORT DataArrayByteIterator(DataArrayByte *da);
+    MEDCOUPLING_EXPORT ~DataArrayByteIterator();
+    MEDCOUPLING_EXPORT DataArrayByteTuple *nextt();
   private:
-    DataArrayAsciiChar *_da;
+    DataArrayByte *_da;
     char *_pt;
     int _tuple_id;
     int _nb_comp;
     int _nb_tuple;
   };
 
-  class MEDCOUPLING_EXPORT DataArrayAsciiCharTuple
+  class DataArrayByteTuple
   {
   public:
-     DataArrayAsciiCharTuple(char *pt, int nbOfComp);
-     std::string repr() const;
-     int getNumberOfCompo() const { return _nb_of_compo; }
-     const char *getConstPointer() const { return  _pt; }
-     char *getPointer() { return _pt; }
-     char asciiCharValue() const;
-     DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const;
+    MEDCOUPLING_EXPORT DataArrayByteTuple(char *pt, int nbOfComp);
+    MEDCOUPLING_EXPORT std::string repr() const;
+    MEDCOUPLING_EXPORT int getNumberOfCompo() const { return _nb_of_compo; }
+    MEDCOUPLING_EXPORT const char *getConstPointer() const { return  _pt; }
+    MEDCOUPLING_EXPORT char *getPointer() { return _pt; }
+    MEDCOUPLING_EXPORT char byteValue() const;
+    MEDCOUPLING_EXPORT DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const;
   private:
     char *_pt;
     int _nb_of_compo;
@@ -864,50 +966,21 @@ namespace MEDCoupling
         pointer[_nb_of_elem++]=*first++;
       }
   }
-  
-  template<class InputIterator>
-  void DataArrayDouble::insertAtTheEnd(InputIterator first, InputIterator last)
-  {
-    int nbCompo(getNumberOfComponents());
-    if(nbCompo==1)
-      _mem.insertAtTheEnd(first,last);
-    else if(nbCompo==0)
-      {
-        _info_on_compo.resize(1);
-        _mem.insertAtTheEnd(first,last);
-      }
-    else
-      throw INTERP_KERNEL::Exception("DataArrayDouble::insertAtTheEnd : not available for DataArrayDouble with number of components different than 1 !");
-  }
-
-  template<class InputIterator>
-  void DataArrayInt::insertAtTheEnd(InputIterator first, InputIterator last)
-  {
-    int nbCompo(getNumberOfComponents());
-    if(nbCompo==1)
-      _mem.insertAtTheEnd(first,last);
-    else if(nbCompo==0)
-      {
-        _info_on_compo.resize(1);
-        _mem.insertAtTheEnd(first,last);
-      }
-    else
-      throw INTERP_KERNEL::Exception("DataArrayInt::insertAtTheEnd : not available for DataArrayInt with number of components different than 1 !");
-  }
 
+  template<class T>
   template<class InputIterator>
-  void DataArrayChar::insertAtTheEnd(InputIterator first, InputIterator last)
+  void DataArrayTemplate<T>::insertAtTheEnd(InputIterator first, InputIterator last)
   {
-    int nbCompo(getNumberOfComponents());
+    int nbCompo(this->getNumberOfComponents());
     if(nbCompo==1)
-      _mem.insertAtTheEnd(first,last);
+      this->_mem.insertAtTheEnd(first,last);
     else if(nbCompo==0)
       {
-        _info_on_compo.resize(1);
-        _mem.insertAtTheEnd(first,last);
+        this->_info_on_compo.resize(1);
+        this->_mem.insertAtTheEnd(first,last);
       }
     else
-      throw INTERP_KERNEL::Exception("DataArrayChar::insertAtTheEnd : not available for DataArrayChar with number of components different than 1 !");
+      throw INTERP_KERNEL::Exception("DataArrayDouble::insertAtTheEnd : not available for DataArrayDouble with number of components different than 1 !");
   }
 }
 
index 5df4f7150b71637dd40bcf3af923036533ed8d9b..51edbee9696e234dab9e04d8e10d515f7f0c6f33 100644 (file)
@@ -31,6 +31,7 @@
 
 #include <sstream>
 #include <cstdlib>
+#include <numeric>
 #include <algorithm>
 
 namespace MEDCoupling
@@ -480,6 +481,76 @@ namespace MEDCoupling
 
   //////////////////////////////////
 
+  template<class T>
+  DataArrayIterator<T>::DataArrayIterator(typename Traits<T>::ArrayType *da):_da(da),_tuple_id(0),_nb_comp(0),_nb_tuple(0)
+  {
+    if(_da)
+      {
+        _da->incrRef();
+        if(_da->isAllocated())
+          {
+            _nb_comp=da->getNumberOfComponents();
+            _nb_tuple=da->getNumberOfTuples();
+            _pt=da->getPointer();
+          }
+      }
+  }
+  
+  template<class T>
+  DataArrayIterator<T>::~DataArrayIterator()
+  {
+    if(_da)
+      _da->decrRef();
+  }
+
+  template<class T>
+  typename Traits<T>::ArrayTuple *DataArrayIterator<T>::nextt()
+  {
+    if(_tuple_id<_nb_tuple)
+      {
+        _tuple_id++;
+        typename Traits<T>::ArrayTuple *ret=new typename Traits<T>::ArrayTuple(_pt,_nb_comp);
+        _pt+=_nb_comp;
+        return ret;
+      }
+    else
+      return 0;
+  }
+
+  //////////////////////////////////
+
+  template<class T>
+  DataArrayTuple<T>::DataArrayTuple(T *pt, int nbOfComp):_pt(pt),_nb_of_compo(nbOfComp)
+  {
+  }
+  
+  template<class T>
+  T DataArrayTuple<T>::zeValue() const
+  {
+    if(_nb_of_compo==1)
+      return *_pt;
+    throw INTERP_KERNEL::Exception("DataArrayTuple<T>::zeValue : DataArrayTuple instance has not exactly 1 component -> Not possible to convert it into a single value !");
+  }
+  
+  template<class T>
+  typename Traits<T>::ArrayType *DataArrayTuple<T>::buildDA(int nbOfTuples, int nbOfCompo) const
+  {
+    if((_nb_of_compo==nbOfCompo && nbOfTuples==1) || (_nb_of_compo==nbOfTuples && nbOfCompo==1))
+    {
+      typename Traits<T>::ArrayType *ret=Traits<T>::ArrayType::New();
+      ret->useExternalArrayWithRWAccess(_pt,nbOfTuples,nbOfCompo);
+      return ret;
+    }
+  else
+    {
+      std::ostringstream oss; oss << "DataArrayTuple<T>::buildDA : unable to build a requested DataArrayDouble instance with nbofTuple=" << nbOfTuples << " and nbOfCompo=" << nbOfCompo;
+      oss << ".\nBecause the number of elements in this is " << _nb_of_compo << " !";
+      throw INTERP_KERNEL::Exception(oss.str().c_str());
+    }
+  }
+  
+  //////////////////////////////////
+
   template<class T>
   MCAuto< typename Traits<T>::ArrayTypeCh > DataArrayTemplate<T>::NewFromStdVector(const typename std::vector<T>& v)
   {
@@ -588,7 +659,7 @@ namespace MEDCoupling
         std::ostringstream oss; oss << Traits<T>::ArrayTypeName << "::getIJSafe : request for tupleId " << tupleId << " should be in [0," << getNumberOfTuples() << ") !";
         throw INTERP_KERNEL::Exception(oss.str().c_str());
       }
-    if(compoId<0 || compoId>=getNumberOfComponents())
+    if(compoId<0 || compoId>=(int)getNumberOfComponents())
       {
         std::ostringstream oss; oss << Traits<T>::ArrayTypeName << "::getIJSafe : request for compoId " << compoId << " should be in [0," << getNumberOfComponents() << ") !";
         throw INTERP_KERNEL::Exception(oss.str().c_str());
@@ -754,7 +825,7 @@ namespace MEDCoupling
   {
     if(isAllocated())
       {
-        if(nbOfTuple!=getNumberOfTuples() || nbOfCompo!=getNumberOfComponents())
+        if(nbOfTuple!=getNumberOfTuples() || nbOfCompo!=(int)getNumberOfComponents())
           alloc(nbOfTuple,nbOfCompo);
       }
     else
@@ -1065,21 +1136,21 @@ namespace MEDCoupling
           {
             DataArrayTemplate<T> *directRet(const_cast<DataArrayTemplate<T> *>(this));
             directRet->incrRef();
-            MCAuto<DataArrayTemplate<T> > ret(directRet);
-            return DynamicCastSafe<DataArrayTemplate<T>,typename Traits<T>::ArrayTypeCh>(ret);
+            MCAuto<DataArrayTemplate<T> > ret2(directRet);
+            return DynamicCastSafe<DataArrayTemplate<T>,typename Traits<T>::ArrayTypeCh>(ret2);
           }
         else
           {
-            MCAuto<DataArray> ret(selectByTupleIdSafeSlice(a,b,c));
-            return DynamicCastSafe<DataArray,typename Traits<T>::ArrayTypeCh>(ret);
+            MCAuto<DataArray> ret2(selectByTupleIdSafeSlice(a,b,c));
+            return DynamicCastSafe<DataArray,typename Traits<T>::ArrayTypeCh>(ret2);
           }
       }
     const DataArrayPartDefinition *dpd(dynamic_cast<const DataArrayPartDefinition *>(pd));
     if(dpd)
       {
         MCAuto<DataArrayInt> arr(dpd->toDAI());
-        MCAuto<DataArray> ret(selectByTupleIdSafe(arr->begin(),arr->end()));
-        return DynamicCastSafe<DataArray,typename Traits<T>::ArrayTypeCh>(ret);
+        MCAuto<DataArray> ret2(selectByTupleIdSafe(arr->begin(),arr->end()));
+        return DynamicCastSafe<DataArray,typename Traits<T>::ArrayTypeCh>(ret2);
         
       }
     throw INTERP_KERNEL::Exception("DataArrayTemplate<T>::selectPartDef : unrecognized part def !");
@@ -1857,7 +1928,7 @@ namespace MEDCoupling
     checkAllocated();
     a->checkAllocated();
     tuplesSelec->checkAllocated();
-    int nbOfComp=getNumberOfComponents();
+    std::size_t nbOfComp(getNumberOfComponents());
     if(nbOfComp!=a->getNumberOfComponents())
       throw INTERP_KERNEL::Exception("DataArrayTemplate::setPartOfValuesAdv : This and a do not have the same number of components !");
     if(tuplesSelec->getNumberOfComponents()!=2)
@@ -1922,7 +1993,7 @@ namespace MEDCoupling
     checkAllocated();
     a->checkAllocated();
     tuplesSelec->checkAllocated();
-    int nbOfComp(getNumberOfComponents());
+    std::size_t nbOfComp(getNumberOfComponents());
     if(nbOfComp!=a->getNumberOfComponents())
       throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValues : This and a do not have the same number of components !");
     if(tuplesSelec->getNumberOfComponents()!=1)
@@ -1987,7 +2058,7 @@ namespace MEDCoupling
       throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValuesSlice : input DataArray aBase is not a DataArrayDouble !");
     checkAllocated();
     a->checkAllocated();
-    int nbOfComp(getNumberOfComponents());
+    std::size_t nbOfComp(getNumberOfComponents());
     const char msg[]="DataArrayDouble::setContigPartOfSelectedValuesSlice";
     int nbOfTupleToWrite(DataArray::GetNumberOfItemGivenBES(bg,end2,step,msg));
     if(nbOfComp!=a->getNumberOfComponents())
@@ -2252,6 +2323,1078 @@ namespace MEDCoupling
       std::reverse(work,work+nbOfCompo);
     std::reverse(_info_on_compo.begin(),_info_on_compo.end());
   }
+
+  /*!
+   * Assign pointer to one array to a pointer to another appay. Reference counter of
+   * \a arrayToSet is incremented / decremented.
+   *  \param [in] newArray - the pointer to array to assign to \a arrayToSet.
+   *  \param [in,out] arrayToSet - the pointer to array to assign to.
+   */
+  template<class T>
+  void DataArrayTemplate<T>::SetArrayIn(typename Traits<T>::ArrayType *newArray, typename Traits<T>::ArrayType* &arrayToSet)
+  {
+    if(newArray!=arrayToSet)
+      {
+        if(arrayToSet)
+          arrayToSet->decrRef();
+        arrayToSet=newArray;
+        if(arrayToSet)
+          arrayToSet->incrRef();
+      }
+  }
+
+  template<class T>
+  template<class U>
+  MCAuto< typename Traits<U>::ArrayType > DataArrayTemplateClassic<T>::convertToOtherTypeOfArr() const
+  {
+    this->checkAllocated();
+    MCAuto<typename Traits<U>::ArrayType> ret(Traits<U>::ArrayType::New());
+    ret->alloc(this->getNumberOfTuples(),this->getNumberOfComponents());
+    std::size_t nbOfVals(this->getNbOfElems());
+    const T *src(this->begin());
+    U *dest(ret->getPointer());
+    // to make Visual C++ happy : instead of std::size_t nbOfVals=getNbOfElems(); std::copy(src,src+nbOfVals,dest);
+    //for(const T *src=this->begin();src!=this->end();src++,dest++)
+    //  *dest=(int)*src;
+    std::copy(src,src+nbOfVals,dest);
+    ret->copyStringInfoFrom(*this);
+    return ret;
+  }
+  
+  /*!
+   * Creates a new DataArrayDouble and assigns all (textual and numerical) data of \a this
+   * array to the new one.
+   *  \return DataArrayDouble * - the new instance of DataArrayInt.
+   */
+  template<class T>
+  MCAuto<DataArrayDouble> DataArrayTemplateClassic<T>::convertToDblArr() const
+  {
+    return convertToOtherTypeOfArr<double>();
+  }
+
+  /*!
+   * Creates a new DataArrayInt and assigns all (textual and numerical) data of \a this
+   * array to the new one.
+   *  \return DataArrayInt * - the new instance of DataArrayInt.
+   */
+  template<class T>
+  MCAuto<DataArrayInt> DataArrayTemplateClassic<T>::convertToIntArr() const
+  {
+    return convertToOtherTypeOfArr<int>();
+  }
+
+  /*!
+   * Creates a new DataArrayFloat and assigns all (textual and numerical) data of \a this
+   * array to the new one.
+   *  \return DataArrayFloat * - the new instance of DataArrayInt.
+   */
+  template<class T>
+  MCAuto<DataArrayFloat> DataArrayTemplateClassic<T>::convertToFloatArr() const
+  {
+    return convertToOtherTypeOfArr<float>();
+  }
+
+  /*!
+   * Apply a linear function to a given component of \a this array, so that
+   * an array element <em>(x)</em> becomes \f$ a * x + b \f$.
+   *  \param [in] a - the first coefficient of the function.
+   *  \param [in] b - the second coefficient of the function.
+   *  \param [in] compoId - the index of component to modify.
+   *  \throw If \a this is not allocated, or \a compoId is not in [0,\c this->getNumberOfComponents() ).
+   */
+  template<class T>
+  void DataArrayTemplateClassic<T>::applyLin(T a, T b, int compoId)
+  {
+    this->checkAllocated();
+    T *ptr(this->getPointer()+compoId);
+    int nbOfComp(this->getNumberOfComponents()),nbOfTuple(this->getNumberOfTuples());
+    if(compoId<0 || compoId>=nbOfComp)
+      {
+        std::ostringstream oss; oss << "DataArrayDouble::applyLin : The compoId requested (" << compoId << ") is not valid ! Must be in [0," << nbOfComp << ") !";
+        throw INTERP_KERNEL::Exception(oss.str().c_str());
+      }
+    for(int i=0;i<nbOfTuple;i++,ptr+=nbOfComp)
+      *ptr=a*(*ptr)+b;
+    this->declareAsNew();
+  }
+
+  /*!
+   * Apply a linear function to all elements of \a this array, so that
+   * an element _x_ becomes \f$ a * x + b \f$.
+   *  \param [in] a - the first coefficient of the function.
+   *  \param [in] b - the second coefficient of the function.
+   *  \throw If \a this is not allocated.
+   */
+  template<class T>
+  void DataArrayTemplateClassic<T>::applyLin(T a, T b)
+  {
+    this->checkAllocated();
+    T *ptr(this->getPointer());
+    std::size_t nbOfElems(this->getNbOfElems());
+    for(std::size_t i=0;i<nbOfElems;i++,ptr++)
+      *ptr=a*(*ptr)+b;
+    this->declareAsNew();
+  }
+  
+  /*!
+   * Returns a full copy of \a this array except that sign of all elements is reversed.
+   *  \return DataArrayDouble * - the new instance of DataArrayDouble containing the
+   *          same number of tuples and component as \a this array.
+   *          The caller is to delete this result array using decrRef() as it is no more
+   *          needed.
+   *  \throw If \a this is not allocated.
+   */
+  template<class T>
+  typename Traits<T>::ArrayType *DataArrayTemplateClassic<T>::negate() const
+  {
+    this->checkAllocated();
+    MCAuto<typename Traits<T>::ArrayType> newArr(Traits<T>::ArrayType::New());
+    int nbOfTuples(this->getNumberOfTuples()),nbOfComp(this->getNumberOfComponents());
+    newArr->alloc(nbOfTuples,nbOfComp);
+    const T *cptr(this->begin());
+    std::transform(cptr,cptr+nbOfTuples*nbOfComp,newArr->getPointer(),std::negate<T>());
+    newArr->copyStringInfoFrom(*this);
+    return newArr.retn();
+  }
+
+  template<class T>
+  template<class FCT>
+  void DataArrayTemplateClassic<T>::somethingEqual(const typename Traits<T>::ArrayType *other)
+  {
+    if(!other)
+      throw INTERP_KERNEL::Exception("DataArray<T>::SomethingEqual : input DataArray<T> instance is NULL !");
+    const char *msg="Nb of tuples mismatch for DataArrayDouble::multiplyEqual !";
+    this->checkAllocated();
+    other->checkAllocated();
+    int nbOfTuple(this->getNumberOfTuples()),nbOfTuple2(other->getNumberOfTuples());
+    int nbOfComp(this->getNumberOfComponents()),nbOfComp2(other->getNumberOfComponents());
+    if(nbOfTuple==nbOfTuple2)
+      {
+        if(nbOfComp==nbOfComp2)
+          {
+            std::transform(this->begin(),this->end(),other->begin(),this->getPointer(),FCT());
+          }
+        else if(nbOfComp2==1)
+          {
+            T *ptr(this->getPointer());
+            const T *ptrc(other->begin());
+            for(int i=0;i<nbOfTuple;i++)
+              std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptr+i*nbOfComp,std::bind2nd(FCT(),*ptrc++));
+          }
+        else
+          throw INTERP_KERNEL::Exception(msg);
+      }
+    else if(nbOfTuple2==1)
+      {
+        if(nbOfComp2==nbOfComp)
+          {
+            T *ptr(this->getPointer());
+            const T *ptrc(other->begin());
+            for(int i=0;i<nbOfTuple;i++)
+              std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptrc,ptr+i*nbOfComp,FCT());
+          }
+        else
+          throw INTERP_KERNEL::Exception(msg);
+      }
+    else
+      throw INTERP_KERNEL::Exception(msg);
+    this->declareAsNew();
+  }
+  
+  /*!
+   * Adds values of another DataArrayDouble to values of \a this one. There are 3
+   * valid cases.
+   * 1.  The arrays have same number of tuples and components. Then each value of
+   *   \a other array is added to the corresponding value of \a this array, i.e.:
+   *   _a_ [ i, j ] += _other_ [ i, j ].
+   * 2.  The arrays have same number of tuples and \a other array has one component. Then
+   *   _a_ [ i, j ] += _other_ [ i, 0 ].
+   * 3.  The arrays have same number of components and \a other array has one tuple. Then
+   *   _a_ [ i, j ] += _a2_ [ 0, j ].
+   *
+   *  \param [in] other - an array to add to \a this one.
+   *  \throw If \a other is NULL.
+   *  \throw If \a this->getNumberOfTuples() != \a other->getNumberOfTuples() and
+   *         \a this->getNumberOfComponents() != \a other->getNumberOfComponents() and
+   *         \a other has number of both tuples and components not equal to 1.
+   */
+  template<class T>
+  void DataArrayTemplateClassic<T>::addEqual(const typename Traits<T>::ArrayType *other)
+  {
+    this->somethingEqual< std::plus<T> >(other);
+  }
+
+  /*!
+   * Subtract values of another DataArrayDouble from values of \a this one. There are 3
+   * valid cases.
+   * 1.  The arrays have same number of tuples and components. Then each value of
+   *   \a other array is subtracted from the corresponding value of \a this array, i.e.:
+   *   _a_ [ i, j ] -= _other_ [ i, j ].
+   * 2.  The arrays have same number of tuples and \a other array has one component. Then
+   *   _a_ [ i, j ] -= _other_ [ i, 0 ].
+   * 3.  The arrays have same number of components and \a other array has one tuple. Then
+   *   _a_ [ i, j ] -= _a2_ [ 0, j ].
+   *
+   *  \param [in] other - an array to subtract from \a this one.
+   *  \throw If \a other is NULL.
+   *  \throw If \a this->getNumberOfTuples() != \a other->getNumberOfTuples() and
+   *         \a this->getNumberOfComponents() != \a other->getNumberOfComponents() and
+   *         \a other has number of both tuples and components not equal to 1.
+   */
+  template<class T>
+  void DataArrayTemplateClassic<T>::substractEqual(const typename Traits<T>::ArrayType *other)
+  {
+    this->somethingEqual< std::minus<T> >(other);
+  }
+  
+  /*!
+   * Multiply values of another DataArrayDouble to values of \a this one. There are 3
+   * valid cases.
+   * 1.  The arrays have same number of tuples and components. Then each value of
+   *   \a other array is multiplied to the corresponding value of \a this array, i.e.
+   *   _this_ [ i, j ] *= _other_ [ i, j ].
+   * 2.  The arrays have same number of tuples and \a other array has one component. Then
+   *   _this_ [ i, j ] *= _other_ [ i, 0 ].
+   * 3.  The arrays have same number of components and \a other array has one tuple. Then
+   *   _this_ [ i, j ] *= _a2_ [ 0, j ].
+   *
+   *  \param [in] other - an array to multiply to \a this one.
+   *  \throw If \a other is NULL.
+   *  \throw If \a this->getNumberOfTuples() != \a other->getNumberOfTuples() and
+   *         \a this->getNumberOfComponents() != \a other->getNumberOfComponents() and
+   *         \a other has number of both tuples and components not equal to 1.
+   */
+  template<class T>
+  void DataArrayTemplateClassic<T>::multiplyEqual(const typename Traits<T>::ArrayType *other)
+  {
+    this->somethingEqual< std::multiplies<T> >(other);
+  }
+
+  /*!
+   * Divide values of \a this array by values of another DataArrayDouble. There are 3
+   * valid cases.
+   * 1.  The arrays have same number of tuples and components. Then each value of
+   *    \a this array is divided by the corresponding value of \a other one, i.e.:
+   *   _a_ [ i, j ] /= _other_ [ i, j ].
+   * 2.  The arrays have same number of tuples and \a other array has one component. Then
+   *   _a_ [ i, j ] /= _other_ [ i, 0 ].
+   * 3.  The arrays have same number of components and \a other array has one tuple. Then
+   *   _a_ [ i, j ] /= _a2_ [ 0, j ].
+   *
+   *  \warning No check of division by zero is performed!
+   *  \param [in] other - an array to divide \a this one by.
+   *  \throw If \a other is NULL.
+   *  \throw If \a this->getNumberOfTuples() != \a other->getNumberOfTuples() and
+   *         \a this->getNumberOfComponents() != \a other->getNumberOfComponents() and
+   *         \a other has number of both tuples and components not equal to 1.
+   */
+  template<class T>
+  void DataArrayTemplateClassic<T>::divideEqual(const typename Traits<T>::ArrayType *other)
+  {
+    this->somethingEqual< std::divides<T> >(other);
+  }
+  
+  template<class T, class FCT>
+  typename Traits<T>::ArrayType *DivSub(const typename Traits<T>::ArrayType *a1, const typename Traits<T>::ArrayType *a2)
+  {
+    if(!a1 || !a2)
+      throw INTERP_KERNEL::Exception("DivSub : input DataArrayDouble instance is NULL !");
+    int nbOfTuple1(a1->getNumberOfTuples()),nbOfTuple2(a2->getNumberOfTuples());
+    int nbOfComp1(a1->getNumberOfComponents()),nbOfComp2(a2->getNumberOfComponents());
+    if(nbOfTuple2==nbOfTuple1)
+      {
+        if(nbOfComp1==nbOfComp2)
+          {
+            MCAuto<typename Traits<T>::ArrayType> ret(Traits<T>::ArrayType::New());
+            ret->alloc(nbOfTuple2,nbOfComp1);
+            std::transform(a1->begin(),a1->end(),a2->begin(),ret->getPointer(),FCT());
+            ret->copyStringInfoFrom(*a1);
+            return ret.retn();
+          }
+        else if(nbOfComp2==1)
+          {
+            MCAuto<typename Traits<T>::ArrayType> ret(Traits<T>::ArrayType::New());
+            ret->alloc(nbOfTuple1,nbOfComp1);
+            const T *a2Ptr(a2->begin()),*a1Ptr(a1->begin());
+            T *res(ret->getPointer());
+            for(int i=0;i<nbOfTuple1;i++)
+              res=std::transform(a1Ptr+i*nbOfComp1,a1Ptr+(i+1)*nbOfComp1,res,std::bind2nd(FCT(),a2Ptr[i]));
+            ret->copyStringInfoFrom(*a1);
+            return ret.retn();
+          }
+        else
+          {
+            a1->checkNbOfComps(nbOfComp2,"Nb of components mismatch for array Divide !");
+            return 0;
+          }
+      }
+    else if(nbOfTuple2==1)
+      {
+        a1->checkNbOfComps(nbOfComp2,"Nb of components mismatch for array Divide !");
+        MCAuto<typename Traits<T>::ArrayType> ret(Traits<T>::ArrayType::New());
+        ret->alloc(nbOfTuple1,nbOfComp1);
+        const T *a1ptr=a1->begin(),*a2ptr(a2->begin());
+        T *pt(ret->getPointer());
+        for(int i=0;i<nbOfTuple1;i++)
+          pt=std::transform(a1ptr+i*nbOfComp1,a1ptr+(i+1)*nbOfComp1,a2ptr,pt,FCT());
+        ret->copyStringInfoFrom(*a1);
+        return ret.retn();
+      }
+    else
+      {
+        a1->checkNbOfTuples(nbOfTuple2,"Nb of tuples mismatch for array Divide !");//will always throw an exception
+        return 0;
+      }
+  }
+  
+  /*!
+   * Returns a new DataArrayDouble that is a subtraction of two given arrays. There are 3
+   * valid cases.
+   * 1.  The arrays have same number of tuples and components. Then each value of
+   *   the result array (_a_) is a subtraction of the corresponding values of \a a1 and
+   *   \a a2, i.e.: _a_ [ i, j ] = _a1_ [ i, j ] - _a2_ [ i, j ].
+   * 2.  The arrays have same number of tuples and one array, say _a2_, has one
+   *   component. Then
+   *   _a_ [ i, j ] = _a1_ [ i, j ] - _a2_ [ i, 0 ].
+   * 3.  The arrays have same number of components and one array, say _a2_, has one
+   *   tuple. Then
+   *   _a_ [ i, j ] = _a1_ [ i, j ] - _a2_ [ 0, j ].
+   *
+   * Info on components is copied either from the first array (in the first case) or from
+   * the array with maximal number of elements (getNbOfElems()).
+   *  \param [in] a1 - an array to subtract from.
+   *  \param [in] a2 - an array to subtract.
+   *  \return DataArrayDouble * - the new instance of DataArrayDouble.
+   *          The caller is to delete this result array using decrRef() as it is no more
+   *          needed.
+   *  \throw If either \a a1 or \a a2 is NULL.
+   *  \throw If \a a1->getNumberOfTuples() != \a a2->getNumberOfTuples() and
+   *         \a a1->getNumberOfComponents() != \a a2->getNumberOfComponents() and
+   *         none of them has number of tuples or components equal to 1.
+   */
+  template<class T>
+  typename Traits<T>::ArrayType *DataArrayTemplateClassic<T>::Substract(const typename Traits<T>::ArrayType *a1, const typename Traits<T>::ArrayType *a2)
+  {
+    return DivSub< T,std::minus<T> >(a1,a2);
+  }
+  
+  /*!
+   * Returns a new DataArrayDouble that is a division of two given arrays. There are 3
+   * valid cases.
+   * 1.  The arrays have same number of tuples and components. Then each value of
+   *   the result array (_a_) is a division of the corresponding values of \a a1 and
+   *   \a a2, i.e.: _a_ [ i, j ] = _a1_ [ i, j ] / _a2_ [ i, j ].
+   * 2.  The arrays have same number of tuples and one array, say _a2_, has one
+   *   component. Then
+   *   _a_ [ i, j ] = _a1_ [ i, j ] / _a2_ [ i, 0 ].
+   * 3.  The arrays have same number of components and one array, say _a2_, has one
+   *   tuple. Then
+   *   _a_ [ i, j ] = _a1_ [ i, j ] / _a2_ [ 0, j ].
+   *
+   * Info on components is copied either from the first array (in the first case) or from
+   * the array with maximal number of elements (getNbOfElems()).
+   *  \warning No check of division by zero is performed!
+   *  \param [in] a1 - a numerator array.
+   *  \param [in] a2 - a denominator array.
+   *  \return DataArrayDouble * - the new instance of DataArrayDouble.
+   *          The caller is to delete this result array using decrRef() as it is no more
+   *          needed.
+   *  \throw If either \a a1 or \a a2 is NULL.
+   *  \throw If \a a1->getNumberOfTuples() != \a a2->getNumberOfTuples() and
+   *         \a a1->getNumberOfComponents() != \a a2->getNumberOfComponents() and
+   *         none of them has number of tuples or components equal to 1.
+   */
+  template<class T>
+  typename Traits<T>::ArrayType *DataArrayTemplateClassic<T>::Divide(const typename Traits<T>::ArrayType *a1, const typename Traits<T>::ArrayType *a2)
+  {
+    return DivSub< T,std::divides<T> >(a1,a2);
+  }
+
+  template<class T, class FCT>
+  typename Traits<T>::ArrayType *MulAdd(const typename Traits<T>::ArrayType *a1, const typename Traits<T>::ArrayType *a2)
+  {
+    if(!a1 || !a2)
+      throw INTERP_KERNEL::Exception("DataArrayDouble::MulAdd : input DataArrayDouble instance is NULL !");
+    int nbOfTuple(a1->getNumberOfTuples()),nbOfTuple2(a2->getNumberOfTuples());
+    int nbOfComp(a1->getNumberOfComponents()),nbOfComp2(a2->getNumberOfComponents());
+    MCAuto<typename Traits<T>::ArrayType> ret=0;
+    if(nbOfTuple==nbOfTuple2)
+      {
+        if(nbOfComp==nbOfComp2)
+          {
+            ret=Traits<T>::ArrayType::New();
+            ret->alloc(nbOfTuple,nbOfComp);
+            std::transform(a1->begin(),a1->end(),a2->begin(),ret->getPointer(),FCT());
+            ret->copyStringInfoFrom(*a1);
+          }
+        else
+          {
+            int nbOfCompMin,nbOfCompMax;
+            const typename Traits<T>::ArrayType *aMin, *aMax;
+            if(nbOfComp>nbOfComp2)
+              {
+                nbOfCompMin=nbOfComp2; nbOfCompMax=nbOfComp;
+                aMin=a2; aMax=a1;
+              }
+            else
+              {
+                nbOfCompMin=nbOfComp; nbOfCompMax=nbOfComp2;
+                aMin=a1; aMax=a2;
+              }
+            if(nbOfCompMin==1)
+              {
+                ret=Traits<T>::ArrayType::New();
+                ret->alloc(nbOfTuple,nbOfCompMax);
+                const T *aMinPtr(aMin->begin());
+                const T *aMaxPtr(aMax->begin());
+                T *res=ret->getPointer();
+                for(int i=0;i<nbOfTuple;i++)
+                  res=std::transform(aMaxPtr+i*nbOfCompMax,aMaxPtr+(i+1)*nbOfCompMax,res,std::bind2nd(FCT(),aMinPtr[i]));
+                ret->copyStringInfoFrom(*aMax);
+              }
+            else
+              throw INTERP_KERNEL::Exception("Nb of components mismatch for array MulAdd !");
+          }
+      }
+    else if((nbOfTuple==1 && nbOfTuple2>1) || (nbOfTuple>1 && nbOfTuple2==1))
+      {
+        if(nbOfComp==nbOfComp2)
+          {
+            int nbOfTupleMax=std::max(nbOfTuple,nbOfTuple2);
+            const typename Traits<T>::ArrayType *aMin(nbOfTuple>nbOfTuple2?a2:a1);
+            const typename Traits<T>::ArrayType *aMax(nbOfTuple>nbOfTuple2?a1:a2);
+            const T *aMinPtr(aMin->begin()),*aMaxPtr(aMax->begin());
+            ret=Traits<T>::ArrayType::New();
+            ret->alloc(nbOfTupleMax,nbOfComp);
+            T *res(ret->getPointer());
+            for(int i=0;i<nbOfTupleMax;i++)
+              res=std::transform(aMaxPtr+i*nbOfComp,aMaxPtr+(i+1)*nbOfComp,aMinPtr,res,FCT());
+            ret->copyStringInfoFrom(*aMax);
+          }
+        else
+          throw INTERP_KERNEL::Exception("Nb of components mismatch for array MulAdd !");
+      }
+    else
+      throw INTERP_KERNEL::Exception("Nb of tuples mismatch for array MulAdd !");
+    return ret.retn();
+  }
+  
+  /*!
+   * Returns a new DataArrayDouble that is a product of two given arrays. There are 3
+   * valid cases.
+   * 1.  The arrays have same number of tuples and components. Then each value of
+   *   the result array (_a_) is a product of the corresponding values of \a a1 and
+   *   \a a2, i.e. _a_ [ i, j ] = _a1_ [ i, j ] * _a2_ [ i, j ].
+   * 2.  The arrays have same number of tuples and one array, say _a2_, has one
+   *   component. Then
+   *   _a_ [ i, j ] = _a1_ [ i, j ] * _a2_ [ i, 0 ].
+   * 3.  The arrays have same number of components and one array, say _a2_, has one
+   *   tuple. Then
+   *   _a_ [ i, j ] = _a1_ [ i, j ] * _a2_ [ 0, j ].
+   *
+   * Info on components is copied either from the first array (in the first case) or from
+   * the array with maximal number of elements (getNbOfElems()).
+   *  \param [in] a1 - a factor array.
+   *  \param [in] a2 - another factor array.
+   *  \return DataArrayDouble * - the new instance of DataArrayDouble.
+   *          The caller is to delete this result array using decrRef() as it is no more
+   *          needed.
+   *  \throw If either \a a1 or \a a2 is NULL.
+   *  \throw If \a a1->getNumberOfTuples() != \a a2->getNumberOfTuples() and
+   *         \a a1->getNumberOfComponents() != \a a2->getNumberOfComponents() and
+   *         none of them has number of tuples or components equal to 1.
+   */
+  template<class T>
+  typename Traits<T>::ArrayType *DataArrayTemplateClassic<T>::Multiply(const typename Traits<T>::ArrayType *a1, const typename Traits<T>::ArrayType *a2)
+  {
+    return MulAdd< T , std::multiplies<T> >(a1,a2);
+  }
+  
+  /*!
+   * Returns a new DataArrayDouble that is a sum of two given arrays. There are 3
+   * valid cases.
+   * 1.  The arrays have same number of tuples and components. Then each value of
+   *   the result array (_a_) is a sum of the corresponding values of \a a1 and \a a2,
+   *   i.e.: _a_ [ i, j ] = _a1_ [ i, j ] + _a2_ [ i, j ].
+   * 2.  The arrays have same number of tuples and one array, say _a2_, has one
+   *   component. Then
+   *   _a_ [ i, j ] = _a1_ [ i, j ] + _a2_ [ i, 0 ].
+   * 3.  The arrays have same number of components and one array, say _a2_, has one
+   *   tuple. Then
+   *   _a_ [ i, j ] = _a1_ [ i, j ] + _a2_ [ 0, j ].
+   *
+   * Info on components is copied either from the first array (in the first case) or from
+   * the array with maximal number of elements (getNbOfElems()).
+   *  \param [in] a1 - an array to sum up.
+   *  \param [in] a2 - another array to sum up.
+   *  \return DataArrayDouble * - the new instance of DataArrayDouble.
+   *          The caller is to delete this result array using decrRef() as it is no more
+   *          needed.
+   *  \throw If either \a a1 or \a a2 is NULL.
+   *  \throw If \a a1->getNumberOfTuples() != \a a2->getNumberOfTuples() and
+   *         \a a1->getNumberOfComponents() != \a a2->getNumberOfComponents() and
+   *         none of them has number of tuples or components equal to 1.
+   */
+  template<class T>
+  typename Traits<T>::ArrayType *DataArrayTemplateClassic<T>::Add(const typename Traits<T>::ArrayType *a1, const typename Traits<T>::ArrayType *a2)
+  {
+    return MulAdd< T , std::plus<T> >(a1,a2);
+  }
+  
+  /*!
+   * Returns either a \a deep or \a shallow copy of this array. For more info see
+   * \ref MEDCouplingArrayBasicsCopyDeep and \ref MEDCouplingArrayBasicsCopyShallow.
+   *  \param [in] dCpy - if \a true, a deep copy is returned, else, a shallow one.
+   *  \return DataArrayDouble * - either a new instance of DataArrayDouble (if \a dCpy
+   *          == \a true) or \a this instance (if \a dCpy == \a false).
+   */
+  template<class T>
+  typename Traits<T>::ArrayType *DataArrayTemplateClassic<T>::PerformCopyOrIncrRef(bool dCpy, const typename Traits<T>::ArrayType& self)
+  {
+    if(dCpy)
+      return self.deepCopy();
+    else
+      {
+        self.incrRef();
+        return const_cast<typename Traits<T>::ArrayType *>(&self);
+      }
+  }
+
+  template<class T>
+  struct GreatEqual
+  {
+    GreatEqual(T v):_v(v) { }
+    bool operator()(T v) const { return v>=_v; }
+    T _v;
+  };
+  
+  template<class T>
+  struct GreaterThan
+  {
+    GreaterThan(T v):_v(v) { }
+    bool operator()(T v) const { return v>_v; }
+    T _v;
+  };
+  
+  template<class T>
+  struct LowerEqual
+  {
+    LowerEqual(T v):_v(v) { }
+    bool operator()(T v) const { return v<=_v; }
+    T _v;
+  };
+  
+  template<class T>
+  struct LowerThan
+  {
+    LowerThan(T v):_v(v) { }
+    bool operator()(T v) const { return v<_v; }
+    T _v;
+  };
+  
+  template<class T>
+  struct InRange
+  {
+    InRange(T a, T b):_a(a),_b(b) { }
+    bool operator()(T v) const { return v>=_a && v<_b; }
+    T _a,_b;
+  };
+
+template<class T>
+struct NotInRange
+{
+  NotInRange(T a, T b):_a(a),_b(b) { }
+  bool operator()(T v) const { return v<_a || v>=_b; }
+  T _a,_b;
+};
+
+  /*!
+   * This method works only on data array with one component. This method returns a newly allocated array storing stored ascendantly of tuple ids in \a this so that this[id]<0.
+   *
+   * \return a newly allocated data array that the caller should deal with.
+   * \sa DataArrayInt::findIdsInRange
+   */
+  template<class T>
+  DataArrayInt *DataArrayTemplateClassic<T>::findIdsStrictlyNegative() const
+  {
+    LowerThan<T> lt((T)0);
+    MCAuto<DataArrayInt> ret(findIdsAdv(lt));
+    return ret.retn();
+  }
+  
+  template<class T>
+  MCAuto<DataArrayInt> DataArrayTemplateClassic<T>::findIdsGreaterOrEqualTo(T val) const
+  {
+    GreatEqual<T> ge(val);
+    return findIdsAdv(ge);
+  }
+  
+  template<class T>
+  MCAuto<DataArrayInt> DataArrayTemplateClassic<T>::findIdsGreaterThan(T val) const
+  {
+    GreaterThan<T> gt(val);
+    return findIdsAdv(gt);
+  }
+  
+  template<class T>
+  MCAuto<DataArrayInt> DataArrayTemplateClassic<T>::findIdsLowerOrEqualTo(T val) const
+  {
+    LowerEqual<T> le(val);
+    return findIdsAdv(le);
+  }
+  
+  template<class T>
+  MCAuto<DataArrayInt> DataArrayTemplateClassic<T>::findIdsLowerThan(T val) const
+  {
+    LowerThan<T> lt(val);
+    return findIdsAdv(lt);
+  }
+
+  /*!
+   * Returns a new DataArrayDouble by aggregating two given arrays, so that (1) the number
+   * of components in the result array is a sum of the number of components of given arrays
+   * and (2) the number of tuples in the result array is same as that of each of given
+   * arrays. In other words the i-th tuple of result array includes all components of
+   * i-th tuples of all given arrays.
+   * Number of tuples in the given arrays must be  the same.
+   *  \param [in] a1 - an array to include in the result array.
+   *  \param [in] a2 - another array to include in the result array.
+   *  \return DataArrayDouble * - the new instance of DataArrayDouble.
+   *          The caller is to delete this result array using decrRef() as it is no more
+   *          needed.
+   *  \throw If both \a a1 and \a a2 are NULL.
+   *  \throw If any given array is not allocated.
+   *  \throw If \a a1->getNumberOfTuples() != \a a2->getNumberOfTuples()
+   */
+  template<class T>
+  typename Traits<T>::ArrayType *DataArrayTemplateClassic<T>::Meld(const typename Traits<T>::ArrayType *a1, const typename Traits<T>::ArrayType *a2)
+  {
+    std::vector<const typename Traits<T>::ArrayType *> arr(2);
+    arr[0]=a1; arr[1]=a2;
+    return Meld(arr);
+  }
+
+  /*!
+   * Returns a new DataArrayDouble by aggregating all given arrays, so that (1) the number
+   * of components in the result array is a sum of the number of components of given arrays
+   * and (2) the number of tuples in the result array is same as that of each of given
+   * arrays. In other words the i-th tuple of result array includes all components of
+   * i-th tuples of all given arrays.
+   * Number of tuples in the given arrays must be  the same.
+   *  \param [in] arr - a sequence of arrays to include in the result array.
+   *  \return DataArrayDouble * - the new instance of DataArrayDouble.
+   *          The caller is to delete this result array using decrRef() as it is no more
+   *          needed.
+   *  \throw If all arrays within \a arr are NULL.
+   *  \throw If any given array is not allocated.
+   *  \throw If getNumberOfTuples() of arrays within \a arr is different.
+   */
+  template<class T>
+  typename Traits<T>::ArrayType *DataArrayTemplateClassic<T>::Meld(const std::vector<const typename Traits<T>::ArrayType *>& arr)
+  {
+    std::vector<const typename Traits<T>::ArrayType *> a;
+    for(typename std::vector<const typename Traits<T>::ArrayType *>::const_iterator it4=arr.begin();it4!=arr.end();it4++)
+      if(*it4)
+        a.push_back(*it4);
+    if(a.empty())
+      throw INTERP_KERNEL::Exception("DataArrayDouble::Meld : input list must contain at least one NON EMPTY DataArrayDouble !");
+    typename std::vector<const typename Traits<T>::ArrayType *>::const_iterator it;
+    for(it=a.begin();it!=a.end();it++)
+      (*it)->checkAllocated();
+    it=a.begin();
+    int nbOfTuples((*it)->getNumberOfTuples());
+    std::vector<int> nbc(a.size());
+    std::vector<const T *> pts(a.size());
+    nbc[0]=(*it)->getNumberOfComponents();
+    pts[0]=(*it++)->getConstPointer();
+    for(int i=1;it!=a.end();it++,i++)
+      {
+        if(nbOfTuples!=(*it)->getNumberOfTuples())
+          throw INTERP_KERNEL::Exception("DataArrayDouble::Meld : mismatch of number of tuples !");
+        nbc[i]=(*it)->getNumberOfComponents();
+        pts[i]=(*it)->getConstPointer();
+      }
+    int totalNbOfComp=std::accumulate(nbc.begin(),nbc.end(),0);
+    typename Traits<T>::ArrayType *ret(Traits<T>::ArrayType::New());
+    ret->alloc(nbOfTuples,totalNbOfComp);
+    T *retPtr(ret->getPointer());
+    for(int i=0;i<nbOfTuples;i++)
+      for(int j=0;j<(int)a.size();j++)
+        {
+          retPtr=std::copy(pts[j],pts[j]+nbc[j],retPtr);
+          pts[j]+=nbc[j];
+        }
+    int k=0;
+    for(int i=0;i<(int)a.size();i++)
+      for(int j=0;j<nbc[i];j++,k++)
+        ret->setInfoOnComponent(k,a[i]->getInfoOnComponent(j));
+    return ret;
+  }
+
+  /*!
+   * Returns a new DataArrayDouble holding the same values as \a this array but differently
+   * arranged in memory. If \a this array holds 2 components of 3 values:
+   * \f$ x_0,x_1,x_2,y_0,y_1,y_2 \f$, then the result array holds these values arranged
+   * as follows: \f$ x_0,y_0,x_1,y_1,x_2,y_2 \f$.
+   *  \warning Do not confuse this method with transpose()!
+   *  \return DataArrayDouble * - the new instance of DataArrayDouble that the caller
+   *          is to delete using decrRef() as it is no more needed.
+   *  \throw If \a this is not allocated.
+   */
+  template<class T>
+  typename Traits<T>::ArrayType *DataArrayTemplateClassic<T>::fromNoInterlace() const
+  {
+    if(this->_mem.isNull())
+      throw INTERP_KERNEL::Exception("DataArrayDouble::fromNoInterlace : Not defined array !");
+    T *tab(this->_mem.fromNoInterlace(this->getNumberOfComponents()));
+    MCAuto<typename Traits<T>::ArrayType> ret(Traits<T>::ArrayType::New());
+    ret->useArray(tab,true,C_DEALLOC,this->getNumberOfTuples(),this->getNumberOfComponents());
+    return ret.retn();
+  }
+
+  /*!
+   * Returns a new DataArrayDouble holding the same values as \a this array but differently
+   * arranged in memory. If \a this array holds 2 components of 3 values:
+   * \f$ x_0,y_0,x_1,y_1,x_2,y_2 \f$, then the result array holds these values arranged
+   * as follows: \f$ x_0,x_1,x_2,y_0,y_1,y_2 \f$.
+   *  \warning Do not confuse this method with transpose()!
+   *  \return DataArrayDouble * - the new instance of DataArrayDouble that the caller
+   *          is to delete using decrRef() as it is no more needed.
+   *  \throw If \a this is not allocated.
+   */
+  template<class T>
+  typename Traits<T>::ArrayType *DataArrayTemplateClassic<T>::toNoInterlace() const
+  {
+    if(this->_mem.isNull())
+      throw INTERP_KERNEL::Exception("DataArrayDouble::toNoInterlace : Not defined array !");
+    T *tab(this->_mem.toNoInterlace(this->getNumberOfComponents()));
+    MCAuto<typename Traits<T>::ArrayType> ret(Traits<T>::ArrayType::New());
+    ret->useArray(tab,true,C_DEALLOC,this->getNumberOfTuples(),this->getNumberOfComponents());
+    return ret.retn();
+  }
+  
+  /*!
+   * Appends components of another array to components of \a this one, tuple by tuple.
+   * So that the number of tuples of \a this array remains the same and the number of 
+   * components increases.
+   *  \param [in] other - the DataArrayDouble to append to \a this one.
+   *  \throw If \a this is not allocated.
+   *  \throw If \a this and \a other arrays have different number of tuples.
+   *
+   *  \if ENABLE_EXAMPLES
+   *  \ref cpp_mcdataarraydouble_meldwith "Here is a C++ example".
+   *
+   *  \ref py_mcdataarraydouble_meldwith "Here is a Python example".
+   *  \endif
+   */
+  template<class T>
+  void DataArrayTemplateClassic<T>::meldWith(const typename Traits<T>::ArrayType *other)
+  {
+    this->checkAllocated();
+    other->checkAllocated();
+    int nbOfTuples(this->getNumberOfTuples());
+    if(nbOfTuples!=other->getNumberOfTuples())
+      throw INTERP_KERNEL::Exception("DataArrayDouble::meldWith : mismatch of number of tuples !");
+    int nbOfComp1(this->getNumberOfComponents()),nbOfComp2(other->getNumberOfComponents());
+    T *newArr=(T *)malloc((nbOfTuples*(nbOfComp1+nbOfComp2))*sizeof(T));
+    T *w=newArr;
+    const T *inp1(this->begin()),*inp2(other->begin());
+    for(int i=0;i<nbOfTuples;i++,inp1+=nbOfComp1,inp2+=nbOfComp2)
+      {
+        w=std::copy(inp1,inp1+nbOfComp1,w);
+        w=std::copy(inp2,inp2+nbOfComp2,w);
+      }
+    this->useArray(newArr,true,C_DEALLOC,nbOfTuples,nbOfComp1+nbOfComp2);
+    std::vector<int> compIds(nbOfComp2);
+    for(int i=0;i<nbOfComp2;i++)
+      compIds[i]=nbOfComp1+i;
+    this->copyPartOfStringInfoFrom2(compIds,*other);
+  }
+
+  /*!
+   * 
+   * \param [in] nbTimes specifies the nb of times each tuples in \a this will be duplicated contiguouly in returned DataArrayDouble instance.
+   *             \a nbTimes  should be at least equal to 1.
+   * \return a newly allocated DataArrayDouble having one component and number of tuples equal to \a nbTimes * \c this->getNumberOfTuples.
+   * \throw if \a this is not allocated or if \a this has not number of components set to one or if \a nbTimes is lower than 1.
+   */
+  template<class T>
+  typename Traits<T>::ArrayType *DataArrayTemplateClassic<T>::duplicateEachTupleNTimes(int nbTimes) const
+  {
+    this->checkAllocated();
+    if(this->getNumberOfComponents()!=1)
+      throw INTERP_KERNEL::Exception("DataArrayDouble::duplicateEachTupleNTimes : this should have only one component !");
+    if(nbTimes<1)
+      throw INTERP_KERNEL::Exception("DataArrayDouble::duplicateEachTupleNTimes : nb times should be >= 1 !");
+    int nbTuples(this->getNumberOfTuples());
+    const T *inPtr(this->begin());
+    MCAuto<typename Traits<T>::ArrayType> ret(Traits<T>::ArrayType::New()); ret->alloc(nbTimes*nbTuples,1);
+    T *retPtr(ret->getPointer());
+    for(int i=0;i<nbTuples;i++,inPtr++)
+      {
+        T val(*inPtr);
+        for(int j=0;j<nbTimes;j++,retPtr++)
+          *retPtr=val;
+      }
+    ret->copyStringInfoFrom(*this);
+    return ret.retn();
+  }
+  
+  template<class T>
+  void DataArrayTemplateClassic<T>::aggregate(const typename Traits<T>::ArrayType *other)
+  {
+    if(!other)
+      throw INTERP_KERNEL::Exception("DataArrayDouble::aggregate : null pointer !");
+    if(this->getNumberOfComponents()!=other->getNumberOfComponents())
+      throw INTERP_KERNEL::Exception("DataArrayDouble::aggregate : mismatch number of components !");
+    this->_mem.insertAtTheEnd(other->begin(),other->end());
+  }
+
+  /*!
+   * Converts every value of \a this array to its absolute value.
+   * \b WARNING this method is non const. If a new DataArrayDouble instance should be built containing the result of abs DataArrayDouble::computeAbs
+   * should be called instead.
+   *
+   * \throw If \a this is not allocated.
+   * \sa DataArrayDouble::computeAbs
+   */
+  template<class T>
+  void DataArrayTemplateClassic<T>::abs()
+  {
+    this->checkAllocated();
+    T *ptr(this->getPointer());
+    std::size_t nbOfElems(this->getNbOfElems());
+    std::transform(ptr,ptr+nbOfElems,ptr,std::ptr_fun<T,T>(std::abs));
+    this->declareAsNew();
+  }
+
+  /*!
+   * This method builds a new instance of \a this object containing the result of std::abs applied of all elements in \a this.
+   * This method is a const method (that do not change any values in \a this) contrary to  DataArrayDouble::abs method.
+   *
+   * \return DataArrayDouble * - the new instance of DataArrayDouble containing the
+   *         same number of tuples and component as \a this array.
+   *         The caller is to delete this result array using decrRef() as it is no more
+   *         needed.
+   * \throw If \a this is not allocated.
+   * \sa DataArrayDouble::abs
+   */
+  template<class T>
+  typename Traits<T>::ArrayType *DataArrayTemplateClassic<T>::computeAbs() const
+  {
+    this->checkAllocated();
+    MCAuto<typename Traits<T>::ArrayType> newArr(Traits<T>::ArrayType::New());
+    int nbOfTuples(this->getNumberOfTuples());
+    int nbOfComp(this->getNumberOfComponents());
+    newArr->alloc(nbOfTuples,nbOfComp);
+    std::transform(this->begin(),this->end(),newArr->getPointer(),std::ptr_fun<T,T>(std::abs));
+    newArr->copyStringInfoFrom(*this);
+    return newArr.retn();
+  }
+
+  /*!
+   * Returns either a \a deep or \a shallow copy of this array. For more info see
+   * \ref MEDCouplingArrayBasicsCopyDeep and \ref MEDCouplingArrayBasicsCopyShallow.
+   *  \param [in] dCpy - if \a true, a deep copy is returned, else, a shallow one.
+   *  \return DataArrayDouble * - either a new instance of DataArrayDouble (if \a dCpy
+   *          == \a true) or \a this instance (if \a dCpy == \a false).
+   */
+  template<class T>
+  typename Traits<T>::ArrayType *DataArrayTemplateClassic<T>::performCopyOrIncrRef(bool dCpy) const
+  {
+    const typename Traits<T>::ArrayType *thisC(static_cast<const typename Traits<T>::ArrayType *>(this));
+    return DataArrayTemplateClassic<T>::PerformCopyOrIncrRef(dCpy,*thisC);
+  }
+  
+  /*!
+   * Checks if all values in \a this array are equal to \a val at precision \a eps.
+   *  \param [in] val - value to check equality of array values to.
+   *  \param [in] eps - precision to check the equality.
+   *  \return bool - \a true if all values are in range (_val_ - _eps_; _val_ + _eps_),
+   *                 \a false else.
+   *  \throw If \a this->getNumberOfComponents() != 1
+   *  \throw If \a this is not allocated.
+   */
+  template<class T>
+  bool DataArrayTemplateFP<T>::isUniform(T val, T eps) const
+  {
+    this->checkAllocated();
+    if(this->getNumberOfComponents()!=1)
+      throw INTERP_KERNEL::Exception("DataArrayDouble::isUniform : must be applied on DataArrayDouble with only one component, you can call 'rearrange' method before !");
+    const T *w(this->begin()),*end2(this->end());
+    const T vmin(val-eps),vmax(val+eps);
+    for(;w!=end2;w++)
+      if(*w<vmin || *w>vmax)
+        return false;
+    return true;
+  }
+
+  /*!
+   * Set all values in \a this array so that the i-th element equals to \a init + i
+   * (i starts from zero). To know more on filling arrays see \ref MEDCouplingArrayFill.
+   *  \param [in] init - value to assign to the first element of array.
+   *  \throw If \a this->getNumberOfComponents() != 1
+   *  \throw If \a this is not allocated.
+   */
+  template<class T>
+  void DataArrayTemplateFP<T>::iota(T init)
+  {
+    this->checkAllocated();
+    if(this->getNumberOfComponents()!=1)
+      throw INTERP_KERNEL::Exception("DataArrayDouble::iota : works only for arrays with only one component, you can call 'rearrange' method before !");
+    T *ptr(this->getPointer());
+    int ntuples(this->getNumberOfTuples());
+    for(int i=0;i<ntuples;i++)
+      ptr[i]=init+T(i);
+    this->declareAsNew();
+  }
+
+  /*!
+   * Equivalent to DataArrayInt::isEqual except that if false the reason of
+   * mismatch is given.
+   * 
+   * \param [in] other the instance to be compared with \a this
+   * \param [out] reason In case of inequality returns the reason.
+   * \sa DataArrayInt::isEqual
+   */
+  template<class T>
+  bool DataArrayDiscrete<T>::isEqualIfNotWhy(const DataArrayDiscrete<T>& other, std::string& reason) const
+  {
+    if(!this->areInfoEqualsIfNotWhy(other,reason))
+      return false;
+    return this->_mem.isEqual(other._mem,0,reason);
+  }
+
+  /*!
+   * Checks if \a this and another DataArrayInt are fully equal. For more info see
+   * \ref MEDCouplingArrayBasicsCompare.
+   *  \param [in] other - an instance of DataArrayInt to compare with \a this one.
+   *  \return bool - \a true if the two arrays are equal, \a false else.
+   */
+  template<class T>
+  bool DataArrayDiscrete<T>::isEqual(const DataArrayDiscrete<T>& other) const
+  {
+    std::string tmp;
+    return isEqualIfNotWhy(other,tmp);
+  }
+
+  /*!
+   * Checks if values of \a this and another DataArrayInt are equal. For more info see
+   * \ref MEDCouplingArrayBasicsCompare.
+   *  \param [in] other - an instance of DataArrayInt to compare with \a this one.
+   *  \return bool - \a true if the values of two arrays are equal, \a false else.
+   */
+  template<class T>
+  bool DataArrayDiscrete<T>::isEqualWithoutConsideringStr(const DataArrayDiscrete<T>& other) const
+  {
+    std::string tmp;
+    return this->_mem.isEqual(other._mem,0,tmp);
+  }
+
+  /*!
+   * Checks if values of \a this and another DataArrayInt are equal. Comparison is
+   * performed on sorted value sequences.
+   * For more info see\ref MEDCouplingArrayBasicsCompare.
+   *  \param [in] other - an instance of DataArrayInt to compare with \a this one.
+   *  \return bool - \a true if the sorted values of two arrays are equal, \a false else.
+   */
+  template<class T>
+  bool DataArrayDiscrete<T>::isEqualWithoutConsideringStrAndOrder(const typename Traits<T>::ArrayType& other) const
+  {
+    MCAuto<DataArrayInt> a(static_cast<const typename Traits<T>::ArrayType *>(this)->deepCopy()),b(other.deepCopy());
+    a->sort();
+    b->sort();
+    return a->isEqualWithoutConsideringStr(*b);
+  }
+  
+  template<class T>
+  template<class ALG>
+  void DataArrayDiscrete<T>::switchOnTupleAlg(T val, std::vector<bool>& vec, ALG algo) const
+  {
+    this->checkAllocated();
+    if(this->getNumberOfComponents()!=1)
+      throw INTERP_KERNEL::Exception("DataArrayInt::switchOnTupleEqualTo : number of components of this should be equal to one !");
+    int nbOfTuples(this->getNumberOfTuples());
+    if(nbOfTuples!=(int)vec.size())
+      throw INTERP_KERNEL::Exception("DataArrayInt::switchOnTupleEqualTo : number of tuples of this should be equal to size of input vector of bool !");
+    const T *pt(this->begin());
+    for(int i=0;i<nbOfTuples;i++)
+      if(algo(pt[i],val))
+        vec[i]=true;
+  }
+  
+  /*!
+   * This method assumes that \a this has one component and is allocated. This method scans all tuples in \a this and for all tuple equal to \a val
+   * put True to the corresponding entry in \a vec.
+   * \a vec is expected to be with the same size than the number of tuples of \a this.
+   *
+   *  \sa DataArrayInt::switchOnTupleNotEqualTo.
+   */
+  template<class T>
+  void DataArrayDiscrete<T>::switchOnTupleEqualTo(T val, std::vector<bool>& vec) const
+  {
+    switchOnTupleAlg(val,vec,std::equal_to<T>());
+  }
+
+  /*!
+   * This method assumes that \a this has one component and is allocated. This method scans all tuples in \a this and for all tuple different from \a val
+   * put True to the corresponding entry in \a vec.
+   * \a vec is expected to be with the same size than the number of tuples of \a this.
+   * 
+   *  \sa DataArrayInt::switchOnTupleEqualTo.
+   */
+  template<class T>
+  void DataArrayDiscrete<T>::switchOnTupleNotEqualTo(T val, std::vector<bool>& vec) const
+  {
+    switchOnTupleAlg(val,vec,std::not_equal_to<T>());
+  }
+
+  /*!
+   * This method compares content of input vector \a v and \a this.
+   * If for each id in \a this v[id]==True and for all other ids id2 not in \a this v[id2]==False, true is returned.
+   * For performance reasons \a this is expected to be sorted ascendingly. If not an exception will be thrown.
+   *
+   * \param [in] v - the vector of 'flags' to be compared with \a this.
+   *
+   * \throw If \a this is not sorted ascendingly.
+   * \throw If \a this has not exactly one component.
+   * \throw If \a this is not allocated.
+   */
+  template<class T>
+  bool DataArrayDiscreteSigned<T>::isFittingWith(const std::vector<bool>& v) const
+  {
+    this->checkAllocated();
+    if(this->getNumberOfComponents()!=1)
+      throw INTERP_KERNEL::Exception("DataArrayInt::isFittingWith : number of components of this should be equal to one !");
+    const T *w(this->begin()),*end2(this->end());
+    T refVal=-std::numeric_limits<T>::max();
+    int i=0;
+    std::vector<bool>::const_iterator it(v.begin());
+    for(;it!=v.end();it++,i++)
+      {
+        if(*it)
+          {
+            if(w!=end2)
+              {
+                if(*w++==i)
+                  {
+                    if(i>refVal)
+                      refVal=i;
+                    else
+                      {
+                        std::ostringstream oss; oss << "DataArrayInt::isFittingWith : At pos #" << std::distance(this->begin(),w-1) << " this is not sorted ascendingly !";
+                        throw INTERP_KERNEL::Exception(oss.str().c_str());
+                      }
+                  }
+                else
+                  return false;
+              }
+            else
+              return false;
+          }
+      }
+    return w==end2;
+  }
 }
 
 #endif
index 590423fdb2bd6b22bac590cdc9ce7bf5df8a447e..6c90110879617f988f67cefaca60eeddd06a937c 100644 (file)
@@ -453,7 +453,7 @@ DataArrayChar *DataArrayChar::Aggregate(const std::vector<const DataArrayChar *>
   if(a.empty())
     throw INTERP_KERNEL::Exception("DataArrayChar::Aggregate : input list must be NON EMPTY !");
   std::vector<const DataArrayChar *>::const_iterator it=a.begin();
-  int nbOfComp=(*it)->getNumberOfComponents();
+  std::size_t nbOfComp((*it)->getNumberOfComponents());
   int nbt=(*it++)->getNumberOfTuples();
   for(int i=1;it!=a.end();it++,i++)
     {
diff --git a/src/MEDCoupling/MEDCouplingMemArrayFloat.cxx b/src/MEDCoupling/MEDCouplingMemArrayFloat.cxx
new file mode 100644 (file)
index 0000000..08dd53d
--- /dev/null
@@ -0,0 +1,209 @@
+// Copyright (C) 2007-2017  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay (EDF R&D)
+
+#include "MEDCouplingMemArray.txx"
+
+using namespace MEDCoupling;
+
+template class MEDCoupling::MemArray<float>;
+template class MEDCoupling::DataArrayTemplate<float>;
+template class MEDCoupling::DataArrayTemplateClassic<float>;
+template class MEDCoupling::DataArrayTemplateFP<float>;
+template class MEDCoupling::DataArrayIterator<float>;
+
+DataArrayFloat *DataArrayFloat::New()
+{
+  return new DataArrayFloat;
+}
+
+DataArrayFloat *DataArrayFloat::deepCopy() const
+{
+  return new DataArrayFloat(*this);
+}
+
+void DataArrayFloat::reprStream(std::ostream& stream) const
+{
+  stream << "Name of float array : \"" << _name << "\"\n";
+  reprWithoutNameStream(stream);
+}
+
+void DataArrayFloat::reprZipStream(std::ostream& stream) const
+{
+  stream << "Name of float array : \"" << _name << "\"\n";
+  reprZipWithoutNameStream(stream);
+}
+
+void DataArrayFloat::reprZipWithoutNameStream(std::ostream& stream) const
+{
+  DataArray::reprWithoutNameStream(stream);
+  stream.precision(7);
+  _mem.repr(getNumberOfComponents(),stream);
+}
+
+void DataArrayFloat::reprCppStream(const std::string& varName, std::ostream& stream) const
+{
+  int nbTuples(getNumberOfTuples()),nbComp(getNumberOfComponents());
+  const float *data(begin());
+  stream.precision(7);
+  stream << "DataArrayFloat *" << varName << "=DataArrayFloat::New();" << std::endl;
+  if(nbTuples*nbComp>=1)
+    {
+      stream << "const float " << varName << "Data[" << nbTuples*nbComp << "]={";
+      std::copy(data,data+nbTuples*nbComp-1,std::ostream_iterator<float>(stream,","));
+      stream << data[nbTuples*nbComp-1] << "};" << std::endl;
+      stream << varName << "->useArray(" << varName << "Data,false,CPP_DEALLOC," << nbTuples << "," << nbComp << ");" << std::endl;
+    }
+  else
+    stream << varName << "->alloc(" << nbTuples << "," << nbComp << ");" << std::endl;
+  stream << varName << "->setName(\"" << getName() << "\");" << std::endl;
+}
+
+void DataArrayFloat::reprQuickOverview(std::ostream& stream) const
+{
+  static const std::size_t MAX_NB_OF_BYTE_IN_REPR=300;
+  stream << "DataArrayFloat C++ instance at " << this << ". ";
+  if(isAllocated())
+    {
+      int nbOfCompo=(int)_info_on_compo.size();
+      if(nbOfCompo>=1)
+        {
+          int nbOfTuples=getNumberOfTuples();
+          stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl;
+          reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR);
+        }
+      else
+        stream << "Number of components : 0.";
+    }
+  else
+    stream << "*** No data allocated ****";
+}
+
+void DataArrayFloat::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const
+{
+  const float *data(begin());
+  int nbOfTuples(getNumberOfTuples());
+  int nbOfCompo=(int)_info_on_compo.size();
+  std::ostringstream oss2; oss2 << "[";
+  oss2.precision(7);
+  std::string oss2Str(oss2.str());
+  bool isFinished=true;
+  for(int i=0;i<nbOfTuples && isFinished;i++)
+    {
+      if(nbOfCompo>1)
+        {
+          oss2 << "(";
+          for(int j=0;j<nbOfCompo;j++,data++)
+            {
+              oss2 << *data;
+              if(j!=nbOfCompo-1) oss2 << ", ";
+            }
+          oss2 << ")";
+        }
+      else
+        oss2 << *data++;
+      if(i!=nbOfTuples-1) oss2 << ", ";
+      std::string oss3Str(oss2.str());
+      if(oss3Str.length()<maxNbOfByteInRepr)
+        oss2Str=oss3Str;
+      else
+        isFinished=false;
+    }
+  stream << oss2Str;
+  if(!isFinished)
+    stream << "... ";
+  stream << "]";
+}
+
+std::string DataArrayFloat::reprNotTooLong() const
+{
+  std::ostringstream ret;
+  reprNotTooLongStream(ret);
+  return ret.str();
+}
+
+void DataArrayFloat::reprNotTooLongStream(std::ostream& stream) const
+{
+  stream << "Name of float array : \"" << _name << "\"\n";
+  reprNotTooLongWithoutNameStream(stream);
+}
+
+void DataArrayFloat::reprNotTooLongWithoutNameStream(std::ostream& stream) const
+{
+  DataArray::reprWithoutNameStream(stream);
+  stream.precision(7);
+  _mem.reprNotTooLong(getNumberOfComponents(),stream);
+}
+
+bool DataArrayFloat::isEqualIfNotWhy(const DataArrayFloat& other, float prec, std::string& reason) const
+{
+  if(!areInfoEqualsIfNotWhy(other,reason))
+    return false;
+  return _mem.isEqual(other._mem,prec,reason);
+}
+
+bool DataArrayFloat::isEqual(const DataArrayFloat& other, float prec) const
+{
+  std::string tmp;
+  return isEqualIfNotWhy(other,prec,tmp);
+}
+
+bool DataArrayFloat::isEqualWithoutConsideringStr(const DataArrayFloat& other, float prec) const
+{
+  std::string tmp;
+  return _mem.isEqual(other._mem,prec,tmp);
+}
+
+DataArrayFloatIterator *DataArrayFloat::iterator()
+{
+  return new DataArrayFloatIterator(this);
+}
+
+DataArrayFloatIterator::DataArrayFloatIterator(DataArrayFloat *da):DataArrayIterator<float>(da)
+{
+}
+
+DataArrayFloatTuple::DataArrayFloatTuple(float *pt, int nbOfComp):DataArrayTuple<float>(pt,nbOfComp)
+{
+}
+
+std::string DataArrayFloatTuple::repr() const
+{
+  std::ostringstream oss; oss.precision(7); oss << "(";
+  for(int i=0;i<_nb_of_compo-1;i++)
+    oss << _pt[i] << ", ";
+  oss << _pt[_nb_of_compo-1] << ")";
+  return oss.str();
+}
+
+float DataArrayFloatTuple::floatValue() const
+{
+  return this->zeValue();
+}
+
+/*!
+ * This method returns a newly allocated instance the caller should dealed with by a MEDCoupling::DataArrayFloat::decrRef.
+ * This method performs \b no copy of data. The content is only referenced using MEDCoupling::DataArrayFloat::useArray with ownership set to \b false.
+ * This method throws an INTERP_KERNEL::Exception is it is impossible to match sizes of \b this that is too say \b nbOfCompo=this->_nb_of_elem and \bnbOfTuples==1 or
+ * \b nbOfCompo=1 and \bnbOfTuples==this->_nb_of_elem.
+ */
+DataArrayFloat *DataArrayFloatTuple::buildDAFloat(int nbOfTuples, int nbOfCompo) const
+{
+  return this->buildDA(nbOfTuples,nbOfCompo);
+}
index 1f1a79cc4349041dd27e354a407259deca0821e6..e7cf09098fdb49041487c4b3e9ccea89d9a5c681 100644 (file)
@@ -22,6 +22,7 @@
 #define __PARAMEDMEM_MEDCOUPLINGMESH_HXX__
 
 #include "MEDCoupling.hxx"
+#include "MCType.hxx"
 #include "MEDCouplingTimeLabel.hxx"
 #include "MEDCouplingRefCountObject.hxx"
 #include "NormalizedUnstructuredMesh.hxx"
index 981d8dcf19e543e70bbeb36a28591ef05526bbfc..b373b3cfdfc5fea66a5f59a4615f2a9006f8f5c3 100644 (file)
@@ -40,10 +40,10 @@ MEDCouplingPointSet::MEDCouplingPointSet():_coords(0)
 {
 }
 
-MEDCouplingPointSet::MEDCouplingPointSet(const MEDCouplingPointSet& other, bool deepCopy):MEDCouplingMesh(other),_coords(0)
+MEDCouplingPointSet::MEDCouplingPointSet(const MEDCouplingPointSet& other, bool deepCpy):MEDCouplingMesh(other),_coords(0)
 {
   if(other._coords)
-    _coords=other._coords->performCopyOrIncrRef(deepCopy);
+    _coords=other._coords->performCopyOrIncrRef(deepCpy);
 }
 
 MEDCouplingPointSet::~MEDCouplingPointSet()
index 0b8d32c411dc71fdf38a85179a47b1a92ea33ce0..a3ece6f4dd5aa12eb244332b269ac0120cc5fd6e 100644 (file)
@@ -50,7 +50,7 @@ namespace MEDCoupling
   {
   protected:
     MEDCOUPLING_EXPORT MEDCouplingPointSet();
-    MEDCOUPLING_EXPORT MEDCouplingPointSet(const MEDCouplingPointSet& other, bool deepCopy);
+    MEDCOUPLING_EXPORT MEDCouplingPointSet(const MEDCouplingPointSet& other, bool deepCpy);
     MEDCOUPLING_EXPORT ~MEDCouplingPointSet();
   public:
     MEDCOUPLING_EXPORT void updateTime() const;
@@ -129,6 +129,7 @@ namespace MEDCoupling
     MEDCOUPLING_EXPORT virtual void renumberNodes(const int *newNodeNumbers, int newNbOfNodes);
     MEDCOUPLING_EXPORT virtual void renumberNodesCenter(const int *newNodeNumbers, int newNbOfNodes);
     MEDCOUPLING_EXPORT virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const = 0;
+    MEDCOUPLING_EXPORT virtual void invertOrientationOfAllCells() = 0;
     MEDCOUPLING_EXPORT virtual void checkFullyDefined() const = 0;
     MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const;
     MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
index c75f7934ad79213aabc0eb24fe86c403f470faec..725c1cf19a17212cac7b6c5e2827276e4f4debef 100644 (file)
@@ -330,7 +330,7 @@ void GlobalDict::clear()
   _my_map.clear();
 }
 
-void GlobalDict::setKeyValue(const std::string& key, const std::string& value)
+void GlobalDict::setKeyValue(const std::string& key, const std::string& val)
 {
   std::map<std::string, std::string>::const_iterator it(_my_map.find(key));
   if(it!=_my_map.end())
@@ -339,12 +339,12 @@ void GlobalDict::setKeyValue(const std::string& key, const std::string& value)
       oss << "GlobalDict::setKeyValue : key \"" << key << "\" already exists !";
       throw INTERP_KERNEL::Exception(oss.str().c_str());
     }
-  _my_map[key]=value;
+  _my_map[key]=val;
 }
 
-void GlobalDict::setKeyValueForce(const std::string& key, const std::string& value)
+void GlobalDict::setKeyValueForce(const std::string& key, const std::string& val)
 {
-  _my_map[key]=value;
+  _my_map[key]=val;
 }
 
 std::string GlobalDict::printSelf() const
index 5130f1a2f00f8eb3b5c205d5eb06a186d2ba6b60..7fdf91f538d0a2dad02af990070961f805d80e71 100644 (file)
@@ -114,8 +114,8 @@ namespace MEDCoupling
     MEDCOUPLING_EXPORT std::vector<std::string> keys() const;
     MEDCOUPLING_EXPORT void erase(const std::string& key);
     MEDCOUPLING_EXPORT void clear();
-    MEDCOUPLING_EXPORT void setKeyValue(const std::string& key, const std::string& value);
-    MEDCOUPLING_EXPORT void setKeyValueForce(const std::string& key, const std::string& value);
+    MEDCOUPLING_EXPORT void setKeyValue(const std::string& key, const std::string& val);
+    MEDCOUPLING_EXPORT void setKeyValueForce(const std::string& key, const std::string& val);
     MEDCOUPLING_EXPORT std::string printSelf() const;
   private:
     GlobalDict() { }
index ffb964e1fa8237f273fdfdff3fa49a9a7f52678a..f270ddf16a098006bdc0723c8e1652094024440a 100644 (file)
@@ -24,7 +24,7 @@
 using namespace MEDCoupling;
 
 MEDCouplingSkyLineArray::MEDCouplingSkyLineArray():
-  _index( DataArrayInt::New() ), _values( DataArrayInt::New() ), _super_index( DataArrayInt::New() )
+  _super_index( DataArrayInt::New() ), _index( DataArrayInt::New() ), _values( DataArrayInt::New() )
 {
 }
 
@@ -76,9 +76,9 @@ MEDCouplingSkyLineArray * MEDCouplingSkyLineArray::BuildFromPolyhedronConn( cons
 
   const int * cP(c->begin()), * cIP(cI->begin());
   int prev = -1;
-  if (c->getNbOfElems() != *(cI->end()-1))
+  if ((int)c->getNbOfElems() != *(cI->end()-1))
     throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::BuildFromDynamicConn: misformatted connectivity (wrong nb of tuples)!");
-  for (int i=0; i < cI->getNbOfElems(); i++)
+  for (std::size_t i=0; i < cI->getNbOfElems(); i++)
     {
       int j = cIP[i];
       if (cIP[i] < prev)
@@ -95,7 +95,7 @@ MEDCouplingSkyLineArray * MEDCouplingSkyLineArray::BuildFromPolyhedronConn( cons
   superIdx.push_back(0);
   idx.push_back(0);
   vals.resize(c->getNbOfElems()); // too much because of the type and the -1, but still better than push_back().
-  for (int i=0; i < cI->getNbOfElems()-1; i++)
+  for (std::size_t i=0; i < cI->getNbOfElems()-1; i++)
     {
       int start = cIP[i]+1, end = cIP[i+1];
       int * work = vals.data() + cnt;
@@ -145,7 +145,7 @@ void MEDCouplingSkyLineArray::convertToPolyhedronConn( MCAuto<DataArrayInt>& c,
   c->alloc(sz, 1);
   int * cVecP(c->getPointer());
 
-  for (int i=0; i < _super_index->getNbOfElems()-1; i++)
+  for ( std::size_t i=0; i < _super_index->getNbOfElems()-1; i++)
      {
        cIVecP[i]= cnt;
        int endId = siP[i+1];
@@ -197,18 +197,18 @@ void MEDCouplingSkyLineArray::set3( DataArrayInt* superIndex, DataArrayInt* inde
 
 DataArrayInt* MEDCouplingSkyLineArray::getSuperIndexArray() const
 {
-  return ((MEDCouplingSkyLineArray*)this)->_super_index;
+  return const_cast<MEDCouplingSkyLineArray*>(this)->_super_index;
 }
 
 
 DataArrayInt* MEDCouplingSkyLineArray::getIndexArray() const
 {
-  return ((MEDCouplingSkyLineArray*)this)->_index;
+  return const_cast<MEDCouplingSkyLineArray*>(this)->_index;
 }
 
 DataArrayInt* MEDCouplingSkyLineArray::getValuesArray() const
 {
-  return ((MEDCouplingSkyLineArray*)this)->_values;
+  return const_cast<MEDCouplingSkyLineArray*>(this)->_values;
 }
 
 void MEDCouplingSkyLineArray::checkSuperIndex(const std::string& func) const
@@ -223,7 +223,7 @@ void MEDCouplingSkyLineArray::checkSuperIndex(const std::string& func) const
 
 void MEDCouplingSkyLineArray::validSuperIndex(const std::string& func, int superIndex) const
 {
-  if(superIndex < 0 || superIndex >= _super_index->getNbOfElems())
+  if(superIndex < 0 || superIndex >= (int)_super_index->getNbOfElems())
     {
       std::ostringstream oss;
       oss << "MEDCouplingSkyLineArray::" << func <<  ": invalid super index!";
@@ -233,7 +233,7 @@ void MEDCouplingSkyLineArray::validSuperIndex(const std::string& func, int super
 
 void MEDCouplingSkyLineArray::validIndex(const std::string& func, int idx) const
 {
-  if(idx < 0 || idx >= _index->getNbOfElems())
+  if(idx < 0 || idx >= (int)_index->getNbOfElems())
     {
       std::ostringstream oss;
       oss << "MEDCouplingSkyLineArray::" << func <<  ": invalid index!";
@@ -245,7 +245,7 @@ void MEDCouplingSkyLineArray::validSuperIndexAndIndex(const std::string& func, i
 {
   validSuperIndex(func, superIndex);
   int idx = _super_index->begin()[superIndex] + index;
-  if(idx < 0 || idx >= _index->getNbOfElems())
+  if(idx < 0 || idx >= (int)_index->getNbOfElems())
     {
       std::ostringstream oss;
       oss << "MEDCouplingSkyLineArray::" << func <<  ": invalid index!";
@@ -315,7 +315,7 @@ std::string MEDCouplingSkyLineArray::simpleRepr() const
  */
 void MEDCouplingSkyLineArray::getSimplePackSafe(const int absolutePackId, std::vector<int> & pack) const
 {
-  if(absolutePackId < 0 || absolutePackId >= _index->getNbOfElems())
+  if(absolutePackId < 0 || absolutePackId >= (int)_index->getNbOfElems())
     throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::getPackSafe: invalid index!");
   const int * iP(_index->begin()), *vP(_values->begin());
   int sz = iP[absolutePackId+1]-iP[absolutePackId];
@@ -328,7 +328,7 @@ void MEDCouplingSkyLineArray::getSimplePackSafe(const int absolutePackId, std::v
  */
 const int * MEDCouplingSkyLineArray::getSimplePackSafePtr(const int absolutePackId, int & packSize) const
 {
-  if(absolutePackId < 0 || absolutePackId >= _index->getNbOfElems())
+  if(absolutePackId < 0 || absolutePackId >= (int)_index->getNbOfElems())
     throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::getPackSafe: invalid index!");
   const int * iP(_index->begin()), *vP(_values->begin());
   packSize = iP[absolutePackId+1]-iP[absolutePackId];
@@ -404,7 +404,7 @@ void MEDCouplingSkyLineArray::deletePack(const int superIdx, const int idx)
     iP[ii] -= (end-start);
 
   // _super_index
-  for(int ii = superIdx+1; ii < _super_index->getNbOfElems(); ii++)
+  for(int ii = superIdx+1; ii < (int)_super_index->getNbOfElems(); ii++)
     (siP[ii])--;
 }
 
@@ -438,7 +438,7 @@ void MEDCouplingSkyLineArray::pushBackPack(const int superIdx, const int * packB
     iP[ii] += sz;
 
   // _super_index
-  for(int ii = superIdx+1; ii < _super_index->getNbOfElems(); ii++)
+  for(int ii = superIdx+1; ii < (int)_super_index->getNbOfElems(); ii++)
     (siP[ii])++;
 }
 
@@ -473,7 +473,7 @@ void MEDCouplingSkyLineArray::replaceSimplePack(const int idx, const int * packB
   copy(packBg, packEnd, _values->getPointer()+start);
 
   // _index
-  for(int ii = idx+1; ii < _index->getNbOfElems(); ii++)
+  for(int ii = idx+1; ii < (int)_index->getNbOfElems(); ii++)
     iP[ii] += deltaSz;
 }
 
@@ -509,6 +509,6 @@ void MEDCouplingSkyLineArray::replacePack(const int superIdx, const int idx, con
   copy(packBg, packEnd, _values->getPointer()+start);
 
   // _index
-  for(int ii = siP[superIdx]+idx+1; ii < _index->getNbOfElems(); ii++)
+  for(int ii = siP[superIdx]+idx+1; ii < (int)_index->getNbOfElems(); ii++)
     iP[ii] += deltaSz;
 }
index ab70da60d66e7f843b9fb011caf275643f9f43d7..665e89082034d168db69f67a3f71ea8f2e2ca7c2 100644 (file)
@@ -33,7 +33,7 @@ MEDCouplingStructuredMesh::MEDCouplingStructuredMesh()
 {
 }
 
-MEDCouplingStructuredMesh::MEDCouplingStructuredMesh(const MEDCouplingStructuredMesh& other, bool deepCopy):MEDCouplingMesh(other)
+MEDCouplingStructuredMesh::MEDCouplingStructuredMesh(const MEDCouplingStructuredMesh& other, bool deepCpy):MEDCouplingMesh(other)
 {
 }
 
@@ -984,8 +984,8 @@ DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivity2D(const int *
   conn->alloc(4*n1*n2,1);
   int *cp(conn->getPointer());
   std::size_t pos(0);
-  for(int j=0;j<n2;j++)
-    for(int i=0;i<n1;i++,pos++)
+  for(std::size_t j=0;j<n2;j++)
+    for(std::size_t i=0;i<n1;i++,pos++)
       {
         cp[4*pos+0]=i+1+j*(n1+1);
         cp[4*pos+1]=i+j*(n1+1);
@@ -1002,9 +1002,9 @@ DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivity3D(const int *
   conn->alloc(8*n1*n2*n3,1);
   int *cp(conn->getPointer());
   std::size_t pos(0);
-  for(int k=0;k<n3;k++)
-    for(int j=0;j<n2;j++)
-      for(int i=0;i<n1;i++,pos++)
+  for(std::size_t k=0;k<n3;k++)
+    for(std::size_t j=0;j<n2;j++)
+      for(std::size_t i=0;i<n1;i++,pos++)
         {
           int tmp=(n1+1)*(n2+1);
           cp[8*pos+0]=i+1+j*(n1+1)+k*tmp;
index 73766fe09d4668e94fef1af5cbd1039e3eed6500..f4ee4fd67213492f7bbe429e05115a8b5f9542aa 100644 (file)
@@ -117,7 +117,7 @@ namespace MEDCoupling
     static int ZipNodeStructure(const int *nodeStBg, const int *nodeStEnd, int zipNodeSt[3]);
   protected:
     MEDCOUPLING_EXPORT MEDCouplingStructuredMesh();
-    MEDCOUPLING_EXPORT MEDCouplingStructuredMesh(const MEDCouplingStructuredMesh& other, bool deepCopy);
+    MEDCOUPLING_EXPORT MEDCouplingStructuredMesh(const MEDCouplingStructuredMesh& other, bool deepCpy);
     MEDCOUPLING_EXPORT ~MEDCouplingStructuredMesh();
   };
 }
index 988048d99dd413564dea1eabb6c9551f4d11836e..246f9a6bf89ef33077c26c6f7cbc54052392c67e 100644 (file)
 using namespace MEDCoupling;
 
 template class MEDCoupling::MEDCouplingTimeDiscretizationTemplate<double>;
+template class MEDCoupling::MEDCouplingTimeDiscretizationTemplate<float>;
+template class MEDCoupling::MEDCouplingTimeDiscretizationSimple<float>;
 template class MEDCoupling::MEDCouplingTimeDiscretizationTemplate<int>;
-
-const char MEDCouplingTimeDiscretizationInt::REPR[]="One time label.";
+template class MEDCoupling::MEDCouplingTimeDiscretizationSimple<int>;
 
 const char MEDCouplingNoTimeLabel::EXCEPTION_MSG[]="MEDCouplingNoTimeLabel::setTime : no time info attached.";
 
@@ -117,73 +118,6 @@ MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::buildNewTimeReprFr
   return ret;
 }
 
-void MEDCouplingTimeDiscretization::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
-{
-  if(_array)
-    {
-      tinyInfo.push_back(_array->getNumberOfTuples());
-      tinyInfo.push_back(_array->getNumberOfComponents());
-    }
-  else
-    {
-      tinyInfo.push_back(-1);
-      tinyInfo.push_back(-1);
-    }
-}
-
-void MEDCouplingTimeDiscretization::resizeForUnserialization(const std::vector<int>& tinyInfoI, std::vector<DataArrayDouble *>& arrays)
-{
-  arrays.resize(1);
-  if(_array!=0)
-    _array->decrRef();
-  DataArrayDouble *arr=0;
-  if(tinyInfoI[0]!=-1 && tinyInfoI[1]!=-1)
-    {
-      arr=DataArrayDouble::New();
-      arr->alloc(tinyInfoI[0],tinyInfoI[1]);
-    }
-  _array=arr;
-  arrays[0]=arr;
-}
-
-void MEDCouplingTimeDiscretization::checkForUnserialization(const std::vector<int>& tinyInfoI, const std::vector<DataArrayDouble *>& arrays)
-{
-  static const char MSG[]="MEDCouplingTimeDiscretization::checkForUnserialization : arrays in input is expected to have size one !";
-  if(arrays.size()!=1)
-    throw INTERP_KERNEL::Exception(MSG);
-  if(_array!=0)
-    _array->decrRef();
-  _array=0;
-  if(tinyInfoI[0]!=-1 && tinyInfoI[1]!=-1)
-    {
-      if(!arrays[0])
-        throw INTERP_KERNEL::Exception(MSG);
-      arrays[0]->checkNbOfTuplesAndComp(tinyInfoI[0],tinyInfoI[1],MSG);
-      _array=arrays[0];
-      _array->incrRef();
-    }
-}
-
-void MEDCouplingTimeDiscretization::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
-{
-  _time_tolerance=tinyInfoD[0];
-  int nbOfCompo=_array->getNumberOfComponents();
-  for(int i=0;i<nbOfCompo;i++)
-    _array->setInfoOnComponent(i,tinyInfoS[i]);
-}
-
-void MEDCouplingTimeDiscretization::getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const
-{
-  tinyInfo.push_back(_time_tolerance);
-}
-
-void MEDCouplingTimeDiscretization::getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const
-{
-  int nbOfCompo=_array->getNumberOfComponents();
-  for(int i=0;i<nbOfCompo;i++)
-    tinyInfo.push_back(_array->getInfoOnComponent(i));
-}
-
 bool MEDCouplingTimeDiscretization::isBefore(const MEDCouplingTimeDiscretization *other) const
 {
   int iteration,order;
@@ -760,20 +694,8 @@ void MEDCouplingTimeKeeper::checkTimePresence(double time, double eps) const
 
 ////////////////////////
 
-MEDCouplingTimeDiscretizationInt::MEDCouplingTimeDiscretizationInt()
-{
-}
-
-MEDCouplingTimeDiscretizationInt::MEDCouplingTimeDiscretizationInt(const MEDCouplingTimeDiscretizationInt& other, bool deepCopy):MEDCouplingTimeDiscretizationTemplate<int>(other,deepCopy),_tk(other._tk)
-{
-}
-
-std::string MEDCouplingTimeDiscretizationInt::getStringRepr() const
+MEDCouplingTimeDiscretizationInt::MEDCouplingTimeDiscretizationInt(const MEDCouplingTimeDiscretizationInt& other, bool deepCopy):MEDCouplingTimeDiscretizationSimple<int>(other,deepCopy)
 {
-  std::ostringstream stream;
-  stream << REPR << " Time is defined by iteration=" << _tk.getIteration() << " order=" << _tk.getOrder() << " and time=" << _tk.getTimeValue() << ".";
-  stream << "\nTime unit is : \"" << _time_unit << "\"";
-  return stream.str();
 }
 
 MEDCouplingTimeDiscretizationInt *MEDCouplingTimeDiscretizationInt::performCopyOrIncrRef(bool deepCopy) const
@@ -831,29 +753,65 @@ bool MEDCouplingTimeDiscretizationInt::isEqualWithoutConsideringStr(const MEDCou
   return _array->isEqualWithoutConsideringStr(*(other->getArray()));
 }
 
-double MEDCouplingTimeDiscretizationInt::getEndTime(int& iteration, int& order) const
+////////////////////////
+
+MEDCouplingTimeDiscretizationFloat::MEDCouplingTimeDiscretizationFloat(const MEDCouplingTimeDiscretizationFloat& other, bool deepCopy):MEDCouplingTimeDiscretizationSimple<float>(other,deepCopy)
 {
-  throw INTERP_KERNEL::Exception("getEndTime : invalid for this type of time discr !");
 }
 
-void MEDCouplingTimeDiscretizationInt::setEndIteration(int it)
+MEDCouplingTimeDiscretizationFloat *MEDCouplingTimeDiscretizationFloat::performCopyOrIncrRef(bool deepCopy) const
 {
-  throw INTERP_KERNEL::Exception("setEndIteration : invalid for this type of time discr !");
+  return new MEDCouplingTimeDiscretizationFloat(*this,deepCopy);
 }
 
-void MEDCouplingTimeDiscretizationInt::setEndOrder(int order)
+MEDCouplingTimeDiscretizationFloat *MEDCouplingTimeDiscretizationFloat::New(TypeOfTimeDiscretization type)
 {
-  throw INTERP_KERNEL::Exception("setEndOrder : invalid for this type of time discr !");
+  switch(type)
+  {
+    case MEDCouplingTimeDiscretizationFloat::DISCRETIZATION:
+      return new MEDCouplingTimeDiscretizationFloat;
+    default:
+      throw INTERP_KERNEL::Exception("Time discretization not implemented yet for intergers !");
+  }
 }
 
-void MEDCouplingTimeDiscretizationInt::setEndTimeValue(double time)
+bool MEDCouplingTimeDiscretizationFloat::isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate<float> *other, float prec, std::string& reason) const
 {
-  throw INTERP_KERNEL::Exception("setEndTimeValue : invalid for this type of time discr !");
+  if(prec!=0)
+    throw INTERP_KERNEL::Exception("isEqualIfNotWhy : only precision equal to 0 supported for int !");
+  if(!other)
+    {
+      reason="Time discretization is NULL.";
+      return false;
+    }
+  const MEDCouplingTimeDiscretizationFloat *otherC(dynamic_cast<const MEDCouplingTimeDiscretizationFloat *>(other));
+  if(!otherC)
+    throw INTERP_KERNEL::Exception("isEqualIfNotWhy : other is not a MEDCouplingTimeDiscretizationFloat !");
+  if(!MEDCouplingTimeDiscretizationTemplate<float>::areStrictlyCompatible(other,reason))
+    return false;
+  if(!_tk.isEqualIfNotWhy(otherC->_tk,_time_tolerance,reason))
+    return false;
+  if(_array==other->getArray())
+    return true;
+  return _array->isEqualIfNotWhy(*other->getArray(),prec,reason);
 }
 
-void MEDCouplingTimeDiscretizationInt::setEndTime(double time, int iteration, int order)
+bool MEDCouplingTimeDiscretizationFloat::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<float> *other, float prec) const
 {
-  throw INTERP_KERNEL::Exception("setEndTime : invalid for this type of time discr !");
+  if(prec!=0)
+    throw INTERP_KERNEL::Exception("MEDCouplingTimeDiscretizationFloat::isEqualWithoutConsideringStr : only precision 0 is supported !");
+  const MEDCouplingTimeDiscretizationFloat *otherC(dynamic_cast<const MEDCouplingTimeDiscretizationFloat *>(other));
+  if(!otherC)
+    throw INTERP_KERNEL::Exception("isEqualWithoutConsideringStr : other is not a MEDCouplingTimeDiscretizationFloat !");
+  std::string tmp;
+  if(!areStrictlyCompatible(other,tmp))
+    return false;
+  std::string reason;
+  if(!_tk.isEqualIfNotWhy(otherC->_tk,_time_tolerance,reason))
+    return false;
+  if(_array==other->getArray())
+    return true;
+  return _array->isEqualWithoutConsideringStr(*(other->getArray()),prec);
 }
 
 ////////////////////////
@@ -870,7 +828,7 @@ std::string MEDCouplingNoTimeLabel::getStringRepr() const
 {
   std::ostringstream stream;
   stream << REPR;
-  stream << "\nTime unit is : \"" << _time_unit << "\"";
+  stream << "\nTime unit is : \"" << getTimeUnit() << "\"";
   return stream.str();
 }
 
@@ -1259,7 +1217,7 @@ std::string MEDCouplingWithTimeStep::getStringRepr() const
 {
   std::ostringstream stream;
   stream << REPR << " Time is defined by iteration=" << _tk.getIteration() << " order=" << _tk.getOrder() << " and time=" << _tk.getTimeValue() << ".";
-  stream << "\nTime unit is : \"" << _time_unit << "\"";
+  stream << "\nTime unit is : \"" << getTimeUnit() << "\"";
   return stream.str();
 }
 
@@ -1270,8 +1228,8 @@ void MEDCouplingWithTimeStep::synchronizeTimeWith(const MEDCouplingMesh *mesh)
   int it=-1,order=-1;
   double val=mesh->getTime(it,order);
   _tk.setAllInfo(val,it,order);
-  std::string tUnit=mesh->getTimeUnit();
-  _time_unit=tUnit;
+  std::string tUnit(mesh->getTimeUnit());
+  setTimeUnit(tUnit);
 }
 
 void MEDCouplingWithTimeStep::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
@@ -1747,7 +1705,7 @@ std::string MEDCouplingConstOnTimeInterval::getStringRepr() const
   std::ostringstream stream;
   stream << REPR << " Time interval is defined by :\niteration_start=" << _start.getIteration() << " order_start=" << _start.getOrder() << " and time_start=" << _start.getTimeValue() << "\n";
   stream << "iteration_end=" << _end.getIteration() << " order_end=" << _end.getOrder() << " and end_time=" << _end.getTimeValue() << "\n";
-  stream << "\nTime unit is : \"" << _time_unit << "\"";
+  stream << "\nTime unit is : \"" << getTimeUnit() << "\"";
   return stream.str();
 }
 
@@ -1760,7 +1718,7 @@ void MEDCouplingConstOnTimeInterval::synchronizeTimeWith(const MEDCouplingMesh *
   _start.setAllInfo(val,it,order);
   _end.setAllInfo(val,it,order);
   std::string tUnit(mesh->getTimeUnit());
-  _time_unit=tUnit;
+  setTimeUnit(tUnit);
 }
 
 MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::performCopyOrIncrRef(bool deepCopy) const
@@ -2132,8 +2090,8 @@ void MEDCouplingTwoTimeSteps::synchronizeTimeWith(const MEDCouplingMesh *mesh)
   double val=mesh->getTime(it,order);
   _start.setAllInfo(val,it,order);
   _end.setAllInfo(val,it,order);
-  std::string tUnit=mesh->getTimeUnit();
-  _time_unit=tUnit;
+  std::string tUnit(mesh->getTimeUnit());
+  setTimeUnit(tUnit);
 }
 
 std::size_t MEDCouplingTwoTimeSteps::getHeapMemorySizeWithoutChildren() const
@@ -2441,7 +2399,7 @@ std::string MEDCouplingLinearTime::getStringRepr() const
   std::ostringstream stream;
   stream << REPR << " Time interval is defined by :\niteration_start=" << _start.getIteration() << " order_start=" << _start.getOrder() << " and time_start=" << _start.getTimeValue() << "\n";
   stream << "iteration_end=" << _end.getIteration() << " order_end=" << _end.getOrder() << " and end_time=" << _end.getTimeValue() << "\n";
-  stream << "Time unit is : \"" << _time_unit << "\"";
+  stream << "Time unit is : \"" << getTimeUnit() << "\"";
   return stream.str();
 }
 
index c75304ab8966ebee8d9adf12745c286828b292ec..f6d877a7539136c7467a9e08faa986cfd0603a76 100644 (file)
@@ -35,24 +35,36 @@ namespace MEDCoupling
   class DataArrayDouble;
   class TimeLabel;
 
+  class TimeHolder
+  {
+  public:
+    MEDCOUPLING_EXPORT std::string getTimeUnit() const { return _time_unit; }
+    MEDCOUPLING_EXPORT void setTimeUnit(const std::string& unit) { _time_unit=unit; }
+    MEDCOUPLING_EXPORT double getTime(int& iteration, int& order) const { return getStartTime(iteration,order); }
+    MEDCOUPLING_EXPORT virtual double getStartTime(int& iteration, int& order) const = 0;
+    void copyTinyAttrFrom(const TimeHolder& other) { _time_unit=other._time_unit; }
+  protected:
+    TimeHolder() { }
+    TimeHolder(const TimeHolder& other):_time_unit(other._time_unit) { }
+    virtual ~TimeHolder() { }
+  private:
+    std::string _time_unit;
+  };
+
   template<class T>
-  class MEDCouplingTimeDiscretizationTemplate : public TimeLabel, public BigMemoryObject
+  class MEDCouplingTimeDiscretizationTemplate : public TimeLabel, public BigMemoryObject, public TimeHolder
   {
   public:
     MEDCOUPLING_EXPORT void updateTime() const;
     MEDCOUPLING_EXPORT virtual void setArray(typename Traits<T>::ArrayType *array, TimeLabel *owner);
     MEDCOUPLING_EXPORT typename Traits<T>::ArrayType *getArray() { return _array; }
     MEDCOUPLING_EXPORT const typename Traits<T>::ArrayType *getArray() const { return _array; }
-    MEDCOUPLING_EXPORT void setTimeUnit(const std::string& unit) { _time_unit=unit; }
-    MEDCOUPLING_EXPORT std::string getTimeUnit() const { return _time_unit; }
     MEDCOUPLING_EXPORT void setTimeTolerance(double val) { _time_tolerance=val; }
     MEDCOUPLING_EXPORT double getTimeTolerance() const { return _time_tolerance; }
-    MEDCOUPLING_EXPORT double getTime(int& iteration, int& order) const { return getStartTime(iteration,order); }
     MEDCOUPLING_EXPORT void setTime(double time, int iteration, int order) { setStartTime(time,iteration,order); }
     MEDCOUPLING_EXPORT void setIteration(int it) { setStartIteration(it); }
     MEDCOUPLING_EXPORT void setOrder(int order) { setStartOrder(order); }
     MEDCOUPLING_EXPORT void setTimeValue(double val) { setStartTimeValue(val); }
-    MEDCOUPLING_EXPORT virtual double getStartTime(int& iteration, int& order) const = 0;
     MEDCOUPLING_EXPORT virtual void setStartIteration(int it) = 0;
     MEDCOUPLING_EXPORT virtual void setStartOrder(int order) = 0;
     MEDCOUPLING_EXPORT virtual void setStartTime(double time, int iteration, int order) = 0;
@@ -87,11 +99,16 @@ namespace MEDCoupling
     MEDCOUPLING_EXPORT virtual bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretizationTemplate<T> *other) const;
     MEDCOUPLING_EXPORT virtual bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate<T> *other) const;
     MEDCOUPLING_EXPORT virtual ~MEDCouplingTimeDiscretizationTemplate();
+    MEDCOUPLING_EXPORT virtual void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
+    MEDCOUPLING_EXPORT virtual void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
+    MEDCOUPLING_EXPORT virtual void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
+    MEDCOUPLING_EXPORT virtual void resizeForUnserialization(const std::vector<int>& tinyInfoI, std::vector<typename Traits<T>::ArrayType *>& arrays);
+    MEDCOUPLING_EXPORT virtual void checkForUnserialization(const std::vector<int>& tinyInfoI, const std::vector<typename Traits<T>::ArrayType *>& arrays);
+    MEDCOUPLING_EXPORT virtual void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
   protected:
     MEDCOUPLING_EXPORT MEDCouplingTimeDiscretizationTemplate();
     MEDCOUPLING_EXPORT MEDCouplingTimeDiscretizationTemplate(const MEDCouplingTimeDiscretizationTemplate<T>& other, bool deepCopy);
   protected:
-    std::string _time_unit;
     double _time_tolerance;
     typename Traits<T>::ArrayType *_array;
   protected:
@@ -150,12 +167,6 @@ namespace MEDCoupling
     MEDCOUPLING_EXPORT virtual void divideEqual(const MEDCouplingTimeDiscretization *other) = 0;
     MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const = 0;
     MEDCOUPLING_EXPORT virtual void powEqual(const MEDCouplingTimeDiscretization *other) = 0;
-    MEDCOUPLING_EXPORT virtual void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
-    MEDCOUPLING_EXPORT virtual void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
-    MEDCOUPLING_EXPORT virtual void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
-    MEDCOUPLING_EXPORT virtual void resizeForUnserialization(const std::vector<int>& tinyInfoI, std::vector<DataArrayDouble *>& arrays);
-    MEDCOUPLING_EXPORT virtual void checkForUnserialization(const std::vector<int>& tinyInfoI, const std::vector<DataArrayDouble *>& arrays);
-    MEDCOUPLING_EXPORT virtual void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
     MEDCOUPLING_EXPORT virtual void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const = 0;
     MEDCOUPLING_EXPORT virtual void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const = 0;
     MEDCOUPLING_EXPORT virtual void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD) = 0;
@@ -199,13 +210,12 @@ namespace MEDCoupling
     MEDCOUPLING_EXPORT virtual void fillFromAnalyticCompo(const DataArrayDouble *loc, int nbOfComp, const std::string& func);
     MEDCOUPLING_EXPORT virtual void fillFromAnalyticNamedCompo(const DataArrayDouble *loc, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func);
   };
-  
-  class MEDCouplingTimeDiscretizationInt : public MEDCouplingTimeDiscretizationTemplate<int>
+
+  template<class T>
+  class MEDCouplingTimeDiscretizationSimple : public MEDCouplingTimeDiscretizationTemplate<T>
   {
   public:
-    MEDCouplingTimeDiscretizationInt();
-    MEDCouplingTimeDiscretizationInt(const MEDCouplingTimeDiscretizationInt& other, bool deepCopy);
-    static MEDCouplingTimeDiscretizationInt *New(TypeOfTimeDiscretization type);
+    std::string getStringRepr() const;
     double getStartTime(int& iteration, int& order) const { return _tk.getAllInfo(iteration,order); }
     void setStartIteration(int it) { _tk.setIteration(it); }
     void setStartOrder(int order) { _tk.setOrder(order); }
@@ -216,16 +226,40 @@ namespace MEDCoupling
     void setEndOrder(int order);
     void setEndTimeValue(double time);
     void setEndTime(double time, int iteration, int order);
-    std::string getStringRepr() const;
     TypeOfTimeDiscretization getEnum() const { return DISCRETIZATION; }
+  protected:
+    MEDCouplingTimeDiscretizationSimple(const MEDCouplingTimeDiscretizationSimple<T>& other, bool deepCopy);
+    MEDCouplingTimeDiscretizationSimple() { }
+  protected:
+    MEDCouplingTimeKeeper _tk;
+  private:
+    MEDCOUPLING_EXPORT static const char REPR[];
+  protected:
+    static const TypeOfTimeDiscretization DISCRETIZATION=ONE_TIME;
+  };
+  
+  class MEDCouplingTimeDiscretizationInt : public MEDCouplingTimeDiscretizationSimple<int>
+  {
+  public:
+    MEDCouplingTimeDiscretizationInt() { }
+    MEDCouplingTimeDiscretizationInt(const MEDCouplingTimeDiscretizationInt& other, bool deepCopy);
+    static MEDCouplingTimeDiscretizationInt *New(TypeOfTimeDiscretization type);
     MEDCouplingTimeDiscretizationInt *performCopyOrIncrRef(bool deepCopy) const;
     bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate<int> *other, int prec, std::string& reason) const;
     bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<int> *other, int prec) const;
+  };
+
+  class MEDCouplingTimeDiscretizationFloat : public MEDCouplingTimeDiscretizationSimple<float>
+  {
+  public:
+    MEDCouplingTimeDiscretizationFloat() { }
+    MEDCouplingTimeDiscretizationFloat(const MEDCouplingTimeDiscretizationFloat& other, bool deepCopy);
+    static MEDCouplingTimeDiscretizationFloat *New(TypeOfTimeDiscretization type);
+    MEDCouplingTimeDiscretizationFloat *performCopyOrIncrRef(bool deepCopy) const;
+    bool isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate<float> *other, float prec, std::string& reason) const;
+    bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<float> *other, float prec) const;
   private:
     static const TypeOfTimeDiscretization DISCRETIZATION=ONE_TIME;
-    MEDCOUPLING_EXPORT static const char REPR[];
-  protected:
-    MEDCouplingTimeKeeper _tk;
   };
   
   class MEDCouplingNoTimeLabel : public MEDCouplingTimeDiscretization
index 4d96c7cc83596eb0f0a3a710561c1369ee1be127..54a0b19f0f072e8e1d1e310cde2df1e79d28144c 100644 (file)
 #define __MEDCOUPLINGTIMEDISCRETIZATION_TXX__
 
 #include "MEDCouplingTimeDiscretization.hxx"
+#include "MEDCouplingMemArray.txx"
 
 #include <cmath>
 #include <sstream>
 
 namespace MEDCoupling
 {
+  template<class T>
+  const char MEDCouplingTimeDiscretizationSimple<T>::REPR[]="One time label.";
+
   template<class T>
   const double MEDCouplingTimeDiscretizationTemplate<T>::TIME_TOLERANCE_DFT=1.e-12;
   
@@ -56,14 +60,14 @@ namespace MEDCoupling
   template<class T>
   void MEDCouplingTimeDiscretizationTemplate<T>::copyTinyAttrFrom(const MEDCouplingTimeDiscretizationTemplate<T>& other)
   {
+    TimeHolder::copyTinyAttrFrom(other);
     _time_tolerance=other._time_tolerance;
-    _time_unit=other._time_unit;
   }
   
   template<class T>
   void MEDCouplingTimeDiscretizationTemplate<T>::copyTinyStringsFrom(const MEDCouplingTimeDiscretizationTemplate<T>& other)
   {
-    _time_unit=other._time_unit;
+    TimeHolder::copyTinyAttrFrom(other);
     if(_array && other._array)
       _array->copyStringInfoFrom(*other._array);
   }
@@ -71,7 +75,7 @@ namespace MEDCoupling
   template<class T>
   std::size_t MEDCouplingTimeDiscretizationTemplate<T>::getHeapMemorySizeWithoutChildren() const
   {
-    return _time_unit.capacity();
+    return getTimeUnit().capacity();
   }
   
   template<class T>
@@ -95,9 +99,9 @@ namespace MEDCoupling
   bool MEDCouplingTimeDiscretizationTemplate<T>::areStrictlyCompatible(const MEDCouplingTimeDiscretizationTemplate<T> *other, std::string& reason) const
   {
     std::ostringstream oss; oss.precision(15);
-    if(_time_unit!=other->_time_unit)
+    if(getTimeUnit()!=other->getTimeUnit())
       {
-        oss << "Field discretizations differ : this time unit = \"" << _time_unit << "\" and other time unit = \"" << other->_time_unit << "\" !";
+        oss << "Field discretizations differ : this time unit = \"" << getTimeUnit() << "\" and other time unit = \"" << other->getTimeUnit() << "\" !";
         reason=oss.str();
         return false;
       }
@@ -172,7 +176,7 @@ namespace MEDCoupling
   }
 
   template<class T>
-  MEDCouplingTimeDiscretizationTemplate<T>::MEDCouplingTimeDiscretizationTemplate(const MEDCouplingTimeDiscretizationTemplate<T>& other, bool deepCopy):_time_unit(other._time_unit),_time_tolerance(other._time_tolerance)
+  MEDCouplingTimeDiscretizationTemplate<T>::MEDCouplingTimeDiscretizationTemplate(const MEDCouplingTimeDiscretizationTemplate<T>& other, bool deepCopy):TimeHolder(other),_time_tolerance(other._time_tolerance)
   {
     if(other._array)
       _array=other._array->performCopyOrIncrRef(deepCopy);
@@ -219,6 +223,125 @@ namespace MEDCoupling
     arrays.resize(1);
     arrays[0]=_array;
   }
+  
+  template<class T>
+  void MEDCouplingTimeDiscretizationTemplate<T>::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
+  {
+    if(_array)
+      {
+        tinyInfo.push_back(_array->getNumberOfTuples());
+        tinyInfo.push_back(_array->getNumberOfComponents());
+      }
+    else
+      {
+        tinyInfo.push_back(-1);
+        tinyInfo.push_back(-1);
+      }
+  }
+  
+  template<class T>
+  void MEDCouplingTimeDiscretizationTemplate<T>::getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const
+  {
+    tinyInfo.push_back(_time_tolerance);
+  }
+  
+  template<class T>
+  void MEDCouplingTimeDiscretizationTemplate<T>::getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const
+  {
+    int nbOfCompo(_array->getNumberOfComponents());
+    for(int i=0;i<nbOfCompo;i++)
+      tinyInfo.push_back(_array->getInfoOnComponent(i));
+  }
+  
+  template<class T>
+  void MEDCouplingTimeDiscretizationTemplate<T>::resizeForUnserialization(const std::vector<int>& tinyInfoI, std::vector<typename Traits<T>::ArrayType *>& arrays)
+  {
+    arrays.resize(1);
+    if(_array!=0)
+      _array->decrRef();
+    typename Traits<T>::ArrayType *arr=0;
+    if(tinyInfoI[0]!=-1 && tinyInfoI[1]!=-1)
+      {
+        arr=Traits<T>::ArrayType::New();
+        arr->alloc(tinyInfoI[0],tinyInfoI[1]);
+      }
+    _array=arr;
+    arrays[0]=arr;
+  }
+  
+  template<class T>
+  void MEDCouplingTimeDiscretizationTemplate<T>::checkForUnserialization(const std::vector<int>& tinyInfoI, const std::vector<typename Traits<T>::ArrayType *>& arrays)
+  {
+    static const char MSG[]="MEDCouplingTimeDiscretization::checkForUnserialization : arrays in input is expected to have size one !";
+    if(arrays.size()!=1)
+      throw INTERP_KERNEL::Exception(MSG);
+    if(_array!=0)
+      _array->decrRef();
+    _array=0;
+    if(tinyInfoI[0]!=-1 && tinyInfoI[1]!=-1)
+      {
+        if(!arrays[0])
+          throw INTERP_KERNEL::Exception(MSG);
+        arrays[0]->checkNbOfTuplesAndComp(tinyInfoI[0],tinyInfoI[1],MSG);
+        _array=arrays[0];
+        _array->incrRef();
+      }
+  }
+  
+  template<class T>
+  void MEDCouplingTimeDiscretizationTemplate<T>::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
+  {
+    _time_tolerance=tinyInfoD[0];
+    int nbOfCompo=_array->getNumberOfComponents();
+    for(int i=0;i<nbOfCompo;i++)
+      _array->setInfoOnComponent(i,tinyInfoS[i]);
+  }
+  
+  /////////////////////////
+  
+  template<class T>
+  std::string MEDCouplingTimeDiscretizationSimple<T>::getStringRepr() const
+  {
+    std::ostringstream stream;
+    stream << REPR << " Time is defined by iteration=" << _tk.getIteration() << " order=" << _tk.getOrder() << " and time=" << _tk.getTimeValue() << ".";
+    stream << "\nTime unit is : \"" << this->getTimeUnit() << "\"";
+    return stream.str();
+  }
+  
+  template<class T>
+  double MEDCouplingTimeDiscretizationSimple<T>::getEndTime(int& iteration, int& order) const
+  {
+    throw INTERP_KERNEL::Exception("getEndTime : invalid for this type of time discr !");
+  }
+  
+  template<class T>
+  void MEDCouplingTimeDiscretizationSimple<T>::setEndIteration(int it)
+  {
+    throw INTERP_KERNEL::Exception("setEndIteration : invalid for this type of time discr !");
+  }
+  
+  template<class T>
+  void MEDCouplingTimeDiscretizationSimple<T>::setEndOrder(int order)
+  {
+    throw INTERP_KERNEL::Exception("setEndOrder : invalid for this type of time discr !");
+  }
+  
+  template<class T>
+  void MEDCouplingTimeDiscretizationSimple<T>::setEndTimeValue(double time)
+  {
+    throw INTERP_KERNEL::Exception("setEndTimeValue : invalid for this type of time discr !");
+  }
+  
+  template<class T>
+  void MEDCouplingTimeDiscretizationSimple<T>::setEndTime(double time, int iteration, int order)
+  {
+    throw INTERP_KERNEL::Exception("setEndTime : invalid for this type of time discr !");
+  }
+
+  template<class T>
+  MEDCouplingTimeDiscretizationSimple<T>::MEDCouplingTimeDiscretizationSimple(const MEDCouplingTimeDiscretizationSimple<T>& other, bool deepCopy):MEDCouplingTimeDiscretizationTemplate<T>(other,deepCopy),_tk(other._tk)
+  {
+  }
 }
 
 #endif
index 0a30d982d97defc1ffe18aa698a3f107e390031c..eaeeffa0ab3154c994c18ef4c621ccda93e03ee3 100644 (file)
@@ -26,8 +26,22 @@ const char Traits<double>::ArrayTypeName[]="DataArrayDouble";
 
 const char Traits<double>::FieldTypeName[]="MEDCouplingFieldDouble";
 
+const char Traits<double>::NPYStr[]="FLOAT64";
+
+const char Traits<float>::ArrayTypeName[]="DataArrayFloat";
+
+const char Traits<float>::FieldTypeName[]="MEDCouplingFieldFloat";
+
+const char Traits<float>::NPYStr[]="FLOAT32";
+
 const char Traits<int>::ArrayTypeName[]="DataArrayInt";
 
 const char Traits<int>::FieldTypeName[]="MEDCouplingFieldInt";
 
 const char Traits<char>::ArrayTypeName[]="DataArrayChar";
+
+const char Traits<Int64>::ArrayTypeName[]="DataArrayInt64";
+
+const char Traits<Int64>::FieldTypeName[]="MEDCouplingFieldInt64";
+
+const char Traits<Int64>::NPYStr[]="INT64";
index 5a22379bf02963c97dd236326f8a67821c66fe4a..ff5debe4c33f3aa38ad9f9268b8a933850f9c5ed 100644 (file)
@@ -22,6 +22,7 @@
 #define __MEDCOUPLINGTRAITS_HXX__
 
 #include "MEDCoupling.hxx"
+#include "MCType.hxx"
 
 namespace MEDCoupling
 {
@@ -31,31 +32,64 @@ namespace MEDCoupling
     typedef T EltType;
   };
 
-  class DataArrayInt;
+  class DataArrayInt32;
+  class DataArrayFloat;
   class DataArrayDouble;
   class DataArrayChar;
   class DataArrayByte;
+  class DataArrayInt64;
   class MEDCouplingFieldDouble;
+  class MEDCouplingFieldFloat;
   class MEDCouplingFieldInt;
+  class DataArrayInt32Tuple;
+  class DataArrayFloatTuple;
+  class DataArrayDoubleTuple;
   
   template<>
   struct MEDCOUPLING_EXPORT Traits<double>
   {
     static const char ArrayTypeName[];
     static const char FieldTypeName[];
+    static const char NPYStr[];
     typedef DataArrayDouble ArrayType;
     typedef DataArrayDouble ArrayTypeCh;
     typedef MEDCouplingFieldDouble FieldType;
+    typedef DataArrayDoubleTuple ArrayTuple;
+  };
+
+  template<>
+  struct MEDCOUPLING_EXPORT Traits<float>
+  {
+    static const char ArrayTypeName[];
+    static const char FieldTypeName[];
+    static const char NPYStr[];
+    typedef DataArrayFloat ArrayType;
+    typedef DataArrayFloat ArrayTypeCh;
+    typedef MEDCouplingFieldFloat FieldType;
+    typedef DataArrayFloatTuple ArrayTuple;
   };
   
   template<>
-  struct MEDCOUPLING_EXPORT Traits<int>
+  struct MEDCOUPLING_EXPORT Traits<Int32>
   {
     static const char ArrayTypeName[];
     static const char FieldTypeName[];
-    typedef DataArrayInt ArrayType;
-    typedef DataArrayInt ArrayTypeCh;
+    typedef DataArrayInt32 ArrayType;
+    typedef DataArrayInt32 ArrayTypeCh;
     typedef MEDCouplingFieldInt FieldType;
+    typedef DataArrayInt32Tuple ArrayTuple;
+  };
+
+  template<>
+  struct MEDCOUPLING_EXPORT Traits<Int64>
+  {
+    static const char ArrayTypeName[];
+    static const char FieldTypeName[];
+    static const char NPYStr[];
+    typedef DataArrayInt64 ArrayType;
+    typedef DataArrayInt64 ArrayTypeCh;
+    //typedef MEDCouplingFieldInt64 FieldType;
+    //typedef DataArrayInt64Tuple ArrayTuple;
   };
 
   template<>
index 87c0118f02c07dc438dc139596d2e00a4fe12faf..94be2bd5a6791caf733e42d93bcf6e0ee52e65e6 100644 (file)
@@ -41,6 +41,7 @@
 #include "InterpKernelGeo2DEdgeLin.hxx"
 #include "InterpKernelGeo2DEdgeArcCircle.hxx"
 #include "InterpKernelGeo2DQuadraticPolygon.hxx"
+#include "OrientationInverter.hxx"
 #include "MEDCouplingUMesh_internal.hxx"
 
 #include <sstream>
@@ -589,18 +590,15 @@ void MEDCouplingUMesh::checkFastEquivalWith(const MEDCouplingMesh *other, double
 void MEDCouplingUMesh::getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const
 {
   checkFullyDefined();
-  int nbOfNodes=getNumberOfNodes();
+  int nbOfNodes(getNumberOfNodes());
   int *revNodalIndxPtr=(int *)malloc((nbOfNodes+1)*sizeof(int));
   revNodalIndx->useArray(revNodalIndxPtr,true,C_DEALLOC,nbOfNodes+1,1);
   std::fill(revNodalIndxPtr,revNodalIndxPtr+nbOfNodes+1,0);
-  const int *conn=_nodal_connec->getConstPointer();
-  const int *connIndex=_nodal_connec_index->getConstPointer();
-  int nbOfCells=getNumberOfCells();
-  int nbOfEltsInRevNodal=0;
+  const int *conn(_nodal_connec->begin()),*connIndex(_nodal_connec_index->begin());
+  int nbOfCells(getNumberOfCells()),nbOfEltsInRevNodal(0);
   for(int eltId=0;eltId<nbOfCells;eltId++)
     {
-      const int *strtNdlConnOfCurCell=conn+connIndex[eltId]+1;
-      const int *endNdlConnOfCurCell=conn+connIndex[eltId+1];
+      const int *strtNdlConnOfCurCell(conn+connIndex[eltId]+1),*endNdlConnOfCurCell(conn+connIndex[eltId+1]);
       for(const int *iter=strtNdlConnOfCurCell;iter!=endNdlConnOfCurCell;iter++)
         if(*iter>=0)//for polyhedrons
           {
@@ -838,10 +836,10 @@ void MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, cons
 {
   if(!desc || !descIndx || !revDesc || !revDescIndx)
     throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ComputeNeighborsOfCellsAdv some input array is empty !");
-  const int *descPtr=desc->getConstPointer();
-  const int *descIPtr=descIndx->getConstPointer();
-  const int *revDescPtr=revDesc->getConstPointer();
-  const int *revDescIPtr=revDescIndx->getConstPointer();
+  const int *descPtr=desc->begin();
+  const int *descIPtr=descIndx->begin();
+  const int *revDescPtr=revDesc->begin();
+  const int *revDescIPtr=revDescIndx->begin();
   //
   int nbCells=descIndx->getNumberOfTuples()-1;
   MCAuto<DataArrayInt> out0=DataArrayInt::New();
@@ -863,6 +861,35 @@ void MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, cons
   neighborsIndx=out1.retn();
 }
 
+/*!
+ * Explodes \a this into edges whatever its dimension.
+ */
+MCAuto<MEDCouplingUMesh> MEDCouplingUMesh::explodeIntoEdges(MCAuto<DataArrayInt>& desc, MCAuto<DataArrayInt>& descIndex, MCAuto<DataArrayInt>& revDesc, MCAuto<DataArrayInt>& revDescIndx) const
+{
+  checkFullyDefined();
+  int mdim(getMeshDimension());
+  desc=DataArrayInt::New(); descIndex=DataArrayInt::New(); revDesc=DataArrayInt::New(); revDescIndx=DataArrayInt::New();
+  MCAuto<MEDCouplingUMesh> mesh1D;
+  switch(mdim)
+  {
+    case 3:
+      {
+        mesh1D=explode3DMeshTo1D(desc,descIndex,revDesc,revDescIndx);
+        break;
+      }
+    case 2:
+      {
+        mesh1D=buildDescendingConnectivity(desc,descIndex,revDesc,revDescIndx);
+        break;
+      }
+    default:
+      {
+        throw INTERP_KERNEL::Exception("MEDCouplingUMesh::computeNeighborsOfNodes : Mesh dimension supported are [3,2] !");
+      }
+  }
+  return mesh1D;
+}
+
 /*!
  * \b WARNING this method do the assumption that connectivity lies on the coordinates set.
  * For speed reasons no check of this will be done. This method calls
@@ -877,13 +904,15 @@ void MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, cons
  * The number of tuples is equal to the last values in \b neighborsIndx.
  * \param [out] neighborsIdx is an array of size this->getNumberOfCells()+1 newly allocated and should
  * be dealt by the caller. This arrays allow to use the first output parameter \b neighbors.
+ * 
+ * \sa MEDCouplingUMesh::computeEnlargedNeighborsOfNodes
  */
 void MEDCouplingUMesh::computeNeighborsOfNodes(DataArrayInt *&neighbors, DataArrayInt *&neighborsIdx) const
 {
   checkFullyDefined();
   int mdim(getMeshDimension()),nbNodes(getNumberOfNodes());
   MCAuto<DataArrayInt> desc(DataArrayInt::New()),descIndx(DataArrayInt::New()),revDesc(DataArrayInt::New()),revDescIndx(DataArrayInt::New());
-  MCAuto<MEDCouplingUMesh> mesh1D;
+  MCConstAuto<MEDCouplingUMesh> mesh1D;
   switch(mdim)
   {
     case 3:
@@ -898,8 +927,7 @@ void MEDCouplingUMesh::computeNeighborsOfNodes(DataArrayInt *&neighbors, DataArr
       }
     case 1:
       {
-        mesh1D=const_cast<MEDCouplingUMesh *>(this);
-        mesh1D->incrRef();
+        mesh1D.takeRef(this);
         break;
       }
     default:
@@ -922,6 +950,45 @@ void MEDCouplingUMesh::computeNeighborsOfNodes(DataArrayInt *&neighbors, DataArr
   neighborsIdx=descIndx.retn();
 }
 
+/*!
+ * Computes enlarged neighbors for each nodes in \a this. The behavior of this method is close to MEDCouplingUMesh::computeNeighborsOfNodes except that the neighborhood of each node is wider here.
+ * A node j is considered to be in the neighborhood of i if and only if there is a cell in \a this containing in its nodal connectivity both i and j.
+ * This method is useful to find ghost cells of a part of a mesh with a code based on fields on nodes.
+ * 
+ * \sa MEDCouplingUMesh::computeNeighborsOfNodes
+ */
+void MEDCouplingUMesh::computeEnlargedNeighborsOfNodes(MCAuto<DataArrayInt> &neighbors, MCAuto<DataArrayInt>& neighborsIdx) const
+{
+  checkFullyDefined();
+  int nbOfNodes(getNumberOfNodes());
+  const int *conn(_nodal_connec->begin()),*connIndex(_nodal_connec_index->begin());
+  int nbOfCells(getNumberOfCells());
+  std::vector< std::set<int> > st0(nbOfNodes);
+  for(int eltId=0;eltId<nbOfCells;eltId++)
+    {
+      const int *strtNdlConnOfCurCell(conn+connIndex[eltId]+1),*endNdlConnOfCurCell(conn+connIndex[eltId+1]);
+      std::set<int> s(strtNdlConnOfCurCell,endNdlConnOfCurCell); s.erase(-1); //for polyhedrons
+      for(std::set<int>::const_iterator iter2=s.begin();iter2!=s.end();iter2++)
+        st0[*iter2].insert(s.begin(),s.end());
+    }
+  neighborsIdx=DataArrayInt::New(); neighborsIdx->alloc(nbOfNodes+1,1); neighborsIdx->setIJ(0,0,0);
+  {
+    int *neighIdx(neighborsIdx->getPointer());
+    for(std::vector< std::set<int> >::const_iterator it=st0.begin();it!=st0.end();it++,neighIdx++)
+      neighIdx[1]=neighIdx[0]+(*it).size()-1;
+  }
+  neighbors=DataArrayInt::New(); neighbors->alloc(neighborsIdx->back(),1);
+  {
+    const int *neighIdx(neighborsIdx->begin());
+    int *neigh(neighbors->getPointer()),nodeId(0);
+    for(std::vector< std::set<int> >::const_iterator it=st0.begin();it!=st0.end();it++,neighIdx++,nodeId++)
+      {
+        std::set<int> s(*it); s.erase(nodeId);
+        std::copy(s.begin(),s.end(),neigh+*neighIdx);
+      }
+  }
+}
+
 /*!
  * Converts specified cells to either polygons (if \a this is a 2D mesh) or
  * polyhedrons (if \a this is a 3D mesh). The cells to convert are specified by an
@@ -954,7 +1021,7 @@ void MEDCouplingUMesh::convertToPolyTypes(const int *cellIdsToConvertBg, const i
   int nbOfCells(getNumberOfCells());
   if(dim==2)
     {
-      const int *connIndex=_nodal_connec_index->getConstPointer();
+      const int *connIndex=_nodal_connec_index->begin();
       int *conn=_nodal_connec->getPointer();
       for(const int *iter=cellIdsToConvertBg;iter!=cellIdsToConvertEnd;iter++)
         {
@@ -2296,7 +2363,7 @@ void MEDCouplingUMesh::findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1On
   DAInt neighIInit00(tmp11);
   // Neighbor information of the mesh WITH the crack (some neighbors are removed):
   DataArrayInt *idsTmp=0;
-  bool b=m01->areCellsIncludedIn(&otherDimM1OnSameCoords,2,idsTmp);
+  m01->areCellsIncludedIn(&otherDimM1OnSameCoords,2,idsTmp);
   DAInt ids(idsTmp);
   // In the neighbor information remove the connection between high dimension cells and its low level constituents which are part
   // of the frontier given in parameter (i.e. the cells of low dimension from the group delimiting the crack):
@@ -2977,14 +3044,14 @@ void MEDCouplingUMesh::setConnectivity(DataArrayInt *conn, DataArrayInt *connInd
  * Copy constructor. If 'deepCopy' is false \a this is a shallow copy of other.
  * If 'deeCpy' is true all arrays (coordinates and connectivities) are deeply copied.
  */
-MEDCouplingUMesh::MEDCouplingUMesh(const MEDCouplingUMesh& other, bool deepCopy):MEDCouplingPointSet(other,deepCopy),_mesh_dim(other._mesh_dim),
+MEDCouplingUMesh::MEDCouplingUMesh(const MEDCouplingUMesh& other, bool deepCpy):MEDCouplingPointSet(other,deepCpy),_mesh_dim(other._mesh_dim),
     _nodal_connec(0),_nodal_connec_index(0),
     _types(other._types)
 {
   if(other._nodal_connec)
-    _nodal_connec=other._nodal_connec->performCopyOrIncrRef(deepCopy);
+    _nodal_connec=other._nodal_connec->performCopyOrIncrRef(deepCpy);
   if(other._nodal_connec_index)
-    _nodal_connec_index=other._nodal_connec_index->performCopyOrIncrRef(deepCopy);
+    _nodal_connec_index=other._nodal_connec_index->performCopyOrIncrRef(deepCpy);
 }
 
 MEDCouplingUMesh::~MEDCouplingUMesh()
@@ -3649,7 +3716,7 @@ MCAuto<MEDCouplingUMesh> MEDCouplingUMesh::clipSingle3DCellByPlane(const double
   std::vector<std::vector<int> > res;
   buildSubCellsFromCut(cut3DSurf,desc2->begin(),descIndx2->begin(),mDesc1->getCoords()->begin(),eps,res);
   std::size_t sz(res.size());
-  if(res.size()==mDesc1->getNumberOfCells() && sameNbNodes)
+  if((int)res.size()==mDesc1->getNumberOfCells() && sameNbNodes)
     throw INTERP_KERNEL::Exception("MEDCouplingUMesh::clipSingle3DCellByPlane : cell is not clipped !");
   for(std::size_t i=0;i<sz;i++)
     {
@@ -3905,7 +3972,7 @@ DataArrayDouble *MEDCouplingUMesh::distanceToPoints(const DataArrayDouble *pts,
     throw INTERP_KERNEL::Exception("MEDCouplingUMesh::distanceToPoints works only for spaceDim=meshDim+1 !");
   if(meshDim!=2 && meshDim!=1)
     throw INTERP_KERNEL::Exception("MEDCouplingUMesh::distanceToPoints : only mesh dimension 2 and 1 are implemented !");
-  if(pts->getNumberOfComponents()!=spaceDim)
+  if((int)pts->getNumberOfComponents()!=spaceDim)
     {
       std::ostringstream oss; oss << "MEDCouplingUMesh::distanceToPoints : input pts DataArrayDouble has " << pts->getNumberOfComponents() << " components whereas it should be equal to " << spaceDim << " (mesh spaceDimension) !";
       throw INTERP_KERNEL::Exception(oss.str());
@@ -4788,6 +4855,27 @@ void MEDCouplingUMesh::orientCorrectlyPolyhedrons()
   updateTime();
 }
 
+/*!
+ * This method invert orientation of all cells in \a this. 
+ * After calling this method the absolute value of measure of cells in \a this are the same than before calling.
+ * This method only operates on the connectivity so coordinates are not touched at all.
+ */
+void MEDCouplingUMesh::invertOrientationOfAllCells()
+{
+  checkConnectivityFullyDefined();
+  std::set<INTERP_KERNEL::NormalizedCellType> gts(getAllGeoTypes());
+  int *conn(_nodal_connec->getPointer());
+  const int *conni(_nodal_connec_index->begin());
+  for(std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator gt=gts.begin();gt!=gts.end();gt++)
+    {
+      INTERP_KERNEL::AutoCppPtr<INTERP_KERNEL::OrientationInverter> oi(INTERP_KERNEL::OrientationInverter::BuildInstanceFrom(*gt));
+      MCAuto<DataArrayInt> cwt(giveCellsWithType(*gt));
+      for(const int *it=cwt->begin();it!=cwt->end();it++)
+        oi->operate(conn+conni[*it]+1,conn+conni[*it+1]);
+    }
+  updateTime();
+}
+
 /*!
  * Finds and fixes incorrectly oriented linear extruded volumes (INTERP_KERNEL::NORM_HEXA8,
  * INTERP_KERNEL::NORM_PENTA6, INTERP_KERNEL::NORM_HEXGP12 etc) to respect the MED convention
index efab092eb273eaf775524495234eae7c3a2882f3..9f1a8606ff189520b0614cd31257371c0b8fca5d 100644 (file)
@@ -120,6 +120,7 @@ namespace MEDCoupling
     MEDCOUPLING_EXPORT bool areCellsIncludedIn(const MEDCouplingUMesh *other, int compType, DataArrayInt *& arr) const;
     MEDCOUPLING_EXPORT bool areCellsIncludedInPolicy7(const MEDCouplingUMesh *other, DataArrayInt *& arr) const;
     MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const;
+    MEDCOUPLING_EXPORT MCAuto<MEDCouplingUMesh> explodeIntoEdges(MCAuto<DataArrayInt>& desc, MCAuto<DataArrayInt>& descIndex, MCAuto<DataArrayInt>& revDesc, MCAuto<DataArrayInt>& revDescIndx) const;
     MEDCOUPLING_EXPORT MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const;
     MEDCOUPLING_EXPORT MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const;
     MEDCOUPLING_EXPORT MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const;
@@ -129,6 +130,7 @@ namespace MEDCoupling
     MEDCOUPLING_EXPORT static void ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI,
                                                               DataArrayInt *&neighbors, DataArrayInt *&neighborsIdx);
     MEDCOUPLING_EXPORT void computeNeighborsOfNodes(DataArrayInt *&neighbors, DataArrayInt *&neighborsIdx) const;
+    MEDCOUPLING_EXPORT void computeEnlargedNeighborsOfNodes(MCAuto<DataArrayInt> &neighbors, MCAuto<DataArrayInt>& neighborsIdx) const;
     MEDCOUPLING_EXPORT MEDCouplingUMesh *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const;
     MEDCOUPLING_EXPORT MEDCouplingUMesh *buildPartOfMySelf(const int *begin, const int *end, bool keepCoords=true) const;
     MEDCOUPLING_EXPORT MEDCouplingUMesh *buildPartOfMySelfSlice(int start, int end, int step, bool keepCoords=true) const;
@@ -192,6 +194,7 @@ namespace MEDCoupling
     MEDCOUPLING_EXPORT void changeOrientationOfCells();
     MEDCOUPLING_EXPORT void arePolyhedronsNotCorrectlyOriented(std::vector<int>& cells) const;
     MEDCOUPLING_EXPORT void orientCorrectlyPolyhedrons();
+    MEDCOUPLING_EXPORT void invertOrientationOfAllCells();
     MEDCOUPLING_EXPORT void getFastAveragePlaneOfThis(double *vec, double *pos) const;
     //Mesh quality
     MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getEdgeRatioField() const;
@@ -282,7 +285,7 @@ namespace MEDCoupling
   private: // all private methods are impl in MEDCouplingUMesh_internal.cxx
 
     MEDCouplingUMesh();
-    MEDCouplingUMesh(const MEDCouplingUMesh& other, bool deepCopy);
+    MEDCouplingUMesh(const MEDCouplingUMesh& other, bool deepCpy);
     ~MEDCouplingUMesh();
     void checkFullyDefined() const;
     void checkConnectivityFullyDefined() const;
index 8865deb8ad6a73209452b0cdb3584945212dffce..7a6fa91598e72e4f8da729350f81f5fc2865cb96 100644 (file)
@@ -1400,7 +1400,7 @@ void MEDCouplingUMesh::buildSubCellsFromCut(const std::vector< std::pair<int,int
     throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSubCellsFromCut works only with single cell presently !");
   for(int i=0;i<nbOfCells;i++)
     {
-      int offset(descIndx[i]),nbOfFaces(descIndx[i+1]-offset),start(-1),end(-1);
+      int offset(descIndx[i]),nbOfFaces(descIndx[i+1]-offset);
       for(int j=0;j<nbOfFaces;j++)
         {
           const std::pair<int,int>& p=cut3DSurf[desc[offset+j]];
@@ -1788,7 +1788,7 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D,
   MCAuto<MEDCouplingUMesh> ret2D(MEDCouplingUMesh::MergeUMeshesOnSameCoords(tmp));
   // To finish - filter ret3 - std::numeric_limits<int>::max() -> -1 - negate values must be resolved.
   ret3->rearrange(1);
-  MCAuto<DataArrayInt> edgesToDealWith(ret3->findIdsStricltyNegative());
+  MCAuto<DataArrayInt> edgesToDealWith(ret3->findIdsStrictlyNegative());
   for(const int *it=edgesToDealWith->begin();it!=edgesToDealWith->end();it++)
     {
       int old2DCellId(-ret3->getIJ(*it,0)-1);
@@ -2123,7 +2123,6 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps)
   if(_types.size() != 1 || *(_types.begin()) != INTERP_KERNEL::NORM_POLYHED)
     throw INTERP_KERNEL::Exception("MEDCouplingUMesh::conformize3D : This method only works for polyhedrons! Call convertAllToPoly first.");
 
-  int *c(getNodalConnectivity()->getPointer()),*cI(getNodalConnectivityIndex()->getPointer());
   MCAuto<MEDCouplingSkyLineArray> connSla(MEDCouplingSkyLineArray::BuildFromPolyhedronConn(getNodalConnectivity(), getNodalConnectivityIndex()));
   const double * coo(_coords->begin());
   MCAuto<DataArrayInt> ret(DataArrayInt::New());
@@ -2140,8 +2139,8 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps)
 
     // Build BBTree
     MCAuto<DataArrayDouble> bboxArr(mDesc->getBoundingBoxForBBTree());
-    const double *bbox(bboxArr->begin()),*coords(getCoords()->begin());
-    int nCell=getNumberOfCells(), nDescCell=mDesc->getNumberOfCells();
+    const double *bbox(bboxArr->begin()); getCoords()->begin();
+    int nDescCell(mDesc->getNumberOfCells());
     BBTree<SPACEDIM,int> myTree(bbox,0,0,nDescCell,-eps);
     // Surfaces - handle biggest first
     MCAuto<MEDCouplingFieldDouble> surfF = mDesc->getMeasureField(true);
@@ -2170,11 +2169,11 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps)
         vector<int> candidates, cands2;
         myTree.getIntersectingElems(bbox+faceIdx*2*SPACEDIM,candidates);
         // Keep only candidates whose normal matches the normal of current face
-        for(vector<int>::const_iterator it=candidates.begin();it!=candidates.end();it++)
+        for(vector<int>::const_iterator it2=candidates.begin();it2!=candidates.end();it2++)
           {
-            bool col = INTERP_KERNEL::isColinear3D(normalsP + faceIdx*SPACEDIM, normalsP + *(it)*SPACEDIM, eps);
-            if (*it != faceIdx && col)
-              cands2.push_back(*it);
+            bool col = INTERP_KERNEL::isColinear3D(normalsP + faceIdx*SPACEDIM, normalsP + *(it2)*SPACEDIM, eps);
+            if (*it2 != faceIdx && col)
+              cands2.push_back(*it2);
           }
         if (!cands2.size())
           continue;
@@ -2233,9 +2232,9 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps)
         const int * idsGoodPlaneP(idsGoodPlane->begin());
         for (const int * ii = ids->begin(); ii != ids->end(); ii++)
           {
-            int faceIdx = cands2[idsGoodPlaneP[*ii]];
-            hit[faceIdx] = true;
-            checkSurf += surfs->begin()[faceIdx];
+            int faceIdx2 = cands2[idsGoodPlaneP[*ii]];
+            hit[faceIdx2] = true;
+            checkSurf += surfs->begin()[faceIdx2];
           }
         if (fabs(checkSurf - surfs->begin()[faceIdx]) > eps)
           {
@@ -2256,7 +2255,7 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps)
         connSla->findPackIds(polyIndices, sIdxConn, sIdxConnE, packsIds);
         // Deletion of old faces
         int jj=0;
-        for (vector<int>::const_iterator it=polyIndices.begin(); it!=polyIndices.end(); ++it, ++jj)
+        for (vector<int>::const_iterator it2=polyIndices.begin(); it2!=polyIndices.end(); ++it2, ++jj)
           {
             if (packsIds[jj] == -1)
               // The below should never happen - if a face is used several times, with a different layout of the nodes
@@ -2264,18 +2263,18 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps)
               // faces which are actually used only once, by a single cell. This is different for edges below.
               throw INTERP_KERNEL::Exception("MEDCouplingUMesh::conformize3D: Could not find face in connectivity! Internal error.");
             else
-              connSla->deletePack(*it, packsIds[jj]);
+              connSla->deletePack(*it2, packsIds[jj]);
           }
         // Insertion of new faces:
         for (const int * ii = ids->begin(); ii != ids->end(); ii++)
           {
             // Build pack from the face to insert:
-            int faceIdx = cands2[idsGoodPlane->getIJ(*ii,0)];
+            int faceIdx2 = cands2[idsGoodPlane->getIJ(*ii,0)];
             int facePack2Sz;
-            const int * facePack2 = connSlaDesc->getSimplePackSafePtr(faceIdx, facePack2Sz); // contains the type!
+            const int * facePack2 = connSlaDesc->getSimplePackSafePtr(faceIdx2, facePack2Sz); // contains the type!
             // Insert it in all hit polyhedrons:
-            for (vector<int>::const_iterator it=polyIndices.begin(); it!=polyIndices.end(); ++it)
-              connSla->pushBackPack(*it, facePack2+1, facePack2+facePack2Sz);  // without the type
+            for (vector<int>::const_iterator it2=polyIndices.begin(); it2!=polyIndices.end(); ++it2)
+              connSla->pushBackPack(*it2, facePack2+1, facePack2+facePack2Sz);  // without the type
           }
       }
   }  // end step1
@@ -2288,7 +2287,7 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps)
   {
     /************************
      *  STEP 2 -- edges
-    /************************/
+     ************************/
     // Now we have a face-conform mesh.
 
     // Recompute descending
@@ -2341,17 +2340,17 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps)
         unsigned start = cDesc2[cIDesc2[eIdx]+1], end = cDesc2[cIDesc2[eIdx]+2];
         for (int i3=0; i3 < 3; i3++)  // TODO: use fillSonCellNodalConnectivity2 or similar?
           vCurr[i3] = coo[start*SPACEDIM+i3] - coo[end*SPACEDIM+i3];
-        for(vector<int>::const_iterator it=candidates.begin();it!=candidates.end();it++)
+        for(vector<int>::const_iterator it2=candidates.begin();it2!=candidates.end();it2++)
           {
             double vOther[3];
-            unsigned start2 = cDesc2[cIDesc2[*it]+1], end2 = cDesc2[cIDesc2[*it]+2];
+            unsigned start2 = cDesc2[cIDesc2[*it2]+1], end2 = cDesc2[cIDesc2[*it2]+2];
             for (int i3=0; i3 < 3; i3++)
               vOther[i3] = coo[start2*SPACEDIM+i3] - coo[end2*SPACEDIM+i3];
             bool col = INTERP_KERNEL::isColinear3D(vCurr, vOther, eps);
             // Warning: different from faces: we need to keep eIdx in the final list of candidates because we need
             // to have its nodes inside the sub mesh mPartCand below (needed in OrderPointsAlongLine())
             if (col)
-              cands2.push_back(*it);
+              cands2.push_back(*it2);
           }
         if (cands2.size() == 1 && cands2[0] == eIdx)  // see warning above
           continue;
index 1dead8e8d599c2ca3f2f5e2d9c715ba5d8d23fbe..deac498563bbf4bac719bb33cc32d9c2f5656974 100644 (file)
@@ -440,7 +440,7 @@ MCAuto<MEDCouplingUMesh> MEDCoupling::Voronizer2D::doIt(const MEDCouplingUMesh *
             newCoords=a->getCoords()->selectByTupleId(tmp->begin(),tmp->end());
           }
           const double *cPtr(newCoords->begin());
-          for(int i=0;i<newCoords->getNumberOfTuples();i++,cPtr+=2)
+          for(int j=0;j<newCoords->getNumberOfTuples();j++,cPtr+=2)
             {
               std::set<int> zeCandidates;
               {
@@ -509,9 +509,15 @@ MCAuto<MEDCouplingUMesh> MEDCoupling::Voronizer3D::doIt(const MEDCouplingUMesh *
       vorTess->getCellsContainingPoint(pt,eps,polygsToIterOn);
       if(polygsToIterOn.size()<1)
         throw INTERP_KERNEL::Exception("Voronoize3D : presence of a point outside the given cell !");
+      std::set<int> elemsToDo(polygsToIterOn.begin(),polygsToIterOn.end()),elemsDone;
+      std::size_t ii(0);
       std::vector< MCAuto<MEDCouplingUMesh> > newVorCells;
-      for(int poly=0;poly<vorTess->getNumberOfCells();poly++)
+      MCAuto<DataArrayInt> d(DataArrayInt::New()),dI(DataArrayInt::New()),rd(DataArrayInt::New()),rdI(DataArrayInt::New());
+      MCAuto<MEDCouplingUMesh> faces(vorTess->buildDescendingConnectivity(d,dI,rd,rdI));
+      //
+      while(!elemsToDo.empty())
         {
+          int poly(*elemsToDo.begin()); elemsToDo.erase(elemsToDo.begin()); elemsDone.insert(poly);
           const double *seed(pts+3*poly);
           MCAuto<MEDCouplingUMesh> tile(l0[poly]);
           tile->zipCoords();
@@ -529,6 +535,42 @@ MCAuto<MEDCouplingUMesh> MEDCoupling::Voronizer3D::doIt(const MEDCouplingUMesh *
           newVorCell->zipCoords();
           MCAuto<MEDCouplingUMesh> modifiedCell(cells->buildPartOfMySelfSlice(0,1,1,true));
           modifiedCell->zipCoords();
+          l0[poly]=modifiedCell;
+          if(std::find(polygsToIterOn.begin(),polygsToIterOn.end(),poly)!=polygsToIterOn.end())// we iterate on a polyhedron containg the point to add pt -> add cells sharing faces with just computed newVorCell
+            {
+              MCAuto<MEDCouplingUMesh> faces2;
+              {
+                MCAuto<DataArrayInt> d2(DataArrayInt::New()),d2I(DataArrayInt::New()),rd2(DataArrayInt::New()),rd2I(DataArrayInt::New());
+                faces2=newVorCell->buildDescendingConnectivity(d2,d2I,rd2,rd2I);
+              }
+              MCAuto<MEDCouplingUMesh> faces3(faces2->buildPartOfMySelfSlice(1,faces2->getNumberOfCells(),1,true));// suppress internal face
+              MCAuto<MEDCouplingUMesh> facesOfCurSplitPol(faces->buildPartOfMySelf(d->begin()+dI->getIJ(poly,0),d->begin()+dI->getIJ(poly+1,0),true));
+              // intersection between the out faces of newVorCell and the neighbor faces of poly polyhedron -> candidates
+              MEDCouplingNormalizedUnstructuredMesh<3,2> source_mesh_wrapper(facesOfCurSplitPol);
+              MEDCouplingNormalizedUnstructuredMesh<3,2> target_mesh_wrapper(faces3);
+              INTERP_KERNEL::Interpolation3DSurf interpolation;
+              interpolation.setMinDotBtwPlane3DSurfIntersect(eps2);
+              interpolation.setMaxDistance3DSurfIntersect(eps);
+              interpolation.setPrecision(1e-12);
+              std::vector<std::map<int,double> > matrix;
+              interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,matrix,"P0P0");
+              std::set<int> zeCandidates;
+              for(std::vector<std::map<int,double> >::const_iterator it2=matrix.begin();it2!=matrix.end();it2++)
+                for(std::map<int,double>::const_iterator it3=(*it2).begin();it3!=(*it2).end();it3++)
+                  {
+                    int faceIdInVorTess(d->getIJ(dI->getIJ(poly,0)+(*it3).first,0));
+                    for(const int *it4=rd->begin()+rdI->getIJ(faceIdInVorTess,0);it4!=rd->begin()+rdI->getIJ(faceIdInVorTess+1,0);it4++)
+                      {
+                        if(*it4!=poly)
+                          zeCandidates.insert(*it4);
+                      }
+                  }
+              std::set<int> tmp2,newElementsToDo;
+              std::set_difference(zeCandidates.begin(),zeCandidates.end(),elemsDone.begin(),elemsDone.end(),std::inserter(tmp2,tmp2.begin()));
+              std::set_union(elemsToDo.begin(),elemsToDo.end(),tmp2.begin(),tmp2.end(),std::inserter(newElementsToDo,newElementsToDo.begin()));
+              elemsToDo=newElementsToDo;
+            }
+          //
           newVorCells.push_back(newVorCell);
           l0[poly]=modifiedCell;
         }
index 3589367a5710397693478a151e441cd7d8949e71..460215242ac52c8c0e3f0a4b9324047f529554fa 100644 (file)
@@ -77,11 +77,9 @@ void MEDCouplingBasicsTest1::testArray2()
   arr->setInfoOnComponent(1,"hhhh");
   arr->setInfoOnComponent(2,"jj");
   arr->setInfoOnComponent(3,"kkkkkk");
-  DataArrayInt *arr2=arr->convertToIntArr();
-  DataArrayDouble *arr3=arr2->convertToDblArr();
-  arr2->decrRef();
+  MCAuto<DataArrayInt> arr2(arr->convertToIntArr());
+  MCAuto<DataArrayDouble> arr3(arr2->convertToDblArr());
   CPPUNIT_ASSERT(arr->isEqual(*arr3,1e-14));
-  arr3->decrRef();
   arr->decrRef();
 }
 
index a6e7075caeff5d0985ba041a72d774012b86fe0b..42972290c7edf0294f80eab911a74030a7e712ba 100644 (file)
@@ -681,7 +681,7 @@ void MEDCouplingBasicsTest3::testKeepSetSelectedComponent1()
   const double expected1[30]={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(int i=0;i<30;i++)
     CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],a2->getIJ(0,i),1e-14);
-  DataArrayInt *a3=a1->convertToIntArr();
+  MCAuto<DataArrayInt> a3(a1->convertToIntArr());
   DataArrayInt *a4=static_cast<DataArrayInt *>(a3->keepSelectedComponents(arr2V));
   CPPUNIT_ASSERT_EQUAL(6,(int)a4->getNumberOfComponents());
   CPPUNIT_ASSERT_EQUAL(5,(int)a4->getNumberOfTuples());
@@ -713,7 +713,7 @@ void MEDCouplingBasicsTest3::testKeepSetSelectedComponent1()
   const double expected2[30]={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(int i=0;i<30;i++)
     CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],a2->getIJ(0,i),1e-14);
-  DataArrayInt *a6=a5->convertToIntArr();
+  MCAuto<DataArrayInt> a6=a5->convertToIntArr();
   a6->setInfoOnComponent(0,"eeee");
   a6->setInfoOnComponent(1,"ffff");
   a4->setSelectedComponents(a6,arr4V);
@@ -740,10 +740,8 @@ void MEDCouplingBasicsTest3::testKeepSetSelectedComponent1()
   arr7V.resize(3);
   CPPUNIT_ASSERT_THROW(a2->setSelectedComponents(a1,arr7V),INTERP_KERNEL::Exception);
   //
-  a6->decrRef();
   a5->decrRef();
   a4->decrRef();
-  a3->decrRef();
   a2->decrRef();
   a1->decrRef();
 }
@@ -1066,14 +1064,13 @@ void MEDCouplingBasicsTest3::testDAFromNoInterlace1()
   CPPUNIT_ASSERT_EQUAL(5,(int)da2->getNumberOfTuples());
   CPPUNIT_ASSERT_EQUAL(3,(int)da2->getNumberOfComponents());// it's not a bug. Avoid to have 1 million components !
   CPPUNIT_ASSERT(std::equal(expected1,expected1+15,da2->getConstPointer()));
-  DataArrayDouble *da3=da->convertToDblArr();
+  MCAuto<DataArrayDouble> da3=da->convertToDblArr();
   DataArrayDouble *da4=da3->fromNoInterlace();
   CPPUNIT_ASSERT_EQUAL(5,(int)da4->getNumberOfTuples());
   CPPUNIT_ASSERT_EQUAL(3,(int)da4->getNumberOfComponents());// it's not a bug. Avoid to have 1 million components !
   for(int i=0;i<15;i++)
     CPPUNIT_ASSERT_DOUBLES_EQUAL((double)expected1[i],da4->getIJ(0,i),1e-14);
   da4->decrRef();
-  da3->decrRef();
   da2->decrRef();
   da->decrRef();
 }
@@ -1089,14 +1086,13 @@ void MEDCouplingBasicsTest3::testDAToNoInterlace1()
   CPPUNIT_ASSERT_EQUAL(5,(int)da2->getNumberOfTuples());
   CPPUNIT_ASSERT_EQUAL(3,(int)da2->getNumberOfComponents());// it's not a bug. Avoid to have 1 million components !
   CPPUNIT_ASSERT(std::equal(expected1,expected1+15,da2->getConstPointer()));
-  DataArrayDouble *da3=da->convertToDblArr();
+  MCAuto<DataArrayDouble> da3=da->convertToDblArr();
   DataArrayDouble *da4=da3->toNoInterlace();
   CPPUNIT_ASSERT_EQUAL(5,(int)da4->getNumberOfTuples());
   CPPUNIT_ASSERT_EQUAL(3,(int)da4->getNumberOfComponents());// it's not a bug. Avoid to have 1 million components !
   for(int i=0;i<15;i++)
     CPPUNIT_ASSERT_DOUBLES_EQUAL((double)expected1[i],da4->getIJ(0,i),1e-14);
   da4->decrRef();
-  da3->decrRef();
   da2->decrRef();
   da->decrRef();
 }
@@ -1112,13 +1108,12 @@ void MEDCouplingBasicsTest3::testDAIsUniform1()
   CPPUNIT_ASSERT(!da->isUniform(1));
   da->setIJ(2,0,1);
   CPPUNIT_ASSERT(da->isUniform(1));
-  DataArrayDouble *da2=da->convertToDblArr();
+  MCAuto<DataArrayDouble> da2=da->convertToDblArr();
   CPPUNIT_ASSERT(da2->isUniform(1.,1e-12));
   da2->setIJ(1,0,1.+1.e-13);
   CPPUNIT_ASSERT(da2->isUniform(1.,1e-12));
   da2->setIJ(1,0,1.+1.e-11);
   CPPUNIT_ASSERT(!da2->isUniform(1.,1e-12));
-  da2->decrRef();
   da->decrRef();
 }
 
@@ -1648,7 +1643,7 @@ void MEDCouplingBasicsTest3::testDAMeld1()
   //
   da1->fillWithValue(7.);
   da2->iota(0.);
-  DataArrayDouble *da3=da2->applyFunc(3,"10*x*IVec+100*x*JVec+1000*x*KVec");
+  MCAuto<DataArrayDouble> da3=da2->applyFunc(3,"10*x*IVec+100*x*JVec+1000*x*KVec");
   //
   da1->setInfoOnComponent(0,"c0da1");
   da1->setInfoOnComponent(1,"c1da1");
@@ -1670,8 +1665,8 @@ void MEDCouplingBasicsTest3::testDAMeld1()
   for(int i=0;i<35;i++)
     CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],da1->getIJ(0,i),1e-10);
   //
-  DataArrayInt *dai1=da1C->convertToIntArr();
-  DataArrayInt *dai3=da3->convertToIntArr();
+  MCAuto<DataArrayInt> dai1=da1C->convertToIntArr();
+  MCAuto<DataArrayInt> dai3=da3->convertToIntArr();
   dai1->meldWith(dai3);
   CPPUNIT_ASSERT_EQUAL(5,(int)dai1->getNumberOfComponents());
   CPPUNIT_ASSERT_EQUAL(7,(int)dai1->getNumberOfTuples());
@@ -1694,7 +1689,6 @@ void MEDCouplingBasicsTest3::testDAMeld1()
   for(int i=0;i<35;i++)
     CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],da4->getIJ(0,i),1e-10);
   // test of static method DataArrayInt::meld
-  dai1->decrRef();
   dai1=da1C->convertToIntArr();
   DataArrayInt *dai4=DataArrayInt::Meld(dai1,dai3);
   CPPUNIT_ASSERT_EQUAL(5,(int)dai4->getNumberOfComponents());
@@ -1709,12 +1703,9 @@ void MEDCouplingBasicsTest3::testDAMeld1()
   //
   dai4->decrRef();
   da4->decrRef();
-  dai3->decrRef();
-  dai1->decrRef();
   da1C->decrRef();
   da1->decrRef();
   da2->decrRef();
-  da3->decrRef();
 }
 
 void MEDCouplingBasicsTest3::testFieldMeld1()
@@ -2140,7 +2131,7 @@ void MEDCouplingBasicsTest3::testDARearrange1()
   for(int i=0;i<12;i++)
     CPPUNIT_ASSERT_EQUAL(i,da1->getIJ(0,i));
   //double
-  DataArrayDouble *da2=da1->convertToDblArr();
+  MCAuto<DataArrayDouble> da2=da1->convertToDblArr();
   da1->decrRef();
   const double *ptr2=da2->getConstPointer();
   //
@@ -2180,7 +2171,6 @@ void MEDCouplingBasicsTest3::testDARearrange1()
   CPPUNIT_ASSERT_EQUAL(4,(int)da2->getNumberOfTuples());
   for(int i=0;i<12;i++)
     CPPUNIT_ASSERT_DOUBLES_EQUAL((double)i,da2->getIJ(0,i),1e-14);
-  da2->decrRef();
 }
 
 void MEDCouplingBasicsTest3::testGetDifferentValues1()
@@ -2224,7 +2214,7 @@ void MEDCouplingBasicsTest3::testDAIBuildPermutationArr1()
   c=a->buildPermutationArr(*b);
   const int expect2[5]={1,3,4,2,3};
   CPPUNIT_ASSERT(std::equal(expect2,expect2+5,c->getConstPointer()));
-  DataArrayDouble *d=b->convertToDblArr();
+  MCAuto<DataArrayDouble> d=b->convertToDblArr();
   b->sort();
   const int expect3[5]={4,4,5,6,8};
   CPPUNIT_ASSERT(std::equal(expect3,expect3+5,b->getConstPointer()));
@@ -2234,10 +2224,9 @@ void MEDCouplingBasicsTest3::testDAIBuildPermutationArr1()
   for(int i=0;i<5;i++)
     CPPUNIT_ASSERT_DOUBLES_EQUAL(double(expect3[i]),d->getIJ(i,0),1e-14);
   //
-  d->decrRef();
+  b->decrRef();
   c->decrRef();
   a->decrRef();
-  b->decrRef();
 }
 
 void MEDCouplingBasicsTest3::testAreCellsIncludedIn2()
index 6ed02e3ede897a8c62b6bdf6852ff7d238212b2b..fc199652f01eae4ed539d8df30e1e0711c1a0271 100644 (file)
@@ -998,7 +998,7 @@ void MEDCouplingBasicsTest4::testDACpyFrom1()
   d1->deepCopyFrom(*d);
   CPPUNIT_ASSERT(d->isEqual(*d1,1e-12));
   //
-  DataArrayInt *d2=d->convertToIntArr();
+  MCAuto<DataArrayInt> d2=d->convertToIntArr();
   DataArrayInt *d4=DataArrayInt::New();
   CPPUNIT_ASSERT(!d2->isEqual(*d4));
   d4->deepCopyFrom(*d2);
@@ -1012,7 +1012,6 @@ void MEDCouplingBasicsTest4::testDACpyFrom1()
   //
   d->decrRef();
   d1->decrRef();
-  d2->decrRef();
   d4->decrRef();
 }
 
index 3213b5728b2478d4f99c52b5f276da82e7be03a8..b18a7d3def641306b91daa6f7239b356a2fe1b31 100644 (file)
@@ -601,7 +601,7 @@ void MEDCouplingBasicsTest5::testDataArrayAbs1()
   const double expected1[12]={2.,3.,5.,6.,7.,8.,9.,10.,11.,12.,13.,15.};
   d1->alloc(6,2);
   std::copy(val1,val1+12,d1->getPointer());
-  DataArrayInt *d2=d1->convertToIntArr();
+  MCAuto<DataArrayInt> d2=d1->convertToIntArr();
   //
   d1->abs();
   for(int i=0;i<12;i++)
@@ -612,7 +612,6 @@ void MEDCouplingBasicsTest5::testDataArrayAbs1()
   for(int i=0;i<12;i++)
     CPPUNIT_ASSERT_EQUAL(expected2[i],d2->getIJ(0,i));
   //
-  d2->decrRef();
   d1->decrRef();
 }
 
index 9ae0519e91df7b45c0e7f22a85d4883bc137c60a..ed16b352325728bb3272fd7b3813be8f7c9b8faf 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
@@ -38,6 +42,7 @@ SET (MC_pyTestFiles
     MEDCouplingBasicsTest3.py
     MEDCouplingBasicsTest4.py
     MEDCouplingBasicsTest5.py
+    MEDCouplingBasicsTest6.py
     MEDCouplingIntersectTest.py
     MEDCouplingRemapperTest.py
     MEDCouplingDataForTest.py
@@ -56,6 +61,7 @@ SET (MC_Swig_interf
     MEDCouplingRemapper.i
     MEDCouplingTypemaps.i
     MEDCouplingDataArrayTypemaps.i
+    MEDCouplingDataArrayTraits.hxx
 )
 
 INCLUDE_DIRECTORIES(
@@ -91,7 +97,11 @@ SWIG_ADD_MODULE(MEDCoupling python MEDCoupling.i)
 SWIG_LINK_LIBRARIES(MEDCoupling ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} medcoupling)
 SWIG_CHECK_GENERATION(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
@@ -127,6 +137,8 @@ ADD_TEST(MEDCouplingBasicsTest4 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}
 SET_TESTS_PROPERTIES(MEDCouplingBasicsTest4 PROPERTIES ENVIRONMENT "${tests_env}")
 ADD_TEST(MEDCouplingBasicsTest5 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingBasicsTest5.py)
 SET_TESTS_PROPERTIES(MEDCouplingBasicsTest5 PROPERTIES ENVIRONMENT "${tests_env}")
+ADD_TEST(MEDCouplingBasicsTest6 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingBasicsTest6.py)
+SET_TESTS_PROPERTIES(MEDCouplingBasicsTest6 PROPERTIES ENVIRONMENT "${tests_env}")
 ADD_TEST(MEDCouplingIntersectTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingIntersectTest.py)
 SET_TESTS_PROPERTIES(MEDCouplingIntersectTest PROPERTIES ENVIRONMENT "${tests_env}")
 ADD_TEST(MEDCouplingExamplesTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingExamplesTest.py)
index 911e471e5069012aaf61fc8f6a81ed6aa4327325..ea92e59d71139af179a963f7650c80916a6c7d5b 100644 (file)
@@ -23,6 +23,7 @@ SET(TEST_NAMES
   MEDCouplingBasicsTest3
   MEDCouplingBasicsTest4
   MEDCouplingBasicsTest5
+  MEDCouplingBasicsTest6
   MEDCouplingIntersectTest
   MEDCouplingExamplesTest
   MEDCouplingRemapperTest
index c96a45ad1b9f0517b35c91ce15f73aa2d212f09e..41eab4b45f6a09297a81440593f8aa43b7aeed75 100644 (file)
@@ -56,6 +56,12 @@ def MEDCouplingFieldDoubleIdiv(self,*args):
 def MEDCouplingFieldDoubleIpow(self,*args):
     import _MEDCoupling
     return _MEDCoupling.MEDCouplingFieldDouble____ipow___(self, self, *args)
+def MEDCouplingFieldIntnew(cls,*args):
+    import _MEDCoupling
+    return _MEDCoupling.MEDCouplingFieldInt____new___(cls,args)
+def MEDCouplingFieldFloatnew(cls,*args):
+    import _MEDCoupling
+    return _MEDCoupling.MEDCouplingFieldFloat____new___(cls,args)
 def MEDCouplingDataArrayIntnew(cls,*args):
     import _MEDCoupling
     return _MEDCoupling.DataArrayInt____new___(cls,args)
@@ -80,6 +86,21 @@ def MEDCouplingDataArrayIntIpow(self,*args):
 def MEDCouplingDataArrayBytenew(cls,*args):
     import _MEDCoupling
     return _MEDCoupling.DataArrayByte____new___(cls,args)
+def MEDCouplingDataArrayFloatnew(cls,*args):
+    import _MEDCoupling
+    return _MEDCoupling.DataArrayFloat____new___(cls,args)
+def MEDCouplingDataArrayFloatIadd(self,*args):
+    import _MEDCoupling
+    return _MEDCoupling.DataArrayFloat____iadd___(self, self, *args)
+def MEDCouplingDataArrayFloatIsub(self,*args):
+    import _MEDCoupling
+    return _MEDCoupling.DataArrayFloat____isub___(self, self, *args)
+def MEDCouplingDataArrayFloatImul(self,*args):
+    import _MEDCoupling
+    return _MEDCoupling.DataArrayFloat____imul___(self, self, *args)
+def MEDCouplingDataArrayFloatIdiv(self,*args):
+    import _MEDCoupling
+    return _MEDCoupling.DataArrayFloat____idiv___(self, self, *args)
 def MEDCouplingDataArrayDoubleTupleIadd(self,*args):
     import _MEDCoupling
     return _MEDCoupling.DataArrayDoubleTuple____iadd___(self, self, *args)
index cdc7565519432feff07e948f9e5b7f90c93b09bc..4d3692134593b76200104c5e8e4b4b4f04422286 100644 (file)
@@ -23,7 +23,7 @@ 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 MEDCouplingBasicsTest1(unittest.TestCase):
     def testArray2(self):
@@ -60,21 +60,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 +133,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 +797,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 +853,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 +864,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 +877,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 +992,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 +1035,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 +1054,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 +1067,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 +1080,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 +1106,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 +1119,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 +1131,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 +1144,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 +1171,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 +1201,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 +1213,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 +1231,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 +1242,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 +1254,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 +1264,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 +1280,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 +1296,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 +1316,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 +1326,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 +1351,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 +1360,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 +1546,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 +1561,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 +1595,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 +1699,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 +1719,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 +1765,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 +1776,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 +1962,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 +2049,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 +2084,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 +2146,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 +2228,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 +2236,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 +2244,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 +2284,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 +2293,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 +2302,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 +2313,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 +2332,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 +2341,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 +2355,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 +2363,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 +2380,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 +2397,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 +2413,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 +2423,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 +2447,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 +2460,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 +2468,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 +2476,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 +2563,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 +2579,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 +2628,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 +2648,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 +2670,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 +2680,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 +2701,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 +2824,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 +2943,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 +2954,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 +2978,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 +2995,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 +3076,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..e64c24637bd9f2b0947be9d941664dc6c91a3091 100644 (file)
@@ -45,13 +45,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 +68,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 +80,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 +102,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 +125,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 +155,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 +233,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 +256,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 +275,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 +298,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 +321,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 +341,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 +366,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 +395,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 +418,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 +438,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 +461,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 +475,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 +489,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 +510,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 +535,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 +555,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 +583,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 +591,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 +611,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 +623,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 +726,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 +736,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 +757,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 +773,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 +788,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 +808,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 +832,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 +850,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 +940,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 +968,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 +997,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 +1009,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 +1020,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 +1034,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 +1073,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 +1084,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 +1095,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 +1120,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 +1135,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 +1154,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 +1169,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 +1184,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 +1195,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 +1214,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 +1229,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 +1244,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 +1255,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 +1274,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 +1289,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 +1306,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 +1319,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 +1342,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 +1355,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 +1384,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 +1399,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 +1414,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 +1439,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 +1454,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 +1469,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 +1487,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 +1501,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 +1520,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 +1535,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 +1583,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 +1609,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 +1831,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 +1849,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 +1890,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 +1901,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 +1912,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 +1982,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 +2131,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 +2170,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 +2216,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 +2230,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 +2244,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 +2255,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 +2270,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 +2289,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 +2326,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 +2340,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 +2354,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 +2369,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 +2403,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 +2420,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 +2436,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 +2466,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 +2480,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 +2496,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 +2519,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 +2539,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 +2558,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 +2577,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 +2643,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 +2721,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 +2738,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 +2754,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 +2774,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 +2791,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 +2867,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 +2896,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 +2910,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 +2925,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..7583efb1cdf6cb39621dae43aabfc2625ed1fcd4 100644 (file)
@@ -23,7 +23,7 @@ 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 MEDCouplingBasicsTest3(unittest.TestCase):
     def testSwigGetItem1(self):
@@ -130,7 +130,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 +186,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 +271,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 +347,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 +492,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 +550,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 +616,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 +682,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 +741,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 +805,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 +940,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 +954,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 +978,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 +988,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 +1006,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 +1024,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 +1108,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 +1148,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 +1210,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 +1237,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 +1263,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 +1282,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 +1301,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 +1315,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 +1327,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 +1340,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 +1366,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 +1378,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 +1519,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 +1527,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 +1540,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 +1558,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 +1576,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 +1634,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 +1678,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 +1690,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 +1741,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 +1749,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 +1769,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 +1888,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 +1901,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 +1926,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 +2076,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 +2154,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 +2188,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 +2222,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 +2235,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 +2288,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 +2346,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 +2488,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 +2509,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 +2601,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 +2621,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 +2642,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 +2667,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 +2688,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 +2713,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 +2721,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 +2735,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 +2745,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 +2755,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 +2771,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 +2796,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 +2804,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 +2818,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 +2828,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 +2838,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 +2854,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 +2899,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 +2918,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 +2953,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 +2973,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 +2981,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 +2990,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..00090fb60fda793a70fafda462df65cbfae4f95b 100644 (file)
@@ -23,7 +23,7 @@ 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
 from sys import platform
 
 def checkFreeMemory(size):
@@ -44,23 +44,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 +68,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 +82,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 +95,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 +108,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 +117,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 +134,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 +143,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 +160,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 +169,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 +193,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 +207,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 +220,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 +233,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 +242,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 +259,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 +268,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 +285,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 +300,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 +314,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 +357,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 +372,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 +502,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 +510,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 +533,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 +555,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 +666,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 +754,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 +921,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 +950,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 +1028,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 +1165,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 +1348,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 +1458,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 +1595,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 +1667,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 +1857,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 +1870,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 +1885,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 +1911,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 +1940,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]
@@ -1963,10 +1999,10 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         m.insertNextCell(NORM_TRI3,[0,1,2])
         a,b=m.distanceToPoint([-0.335,2.27,1.21])
         self.assertEqual(0,b)
-        self.assertAlmostEqual(0.022360988100374124,a,14);
+        self.assertAlmostEqual(0.0223609881003,a,12);
         a,b=m.distanceToPoint(DataArrayDouble([-0.335,2.27,1.21],1,3))
         self.assertEqual(0,b)
-        self.assertAlmostEqual(0.022360988100374124,a,14);
+        self.assertAlmostEqual(0.0223609881003,a,12);
         a,b=coords.distanceToTuple([-0.335,2.27,1.21])
         self.assertAlmostEqual(5.243302871282566,a,14)
         self.assertEqual(0,b)
@@ -2005,6 +2041,27 @@ class MEDCouplingBasicsTest4(unittest.TestCase):
         self.assertAlmostEqual(0.07071067811865482,a,14) ; self.assertEqual(1,b) # self.assertEqual(2,c)
         pass
 
+    def testSwig2UMeshDistanceToMesh2(self):
+        mesh = MEDCouplingUMesh('Solid_3', 2)
+        coo = DataArrayDouble([(99.75,-1.42109e-14,102.75),(99.75,200,102.75),(2.5,0,200),(2.5,200,200),(197,0,200),(197,200,200)])
+        mesh.setCoords(coo)
+        c = DataArrayInt([3, 4, 0, 1, 3, 4, 1, 5, 3, 1, 0, 3, 3, 3, 0, 2])
+        cI = DataArrayInt([0, 4, 8, 12, 16])
+        mesh.setConnectivity(c, cI)
+        mesh.checkConsistency()
+        pt = [125.0, 175.0, 175.0]
+        # Values computed from GEOM:
+        exp1, exp2, exp3, exp4 = 54.0633707597, 33.2340187158, 68.9429111657, 99.5221476482
+        d1, _ = mesh[0].distanceToPoint(pt)
+        d2, _ = mesh[1].distanceToPoint(pt)
+        d3, _ = mesh[2].distanceToPoint(pt)
+        d4, _ = mesh[3].distanceToPoint(pt)
+        self.assertAlmostEqual(exp1,d1,10)
+        self.assertAlmostEqual(exp2,d2,10)
+        self.assertAlmostEqual(exp3,d3,10)
+        self.assertAlmostEqual(exp4,d4,10)
+        pass
+
     def testSwig2NonRegressionPartitionBySpreadZone1(self):
         m=MEDCouplingCMesh()
         arr=DataArrayDouble(6) ; arr.iota(0.)
@@ -2035,7 +2092,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 +2100,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 +2267,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 +2327,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 +2416,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 +2623,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 +2756,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 +2818,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 +2884,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 +2912,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 +2930,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 +2965,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 +3005,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 +3028,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 +3038,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 +3105,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 +3137,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 +3169,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 +3201,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 +3237,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 +3263,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 +3295,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 +3327,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 +3359,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 +3391,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 +3413,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 +3441,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 +3467,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 +3495,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..1719e3488c34d290ef566997f0cf17330c24fcc5 100644 (file)
@@ -23,7 +23,7 @@ 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 +31,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 +61,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 +96,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 +130,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 +230,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 +258,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 +288,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 +307,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 +325,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 +469,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 +537,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 +601,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])
@@ -696,7 +696,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         self.assertRaises(InterpKernelException,m.buildUnstructured().splitProfilePerType,invalidPfl)
         ##
         pfl1=DataArrayInt([1,2,3])
-        a=m.checkTypeConsistencyAndContig([NORM_QUAD4,3,0],[pfl1])
+        a=m.getCellsContainingPointcheckTypeConsistencyAndContig([NORM_QUAD4,3,0],[pfl1])
         b=m.buildUnstructured().checkTypeConsistencyAndContig([NORM_QUAD4,3,0],[pfl1])
         self.assertTrue(a.isEqual(b) and pfl1.getHiddenCppPointer(),a.getHiddenCppPointer())
         #
@@ -1405,7 +1405,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 +1552,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 +1899,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 +2204,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 +2667,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 +3087,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);
@@ -3261,7 +3261,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
 
     def testSwig2DAIGetIdsStrictlyNegative1(self):
         d=DataArrayInt([4,-5,-1,0,3,99,-7])
-        self.assertTrue(d.findIdsStricltyNegative().isEqual(DataArrayInt([1,2,6])))
+        self.assertTrue(d.findIdsStrictlyNegative().isEqual(DataArrayInt([1,2,6])))
         pass
 
     def testSwig2DAIReplaceOneValByInThis1(self):
@@ -3310,7 +3310,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 +3323,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 +3333,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 +3349,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 +3362,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 +3372,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 +3390,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 +3401,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 +3475,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 +3493,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 +3514,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 +3532,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 +3550,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 +3564,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 +3579,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)
@@ -4546,13 +4546,188 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         self.assertEqual(f2.getTime(),[1.,2,3])
         pass
 
-    def testBugInComputationOfEqOfPlane1(self):
-        coo=DataArrayDouble([-1.0, 1.0, -0.3872983455657959, -1.0, 1.0, 0.3872983455657959, -1.0, 1.0, 0.693649172782898, 1.0, 1.0, 0.693649172782898, 1.0, 1.0, 0.3872983455657959, 1.0, 1.0, -0.3872983455657959],6,3)
-        m=MEDCouplingUMesh("",2)
-        m.setCoords(coo)
-        m.allocateCells()
-        m.insertNextCell(NORM_POLYGON,[0,1,2,3,4,5])
-        self.assertTrue(m.computePlaneEquationOf3DFaces().isEqual(DataArrayDouble([0,1,0,-1],1,4),1e-12))
+    def testDADCumSum1(self):
+        d=DataArrayDouble([3.,2.,4.,5.])
+        self.assertTrue(d.cumSum().isEqual(DataArrayDouble([0.,3.,5.,9.,14.]),1e-12))
+        d2=DataArrayDouble([])
+        self.assertTrue(d2.cumSum().isEqual(DataArrayDouble([0.]),1e-12))
+        d.rearrange(2)
+        self.assertRaises(InterpKernelException,d.cumSum)
+        pass
+
+    def testDAIFromLinkedListOfPairToList1(self):
+        d=DataArrayInt([(5,7),(7,3),(3,12),(12,17)])
+        zeRes=DataArrayInt([5,7,3,12,17])
+        self.assertTrue(d.fromLinkedListOfPairToList().isEqual(zeRes))
+        d.rearrange(1)
+        self.assertRaises(InterpKernelException,d.fromLinkedListOfPairToList)
+        d.rearrange(2)
+        self.assertTrue(d.fromLinkedListOfPairToList().isEqual(zeRes))
+        d2=DataArrayInt([(5,7)])
+        self.assertTrue(d2.fromLinkedListOfPairToList().isEqual(DataArrayInt([5,7])))
+        d3=DataArrayInt([(5,7),(7,3),(4,12),(12,17)])
+        self.assertRaises(InterpKernelException,d3.fromLinkedListOfPairToList) # not a linked list of pair
+        d4=DataArrayInt([(5,7),(7,3),(12,3),(12,17)])
+        self.assertRaises(InterpKernelException,d4.fromLinkedListOfPairToList) # not a linked list of pair, but can be repaired !
+        d4.sortEachPairToMakeALinkedList()
+        self.assertTrue(d4.fromLinkedListOfPairToList().isEqual(zeRes))
+        pass
+
+    def testUMeshExplodeIntoEdges1(self):
+        m=MEDCouplingCMesh() ; arr=DataArrayDouble(5) ; arr.iota() ; m.setCoords(arr,arr,arr) ; m=m.buildUnstructured()
+        self.assertEqual(m.getMeshDimension(),3)
+        a0,a1,a2,a3,a4=m.explodeIntoEdges()
+        b0,b1,b2,b3,b4=m.explode3DMeshTo1D()
+        self.assertTrue(a0.isEqual(b0,1e-12))
+        self.assertTrue(a1.isEqual(b1)) ; self.assertTrue(a2.isEqual(b2)) ; self.assertTrue(a3.isEqual(b3)) ; self.assertTrue(a4.isEqual(b4))
+        #
+        m=MEDCouplingCMesh() ; arr=DataArrayDouble(5) ; arr.iota() ; m.setCoords(arr,arr) ; m=m.buildUnstructured()
+        self.assertEqual(m.getMeshDimension(),2)
+        a0,a1,a2,a3,a4=m.explodeIntoEdges()
+        b0,b1,b2,b3,b4=m.buildDescendingConnectivity()
+        self.assertTrue(a0.isEqual(b0,1e-12))
+        self.assertTrue(a1.isEqual(b1)) ; self.assertTrue(a2.isEqual(b2)) ; self.assertTrue(a3.isEqual(b3)) ; self.assertTrue(a4.isEqual(b4))
+        pass
+
+    def testUMeshComputeEnlargedNeighborsOfNodes(self):
+        m=MEDCouplingCMesh() ; arr=DataArrayDouble(4) ; arr.iota() ; m.setCoords(arr,arr) ; m=m.buildUnstructured()
+        a,b=m.computeEnlargedNeighborsOfNodes()
+        self.assertTrue(a.isEqual(DataArrayInt([1,4,5,0,2,4,5,6,1,3,5,6,7,2,6,7,0,1,5,8,9,0,1,2,4,6,8,9,10,1,2,3,5,7,9,10,11,2,3,6,10,11,4,5,9,12,13,4,5,6,8,10,12,13,14,5,6,7,9,11,13,14,15,6,7,10,14,15,8,9,13,8,9,10,12,14,9,10,11,13,15,10,11,14])))
+        self.assertTrue(b.isEqual(DataArrayInt([0,3,8,13,16,21,29,37,42,47,55,63,68,71,76,81,84])))
+        pass
+
+    def testDAIfindIdsExt1(self):
+        d=DataArrayInt([4,6,-2,3,7,0,10])
+        self.assertTrue(d.findIdsGreaterOrEqualTo(3).isEqual(DataArrayInt([0,1,3,4,6])))
+        self.assertTrue(d.findIdsGreaterThan(3).isEqual(DataArrayInt([0,1,4,6])))
+        self.assertTrue(d.findIdsLowerThan(3).isEqual(DataArrayInt([2,5])))
+        self.assertTrue(d.findIdsLowerOrEqualTo(3).isEqual(DataArrayInt([2,3,5])))
+        pass
+
+    def testDAFacto1(self):
+        """Test focused of new wrapped methods for MEDCouplingFieldInt thanks to code factorization."""
+        d=DataArrayDouble(7) ; d.iota()
+        m=MEDCouplingUMesh.Build1DMeshFromCoords(d)
+        f=MEDCouplingFieldInt(ON_CELLS) ; f.setMesh(m) ; arr=DataArrayInt(6) ; arr.iota() ; f.setArray(arr) ; f.checkConsistencyLight()
+        f_0=f[::2] # test is here
+        self.assertTrue(f_0.getArray().isEqual(DataArrayInt([0,2,4])))
+        self.assertTrue(f_0.getMesh().isEqual(m[[0,2,4]],1e-12))
+        #
+        f2=MEDCouplingFieldInt(ON_NODES) ; f2.setMesh(m) ; arr=DataArrayInt(7) ; arr.iota() ; f2.setArray(arr) ; f2.checkConsistencyLight()
+        f_1=f2[::2] # test is here
+        self.assertTrue(f_1.getArray().isEqual(DataArrayInt([0,1,2,3,4,5])))
+        m_1=m[[0,2,4]] ; m_1.zipCoords()
+        self.assertTrue(f_1.getMesh().isEqual(m_1,1e-12))
+        pass
+
+    def testFieldFloatIsOnStage1(self):
+        """ My first test with field int."""
+        m=MEDCouplingCMesh()
+        m.setName("mesh")
+        arrX=DataArrayDouble([0,1,2,3])
+        m.setCoords(arrX,arrX)
+        f=MEDCouplingFieldFloat(ON_CELLS)
+        f.setMesh(m)
+        arr=DataArrayFloat(8) ; arr.iota() ;f.setArray(arr)
+        self.assertRaises(InterpKernelException,f.checkConsistencyLight)
+        arr=DataArrayFloat(9) ; arr.iota() ;f.setArray(arr)
+        f.checkConsistencyLight()
+        f.setTimeUnit("ms")
+        self.assertEqual(f.getTimeUnit(),"ms")
+        f.setTime(3.2,5,6)
+        a,b,c=f.getTime()
+        self.assertEqual(b,5)
+        self.assertEqual(c,6)
+        self.assertEqual(a,3.2,12)
+        pass
+
+    def testFieldFloatIsOnStage2(self):
+        """ Very important test to check that isEqual of MEDCouplingFieldFloat is OK !"""
+        m1=MEDCouplingCMesh() ; m1.setCoords(DataArrayDouble([0,1,2,3]),DataArrayDouble([0,1,2,3,4]))
+        m1=m1.buildUnstructured() ; m1.setName("mesh")
+        f1=MEDCouplingFieldFloat(ON_CELLS) ; f1.setMesh(m1)
+        arr1=DataArrayFloat([(0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23)]) ; arr1.setInfoOnComponents(["aa","bbb"])
+        f1.setArray(arr1) ; f1.setName("f1") ; f1.setTime(2.,3,4)
+        #
+        m2=MEDCouplingCMesh() ; m2.setCoords(DataArrayDouble([0,1,2,3]),DataArrayDouble([0,1,2,3,4]))
+        m2=m2.buildUnstructured() ; m2.setName("mesh")
+        f2=MEDCouplingFieldFloat(ON_CELLS) ; f2.setMesh(m2)
+        arr2=DataArrayFloat([(0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23)]) ; arr2.setInfoOnComponents(["aa","bbb"])
+        f2.setArray(arr2) ; f2.setName("f1") ; f2.setTime(2.,3,4)
+        #
+        self.assertTrue(f1.isEqual(f2,1e-12,0.))
+        f1.getArray()[:]*=2
+        self.assertTrue(not f1.isEqual(f2,1e-12,0.))
+        self.assertTrue(not f1.isEqualWithoutConsideringStr(f2,1e-12,0.))
+        f1.getArray()[:]/=2
+        self.assertTrue(f1.isEqual(f2,1e-12,0.))
+        #
+        f1.setName("F1")
+        self.assertTrue(not f1.isEqual(f2,1e-12,0.))
+        f1.setName("f1")
+        self.assertTrue(f1.isEqual(f2,1e-12,0.))
+        #
+        f1.getArray().setInfoOnComponents(["aa","bbbb"])
+        self.assertTrue(not f1.isEqual(f2,1e-12,0.))
+        self.assertTrue(f1.isEqualWithoutConsideringStr(f2,1e-12,0.))
+        f1.getArray().setInfoOnComponents(["aa","bbb"])
+        self.assertTrue(f1.isEqual(f2,1e-12,0.))
+        #
+        f3=f2.deepCopy()
+        self.assertTrue(f1.isEqual(f3,1e-12,0.))
+        #
+        for fd,expected in ((ON_NODES,False),(ON_CELLS,True)):
+            f4=MEDCouplingFieldFloat(fd) ; f4.setMesh(m2) ; f4.setTime(2.,3,4)
+            arr4=DataArrayFloat([(0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23)]) ; arr4.setInfoOnComponents(["aa","bbb"])
+            f4.setArray(arr4) ; f4.setName("f1")
+            self.assertEqual(f1.isEqual(f4,1e-12,0.),expected)
+            pass
+        pass
+
+    def testLTGTDAD1(self):
+        d=DataArrayDouble(10) ; d.iota()
+        self.assertTrue(d.findIdsLowerThan(0).empty())
+        self.assertTrue(d.findIdsLowerThan(1).isEqual(DataArrayInt([0])))
+        d-=5.
+        self.assertTrue(d.findIdsStrictlyNegative().isEqual(DataArrayInt([0,1,2,3,4])))
+        self.assertTrue(d.findIdsGreaterThan(0.).isEqual(DataArrayInt([6,7,8,9])))
+        self.assertTrue(d.convertToFloatArr().isEqual(DataArrayFloat([-5,-4,-3,-2,-1,0,1,2,3,4]),1e-7))
+        self.assertTrue(d.convertToFloatArr().convertToDblArr().isEqual(d,1e-12))
+        pass
+
+    def testMapII1(self):
+        """ Test optimized maps for renumbering. Typical usage local to global in parallel mode"""
+        d=DataArrayInt([1003,1007])
+        m=d.invertArrayN2O2O2NOptimized()
+        d2=DataArrayInt([1003,1003,1007,1003,1007])
+        d2.transformWithIndArr(m)
+        self.assertTrue(d2.isEqual(DataArrayInt([0,0,1,0,1])))
+        pass
+
+    def testDAICheckUniformAndGuess1(self):
+        d=DataArrayInt([3,3],1,2)
+        self.assertRaises(InterpKernelException,d.checkUniformAndGuess)# non single compo
+        d=DataArrayInt([])
+        self.assertRaises(InterpKernelException,d.checkUniformAndGuess)# empty
+        d=DataArrayInt()
+        self.assertRaises(InterpKernelException,d.checkUniformAndGuess)# non allocated
+        d=DataArrayInt([3,3,3])
+        self.assertEqual(3,d.checkUniformAndGuess())
+        d=DataArrayInt([7])
+        self.assertEqual(7,d.checkUniformAndGuess())
+        d=DataArrayInt([3,4,3])
+        self.assertRaises(InterpKernelException,d.checkUniformAndGuess)# non uniform
+        pass
+
+    def testUMComputePlaneEquationOf3DFaces1(self):
+        """ Consequence of an invalid traduction of matrix inversion transposition."""
+        m=MEDCoupling1SGTUMesh("msh",NORM_QUAD4)
+        m.setCoords(DataArrayDouble([(0,0,0),(1,0,0),(2,0,0),(0,2,0),(1,2,0),(2,2,0),(0,4,0),(1,4,0),(2,4,0),(0,0,3),(1,0,3),(2,0,3),(0,2,3),(1,2,3),(2,2,3),(0,4,3),(1,4,3),(2,4,3)]))
+        m.setNodalConnectivity(DataArrayInt([0,1,4,3,9,12,13,10,0,9,10,1,1,10,13,4,4,13,12,3,3,12,9,0,1,2,5,4,10,13,14,11,1,10,11,2,2,11,14,5,5,14,13,4,3,4,7,6,12,15,16,13,4,13,16,7,7,16,15,6,6,15,12,3,4,5,8,7,13,16,17,14,5,14,17,8,8,17,16,7]))
+        m=m.buildUnstructured()
+        ref=DataArrayDouble([(0,0,1,0),(0,0,1,-3),(0,1,0,0),(1,0,0,-1),(0,1,0,-2),(1,0,0,0),(0,0,1,0),(0,0,1,-3),(0,1,0,0),(1,0,0,-2),(0,1,0,-2),(0,0,1,0),(0,0,1,-3),(1,0,0,-1),(0,1,0,-4),(1,0,0,0),(0,0,1,0),(0,0,1,-3),(1,0,0,-2),(0,1,0,-4)])
+        res=m.computePlaneEquationOf3DFaces()
+        self.assertTrue(res.isEqual(ref,1e-12))
         pass
     
     pass
diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest6.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest6.py
new file mode 100644 (file)
index 0000000..f767558
--- /dev/null
@@ -0,0 +1,112 @@
+#  -*- coding: utf-8 -*-
+# Copyright (C) 2017  CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from MEDCoupling import *
+import unittest
+from math import pi,e,sqrt,cos,sin
+from datetime import datetime
+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 MEDCouplingBasicsTest6(unittest.TestCase):
+    def testPointSetInvertOrientationOfAllCells(self):
+        """ Test of inversion of orientation of cells on a different geo types"""
+        def level1(self):
+            m=MEDCouplingUMesh("",1)
+            m.allocateCells()
+            m.insertNextCell(NORM_SEG2,[3,4])
+            m.insertNextCell(NORM_SEG2,[13,14])
+            m.insertNextCell(NORM_SEG3,[5,6,7])
+            m.insertNextCell(NORM_SEG2,[23,24])
+            m.insertNextCell(NORM_SEG3,[8,9,10])
+            ref0=DataArrayInt([0,3,6,10,13,17])
+            self.assertTrue(m.getNodalConnectivityIndex().isEqual(ref0))
+            m.invertOrientationOfAllCells()
+            self.assertTrue(m.getNodalConnectivity().isEqual(DataArrayInt([1,4,3, 1,14,13, 2,7,6,5, 1,24,23, 2,10,9,8])))
+            self.assertTrue(m.getNodalConnectivityIndex().isEqual(ref0))
+            pass
+
+        def level2(self):
+            m=MEDCouplingUMesh("",2)
+            m.allocateCells()
+            m.insertNextCell(NORM_TRI3,[1,2,3])
+            m.insertNextCell(NORM_QUAD4,[4,5,6,7])
+            m.insertNextCell(NORM_POLYGON,[8,9,10,11,12,13])
+            m.insertNextCell(NORM_TRI6,[14,15,16,17,18,19])
+            m.insertNextCell(NORM_QUAD8,[20,21,22,23,24,25,26,27])
+            m.insertNextCell(NORM_QPOLYG,[30,31,32,33,34,35, 36,37,38,39,40,41])
+            ref0=DataArrayInt([0,4,9,16,23,32,45])
+            self.assertTrue(m.getNodalConnectivityIndex().isEqual(ref0))
+            m.invertOrientationOfAllCells()
+            self.assertTrue(m.getNodalConnectivity().isEqual(DataArrayInt([3,1,3,2, 4,4,7,6,5, 5,8,13,12,11,10,9, 6,14,16,15,19,18,17, 8,20,23,22,21,27,26,25,24, 32,30,35,34,33,32,31,41,40,39,38,37,36])))
+            self.assertTrue(m.getNodalConnectivityIndex().isEqual(ref0))
+            pass
+
+        def level3(self):
+            m=MEDCouplingUMesh("",3)
+            m.allocateCells()
+            m.insertNextCell(NORM_TETRA4,[1,2,3,4])
+            m.insertNextCell(NORM_PYRA5,[5,6,7,8,9])
+            m.insertNextCell(NORM_PENTA6,[10,11,12,13,14,15])
+            m.insertNextCell(NORM_HEXA8,[20,21,22,23,24,25,26,27])
+            m.insertNextCell(NORM_TETRA10,[30,31,32,33,34,35,36,37,38,39])
+            m.insertNextCell(NORM_PYRA13,[40,41,42,43,44,45,46,47,48,49,50,51,52])
+            m.insertNextCell(NORM_HEXA20,[60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79])
+            m.insertNextCell(NORM_PENTA15,[80,81,82,83,84,85,86,87,88,89,90,91,92,93,94])
+            ref0=DataArrayInt([0,5,11,18,27,38,52,73,89])
+            self.assertTrue(m.getNodalConnectivityIndex().isEqual(ref0))
+            m.invertOrientationOfAllCells()
+            self.assertTrue(m.getNodalConnectivity().isEqual(DataArrayInt([14,1,3,2,4, 15,5,8,7,6,9, 16,10,12,11,13,15,14, 18,20,23,22,21,24,27,26,25, 20,30,32,31,33,36,35,34,37,39,38, 23,40,43,42,41,44,48,47,46,45,49,52,51,50, 30,60,63,62,61,64,67,66,65,71,70,69,68,75,74,73,72,76,79,78,77, 25,80,82,81,83,85,84,88,87,86,91,90,89,92,94,93])))
+            self.assertTrue(m.getNodalConnectivityIndex().isEqual(ref0))
+            pass
+
+        def gtumesh(self):
+            m=MEDCoupling1SGTUMesh("",NORM_SEG2)
+            m.setNodalConnectivity(DataArrayInt([1,2,3,4,5,6,7,8]))
+            self.assertEqual(m.getNumberOfCells(),4)
+            m2=m.deepCopy()
+            self.assertTrue(m2.isEqual(m,0.))
+            m.invertOrientationOfAllCells()
+            self.assertTrue(not m2.isEqual(m,0.))
+            m.getNodalConnectivity().isEqual(DataArrayInt([2,1,4,3,6,5,8,7]))
+            m.invertOrientationOfAllCells()
+            self.assertTrue(m2.isEqual(m,0.))
+            #
+            p=MEDCoupling1DGTUMesh("",NORM_POLYGON)
+            ref0=DataArrayInt([0,3,7,12])
+            p.setNodalConnectivity(DataArrayInt([1,2,3, 10,11,12,13, 20,21,22,23,24]),ref0)
+            p2=p.deepCopy()
+            self.assertTrue(p2.isEqual(p,0.))
+            self.assertEqual(p.getNumberOfCells(),3)
+            p.invertOrientationOfAllCells()
+            self.assertTrue(not p2.isEqual(p,0.))
+            self.assertTrue(p.getNodalConnectivityIndex().isEqual(ref0))
+            self.assertTrue(p.getNodalConnectivity().isEqual(DataArrayInt([1,3,2, 10,13,12,11, 20,24,23,22,21])))
+            p.invertOrientationOfAllCells()
+            self.assertTrue(p2.isEqual(p,0.))
+            pass
+        level1(self)
+        level2(self)
+        level3(self)
+        gtumesh(self)
+        pass
+    pass
+
+if __name__ == '__main__':
+    unittest.main()
index a1a557ecc487f7d8059e1240bd00d53a7d244b70..d97b69bbb5904aa1f0726e35220fa71beb8ddbdd 100644 (file)
@@ -38,6 +38,7 @@
 #include "MEDCouplingField.hxx"
 #include "MEDCouplingFieldDouble.hxx"
 #include "MEDCouplingFieldInt.hxx"
+#include "MEDCouplingFieldFloat.hxx"
 #include "MEDCouplingFieldTemplate.hxx"
 #include "MEDCouplingGaussLocalization.hxx"
 #include "MCAuto.hxx"
@@ -173,6 +174,8 @@ using namespace INTERP_KERNEL;
 %init %{ import_array(); %}
 #endif
 
+%init %{ initializeMe(); %}
+
 %feature("autodoc", "1");
 %feature("docstring");
 
@@ -239,6 +242,18 @@ using namespace INTERP_KERNEL;
 %newobject MEDCoupling::MEDCouplingFieldInt::deepCopy;
 %newobject MEDCoupling::MEDCouplingFieldInt::clone;
 %newobject MEDCoupling::MEDCouplingFieldInt::cloneWithMesh;
+%newobject MEDCoupling::MEDCouplingFieldInt::buildSubPart;
+%newobject MEDCoupling::MEDCouplingFieldInt::buildSubPartRange;
+%newobject MEDCoupling::MEDCouplingFieldInt::__getitem__;
+%newobject MEDCoupling::MEDCouplingFieldFloat::New;
+%newobject MEDCoupling::MEDCouplingFieldFloat::convertToDblField;
+%newobject MEDCoupling::MEDCouplingFieldFloat::getArray;
+%newobject MEDCoupling::MEDCouplingFieldFloat::deepCopy;
+%newobject MEDCoupling::MEDCouplingFieldFloat::clone;
+%newobject MEDCoupling::MEDCouplingFieldFloat::cloneWithMesh;
+%newobject MEDCoupling::MEDCouplingFieldFloat::buildSubPart;
+%newobject MEDCoupling::MEDCouplingFieldFloat::buildSubPartRange;
+%newobject MEDCoupling::MEDCouplingFieldFloat::__getitem__;
 %newobject MEDCoupling::MEDCouplingFieldTemplate::New;
 %newobject MEDCoupling::MEDCouplingMesh::deepCopy;
 %newobject MEDCoupling::MEDCouplingMesh::clone;
@@ -412,6 +427,9 @@ using namespace INTERP_KERNEL;
 %newobject MEDCoupling::MEDCouplingGaussLocalization::localizePtsInRefCooForEachCell;
 %newobject MEDCoupling::MEDCouplingGaussLocalization::buildRefCell;
 %newobject MEDCoupling::MEDCouplingSkyLineArray::BuildFromPolyhedronConn;
+%newobject MEDCoupling::MEDCouplingSkyLineArray::getSuperIndexArray;
+%newobject MEDCoupling::MEDCouplingSkyLineArray::getIndexArray;
+%newobject MEDCoupling::MEDCouplingSkyLineArray::getValuesArray;
 
 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
 %feature("unref") MEDCouplingMesh "$this->decrRef();"
@@ -457,6 +475,18 @@ using namespace INTERP_KERNEL;
 %include "MEDCouplingRefCountObject.i"
 %include "MEDCouplingMemArray.i"
 
+%{
+  void initializeMe()
+  {// AGY : here initialization of C++ traits in MEDCouplingDataArrayTypemaps.i for code factorization. Awful, I know, but no other solutions.
+    SWIGTITraits<double>::TI=SWIGTYPE_p_MEDCoupling__DataArrayDouble;
+    SWIGTITraits<float>::TI=SWIGTYPE_p_MEDCoupling__DataArrayFloat;
+    SWIGTITraits<int>::TI=SWIGTYPE_p_MEDCoupling__DataArrayInt;
+    SWIGTITraits<double>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple;
+    SWIGTITraits<float>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayFloatTuple;
+    SWIGTITraits<int>::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayIntTuple;
+  }
+%}
+
 namespace INTERP_KERNEL
 { 
   /*!
@@ -739,7 +769,7 @@ namespace MEDCoupling
          {
            int sw,sz(-1);
            int v0; std::vector<int> v1;
-           const int *ids(convertObjToPossibleCpp1_Safe(li,sw,sz,v0,v1));
+           const int *ids(convertIntStarLikePyObjToCppIntStar(li,sw,sz,v0,v1));
            self->renumberCells(ids,check);
          }
 
@@ -821,7 +851,7 @@ namespace MEDCoupling
            int spaceDim=self->getSpaceDimension();
            INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
            self->getBoundingBox(tmp);
-           PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,spaceDim);
+           PyObject *ret=convertDblArrToPyListOfTuple<double>(tmp,2,spaceDim);
            return ret;
          }
 
@@ -841,7 +871,7 @@ namespace MEDCoupling
          {
            int szArr,sw,iTypppArr;
            std::vector<int> stdvecTyyppArr;
-           const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+           const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
            MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
            if(sw==3)//DataArrayInt
              { 
@@ -859,7 +889,7 @@ namespace MEDCoupling
            int szArr,sw,iTypppArr;
            std::vector<int> stdvecTyyppArr;
            DataArrayInt *arr=0;
-           const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+           const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
            MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
            if(sw==3)//DataArrayInt
              { 
@@ -1189,10 +1219,6 @@ namespace MEDCoupling
     int getNumberOf() const;
     int getLength() const;
     
-    DataArrayInt* getSuperIndexArray() const;
-    DataArrayInt* getIndexArray() const;
-    DataArrayInt* getValuesArray() const;
-
     void deletePack(const int i, const int j) throw(INTERP_KERNEL::Exception);
     
     %extend 
@@ -1221,6 +1247,30 @@ namespace MEDCoupling
       {
         return self->simpleRepr();
       }
+      
+      DataArrayInt *getSuperIndexArray() const
+      {
+        DataArrayInt *ret(self->getSuperIndexArray());
+        if(ret)
+          ret->incrRef();
+        return ret;
+      }
+      
+      DataArrayInt *getIndexArray() const
+      {
+        DataArrayInt *ret(self->getIndexArray());
+        if(ret)
+          ret->incrRef();
+        return ret;
+      }
+      
+      DataArrayInt *getValuesArray() const
+      {
+        DataArrayInt *ret(self->getValuesArray());
+        if(ret)
+          ret->incrRef();
+        return ret;
+      }
      
       PyObject *getSimplePackSafe(int absolutePackId) const throw(INTERP_KERNEL::Exception)
       {
@@ -1313,6 +1363,7 @@ namespace MEDCoupling
       virtual void renumberNodesWithOffsetInConn(int offset) throw(INTERP_KERNEL::Exception);
       virtual bool areAllNodesFetched() const throw(INTERP_KERNEL::Exception);
       virtual MEDCouplingFieldDouble *computeDiameterField() const throw(INTERP_KERNEL::Exception);
+      virtual void invertOrientationOfAllCells() throw(INTERP_KERNEL::Exception);
       %extend 
          {
            std::string __str__() const throw(INTERP_KERNEL::Exception)
@@ -1352,7 +1403,7 @@ namespace MEDCoupling
            {
              int szArr,sw,iTypppArr;
              std::vector<int> stdvecTyyppArr;
-             const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+             const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
              MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
              if(sw==3)//DataArrayInt
                { 
@@ -1369,7 +1420,7 @@ namespace MEDCoupling
            {
              int szArr,sw,iTypppArr;
              std::vector<int> stdvecTyyppArr;
-             const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+             const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
              MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
              if(sw==3)//DataArrayInt
                { 
@@ -1386,7 +1437,7 @@ namespace MEDCoupling
            {
              int szArr,sw,iTypppArr;
              std::vector<int> stdvecTyyppArr;
-             const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+             const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
              MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
              if(sw==3)//DataArrayInt
                { 
@@ -1409,7 +1460,7 @@ namespace MEDCoupling
            {
              int szArr,sw,iTypppArr;
              std::vector<int> stdvecTyyppArr;
-             const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+             const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
              MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
              if(sw==3)//DataArrayInt
                { 
@@ -1426,7 +1477,7 @@ namespace MEDCoupling
            {
              int szArr,sw,iTypppArr;
              std::vector<int> stdvecTyyppArr;
-             const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+             const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
              self->renumberNodes(tmp,newNbOfNodes);
            }
 
@@ -1434,7 +1485,7 @@ namespace MEDCoupling
            {
              int szArr,sw,iTypppArr;
              std::vector<int> stdvecTyyppArr;
-             const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+             const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
              self->renumberNodesCenter(tmp,newNbOfNodes);
            }
 
@@ -1551,7 +1602,7 @@ namespace MEDCoupling
              std::vector<int> multiVal;
              std::pair<int, std::pair<int,int> > slic;
              MEDCoupling::DataArrayInt *daIntTyypp=0;
-             convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
+             convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
              switch(sw)
                {
                case 1:
@@ -1612,7 +1663,7 @@ namespace MEDCoupling
              //
              int szArr,sw,iTypppArr;
              std::vector<int> stdvecTyyppArr;
-             const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+             const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
              self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
              return ret;
            }
@@ -1669,7 +1720,7 @@ namespace MEDCoupling
              std::pair<int, std::pair<int,int> > slic;
              MEDCoupling::DataArrayInt *daIntTyypp=0;
              int nbc=self->getNumberOfCells();
-             convertObjToPossibleCpp2(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
+             convertIntStarOrSliceLikePyObjToCpp(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
              switch(sw)
                {
                case 1:
@@ -1990,7 +2041,7 @@ namespace MEDCoupling
         std::pair<int, std::pair<int,int> > slic;
         MEDCoupling::DataArrayInt *daIntTyypp=0;
         int nbc=self->getNumberOfCells();
-        convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
+        convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
         switch(sw)
           {
           case 1:
@@ -2048,7 +2099,7 @@ namespace MEDCoupling
         std::pair<int, std::pair<int,int> > slic;
         MEDCoupling::DataArrayInt *daIntTyypp=0;
         int nbc=self->getNumberOfCells();
-        convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
+        convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
         switch(sw)
           {
           case 1:
@@ -2107,7 +2158,7 @@ namespace MEDCoupling
       {
         int szArr,sw,iTypppArr;
         std::vector<int> stdvecTyyppArr;
-        const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+        const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
         if(size>szArr)
           {
             std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
@@ -2120,7 +2171,7 @@ namespace MEDCoupling
       {
         int szArr,sw,iTypppArr;
         std::vector<int> stdvecTyyppArr;
-        const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+        const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
         self->insertNextCell(type,szArr,tmp);
       }
       
@@ -2143,7 +2194,7 @@ namespace MEDCoupling
       {
         int szArr,sw,iTypppArr;
         std::vector<int> stdvecTyyppArr;
-        const int *seedPtr=convertObjToPossibleCpp1_Safe(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
+        const int *seedPtr=convertIntStarLikePyObjToCppIntStar(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
         int nbOfDepthPeelingPerformed=0;
         DataArrayInt *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
         PyObject *res=PyTuple_New(2);
@@ -2294,7 +2345,7 @@ namespace MEDCoupling
         std::vector<int> multiVal;
         std::pair<int, std::pair<int,int> > slic;
         MEDCoupling::DataArrayInt *daIntTyypp=0;
-        convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
+        convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
         switch(sw)
           {
           case 1:
@@ -2315,7 +2366,7 @@ namespace MEDCoupling
         std::vector<int> multiVal;
         std::pair<int, std::pair<int,int> > slic;
         MEDCoupling::DataArrayInt *daIntTyypp=0;
-        convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
+        convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
         switch(sw)
           {
           case 1:
@@ -2412,7 +2463,7 @@ namespace MEDCoupling
         MEDCoupling::DataArrayInt *daIntTyypp=0;
         if(!arrIndx)
           throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
-        convertObjToPossibleCpp2(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
+        convertIntStarOrSliceLikePyObjToCpp(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
         switch(sw)
           {
           case 1:
@@ -2436,7 +2487,7 @@ namespace MEDCoupling
         MEDCoupling::DataArrayInt *daIntTyypp=0;
         if(!arrIndxIn)
           throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
-        convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
+        convertIntStarOrSliceLikePyObjToCpp(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
         switch(sw)
           {
           case 1:
@@ -2478,13 +2529,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);
@@ -2505,7 +2555,7 @@ namespace MEDCoupling
         MEDCoupling::DataArrayInt *daIntTyypp=0;
         if(!arrIndxIn)
           throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : null pointer as arrIndex !");
-        convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
+        convertIntStarOrSliceLikePyObjToCpp(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
         switch(sw)
           {
           case 1:
@@ -2542,7 +2592,7 @@ namespace MEDCoupling
         MEDCoupling::DataArrayInt *daIntTyypp=0;
         if(!arrIndxIn)
           throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
-        convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
+        convertIntStarOrSliceLikePyObjToCpp(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
         switch(sw)
           {
           case 1:
@@ -2615,7 +2665,7 @@ namespace MEDCoupling
         double vals[6];
         std::copy(vec,vec+3,vals);
         std::copy(pos,pos+3,vals+3);
-        return convertDblArrToPyListOfTuple(vals,3,2);
+        return convertDblArrToPyListOfTuple<double>(vals,3,2);
       }
       
       static MEDCouplingUMesh *MergeUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
@@ -2665,6 +2715,19 @@ namespace MEDCoupling
         return ret;
       }
 
+      PyObject *explodeIntoEdges() const throw(INTERP_KERNEL::Exception)
+      {
+        MCAuto<DataArrayInt> desc,descIndex,revDesc,revDescIndx;
+        MCAuto<MEDCouplingUMesh> m(self->explodeIntoEdges(desc,descIndex,revDesc,revDescIndx));
+        PyObject *ret=PyTuple_New(5);
+        PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
+        PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(desc.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+        PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(descIndex.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+        PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(revDesc.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+        PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(revDescIndx.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+        return ret;
+      }
+
       PyObject *explodeMeshIntoMicroEdges() const throw(INTERP_KERNEL::Exception)
       {
         MCAuto<DataArrayInt> d0=DataArrayInt::New();
@@ -2732,6 +2795,16 @@ namespace MEDCoupling
         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
         return ret;
       }
+
+      PyObject *computeEnlargedNeighborsOfNodes() const throw(INTERP_KERNEL::Exception)
+      {
+        MCAuto<DataArrayInt> neighbors,neighborsIdx;
+        self->computeEnlargedNeighborsOfNodes(neighbors,neighborsIdx);
+        PyObject *ret=PyTuple_New(2);
+        PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+        PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+        return ret;
+      }
       
       PyObject *computeCellNeighborhoodFromNodesOne(const DataArrayInt *nodeNeigh, const DataArrayInt *nodeNeighI) const throw(INTERP_KERNEL::Exception)
       {
@@ -2926,7 +2999,7 @@ namespace MEDCoupling
         std::vector<int> pos2;
         DataArrayInt *pos3=0;
         DataArrayIntTuple *pos4=0;
-        convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
+        convertIntStarLikePyObjToCpp(li,sw,pos1,pos2,pos3,pos4);
         switch(sw)
           {
           case 1:
@@ -3044,7 +3117,7 @@ namespace MEDCoupling
       {
         int szArr,sw,iTypppArr;
         std::vector<int> stdvecTyyppArr;
-        const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+        const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
         self->insertNextCell(tmp,tmp+szArr);
       }
 
@@ -3291,7 +3364,7 @@ namespace MEDCoupling
         //
         int szArr,sw,iTypppArr;
         std::vector<int> stdvecTyyppArr;
-        const int *tmp4=convertObjToPossibleCpp1_Safe(st,sw,szArr,iTypppArr,stdvecTyyppArr);
+        const int *tmp4=convertIntStarLikePyObjToCppIntStar(st,sw,szArr,iTypppArr,stdvecTyyppArr);
         std::vector<int> tmp5(tmp4,tmp4+szArr);
         //
         return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
@@ -3349,7 +3422,7 @@ namespace MEDCoupling
       {
         int szArr,sw,iTypppArr;
         std::vector<int> stdvecTyyppArr;
-        const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+        const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
         return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
       }
 
@@ -3357,7 +3430,7 @@ namespace MEDCoupling
       {
         int szArr,sw,iTypppArr;
         std::vector<int> stdvecTyyppArr;
-        const int *tmp(convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr));
+        const int *tmp(convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr));
         return MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh(tmp,tmp+szArr);
       }
 
@@ -3411,10 +3484,10 @@ namespace MEDCoupling
       {
         int szArr,sw,iTypppArr;
         std::vector<int> stdvecTyyppArr;
-        const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+        const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
         int szArr2,sw2,iTypppArr2;
         std::vector<int> stdvecTyyppArr2;
-        const int *tmp2=convertObjToPossibleCpp1_Safe(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
+        const int *tmp2=convertIntStarLikePyObjToCppIntStar(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
         std::vector<int> tmp3(tmp2,tmp2+szArr2);
         std::vector< std::pair<int,int> > partCompactFormat;
         bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
@@ -3585,7 +3658,7 @@ namespace MEDCoupling
       {
         int szArr,sw,iTypppArr;
         std::vector<int> stdvecTyyppArr;
-        const int *tmp=convertObjToPossibleCpp1_Safe(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
+        const int *tmp=convertIntStarLikePyObjToCppIntStar(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
         self->setNodeGridStructure(tmp,tmp+szArr);
       }
     }
@@ -3625,7 +3698,7 @@ namespace MEDCoupling
         const double *originPtr(0),*dxyzPtr(0);
         int sw,sz,val0;
         std::vector<int> bb0;
-        nodeStrctPtr=convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0);
+        nodeStrctPtr=convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0);
         //
         double val,val2;
         std::vector<double> bb,bb2;
@@ -3650,7 +3723,7 @@ namespace MEDCoupling
       {
         int sw,sz,val0;
         std::vector<int> bb0;
-        const int *nodeStrctPtr(convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0));
+        const int *nodeStrctPtr(convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0));
         self->setNodeStruct(nodeStrctPtr,nodeStrctPtr+sz);
       }
 
@@ -3843,7 +3916,7 @@ namespace MEDCoupling
       {
         int sw,sz(-1);
         int v0; std::vector<int> v1;
-        const int *cellIdsBg(convertObjToPossibleCpp1_Safe(cellIds,sw,sz,v0,v1));
+        const int *cellIdsBg(convertIntStarLikePyObjToCppIntStar(cellIds,sw,sz,v0,v1));
         return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
       }
 
@@ -3893,6 +3966,7 @@ namespace MEDCoupling
   {
   public:
     static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception);
+    static MEDCouplingFieldTemplate *New(const MEDCouplingFieldFloat& f) throw(INTERP_KERNEL::Exception);
     static MEDCouplingFieldTemplate *New(const MEDCouplingFieldInt& f) throw(INTERP_KERNEL::Exception);
     static MEDCouplingFieldTemplate *New(TypeOfField type);
     std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
@@ -3904,6 +3978,11 @@ namespace MEDCoupling
            return MEDCouplingFieldTemplate::New(f);
          }
 
+         MEDCouplingFieldTemplate(const MEDCouplingFieldFloat& f) throw(INTERP_KERNEL::Exception)
+         {
+           return MEDCouplingFieldTemplate::New(f);
+         }
+         
          MEDCouplingFieldTemplate(const MEDCouplingFieldInt& f) throw(INTERP_KERNEL::Exception)
          {
            return MEDCouplingFieldTemplate::New(f);
@@ -4139,7 +4218,7 @@ namespace MEDCoupling
         int sz=self->getNumberOfComponents();
         INTERP_KERNEL::AutoPtr<double> res=new double[sz];
         self->getValueOn(spaceLoc,res);
-        return convertDblArrToPyList(res,sz);
+        return convertDblArrToPyList<double>(res,sz);
       }
 
        PyObject *getValueOnPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception)
@@ -4147,7 +4226,7 @@ namespace MEDCoupling
          int sz=self->getNumberOfComponents();
          INTERP_KERNEL::AutoPtr<double> res=new double[sz];
          self->getValueOnPos(i,j,k,res);
-         return convertDblArrToPyList(res,sz);
+         return convertDblArrToPyList<double>(res,sz);
        }
 
       DataArrayDouble *getValueOnMulti(PyObject *locs) const throw(INTERP_KERNEL::Exception)
@@ -4181,7 +4260,7 @@ namespace MEDCoupling
         int sz=self->getNumberOfComponents();
         INTERP_KERNEL::AutoPtr<double> res=new double[sz];
         self->getValueOn(spaceLoc,time,res);
-        return convertDblArrToPyList(res,sz);
+        return convertDblArrToPyList<double>(res,sz);
       }
 
       void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
@@ -4233,41 +4312,41 @@ namespace MEDCoupling
         int sz=self->getNumberOfComponents();
         INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
         self->accumulate(tmp);
-        return convertDblArrToPyList(tmp,sz);
+        return convertDblArrToPyList<double>(tmp,sz);
       }
       PyObject *integral(bool isWAbs) const throw(INTERP_KERNEL::Exception)
       {
         int sz=self->getNumberOfComponents();
         INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
         self->integral(isWAbs,tmp);
-        return convertDblArrToPyList(tmp,sz);
+        return convertDblArrToPyList<double>(tmp,sz);
       }
       PyObject *getWeightedAverageValue(bool isWAbs=true) const throw(INTERP_KERNEL::Exception)
       {
         int sz=self->getNumberOfComponents();
         INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
         self->getWeightedAverageValue(tmp,isWAbs);
-        return convertDblArrToPyList(tmp,sz);
+        return convertDblArrToPyList<double>(tmp,sz);
       }
       PyObject *normL1() const throw(INTERP_KERNEL::Exception)
       {
         int sz=self->getNumberOfComponents();
         INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
         self->normL1(tmp);
-        return convertDblArrToPyList(tmp,sz);
+        return convertDblArrToPyList<double>(tmp,sz);
       }
       PyObject *normL2() const throw(INTERP_KERNEL::Exception)
       {
         int sz=self->getNumberOfComponents();
         INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
         self->normL2(tmp);
-        return convertDblArrToPyList(tmp,sz);
+        return convertDblArrToPyList<double>(tmp,sz);
       }
       void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
       {
         int szArr,sw,iTypppArr;
         std::vector<int> stdvecTyyppArr;
-        const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+        const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
         self->renumberCells(tmp,check);
       }
       
@@ -4275,7 +4354,7 @@ namespace MEDCoupling
       {
         int szArr,sw,iTypppArr;
         std::vector<int> stdvecTyyppArr;
-        const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+        const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
         self->renumberCellsWithoutMesh(tmp,check);
       }
       
@@ -4283,7 +4362,7 @@ namespace MEDCoupling
       {
         int szArr,sw,iTypppArr;
         std::vector<int> stdvecTyyppArr;
-        const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+        const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
         self->renumberNodes(tmp,eps);
       }
 
@@ -4291,125 +4370,18 @@ namespace MEDCoupling
       {
         int szArr,sw,iTypppArr;
         std::vector<int> stdvecTyyppArr;
-        const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+        const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
         self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
       }
 
       MEDCouplingFieldDouble *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
       {
-        int sw;
-        int singleVal;
-        std::vector<int> multiVal;
-        std::pair<int, std::pair<int,int> > slic;
-        MEDCoupling::DataArrayInt *daIntTyypp=0;
-        const MEDCouplingMesh *mesh=self->getMesh();
-        if(!mesh)
-          throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !");
-        int nbc=mesh->getNumberOfCells();
-        convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
-        switch(sw)
-          {
-          case 1:
-            {
-              if(singleVal>=nbc)
-                {
-                  std::ostringstream oss;
-                  oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
-                  throw INTERP_KERNEL::Exception(oss.str().c_str());
-                }
-              if(singleVal>=0)
-                return self->buildSubPart(&singleVal,&singleVal+1);
-              else
-                {
-                  if(nbc+singleVal>0)
-                    {
-                      int tmp=nbc+singleVal;
-                      return self->buildSubPart(&tmp,&tmp+1);
-                    }
-                  else
-                    {
-                      std::ostringstream oss;
-                      oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
-                      throw INTERP_KERNEL::Exception(oss.str().c_str());
-                    }
-                }
-            }
-          case 2:
-            {
-              return self->buildSubPart(&multiVal[0],&multiVal[0]+multiVal.size());
-            }
-          case 3:
-            {
-              return self->buildSubPartRange(slic.first,slic.second.first,slic.second.second);
-            }
-          case 4:
-            {
-              if(!daIntTyypp)
-                throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : null instance has been given in input !");
-              daIntTyypp->checkAllocated();
-              return self->buildSubPart(daIntTyypp->begin(),daIntTyypp->end());
-            }
-          default:
-            throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
-          }
+        return fieldT_buildSubPart(self,li);
       }
 
       MEDCouplingFieldDouble *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
       {
-        const char msg[]="MEDCouplingFieldDouble::__getitem__ : invalid call  Available API are : \n-myField[dataArrayInt]\n-myField[slice]\n-myField[pythonListOfCellIds]\n-myField[integer]\n-myField[dataArrayInt,1]\n-myField[slice,1]\n-myField[pythonListOfCellIds,1]\n-myField[integer,1]\n";
-        if(PyTuple_Check(li))
-          {
-            Py_ssize_t sz=PyTuple_Size(li);
-            if(sz!=2)
-              throw INTERP_KERNEL::Exception(msg);
-            PyObject *elt0=PyTuple_GetItem(li,0),*elt1=PyTuple_GetItem(li,1);
-            int sw;
-            int singleVal;
-            std::vector<int> multiVal;
-            std::pair<int, std::pair<int,int> > slic;
-            MEDCoupling::DataArrayInt *daIntTyypp=0;
-            if(!self->getArray())
-              throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array set on field to deduce number of components !");
-            try
-              { convertObjToPossibleCpp2(elt1,self->getArray()->getNumberOfComponents(),sw,singleVal,multiVal,slic,daIntTyypp); }
-            catch(INTERP_KERNEL::Exception& e)
-              { std::ostringstream oss; oss << "MEDCouplingFieldDouble::__getitem__ : invalid type in 2nd parameter (compo) !" << e.what(); throw INTERP_KERNEL::Exception(oss.str().c_str()); }
-            MCAuto<MEDCouplingFieldDouble> ret0=MEDCoupling_MEDCouplingFieldDouble_buildSubPart(self,elt0);
-            DataArrayDouble *ret0Arr=ret0->getArray();
-            if(!ret0Arr)
-              throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array exists to apply restriction on component on it !");
-            switch(sw)
-              {
-              case 1:
-                {
-                  std::vector<int> v2(1,singleVal);
-                  MCAuto<DataArrayDouble> aarr(ret0Arr->keepSelectedComponents(v2));
-                  ret0->setArray(aarr);
-                  return ret0.retn();
-                }
-              case 2:
-                {
-                  MCAuto<DataArrayDouble> aarr(ret0Arr->keepSelectedComponents(multiVal));
-                  ret0->setArray(aarr);
-                  return ret0.retn();
-                }
-              case 3:
-                {
-                  int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(slic.first,slic.second.first,slic.second.second,"MEDCouplingFieldDouble::__getitem__ : invalid range in 2nd parameter (components) !");
-                  std::vector<int> v2(nbOfComp);
-                  for(int i=0;i<nbOfComp;i++)
-                    v2[i]=slic.first+i*slic.second.second;
-                  MCAuto<DataArrayDouble> aarr(ret0Arr->keepSelectedComponents(v2));
-                  ret0->setArray(aarr);
-                  return ret0.retn();
-                }
-              default:
-                throw INTERP_KERNEL::Exception(msg);
-              }
-            
-          }
-        else
-          return MEDCoupling_MEDCouplingFieldDouble_buildSubPart(self,li);
+        return fieldT__getitem__(self,li);
       }
 
       PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
@@ -4492,7 +4464,7 @@ namespace MEDCoupling
         DataArrayDoubleTuple *aa;
         std::vector<double> bb;
         int sw;
-        convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+        convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
         switch(sw)
           {
           case 1:
@@ -4574,7 +4546,7 @@ namespace MEDCoupling
         DataArrayDoubleTuple *aa;
         std::vector<double> bb;
         int sw;
-        convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+        convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
         switch(sw)
           {
           case 1:
@@ -4648,7 +4620,7 @@ namespace MEDCoupling
         DataArrayDoubleTuple *aa;
         std::vector<double> bb;
         int sw;
-        convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+        convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
         switch(sw)
           {
           case 1:
@@ -4724,7 +4696,7 @@ namespace MEDCoupling
         DataArrayDoubleTuple *aa;
         std::vector<double> bb;
         int sw;
-        convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+        convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
         switch(sw)
           {
           case 1:
@@ -4790,7 +4762,7 @@ namespace MEDCoupling
         DataArrayDoubleTuple *aa;
         std::vector<double> bb;
         int sw;
-        convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+        convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
         switch(sw)
           {
           case 1:
@@ -4856,7 +4828,7 @@ namespace MEDCoupling
         DataArrayDoubleTuple *aa;
         std::vector<double> bb;
         int sw;
-        convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+        convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
         switch(sw)
           {
           case 1:
@@ -4922,7 +4894,7 @@ namespace MEDCoupling
         DataArrayDoubleTuple *aa;
         std::vector<double> bb;
         int sw;
-        convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+        convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
         switch(sw)
           {
           case 1:
@@ -4990,7 +4962,7 @@ namespace MEDCoupling
         DataArrayDoubleTuple *aa;
         std::vector<double> bb;
         int sw;
-        convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+        convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
         switch(sw)
           {
           case 1:
@@ -5048,156 +5020,32 @@ namespace MEDCoupling
 
       PyObject *getTinySerializationInformation() const throw(INTERP_KERNEL::Exception)
       {
-        std::vector<double> a0;
-        std::vector<int> a1;
-        std::vector<std::string> a2;
-        self->getTinySerializationDbleInformation(a0);
-        self->getTinySerializationIntInformation(a1);
-        self->getTinySerializationStrInformation(a2);
-        //
-        PyObject *ret(PyTuple_New(3));
-        PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0));
-        PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1));
-        int sz(a2.size());
-        PyObject *ret2(PyList_New(sz));
-        {
-          for(int i=0;i<sz;i++)
-            PyList_SetItem(ret2,i,PyString_FromString(a2[i].c_str()));
-        }
-        PyTuple_SetItem(ret,2,ret2);
-        return ret;
+        return field_getTinySerializationInformation<MEDCouplingFieldDouble>(self);
       }
       
       PyObject *serialize() const throw(INTERP_KERNEL::Exception)
       {
-        DataArrayInt *ret0(0);
-        std::vector<DataArrayDouble *> ret1;
-        self->serialize(ret0,ret1);
-        if(ret0)
-          ret0->incrRef();
-        std::size_t sz(ret1.size());
-        PyObject *ret(PyTuple_New(2));
-        PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
-        PyObject *ret1Py(PyList_New(sz));
-        for(std::size_t i=0;i<sz;i++)
-          {
-            if(ret1[i])
-              ret1[i]->incrRef();
-            PyList_SetItem(ret1Py,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret1[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
-          }
-        PyTuple_SetItem(ret,1,ret1Py);
-        return ret;
+        return field_serialize<double>(self);
       }
 
       static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
       {
-        static const char MSG[]="MEDCouplingFieldDouble.__new__ : the args in input is expected to be a tuple !";
-        if(!PyTuple_Check(args))
-          throw INTERP_KERNEL::Exception(MSG);
-        PyObject *builtinsd(PyEval_GetBuiltins());//borrowed
-        PyObject *obj(PyDict_GetItemString(builtinsd,"object"));//borrowed
-        PyObject *selfMeth(PyObject_GetAttrString(obj,"__new__"));
-        //
-        PyObject *tmp0(PyTuple_New(1));
-        PyTuple_SetItem(tmp0,0,cls); Py_XINCREF(cls);
-        PyObject *instance(PyObject_CallObject(selfMeth,tmp0));
-        Py_DECREF(tmp0);
-        Py_DECREF(selfMeth);
-        if(PyTuple_Size(args)==2 && PyDict_Check(PyTuple_GetItem(args,1)) && PyDict_Size(PyTuple_GetItem(args,1))==1 )
-          {// NOT general case. only true if in unpickeling context ! call __init__. Because for all other cases, __init__ is called right after __new__ !
-            PyObject *initMeth(PyObject_GetAttrString(instance,"__init__"));
-            ////
-            PyObject *a(PyInt_FromLong(0));
-            PyObject *uniqueElt(PyDict_GetItem(PyTuple_GetItem(args,1),a));
-            Py_DECREF(a);
-            if(!uniqueElt)
-              throw INTERP_KERNEL::Exception(MSG);
-            if(!PyTuple_Check(uniqueElt) || PyTuple_Size(uniqueElt)!=2)
-              throw INTERP_KERNEL::Exception(MSG);
-            PyObject *tmp2(PyObject_CallObject(initMeth,uniqueElt));
-            Py_XDECREF(tmp2);
-            ////
-            Py_DECREF(initMeth);
-          }
-        return instance;
+        return NewMethWrapCallInitOnlyIfDictWithSingleEltInInputGeneral<SinglePyObjExpectToBeAListOfSz2>(cls,args,"MEDCouplingFieldDouble");
       }
 
       PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
       {// put an empty dict in input to say to __new__ to call __init__...
-        self->checkConsistencyLight();
-        PyObject *ret(PyTuple_New(1));
-        PyObject *ret0(PyDict_New());
-        {
-          PyObject *a(PyInt_FromLong(0)),*b(PyInt_FromLong(self->getTypeOfField())),*c(PyInt_FromLong(self->getTimeDiscretization()));
-          PyObject *d(PyTuple_New(2)); PyTuple_SetItem(d,0,b); PyTuple_SetItem(d,1,c);
-          PyDict_SetItem(ret0,a,d);
-          Py_DECREF(a); Py_DECREF(d);
-        }
-        PyTuple_SetItem(ret,0,ret0);
-        return ret;
+        return field__getnewargs__<MEDCouplingFieldDouble>(self);
       }
 
       PyObject *__getstate__() const throw(INTERP_KERNEL::Exception)
       {
-        self->checkConsistencyLight();
-        PyObject *ret0(MEDCoupling_MEDCouplingFieldDouble_getTinySerializationInformation(self));
-        PyObject *ret1(MEDCoupling_MEDCouplingFieldDouble_serialize(self));
-        const MEDCouplingMesh *mesh(self->getMesh());
-        if(mesh)
-          mesh->incrRef();
-        PyObject *ret(PyTuple_New(3));
-        PyTuple_SetItem(ret,0,ret0);
-        PyTuple_SetItem(ret,1,ret1);
-        PyTuple_SetItem(ret,2,convertMesh(const_cast<MEDCouplingMesh *>(mesh),SWIG_POINTER_OWN | 0 ));
-        return ret;
+        return field__getstate__<MEDCouplingFieldDouble>(self,MEDCoupling_MEDCouplingFieldDouble_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldDouble_serialize);
       }
       
       void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
       {
-        static const char MSG[]="MEDCouplingFieldDouble.__setstate__ : expected input is a tuple of size 3 !";
-        if(!PyTuple_Check(inp))
-          throw INTERP_KERNEL::Exception(MSG);
-        int sz(PyTuple_Size(inp));
-        if(sz!=3)
-          throw INTERP_KERNEL::Exception(MSG);
-        // mesh
-        PyObject *elt2(PyTuple_GetItem(inp,2));
-        void *argp=0;
-        int status(SWIG_ConvertPtr(elt2,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingMesh,0|0));
-        if(!SWIG_IsOK(status))
-          throw INTERP_KERNEL::Exception(MSG);
-        self->setMesh(reinterpret_cast< const MEDCouplingUMesh * >(argp));
-        //
-        PyObject *elt0(PyTuple_GetItem(inp,0));
-        PyObject *elt1(PyTuple_GetItem(inp,1));
-        std::vector<double> a0;
-        std::vector<int> a1;
-        std::vector<std::string> a2;
-        DataArrayInt *b0(0);
-        std::vector<DataArrayDouble *>b1;
-        {
-          if(!PyTuple_Check(elt0) && PyTuple_Size(elt0)!=3)
-            throw INTERP_KERNEL::Exception(MSG);
-          PyObject *a0py(PyTuple_GetItem(elt0,0)),*a1py(PyTuple_GetItem(elt0,1)),*a2py(PyTuple_GetItem(elt0,2));
-          int tmp(-1);
-          fillArrayWithPyListDbl3(a0py,tmp,a0);
-          convertPyToNewIntArr3(a1py,a1);
-          fillStringVector(a2py,a2);
-        }
-        {
-          if(!PyTuple_Check(elt1) && PyTuple_Size(elt1)!=2)
-            throw INTERP_KERNEL::Exception(MSG);
-          PyObject *b0py(PyTuple_GetItem(elt1,0)),*b1py(PyTuple_GetItem(elt1,1));
-          void *argp(0);
-          int status(SWIG_ConvertPtr(b0py,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0));
-          if(!SWIG_IsOK(status))
-            throw INTERP_KERNEL::Exception(MSG);
-          b0=reinterpret_cast<DataArrayInt *>(argp);
-          convertFromPyObjVectorOfObj<MEDCoupling::DataArrayDouble *>(b1py,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",b1);
-        }
-        self->checkForUnserialization(a1,b0,b1);
-        // useless here to call resizeForUnserialization because arrays are well resized.
-        self->finishUnserialization(a1,a0,a2);
+        field__setstate__<double>(self,inp);
       }
     }
   };
@@ -5372,6 +5220,7 @@ namespace MEDCoupling
     MEDCouplingFieldInt *clone(bool recDeepCpy) const throw(INTERP_KERNEL::Exception);
     MEDCouplingFieldInt *cloneWithMesh(bool recDeepCpy) const throw(INTERP_KERNEL::Exception);
     MEDCouplingFieldDouble *convertToDblField() const throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldInt *buildSubPartRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception);
     %extend {
       MEDCouplingFieldInt(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
       {
@@ -5395,13 +5244,23 @@ namespace MEDCoupling
         return oss.str();
       }
 
+      MEDCouplingFieldInt *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
+      {
+        return fieldT_buildSubPart(self,li);
+      }
+
+      MEDCouplingFieldInt *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
+      {
+        return fieldT__getitem__(self,li);
+      }
+
       DataArrayInt *getArray() throw(INTERP_KERNEL::Exception)
-        {
-          DataArrayInt *ret=self->getArray();
-          if(ret)
-            ret->incrRef();
-          return ret;
-        }
+      {
+        DataArrayInt *ret=self->getArray();
+        if(ret)
+          ret->incrRef();
+        return ret;
+      }
       
       PyObject *getTime() throw(INTERP_KERNEL::Exception)
         {
@@ -5413,6 +5272,134 @@ namespace MEDCoupling
         PyList_SetItem(res,2,SWIG_From_int(tmp2));
         return res;
         }
+
+      PyObject *getTinySerializationInformation() const throw(INTERP_KERNEL::Exception)
+      {
+        return field_getTinySerializationInformation<MEDCouplingFieldInt>(self);
+      }
+      
+      PyObject *serialize() const throw(INTERP_KERNEL::Exception)
+      {
+        return field_serialize<int>(self);
+      }
+
+      static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
+      {
+        return NewMethWrapCallInitOnlyIfDictWithSingleEltInInputGeneral<SinglePyObjExpectToBeAListOfSz2>(cls,args,"MEDCouplingFieldInt");
+      }
+
+      PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
+      {// put an empty dict in input to say to __new__ to call __init__...
+        return field__getnewargs__<MEDCouplingFieldInt>(self);
+      }
+
+      PyObject *__getstate__() const throw(INTERP_KERNEL::Exception)
+      {
+        return field__getstate__<MEDCouplingFieldInt>(self,MEDCoupling_MEDCouplingFieldInt_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldInt_serialize);
+      }
+      
+      void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
+      {
+        field__setstate__<int>(self,inp);
+      }
+    }
+  };
+
+  class MEDCouplingFieldFloat : public MEDCouplingField
+  {
+  public:
+    static MEDCouplingFieldFloat *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
+    static MEDCouplingFieldFloat *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
+    void setTimeUnit(const std::string& unit) throw(INTERP_KERNEL::Exception);
+    std::string getTimeUnit() const throw(INTERP_KERNEL::Exception);
+    void setTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
+    void setArray(DataArrayFloat *array) throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldFloat *deepCopy() const throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldFloat *clone(bool recDeepCpy) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldFloat *cloneWithMesh(bool recDeepCpy) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldDouble *convertToDblField() const throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldFloat *buildSubPartRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception);
+    %extend {
+      MEDCouplingFieldFloat(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
+      {
+        return MEDCouplingFieldFloat::New(type,td);
+      }
+
+      MEDCouplingFieldFloat(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
+      {
+        return MEDCouplingFieldFloat::New(ft,td);
+      }
+
+      std::string __str__() const throw(INTERP_KERNEL::Exception)
+      {
+        return self->simpleRepr();
+      }
+
+      std::string __repr__() const throw(INTERP_KERNEL::Exception)
+      {
+        std::ostringstream oss;
+        self->reprQuickOverview(oss);
+        return oss.str();
+      }
+
+      MEDCouplingFieldFloat *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
+      {
+        return fieldT_buildSubPart(self,li);
+      }
+
+      MEDCouplingFieldFloat *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
+      {
+        return fieldT__getitem__(self,li);
+      }
+
+      DataArrayFloat *getArray() throw(INTERP_KERNEL::Exception)
+      {
+        DataArrayFloat *ret=self->getArray();
+        if(ret)
+          ret->incrRef();
+        return ret;
+      }
+      
+      PyObject *getTime() throw(INTERP_KERNEL::Exception)
+      {
+        int tmp1,tmp2;
+        double tmp0=self->getTime(tmp1,tmp2);
+        PyObject *res = PyList_New(3);
+        PyList_SetItem(res,0,SWIG_From_double(tmp0));
+        PyList_SetItem(res,1,SWIG_From_int(tmp1));
+        PyList_SetItem(res,2,SWIG_From_int(tmp2));
+        return res;
+      }
+
+      PyObject *getTinySerializationInformation() const throw(INTERP_KERNEL::Exception)
+      {
+        return field_getTinySerializationInformation<MEDCouplingFieldFloat>(self);
+      }
+      
+      PyObject *serialize() const throw(INTERP_KERNEL::Exception)
+      {
+        return field_serialize<float>(self);
+      }
+        
+      static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
+      {
+        return NewMethWrapCallInitOnlyIfDictWithSingleEltInInputGeneral<SinglePyObjExpectToBeAListOfSz2>(cls,args,"MEDCouplingFieldFloat");
+      }
+      
+      PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
+      {// put an empty dict in input to say to __new__ to call __init__...
+        return field__getnewargs__<MEDCouplingFieldFloat>(self);
+      }
+      
+      PyObject *__getstate__() const throw(INTERP_KERNEL::Exception)
+      {
+        return field__getstate__<MEDCouplingFieldFloat>(self,MEDCoupling_MEDCouplingFieldFloat_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldFloat_serialize);
+      }
+        
+      void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
+      {
+        field__setstate__<float>(self,inp);
+      }
     }
   };
   
@@ -5784,7 +5771,7 @@ namespace MEDCoupling
         const double *originPtr(0),*dxyzPtr(0);
         int sw,sz,val0;
         std::vector<int> bb0;
-        nodeStrctPtr=convertObjToPossibleCpp1_Safe(nodeStrct,sw,sz,val0,bb0);
+        nodeStrctPtr=convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0);
         //
         double val,val2;
         std::vector<double> bb,bb2;
@@ -6016,6 +6003,6 @@ namespace MEDCoupling
 import os
 __filename=os.environ.get('PYTHONSTARTUP')
 if __filename and os.path.isfile(__filename):
-  execfile(__filename)
+  exec(open(__filename).read())
   pass
 %}
diff --git a/src/MEDCoupling_Swig/MEDCouplingDataArrayTraits.hxx b/src/MEDCoupling_Swig/MEDCouplingDataArrayTraits.hxx
new file mode 100644 (file)
index 0000000..c22b758
--- /dev/null
@@ -0,0 +1,351 @@
+// Copyright (C) 2007-2017  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay (EDF R&D)
+
+#ifndef __MEDCOUPLINGDATAARRAYTRAITS_HXX__
+#define __MEDCOUPLINGDATAARRAYTRAITS_HXX__
+
+#include "MEDCouplingMemArray.hxx"
+
+#include <Python.h>
+
+#ifdef WITH_NUMPY
+#include <numpy/arrayobject.h>
+#if NPY_API_VERSION <= 0x00000006
+#  define MED_NUMPY_OWNDATA NPY_OWNDATA
+#else
+#  define MED_NUMPY_OWNDATA NPY_ARRAY_OWNDATA
+#endif
+#endif
+
+// specific DataArray deallocator callback. This deallocator is used both in the constructor of DataArray and in the toNumPyArr
+// method. This dellocator uses weakref to determine if the linked numArr is still alive or not. If alive the ownership is given to it.
+// if no more alive the "standart" DataArray deallocator is called.
+void numarrdeal(void *pt, void *wron)
+{
+  void **wronc=(void **)wron;
+  PyObject *weakRefOnOwner=reinterpret_cast<PyObject *>(wronc[0]);
+  PyObject *obj=PyWeakref_GetObject(weakRefOnOwner);
+  if(obj!=Py_None)
+    {
+      Py_XINCREF(obj);
+      PyArrayObject *objC=reinterpret_cast<PyArrayObject *>(obj);
+      objC->flags|=MED_NUMPY_OWNDATA;
+      Py_XDECREF(weakRefOnOwner);
+      Py_XDECREF(obj);
+    }
+  else
+    {
+      typedef void (*MyDeallocator)(void *,void *);
+      MyDeallocator deall=(MyDeallocator)wronc[1];
+      deall(pt,NULL);
+      Py_XDECREF(weakRefOnOwner);
+    }
+  delete [] wronc;
+}
+
+template<class MCData>
+struct PyCallBackDataArraySt {
+    PyObject_HEAD
+    MCData *_pt_mc;
+};
+
+typedef struct PyCallBackDataArraySt<MEDCoupling::DataArrayByte> PyCallBackDataArrayChar;
+typedef struct PyCallBackDataArraySt<MEDCoupling::DataArrayInt> PyCallBackDataArrayInt;
+typedef struct PyCallBackDataArraySt<MEDCoupling::DataArrayFloat> PyCallBackDataArrayFloat;
+typedef struct PyCallBackDataArraySt<MEDCoupling::DataArrayDouble> PyCallBackDataArrayDouble;
+
+extern "C"
+{
+  static int callbackmcdataarray___init__(PyObject *self, PyObject *args, PyObject *kwargs) { return 0; }
+  
+  static PyObject *callbackmcdataarraychar___new__(PyTypeObject *type, PyObject *args, PyObject *kwargs)
+  {
+    PyCallBackDataArrayChar *self = (PyCallBackDataArrayChar *) ( type->tp_alloc(type, 0) );
+    return (PyObject *)self;
+  }
+
+  static PyObject *callbackmcdataarrayint___new__(PyTypeObject *type, PyObject *args, PyObject *kwargs)
+  {
+    PyCallBackDataArrayInt *self = (PyCallBackDataArrayInt *) ( type->tp_alloc(type, 0) );
+    return (PyObject *)self;
+  }
+  
+  static PyObject *callbackmcdataarrayfloat___new__(PyTypeObject *type, PyObject *args, PyObject *kwargs)
+  {
+    PyCallBackDataArrayFloat *self = (PyCallBackDataArrayFloat *) ( type->tp_alloc(type, 0) );
+    return (PyObject *)self;
+  }
+  
+  static PyObject *callbackmcdataarraydouble___new__(PyTypeObject *type, PyObject *args, PyObject *kwargs)
+  {
+    PyCallBackDataArrayDouble *self = (PyCallBackDataArrayDouble *) ( type->tp_alloc(type, 0) );
+    return (PyObject *)self;
+  }
+  
+  static void callbackmcdataarray_dealloc(PyObject *self)
+  {
+    Py_TYPE(self)->tp_free(self);
+  }
+
+  
+  // real callback called when a numpy arr having more than one DataArray instance client on it is destroyed.
+  // In this case, all the "weak" clients, except the first one, invoke this call back that desable the content of these "weak" clients.
+  static PyObject *callbackmcdataarraychar_call(PyCallBackDataArrayChar *self, PyObject *args, PyObject *kw)
+  {
+    if(self->_pt_mc)
+      {
+        MEDCoupling::MemArray<char>& mma=self->_pt_mc->accessToMemArray();
+        mma.destroy();
+      }
+    Py_XINCREF(Py_None);
+    return Py_None;
+  }
+
+  // real callback called when a numpy arr having more than one DataArray instance client on it is destroyed.
+  // In this case, all the "weak" clients, except the first one, invoke this call back that desable the content of these "weak" clients.
+  static PyObject *callbackmcdataarrayint_call(PyCallBackDataArrayInt *self, PyObject *args, PyObject *kw)
+  {
+    if(self->_pt_mc)
+      {
+        MEDCoupling::MemArray<int>& mma=self->_pt_mc->accessToMemArray();
+        mma.destroy();
+      }
+    Py_XINCREF(Py_None);
+    return Py_None;
+  }
+
+  // real callback called when a numpy arr having more than one DataArray instance client on it is destroyed.
+  // In this case, all the "weak" clients, except the first one, invoke this call back that desable the content of these "weak" clients.
+  static PyObject *callbackmcdataarrayfloat_call(PyCallBackDataArrayFloat *self, PyObject *args, PyObject *kw)
+  {
+    if(self->_pt_mc)
+      {
+        MEDCoupling::MemArray<float>& mma=self->_pt_mc->accessToMemArray();
+        mma.destroy();
+      }
+    Py_XINCREF(Py_None);
+    return Py_None;
+  }
+  
+  // real callback called when a numpy arr having more than one DataArray instance client on it is destroyed.
+  // In this case, all the "weak" clients, except the first one, invoke this call back that desable the content of these "weak" clients.
+  static PyObject *callbackmcdataarraydouble_call(PyCallBackDataArrayDouble *self, PyObject *args, PyObject *kw)
+  {
+    if(self->_pt_mc)
+      {
+        MEDCoupling::MemArray<double>& mma=self->_pt_mc->accessToMemArray();
+        mma.destroy();
+      }
+    Py_XINCREF(Py_None);
+    return Py_None;
+  }
+}
+
+PyTypeObject PyCallBackDataArrayChar_RefType = {
+  PyVarObject_HEAD_INIT(&PyType_Type, 0)
+  "callbackmcdataarraychar",
+  sizeof(PyCallBackDataArrayChar),
+  0,
+  callbackmcdataarray_dealloc,            /*tp_dealloc*/
+  0,                          /*tp_print*/
+  0,                          /*tp_getattr*/
+  0,                          /*tp_setattr*/
+  0,                          /*tp_compare*/
+  0,                          /*tp_repr*/
+  0,                          /*tp_as_number*/
+  0,                          /*tp_as_sequence*/
+  0,                          /*tp_as_mapping*/
+  0,                          /*tp_hash*/
+  (ternaryfunc)callbackmcdataarraychar_call,  /*tp_call*/
+  0,                          /*tp_str*/
+  0,                          /*tp_getattro*/
+  0,                          /*tp_setattro*/
+  0,                          /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,  /*tp_flags*/
+  0,                          /*tp_doc*/
+  0,                          /*tp_traverse*/
+  0,                          /*tp_clear*/
+  0,                          /*tp_richcompare*/
+  0,                          /*tp_weaklistoffset*/
+  0,                          /*tp_iter*/
+  0,                          /*tp_iternext*/
+  0,                          /*tp_methods*/
+  0,                          /*tp_members*/
+  0,                          /*tp_getset*/
+  0,                          /*tp_base*/
+  0,                          /*tp_dict*/
+  0,                          /*tp_descr_get*/
+  0,                          /*tp_descr_set*/
+  0,                          /*tp_dictoffset*/
+  callbackmcdataarray___init__,           /*tp_init*/
+  PyType_GenericAlloc,        /*tp_alloc*/
+  callbackmcdataarraychar___new__,            /*tp_new*/
+  PyObject_GC_Del,            /*tp_free*/
+};
+
+
+PyTypeObject PyCallBackDataArrayInt_RefType = {
+  PyVarObject_HEAD_INIT(&PyType_Type, 0)
+  "callbackmcdataarrayint",
+  sizeof(PyCallBackDataArrayInt),
+  0,
+  callbackmcdataarray_dealloc,            /*tp_dealloc*/
+  0,                          /*tp_print*/
+  0,                          /*tp_getattr*/
+  0,                          /*tp_setattr*/
+  0,                          /*tp_compare*/
+  0,                          /*tp_repr*/
+  0,                          /*tp_as_number*/
+  0,                          /*tp_as_sequence*/
+  0,                          /*tp_as_mapping*/
+  0,                          /*tp_hash*/
+  (ternaryfunc)callbackmcdataarrayint_call,  /*tp_call*/
+  0,                          /*tp_str*/
+  0,                          /*tp_getattro*/
+  0,                          /*tp_setattro*/
+  0,                          /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,  /*tp_flags*/
+  0,                          /*tp_doc*/
+  0,                          /*tp_traverse*/
+  0,                          /*tp_clear*/
+  0,                          /*tp_richcompare*/
+  0,                          /*tp_weaklistoffset*/
+  0,                          /*tp_iter*/
+  0,                          /*tp_iternext*/
+  0,                          /*tp_methods*/
+  0,                          /*tp_members*/
+  0,                          /*tp_getset*/
+  0,                          /*tp_base*/
+  0,                          /*tp_dict*/
+  0,                          /*tp_descr_get*/
+  0,                          /*tp_descr_set*/
+  0,                          /*tp_dictoffset*/
+  callbackmcdataarray___init__,           /*tp_init*/
+  PyType_GenericAlloc,        /*tp_alloc*/
+  callbackmcdataarrayint___new__,            /*tp_new*/
+  PyObject_GC_Del,            /*tp_free*/
+};
+
+PyTypeObject PyCallBackDataArrayFloat_RefType = {
+  PyVarObject_HEAD_INIT(&PyType_Type, 0)
+  "callbackmcdataarraydouble",
+  sizeof(PyCallBackDataArrayFloat),
+  0,
+  callbackmcdataarray_dealloc,            /*tp_dealloc*/
+  0,                          /*tp_print*/
+  0,                          /*tp_getattr*/
+  0,                          /*tp_setattr*/
+  0,                          /*tp_compare*/
+  0,                          /*tp_repr*/
+  0,                          /*tp_as_number*/
+  0,                          /*tp_as_sequence*/
+  0,                          /*tp_as_mapping*/
+  0,                          /*tp_hash*/
+  (ternaryfunc)callbackmcdataarraydouble_call,  /*tp_call*/
+  0,                          /*tp_str*/
+  0,                          /*tp_getattro*/
+  0,                          /*tp_setattro*/
+  0,                          /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,  /*tp_flags*/
+  0,                          /*tp_doc*/
+  0,                          /*tp_traverse*/
+  0,                          /*tp_clear*/
+  0,                          /*tp_richcompare*/
+  0,                          /*tp_weaklistoffset*/
+  0,                          /*tp_iter*/
+  0,                          /*tp_iternext*/
+  0,                          /*tp_methods*/
+  0,                          /*tp_members*/
+  0,                          /*tp_getset*/
+  0,                          /*tp_base*/
+  0,                          /*tp_dict*/
+  0,                          /*tp_descr_get*/
+  0,                          /*tp_descr_set*/
+  0,                          /*tp_dictoffset*/
+  callbackmcdataarray___init__,           /*tp_init*/
+  PyType_GenericAlloc,        /*tp_alloc*/
+  callbackmcdataarrayfloat___new__,            /*tp_new*/
+  PyObject_GC_Del,            /*tp_free*/
+};
+
+PyTypeObject PyCallBackDataArrayDouble_RefType = {
+  PyVarObject_HEAD_INIT(&PyType_Type, 0)
+  "callbackmcdataarraydouble",
+  sizeof(PyCallBackDataArrayDouble),
+  0,
+  callbackmcdataarray_dealloc,            /*tp_dealloc*/
+  0,                          /*tp_print*/
+  0,                          /*tp_getattr*/
+  0,                          /*tp_setattr*/
+  0,                          /*tp_compare*/
+  0,                          /*tp_repr*/
+  0,                          /*tp_as_number*/
+  0,                          /*tp_as_sequence*/
+  0,                          /*tp_as_mapping*/
+  0,                          /*tp_hash*/
+  (ternaryfunc)callbackmcdataarraydouble_call,  /*tp_call*/
+  0,                          /*tp_str*/
+  0,                          /*tp_getattro*/
+  0,                          /*tp_setattro*/
+  0,                          /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,  /*tp_flags*/
+  0,                          /*tp_doc*/
+  0,                          /*tp_traverse*/
+  0,                          /*tp_clear*/
+  0,                          /*tp_richcompare*/
+  0,                          /*tp_weaklistoffset*/
+  0,                          /*tp_iter*/
+  0,                          /*tp_iternext*/
+  0,                          /*tp_methods*/
+  0,                          /*tp_members*/
+  0,                          /*tp_getset*/
+  0,                          /*tp_base*/
+  0,                          /*tp_dict*/
+  0,                          /*tp_descr_get*/
+  0,                          /*tp_descr_set*/
+  0,                          /*tp_dictoffset*/
+  callbackmcdataarray___init__,           /*tp_init*/
+  PyType_GenericAlloc,        /*tp_alloc*/
+  callbackmcdataarraydouble___new__,            /*tp_new*/
+  PyObject_GC_Del,            /*tp_free*/
+};
+
+template<class T>
+struct NPYTraits
+{
+};
+
+template<>
+struct NPYTraits<double>
+{
+  static const int NPYObjectType=NPY_DOUBLE;
+  static PyTypeObject *NPYFunc;
+  static PyObject *Array_SWIGTYPE;
+};
+
+template<>
+struct NPYTraits<float>
+{
+  static const int NPYObjectType=NPY_FLOAT;
+  static PyTypeObject *NPYFunc;
+  static PyObject *Array_SWIGTYPE;
+};
+
+#endif
index 8cb326457a0aecbfe9be8f1a0e537dd50298ecf2..31c881f06459984973d24815de3e93139cfc2174 100644 (file)
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-// Author : Anthony Geay (CEA/DEN)
+// Author : Anthony Geay (EDF R&D)
 
 #ifndef __MEDCOUPLINGDATAARRAYTYPEMAPS_I__
 #define __MEDCOUPLINGDATAARRAYTYPEMAPS_I__
 
+#if PY_VERSION_HEX >= 0x03000000
+#define PyInt_AS_LONG PyLong_AS_LONG
+#endif
+
 #include "InterpKernelAutoPtr.hxx"
+#include "MEDCouplingDataArrayTraits.hxx"
 
 #include <sstream>
 
+static PyObject *convertArray(MEDCoupling::DataArray *array, int owner)
+{
+  PyObject *ret(NULL);
+  if(!array)
+    {
+      Py_XINCREF(Py_None);
+      return Py_None;
+    }
+  if(dynamic_cast<MEDCoupling::DataArrayDouble *>(array))
+    ret=SWIG_NewPointerObj((void*)array,SWIGTYPE_p_MEDCoupling__DataArrayDouble,owner);
+  if(dynamic_cast<MEDCoupling::DataArrayInt *>(array))
+    ret=SWIG_NewPointerObj((void*)array,SWIGTYPE_p_MEDCoupling__DataArrayInt,owner);
+  if(dynamic_cast<MEDCoupling::DataArrayFloat *>(array))
+    ret=SWIG_NewPointerObj((void*)array,SWIGTYPE_p_MEDCoupling__DataArrayFloat,owner);
+  if(!ret)
+    throw INTERP_KERNEL::Exception("Not recognized type of array on downcast !");
+  return ret;
+}
+
 /*!
  * 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 +72,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())
@@ -72,245 +108,6 @@ int InterpreteNegativeInt(int val, int nbelem)
     return val;
 }
 
-#ifdef WITH_NUMPY
-#include <numpy/arrayobject.h>
-#if NPY_API_VERSION <= 0x00000006
-#  define MED_NUMPY_OWNDATA NPY_OWNDATA
-#else
-#  define MED_NUMPY_OWNDATA NPY_ARRAY_OWNDATA
-#endif
-
-// specific DataArray deallocator callback. This deallocator is used both in the constructor of DataArray and in the toNumPyArr
-// method. This dellocator uses weakref to determine if the linked numArr is still alive or not. If alive the ownership is given to it.
-// if no more alive the "standart" DataArray deallocator is called.
-void numarrdeal(void *pt, void *wron)
-{
-  void **wronc=(void **)wron;
-  PyObject *weakRefOnOwner=reinterpret_cast<PyObject *>(wronc[0]);
-  PyObject *obj=PyWeakref_GetObject(weakRefOnOwner);
-  if(obj!=Py_None)
-    {
-      Py_XINCREF(obj);
-      PyArrayObject *objC=reinterpret_cast<PyArrayObject *>(obj);
-      objC->flags|=MED_NUMPY_OWNDATA;
-      Py_XDECREF(weakRefOnOwner);
-      Py_XDECREF(obj);
-    }
-  else
-    {
-      typedef void (*MyDeallocator)(void *,void *);
-      MyDeallocator deall=(MyDeallocator)wronc[1];
-      deall(pt,NULL);
-      Py_XDECREF(weakRefOnOwner);
-    }
-  delete [] wronc;
-}
-
-template<class MCData>
-struct PyCallBackDataArraySt {
-    PyObject_HEAD
-    MCData *_pt_mc;
-};
-
-typedef struct PyCallBackDataArraySt<MEDCoupling::DataArrayByte> PyCallBackDataArrayChar;
-typedef struct PyCallBackDataArraySt<MEDCoupling::DataArrayInt> PyCallBackDataArrayInt;
-typedef struct PyCallBackDataArraySt<MEDCoupling::DataArrayDouble> PyCallBackDataArrayDouble;
-
-extern "C"
-{
-  static int callbackmcdataarray___init__(PyObject *self, PyObject *args, PyObject *kwargs) { return 0; }
-  
-  static PyObject *callbackmcdataarraychar___new__(PyTypeObject *type, PyObject *args, PyObject *kwargs)
-  {
-    PyCallBackDataArrayChar *self = (PyCallBackDataArrayChar *) ( type->tp_alloc(type, 0) );
-    return (PyObject *)self;
-  }
-
-  static PyObject *callbackmcdataarrayint___new__(PyTypeObject *type, PyObject *args, PyObject *kwargs)
-  {
-    PyCallBackDataArrayInt *self = (PyCallBackDataArrayInt *) ( type->tp_alloc(type, 0) );
-    return (PyObject *)self;
-  }
-
-  static PyObject *callbackmcdataarraydouble___new__(PyTypeObject *type, PyObject *args, PyObject *kwargs)
-  {
-    PyCallBackDataArrayDouble *self = (PyCallBackDataArrayDouble *) ( type->tp_alloc(type, 0) );
-    return (PyObject *)self;
-  }
-  
-  static void callbackmcdataarray_dealloc(PyObject *self)
-  {
-    Py_TYPE(self)->tp_free(self);
-  }
-
-  
-  // real callback called when a numpy arr having more than one DataArray instance client on it is destroyed.
-  // In this case, all the "weak" clients, except the first one, invoke this call back that desable the content of these "weak" clients.
-  static PyObject *callbackmcdataarraychar_call(PyCallBackDataArrayChar *self, PyObject *args, PyObject *kw)
-  {
-    if(self->_pt_mc)
-      {
-        MEDCoupling::MemArray<char>& mma=self->_pt_mc->accessToMemArray();
-        mma.destroy();
-      }
-    Py_XINCREF(Py_None);
-    return Py_None;
-  }
-
-  // real callback called when a numpy arr having more than one DataArray instance client on it is destroyed.
-  // In this case, all the "weak" clients, except the first one, invoke this call back that desable the content of these "weak" clients.
-  static PyObject *callbackmcdataarrayint_call(PyCallBackDataArrayInt *self, PyObject *args, PyObject *kw)
-  {
-    if(self->_pt_mc)
-      {
-        MEDCoupling::MemArray<int>& mma=self->_pt_mc->accessToMemArray();
-        mma.destroy();
-      }
-    Py_XINCREF(Py_None);
-    return Py_None;
-  }
-  
-  // real callback called when a numpy arr having more than one DataArray instance client on it is destroyed.
-  // In this case, all the "weak" clients, except the first one, invoke this call back that desable the content of these "weak" clients.
-  static PyObject *callbackmcdataarraydouble_call(PyCallBackDataArrayDouble *self, PyObject *args, PyObject *kw)
-  {
-    if(self->_pt_mc)
-      {
-        MEDCoupling::MemArray<double>& mma=self->_pt_mc->accessToMemArray();
-        mma.destroy();
-      }
-    Py_XINCREF(Py_None);
-    return Py_None;
-  }
-}
-
-PyTypeObject PyCallBackDataArrayChar_RefType = {
-  PyVarObject_HEAD_INIT(&PyType_Type, 0)
-  "callbackmcdataarraychar",
-  sizeof(PyCallBackDataArrayChar),
-  0,
-  callbackmcdataarray_dealloc,            /*tp_dealloc*/
-  0,                          /*tp_print*/
-  0,                          /*tp_getattr*/
-  0,                          /*tp_setattr*/
-  0,                          /*tp_compare*/
-  0,                          /*tp_repr*/
-  0,                          /*tp_as_number*/
-  0,                          /*tp_as_sequence*/
-  0,                          /*tp_as_mapping*/
-  0,                          /*tp_hash*/
-  (ternaryfunc)callbackmcdataarraychar_call,  /*tp_call*/
-  0,                          /*tp_str*/
-  0,                          /*tp_getattro*/
-  0,                          /*tp_setattro*/
-  0,                          /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,  /*tp_flags*/
-  0,                          /*tp_doc*/
-  0,                          /*tp_traverse*/
-  0,                          /*tp_clear*/
-  0,                          /*tp_richcompare*/
-  0,                          /*tp_weaklistoffset*/
-  0,                          /*tp_iter*/
-  0,                          /*tp_iternext*/
-  0,                          /*tp_methods*/
-  0,                          /*tp_members*/
-  0,                          /*tp_getset*/
-  0,                          /*tp_base*/
-  0,                          /*tp_dict*/
-  0,                          /*tp_descr_get*/
-  0,                          /*tp_descr_set*/
-  0,                          /*tp_dictoffset*/
-  callbackmcdataarray___init__,           /*tp_init*/
-  PyType_GenericAlloc,        /*tp_alloc*/
-  callbackmcdataarraychar___new__,            /*tp_new*/
-  PyObject_GC_Del,            /*tp_free*/
-};
-
-
-PyTypeObject PyCallBackDataArrayInt_RefType = {
-  PyVarObject_HEAD_INIT(&PyType_Type, 0)
-  "callbackmcdataarrayint",
-  sizeof(PyCallBackDataArrayInt),
-  0,
-  callbackmcdataarray_dealloc,            /*tp_dealloc*/
-  0,                          /*tp_print*/
-  0,                          /*tp_getattr*/
-  0,                          /*tp_setattr*/
-  0,                          /*tp_compare*/
-  0,                          /*tp_repr*/
-  0,                          /*tp_as_number*/
-  0,                          /*tp_as_sequence*/
-  0,                          /*tp_as_mapping*/
-  0,                          /*tp_hash*/
-  (ternaryfunc)callbackmcdataarrayint_call,  /*tp_call*/
-  0,                          /*tp_str*/
-  0,                          /*tp_getattro*/
-  0,                          /*tp_setattro*/
-  0,                          /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,  /*tp_flags*/
-  0,                          /*tp_doc*/
-  0,                          /*tp_traverse*/
-  0,                          /*tp_clear*/
-  0,                          /*tp_richcompare*/
-  0,                          /*tp_weaklistoffset*/
-  0,                          /*tp_iter*/
-  0,                          /*tp_iternext*/
-  0,                          /*tp_methods*/
-  0,                          /*tp_members*/
-  0,                          /*tp_getset*/
-  0,                          /*tp_base*/
-  0,                          /*tp_dict*/
-  0,                          /*tp_descr_get*/
-  0,                          /*tp_descr_set*/
-  0,                          /*tp_dictoffset*/
-  callbackmcdataarray___init__,           /*tp_init*/
-  PyType_GenericAlloc,        /*tp_alloc*/
-  callbackmcdataarrayint___new__,            /*tp_new*/
-  PyObject_GC_Del,            /*tp_free*/
-};
-
-PyTypeObject PyCallBackDataArrayDouble_RefType = {
-  PyVarObject_HEAD_INIT(&PyType_Type, 0)
-  "callbackmcdataarraydouble",
-  sizeof(PyCallBackDataArrayDouble),
-  0,
-  callbackmcdataarray_dealloc,            /*tp_dealloc*/
-  0,                          /*tp_print*/
-  0,                          /*tp_getattr*/
-  0,                          /*tp_setattr*/
-  0,                          /*tp_compare*/
-  0,                          /*tp_repr*/
-  0,                          /*tp_as_number*/
-  0,                          /*tp_as_sequence*/
-  0,                          /*tp_as_mapping*/
-  0,                          /*tp_hash*/
-  (ternaryfunc)callbackmcdataarraydouble_call,  /*tp_call*/
-  0,                          /*tp_str*/
-  0,                          /*tp_getattro*/
-  0,                          /*tp_setattro*/
-  0,                          /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,  /*tp_flags*/
-  0,                          /*tp_doc*/
-  0,                          /*tp_traverse*/
-  0,                          /*tp_clear*/
-  0,                          /*tp_richcompare*/
-  0,                          /*tp_weaklistoffset*/
-  0,                          /*tp_iter*/
-  0,                          /*tp_iternext*/
-  0,                          /*tp_methods*/
-  0,                          /*tp_members*/
-  0,                          /*tp_getset*/
-  0,                          /*tp_base*/
-  0,                          /*tp_dict*/
-  0,                          /*tp_descr_get*/
-  0,                          /*tp_descr_set*/
-  0,                          /*tp_dictoffset*/
-  callbackmcdataarray___init__,           /*tp_init*/
-  PyType_GenericAlloc,        /*tp_alloc*/
-  callbackmcdataarraydouble___new__,            /*tp_new*/
-  PyObject_GC_Del,            /*tp_free*/
-};
-
 // this is the second type of specific deallocator, only valid for the constructor of DataArrays taking numpy array
 // in input when an another DataArray is already client of this.
 template<class MCData>
@@ -545,7 +342,7 @@ PyObject *ToNumPyArray(MCData *self, int npyObjectType, const char *MCDataStr)
 SWIGINTERN PyObject *MEDCoupling_DataArrayInt_toNumPyArray(MEDCoupling::DataArrayInt *self);
 SWIGINTERN PyObject *MEDCoupling_DataArrayDouble_toNumPyArray(MEDCoupling::DataArrayDouble *self);
 
-PyObject *ToCSRMatrix(const std::vector<std::map<int,double> >& m, int nbCols) throw(INTERP_KERNEL::Exception)
+PyObject *ToCSRMatrix(const std::vector<std::map<int,double> >& m, int nbCols)
 {
   int nbRows((int)m.size());
   MEDCoupling::MCAuto<MEDCoupling::DataArrayInt> indPtr(MEDCoupling::DataArrayInt::New()),indices(MEDCoupling::DataArrayInt::New());
@@ -587,9 +384,7 @@ PyObject *ToCSRMatrix(const std::vector<std::map<int,double> >& m, int nbCols) t
   return ret;
 }
 
-#endif
-
-static PyObject *convertDataArrayChar(MEDCoupling::DataArrayChar *dac, int owner) throw(INTERP_KERNEL::Exception)
+static PyObject *convertDataArrayChar(MEDCoupling::DataArrayChar *dac, int owner)
 {
   PyObject *ret=0;
   if(!dac)
@@ -606,7 +401,7 @@ static PyObject *convertDataArrayChar(MEDCoupling::DataArrayChar *dac, int owner
   return ret;
 }
 
-static PyObject *convertDataArray(MEDCoupling::DataArray *dac, int owner) throw(INTERP_KERNEL::Exception)
+static PyObject *convertDataArray(MEDCoupling::DataArray *dac, int owner)
 {
   PyObject *ret=0;
   if(!dac)
@@ -618,6 +413,8 @@ static PyObject *convertDataArray(MEDCoupling::DataArray *dac, int owner) throw(
     ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_MEDCoupling__DataArrayDouble,owner);
   if(dynamic_cast<MEDCoupling::DataArrayInt *>(dac))
     ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_MEDCoupling__DataArrayInt,owner);
+  if(dynamic_cast<MEDCoupling::DataArrayFloat *>(dac))
+    ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_MEDCoupling__DataArrayFloat,owner);
   if(dynamic_cast<MEDCoupling::DataArrayByte *>(dac))
     ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_MEDCoupling__DataArrayByte,owner);
   if(dynamic_cast<MEDCoupling::DataArrayAsciiChar *>(dac))
@@ -627,7 +424,7 @@ static PyObject *convertDataArray(MEDCoupling::DataArray *dac, int owner) throw(
   return ret;
 }
 
-static PyObject *convertIntArrToPyList(const int *ptr, int size) throw(INTERP_KERNEL::Exception)
+static PyObject *convertIntArrToPyList(const int *ptr, int size)
 {
   PyObject *ret=PyList_New(size);
   for(int i=0;i<size;i++)
@@ -635,7 +432,7 @@ static PyObject *convertIntArrToPyList(const int *ptr, int size) throw(INTERP_KE
   return ret;
 }
 
-static PyObject *convertIntArrToPyList2(const std::vector<int>& v) throw(INTERP_KERNEL::Exception)
+static PyObject *convertIntArrToPyList2(const std::vector<int>& v)
 {
   int size=v.size();
   PyObject *ret=PyList_New(size);
@@ -644,7 +441,7 @@ static PyObject *convertIntArrToPyList2(const std::vector<int>& v) throw(INTERP_
   return ret;
 }
 
-static PyObject *convertIntArrToPyList3(const std::set<int>& v) throw(INTERP_KERNEL::Exception)
+static PyObject *convertIntArrToPyList3(const std::set<int>& v)
 {
   int size=v.size();
   PyObject *ret=PyList_New(size);
@@ -654,7 +451,45 @@ static PyObject *convertIntArrToPyList3(const std::set<int>& v) throw(INTERP_KER
   return ret;
 }
 
-static PyObject *convertIntArrToPyListOfTuple(const int *vals, int nbOfComp, int nbOfTuples) throw(INTERP_KERNEL::Exception)
+static bool convertPyObjectToStrNT(PyObject *obj, std::string& ret)
+{
+  if(PyString_Check(obj))
+    {
+      ret=PyString_AsString(obj);
+      return true;
+    }
+#if PY_VERSION_HEX >= 0x03000000
+  else if(PyUnicode_Check(obj))
+    {
+      ret=PyUnicode_AsUTF8(obj);
+      return true;
+    }
+#endif
+  return false;
+}
+
+static std::string convertPyObjectToStr(PyObject *obj, const char *msg=NULL)
+{
+  std::string ret;
+  if(PyString_Check(obj))
+    ret=PyString_AsString(obj);
+#if PY_VERSION_HEX >= 0x03000000
+  else if(PyUnicode_Check(obj))
+    ret=PyUnicode_AsUTF8(obj);
+#endif
+  else
+    {
+      std::ostringstream oss;
+      if(msg)
+        oss << msg;
+      else
+        oss << "PyWrap convertPyObjectToStr : expect a sting like py object !";
+      throw INTERP_KERNEL::Exception(oss.str());
+    }
+  return ret;
+}
+
+static PyObject *convertIntArrToPyListOfTuple(const int *vals, int nbOfComp, int nbOfTuples)
 {
   PyObject *ret=PyList_New(nbOfTuples);
   for(int i=0;i<nbOfTuples;i++)
@@ -667,7 +502,7 @@ static PyObject *convertIntArrToPyListOfTuple(const int *vals, int nbOfComp, int
   return ret;
 }
 
-static int *convertPyToNewIntArr2(PyObject *pyLi, int *size) throw(INTERP_KERNEL::Exception)
+static int *convertPyToNewIntArr2(PyObject *pyLi, int *size)
 {
   if(PyList_Check(pyLi))
     {
@@ -715,7 +550,7 @@ static int *convertPyToNewIntArr2(PyObject *pyLi, int *size) throw(INTERP_KERNEL
     }
 }
 
-static PyObject *convertFromVectorPairInt(const std::vector< std::pair<int,int> >& arr) throw(INTERP_KERNEL::Exception)
+static PyObject *convertFromVectorPairInt(const std::vector< std::pair<int,int> >& arr)
 {
   PyObject *ret=PyList_New(arr.size());
   for(std::size_t i=0;i<arr.size();i++)
@@ -728,7 +563,7 @@ static PyObject *convertFromVectorPairInt(const std::vector< std::pair<int,int>
   return ret;
 }
 
-static void convertPyToVectorPairInt(PyObject *pyLi, std::vector< std::pair<int,int> >& arr) throw(INTERP_KERNEL::Exception)
+static void convertPyToVectorPairInt(PyObject *pyLi, std::vector< std::pair<int,int> >& arr)
 {
   const char msg[]="list must contain tuples of 2 integers only or tuple must contain tuples of 2 integers only !";
   if(PyList_Check(pyLi))
@@ -785,7 +620,7 @@ static void convertPyToVectorPairInt(PyObject *pyLi, std::vector< std::pair<int,
     throw INTERP_KERNEL::Exception(msg);
 }
 
-static void convertPyToVectorPairStringInt(PyObject *pyLi, std::vector< std::pair<std::string,int> >& arr) throw(INTERP_KERNEL::Exception)
+static void convertPyToVectorPairStringInt(PyObject *pyLi, std::vector< std::pair<std::string,int> >& arr)
 {
   const char msg[]="convertPyToVectorPairStringInt : list must contain tuples of 2 integers only or tuple must contain tuples of 1 string and 1 integer only !";
   if(PyList_Check(pyLi))
@@ -801,12 +636,10 @@ 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);
+              arr[i].first=convertPyObjectToStr(o_0,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 +659,10 @@ 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);
+              arr[i].first=convertPyObjectToStr(o_0,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
@@ -842,7 +673,7 @@ static void convertPyToVectorPairStringInt(PyObject *pyLi, std::vector< std::pai
     throw INTERP_KERNEL::Exception(msg);
 }
 
-static void convertPyToNewIntArr3(PyObject *pyLi, std::vector<int>& arr) throw(INTERP_KERNEL::Exception)
+static void convertPyToNewIntArr3(PyObject *pyLi, std::vector<int>& arr)
 {
   if(PyList_Check(pyLi))
     {
@@ -882,7 +713,7 @@ static void convertPyToNewIntArr3(PyObject *pyLi, std::vector<int>& arr) throw(I
     }
 }
 
-static void convertPyToNewIntArr4(PyObject *pyLi, int recurseLev, int nbOfSubPart, std::vector<int>& arr) throw(INTERP_KERNEL::Exception)
+static void convertPyToNewIntArr4(PyObject *pyLi, int recurseLev, int nbOfSubPart, std::vector<int>& arr)
 {
   if(recurseLev<0)
     throw INTERP_KERNEL::Exception("convertPyToNewIntArr4 : invalid list of integers level of recursion !");
@@ -939,7 +770,7 @@ static void convertPyToNewIntArr4(PyObject *pyLi, int recurseLev, int nbOfSubPar
     throw INTERP_KERNEL::Exception("convertPyToNewIntArr4 : not a list nor a tuple recursively !");
 }
 
-static void checkFillArrayWithPyList(int size1, int size2, int& nbOfTuples, int& nbOfComp) throw(INTERP_KERNEL::Exception)
+static void checkFillArrayWithPyList(int size1, int size2, int& nbOfTuples, int& nbOfComp)
 {
   if(nbOfTuples==-1)
     {
@@ -1034,7 +865,7 @@ static void fillArrayWithPyListInt3(PyObject *pyLi, int& nbOfElt, std::vector<in
     throw INTERP_KERNEL::Exception("fillArrayWithPyListInt3 : Unrecognized type ! Should be a composition of tuple,list,int !");
 }
 
-static std::vector<int> fillArrayWithPyListInt2(PyObject *pyLi, int& nbOfTuples, int& nbOfComp) throw(INTERP_KERNEL::Exception)
+static std::vector<int> fillArrayWithPyListInt2(PyObject *pyLi, int& nbOfTuples, int& nbOfComp)
 {
   std::vector<int> ret;
   int size1=-1,size2=-1;
@@ -1067,7 +898,7 @@ static std::vector<int> fillArrayWithPyListInt2(PyObject *pyLi, int& nbOfTuples,
   return ret;
 }
 
-static bool fillStringVector(PyObject *pyLi, std::vector<std::string>& vec) throw(INTERP_KERNEL::Exception)
+static bool fillStringVector(PyObject *pyLi, std::vector<std::string>& vec)
 {
   if(PyList_Check(pyLi))
     {
@@ -1076,9 +907,7 @@ static bool fillStringVector(PyObject *pyLi, std::vector<std::string>& vec) thro
       for(int i=0;i<sz;i++)
         {
           PyObject *o=PyList_GetItem(pyLi,i);
-          if(PyString_Check(o))
-            vec[i]=PyString_AsString(o);
-          else
+          if(!convertPyObjectToStrNT(o,vec[i]))
             return false;
         }
       return true;
@@ -1090,9 +919,7 @@ static bool fillStringVector(PyObject *pyLi, std::vector<std::string>& vec) thro
       for(int i=0;i<sz;i++)
         {
           PyObject *o=PyTuple_GetItem(pyLi,i);
-          if(PyString_Check(o))
-            vec[i]=PyString_AsString(o);
-          else
+          if(!convertPyObjectToStrNT(o,vec[i]))
             return false;
         }
       return true;
@@ -1100,7 +927,7 @@ static bool fillStringVector(PyObject *pyLi, std::vector<std::string>& vec) thro
   else
     return false;
 }
-static void convertPyToVectorOfVectorOfString(PyObject *pyLi, std::vector< std::vector<std::string> >& arr) throw(INTERP_KERNEL::Exception)
+static void convertPyToVectorOfVectorOfString(PyObject *pyLi, std::vector< std::vector<std::string> >& arr)
 {
   const char msg[]="convertPyToVectorOfVectorOfString : expecting list of list of strings !";
   if(PyList_Check(pyLi))
@@ -1129,7 +956,7 @@ static void convertPyToVectorOfVectorOfString(PyObject *pyLi, std::vector< std::
     throw INTERP_KERNEL::Exception(msg);
 }
 
-static bool fillIntVector(PyObject *pyLi, std::vector<int>& vec) throw(INTERP_KERNEL::Exception)
+static bool fillIntVector(PyObject *pyLi, std::vector<int>& vec)
 {
   if(PyList_Check(pyLi))
     {
@@ -1163,7 +990,7 @@ static bool fillIntVector(PyObject *pyLi, std::vector<int>& vec) throw(INTERP_KE
     return false;
 }
 
-static void convertPyToVectorOfVectorOfInt(PyObject *pyLi, std::vector< std::vector<int> >& arr) throw(INTERP_KERNEL::Exception)
+static void convertPyToVectorOfVectorOfInt(PyObject *pyLi, std::vector< std::vector<int> >& arr)
 {
   const char msg[]="convertPyToVectorOfVectorOfInt : expecting list of list of strings !";
   if(PyList_Check(pyLi))
@@ -1192,7 +1019,7 @@ static void convertPyToVectorOfVectorOfInt(PyObject *pyLi, std::vector< std::vec
     throw INTERP_KERNEL::Exception(msg);
 }
 
-static void convertPyToVectorPairStringVecString(PyObject *pyLi, std::vector< std::pair<std::string, std::vector<std::string> > >& arr) throw(INTERP_KERNEL::Exception)
+static void convertPyToVectorPairStringVecString(PyObject *pyLi, std::vector< std::pair<std::string, std::vector<std::string> > >& arr)
 {
   const char msg[]="convertPyToVectorPairStringVecString : expecting list of tuples containing each exactly 2 items : one string and one vector of string !";
   if(PyList_Check(pyLi))
@@ -1209,9 +1036,7 @@ 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))
-                throw INTERP_KERNEL::Exception(msg);
-              item.first=PyString_AsString(o_0);
+              item.first=convertPyObjectToStr(o_0,msg);
               PyObject *o_1=PyTuple_GetItem(o,1);
               if(!fillStringVector(o_1,item.second))
                 throw INTERP_KERNEL::Exception(msg);
@@ -1235,9 +1060,7 @@ 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))
-                throw INTERP_KERNEL::Exception(msg);
-              item.first=PyString_AsString(o_0);
+              item.first=convertPyObjectToStr(o_0,msg);
               PyObject *o_1=PyTuple_GetItem(o,1);
               if(!fillStringVector(o_1,item.second))
                 throw INTERP_KERNEL::Exception(msg);
@@ -1251,26 +1074,28 @@ static void convertPyToVectorPairStringVecString(PyObject *pyLi, std::vector< st
     throw INTERP_KERNEL::Exception(msg);
 }
 
-static PyObject *convertDblArrToPyList(const double *ptr, int size) throw(INTERP_KERNEL::Exception)
+template<class T>
+PyObject *convertDblArrToPyList(const T *ptr, int size)
 {
-  PyObject *ret=PyList_New(size);
+  PyObject *ret(PyList_New(size));
   for(int i=0;i<size;i++)
     PyList_SetItem(ret,i,PyFloat_FromDouble(ptr[i]));
   return ret;
 }
 
-static PyObject *convertDblArrToPyList2(const std::vector<double>& v) throw(INTERP_KERNEL::Exception)
+static PyObject *convertDblArrToPyList2(const std::vector<double>& v)
 {
-  int size=v.size();
-  PyObject *ret=PyList_New(size);
+  int size(v.size());
+  PyObject *ret(PyList_New(size));
   for(int i=0;i<size;i++)
     PyList_SetItem(ret,i,PyFloat_FromDouble(v[i]));
   return ret;
 }
 
-static PyObject *convertDblArrToPyListOfTuple(const double *vals, int nbOfComp, int nbOfTuples) throw(INTERP_KERNEL::Exception)
+template<class T>
+PyObject *convertDblArrToPyListOfTuple(const T *vals, int nbOfComp, int nbOfTuples)
 {
-  PyObject *ret=PyList_New(nbOfTuples);
+  PyObject *ret(PyList_New(nbOfTuples));
   for(int i=0;i<nbOfTuples;i++)
     {
       PyObject *t=PyTuple_New(nbOfComp);
@@ -1281,7 +1106,7 @@ static PyObject *convertDblArrToPyListOfTuple(const double *vals, int nbOfComp,
   return ret;
 }
 
-static PyObject *convertCharArrToPyListOfTuple(const char *vals, int nbOfComp, int nbOfTuples) throw(INTERP_KERNEL::Exception)
+static PyObject *convertCharArrToPyListOfTuple(const char *vals, int nbOfComp, int nbOfTuples)
 {
   PyObject *ret=PyList_New(nbOfTuples);
   INTERP_KERNEL::AutoPtr<char> tmp=new char[nbOfComp+1]; tmp[nbOfComp]='\0';
@@ -1293,7 +1118,7 @@ static PyObject *convertCharArrToPyListOfTuple(const char *vals, int nbOfComp, i
   return ret;
 }
 
-static double *convertPyToNewDblArr2(PyObject *pyLi, int *size) throw(INTERP_KERNEL::Exception)
+static double *convertPyToNewDblArr2(PyObject *pyLi, int *size)
 {
   if(PyList_Check(pyLi))
     {
@@ -1417,7 +1242,7 @@ static void fillArrayWithPyListDbl3(PyObject *pyLi, int& nbOfElt, std::vector<do
     throw INTERP_KERNEL::Exception("fillArrayWithPyListDbl3 : Unrecognized type ! Should be a composition of tuple,list,int and float !");
 }
 
-static std::vector<double> fillArrayWithPyListDbl2(PyObject *pyLi, int& nbOfTuples, int& nbOfComp) throw(INTERP_KERNEL::Exception)
+static std::vector<double> fillArrayWithPyListDbl2(PyObject *pyLi, int& nbOfTuples, int& nbOfComp)
 {
   std::vector<double> ret;
   int size1=-1,size2=-1;
@@ -1508,7 +1333,7 @@ static void convertFromPyObjVectorOfObj(PyObject *pyLi, swig_type_info *ty, cons
  *
  * switch between (int,vector<int>,DataArrayInt)
  */
-static void convertObjToPossibleCpp1(PyObject *value, int& sw, int& iTyypp, std::vector<int>& stdvecTyypp, MEDCoupling::DataArrayInt *& daIntTyypp, MEDCoupling::DataArrayIntTuple *&daIntTuple) throw(INTERP_KERNEL::Exception)
+static void convertIntStarLikePyObjToCpp(PyObject *value, int& sw, int& iTyypp, std::vector<int>& stdvecTyypp, MEDCoupling::DataArrayInt *& daIntTyypp, MEDCoupling::DataArrayIntTuple *&daIntTuple)
 {
   sw=-1;
   if(PyInt_Check(value))
@@ -1571,6 +1396,86 @@ static void convertObjToPossibleCpp1(PyObject *value, int& sw, int& iTyypp, std:
   throw INTERP_KERNEL::Exception("5 types accepted : integer, tuple of integer, list of integer, DataArrayInt, DataArrayIntTuple");
 }
 
+/*!
+ * if python int -> cpp int sw=1
+ * if python list[int] -> cpp vector<int> sw=2
+ * if python tuple[int] -> cpp vector<int> sw=2
+ * if python DataArrayInt -> cpp DataArrayInt sw=3
+ * if python DataArrayIntTuple -> cpp DataArrayIntTuple sw=4
+ *
+ * switch between (int,vector<int>,DataArrayInt)
+ */
+static const int *convertIntStarLikePyObjToCppIntStar(PyObject *value, int& sw, int& sz, int& iTyypp, std::vector<int>& stdvecTyypp)
+{
+  sw=-1;
+  if(PyInt_Check(value))
+    {
+      iTyypp=(int)PyInt_AS_LONG(value);
+      sw=1; sz=1;
+      return &iTyypp;
+    }
+  if(PyTuple_Check(value))
+    {
+      int size=PyTuple_Size(value);
+      stdvecTyypp.resize(size);
+      for(int i=0;i<size;i++)
+        {
+          PyObject *o=PyTuple_GetItem(value,i);
+          if(PyInt_Check(o))
+            stdvecTyypp[i]=(int)PyInt_AS_LONG(o);
+          else
+            {
+              std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not integer ! only tuples of integers accepted !";
+              throw INTERP_KERNEL::Exception(oss.str().c_str());
+            }
+        }
+      sw=2; sz=size;
+      return &stdvecTyypp[0];
+    }
+  if(PyList_Check(value))
+    {
+      int size=PyList_Size(value);
+      stdvecTyypp.resize(size);
+      for(int i=0;i<size;i++)
+        {
+          PyObject *o=PyList_GetItem(value,i);
+          if(PyInt_Check(o))
+            stdvecTyypp[i]=(int)PyInt_AS_LONG(o);
+          else
+            {
+              std::ostringstream oss; oss << "List as been detected but element #" << i << " is not integer ! only lists of integers accepted !";
+              throw INTERP_KERNEL::Exception(oss.str().c_str());
+            }
+        }
+      sw=2; sz=size;
+      return &stdvecTyypp[0];
+    }
+  void *argp;
+  int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0);
+  if(SWIG_IsOK(status))
+    {
+      MEDCoupling::DataArrayInt *daIntTyypp=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp);
+      if(daIntTyypp)
+        {
+          sw=3; sz=daIntTyypp->getNbOfElems();
+          return daIntTyypp->begin();
+        }
+      else
+        {
+          sz=0;
+          return 0;
+        }
+    }
+  status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,0|0);
+  if(SWIG_IsOK(status))
+    {  
+      MEDCoupling::DataArrayIntTuple *daIntTuple=reinterpret_cast< MEDCoupling::DataArrayIntTuple * >(argp);
+      sw=4; sz=daIntTuple->getNumberOfCompo();
+      return daIntTuple->getConstPointer();
+    }
+  throw INTERP_KERNEL::Exception("5 types accepted : integer, tuple of integer, list of integer, DataArrayInt, DataArrayIntTuple");
+}
+
 /*!
  * if python double -> cpp double sw=1
  * if python int -> cpp double sw=1
@@ -1582,18 +1487,19 @@ static void convertObjToPossibleCpp1(PyObject *value, int& sw, int& iTyypp, std:
  *
  * switch between (int,vector<int>,DataArrayInt)
  */
-static void convertObjToPossibleCpp4(PyObject *value, int& sw, double& iTyypp, std::vector<double>& stdvecTyypp, MEDCoupling::DataArrayDouble *& daIntTyypp) throw(INTERP_KERNEL::Exception)
+template<class T>
+void considerPyObjAsATStarLikeObject(PyObject *value, int& sw, T& iTyypp, std::vector<T>& stdvecTyypp, typename MEDCoupling::Traits<T>::ArrayType *& daIntTyypp, swig_type_info *ti)
 {
   sw=-1;
   if(PyFloat_Check(value))
     {
-      iTyypp=PyFloat_AS_DOUBLE(value);
+      iTyypp=(T)PyFloat_AS_DOUBLE(value);
       sw=1;
       return;
     }
   if(PyInt_Check(value))
     {
-      iTyypp=(double)PyInt_AS_LONG(value);
+      iTyypp=(T)PyInt_AS_LONG(value);
       sw=1;
       return;
     }
@@ -1605,9 +1511,9 @@ static void convertObjToPossibleCpp4(PyObject *value, int& sw, double& iTyypp, s
         {
           PyObject *o=PyTuple_GetItem(value,i);
           if(PyFloat_Check(o))
-            stdvecTyypp[i]=PyFloat_AS_DOUBLE(o);
+            stdvecTyypp[i]=(T)PyFloat_AS_DOUBLE(o);
           else if(PyInt_Check(o))
-            stdvecTyypp[i]=(double)PyInt_AS_LONG(o);
+            stdvecTyypp[i]=(T)PyInt_AS_LONG(o);
           else
             {
               std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not double ! only tuples of doubles accepted or integer !";
@@ -1625,9 +1531,9 @@ static void convertObjToPossibleCpp4(PyObject *value, int& sw, double& iTyypp, s
         {
           PyObject *o=PyList_GetItem(value,i);
           if(PyFloat_Check(o))
-            stdvecTyypp[i]=PyFloat_AS_DOUBLE(o);
+            stdvecTyypp[i]=(T)PyFloat_AS_DOUBLE(o);
           else if(PyInt_Check(o))
-            stdvecTyypp[i]=(double)PyInt_AS_LONG(o);
+            stdvecTyypp[i]=(T)PyInt_AS_LONG(o);
           else
             {
               std::ostringstream oss; oss << "List as been detected but element #" << i << " is not double ! only lists of doubles accepted or integer !";
@@ -1638,10 +1544,10 @@ static void convertObjToPossibleCpp4(PyObject *value, int& sw, double& iTyypp, s
       return;
     }
   void *argp;
-  int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0);
+  int status=SWIG_ConvertPtr(value,&argp,ti,0|0);
   if(!SWIG_IsOK(status))
     throw INTERP_KERNEL::Exception("5 types accepted : double float, integer, tuple of double float or int, list of double float or int, DataArrayDouble");
-  daIntTyypp=reinterpret_cast< MEDCoupling::DataArrayDouble * >(argp);
+  daIntTyypp=reinterpret_cast< typename MEDCoupling::Traits<T>::ArrayType * >(argp);
   sw=3;
 }
 
@@ -1656,7 +1562,7 @@ static void convertObjToPossibleCpp4(PyObject *value, int& sw, double& iTyypp, s
  *
  * switch between (int,vector<int>,DataArrayInt)
  */
-static void convertObjToPossibleCpp44(PyObject *value, int& sw, double& iTyypp, std::vector<double>& stdvecTyypp, MEDCoupling::DataArrayDoubleTuple *& daIntTyypp) throw(INTERP_KERNEL::Exception)
+static void convertDoubleStarLikePyObjToCpp(PyObject *value, int& sw, double& iTyypp, std::vector<double>& stdvecTyypp, MEDCoupling::DataArrayDoubleTuple *& daIntTyypp)
 {
   sw=-1;
   if(PyFloat_Check(value))
@@ -1719,92 +1625,178 @@ static void convertObjToPossibleCpp44(PyObject *value, int& sw, double& iTyypp,
   sw=3;
 }
 
-/*!
- * if python int -> cpp int sw=1
- * if python list[int] -> cpp vector<int> sw=2
- * if python tuple[int] -> cpp vector<int> sw=2
- * if python slicp -> cpp pair sw=3 (begin,end,step)
- * if python DataArrayInt -> cpp DataArrayInt sw=4 . The returned pointer cannot be the null pointer ! If null an exception is thrown.
- *
- * switch between (int,vector<int>,DataArrayInt)
- */
-static void convertObjToPossibleCpp2(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector<int>& stdvecTyypp, std::pair<int, std::pair<int,int> >& p, MEDCoupling::DataArrayInt *& daIntTyypp) throw(INTERP_KERNEL::Exception)
+template<class T>
+void convertFPStarLikePyObjToCpp_2(PyObject *value, int& sw, T& val, typename MEDCoupling::Traits<T>::ArrayType *&d, typename MEDCoupling::Traits<T>::ArrayTuple *&e, std::vector<T>& f, swig_type_info *ti_da, swig_type_info *ti_tuple)
 {
-  const char *msg="5 types accepted : integer, tuple of integer, list of integer, slice, DataArrayInt, DataArrayIntTuple";
   sw=-1;
+  if(PyFloat_Check(value))
+    {
+      val=PyFloat_AS_DOUBLE(value);
+      sw=1;
+      return;
+    }
   if(PyInt_Check(value))
     {
-      iTyypp=(int)PyInt_AS_LONG(value);
+      val=(T)PyInt_AS_LONG(value);
       sw=1;
       return;
     }
   if(PyTuple_Check(value))
     {
       int size=PyTuple_Size(value);
-      stdvecTyypp.resize(size);
+      f.resize(size);
       for(int i=0;i<size;i++)
         {
           PyObject *o=PyTuple_GetItem(value,i);
-          if(PyInt_Check(o))
-            stdvecTyypp[i]=(int)PyInt_AS_LONG(o);
+          if(PyFloat_Check(o))
+            f[i]=PyFloat_AS_DOUBLE(o);
+          else if(PyInt_Check(o))
+            f[i]=(T)PyInt_AS_LONG(o);
           else
             {
-              std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not integer ! only tuples of integers accepted !";
+              std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not double ! only tuples of doubles accepted or integer !";
               throw INTERP_KERNEL::Exception(oss.str().c_str());
             }
         }
-      sw=2;
+      sw=4;
       return;
     }
   if(PyList_Check(value))
     {
       int size=PyList_Size(value);
-      stdvecTyypp.resize(size);
+      f.resize(size);
       for(int i=0;i<size;i++)
         {
           PyObject *o=PyList_GetItem(value,i);
-          if(PyInt_Check(o))
-            stdvecTyypp[i]=(int)PyInt_AS_LONG(o);
+          if(PyFloat_Check(o))
+            f[i]=PyFloat_AS_DOUBLE(o);
+          else if(PyInt_Check(o))
+            f[i]=(T)PyInt_AS_LONG(o);
           else
             {
-              std::ostringstream oss; oss << "List as been detected but element #" << i << " is not integer ! only lists of integers accepted !";
+              std::ostringstream oss; oss << "List as been detected but element #" << i << " is not double ! only lists of doubles accepted or integer !";
               throw INTERP_KERNEL::Exception(oss.str().c_str());
             }
         }
-      sw=2;
+      sw=4;
       return;
     }
-  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 !");
-      p.first=strt;
-      p.second.first=stp;
-      p.second.second=step;
-      sw=3;
-      return ;
-    }
   void *argp;
-  int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0);
+  int status=SWIG_ConvertPtr(value,&argp,ti_da,0|0);
   if(SWIG_IsOK(status))
-    {
-      daIntTyypp=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp);
-      if(!daIntTyypp)
-        {
-          std::ostringstream oss; oss << msg << " Instance in null !";
-          throw INTERP_KERNEL::Exception(oss.str().c_str());
-        }
-      sw=4;
+    {  
+      d=reinterpret_cast< typename MEDCoupling::Traits<T>::ArrayType * >(argp);
+      sw=2;
       return ;
     }
-  status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,0|0);
+  status=SWIG_ConvertPtr(value,&argp,ti_tuple,0|0);
   if(SWIG_IsOK(status))
-    {
-      MEDCoupling::DataArrayIntTuple *tmp=reinterpret_cast< MEDCoupling::DataArrayIntTuple * >(argp);
-      if(!tmp)
-        {
-          std::ostringstream oss; oss << msg << " Instance in null !";
+    {  
+      e=reinterpret_cast< typename MEDCoupling::Traits<T>::ArrayTuple * >(argp);
+      sw=3;
+      return ;
+    }
+  throw INTERP_KERNEL::Exception("4 types accepted : integer, double, DataArrayDouble, DataArrayDoubleTuple");
+}
+
+/*!
+ * if value int -> cpp val sw=1
+ * if value double -> cpp val sw=1
+ * if value DataArrayDouble -> cpp DataArrayDouble sw=2
+ * if value DataArrayDoubleTuple -> cpp DataArrayDoubleTuple sw=3
+ * if value list[int,double] -> cpp std::vector<double> sw=4
+ * if value tuple[int,double] -> cpp std::vector<double> sw=4
+ */
+static void convertDoubleStarLikePyObjToCpp_2(PyObject *value, int& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector<double>& f)
+{
+  convertFPStarLikePyObjToCpp_2<double>(value,sw,val,d,e,f,SWIGTYPE_p_MEDCoupling__DataArrayDouble,SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple);
+}
+
+/*!
+ * if python int -> cpp int sw=1
+ * if python list[int] -> cpp vector<int> sw=2
+ * if python tuple[int] -> cpp vector<int> sw=2
+ * if python slicp -> cpp pair sw=3 (begin,end,step)
+ * if python DataArrayInt -> cpp DataArrayInt sw=4 . The returned pointer cannot be the null pointer ! If null an exception is thrown.
+ *
+ * switch between (int,vector<int>,DataArrayInt)
+ */
+static void convertIntStarOrSliceLikePyObjToCpp(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector<int>& stdvecTyypp, std::pair<int, std::pair<int,int> >& p, MEDCoupling::DataArrayInt *& daIntTyypp)
+{
+  const char *msg="5 types accepted : integer, tuple of integer, list of integer, slice, DataArrayInt, DataArrayIntTuple";
+  sw=-1;
+  if(PyInt_Check(value))
+    {
+      iTyypp=(int)PyInt_AS_LONG(value);
+      sw=1;
+      return;
+    }
+  if(PyTuple_Check(value))
+    {
+      int size=PyTuple_Size(value);
+      stdvecTyypp.resize(size);
+      for(int i=0;i<size;i++)
+        {
+          PyObject *o=PyTuple_GetItem(value,i);
+          if(PyInt_Check(o))
+            stdvecTyypp[i]=(int)PyInt_AS_LONG(o);
+          else
+            {
+              std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not integer ! only tuples of integers accepted !";
+              throw INTERP_KERNEL::Exception(oss.str().c_str());
+            }
+        }
+      sw=2;
+      return;
+    }
+  if(PyList_Check(value))
+    {
+      int size=PyList_Size(value);
+      stdvecTyypp.resize(size);
+      for(int i=0;i<size;i++)
+        {
+          PyObject *o=PyList_GetItem(value,i);
+          if(PyInt_Check(o))
+            stdvecTyypp[i]=(int)PyInt_AS_LONG(o);
+          else
+            {
+              std::ostringstream oss; oss << "List as been detected but element #" << i << " is not integer ! only lists of integers accepted !";
+              throw INTERP_KERNEL::Exception(oss.str().c_str());
+            }
+        }
+      sw=2;
+      return;
+    }
+  if(PySlice_Check(value))
+    {
+      Py_ssize_t strt=2,stp=2,step=2;
+      GetIndicesOfSlice(value,nbelem,&strt,&stp,&step,"Slice in subscriptable object DataArray invalid !");
+      p.first=strt;
+      p.second.first=stp;
+      p.second.second=step;
+      sw=3;
+      return ;
+    }
+  void *argp;
+  int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0);
+  if(SWIG_IsOK(status))
+    {
+      daIntTyypp=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp);
+      if(!daIntTyypp)
+        {
+          std::ostringstream oss; oss << msg << " Instance in null !";
+          throw INTERP_KERNEL::Exception(oss.str().c_str());
+        }
+      sw=4;
+      return ;
+    }
+  status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,0|0);
+  if(SWIG_IsOK(status))
+    {
+      MEDCoupling::DataArrayIntTuple *tmp=reinterpret_cast< MEDCoupling::DataArrayIntTuple * >(argp);
+      if(!tmp)
+        {
+          std::ostringstream oss; oss << msg << " Instance in null !";
           throw INTERP_KERNEL::Exception(oss.str().c_str());
         }
       stdvecTyypp.resize(tmp->getNumberOfCompo());
@@ -1816,11 +1808,11 @@ static void convertObjToPossibleCpp2(PyObject *value, int nbelem, int& sw, int&
 }
 
 /*!
- * Idem than convertObjToPossibleCpp2
+ * Idem than convertIntStarOrSliceLikePyObjToCpp
  */
-static void convertObjToPossibleCpp2WithNegIntInterp(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector<int>& stdvecTyypp, std::pair<int, std::pair<int,int> >& p, MEDCoupling::DataArrayInt *& daIntTyypp) throw(INTERP_KERNEL::Exception)
+static void convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector<int>& stdvecTyypp, std::pair<int, std::pair<int,int> >& p, MEDCoupling::DataArrayInt *& daIntTyypp)
 {
-  convertObjToPossibleCpp2(value,nbelem,sw,iTyypp,stdvecTyypp,p,daIntTyypp);
+  convertIntStarOrSliceLikePyObjToCpp(value,nbelem,sw,iTyypp,stdvecTyypp,p,daIntTyypp);
   if(sw==1)
     {
       iTyypp=InterpreteNegativeInt(iTyypp,nbelem);
@@ -1834,7 +1826,7 @@ static void convertObjToPossibleCpp2WithNegIntInterp(PyObject *value, int nbelem
  * if python slice -> cpp pair sw=3
  * if python DataArrayIntTuple -> cpp DataArrayIntTuple sw=4 . WARNING The returned pointer can be the null pointer !
  */
-static void convertObjToPossibleCpp22(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector<int>& stdvecTyypp, std::pair<int, std::pair<int,int> >& p, MEDCoupling::DataArrayIntTuple *& daIntTyypp) throw(INTERP_KERNEL::Exception)
+static void convertObjToPossibleCpp22(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector<int>& stdvecTyypp, std::pair<int, std::pair<int,int> >& p, MEDCoupling::DataArrayIntTuple *& daIntTyypp)
 {
   sw=-1;
   if(PyInt_Check(value))
@@ -1882,8 +1874,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;
@@ -1905,7 +1896,7 @@ static void convertObjToPossibleCpp22(PyObject *value, int nbelem, int& sw, int&
  * if python not null pointer of DataArrayChar -> cpp DataArrayChar sw=4
  * switch between (int,string,vector<string>,DataArrayChar)
  */
-static void convertObjToPossibleCpp6(PyObject *value, int& sw, char& cTyp, std::string& sType, std::vector<std::string>& vsType, MEDCoupling::DataArrayChar *& dacType) throw(INTERP_KERNEL::Exception)
+static void convertObjToPossibleCpp6(PyObject *value, int& sw, char& cTyp, std::string& sType, std::vector<std::string>& vsType, MEDCoupling::DataArrayChar *& dacType)
 {
   const char *msg="4 types accepted : string, list or tuple of strings having same size, not null DataArrayChar instance.";
   sw=-1;
@@ -1926,6 +1917,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);
@@ -1933,9 +1943,11 @@ static void convertObjToPossibleCpp6(PyObject *value, int& sw, char& cTyp, std::
       for(int i=0;i<size;i++)
         {
           PyObject *o=PyTuple_GetItem(value,i);
-          if(PyString_Check(o))
-            vsType[i]=PyString_AsString(o);
-          else
+          try
+            {
+              vsType[i]=convertPyObjectToStr(o);
+            }
+          catch(INTERP_KERNEL::Exception& e)
             {
               std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not a string ! only tuples of strings accepted !";
               throw INTERP_KERNEL::Exception(oss.str().c_str());
@@ -1951,11 +1963,13 @@ static void convertObjToPossibleCpp6(PyObject *value, int& sw, char& cTyp, std::
       for(int i=0;i<size;i++)
         {
           PyObject *o=PyList_GetItem(value,i);
-          if(PyString_Check(o))
-            vsType[i]=PyString_AsString(o);
-          else
+          try
             {
-              std::ostringstream oss; oss << "List as been detected but element #" << i << " is not string ! only lists of strings accepted !";
+              vsType[i]=convertPyObjectToStr(o);
+            }
+          catch(INTERP_KERNEL::Exception& e)
+            {
+              std::ostringstream oss; oss << "List as been detected but element #" << i << " is not a string ! only tuples of strings accepted !";
               throw INTERP_KERNEL::Exception(oss.str().c_str());
             }
         }
@@ -2009,11 +2023,11 @@ static void convertObjToPossibleCpp6(PyObject *value, int& sw, char& cTyp, std::
  */
 static void convertObjToPossibleCpp3(PyObject *value, int nbTuple, int nbCompo, int& sw, int& it, int& ic, std::vector<int>& vt, std::vector<int>& vc,
                                      std::pair<int, std::pair<int,int> >& pt, std::pair<int, std::pair<int,int> >& pc,
-                                     MEDCoupling::DataArrayInt *&dt, MEDCoupling::DataArrayInt *&dc) throw(INTERP_KERNEL::Exception)
+                                     MEDCoupling::DataArrayInt *&dt, MEDCoupling::DataArrayInt *&dc)
 {
   if(!PyTuple_Check(value))
     {
-      convertObjToPossibleCpp2WithNegIntInterp(value,nbTuple,sw,it,vt,pt,dt);
+      convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(value,nbTuple,sw,it,vt,pt,dt);
       return ;
     }
   else
@@ -2023,94 +2037,13 @@ static void convertObjToPossibleCpp3(PyObject *value, int nbTuple, int nbCompo,
         throw INTERP_KERNEL::Exception("Unexpected nb of slice element : 1 or 2 expected !\n1st is for tuple selection, 2nd for component selection !");
       PyObject *ob0=PyTuple_GetItem(value,0);
       int sw1,sw2;
-      convertObjToPossibleCpp2WithNegIntInterp(ob0,nbTuple,sw1,it,vt,pt,dt);
+      convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(ob0,nbTuple,sw1,it,vt,pt,dt);
       PyObject *ob1=PyTuple_GetItem(value,1);
-      convertObjToPossibleCpp2WithNegIntInterp(ob1,nbCompo,sw2,ic,vc,pc,dc);
+      convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(ob1,nbCompo,sw2,ic,vc,pc,dc);
       sw=4*sw2+sw1;
     }
 }
 
-/*!
- * if value int -> cpp val sw=1
- * if value double -> cpp val sw=1
- * if value DataArrayDouble -> cpp DataArrayDouble sw=2
- * if value DataArrayDoubleTuple -> cpp DataArrayDoubleTuple sw=3
- * if value list[int,double] -> cpp std::vector<double> sw=4
- * if value tuple[int,double] -> cpp std::vector<double> sw=4
- */
-static void convertObjToPossibleCpp5(PyObject *value, int& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector<double>& f)
-{
-  sw=-1;
-  if(PyFloat_Check(value))
-    {
-      val=PyFloat_AS_DOUBLE(value);
-      sw=1;
-      return;
-    }
-  if(PyInt_Check(value))
-    {
-      val=(double)PyInt_AS_LONG(value);
-      sw=1;
-      return;
-    }
-  if(PyTuple_Check(value))
-    {
-      int size=PyTuple_Size(value);
-      f.resize(size);
-      for(int i=0;i<size;i++)
-        {
-          PyObject *o=PyTuple_GetItem(value,i);
-          if(PyFloat_Check(o))
-            f[i]=PyFloat_AS_DOUBLE(o);
-          else if(PyInt_Check(o))
-            f[i]=(double)PyInt_AS_LONG(o);
-          else
-            {
-              std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not double ! only tuples of doubles accepted or integer !";
-              throw INTERP_KERNEL::Exception(oss.str().c_str());
-            }
-        }
-      sw=4;
-      return;
-    }
-  if(PyList_Check(value))
-    {
-      int size=PyList_Size(value);
-      f.resize(size);
-      for(int i=0;i<size;i++)
-        {
-          PyObject *o=PyList_GetItem(value,i);
-          if(PyFloat_Check(o))
-            f[i]=PyFloat_AS_DOUBLE(o);
-          else if(PyInt_Check(o))
-            f[i]=(double)PyInt_AS_LONG(o);
-          else
-            {
-              std::ostringstream oss; oss << "List as been detected but element #" << i << " is not double ! only lists of doubles accepted or integer !";
-              throw INTERP_KERNEL::Exception(oss.str().c_str());
-            }
-        }
-      sw=4;
-      return;
-    }
-  void *argp;
-  int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0);
-  if(SWIG_IsOK(status))
-    {  
-      d=reinterpret_cast< MEDCoupling::DataArrayDouble * >(argp);
-      sw=2;
-      return ;
-    }
-  status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,0|0);
-  if(SWIG_IsOK(status))
-    {  
-      e=reinterpret_cast< MEDCoupling::DataArrayDoubleTuple * >(argp);
-      sw=3;
-      return ;
-    }
-  throw INTERP_KERNEL::Exception("4 types accepted : integer, double, DataArrayDouble, DataArrayDoubleTuple");
-}
-
 /*!
  * if value int -> cpp val sw=1
  * if value double -> cpp val sw=1
@@ -2120,7 +2053,7 @@ static void convertObjToPossibleCpp5(PyObject *value, int& sw, double& val, MEDC
  * if value tuple[int,double] -> cpp std::vector<double> sw=4
  */
 static const double *convertObjToPossibleCpp5_Safe(PyObject *value, int& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector<double>& f,
-                                                   const char *msg, int nbTuplesExpected, int nbCompExpected, bool throwIfNullPt) throw(INTERP_KERNEL::Exception)
+                                                   const char *msg, int nbTuplesExpected, int nbCompExpected, bool throwIfNullPt)
 {
   sw=-1;
   if(PyFloat_Check(value))
@@ -2227,7 +2160,7 @@ static const double *convertObjToPossibleCpp5_Safe(PyObject *value, int& sw, dou
  * if value tuple[int,double] -> cpp std::vector<double> sw=4
  */
 static const double *convertObjToPossibleCpp5_Safe2(PyObject *value, int& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector<double>& f,
-                                                    const char *msg, int nbCompExpected, bool throwIfNullPt, int& nbTuples) throw(INTERP_KERNEL::Exception)
+                                                    const char *msg, int nbCompExpected, bool throwIfNullPt, int& nbTuples)
 {
   sw=-1;
   if(PyFloat_Check(value))
@@ -2377,7 +2310,7 @@ static const double *convertObjToPossibleCpp5_Safe2(PyObject *value, int& sw, do
  * if value tuple[int,double] -> cpp std::vector<double> sw=4
  */
 static const double *convertObjToPossibleCpp5_SingleCompo(PyObject *value, int& sw, double& val, std::vector<double>& f,
-                                                          const char *msg, bool throwIfNullPt, int& nbTuples) throw(INTERP_KERNEL::Exception)
+                                                          const char *msg, bool throwIfNullPt, int& nbTuples)
 {
   MEDCoupling::DataArrayDouble *d=0;
   MEDCoupling::DataArrayDoubleTuple *e=0;
@@ -2492,114 +2425,34 @@ static const double *convertObjToPossibleCpp5_SingleCompo(PyObject *value, int&
   throw INTERP_KERNEL::Exception("4 types accepted : integer, double, DataArrayDouble, DataArrayDoubleTuple");
 }
 
-/*!
- * if python int -> cpp int sw=1
- * if python list[int] -> cpp vector<int> sw=2
- * if python tuple[int] -> cpp vector<int> sw=2
- * if python DataArrayInt -> cpp DataArrayInt sw=3
- * if python DataArrayIntTuple -> cpp DataArrayIntTuple sw=4
- *
- * switch between (int,vector<int>,DataArrayInt)
- */
-static const int *convertObjToPossibleCpp1_Safe(PyObject *value, int& sw, int& sz, int& iTyypp, std::vector<int>& stdvecTyypp) throw(INTERP_KERNEL::Exception)
+static MEDCoupling::DataArray *CheckAndRetrieveDataArrayInstance(PyObject *obj, const char *msg)
 {
-  sw=-1;
-  if(PyInt_Check(value))
-    {
-      iTyypp=(int)PyInt_AS_LONG(value);
-      sw=1; sz=1;
-      return &iTyypp;
-    }
-  if(PyTuple_Check(value))
+  void *aBasePtrVS=0;
+  int status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_MEDCoupling__DataArray,0|0);
+  if(!SWIG_IsOK(status))
     {
-      int size=PyTuple_Size(value);
-      stdvecTyypp.resize(size);
-      for(int i=0;i<size;i++)
+      status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0);
+      if(!SWIG_IsOK(status))
         {
-          PyObject *o=PyTuple_GetItem(value,i);
-          if(PyInt_Check(o))
-            stdvecTyypp[i]=(int)PyInt_AS_LONG(o);
-          else
+          status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0);
+          if(!SWIG_IsOK(status))
             {
-              std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not integer ! only tuples of integers accepted !";
-              throw INTERP_KERNEL::Exception(oss.str().c_str());
+              status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_MEDCoupling__DataArrayAsciiChar,0|0);
+              if(!SWIG_IsOK(status))
+                {
+                  status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_MEDCoupling__DataArrayByte,0|0);
+                  std::ostringstream oss; oss << msg << " ! Accepted instances are DataArrayDouble, DataArrayInt, DataArrayAsciiChar, DataArrayByte !";
+                  throw INTERP_KERNEL::Exception(oss.str().c_str());
+                }
             }
         }
-      sw=2; sz=size;
-      return &stdvecTyypp[0];
     }
-  if(PyList_Check(value))
-    {
-      int size=PyList_Size(value);
-      stdvecTyypp.resize(size);
-      for(int i=0;i<size;i++)
-        {
-          PyObject *o=PyList_GetItem(value,i);
-          if(PyInt_Check(o))
-            stdvecTyypp[i]=(int)PyInt_AS_LONG(o);
-          else
-            {
-              std::ostringstream oss; oss << "List as been detected but element #" << i << " is not integer ! only lists of integers accepted !";
-              throw INTERP_KERNEL::Exception(oss.str().c_str());
-            }
-        }
-      sw=2; sz=size;
-      return &stdvecTyypp[0];
-    }
-  void *argp;
-  int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0);
-  if(SWIG_IsOK(status))
-    {
-      MEDCoupling::DataArrayInt *daIntTyypp=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp);
-      if(daIntTyypp)
-        {
-          sw=3; sz=daIntTyypp->getNbOfElems();
-          return daIntTyypp->begin();
-        }
-      else
-        {
-          sz=0;
-          return 0;
-        }
-    }
-  status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,0|0);
-  if(SWIG_IsOK(status))
-    {  
-      MEDCoupling::DataArrayIntTuple *daIntTuple=reinterpret_cast< MEDCoupling::DataArrayIntTuple * >(argp);
-      sw=4; sz=daIntTuple->getNumberOfCompo();
-      return daIntTuple->getConstPointer();
-    }
-  throw INTERP_KERNEL::Exception("5 types accepted : integer, tuple of integer, list of integer, DataArrayInt, DataArrayIntTuple");
-}
-
-static MEDCoupling::DataArray *CheckAndRetrieveDataArrayInstance(PyObject *obj, const char *msg)
-{
-  void *aBasePtrVS=0;
-  int status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_MEDCoupling__DataArray,0|0);
-  if(!SWIG_IsOK(status))
-    {
-      status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0);
-      if(!SWIG_IsOK(status))
-        {
-          status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0);
-          if(!SWIG_IsOK(status))
-            {
-              status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_MEDCoupling__DataArrayAsciiChar,0|0);
-              if(!SWIG_IsOK(status))
-                {
-                  status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_MEDCoupling__DataArrayByte,0|0);
-                  std::ostringstream oss; oss << msg << " ! Accepted instances are DataArrayDouble, DataArrayInt, DataArrayAsciiChar, DataArrayByte !";
-                  throw INTERP_KERNEL::Exception(oss.str().c_str());
-                }
-            }
-        }
-    }
-  return reinterpret_cast< MEDCoupling::DataArray * >(aBasePtrVS);
-}
-
-static PyObject *NewMethWrapCallInitOnlyIfEmptyDictInInput(PyObject *cls, PyObject *args, const char *clsName)
-{
-  if(!PyTuple_Check(args))
+  return reinterpret_cast< MEDCoupling::DataArray * >(aBasePtrVS);
+}
+
+static PyObject *NewMethWrapCallInitOnlyIfEmptyDictInInput(PyObject *cls, PyObject *args, const char *clsName)
+{
+  if(!PyTuple_Check(args))
     {
       std::ostringstream oss; oss << clsName << ".__new__ : the args in input is expected to be a tuple !";
       throw INTERP_KERNEL::Exception(oss.str().c_str());
@@ -2625,7 +2478,8 @@ static PyObject *NewMethWrapCallInitOnlyIfEmptyDictInInput(PyObject *cls, PyObje
   return instance;
 }
 
-static PyObject *NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(PyObject *cls, PyObject *args, const char *clsName)
+template<class T>
+static PyObject *NewMethWrapCallInitOnlyIfDictWithSingleEltInInputGeneral(PyObject *cls, PyObject *args, const char *clsName)
 {
   if(!PyTuple_Check(args))
     {
@@ -2650,11 +2504,27 @@ static PyObject *NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(PyObject *cls
        zeNumpyRepr=PyDict_GetItem(PyTuple_GetItem(args,1),tmp1);//borrowed
         Py_DECREF(tmp1);
       }
+      if(!zeNumpyRepr)
+        {
+          std::ostringstream oss; oss << clsName << ".__new__ : the args in input is expected to be a tuple !";
+          throw INTERP_KERNEL::Exception(oss.str().c_str());
+        }
+      T tt;
       {
-        PyObject *tmp3(PyTuple_New(1));
-        PyTuple_SetItem(tmp3,0,zeNumpyRepr); Py_XINCREF(zeNumpyRepr);
-        PyObject *tmp2(PyObject_CallObject(initMeth,tmp3));
-        Py_XDECREF(tmp2);
+        PyObject *tmp3(0);
+        try
+          {
+            tmp3=tt(zeNumpyRepr);
+          }
+        catch(INTERP_KERNEL::Exception& e)
+          {
+            std::ostringstream oss; oss << clsName << ".__new__ : Invalid type in input " << " : " << e.what();
+            throw INTERP_KERNEL::Exception(oss.str());
+          }
+        {
+          PyObject *tmp2(PyObject_CallObject(initMeth,tmp3));
+          Py_XDECREF(tmp2);
+        }
         Py_DECREF(tmp3);
       }
       Py_DECREF(initMeth);
@@ -2662,7 +2532,33 @@ static PyObject *NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(PyObject *cls
   return instance;
 }
 
-static PyObject *convertPartDefinition(MEDCoupling::PartDefinition *pd, int owner) throw(INTERP_KERNEL::Exception)
+struct SinglePyObjToBePutInATuple
+{
+  PyObject *operator()(PyObject *zeNumpyRepr)
+  {
+    PyObject *tmp3(PyTuple_New(1));
+    PyTuple_SetItem(tmp3,0,zeNumpyRepr); Py_XINCREF(zeNumpyRepr);
+    return tmp3;
+  }
+};
+
+struct SinglePyObjExpectToBeAListOfSz2
+{
+  PyObject *operator()(PyObject *uniqueElt)
+  {
+    if(!PyTuple_Check(uniqueElt) || PyTuple_Size(uniqueElt)!=2)
+      throw INTERP_KERNEL::Exception("Not a tuple of size 2 !");
+    Py_XINCREF(uniqueElt);
+    return uniqueElt;
+  }
+};
+
+static PyObject *NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(PyObject *cls, PyObject *args, const char *clsName)
+{
+  return NewMethWrapCallInitOnlyIfDictWithSingleEltInInputGeneral<SinglePyObjToBePutInATuple>(cls,args,clsName);
+}
+
+static PyObject *convertPartDefinition(MEDCoupling::PartDefinition *pd, int owner)
 {
   PyObject *ret=0;
   if(!pd)
@@ -2677,5 +2573,789 @@ static PyObject *convertPartDefinition(MEDCoupling::PartDefinition *pd, int owne
   return ret;
 }
 
+template<class T>
+static typename MEDCoupling::Traits<T>::ArrayType *DataArrayT_New(PyObject *elt0, PyObject *nbOfTuples, PyObject *elt2)
+{
+  const char *msgBase="MEDCoupling::DataArrayDouble::New : Available API are : \n-DataArrayDouble.New()\n-DataArrayDouble.New([1.,3.,4.])\n-DataArrayDouble.New([1.,3.,4.],3)\n-DataArrayDouble.New([1.,3.,4.,5.],2,2)\n-DataArrayDouble.New([1.,3.,4.,5.,7,8.],3,2)\n-DataArrayDouble.New([(1.,3.),(4.,5.),(7,8.)])\n-DataArrayDouble.New(5)\n-DataArrayDouble.New(5,2)";
+  std::string msg(msgBase);
+#ifdef WITH_NUMPY
+  msg+="\n-DataArrayDouble.New(numpy array with dtype=float64)";
+#endif
+  msg+=" !";
+  if(PyList_Check(elt0) || PyTuple_Check(elt0))
+    {
+      if(nbOfTuples)
+        {
+          if(PyInt_Check(nbOfTuples))
+            {
+              int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
+              if(nbOfTuples1<0)
+                throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
+              if(elt2)
+                {
+                  if(PyInt_Check(elt2))
+                    {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
+                      int nbOfCompo=PyInt_AS_LONG(elt2);
+                      if(nbOfCompo<0)
+                        throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
+                      MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > ret(MEDCoupling::Traits<T>::ArrayType::New());
+                      std::vector<double> tmp(fillArrayWithPyListDbl2(elt0,nbOfTuples1,nbOfCompo));
+                      ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
+                      return ret.retn();
+                    }
+                  else
+                    throw INTERP_KERNEL::Exception(msg.c_str());
+                }
+              else
+                {//DataArrayDouble.New([1.,3.,4.],3)
+                  MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > ret(MEDCoupling::Traits<T>::ArrayType::New());
+                  int tmpp1(-1);
+                  std::vector<double> tmp(fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1));
+                  ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
+                  return ret.retn();
+                }
+            }
+          else
+            throw INTERP_KERNEL::Exception(msg.c_str());
+        }
+      else
+        {// DataArrayDouble.New([1.,3.,4.])
+          MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > ret(MEDCoupling::Traits<T>::ArrayType::New());
+          int tmpp1(-1),tmpp2(-1);
+          std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
+          ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
+          return ret.retn();
+        }
+    }
+  else if(PyInt_Check(elt0))
+    {
+      int nbOfTuples1(PyInt_AS_LONG(elt0));
+      if(nbOfTuples1<0)
+        throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
+      if(nbOfTuples)
+        {
+          if(!elt2)
+            {
+              if(PyInt_Check(nbOfTuples))
+                {//DataArrayDouble.New(5,2)
+                  int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
+                  if(nbOfCompo<0)
+                    throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
+                  MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > ret(MEDCoupling::Traits<T>::ArrayType::New());
+                  ret->alloc(nbOfTuples1,nbOfCompo);
+                  return ret.retn();
+                }
+              else
+                throw INTERP_KERNEL::Exception(msg.c_str());
+            }
+          else
+            throw INTERP_KERNEL::Exception(msg.c_str());
+        }
+      else
+        {//DataArrayDouble.New(5)
+          MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > ret(MEDCoupling::Traits<T>::ArrayType::New());
+          ret->alloc(nbOfTuples1,1);
+          return ret.retn();
+        }
+    }
+#ifdef WITH_NUMPY
+  else if(PyArray_Check(elt0) && nbOfTuples==NULL && elt2==NULL)
+    {//DataArrayDouble.New(numpyArray)
+      return BuildNewInstance< typename MEDCoupling::Traits<T>::ArrayType , T >(elt0,NPYTraits<T>::NPYObjectType,NPYTraits<T>::NPYFunc,MEDCoupling::Traits<T>::NPYStr);
+    }
 #endif
+  else
+    throw INTERP_KERNEL::Exception(msg.c_str());
+  throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
+}
 
+template<class T>
+typename MEDCoupling::Traits<T>::ArrayType *DataArrayT__setitem__internal(typename MEDCoupling::Traits<T>::ArrayType *self, PyObject *obj, PyObject *value, swig_type_info *ti)
+{
+  self->checkAllocated();
+  const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
+  int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
+  int sw1,sw2;
+  T i1;
+  std::vector<T> v1;
+  typename MEDCoupling::Traits<T>::ArrayType *d1=0;
+  considerPyObjAsATStarLikeObject<T>(value,sw1,i1,v1,d1,ti);
+  int it1,ic1;
+  std::vector<int> vt1,vc1;
+  std::pair<int, std::pair<int,int> > pt1,pc1;
+  MEDCoupling::DataArrayInt *dt1=0,*dc1=0;
+  convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
+  MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > tmp;
+  switch(sw2)
+    {
+    case 1:
+      {
+        switch(sw1)
+          {
+          case 1:
+            self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
+            return self;
+          case 2:
+            tmp=MEDCoupling::Traits<T>::ArrayType::New();
+            tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
+            self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
+            return self;
+          case 3:
+            self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
+            return self;
+          default:
+            throw INTERP_KERNEL::Exception(msg);
+          }
+        break;
+      }
+    case 2:
+      {
+        switch(sw1)
+          {
+          case 1:
+            self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
+            return self;
+          case 2:
+            tmp=MEDCoupling::Traits<T>::ArrayType::New();
+            tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
+            self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
+            return self;
+          case 3:
+            self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
+            return self;
+          default:
+            throw INTERP_KERNEL::Exception(msg);
+          }
+        break;
+      }
+    case 3:
+      {
+        switch(sw1)
+          {
+          case 1:
+            self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
+            return self;
+          case 2:
+            tmp=MEDCoupling::Traits<T>::ArrayType::New();
+            tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
+            self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
+            return self;
+          case 3:
+            self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
+            return self;
+          default:
+            throw INTERP_KERNEL::Exception(msg);
+          }
+        break;
+      }
+    case 4:
+      {
+        switch(sw1)
+          {
+          case 1:
+            self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
+            return self;
+          case 2:
+            tmp=MEDCoupling::Traits<T>::ArrayType::New();
+            tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
+            self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
+            return self;
+          case 3:
+            self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
+            return self;
+          default:
+            throw INTERP_KERNEL::Exception(msg);
+          }
+        break;
+      }
+    case 5:
+      {
+        switch(sw1)
+          {
+          case 1:
+            self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
+            return self;
+          case 2:
+            tmp=MEDCoupling::Traits<T>::ArrayType::New();
+            tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
+            self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
+            return self;
+          case 3:
+            self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
+            return self;
+          default:
+            throw INTERP_KERNEL::Exception(msg);
+          }
+        break;
+      }
+    case 6:
+      {
+        switch(sw1)
+          {
+          case 1:
+            self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
+            return self;
+          case 2:
+            tmp=MEDCoupling::Traits<T>::ArrayType::New();
+            tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
+            self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
+            return self;
+          case 3:
+            self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
+            return self;
+          default:
+            throw INTERP_KERNEL::Exception(msg);
+          }
+        break;
+      }
+    case 7:
+      {
+        switch(sw1)
+          {
+          case 1:
+            self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
+            return self;
+          case 2:
+            tmp=MEDCoupling::Traits<T>::ArrayType::New();
+            tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
+            self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
+            return self;
+          case 3:
+            self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
+            return self;
+          default:
+            throw INTERP_KERNEL::Exception(msg);
+          }
+        break;
+      }
+    case 8:
+      {
+        switch(sw1)
+          {
+          case 1:
+            self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
+            return self;
+          case 2:
+            tmp=MEDCoupling::Traits<T>::ArrayType::New();
+            tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
+            self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
+            return self;
+          case 3:
+            self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
+            return self;
+          default:
+            throw INTERP_KERNEL::Exception(msg);
+          }
+        break;
+      }
+    case 9:
+      {
+        switch(sw1)
+          {
+          case 1:
+            self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
+            return self;
+          case 2:
+            tmp=MEDCoupling::Traits<T>::ArrayType::New();
+            tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
+            self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
+            return self;
+          case 3:
+            self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
+            return self;
+          default:
+            throw INTERP_KERNEL::Exception(msg);
+          }
+        break;
+      }
+    case 10:
+      {
+        switch(sw1)
+          {
+          case 1:
+            self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
+            return self;
+          case 2:
+            tmp=MEDCoupling::Traits<T>::ArrayType::New();
+            tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
+            self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
+            return self;
+          case 3:
+            self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
+            return self;
+          default:
+            throw INTERP_KERNEL::Exception(msg);
+          }
+        break;
+      }
+    case 11:
+      {
+        switch(sw1)
+          {
+          case 1:
+            self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
+            return self;
+          case 2:
+            tmp=MEDCoupling::Traits<T>::ArrayType::New();
+            tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
+            self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
+            return self;
+          case 3:
+            self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
+            return self;
+          default:
+            throw INTERP_KERNEL::Exception(msg);
+          }
+        break;
+      }
+    case 12:
+      {
+        switch(sw1)
+          {
+          case 1:
+            self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
+            return self;
+          case 2:
+            tmp=MEDCoupling::Traits<T>::ArrayType::New();
+            tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
+            self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
+            return self;
+          case 3:
+            self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
+            return self;
+          default:
+            throw INTERP_KERNEL::Exception(msg);
+          }
+        break;
+      }
+    case 13:
+      {
+        switch(sw1)
+          {
+          case 1:
+            self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
+            return self;
+          case 2:
+            tmp=MEDCoupling::Traits<T>::ArrayType::New();
+            tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
+            self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
+            return self;
+          case 3:
+            self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
+            return self;
+          default:
+            throw INTERP_KERNEL::Exception(msg);
+          }
+        break;
+      }
+    case 14:
+      {
+        switch(sw1)
+          {
+          case 1:
+            self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
+            return self;
+          case 2:
+            tmp=MEDCoupling::Traits<T>::ArrayType::New();
+            tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
+            self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
+            return self;
+          case 3:
+            self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
+            return self;
+          default:
+            throw INTERP_KERNEL::Exception(msg);
+          }
+        break;
+      }
+    case 15:
+      {
+        switch(sw1)
+          {
+          case 1:
+            self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
+            return self;
+          case 2:
+            tmp=MEDCoupling::Traits<T>::ArrayType::New();
+            tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
+            self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
+            return self;
+          case 3:
+            self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
+            return self;
+          default:
+            throw INTERP_KERNEL::Exception(msg);
+          }
+        break;
+      }
+    case 16:
+      {
+        switch(sw1)
+          {
+          case 1:
+            self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
+            return self;
+          case 2:
+            tmp=MEDCoupling::Traits<T>::ArrayType::New();
+            tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
+            self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
+            return self;
+          case 3:
+            self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
+            return self;
+          default:
+            throw INTERP_KERNEL::Exception(msg);
+          }
+        break;
+      }
+    default:
+      throw INTERP_KERNEL::Exception(msg);
+    }
+  return self;
+}
+
+template<class T>
+PyObject *DataArrayT__getitem__internal(const typename MEDCoupling::Traits<T>::ArrayType *self, PyObject *obj, swig_type_info *ti)
+{
+  const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
+  const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
+  self->checkAllocated();
+  int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
+  int it1,ic1;
+  std::vector<int> vt1,vc1;
+  std::pair<int, std::pair<int,int> > pt1,pc1;
+  MEDCoupling::DataArrayInt *dt1=0,*dc1=0;
+  int sw;
+  convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
+  MEDCoupling::MCAuto<typename MEDCoupling::Traits<T>::ArrayType > ret;
+  switch(sw)
+    {
+    case 1:
+      if(nbOfComponents==1)
+        return PyFloat_FromDouble((T)self->getIJSafe(it1,0));
+      return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),ti, SWIG_POINTER_OWN | 0 );
+    case 2:
+      return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),ti, SWIG_POINTER_OWN | 0 );
+    case 3:
+      return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),ti, SWIG_POINTER_OWN | 0 );
+    case 4:
+      return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),ti, SWIG_POINTER_OWN | 0 );
+    case 5:
+      return PyFloat_FromDouble((T)self->getIJSafe(it1,ic1));
+    case 6:
+      {
+        ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
+        std::vector<int> v2(1,ic1);
+        return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),ti, SWIG_POINTER_OWN | 0 );
+      }
+    case 7:
+      {
+        ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
+        std::vector<int> v2(1,ic1);
+        return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),ti, SWIG_POINTER_OWN | 0 );
+      }
+    case 8:
+      {
+        ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
+        std::vector<int> v2(1,ic1);
+        return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),ti, SWIG_POINTER_OWN | 0 );
+      }
+    case 9:
+      {
+        ret=self->selectByTupleIdSafe(&it1,&it1+1);
+        return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),ti, SWIG_POINTER_OWN | 0 );
+      }
+    case 10:
+      {
+        ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
+        return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),ti, SWIG_POINTER_OWN | 0 );
+      }
+    case 11:
+      {
+        ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
+        return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),ti, SWIG_POINTER_OWN | 0 );
+      }
+    case 12:
+      {
+        ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
+        return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),ti, SWIG_POINTER_OWN | 0 );
+      }
+    case 13:
+      {
+        ret=self->selectByTupleIdSafe(&it1,&it1+1);
+        int nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2));
+        std::vector<int> v2(nbOfComp);
+        for(int i=0;i<nbOfComp;i++)
+          v2[i]=pc1.first+i*pc1.second.second;
+        return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),ti, SWIG_POINTER_OWN | 0 );
+      }
+    case 14:
+      {
+        ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
+        int nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2));
+        std::vector<int> v2(nbOfComp);
+        for(int i=0;i<nbOfComp;i++)
+          v2[i]=pc1.first+i*pc1.second.second;
+        return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),ti, SWIG_POINTER_OWN | 0 );
+      }
+    case 15:
+      {
+        ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
+        int nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2));
+        std::vector<int> v2(nbOfComp);
+        for(int i=0;i<nbOfComp;i++)
+          v2[i]=pc1.first+i*pc1.second.second;
+        return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),ti, SWIG_POINTER_OWN | 0 );
+      }
+    case 16:
+      {
+        ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
+        int nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2));
+        std::vector<int> v2(nbOfComp);
+        for(int i=0;i<nbOfComp;i++)
+          v2[i]=pc1.first+i*pc1.second.second;
+        return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),ti, SWIG_POINTER_OWN | 0 );
+      }
+    default:
+      throw INTERP_KERNEL::Exception(msg);
+    }
+}
+
+template<class T>
+PyObject *DataArrayT_imul__internal(PyObject *trueSelf, PyObject *obj, typename MEDCoupling::Traits<T>::ArrayType *self, swig_type_info *ti_da, swig_type_info *ti_tuple)
+{
+  const char msg[]="Unexpected situation in __imul__ !";
+  T val;
+  typename MEDCoupling::Traits<T>::ArrayType *a;
+  typename MEDCoupling::Traits<T>::ArrayTuple *aa;
+  std::vector<T> bb;
+  int sw;
+  convertFPStarLikePyObjToCpp_2<T>(obj,sw,val,a,aa,bb,ti_da,ti_tuple);
+  switch(sw)
+    {
+    case 1:
+      {
+        self->applyLin(val,0.);
+        Py_XINCREF(trueSelf);
+        return trueSelf;
+      }
+    case 2:
+      {
+        self->multiplyEqual(a);
+        Py_XINCREF(trueSelf);
+        return trueSelf;
+      }
+    case 3:
+      {
+        MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > aaa(aa->buildDA(1,self->getNumberOfComponents()));
+        self->multiplyEqual(aaa);
+        Py_XINCREF(trueSelf);
+        return trueSelf;
+      }
+    case 4:
+      {
+        MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > aaa(MEDCoupling::Traits<T>::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::CPP_DEALLOC,1,(int)bb.size());
+        self->multiplyEqual(aaa);
+        Py_XINCREF(trueSelf);
+        return trueSelf;
+      }
+    default:
+      throw INTERP_KERNEL::Exception(msg);
+    }
+}
+
+template<class T>
+PyObject *DataArrayT_idiv__internal(PyObject *trueSelf, PyObject *obj, typename MEDCoupling::Traits<T>::ArrayType *self, swig_type_info *ti_da, swig_type_info *ti_tuple)
+{
+  const char msg[]="Unexpected situation in __idiv__ !";
+  T val;
+  typename MEDCoupling::Traits<T>::ArrayType *a;
+  typename MEDCoupling::Traits<T>::ArrayTuple *aa;
+  std::vector<T> bb;
+  int sw;
+  convertFPStarLikePyObjToCpp_2<T>(obj,sw,val,a,aa,bb,ti_da,ti_tuple);
+  switch(sw)
+    {
+    case 1:
+      {
+        if(val==0.)
+          throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
+        self->applyLin(1./val,0.);
+        Py_XINCREF(trueSelf);
+        return trueSelf;
+      }
+    case 2:
+      {
+        self->divideEqual(a);
+        Py_XINCREF(trueSelf);
+        return trueSelf;
+      }
+    case 3:
+      {
+        MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > aaa(aa->buildDA(1,self->getNumberOfComponents()));
+        self->divideEqual(aaa);
+        Py_XINCREF(trueSelf);
+        return trueSelf;
+      }
+    case 4:
+      {
+        MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > aaa(MEDCoupling::Traits<T>::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::CPP_DEALLOC,1,(int)bb.size());
+        self->divideEqual(aaa);
+        Py_XINCREF(trueSelf);
+        return trueSelf;
+      }
+    default:
+      throw INTERP_KERNEL::Exception(msg);
+    }
+}
+
+template<class T>
+PyObject *DataArrayT_iadd__internal(PyObject *trueSelf, PyObject *obj, typename MEDCoupling::Traits<T>::ArrayType *self, swig_type_info *ti_da, swig_type_info *ti_tuple)
+{
+  const char msg[]="Unexpected situation in __iadd__ !";
+  T val;
+  typename MEDCoupling::Traits<T>::ArrayType *a;
+  typename MEDCoupling::Traits<T>::ArrayTuple *aa;
+  std::vector<T> bb;
+  int sw;
+  convertFPStarLikePyObjToCpp_2<T>(obj,sw,val,a,aa,bb,ti_da,ti_tuple);
+  switch(sw)
+    {
+    case 1:
+      {
+        self->applyLin(1.,val);
+        Py_XINCREF(trueSelf);
+        return trueSelf;
+      }
+    case 2:
+      {
+        self->addEqual(a);
+        Py_XINCREF(trueSelf);
+        return trueSelf;
+      }
+    case 3:
+      {
+        MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > aaa(aa->buildDA(1,self->getNumberOfComponents()));
+        self->addEqual(aaa);
+        Py_XINCREF(trueSelf);
+        return trueSelf;
+      }
+    case 4:
+      {
+        MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > aaa(MEDCoupling::Traits<T>::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::CPP_DEALLOC,1,(int)bb.size());
+        self->addEqual(aaa);
+        Py_XINCREF(trueSelf);
+        return trueSelf;
+      }
+    default:
+      throw INTERP_KERNEL::Exception(msg);
+    }
+}
+  
+template<class T>
+PyObject *DataArrayT_isub__internal(PyObject *trueSelf, PyObject *obj, typename MEDCoupling::Traits<T>::ArrayType *self, swig_type_info *ti_da, swig_type_info *ti_tuple)
+{
+  const char msg[]="Unexpected situation in __isub__ !";
+  T val;
+  typename MEDCoupling::Traits<T>::ArrayType *a;
+  typename MEDCoupling::Traits<T>::ArrayTuple *aa;
+  std::vector<T> bb;
+  int sw;
+  convertFPStarLikePyObjToCpp_2<T>(obj,sw,val,a,aa,bb,ti_da,ti_tuple);
+  switch(sw)
+    {
+    case 1:
+      {
+        self->applyLin(1.,-val);
+        Py_XINCREF(trueSelf);
+        return trueSelf;
+      }
+    case 2:
+      {
+        self->substractEqual(a);
+        Py_XINCREF(trueSelf);
+        return trueSelf;
+      }
+    case 3:
+      {
+        MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > aaa(aa->buildDA(1,self->getNumberOfComponents()));
+        self->substractEqual(aaa);
+        Py_XINCREF(trueSelf);
+        return trueSelf;
+      }
+    case 4:
+      {
+        MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > aaa(MEDCoupling::Traits<T>::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::CPP_DEALLOC,1,(int)bb.size());
+        self->substractEqual(aaa);
+        Py_XINCREF(trueSelf);
+        return trueSelf;
+      }
+    default:
+      throw INTERP_KERNEL::Exception(msg);
+    }
+}
+
+template<class T>
+struct SWIGTITraits
+{ };
+
+template<>
+struct SWIGTITraits<double>
+{ static swig_type_info *TI; static swig_type_info *TI_TUPLE; };
+
+template<>
+struct SWIGTITraits<float>
+{ static swig_type_info *TI; static swig_type_info *TI_TUPLE; };
+
+template<>
+struct SWIGTITraits<int>
+{ static swig_type_info *TI; static swig_type_info *TI_TUPLE; };
+
+swig_type_info *SWIGTITraits<double>::TI=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayDouble is null when called here ! Postpone initialization at inlined initializeMe()
+swig_type_info *SWIGTITraits<float>::TI=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe()
+swig_type_info *SWIGTITraits<int>::TI=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe()
+swig_type_info *SWIGTITraits<double>::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayDouble is null when called here ! Postpone initialization at inlined initializeMe()
+swig_type_info *SWIGTITraits<float>::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe()
+swig_type_info *SWIGTITraits<int>::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe()
+
+PyTypeObject *NPYTraits<double>::NPYFunc=&PyCallBackDataArrayDouble_RefType;
+
+PyTypeObject *NPYTraits<float>::NPYFunc=&PyCallBackDataArrayFloat_RefType;
+
+template<class T>
+typename MEDCoupling::Traits<T>::ArrayType *DataArrayT__setitem__(typename MEDCoupling::Traits<T>::ArrayType *self, PyObject *obj, PyObject *value)
+{
+  return DataArrayT__setitem__internal<T>(self,obj,value,SWIGTITraits<T>::TI);
+}
+
+template<class T>
+PyObject *DataArrayT__getitem(const typename MEDCoupling::Traits<T>::ArrayType *self, PyObject *obj)
+{
+  return DataArrayT__getitem__internal<T>(self,obj,SWIGTITraits<T>::TI);
+}
+
+template<class T>
+PyObject *DataArrayT_imul(PyObject *trueSelf, PyObject *obj, typename MEDCoupling::Traits<T>::ArrayType *self)
+{
+  return DataArrayT_imul__internal<T>(trueSelf,obj,self,SWIGTITraits<T>::TI,SWIGTITraits<T>::TI_TUPLE);
+}
+
+template<class T>
+PyObject *DataArrayT_idiv(PyObject *trueSelf, PyObject *obj, typename MEDCoupling::Traits<T>::ArrayType *self)
+{
+  return DataArrayT_idiv__internal<T>(trueSelf,obj,self,SWIGTITraits<T>::TI,SWIGTITraits<T>::TI_TUPLE);
+}
+
+template<class T>
+PyObject *DataArrayT_iadd(PyObject *trueSelf, PyObject *obj, typename MEDCoupling::Traits<T>::ArrayType *self)
+{
+  return DataArrayT_iadd__internal<T>(trueSelf,obj,self,SWIGTITraits<T>::TI,SWIGTITraits<T>::TI_TUPLE);
+}
+
+template<class T>
+PyObject *DataArrayT_isub(PyObject *trueSelf, PyObject *obj, typename MEDCoupling::Traits<T>::ArrayType *self)
+{
+  return DataArrayT_isub__internal<T>(trueSelf,obj,self,SWIGTITraits<T>::TI,SWIGTITraits<T>::TI_TUPLE);
+}
+
+#endif
index 9d68678e4340ee545bfb50dc01d6e40a0ac02469..99f975407ea5e153ae0c9060ae64cecb9fd8bf1e 100644 (file)
@@ -60,7 +60,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 +225,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 +284,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 +541,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 +558,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 +569,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 +586,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 +615,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 +646,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 +670,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 +683,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 +705,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..4e6f406fe733ba900f234d65ccd14e97e261aa85 100644 (file)
@@ -43,7 +43,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 +1478,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 +1500,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 +1513,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 +1524,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 +1890,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 +2009,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 +2019,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 +2042,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 +2051,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 +2064,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 +2073,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 +2084,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 +2093,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 426faae0e98d8088cddaa4e3beb036da95730837..8c5ca3fea466b3ff4649fed8044a81aaa53082c4 100644 (file)
@@ -69,7 +69,7 @@ namespace MEDCoupling
       {
         int sz=0,sw=-1,val1=-1;
         std::vector<int> val2;
-        const int *inp=convertObjToPossibleCpp1_Safe(li,sw,sz,val1,val2);
+        const int *inp=convertIntStarLikePyObjToCppIntStar(li,sw,sz,val1,val2);
         return self->clonePart(inp,inp+sz);
       }
       
@@ -103,7 +103,7 @@ namespace MEDCoupling
       {
         std::vector<int> vVal; int iVal=-1;
         int sz=-1,sw=0;
-        const int *tupleIdsBg=convertObjToPossibleCpp1_Safe(tupleIds,sw,sz,iVal,vVal);
+        const int *tupleIdsBg=convertIntStarLikePyObjToCppIntStar(tupleIds,sw,sz,iVal,vVal);
         if(sw==0)
           throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretization::computeMeshRestrictionFromTupleIds : none parameter in input !");
         DataArrayInt *ret0=0,*ret1=0;
@@ -121,7 +121,7 @@ namespace MEDCoupling
         int sz(arr->getNumberOfComponents());
         INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
         self->normL1(mesh,arr,tmp);
-        return convertDblArrToPyList(tmp,sz);
+        return convertDblArrToPyList<double>(tmp,sz);
       }
 
       virtual PyObject *normL2(const MEDCouplingMesh *mesh, const DataArrayDouble *arr) const throw(INTERP_KERNEL::Exception)
@@ -131,7 +131,7 @@ namespace MEDCoupling
         int sz(arr->getNumberOfComponents());
         INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
         self->normL2(mesh,arr,tmp);
-        return convertDblArrToPyList(tmp,sz);
+        return convertDblArrToPyList<double>(tmp,sz);
       }
 
       virtual PyObject *integral(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, bool isWAbs) const throw(INTERP_KERNEL::Exception)
@@ -141,7 +141,7 @@ namespace MEDCoupling
         int sz(arr->getNumberOfComponents());
         INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
         self->integral(mesh,arr,isWAbs,tmp);
-        return convertDblArrToPyList(tmp,sz);
+        return convertDblArrToPyList<double>(tmp,sz);
       }
 
       virtual PyObject *getCellIdsHavingGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception)
@@ -196,7 +196,7 @@ namespace MEDCoupling
         //
         INTERP_KERNEL::AutoPtr<double> res(new double[spaceDim]);
         self->getValueOn(arr,mesh,spaceLoc,res);
-        return convertDblArrToPyList(res,spaceDim);
+        return convertDblArrToPyList<double>(res,spaceDim);
       }
 
       virtual PyObject *getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k) const throw(INTERP_KERNEL::Exception)
@@ -206,7 +206,7 @@ namespace MEDCoupling
         int sz(arr->getNumberOfComponents());
          INTERP_KERNEL::AutoPtr<double> res=new double[sz];
          self->getValueOnPos(arr,mesh,i,j,k,res);
-         return convertDblArrToPyList(res,sz);
+         return convertDblArrToPyList<double>(res,sz);
        }
       
       virtual DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, PyObject *loc) const throw(INTERP_KERNEL::Exception)
@@ -225,7 +225,7 @@ namespace MEDCoupling
       {
         int sw,sz(-1);
         int v0; std::vector<int> v1;
-        const int *ids(convertObjToPossibleCpp1_Safe(li,sw,sz,v0,v1));
+        const int *ids(convertIntStarLikePyObjToCppIntStar(li,sw,sz,v0,v1));
         self->renumberCells(ids,check);
       }
 
@@ -237,7 +237,7 @@ namespace MEDCoupling
         //
         int sw,sz(-1);
         int v0; std::vector<int> v1;
-        const int *old2NewBg(convertObjToPossibleCpp1_Safe(old2New,sw,sz,v0,v1));
+        const int *old2NewBg(convertIntStarLikePyObjToCppIntStar(old2New,sw,sz,v0,v1));
         //
         self->renumberArraysForCell(mesh,input1,old2NewBg,check);
       }
@@ -246,7 +246,7 @@ namespace MEDCoupling
       {
         int sw,sz(-1);
         int v0; std::vector<int> v1;
-        const int *cellIdsBg(convertObjToPossibleCpp1_Safe(cellIds,sw,sz,v0,v1));
+        const int *cellIdsBg(convertIntStarLikePyObjToCppIntStar(cellIds,sw,sz,v0,v1));
         return self->computeTupleIdsToSelectFromCellIds(mesh,cellIdsBg,cellIdsBg+sz);
       }
 
@@ -254,7 +254,7 @@ namespace MEDCoupling
       {
         int sw,sz(-1);
         int v0; std::vector<int> v1;
-        const int *idsBg(convertObjToPossibleCpp1_Safe(ids,sw,sz,v0,v1));
+        const int *idsBg(convertIntStarLikePyObjToCppIntStar(ids,sw,sz,v0,v1));
         DataArrayInt *di(0);
         MEDCouplingMesh *ret0=self->buildSubMeshData(mesh,idsBg,idsBg+sz,di);
         PyObject *ret=PyTuple_New(2);
@@ -267,7 +267,7 @@ namespace MEDCoupling
       {
         int sw,sz(-1);
         int v0; std::vector<int> v1;
-        const int *old2NewBg(convertObjToPossibleCpp1_Safe(old2New,sw,sz,v0,v1));
+        const int *old2NewBg(convertIntStarLikePyObjToCppIntStar(old2New,sw,sz,v0,v1));
         self->renumberValuesOnNodes(epsOnVals,old2NewBg,newNbOfNodes,arr);
       }
 
@@ -275,7 +275,7 @@ namespace MEDCoupling
       {
         int sw,sz(-1);
         int v0; std::vector<int> v1;
-        const int *old2NewBg(convertObjToPossibleCpp1_Safe(old2New,sw,sz,v0,v1));
+        const int *old2NewBg(convertIntStarLikePyObjToCppIntStar(old2New,sw,sz,v0,v1));
         self->renumberValuesOnCells(epsOnVals,mesh,old2NewBg,newSz,arr);
       }
 
@@ -283,7 +283,7 @@ namespace MEDCoupling
       {
         int sw,sz(-1);
         int v0; std::vector<int> v1;
-        const int *new2oldBg(convertObjToPossibleCpp1_Safe(new2old,sw,sz,v0,v1));
+        const int *new2oldBg(convertIntStarLikePyObjToCppIntStar(new2old,sw,sz,v0,v1));
         self->renumberValuesOnCellsR(mesh,new2oldBg,newSz,arr);
       }
     }
@@ -353,21 +353,21 @@ namespace MEDCoupling
       {
         std::size_t sz(0);
         const double *ret(MEDCouplingFieldDiscretizationGaussNE::GetWeightArrayFromGeometricType(geoType,sz));
-        return convertDblArrToPyList(ret,sz);
+        return convertDblArrToPyList<double>(ret,sz);
       }
       
       static PyObject *GetRefCoordsFromGeometricType(INTERP_KERNEL::NormalizedCellType geoType) throw(INTERP_KERNEL::Exception)
       {
         std::size_t sz(0);
         const double *ret(MEDCouplingFieldDiscretizationGaussNE::GetRefCoordsFromGeometricType(geoType,sz));
-        return convertDblArrToPyList(ret,sz);
+        return convertDblArrToPyList<double>(ret,sz);
       }
       
       static PyObject *GetLocsFromGeometricType(INTERP_KERNEL::NormalizedCellType geoType) throw(INTERP_KERNEL::Exception)
       {
         std::size_t sz(0);
         const double *ret(MEDCouplingFieldDiscretizationGaussNE::GetLocsFromGeometricType(geoType,sz));
-        return convertDblArrToPyList(ret,sz);
+        return convertDblArrToPyList<double>(ret,sz);
       }
     }
   };
index 1640bc63b7acd614831f4b58365c976636600d51..749f5a3abc62c178d5a887b4c30e5ef08b4fad43 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,24 +39,53 @@ 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)
 
+DataArrayFloat.__new__=classmethod(MEDCouplingDataArrayFloatnew)
+DataArrayFloat.__iadd__=MEDCouplingDataArrayFloatIadd
+DataArrayFloat.__isub__=MEDCouplingDataArrayFloatIsub
+DataArrayFloat.__imul__=MEDCouplingDataArrayFloatImul
+DataArrayFloat.__idiv__=MEDCouplingDataArrayFloatIdiv
+DataArrayFloat.__itruediv__=MEDCouplingDataArrayFloatIdiv
+DataArrayFloat.__ifloordiv__=MEDCouplingDataArrayFloatIdiv
+
+MEDCouplingFieldDouble.__new__=classmethod(MEDCouplingFieldDoublenew)
 MEDCouplingFieldDouble.__iadd__=MEDCouplingFieldDoubleIadd
 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
+
+MEDCouplingFieldInt.__new__=classmethod(MEDCouplingFieldIntnew)
+  
+MEDCouplingFieldFloat.__new__=classmethod(MEDCouplingFieldFloatnew)
 
 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
@@ -63,7 +98,12 @@ MEDCouplingCurveLinearMesh.__new__=classmethod(MEDCouplingCurveLinearMeshnew)
 MEDCouplingCMesh.__new__=classmethod(MEDCouplingCMeshnew)
 MEDCouplingIMesh.__new__=classmethod(MEDCouplingIMeshnew)
 MEDCouplingMappedExtrudedMesh.__new__=classmethod(MEDCouplingExtrudedMeshnew)
-MEDCouplingFieldDouble.__new__=classmethod(MEDCouplingFieldDoublenew)
+
+DataArrayAsciiCharIterator.__next__ = DataArrayAsciiCharIterator.next
+DataArrayIntIterator.__next__ = DataArrayIntIterator.next
+DataArrayDoubleIterator.__next__ = DataArrayDoubleIterator.next
+MEDCouplingUMeshCellIterator.__next__ = MEDCouplingUMeshCellIterator.next
+MEDCouplingUMeshCellByTypeIterator.__next__ = MEDCouplingUMeshCellByTypeIterator.next
 
 del INTERPKERNELExceptionReduce
 del MEDCouplingDataArrayDoublenew
@@ -83,6 +123,11 @@ del MEDCouplingDataArrayIntImul
 del MEDCouplingDataArrayIntIdiv
 del MEDCouplingDataArrayIntImod
 del MEDCouplingDataArrayBytenew
+del MEDCouplingDataArrayFloatnew
+del MEDCouplingDataArrayFloatIadd
+del MEDCouplingDataArrayFloatIsub
+del MEDCouplingDataArrayFloatImul
+del MEDCouplingDataArrayFloatIdiv
 del MEDCouplingDataArrayDoubleTupleIadd
 del MEDCouplingDataArrayDoubleTupleIsub
 del MEDCouplingDataArrayDoubleTupleImul
index 4029b5db677a2ae527cb7f830243abd8325adf74..786ee271d8fce6991899e1313dae4d06930a4654 100644 (file)
@@ -23,7 +23,7 @@ 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 MEDCouplingIntersectTest(unittest.TestCase):
     def testSwig2NonRegressionBugIntersectMeshes1(self):
@@ -79,7 +79,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 +124,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 +153,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 +180,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 +209,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 +236,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 +269,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 +340,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 +368,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 +417,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 +437,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 +480,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 +612,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 +643,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 +672,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 +707,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 +738,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 +804,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 +826,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..ab06253fe49c237e28f7886a263523fd72bc2318 100644 (file)
@@ -16,7 +16,7 @@
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-// Author : Anthony Geay (CEA/DEN)
+// Author : Anthony Geay (EDF R&D)
 
 ////////////////////
 %typemap(out) MEDCoupling::DataArray*
 {
   $result=convertDataArrayChar($1,$owner);
 }
+
+%typemap(out) MCAuto<MEDCoupling::DataArrayInt>
+{
+  $result=SWIG_NewPointerObj(SWIG_as_voidptr($1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN|0);
+}
+
+%typemap(out) MCAuto<MEDCoupling::DataArrayDouble>
+{
+  $result=SWIG_NewPointerObj(SWIG_as_voidptr($1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble,SWIG_POINTER_OWN|0);
+}
+
+%typemap(out) MCAuto<MEDCoupling::DataArrayFloat>
+{
+  $result=SWIG_NewPointerObj(SWIG_as_voidptr($1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayFloat,SWIG_POINTER_OWN|0);
+}
+
+%typemap(out) MCAuto<MEDCoupling::MapII>
+{
+  $result=SWIG_NewPointerObj(SWIG_as_voidptr($1.retn()),SWIGTYPE_p_MEDCoupling__MapII,SWIG_POINTER_OWN|0);
+}
 //$$$$$$$$$$$$$$$$$$
 
 %newobject MEDCoupling::DataArray::deepCopy;
 %newobject MEDCoupling::DataArray::selectByTupleIdSafe;
 %newobject MEDCoupling::DataArray::selectByTupleIdSafeSlice;
 %newobject MEDCoupling::DataArray::Aggregate;
+%newobject MEDCoupling::DataArrayFloat::New;
+%newobject MEDCoupling::DataArrayFloat::iterator;
+%newobject MEDCoupling::DataArrayFloat::__iter__;
+%newobject MEDCoupling::DataArrayFloat::Meld;
 %newobject MEDCoupling::DataArrayInt::New;
 %newobject MEDCoupling::DataArrayInt::__iter__;
-%newobject MEDCoupling::DataArrayInt::selectPartDef;
-%newobject MEDCoupling::DataArrayInt::convertToDblArr;
 %newobject MEDCoupling::DataArrayInt::performCopyOrIncrRef;
 %newobject MEDCoupling::DataArrayInt::subArray;
 %newobject MEDCoupling::DataArrayInt::changeNbOfComponents;
@@ -75,7 +97,7 @@
 %newobject MEDCoupling::DataArrayInt::computeAbs;
 %newobject MEDCoupling::DataArrayInt::findIdsInRange;
 %newobject MEDCoupling::DataArrayInt::findIdsNotInRange;
-%newobject MEDCoupling::DataArrayInt::findIdsStricltyNegative;
+%newobject MEDCoupling::DataArrayInt::findIdsStrictlyNegative;
 %newobject MEDCoupling::DataArrayInt::Aggregate;
 %newobject MEDCoupling::DataArrayInt::AggregateIndexes;
 %newobject MEDCoupling::DataArrayInt::Meld;
 %newobject MEDCoupling::DataArrayAsciiCharTuple::buildDAAsciiChar;
 %newobject MEDCoupling::DataArrayDouble::New;
 %newobject MEDCoupling::DataArrayDouble::__iter__;
-%newobject MEDCoupling::DataArrayDouble::selectPartDef;
-%newobject MEDCoupling::DataArrayDouble::convertToIntArr;
 %newobject MEDCoupling::DataArrayDouble::performCopyOrIncrRef;
 %newobject MEDCoupling::DataArrayDouble::Aggregate;
 %newobject MEDCoupling::DataArrayDouble::Meld;
 %newobject MEDCoupling::DataArrayDouble::accumulatePerChunck;
 %newobject MEDCoupling::DataArrayDouble::findIdsInRange;
 %newobject MEDCoupling::DataArrayDouble::findIdsNotInRange;
+%newobject MEDCoupling::DataArrayDouble::findIdsStrictlyNegative;
 %newobject MEDCoupling::DataArrayDouble::negate;
 %newobject MEDCoupling::DataArrayDouble::computeAbs;
 %newobject MEDCoupling::DataArrayDouble::applyFunc;
 %feature("unref") DataArrayAsciiChar "$this->decrRef();"
 %feature("unref") DataArrayByte "$this->decrRef();"
 
+%feature("unref") MapII "$this->decrRef();"
 %feature("unref") PartDefinition "$this->decrRef();"
 %feature("unref") DataArrayPartDefinition "$this->decrRef();"
 %feature("unref") SlicePartDefinition "$this->decrRef();"
@@ -234,6 +256,12 @@ namespace MEDCoupling
     } MEDCouplingAxisType;
 
   class DataArrayInt;
+
+  class MapII : public RefCountObject, public TimeLabel
+  {
+  public:
+    static MCAuto< MapII > New();
+  };
   
   class PartDefinition : public RefCountObject, public TimeLabel
   {
@@ -549,8 +577,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 +588,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 +599,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 +608,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 +624,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 +633,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,17 +662,213 @@ 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))
-          throw INTERP_KERNEL::Exception(MSG);
+        self->setName(convertPyObjectToStr(a0,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);
       }
     }
   };
+
+  class DataArrayDouble;
+
+  class DataArrayFloat : public DataArray
+  {
+  public:
+    static DataArrayFloat *New();
+    void fillWithValue(float val) throw(INTERP_KERNEL::Exception);
+    bool isEqual(const DataArrayFloat& other, float prec) const throw(INTERP_KERNEL::Exception);
+    bool isEqualWithoutConsideringStr(const DataArrayFloat& other, float prec) const throw(INTERP_KERNEL::Exception);
+    bool isUniform(float val, float eps) const throw(INTERP_KERNEL::Exception);
+    void pushBackSilent(float val) throw(INTERP_KERNEL::Exception);
+    void iota(float init=0.) throw(INTERP_KERNEL::Exception);
+    DataArrayFloatIterator *iterator() throw(INTERP_KERNEL::Exception);
+    MCAuto<DataArrayDouble> convertToDblArr() const throw(INTERP_KERNEL::Exception);
+    static DataArrayFloat *Meld(const DataArrayFloat *a1, const DataArrayFloat *a2) throw(INTERP_KERNEL::Exception);
+    %extend
+    {
+      DataArrayFloat() throw(INTERP_KERNEL::Exception)
+      {
+        return DataArrayFloat::New();
+      }
+
+      static DataArrayFloat *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
+      {
+        return DataArrayT_New<float>(elt0,nbOfTuples,elt2);
+      }
+   
+      DataArrayFloat(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
+      {
+        return MEDCoupling_DataArrayFloat_New__SWIG_1(elt0,nbOfTuples,elt2);
+      }
+
+      DataArrayFloatIterator *__iter__() throw(INTERP_KERNEL::Exception)
+      {
+        return self->iterator();
+      }
+
+      std::string __repr__() const throw(INTERP_KERNEL::Exception)
+      {
+        std::ostringstream oss;
+        self->reprQuickOverview(oss);
+        return oss.str();
+      }
+
+      std::string __str__() const throw(INTERP_KERNEL::Exception)
+      {
+        return self->reprNotTooLong();
+      }
+
+      int __len__() const throw(INTERP_KERNEL::Exception)
+      {
+        if(self->isAllocated())
+          {
+            return self->getNumberOfTuples();
+          }
+        else
+          {
+            throw INTERP_KERNEL::Exception("DataArrayFloat::__len__ : Instance is NOT allocated !");
+          }
+      }
+
+      PyObject *getValues() const throw(INTERP_KERNEL::Exception)
+      {
+        const float *vals(self->begin());
+        return convertDblArrToPyList<float>(vals,self->getNbOfElems());
+      }
+
+      PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
+      {
+        const float *vals(self->begin());
+        int nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples());
+        return convertDblArrToPyListOfTuple<float>(vals,nbOfComp,nbOfTuples);
+      }
+      
+      PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
+      {
+        return DataArrayT__getitem<float>(self,obj);
+      }
+
+      DataArrayFloat *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
+      {
+        return DataArrayT__setitem__<float>(self,obj,value);
+      }
+      
+      PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
+      {
+        return DataArrayT_iadd<float>(trueSelf,obj,self);
+      }
+
+      PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
+      {
+        return DataArrayT_isub<float>(trueSelf,obj,self);
+      }
+
+      PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
+      {
+        return DataArrayT_imul<float>(trueSelf,obj,self);
+      }
+
+      PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
+      {
+        return DataArrayT_idiv<float>(trueSelf,obj,self);
+      }
+      
+#ifdef WITH_NUMPY
+      PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
+      {
+        return ToNumPyArray<DataArrayFloat,float>(self,NPY_FLOAT,"DataArrayFloat");
+      }
+#endif
+
+      // serialization
+      static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
+      {
+        return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayFloat");
+      }
+      
+      PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
+      {
+#ifdef WITH_NUMPY
+        if(!self->isAllocated())
+          throw INTERP_KERNEL::Exception("PyWrap of DataArrayFloat.__getnewargs__ : self is not allocated !");
+        PyObject *ret(PyTuple_New(1));
+        PyObject *ret0(PyDict_New());
+        PyObject *numpyArryObj(MEDCoupling_DataArrayFloat_toNumPyArray(self));
+        {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
+          PyObject *tmp1(PyInt_FromLong(0));
+          PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
+          PyTuple_SetItem(ret,0,ret0);
+        }
+        return ret;
+#else
+        throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
+#endif
+      }
+    }
+  };
+
+  class DataArrayFloatTuple;
+
+  class DataArrayFloatIterator
+  {
+  public:
+    DataArrayFloatIterator(DataArrayFloat *da);
+    ~DataArrayFloatIterator();
+    %extend
+    {
+      PyObject *next()
+      {
+        DataArrayFloatTuple *ret=self->nextt();
+        if(ret)
+          return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayFloatTuple,SWIG_POINTER_OWN|0);
+        else
+          {
+            PyErr_SetString(PyExc_StopIteration,"No more data.");
+            return 0;
+          }
+      }
+    }
+  };
+
+  class DataArrayFloatTuple
+  {
+  public:
+    int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
+    DataArrayFloat *buildDAFloat(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
+    %extend
+    {
+      std::string __str__() const throw(INTERP_KERNEL::Exception)
+      {
+        return self->repr();
+      }
+
+      float __float__() const throw(INTERP_KERNEL::Exception)
+      {
+        return self->floatValue();
+      }
+
+      DataArrayFloat *buildDAFloat() throw(INTERP_KERNEL::Exception)
+      {
+        return self->buildDAFloat(1,self->getNumberOfCompo());
+      }
+  
+      /*PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
+      {
+        MCAuto<DataArrayFloat> ret=self->buildDAFloat(1,self->getNumberOfCompo());
+        MEDCoupling_DataArrayFloat____imul___(ret,0,obj);
+        Py_XINCREF(trueSelf);
+        return trueSelf;
+        }*/
+
+      PyObject *__len__() throw(INTERP_KERNEL::Exception)
+      {
+        return PyInt_FromLong(self->getNumberOfCompo());
+      }
+    }
+  };
   
   class DataArrayInt;
   class DataArrayDoubleIterator;
@@ -682,7 +900,6 @@ namespace MEDCoupling
     std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
     bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
     bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
-    DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
     DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
     DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
     DataArrayDouble *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
@@ -754,6 +971,7 @@ namespace MEDCoupling
     void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
     DataArrayInt *findIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
     DataArrayInt *findIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
+    DataArrayInt *findIdsStrictlyNegative() const throw(INTERP_KERNEL::Exception);
     static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
     static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
     static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
@@ -770,117 +988,29 @@ namespace MEDCoupling
     void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
     static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
     void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
+    MCAuto<DataArrayInt> findIdsGreaterOrEqualTo(double val) const throw(INTERP_KERNEL::Exception);
+    MCAuto<DataArrayInt> findIdsGreaterThan(double val) const throw(INTERP_KERNEL::Exception);
+    MCAuto<DataArrayInt> findIdsLowerOrEqualTo(double val) const throw(INTERP_KERNEL::Exception);
+    MCAuto<DataArrayInt> findIdsLowerThan(double val) const throw(INTERP_KERNEL::Exception);
+    MCAuto<DataArrayInt> convertToIntArr() const throw(INTERP_KERNEL::Exception);
+    MCAuto<DataArrayDouble> selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception);
+    MCAuto<DataArrayDouble> cumSum() const throw(INTERP_KERNEL::Exception);
+    MCAuto<DataArrayFloat> convertToFloatArr() const throw(INTERP_KERNEL::Exception);
     %extend
     {
       DataArrayDouble() throw(INTERP_KERNEL::Exception)
-        {
-          return DataArrayDouble::New();
-        }
+      {
+        return DataArrayDouble::New();
+      }
 
       static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
       {
-        const char *msgBase="MEDCoupling::DataArrayDouble::New : Available API are : \n-DataArrayDouble.New()\n-DataArrayDouble.New([1.,3.,4.])\n-DataArrayDouble.New([1.,3.,4.],3)\n-DataArrayDouble.New([1.,3.,4.,5.],2,2)\n-DataArrayDouble.New([1.,3.,4.,5.,7,8.],3,2)\n-DataArrayDouble.New([(1.,3.),(4.,5.),(7,8.)])\n-DataArrayDouble.New(5)\n-DataArrayDouble.New(5,2)";
-        std::string msg(msgBase);
-#ifdef WITH_NUMPY
-        msg+="\n-DataArrayDouble.New(numpy array with dtype=float64)";
-#endif
-        msg+=" !";
-        if(PyList_Check(elt0) || PyTuple_Check(elt0))
-          {
-            if(nbOfTuples)
-              {
-                if(PyInt_Check(nbOfTuples))
-                  {
-                    int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
-                    if(nbOfTuples1<0)
-                      throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
-                    if(elt2)
-                      {
-                        if(PyInt_Check(elt2))
-                          {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
-                            int nbOfCompo=PyInt_AS_LONG(elt2);
-                            if(nbOfCompo<0)
-                              throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
-                            MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
-                            std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,nbOfCompo);
-                            ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
-                            return ret.retn();
-                          }
-                        else
-                          throw INTERP_KERNEL::Exception(msg.c_str());
-                      }
-                    else
-                      {//DataArrayDouble.New([1.,3.,4.],3)
-                        MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
-                        int tmpp1=-1;
-                        std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1);
-                        ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
-                        return ret.retn();
-                      }
-                  }
-                else
-                  throw INTERP_KERNEL::Exception(msg.c_str());
-              }
-            else
-              {// DataArrayDouble.New([1.,3.,4.])
-                MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
-                int tmpp1=-1,tmpp2=-1;
-                std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
-                ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
-                return ret.retn();
-              }
-          }
-        else if(PyInt_Check(elt0))
-          {
-            int nbOfTuples1=PyInt_AS_LONG(elt0);
-            if(nbOfTuples1<0)
-              throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
-            if(nbOfTuples)
-              {
-                if(!elt2)
-                  {
-                    if(PyInt_Check(nbOfTuples))
-                      {//DataArrayDouble.New(5,2)
-                        int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
-                        if(nbOfCompo<0)
-                          throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
-                        MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
-                        ret->alloc(nbOfTuples1,nbOfCompo);
-                        return ret.retn();
-                      }
-                    else
-                      throw INTERP_KERNEL::Exception(msg.c_str());
-                  }
-                else
-                  throw INTERP_KERNEL::Exception(msg.c_str());
-              }
-            else
-              {//DataArrayDouble.New(5)
-                MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
-                ret->alloc(nbOfTuples1,1);
-                return ret.retn();
-              }
-          }
-#ifdef WITH_NUMPY
-        else if(PyArray_Check(elt0) && nbOfTuples==NULL && elt2==NULL)
-          {//DataArrayDouble.New(numpyArray)
-            return BuildNewInstance<DataArrayDouble,double>(elt0,NPY_DOUBLE,&PyCallBackDataArrayDouble_RefType,"FLOAT64");
-          }
-#endif
-        else
-          throw INTERP_KERNEL::Exception(msg.c_str());
-        throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
+        return DataArrayT_New<double>(elt0,nbOfTuples,elt2);
       }
    
       DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
-        {
-          return MEDCoupling_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
-        }
-
-      DataArrayDouble *selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception)
       {
-        MCAuto<DataArrayDouble> ret(self->selectPartDef(pd));
-        return ret.retn();
+        return MEDCoupling_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
       }
 
       void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
@@ -975,8 +1105,8 @@ namespace MEDCoupling
 
       PyObject *getValues() const throw(INTERP_KERNEL::Exception)
       {
-        const double *vals=self->getConstPointer();
-        return convertDblArrToPyList(vals,self->getNbOfElems());
+        const double *vals(self->begin());
+        return convertDblArrToPyList<double>(vals,self->getNbOfElems());
       }
 
 #ifdef WITH_NUMPY
@@ -1000,10 +1130,9 @@ namespace MEDCoupling
 
       PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
       {
-        const double *vals=self->getConstPointer();
-        int nbOfComp=self->getNumberOfComponents();
-        int nbOfTuples=self->getNumberOfTuples();
-        return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
+        const double *vals(self->begin());
+        int nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples());
+        return convertDblArrToPyListOfTuple<double>(vals,nbOfComp,nbOfTuples);
       }
 
       DataArrayDouble *symmetry3DPlane(PyObject *point, PyObject *normalVector) throw(INTERP_KERNEL::Exception)
@@ -1031,7 +1160,7 @@ namespace MEDCoupling
         const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val,a,aa,bb,msg,1,3,true));
         double res[9];
         DataArrayDouble::GiveBaseForPlane(vectorPtr,res);
-        return convertDblArrToPyListOfTuple(res,3,3);
+        return convertDblArrToPyListOfTuple<double>(res,3,3);
       }
 
       DataArrayDouble *fromCartToCylGiven(const DataArrayDouble *coords, PyObject *center, PyObject *vector) const
@@ -1187,10 +1316,10 @@ namespace MEDCoupling
 
       PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
       {
-        int nbOfCompo=self->getNumberOfComponents();
-        INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
+        int nbOfCompo(self->getNumberOfComponents());
+        INTERP_KERNEL::AutoPtr<double> tmp(new double[2*nbOfCompo]);
         self->getMinMaxPerComponent(tmp);
-        PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
+        PyObject *ret=convertDblArrToPyListOfTuple<double>(tmp,2,nbOfCompo);
         return ret;
       }
 
@@ -1199,14 +1328,14 @@ namespace MEDCoupling
         int sz=self->getNumberOfComponents();
         INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
         self->accumulate(tmp);
-        return convertDblArrToPyList(tmp,sz);
+        return convertDblArrToPyList<double>(tmp,sz);
       }
 
       DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
       {
         int sw,sz,val;
         std::vector<int> val2;
-        const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
+        const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
         return self->accumulatePerChunck(bg,bg+sz);
       }
 
@@ -1250,513 +1379,71 @@ namespace MEDCoupling
         std::size_t sz(retCpp.size());
         PyObject *res(PyList_New(sz));
         for(std::size_t i=0;i<sz;i++)
-          PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
-        return res;
-      }
-   
-      PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
-      {
-        int sz=self->getNumberOfComponents();
-        INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
-        self->getTuple(tupleId,tmp);
-        return convertDblArrToPyList(tmp,sz);
-      }
-
-      static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
-      {
-        std::vector<const DataArrayDouble *> tmp;
-        convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
-        return DataArrayDouble::Aggregate(tmp);
-      }
-
-      static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
-      {
-        std::vector<const DataArrayDouble *> tmp;
-        convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
-        return DataArrayDouble::Meld(tmp);
-      }
-
-      PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
-      {
-        double val;
-        DataArrayDouble *a;
-        DataArrayDoubleTuple *aa;
-        std::vector<double> bb;
-        int sw;
-        int nbComp=self->getNumberOfComponents(),nbTuples=-1;
-        const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
-        const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
-        MCAuto<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
-        DataArrayInt *c=0,*cI=0;
-        self->computeTupleIdsNearTuples(inpu,eps,c,cI);
-        PyObject *ret=PyTuple_New(2);
-        PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
-        PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
-        return ret;
-      }
-
-      PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
-      {
-        DataArrayInt *ret1=0;
-        bool ret0=self->areIncludedInMe(other,prec,ret1);
-        PyObject *ret=PyTuple_New(2);
-        PyObject *ret0Py=ret0?Py_True:Py_False;
-        Py_XINCREF(ret0Py);
-        PyTuple_SetItem(ret,0,ret0Py);
-        PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
-        return ret;
-      }
-
-      PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
-      {
-        const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
-        const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
-        self->checkAllocated();
-        int nbOfTuples=self->getNumberOfTuples();
-        int nbOfComponents=self->getNumberOfComponents();
-        int it1,ic1;
-        std::vector<int> vt1,vc1;
-        std::pair<int, std::pair<int,int> > pt1,pc1;
-        DataArrayInt *dt1=0,*dc1=0;
-        int sw;
-        convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
-        MCAuto<DataArrayDouble> ret;
-        switch(sw)
-          {
-          case 1:
-            if(nbOfComponents==1)
-              return PyFloat_FromDouble(self->getIJSafe(it1,0));
-            return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
-          case 2:
-            return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
-          case 3:
-            return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
-          case 4:
-            return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
-          case 5:
-            return PyFloat_FromDouble(self->getIJSafe(it1,ic1));
-          case 6:
-            {
-              ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
-              std::vector<int> v2(1,ic1);
-              return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
-            }
-          case 7:
-            {
-              ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
-              std::vector<int> v2(1,ic1);
-              return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
-            }
-          case 8:
-            {
-              ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
-              std::vector<int> v2(1,ic1);
-              return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
-            }
-          case 9:
-            {
-              ret=self->selectByTupleIdSafe(&it1,&it1+1);
-              return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
-            }
-          case 10:
-            {
-              ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
-              return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
-            }
-          case 11:
-            {
-              ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
-              return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
-            }
-          case 12:
-            {
-              ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
-              return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
-            }
-          case 13:
-            {
-              ret=self->selectByTupleIdSafe(&it1,&it1+1);
-              int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
-              std::vector<int> v2(nbOfComp);
-              for(int i=0;i<nbOfComp;i++)
-                v2[i]=pc1.first+i*pc1.second.second;
-              return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
-            }
-          case 14:
-            {
-              ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
-              int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
-              std::vector<int> v2(nbOfComp);
-              for(int i=0;i<nbOfComp;i++)
-                v2[i]=pc1.first+i*pc1.second.second;
-              return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
-            }
-          case 15:
-            {
-              ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
-              int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
-              std::vector<int> v2(nbOfComp);
-              for(int i=0;i<nbOfComp;i++)
-                v2[i]=pc1.first+i*pc1.second.second;
-              return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
-            }
-          case 16:
-            {
-              ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
-              int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
-              std::vector<int> v2(nbOfComp);
-              for(int i=0;i<nbOfComp;i++)
-                v2[i]=pc1.first+i*pc1.second.second;
-              return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
-            }
-          default:
-            throw INTERP_KERNEL::Exception(msg);
-          }
-      }
-
-      DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
-      {
-        self->checkAllocated();
-        const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
-        int nbOfTuples=self->getNumberOfTuples();
-        int nbOfComponents=self->getNumberOfComponents();
-        int sw1,sw2;
-        double i1;
-        std::vector<double> v1;
-        DataArrayDouble *d1=0;
-        convertObjToPossibleCpp4(value,sw1,i1,v1,d1);
-        int it1,ic1;
-        std::vector<int> vt1,vc1;
-        std::pair<int, std::pair<int,int> > pt1,pc1;
-        DataArrayInt *dt1=0,*dc1=0;
-        convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
-        MCAuto<DataArrayDouble> tmp;
-        switch(sw2)
-          {
-          case 1:
-            {
-              switch(sw1)
-                {
-                case 1:
-                  self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
-                  return self;
-                case 2:
-                  tmp=DataArrayDouble::New();
-                  tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
-                  self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
-                  return self;
-                case 3:
-                  self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
-                  return self;
-                default:
-                  throw INTERP_KERNEL::Exception(msg);
-                }
-              break;
-            }
-          case 2:
-            {
-              switch(sw1)
-                {
-                case 1:
-                  self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
-                  return self;
-                case 2:
-                  tmp=DataArrayDouble::New();
-                  tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
-                  self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
-                  return self;
-                case 3:
-                  self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
-                  return self;
-                default:
-                  throw INTERP_KERNEL::Exception(msg);
-                }
-              break;
-            }
-          case 3:
-            {
-              switch(sw1)
-                {
-                case 1:
-                  self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
-                  return self;
-                case 2:
-                  tmp=DataArrayDouble::New();
-                  tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
-                  self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
-                  return self;
-                case 3:
-                  self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
-                  return self;
-                default:
-                  throw INTERP_KERNEL::Exception(msg);
-                }
-              break;
-            }
-          case 4:
-            {
-              switch(sw1)
-                {
-                case 1:
-                  self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
-                  return self;
-                case 2:
-                  tmp=DataArrayDouble::New();
-                  tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
-                  self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
-                  return self;
-                case 3:
-                  self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
-                  return self;
-                default:
-                  throw INTERP_KERNEL::Exception(msg);
-                }
-              break;
-            }
-          case 5:
-            {
-              switch(sw1)
-                {
-                case 1:
-                  self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
-                  return self;
-                case 2:
-                  tmp=DataArrayDouble::New();
-                  tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
-                  self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
-                  return self;
-                case 3:
-                  self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
-                  return self;
-                default:
-                  throw INTERP_KERNEL::Exception(msg);
-                }
-              break;
-            }
-          case 6:
-            {
-              switch(sw1)
-                {
-                case 1:
-                  self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
-                  return self;
-                case 2:
-                  tmp=DataArrayDouble::New();
-                  tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
-                  self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
-                  return self;
-                case 3:
-                  self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
-                  return self;
-                default:
-                  throw INTERP_KERNEL::Exception(msg);
-                }
-              break;
-            }
-          case 7:
-            {
-              switch(sw1)
-                {
-                case 1:
-                  self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
-                  return self;
-                case 2:
-                  tmp=DataArrayDouble::New();
-                  tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
-                  self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
-                  return self;
-                case 3:
-                  self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
-                  return self;
-                default:
-                  throw INTERP_KERNEL::Exception(msg);
-                }
-              break;
-            }
-          case 8:
-            {
-              switch(sw1)
-                {
-                case 1:
-                  self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
-                  return self;
-                case 2:
-                  tmp=DataArrayDouble::New();
-                  tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
-                  self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
-                  return self;
-                case 3:
-                  self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
-                  return self;
-                default:
-                  throw INTERP_KERNEL::Exception(msg);
-                }
-              break;
-            }
-          case 9:
-            {
-              switch(sw1)
-                {
-                case 1:
-                  self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
-                  return self;
-                case 2:
-                  tmp=DataArrayDouble::New();
-                  tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
-                  self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
-                  return self;
-                case 3:
-                  self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
-                  return self;
-                default:
-                  throw INTERP_KERNEL::Exception(msg);
-                }
-              break;
-            }
-          case 10:
-            {
-              switch(sw1)
-                {
-                case 1:
-                  self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
-                  return self;
-                case 2:
-                  tmp=DataArrayDouble::New();
-                  tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
-                  self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
-                  return self;
-                case 3:
-                  self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
-                  return self;
-                default:
-                  throw INTERP_KERNEL::Exception(msg);
-                }
-              break;
-            }
-          case 11:
-            {
-              switch(sw1)
-                {
-                case 1:
-                  self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
-                  return self;
-                case 2:
-                  tmp=DataArrayDouble::New();
-                  tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
-                  self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
-                  return self;
-                case 3:
-                  self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
-                  return self;
-                default:
-                  throw INTERP_KERNEL::Exception(msg);
-                }
-              break;
-            }
-          case 12:
-            {
-              switch(sw1)
-                {
-                case 1:
-                  self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
-                  return self;
-                case 2:
-                  tmp=DataArrayDouble::New();
-                  tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
-                  self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
-                  return self;
-                case 3:
-                  self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
-                  return self;
-                default:
-                  throw INTERP_KERNEL::Exception(msg);
-                }
-              break;
-            }
-          case 13:
-            {
-              switch(sw1)
-                {
-                case 1:
-                  self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
-                  return self;
-                case 2:
-                  tmp=DataArrayDouble::New();
-                  tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
-                  self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
-                  return self;
-                case 3:
-                  self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
-                  return self;
-                default:
-                  throw INTERP_KERNEL::Exception(msg);
-                }
-              break;
-            }
-          case 14:
-            {
-              switch(sw1)
-                {
-                case 1:
-                  self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
-                  return self;
-                case 2:
-                  tmp=DataArrayDouble::New();
-                  tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
-                  self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
-                  return self;
-                case 3:
-                  self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
-                  return self;
-                default:
-                  throw INTERP_KERNEL::Exception(msg);
-                }
-              break;
-            }
-          case 15:
-            {
-              switch(sw1)
-                {
-                case 1:
-                  self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
-                  return self;
-                case 2:
-                  tmp=DataArrayDouble::New();
-                  tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
-                  self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
-                  return self;
-                case 3:
-                  self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
-                  return self;
-                default:
-                  throw INTERP_KERNEL::Exception(msg);
-                }
-              break;
-            }
-          case 16:
-            {
-              switch(sw1)
-                {
-                case 1:
-                  self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
-                  return self;
-                case 2:
-                  tmp=DataArrayDouble::New();
-                  tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
-                  self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
-                  return self;
-                case 3:
-                  self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
-                  return self;
-                default:
-                  throw INTERP_KERNEL::Exception(msg);
-                }
-              break;
-            }
-          default:
-            throw INTERP_KERNEL::Exception(msg);
-          }
-        return self;
+          PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
+        return res;
+      }
+   
+      PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
+      {
+        int sz=self->getNumberOfComponents();
+        INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
+        self->getTuple(tupleId,tmp);
+        return convertDblArrToPyList<double>(tmp,sz);
+      }
+
+      static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
+      {
+        std::vector<const DataArrayDouble *> tmp;
+        convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
+        return DataArrayDouble::Aggregate(tmp);
+      }
+
+      static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
+      {
+        std::vector<const DataArrayDouble *> tmp;
+        convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
+        return DataArrayDouble::Meld(tmp);
+      }
+
+      PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
+      {
+        double val;
+        DataArrayDouble *a;
+        DataArrayDoubleTuple *aa;
+        std::vector<double> bb;
+        int sw;
+        int nbComp=self->getNumberOfComponents(),nbTuples=-1;
+        const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
+        const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
+        MCAuto<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
+        DataArrayInt *c=0,*cI=0;
+        self->computeTupleIdsNearTuples(inpu,eps,c,cI);
+        PyObject *ret=PyTuple_New(2);
+        PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+        PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+        return ret;
+      }
+
+      PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
+      {
+        DataArrayInt *ret1=0;
+        bool ret0=self->areIncludedInMe(other,prec,ret1);
+        PyObject *ret=PyTuple_New(2);
+        PyObject *ret0Py=ret0?Py_True:Py_False;
+        Py_XINCREF(ret0Py);
+        PyTuple_SetItem(ret,0,ret0Py);
+        PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+        return ret;
+      }
+
+      PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
+      {
+        return DataArrayT__getitem<double>(self,obj);
+      }
+
+      DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
+      {
+        return DataArrayT__setitem__<double>(self,obj,value);
       }
 
       DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
@@ -1790,7 +1477,7 @@ namespace MEDCoupling
           }
 #endif
         //
-        convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+        convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
         switch(sw)
           {
           case 1:
@@ -1826,7 +1513,7 @@ namespace MEDCoupling
         DataArrayDoubleTuple *aa;
         std::vector<double> bb;
         int sw;
-        convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+        convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
         switch(sw)
           {
           case 1:
@@ -1852,44 +1539,7 @@ namespace MEDCoupling
    
       PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
       {
-        const char msg[]="Unexpected situation in __iadd__ !";
-        double val;
-        DataArrayDouble *a;
-        DataArrayDoubleTuple *aa;
-        std::vector<double> bb;
-        int sw;
-        convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
-        switch(sw)
-          {
-          case 1:
-            {
-              self->applyLin(1.,val);
-              Py_XINCREF(trueSelf);
-              return trueSelf;
-            }
-          case 2:
-            {
-              self->addEqual(a);
-              Py_XINCREF(trueSelf);
-              return trueSelf;
-            }
-          case 3:
-            {
-              MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
-              self->addEqual(aaa);
-              Py_XINCREF(trueSelf);
-              return trueSelf;
-            }
-          case 4:
-            {
-              MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
-              self->addEqual(aaa);
-              Py_XINCREF(trueSelf);
-              return trueSelf;
-            }
-          default:
-            throw INTERP_KERNEL::Exception(msg);
-          }
+        return DataArrayT_iadd<double>(trueSelf,obj,self);
       }
 
       PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
@@ -1918,7 +1568,7 @@ namespace MEDCoupling
           }
 #endif
         //
-        convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+        convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
         switch(sw)
           {
           case 1:
@@ -1954,7 +1604,7 @@ namespace MEDCoupling
         DataArrayDoubleTuple *aa;
         std::vector<double> bb;
         int sw;
-        convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+        convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
         switch(sw)
           {
           case 1:
@@ -1980,44 +1630,7 @@ namespace MEDCoupling
 
       PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
       {
-        const char msg[]="Unexpected situation in __isub__ !";
-        double val;
-        DataArrayDouble *a;
-        DataArrayDoubleTuple *aa;
-        std::vector<double> bb;
-        int sw;
-        convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
-        switch(sw)
-          {
-          case 1:
-            {
-              self->applyLin(1,-val);
-              Py_XINCREF(trueSelf);
-              return trueSelf;
-            }
-          case 2:
-            {
-              self->substractEqual(a);
-              Py_XINCREF(trueSelf);
-              return trueSelf;
-            }
-          case 3:
-            {
-              MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
-              self->substractEqual(aaa);
-              Py_XINCREF(trueSelf);
-              return trueSelf;
-            }
-          case 4:
-            {
-              MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
-              self->substractEqual(aaa);
-              Py_XINCREF(trueSelf);
-              return trueSelf;
-            }
-          default:
-            throw INTERP_KERNEL::Exception(msg);
-          }
+        return DataArrayT_isub<double>(trueSelf,obj,self);
       }
 
       PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
@@ -2046,7 +1659,7 @@ namespace MEDCoupling
           }
 #endif
         //
-        convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+        convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
         switch(sw)
           {
           case 1:
@@ -2082,7 +1695,7 @@ namespace MEDCoupling
         DataArrayDoubleTuple *aa;
         std::vector<double> bb;
         int sw;
-        convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+        convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
         switch(sw)
           {
           case 1:
@@ -2108,44 +1721,7 @@ namespace MEDCoupling
 
       PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
       {
-        const char msg[]="Unexpected situation in __imul__ !";
-        double val;
-        DataArrayDouble *a;
-        DataArrayDoubleTuple *aa;
-        std::vector<double> bb;
-        int sw;
-        convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
-        switch(sw)
-          {
-          case 1:
-            {
-              self->applyLin(val,0.);
-              Py_XINCREF(trueSelf);
-              return trueSelf;
-            }
-          case 2:
-            {
-              self->multiplyEqual(a);
-              Py_XINCREF(trueSelf);
-              return trueSelf;
-            }
-          case 3:
-            {
-              MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
-              self->multiplyEqual(aaa);
-              Py_XINCREF(trueSelf);
-              return trueSelf;
-            }
-          case 4:
-            {
-              MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
-              self->multiplyEqual(aaa);
-              Py_XINCREF(trueSelf);
-              return trueSelf;
-            }
-          default:
-            throw INTERP_KERNEL::Exception(msg);
-          }
+        return DataArrayT_imul<double>(trueSelf,obj,self);
       }
 
       PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
@@ -2174,7 +1750,7 @@ namespace MEDCoupling
           }
 #endif
         //
-        convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+        convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
         switch(sw)
           {
           case 1:
@@ -2212,7 +1788,7 @@ namespace MEDCoupling
         DataArrayDoubleTuple *aa;
         std::vector<double> bb;
         int sw;
-        convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+        convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
         switch(sw)
           {
           case 1:
@@ -2238,46 +1814,7 @@ namespace MEDCoupling
 
       PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
       {
-        const char msg[]="Unexpected situation in __idiv__ !";
-        double val;
-        DataArrayDouble *a;
-        DataArrayDoubleTuple *aa;
-        std::vector<double> bb;
-        int sw;
-        convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
-        switch(sw)
-          {
-          case 1:
-            {
-              if(val==0.)
-                throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
-              self->applyLin(1./val,0.);
-              Py_XINCREF(trueSelf);
-              return trueSelf;
-            }
-          case 2:
-            {
-              self->divideEqual(a);
-              Py_XINCREF(trueSelf);
-              return trueSelf;
-            }
-          case 3:
-            {
-              MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
-              self->divideEqual(aaa);
-              Py_XINCREF(trueSelf);
-              return trueSelf;
-            }
-          case 4:
-            {
-              MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
-              self->divideEqual(aaa);
-              Py_XINCREF(trueSelf);
-              return trueSelf;
-            }
-          default:
-            throw INTERP_KERNEL::Exception(msg);
-          }
+        return DataArrayT_idiv<double>(trueSelf,obj,self);
       }
    
       DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
@@ -2288,7 +1825,7 @@ namespace MEDCoupling
         DataArrayDoubleTuple *aa;
         std::vector<double> bb;
         int sw;
-        convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+        convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
         switch(sw)
           {
           case 1:
@@ -2324,7 +1861,7 @@ namespace MEDCoupling
         DataArrayDoubleTuple *aa;
         std::vector<double> bb;
         int sw;
-        convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+        convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
         switch(sw)
           {
           case 1:
@@ -2356,7 +1893,7 @@ namespace MEDCoupling
         DataArrayDoubleTuple *aa;
         std::vector<double> bb;
         int sw;
-        convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+        convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
         switch(sw)
           {
           case 1:
@@ -2530,7 +2067,7 @@ namespace MEDCoupling
         MEDCoupling::DataArrayInt *daIntTyypp=0;
         const double *pt=self->getConstPointer();
         int nbc=self->getNumberOfCompo();
-        convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
+        convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
         switch(sw)
           {
           case 1:
@@ -2594,13 +2131,13 @@ namespace MEDCoupling
         std::vector<double> multiValV;
         MEDCoupling::DataArrayDoubleTuple *daIntTyyppV=0;
         int nbc=self->getNumberOfCompo();
-        convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
+        convertDoubleStarLikePyObjToCpp(value,sw1,singleValV,multiValV,daIntTyyppV);
         int singleVal;
         std::vector<int> multiVal;
         std::pair<int, std::pair<int,int> > slic;
         MEDCoupling::DataArrayInt *daIntTyypp=0;
         double *pt=self->getPointer();
-        convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
+        convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
         switch(sw2)
           {
           case 1:
@@ -2777,7 +2314,7 @@ namespace MEDCoupling
     DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
     DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
     DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
-    DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception);
+    MCAuto< MapII > invertArrayN2O2O2NOptimized() const throw(INTERP_KERNEL::Exception);
     DataArrayInt *indicesOfSubPart(const DataArrayInt& partOfThis) const throw(INTERP_KERNEL::Exception);
     DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
     DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
@@ -2786,6 +2323,7 @@ namespace MEDCoupling
     DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
     bool isIota(int sizeExpected) const throw(INTERP_KERNEL::Exception);
     bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
+    int checkUniformAndGuess() const throw(INTERP_KERNEL::Exception);
     bool hasUniqueValues() const throw(INTERP_KERNEL::Exception);
     DataArrayInt *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
     void transpose() throw(INTERP_KERNEL::Exception);
@@ -2835,7 +2373,7 @@ namespace MEDCoupling
     void applyRPow(int val) throw(INTERP_KERNEL::Exception);
     DataArrayInt *findIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
     DataArrayInt *findIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
-    DataArrayInt *findIdsStricltyNegative() const throw(INTERP_KERNEL::Exception);
+    DataArrayInt *findIdsStrictlyNegative() const throw(INTERP_KERNEL::Exception);
     bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
     static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
     static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
@@ -2871,6 +2409,14 @@ namespace MEDCoupling
     void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
     static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
     void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
+    MCAuto<DataArrayInt> fromLinkedListOfPairToList() const throw(INTERP_KERNEL::Exception);
+    MCAuto<DataArrayInt> findIdsGreaterOrEqualTo(int val) const throw(INTERP_KERNEL::Exception);
+    MCAuto<DataArrayInt> findIdsGreaterThan(int val) const throw(INTERP_KERNEL::Exception);
+    MCAuto<DataArrayInt> findIdsLowerOrEqualTo(int val) const throw(INTERP_KERNEL::Exception);
+    MCAuto<DataArrayInt> findIdsLowerThan(int val) const throw(INTERP_KERNEL::Exception);
+    MCAuto<DataArrayInt> selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception);
+    MCAuto<DataArrayDouble> convertToDblArr() const throw(INTERP_KERNEL::Exception);
+    MCAuto<DataArrayFloat> convertToFloatArr() const throw(INTERP_KERNEL::Exception);
   public:
     static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
     %extend
@@ -2979,7 +2525,7 @@ namespace MEDCoupling
         {
           return MEDCoupling_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
         }
-
+      
       std::string __str__() const throw(INTERP_KERNEL::Exception)
       {
         return self->reprNotTooLong();
@@ -3006,12 +2552,6 @@ namespace MEDCoupling
       {
         return self->iterator();
       }
-
-      DataArrayInt *selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception)
-      {
-        MCAuto<DataArrayInt> ret(self->selectPartDef(pd));
-        return ret.retn();
-      }
    
       PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
       {
@@ -3025,7 +2565,7 @@ namespace MEDCoupling
       {
         int sw,sz,val;
         std::vector<int> val2;
-        const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
+        const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
         return self->accumulatePerChunck(bg,bg+sz);
       }
 
@@ -3033,7 +2573,7 @@ namespace MEDCoupling
       {
         int sw,sz,val;
         std::vector<int> val2;
-        const int *bg(convertObjToPossibleCpp1_Safe(inputTuple,sw,sz,val,val2));
+        const int *bg(convertIntStarLikePyObjToCppIntStar(inputTuple,sw,sz,val,val2));
         return self->findIdsEqualTuple(bg,bg+sz);
       }
 
@@ -3051,8 +2591,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);
@@ -3073,8 +2612,8 @@ namespace MEDCoupling
         int newNbOfTuples=-1;
         int szArr,szArrI,sw,iTypppArr,iTypppArrI;
         std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
-        const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
-        const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
+        const int *arrPtr=convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
+        const int *arrIPtr=convertIntStarLikePyObjToCppIntStar(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
         DataArrayInt *ret0=MEDCoupling::DataArrayInt::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
         PyObject *ret=PyTuple_New(2);
         PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
@@ -3087,7 +2626,7 @@ namespace MEDCoupling
         MCAuto<DataArrayInt> ret(DataArrayInt::New());
         int szArr,sw,iTypppArr;
         std::vector<int> stdvecTyyppArr;
-        const int *arrPtr(convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
+        const int *arrPtr(convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
         int *pt(MEDCoupling::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
         ret->useArray(pt,true,MEDCoupling::C_DEALLOC,szArr,1);
         return ret.retn();
@@ -3191,12 +2730,21 @@ namespace MEDCoupling
       void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
       {
         void *da=0;
-        int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 |  0 );
+        int res1(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 |  0 ));
         if (!SWIG_IsOK(res1))
           {
-            int size;
-            INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
-            self->transformWithIndArr(tmp,tmp+size);
+            int res2(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__MapII, 0 |  0 ));
+            if(SWIG_IsOK(res2))
+              {
+                MapII *m=reinterpret_cast<MapII *>(da);
+                self->transformWithIndArr(*m);
+              }
+            else
+              {
+                int size;
+                INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
+                self->transformWithIndArr(tmp,tmp+size);
+              }
           }
         else
           {
@@ -3212,7 +2760,7 @@ namespace MEDCoupling
         std::vector<int> multiVal;
         std::pair<int, std::pair<int,int> > slic;
         MEDCoupling::DataArrayInt *daIntTyypp=0;
-        convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
+        convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
         switch(sw)
           {
           case 1:
@@ -3233,7 +2781,7 @@ namespace MEDCoupling
         std::vector<int> multiVal;
         std::pair<int, std::pair<int,int> > slic;
         MEDCoupling::DataArrayInt *daIntTyypp=0;
-        convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
+        convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
         switch(sw)
           {
           case 1:
@@ -3638,7 +3186,7 @@ namespace MEDCoupling
         std::vector<int> v1;
         DataArrayInt *d1=0;
         DataArrayIntTuple *dd1=0;
-        convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
+        convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
         int it1,ic1;
         std::vector<int> vt1,vc1;
         std::pair<int, std::pair<int,int> > pt1,pc1;
@@ -4050,7 +3598,7 @@ namespace MEDCoupling
         std::vector<int> aa;
         DataArrayIntTuple *aaa;
         int sw;
-        convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+        convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
         switch(sw)
           {
           case 1:
@@ -4086,7 +3634,7 @@ namespace MEDCoupling
         std::vector<int> aa;
         DataArrayIntTuple *aaa;
         int sw;
-        convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+        convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
         switch(sw)
           {
           case 1:
@@ -4118,7 +3666,7 @@ namespace MEDCoupling
         std::vector<int> aa;
         DataArrayIntTuple *aaa;
         int sw;
-        convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+        convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
         switch(sw)
           {
           case 1:
@@ -4160,7 +3708,7 @@ namespace MEDCoupling
         std::vector<int> aa;
         DataArrayIntTuple *aaa;
         int sw;
-        convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+        convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
         switch(sw)
           {
           case 1:
@@ -4196,7 +3744,7 @@ namespace MEDCoupling
         std::vector<int> aa;
         DataArrayIntTuple *aaa;
         int sw;
-        convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+        convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
         switch(sw)
           {
           case 1:
@@ -4228,7 +3776,7 @@ namespace MEDCoupling
         std::vector<int> aa;
         DataArrayIntTuple *aaa;
         int sw;
-        convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+        convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
         switch(sw)
           {
           case 1:
@@ -4270,7 +3818,7 @@ namespace MEDCoupling
         std::vector<int> aa;
         DataArrayIntTuple *aaa;
         int sw;
-        convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+        convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
         switch(sw)
           {
           case 1:
@@ -4306,7 +3854,7 @@ namespace MEDCoupling
         std::vector<int> aa;
         DataArrayIntTuple *aaa;
         int sw;
-        convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+        convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
         switch(sw)
           {
           case 1:
@@ -4338,7 +3886,7 @@ namespace MEDCoupling
         std::vector<int> aa;
         DataArrayIntTuple *aaa;
         int sw;
-        convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+        convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
         switch(sw)
           {
           case 1:
@@ -4380,7 +3928,7 @@ namespace MEDCoupling
         std::vector<int> aa;
         DataArrayIntTuple *aaa;
         int sw;
-        convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+        convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
         switch(sw)
           {
           case 1:
@@ -4416,7 +3964,7 @@ namespace MEDCoupling
         std::vector<int> aa;
         DataArrayIntTuple *aaa;
         int sw;
-        convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+        convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
         switch(sw)
           {
           case 1:
@@ -4448,7 +3996,7 @@ namespace MEDCoupling
         std::vector<int> aa;
         DataArrayIntTuple *aaa;
         int sw;
-        convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+        convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
         switch(sw)
           {
           case 1:
@@ -4490,7 +4038,7 @@ namespace MEDCoupling
         std::vector<int> aa;
         DataArrayIntTuple *aaa;
         int sw;
-        convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+        convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
         switch(sw)
           {
           case 1:
@@ -4526,7 +4074,7 @@ namespace MEDCoupling
         std::vector<int> aa;
         DataArrayIntTuple *aaa;
         int sw;
-        convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+        convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
         switch(sw)
           {
           case 1:
@@ -4562,7 +4110,7 @@ namespace MEDCoupling
         std::vector<int> aa;
         DataArrayIntTuple *aaa;
         int sw;
-        convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+        convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
         switch(sw)
           {
           case 1:
@@ -4597,7 +4145,7 @@ namespace MEDCoupling
         std::vector<int> aa;
         DataArrayIntTuple *aaa;
         int sw;
-        convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+        convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
         switch(sw)
           {
           case 1:
@@ -4633,7 +4181,7 @@ namespace MEDCoupling
         std::vector<int> aa;
         DataArrayIntTuple *aaa;
         int sw;
-        convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+        convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
         switch(sw)
           {
           case 1:
@@ -4669,7 +4217,7 @@ namespace MEDCoupling
         std::vector<int> aa;
         DataArrayIntTuple *aaa;
         int sw;
-        convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
+        convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
         switch(sw)
           {
           case 1:
@@ -4707,7 +4255,7 @@ namespace MEDCoupling
       {
         int szArr,sw,iTypppArr;
         std::vector<int> stdvecTyyppArr;
-        const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+        const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
         self->pushBackValsSilent(tmp,tmp+szArr);
       }
       
@@ -4853,7 +4401,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());
@@ -4885,7 +4432,7 @@ namespace MEDCoupling
         MEDCoupling::DataArrayInt *daIntTyypp=0;
         const int *pt=self->getConstPointer();
         int nbc=self->getNumberOfCompo();
-        convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
+        convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
         switch(sw)
           {
           case 1:
@@ -4956,7 +4503,7 @@ namespace MEDCoupling
         std::pair<int, std::pair<int,int> > slic;
         MEDCoupling::DataArrayInt *daIntTyypp=0;
         int *pt=self->getPointer();
-        convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
+        convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
         switch(sw2)
           {
           case 1:
@@ -5424,7 +4971,7 @@ namespace MEDCoupling
       {
         int sz=-1,sw=-1;
         int ival=-1; std::vector<int> ivval;
-        const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
+        const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
         std::vector<char> vals(sz);
         std::copy(pt,pt+sz,vals.begin());
         return self->presenceOfTuple(vals);
@@ -5434,7 +4981,7 @@ namespace MEDCoupling
       {
         int sz=-1,sw=-1;
         int ival=-1; std::vector<int> ivval;
-        const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
+        const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
         std::vector<char> vals2(sz);
         std::copy(pt,pt+sz,vals2.begin());
         return self->presenceOfValue(vals2);
@@ -5444,7 +4991,7 @@ namespace MEDCoupling
       {
         int sz=-1,sw=-1;
         int ival=-1; std::vector<int> ivval;
-        const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
+        const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
         std::vector<char> vals2(sz);
         std::copy(pt,pt+sz,vals2.begin());
         return self->findIdFirstEqual(vals2);
@@ -5454,7 +5001,7 @@ namespace MEDCoupling
       {
         int sz=-1,sw=-1;
         int ival=-1; std::vector<int> ivval;
-        const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
+        const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
         std::vector<char> vals(sz);
         std::copy(pt,pt+sz,vals.begin());
         return self->findIdFirstEqualTuple(vals);
@@ -5464,7 +5011,7 @@ namespace MEDCoupling
       {
         int sz=-1,sw=-1;
         int ival=-1; std::vector<int> ivval;
-        const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
+        const int *pt=convertIntStarLikePyObjToCppIntStar(strOrListOfInt,sw,sz,ival,ivval);
         std::vector<char> vals(sz);
         std::copy(pt,pt+sz,vals.begin());
         return self->findIdSequence(vals);
@@ -5584,7 +5131,7 @@ namespace MEDCoupling
         std::vector<int> v1;
         DataArrayInt *d1=0;
         DataArrayIntTuple *dd1=0;
-        convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
+        convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
         int it1,ic1;
         std::vector<int> vt1,vc1;
         std::pair<int, std::pair<int,int> > pt1,pc1;
@@ -5889,6 +5436,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 +5557,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 +5579,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 +5601,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 +5623,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 +5645,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 +5704,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 +5741,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 !");
             }
@@ -6139,7 +5766,7 @@ namespace MEDCoupling
         std::vector<int> stdvecTyyppArr;
         std::pair<int, std::pair<int,int> > sTyyppArr;
         MEDCoupling::DataArrayInt *daIntTyypp=0;
-        convertObjToPossibleCpp2WithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
+        convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
         switch(sw)
           {
           case 1:
@@ -6164,7 +5791,7 @@ namespace MEDCoupling
         MEDCoupling::DataArrayInt *daIntTyypp=0;
         int nbOfCompo=self->getNumberOfComponents();
         int nbOfTuples=self->getNumberOfTuples();
-        convertObjToPossibleCpp2WithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
+        convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
         int sw2;
         char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
         convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
index 7b20363432c3aaaffe837482311f8fc2ae60a322..bed6c8fb1c6be4a6bd75a133cee7d8b9feae0386 100644 (file)
@@ -668,11 +668,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 +685,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 +698,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 +708,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 +729,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 +743,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
@@ -756,6 +756,307 @@ class MEDCouplingNumPyTest(unittest.TestCase):
         gc.collect()
         pass
 
+    @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test29(self):
+        """Same as test9 with float32"""
+        sz=20
+        a=array(0,dtype=float32)
+        a.resize(sz)
+        a[:]=4
+        self.assertEqual(getrefcount(a),2)
+        a=a.cumsum(dtype=float32)
+        self.assertEqual(getrefcount(a),2)
+        d=DataArrayFloat(a)
+        d[:]=2
+        #
+        e=DataArrayFloat(sz) ; e.fillWithValue(2)
+        self.assertTrue(d.isEqual(e,1e-7))
+        #
+        a[:]=4 ; e.fillWithValue(4)
+        self.assertTrue(d.isEqual(e,1e-7))
+        pass
+    
+    @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test30(self):
+        """Same as test10 with float32"""
+        sz=20
+        a=array(0,dtype=float32)
+        a.resize(sz,2)
+        self.assertEqual(getrefcount(a),2)
+        b=a.reshape(2*sz)
+        self.assertEqual(getrefcount(a),3)
+        self.assertEqual(getrefcount(b),2)
+        b[:]=5
+        d=DataArrayFloat(b)
+        #
+        e=DataArrayFloat(sz*2) ; e.fillWithValue(5)
+        self.assertTrue(d.isEqual(e,1e-7))
+        pass
+    
+    @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test31(self):
+        """Same as test11 with float32"""
+        sz=10
+        a=array(0,dtype=float32)
+        a.resize(sz,2)
+        b=a.reshape(2*sz)
+        c=a.reshape(2,sz)
+        b[:]=6
+        b[7:17]=7
+        d=DataArrayFloat(b)
+        self.assertTrue(d.isEqual(DataArrayFloat([6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,6,6,6]),1e-7))
+        #
+        a=zeros((10,2),dtype=float32)
+        b=a.T
+        c=b.view()
+        a.shape=20
+        a[3:]=10.
+        d=DataArrayFloat(a)
+        self.assertTrue(d.isEqual(DataArrayFloat([0,0,0,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10]),1e-7))
+        pass
+    
+    @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test32(self):
+        """Same as test12 with float32"""
+        a=zeros(20,dtype=float32)
+        b = a[::-1]
+        self.assertRaises(InterpKernelException,DataArrayFloat.New,b) # b is not contiguous in memory
+        pass
+    
+    @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test33(self):
+        """Same as test13 with float32"""
+        a=arange(20,dtype=float32)
+        self.assertEqual(weakref.getweakrefcount(a),0)
+        d=DataArrayFloat(a)
+        self.assertEqual(weakref.getweakrefcount(a),1)
+        self.assertTrue(not a.flags["OWNDATA"])
+        self.assertTrue(d.isEqual(DataArrayFloat([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]),1e-7))
+        self.assertEqual(len(d),20)
+        a[:]=2 # modifying a and d because a and d share the same chunk of data
+        self.assertTrue(d.isUniform(2,1e-7))
+        del d # d is destroyed, a retrieves its ownership of its initial chunk of data
+        ##@@ Ensure a pass of the garbage collector so that the de-allocator of d is called
+        import gc
+        gc.collect()
+        self.assertTrue(a.flags["OWNDATA"])
+        a[:]=4 # a can be used has usual
+        self.assertTrue(DataArrayFloat(a).isUniform(4,1e-7))
+        pass
+    
+    @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test34(self):
+        """Same as test14 with float32"""
+        a=arange(20,dtype=float32)
+        d=DataArrayFloat(a) # d owns data of a
+        e=DataArrayFloat(a) # a not owned -> e only an access to chunk of a 
+        self.assertTrue(d.isEqual(DataArrayFloat([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]),1e-7))
+        self.assertTrue(e.isEqual(DataArrayFloat([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]),1e-7))
+        a[:]=6
+        self.assertTrue(d.isUniform(6,1e-7))
+        self.assertTrue(e.isUniform(6,1e-7))
+        del a # a destroyed -> d no change because owned and e array is has no more data set
+        ##@@ Ensure a pass of the garbage collector so that the de-allocator of d is called
+        import gc
+        gc.collect()
+        self.assertTrue(d.isUniform(6,1e-7))
+        self.assertTrue(not e.isAllocated())
+        pass
+
+    @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test35(self):
+        """Same as test15 with float32"""
+        a=array(0,dtype=float32) ; a.resize(10,2)
+        b=a.reshape(20)
+        c=a.reshape(2,10)
+        d=DataArrayFloat(b) # d owns data of a
+        e=DataArrayFloat(b) # a not owned -> e only an access to chunk of a
+        f=DataArrayFloat(b) # a not owned -> e only an access to chunk of a
+        del d # d removed -> a ownes again data
+        ##@@ Ensure a pass of the garbage collector so that the de-allocator of d is called
+        import gc
+        gc.collect()
+        self.assertTrue(e.isUniform(0,1e-7))
+        e[:]=6
+        self.assertTrue(e.isUniform(6,1e-7))
+        self.assertTrue(f.isUniform(6,1e-7))
+        self.assertEqual(b.tolist(),[6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6])
+        self.assertEqual(a.tolist(),[[6,6],[6,6],[6,6],[6,6],[6,6],[6,6],[6,6],[6,6],[6,6],[6,6]])
+        b[:]=arange(20)
+        del b # no impact on e and f because a is the base of a.
+        ##@@ Ensure a pass of the garbage collector so that the de-allocator of d is called
+        gc.collect()
+        self.assertTrue(f.isEqual(DataArrayFloat([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]),1e-7))
+        self.assertTrue(e.isEqual(DataArrayFloat([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]),1e-7))
+        del a # a destroyed, but as c has its base set to a, a exists -> e and f not allocated
+        ##@@ Ensure a pass of the garbage collector so that the de-allocator of d is called
+        gc.collect()
+        self.assertTrue(f.isEqual(DataArrayFloat([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]),1e-7))
+        self.assertTrue(e.isEqual(DataArrayFloat([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]),1e-7))
+        del c # c killed -> a killed -> e and d are put into not allocated state
+        ##@@ Ensure a pass of the garbage collector so that the de-allocator of d is called
+        gc.collect()
+        self.assertTrue(not e.isAllocated())
+        self.assertTrue(not f.isAllocated())
+        pass
+
+    @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test36(self):
+        """Same as test16 with float32"""
+        a=arange(20,dtype=float32)
+        self.assertTrue(a.flags["OWNDATA"])
+        d=DataArrayFloat(a) # d owns data of a
+        self.assertTrue(not a.flags["OWNDATA"])
+        d.pushBackSilent(20)# d pushBack so release of chunk of data -> a becomes owner of its data again
+        self.assertTrue(a.flags["OWNDATA"])
+        self.assertTrue(d.isEqual(DataArrayFloat([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]),1e-7))
+        self.assertEqual(a.tolist(),[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19])
+        pass
+
+    @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test37(self):
+        """Same as test20 with float32"""
+        sz=20
+        a=array(0,dtype=float32)
+        a.resize(sz/2,2)
+        a[:]=4
+        self.assertEqual(getrefcount(a),2)
+        d=DataArrayFloat(a)
+        self.assertEqual(10,d.getNumberOfTuples())
+        self.assertEqual(2,d.getNumberOfComponents())
+        self.assertEqual(sz,d.getNbOfElems())
+        self.assertTrue(d.isEqual(DataArrayFloat([(4.,4.),(4.,4.),(4.,4.),(4.,4.),(4.,4.),(4.,4.),(4.,4.),(4.,4.),(4.,4.),(4.,4.)]),1e-7))
+        a[:]=7
+        self.assertTrue(d.isEqual(DataArrayFloat([(7.,7.),(7.,7.),(7.,7.),(7.,7.),(7.,7.),(7.,7.),(7.,7.),(7.,7.),(7.,7.),(7.,7.)]),1e-7))
+        #
+        b=a.reshape((2,5,2))
+        self.assertRaises(InterpKernelException,DataArrayFloat.New,b) # b has not dimension in [0,1] !
+        pass
+
+    @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test38(self):
+        """Same as test22 with float32"""
+        d=DataArrayFloat(10)
+        d.iota()
+        a=d.toNumPyArray()
+        self.assertTrue(not a.flags["OWNDATA"])
+        del d
+        gc.collect()
+        self.assertTrue(a.flags["OWNDATA"])
+        self.assertEqual(a.tolist(),[0.,1.,2.,3.,4.,5.,6.,7.,8.,9.])
+        #
+        d=DataArrayInt(10)
+        d.iota()
+        a=d.toNumPyArray()
+        self.assertTrue(not a.flags["OWNDATA"])
+        del d
+        gc.collect()
+        self.assertTrue(a.flags["OWNDATA"])
+        self.assertEqual(a.tolist(),[0,1,2,3,4,5,6,7,8,9])
+        pass
+
+    @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test39(self):
+        """Same as test23 with float32"""
+        d=DataArrayFloat(10)
+        d.iota()
+        a=d.toNumPyArray()
+        b=d.toNumPyArray()
+        c=d.toNumPyArray()
+        self.assertTrue(not a.flags["OWNDATA"])
+        self.assertTrue(not b.flags["OWNDATA"])
+        self.assertTrue(not c.flags["OWNDATA"])
+        self.assertEqual(a.tolist(),[0.,1.,2.,3.,4.,5.,6.,7.,8.,9.])
+        self.assertEqual(b.tolist(),[0.,1.,2.,3.,4.,5.,6.,7.,8.,9.])
+        self.assertEqual(c.tolist(),[0.,1.,2.,3.,4.,5.,6.,7.,8.,9.])
+        del d
+        gc.collect()
+        self.assertTrue(a.flags["OWNDATA"])
+        self.assertTrue(not b.flags["OWNDATA"])
+        self.assertTrue(not c.flags["OWNDATA"])
+        self.assertEqual(a.tolist(),[0.,1.,2.,3.,4.,5.,6.,7.,8.,9.])
+        self.assertEqual(b.tolist(),[0.,1.,2.,3.,4.,5.,6.,7.,8.,9.])
+        self.assertEqual(c.tolist(),[0.,1.,2.,3.,4.,5.,6.,7.,8.,9.])
+        #
+        d=DataArrayInt(10)
+        d.iota()
+        a=d.toNumPyArray()
+        b=d.toNumPyArray()
+        c=d.toNumPyArray()
+        self.assertTrue(not a.flags["OWNDATA"])
+        self.assertTrue(not b.flags["OWNDATA"])
+        self.assertTrue(not c.flags["OWNDATA"])
+        self.assertEqual(a.tolist(),[0,1,2,3,4,5,6,7,8,9])
+        self.assertEqual(b.tolist(),[0,1,2,3,4,5,6,7,8,9])
+        self.assertEqual(c.tolist(),[0,1,2,3,4,5,6,7,8,9])
+        del d
+        gc.collect()
+        self.assertTrue(a.flags["OWNDATA"])
+        self.assertTrue(not b.flags["OWNDATA"])
+        self.assertTrue(not c.flags["OWNDATA"])
+        self.assertEqual(a.tolist(),[0,1,2,3,4,5,6,7,8,9])
+        self.assertEqual(b.tolist(),[0,1,2,3,4,5,6,7,8,9])
+        self.assertEqual(c.tolist(),[0,1,2,3,4,5,6,7,8,9])
+        pass
+
+    @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test40(self):
+        """Same as test24 with float32"""
+        d=DataArrayFloat(10)
+        d.iota()
+        a=d.toNumPyArray()
+        self.assertEqual(a.tolist(),[0.,1.,2.,3.,4.,5.,6.,7.,8.,9.])
+        self.assertTrue(not a.flags["OWNDATA"])
+        self.assertTrue(a.base is None)
+        del a
+        gc.collect()
+        a=d.toNumPyArray()
+        self.assertEqual(a.tolist(),[0.,1.,2.,3.,4.,5.,6.,7.,8.,9.])
+        self.assertTrue(not a.flags["OWNDATA"])
+        self.assertTrue(a.base is None)
+        b=d.toNumPyArray()
+        self.assertEqual(a.tolist(),[0.,1.,2.,3.,4.,5.,6.,7.,8.,9.])
+        self.assertEqual(b.tolist(),[0.,1.,2.,3.,4.,5.,6.,7.,8.,9.])
+        self.assertTrue(not a.flags["OWNDATA"])
+        self.assertTrue(not b.flags["OWNDATA"])
+        self.assertTrue(b.base is a)
+        del a
+        gc.collect()
+        self.assertEqual(b.tolist(),[0.,1.,2.,3.,4.,5.,6.,7.,8.,9.])
+        self.assertTrue(not b.flags["OWNDATA"])
+        del d
+        gc.collect()
+        self.assertEqual(b.tolist(),[0.,1.,2.,3.,4.,5.,6.,7.,8.,9.])
+        self.assertTrue(not b.flags["OWNDATA"])
+        #
+        d=DataArrayInt(10)
+        d.iota()
+        a=d.toNumPyArray()
+        self.assertEqual(a.tolist(),[0,1,2,3,4,5,6,7,8,9])
+        self.assertTrue(not a.flags["OWNDATA"])
+        self.assertTrue(a.base is None)
+        del a
+        gc.collect()
+        a=d.toNumPyArray()
+        self.assertEqual(a.tolist(),[0,1,2,3,4,5,6,7,8,9])
+        self.assertTrue(not a.flags["OWNDATA"])
+        self.assertTrue(a.base is None)
+        b=d.toNumPyArray()
+        self.assertEqual(a.tolist(),[0,1,2,3,4,5,6,7,8,9])
+        self.assertEqual(b.tolist(),[0,1,2,3,4,5,6,7,8,9])
+        self.assertTrue(not a.flags["OWNDATA"])
+        self.assertTrue(not b.flags["OWNDATA"])
+        self.assertTrue(b.base is a)
+        del a
+        gc.collect()
+        self.assertEqual(b.tolist(),[0.,1.,2.,3.,4.,5.,6.,7.,8.,9.])
+        self.assertTrue(not b.flags["OWNDATA"])
+        del d
+        gc.collect()
+        self.assertEqual(b.tolist(),[0.,1.,2.,3.,4.,5.,6.,7.,8.,9.])
+        self.assertTrue(not b.flags["OWNDATA"])
+        pass
+
     def setUp(self):
         pass
     pass
index a34420d8a2580c073fe36a85ef08efefc77d9f96..d6135c6746fa84b84a0be50c90bfe07abd80ef4d 100644 (file)
@@ -28,7 +28,12 @@ if MEDCouplingHasNumPyBindings():
 from platform import architecture
 from sys import getrefcount
 
-import os,gc,weakref,cPickle,unittest
+import os, gc, weakref, unittest
+import sys
+if sys.version_info.major < 3:
+  import cPickle as pickle
+else:
+  import pickle
 
 class MEDCouplingPickleTest(unittest.TestCase):
     @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
@@ -36,14 +41,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 +57,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 +77,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 +109,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 +122,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 +135,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 +155,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 +170,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 +180,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 +200,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 +238,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 +280,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 +290,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,16 +301,72 @@ 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
 
+    @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test15(self):
+        """Pickelization of DataArrayFloat"""
+        x=DataArrayFloat(256) ; x.iota()
+        x.rearrange(2) ; x.setInfoOnComponents(["aa","bbb"])
+        x.setName("toto")
+        st = pickle.dumps(x, pickle.HIGHEST_PROTOCOL)
+        x2 = pickle.loads(st)
+        self.assertTrue(x2.isEqual(x,1e-7))
+        pass
+
+    @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test16(self):
+        """  Test of MEDCouplingFieldInt lying on MEDCouplingCMesh pickeling. """
+        arrX=DataArrayDouble(10) ; arrX.iota() ; arrX.setInfoOnComponents(["aa"])
+        arrY=DataArrayDouble(5) ; arrY.iota() ; arrY.setInfoOnComponents(["bbb"])
+        m=MEDCouplingCMesh() ; m.setCoords(arrX,arrY)
+        f=m.getMeasureField(True)
+        f=f.convertToIntField()
+        self.assertTrue(isinstance(f,MEDCouplingFieldInt))
+        f.setName("aname")
+        a=f.getArray()
+        b=a[:] ; b.iota(7000)
+        f.setArray(DataArrayInt.Meld(a,b))
+        f.getArray().setInfoOnComponents(["u1","vv2"])
+        f.checkConsistencyLight();
+        #
+        st = pickle.dumps(f, pickle.HIGHEST_PROTOCOL)
+        f2 = pickle.loads(st)
+        self.assertTrue(f2.isEqual(f,1e-16,0))
+        self.assertTrue(f2.getMesh().isEqual(f.getMesh(),1e-16))
+        pass
+    
+    @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test17(self):
+        """  Test of MEDCouplingFieldInt lying on MEDCouplingCMesh pickeling. """
+        arrX=DataArrayDouble(10) ; arrX.iota() ; arrX.setInfoOnComponents(["aa"])
+        arrY=DataArrayDouble(5) ; arrY.iota() ; arrY.setInfoOnComponents(["bbb"])
+        m=MEDCouplingCMesh() ; m.setCoords(arrX,arrY)
+        f2=m.getMeasureField(True)
+        f=MEDCouplingFieldFloat(ON_CELLS)
+        f.setMesh(m) ; f.setArray(f2.getArray().convertToFloatArr())
+        self.assertTrue(isinstance(f,MEDCouplingFieldFloat))
+        f.setName("aname")
+        a=f.getArray()
+        b=a[:] ; b.iota(7000.)
+        f.setArray(DataArrayFloat.Meld(a,b))
+        f.getArray().setInfoOnComponents(["u1","vv2"])
+        f.checkConsistencyLight();
+        #
+        st = pickle.dumps(f, pickle.HIGHEST_PROTOCOL)
+        f2 = pickle.loads(st)
+        self.assertTrue(f2.isEqual(f,1e-16,0))
+        self.assertTrue(f2.getMesh().isEqual(f.getMesh(),1e-16))
+        pass
+
     def setUp(self):
         pass
     pass
index d170e14690e6b1dc3e4145c2ca276fb03bea52fc..aad7b19977a7165364386c8ed34f0e408e127ca4 100644 (file)
@@ -139,9 +139,30 @@ def MEDCouplingFieldDoubleIdiv(self,*args):
 def MEDCouplingFieldDoubleIpow(self,*args):
     import _MEDCouplingRemapper
     return _MEDCouplingRemapper.MEDCouplingFieldDouble____ipow___(self, self, *args)
+def MEDCouplingFieldIntnew(cls,*args):
+    import _MEDCouplingRemapper
+    return _MEDCouplingRemapper.MEDCouplingFieldInt____new___(cls,args)
+def MEDCouplingFieldFloatnew(cls,*args):
+    import _MEDCouplingRemapper
+    return _MEDCouplingRemapper.MEDCouplingFieldFloat____new___(cls,args)
 def MEDCouplingDataArrayBytenew(cls,*args):
     import _MEDCouplingRemapper
     return _MEDCouplingRemapper.DataArrayByte____new___(cls,args)
+def MEDCouplingDataArrayFloatnew(cls,*args):
+    import _MEDCouplingRemapper
+    return _MEDCouplingRemapper.DataArrayFloat____new___(cls,args)
+def MEDCouplingDataArrayFloatIadd(self,*args):
+    import _MEDCouplingRemapper
+    return _MEDCouplingRemapper.DataArrayFloat____iadd___(self, self, *args)
+def MEDCouplingDataArrayFloatIsub(self,*args):
+    import _MEDCouplingRemapper
+    return _MEDCouplingRemapper.DataArrayFloat____isub___(self, self, *args)
+def MEDCouplingDataArrayFloatImul(self,*args):
+    import _MEDCouplingRemapper
+    return _MEDCouplingRemapper.DataArrayFloat____imul___(self, self, *args)
+def MEDCouplingDataArrayFloatIdiv(self,*args):
+    import _MEDCouplingRemapper
+    return _MEDCouplingRemapper.DataArrayFloat____idiv___(self, self, *args)
 def MEDCouplingDataArrayIntnew(cls,*args):
     import _MEDCouplingRemapper
     return _MEDCouplingRemapper.DataArrayInt____new___(cls,args)
index 5ff24cd86d147141fe78149e47ae5405309e19f5..b00dc71ef730857386b0b83edc15582ee396338e 100644 (file)
@@ -30,13 +30,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 +52,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 +75,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 +85,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 +107,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 +117,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 +127,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 +308,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 +570,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 +727,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 +776,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 +784,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 +860,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 +1118,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 +1157,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 +1211,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 6bb7ee801e85b22969d8a56ed04745beb999775c..72450ab355462796973a068120fdaf5502b60782 100644 (file)
@@ -33,7 +33,7 @@
 #include "MEDCouplingPartDefinition.hxx"
 #include "MEDCouplingCartesianAMRMesh.hxx"
 
-static PyObject *convertMesh(MEDCoupling::MEDCouplingMesh *mesh, int owner) throw(INTERP_KERNEL::Exception)
+static PyObject *convertMesh(MEDCoupling::MEDCouplingMesh *mesh, int owner)
 {
   PyObject *ret=0;
   if(!mesh)
@@ -60,7 +60,7 @@ static PyObject *convertMesh(MEDCoupling::MEDCouplingMesh *mesh, int owner) thro
   return ret;
 }
 
-static PyObject *convertFieldDiscretization(MEDCoupling::MEDCouplingFieldDiscretization *fd, int owner) throw(INTERP_KERNEL::Exception)
+static PyObject *convertFieldDiscretization(MEDCoupling::MEDCouplingFieldDiscretization *fd, int owner)
 {
   PyObject *ret=0;
   if(!fd)
@@ -83,7 +83,7 @@ static PyObject *convertFieldDiscretization(MEDCoupling::MEDCouplingFieldDiscret
   return ret;
 }
 
-static PyObject* convertMultiFields(MEDCoupling::MEDCouplingMultiFields *mfs, int owner) throw(INTERP_KERNEL::Exception)
+static PyObject* convertMultiFields(MEDCoupling::MEDCouplingMultiFields *mfs, int owner)
 {
   PyObject *ret=0;
   if(!mfs)
@@ -98,7 +98,7 @@ static PyObject* convertMultiFields(MEDCoupling::MEDCouplingMultiFields *mfs, in
   return ret;
 }
 
-static PyObject *convertCartesianAMRMesh(MEDCoupling::MEDCouplingCartesianAMRMeshGen *mesh, int owner) throw(INTERP_KERNEL::Exception)
+static PyObject *convertCartesianAMRMesh(MEDCoupling::MEDCouplingCartesianAMRMeshGen *mesh, int owner)
 {
   if(!mesh)
     {
@@ -116,7 +116,7 @@ static PyObject *convertCartesianAMRMesh(MEDCoupling::MEDCouplingCartesianAMRMes
   throw INTERP_KERNEL::Exception("convertCartesianAMRMesh wrap : unrecognized type of cartesian AMR mesh !");
 }
 
-static PyObject *convertDataForGodFather(MEDCoupling::MEDCouplingDataForGodFather *data, int owner) throw(INTERP_KERNEL::Exception)
+static PyObject *convertDataForGodFather(MEDCoupling::MEDCouplingDataForGodFather *data, int owner)
 {
   if(!data)
     {
@@ -168,7 +168,7 @@ static MEDCoupling::MEDCouplingFieldDouble *MEDCoupling_MEDCouplingFieldDouble__
   MEDCoupling::DataArrayDoubleTuple *aa;
   std::vector<double> bb;
   int sw;
-  convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+  convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
   switch(sw)
     {
     case 1:
@@ -240,7 +240,7 @@ static MEDCoupling::MEDCouplingFieldDouble *MEDCoupling_MEDCouplingFieldDouble__
   MEDCoupling::DataArrayDoubleTuple *aa;
   std::vector<double> bb;
   int sw;
-  convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+  convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
   switch(sw)
     {
     case 1:
@@ -307,7 +307,7 @@ static MEDCoupling::MEDCouplingFieldDouble *MEDCoupling_MEDCouplingFieldDouble__
   MEDCoupling::DataArrayDoubleTuple *aa;
   std::vector<double> bb;
   int sw;
-  convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+  convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
   switch(sw)
     {
     case 1:
@@ -379,7 +379,7 @@ MEDCoupling::MEDCouplingFieldDouble *MEDCoupling_MEDCouplingFieldDouble___rdiv__
   MEDCoupling::DataArrayDoubleTuple *aa;
   std::vector<double> bb;
   int sw;
-  convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
+  convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
   switch(sw)
     {
     case 1:
@@ -426,4 +426,248 @@ MEDCoupling::MEDCouplingFieldDouble *MEDCoupling_MEDCouplingFieldDouble___rdiv__
     }
 }
 
+template<class T>
+typename MEDCoupling::Traits<T>::FieldType *fieldT_buildSubPart(const MEDCoupling::MEDCouplingFieldT<T> *self, PyObject *li)
+{
+  int sw;
+  int singleVal;
+  std::vector<int> multiVal;
+  std::pair<int, std::pair<int,int> > slic;
+  MEDCoupling::DataArrayInt *daIntTyypp=0;
+  const MEDCoupling::MEDCouplingMesh *mesh=self->getMesh();
+  if(!mesh)
+    throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !");
+  int nbc=mesh->getNumberOfCells();
+  convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
+  switch(sw)
+    {
+    case 1:
+      {
+        if(singleVal>=nbc)
+          {
+            std::ostringstream oss;
+            oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
+            throw INTERP_KERNEL::Exception(oss.str().c_str());
+          }
+        if(singleVal>=0)
+          return self->buildSubPart(&singleVal,&singleVal+1);
+        else
+          {
+            if(nbc+singleVal>0)
+              {
+                int tmp=nbc+singleVal;
+                return self->buildSubPart(&tmp,&tmp+1);
+              }
+            else
+              {
+                std::ostringstream oss;
+                oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
+                throw INTERP_KERNEL::Exception(oss.str().c_str());
+              }
+          }
+      }
+    case 2:
+      {
+        return self->buildSubPart(&multiVal[0],&multiVal[0]+multiVal.size());
+      }
+    case 3:
+      {
+        return self->buildSubPartRange(slic.first,slic.second.first,slic.second.second);
+      }
+    case 4:
+      {
+        if(!daIntTyypp)
+          throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : null instance has been given in input !");
+        daIntTyypp->checkAllocated();
+        return self->buildSubPart(daIntTyypp->begin(),daIntTyypp->end());
+      }
+    default:
+      throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
+    }
+}
+
+template<class T>
+typename MEDCoupling::Traits<T>::FieldType *fieldT__getitem__(const MEDCoupling::MEDCouplingFieldT<T> *self, PyObject *li)
+{
+  const char msg[]="MEDCouplingFieldDouble::__getitem__ : invalid call  Available API are : \n-myField[dataArrayInt]\n-myField[slice]\n-myField[pythonListOfCellIds]\n-myField[integer]\n-myField[dataArrayInt,1]\n-myField[slice,1]\n-myField[pythonListOfCellIds,1]\n-myField[integer,1]\n";
+  if(PyTuple_Check(li))
+    {
+      Py_ssize_t sz=PyTuple_Size(li);
+      if(sz!=2)
+        throw INTERP_KERNEL::Exception(msg);
+      PyObject *elt0=PyTuple_GetItem(li,0),*elt1=PyTuple_GetItem(li,1);
+      int sw;
+      int singleVal;
+      std::vector<int> multiVal;
+      std::pair<int, std::pair<int,int> > slic;
+      MEDCoupling::DataArrayInt *daIntTyypp=0;
+      if(!self->getArray())
+        throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array set on field to deduce number of components !");
+      try
+        { convertIntStarOrSliceLikePyObjToCpp(elt1,self->getArray()->getNumberOfComponents(),sw,singleVal,multiVal,slic,daIntTyypp); }
+      catch(INTERP_KERNEL::Exception& e)
+        { std::ostringstream oss; oss << "MEDCouplingFieldDouble::__getitem__ : invalid type in 2nd parameter (compo) !" << e.what(); throw INTERP_KERNEL::Exception(oss.str().c_str()); }
+      typename MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::FieldType > ret0(fieldT_buildSubPart<T>(self,elt0));
+      typename MEDCoupling::Traits<T>::ArrayType *ret0Arr=ret0->getArray();
+      if(!ret0Arr)
+        throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array exists to apply restriction on component on it !");
+      switch(sw)
+        {
+        case 1:
+          {
+            std::vector<int> v2(1,singleVal);
+            MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > aarr(ret0Arr->keepSelectedComponents(v2));
+            ret0->setArray(aarr);
+            return ret0.retn();
+          }
+        case 2:
+          {
+            MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > aarr(ret0Arr->keepSelectedComponents(multiVal));
+            ret0->setArray(aarr);
+            return ret0.retn();
+          }
+        case 3:
+          {
+            int nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(slic.first,slic.second.first,slic.second.second,"MEDCouplingFieldDouble::__getitem__ : invalid range in 2nd parameter (components) !"));
+            std::vector<int> v2(nbOfComp);
+            for(int i=0;i<nbOfComp;i++)
+              v2[i]=slic.first+i*slic.second.second;
+            MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > aarr(ret0Arr->keepSelectedComponents(v2));
+            ret0->setArray(aarr);
+            return ret0.retn();
+          }
+        default:
+          throw INTERP_KERNEL::Exception(msg);
+        }
+    }
+  else
+    return fieldT_buildSubPart<T>(self,li);
+}
+
+template<class FIELDT>
+PyObject *field_getTinySerializationInformation(const FIELDT *self)
+{
+  std::vector<double> a0;
+  std::vector<int> a1;
+  std::vector<std::string> a2;
+  self->getTinySerializationDbleInformation(a0);
+  self->getTinySerializationIntInformation(a1);
+  self->getTinySerializationStrInformation(a2);
+  //
+  PyObject *ret(PyTuple_New(3));
+  PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0));
+  PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1));
+  int sz(a2.size());
+  PyObject *ret2(PyList_New(sz));
+  {
+    for(int i=0;i<sz;i++)
+      PyList_SetItem(ret2,i,PyString_FromString(a2[i].c_str()));
+  }
+  PyTuple_SetItem(ret,2,ret2);
+  return ret;
+}
+
+template<class T>
+PyObject *field_serialize(const typename MEDCoupling::Traits<T>::FieldType *self)
+{
+  MEDCoupling::DataArrayInt *ret0(0);
+  std::vector<typename MEDCoupling::Traits<T>::ArrayType *> ret1;
+  self->serialize(ret0,ret1);
+  if(ret0)
+    ret0->incrRef();
+  std::size_t sz(ret1.size());
+  PyObject *ret(PyTuple_New(2));
+  PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+  PyObject *ret1Py(PyList_New(sz));
+  for(std::size_t i=0;i<sz;i++)
+    {
+      if(ret1[i])
+        ret1[i]->incrRef();
+      PyList_SetItem(ret1Py,i,convertArray(ret1[i],SWIG_POINTER_OWN | 0));
+    }
+  PyTuple_SetItem(ret,1,ret1Py);
+  return ret;
+}
+
+template<class FIELDT>
+PyObject *field__getnewargs__(FIELDT *self)
+{
+  self->checkConsistencyLight();
+  PyObject *ret(PyTuple_New(1));
+  PyObject *ret0(PyDict_New());
+  {
+    PyObject *a(PyInt_FromLong(0)),*b(PyInt_FromLong(self->getTypeOfField())),*c(PyInt_FromLong(self->getTimeDiscretization()));
+    PyObject *d(PyTuple_New(2)); PyTuple_SetItem(d,0,b); PyTuple_SetItem(d,1,c);
+    PyDict_SetItem(ret0,a,d);
+    Py_DECREF(a); Py_DECREF(d);
+  }
+  PyTuple_SetItem(ret,0,ret0);
+  return ret;
+}
+
+template<class FIELDT>
+PyObject *field__getstate__(const FIELDT *self, PyObject *(*tinyserial)(const FIELDT *), PyObject *(*bigserial)(const FIELDT *))
+{
+  self->checkConsistencyLight();
+  PyObject *ret0(tinyserial(self));
+  PyObject *ret1(bigserial(self));
+  const MEDCoupling::MEDCouplingMesh *mesh(self->getMesh());
+  if(mesh)
+    mesh->incrRef();
+  PyObject *ret(PyTuple_New(3));
+  PyTuple_SetItem(ret,0,ret0);
+  PyTuple_SetItem(ret,1,ret1);
+  PyTuple_SetItem(ret,2,convertMesh(const_cast<MEDCoupling::MEDCouplingMesh *>(mesh),SWIG_POINTER_OWN | 0 ));
+  return ret;
+}
+
+template<class T>
+void field__setstate__(typename MEDCoupling::Traits<T>::FieldType *self, PyObject *inp)
+{
+  static const char MSG[]="MEDCouplingFieldDouble.__setstate__ : expected input is a tuple of size 3 !";
+  if(!PyTuple_Check(inp))
+    throw INTERP_KERNEL::Exception(MSG);
+  int sz(PyTuple_Size(inp));
+  if(sz!=3)
+    throw INTERP_KERNEL::Exception(MSG);
+  // mesh
+  PyObject *elt2(PyTuple_GetItem(inp,2));
+  void *argp=0;
+  int status(SWIG_ConvertPtr(elt2,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingMesh,0|0));
+  if(!SWIG_IsOK(status))
+    throw INTERP_KERNEL::Exception(MSG);
+  self->setMesh(reinterpret_cast< const MEDCoupling::MEDCouplingMesh * >(argp));
+  //
+  PyObject *elt0(PyTuple_GetItem(inp,0));
+  PyObject *elt1(PyTuple_GetItem(inp,1));
+  std::vector<double> a0;
+  std::vector<int> a1;
+  std::vector<std::string> a2;
+  MEDCoupling::DataArrayInt *b0(0);
+  std::vector<typename MEDCoupling::Traits<T>::ArrayType *>b1;
+  {
+    if(!PyTuple_Check(elt0) && PyTuple_Size(elt0)!=3)
+      throw INTERP_KERNEL::Exception(MSG);
+    PyObject *a0py(PyTuple_GetItem(elt0,0)),*a1py(PyTuple_GetItem(elt0,1)),*a2py(PyTuple_GetItem(elt0,2));
+    int tmp(-1);
+    fillArrayWithPyListDbl3(a0py,tmp,a0);
+    convertPyToNewIntArr3(a1py,a1);
+    fillStringVector(a2py,a2);
+  }
+  {
+    if(!PyTuple_Check(elt1) && PyTuple_Size(elt1)!=2)
+      throw INTERP_KERNEL::Exception(MSG);
+    PyObject *b0py(PyTuple_GetItem(elt1,0)),*b1py(PyTuple_GetItem(elt1,1));
+    void *argp(0);
+    int status(SWIG_ConvertPtr(b0py,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0));
+    if(!SWIG_IsOK(status))
+      throw INTERP_KERNEL::Exception(MSG);
+    b0=reinterpret_cast<MEDCoupling::DataArrayInt *>(argp);
+    convertFromPyObjVectorOfObj<typename MEDCoupling::Traits<T>::ArrayType *>(b1py,SWIGTITraits<T>::TI,MEDCoupling::Traits<T>::ArrayTypeName,b1);
+  }
+  self->checkForUnserialization(a1,b0,b1);
+  // useless here to call resizeForUnserialization because arrays are well resized.
+  self->finishUnserialization(a1,a0,a2);
+}
+
 #endif
index df38605c584fe078d646299facc9ddf4a908461b..cb09988db00b18ff8734e19bb28ce0657937a7e2 100644 (file)
@@ -16,7 +16,7 @@
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-// Author : Anthony Geay (CEA/DEN)
+// Author : Anthony Geay (EDF R&D)
 
 #include "MEDFileField.txx"
 #include "MEDFileMesh.hxx"
@@ -27,8 +27,6 @@
 #include "MEDFileBlowStrEltUp.hxx"
 #include "MEDFileFieldVisitor.hxx"
 
-#include "MEDCouplingFieldDouble.hxx"
-#include "MEDCouplingFieldTemplate.hxx"
 #include "MEDCouplingFieldDiscretization.hxx"
 
 #include "InterpKernelAutoPtr.hxx"
@@ -45,10 +43,26 @@ extern med_geometry_type typmai3[34];
 using namespace MEDCoupling;
 
 template class MEDCoupling::MEDFileField1TSTemplateWithoutSDA<int>;
+template class MEDCoupling::MEDFileField1TSTemplateWithoutSDA<float>;
 template class MEDCoupling::MEDFileField1TSTemplateWithoutSDA<double>;
+template class MEDCoupling::MEDFileField1TSNDTemplateWithoutSDA<int>;
+template class MEDCoupling::MEDFileField1TSNDTemplateWithoutSDA<float>;
+template class MEDCoupling::MEDFileNDTemplateFieldMultiTSWithoutSDA<int>;
+template class MEDCoupling::MEDFileNDTemplateFieldMultiTSWithoutSDA<float>;
+template class MEDCoupling::MEDFileTemplateField1TS<int>;
+template class MEDCoupling::MEDFileTemplateField1TS<float>;
+template class MEDCoupling::MEDFileTemplateField1TS<double>;
+template class MEDCoupling::MEDFileNDTemplateField1TS<int>;
+template class MEDCoupling::MEDFileNDTemplateField1TS<float>;
+template class MEDCoupling::MEDFileTemplateFieldMultiTS<int>;
+template class MEDCoupling::MEDFileTemplateFieldMultiTS<float>;
+template class MEDCoupling::MEDFileTemplateFieldMultiTS<double>;
+template class MEDCoupling::MEDFileNDTemplateFieldMultiTS<int>;
+template class MEDCoupling::MEDFileNDTemplateFieldMultiTS<float>;
 
 const char MEDFileField1TSWithoutSDA::TYPE_STR[]="FLOAT64";
 const char MEDFileIntField1TSWithoutSDA::TYPE_STR[]="INT32";
+const char MEDFileFloatField1TSWithoutSDA::TYPE_STR[]="FLOAT32";
 
 MEDFileGTKeeper::~MEDFileGTKeeper()
 {
@@ -310,7 +324,7 @@ std::string MEDFileFieldLoc::repr() const
   return oss.str();
 }
 
-void MEDFileFieldPerMeshPerTypePerDisc::assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldDouble *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
+void MEDFileFieldPerMeshPerTypePerDisc::assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
 {
   _type=field->getTypeOfField();
   _start=start;
@@ -385,7 +399,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldNoProfile(int& start, int off
  *             \b WARNING if not null the MED file profile can be subdivided again in case of Gauss points.
  * \param [in] mesh is the mesh coming from the MEDFileMesh instance in correspondance with the MEDFileField. The mesh inside the \a field is simply ignored.
  */
-void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(bool isPflAlone, int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldDouble *field, const DataArray *arrr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
+void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(bool isPflAlone, int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arrr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
 {
   _profile.clear();
   _type=field->getTypeOfField();
@@ -494,7 +508,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(bool isPflAlone, int&
   start=_end;
 }
 
-void MEDFileFieldPerMeshPerTypePerDisc::assignNodeFieldNoProfile(int& start, const MEDCouplingFieldDouble *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob)
+void MEDFileFieldPerMeshPerTypePerDisc::assignNodeFieldNoProfile(int& start, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob)
 {
   _start=start;
   _nval=arrr->getNumberOfTuples();
@@ -1189,7 +1203,7 @@ std::vector<const BigMemoryObject *> MEDFileFieldPerMeshPerTypeCommon::getDirect
   return ret;
 }
 
-void MEDFileFieldPerMeshPerTypeCommon::assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
+void MEDFileFieldPerMeshPerTypeCommon::assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
 {
   std::vector<int> pos=addNewEntryIfNecessary(field,offset,nbOfCells);
   for(std::vector<int>::const_iterator it=pos.begin();it!=pos.end();it++)
@@ -1205,21 +1219,21 @@ void MEDFileFieldPerMeshPerTypeCommon::assignFieldNoProfile(int& start, int offs
  * \param [in] nbOfEltsInWholeMesh nb of elts of type \a this->_geo_type in \b WHOLE mesh
  * \param [in] mesh is the mesh coming from the MEDFileMesh instance in correspondance with the MEDFileField. The mesh inside the \a field is simply ignored.
  */
-void MEDFileFieldPerMeshPerTypeCommon::assignFieldProfile(bool isPflAlone, int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
+void MEDFileFieldPerMeshPerTypeCommon::assignFieldProfile(bool isPflAlone, int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
 {
   std::vector<int> pos=addNewEntryIfNecessary(field,idsInPfl);
   for(std::vector<int>::const_iterator it=pos.begin();it!=pos.end();it++)
     _field_pm_pt_pd[*it]->assignFieldProfile(isPflAlone,start,multiTypePfl,idsInPfl,locIds,nbOfEltsInWholeMesh,field,arr,mesh,glob,nasc);
 }
 
-void MEDFileFieldPerMeshPerTypeCommon::assignNodeFieldNoProfile(int& start, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob)
+void MEDFileFieldPerMeshPerTypeCommon::assignNodeFieldNoProfile(int& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob)
 {
   _field_pm_pt_pd.resize(1);
   _field_pm_pt_pd[0]=MEDFileFieldPerMeshPerTypePerDisc::New(this,ON_NODES,-3);
   _field_pm_pt_pd[0]->assignNodeFieldNoProfile(start,field,arr,glob);
 }
 
-void MEDFileFieldPerMeshPerTypeCommon::assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
+void MEDFileFieldPerMeshPerTypeCommon::assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
 {
   MCAuto<DataArrayInt> pfl2=pfl->deepCopy();
   if(!arr || !arr->isAllocated())
@@ -1229,7 +1243,7 @@ void MEDFileFieldPerMeshPerTypeCommon::assignNodeFieldProfile(int& start, const
   _field_pm_pt_pd[0]->assignFieldProfile(true,start,pfl,pfl2,pfl2,-1,field,arr,0,glob,nasc);//mesh is not requested so 0 is send.
 }
 
-std::vector<int> MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(const MEDCouplingFieldDouble *field, int offset, int nbOfCells)
+std::vector<int> MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, int offset, int nbOfCells)
 {
   TypeOfField type=field->getTypeOfField();
   if(type!=ON_GAUSS_PT)
@@ -1284,7 +1298,7 @@ std::vector<int> MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(const
     }
 }
 
-std::vector<int> MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessaryGauss(const MEDCouplingFieldDouble *field, int offset, int nbOfCells)
+std::vector<int> MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, int offset, int nbOfCells)
 {
   const MEDCouplingFieldDiscretization *disc=field->getDiscretization();
   const MEDCouplingFieldDiscretizationGauss *disc2=dynamic_cast<const MEDCouplingFieldDiscretizationGauss *>(disc);
@@ -1301,7 +1315,7 @@ std::vector<int> MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessaryGauss(c
   return ret;
 }
 
-std::vector<int> MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(const MEDCouplingFieldDouble *field, const DataArrayInt *subCells)
+std::vector<int> MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, const DataArrayInt *subCells)
 {
   TypeOfField type=field->getTypeOfField();
   if(type!=ON_GAUSS_PT)
@@ -1356,7 +1370,7 @@ std::vector<int> MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(const
     }
 }
 
-std::vector<int> MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessaryGauss(const MEDCouplingFieldDouble *field, const DataArrayInt *subCells)
+std::vector<int> MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, const DataArrayInt *subCells)
 {
   const MEDCouplingFieldDiscretization *disc=field->getDiscretization();
   const MEDCouplingFieldDiscretizationGauss *disc2=dynamic_cast<const MEDCouplingFieldDiscretizationGauss *>(disc);
@@ -1955,7 +1969,7 @@ void MEDFileFieldPerMesh::copyTinyInfoFrom(const MEDCouplingMesh *mesh)
   mesh->getTime(_mesh_iteration,_mesh_order);
 }
 
-void MEDFileFieldPerMesh::assignFieldNoProfileNoRenum(int& start, const std::vector<int>& code, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
+void MEDFileFieldPerMesh::assignFieldNoProfileNoRenum(int& start, const std::vector<int>& code, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
 {
   int nbOfTypes=code.size()/3;
   int offset=0;
@@ -1978,7 +1992,7 @@ void MEDFileFieldPerMesh::assignFieldNoProfileNoRenum(int& start, const std::vec
  * \param [in] idsPerType is a vector containing the profiles needed to be created for MED file format. \b WARNING these processed MED file profiles can be subdivided again in case of Gauss points.
  * \param [in] mesh is the mesh coming from the MEDFileMesh instance in correspondance with the MEDFileField. The mesh inside the \a field is simply ignored.
  */
-void MEDFileFieldPerMesh::assignFieldProfile(int& start, const DataArrayInt *multiTypePfl, const std::vector<int>& code, const std::vector<int>& code2, const std::vector<DataArrayInt *>& idsInPflPerType, const std::vector<DataArrayInt *>& idsPerType, const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
+void MEDFileFieldPerMesh::assignFieldProfile(int& start, const DataArrayInt *multiTypePfl, const std::vector<int>& code, const std::vector<int>& code2, const std::vector<DataArrayInt *>& idsInPflPerType, const std::vector<DataArrayInt *>& idsPerType, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
 {
   int nbOfTypes(code.size()/3);
   for(int i=0;i<nbOfTypes;i++)
@@ -1999,13 +2013,13 @@ void MEDFileFieldPerMesh::assignFieldProfile(int& start, const DataArrayInt *mul
     }
 }
 
-void MEDFileFieldPerMesh::assignNodeFieldNoProfile(int& start, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob)
+void MEDFileFieldPerMesh::assignNodeFieldNoProfile(int& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob)
 {
   int pos=addNewEntryIfNecessary(INTERP_KERNEL::NORM_ERROR);
   _field_pm_pt[pos]->assignNodeFieldNoProfile(start,field,arr,glob);
 }
 
-void MEDFileFieldPerMesh::assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
+void MEDFileFieldPerMesh::assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
 {
   int pos=addNewEntryIfNecessary(INTERP_KERNEL::NORM_ERROR);
   _field_pm_pt[pos]->assignNodeFieldProfile(start,pfl,field,arr,glob,nasc);
@@ -5102,16 +5116,16 @@ std::vector<const BigMemoryObject *> MEDFileAnyTypeField1TSWithoutSDA::getDirect
  *  \throw If the underlying mesh of \a field has no name.
  *  \throw If elements in the mesh are not in the order suitable for writing to the MED file.
  */
-void MEDFileAnyTypeField1TSWithoutSDA::setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
+void MEDFileAnyTypeField1TSWithoutSDA::setFieldNoProfileSBT(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
 {
-  const MEDCouplingMesh *mesh=field->getMesh();
+  const MEDCouplingMesh *mesh(field->getMesh());
   //
-  TypeOfField type=field->getTypeOfField();
+  TypeOfField type(field->getTypeOfField());
   std::vector<DataArrayInt *> dummy;
   if(mesh)
     setMeshName(mesh->getName());
-  int start=copyTinyInfoFrom(field,arr);
-  int pos=addNewEntryIfNecessary(mesh);
+  int start(copyTinyInfoFrom(th,field,arr));
+  int pos(addNewEntryIfNecessary(mesh));
   if(type!=ON_NODES)
     {
       std::vector<int> code=MEDFileField1TSWithoutSDA::CheckSBTMesh(mesh);
@@ -5144,7 +5158,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::setFieldNoProfileSBT(const MEDCouplingFie
  *  \throw If elements in \a mesh are not in the order suitable for writing to the MED file.
  *  \sa setFieldNoProfileSBT()
  */
-void MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
+void MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
 {
   if(!field)
     throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile : input field is null !");
@@ -5162,7 +5176,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile(const MEDCouplingFieldDou
       std::vector< MCAuto<DataArrayInt> > idsPerType2(idsPerType.size()); std::copy(idsPerType.begin(),idsPerType.end(),idsPerType2.begin()); 
       std::vector<const DataArrayInt *> idsPerType3(idsPerType.size()); std::copy(idsPerType.begin(),idsPerType.end(),idsPerType3.begin());
       // start of check
-      MCAuto<MEDCouplingFieldDouble> field2=field->clone(false);
+      MCAuto<MEDCouplingFieldTemplate> field2=field->clone(false);
       int nbOfTuplesExp=field2->getNumberOfTuplesExpectedRegardingCode(code,idsPerType3);
       if(nbOfTuplesExp!=arrOfVals->getNumberOfTuples())
         {
@@ -5170,7 +5184,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile(const MEDCouplingFieldDou
           throw INTERP_KERNEL::Exception(oss.str());
         }
       // end of check
-      int start=copyTinyInfoFrom(field,arrOfVals);
+      int start(copyTinyInfoFrom(th,field,arrOfVals));
       code2=m->getDistributionOfTypes();
       //
       int pos=addNewEntryIfNecessary(m);
@@ -5188,8 +5202,8 @@ void MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile(const MEDCouplingFieldDou
           std::ostringstream oss; oss << "MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile : For node field, the array is expected to have " << nbOfTuplesExp << " tuples ! It has " << arrOfVals->getNumberOfTuples() << " !";
           throw INTERP_KERNEL::Exception(oss.str());
         }
-      int start=copyTinyInfoFrom(field,arrOfVals);
-      int pos=addNewEntryIfNecessary(m);
+      int start(copyTinyInfoFrom(th,field,arrOfVals));
+      int pos(addNewEntryIfNecessary(m));
       _field_per_mesh[pos]->assignNodeFieldProfile(start,profile,field,arrOfVals,glob,nasc);
     }
 }
@@ -5218,7 +5232,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::allocNotFromFile(int newNbOfTuples)
  *  \throw If \a this->_arr is already allocated but has different number of components
  *         than \a field.
  */
-int MEDFileAnyTypeField1TSWithoutSDA::copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr)
+int MEDFileAnyTypeField1TSWithoutSDA::copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr)
 {
   if(!field)
     throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::copyTinyInfoFrom : input field is NULL !");
@@ -5226,14 +5240,14 @@ int MEDFileAnyTypeField1TSWithoutSDA::copyTinyInfoFrom(const MEDCouplingFieldDou
   setName(name.c_str());
   if(field->getMesh())
     setMeshName(field->getMesh()->getName());
-  setDtUnit(field->getTimeUnit());
+  setDtUnit(th->getTimeUnit());
   if(name.empty())
     throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::copyTinyInfoFrom : unsupported fields with no name in MED file !");
   if(!arr)
     throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::copyTinyInfoFrom : no array set !");
   if(!arr->isAllocated())
     throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::copyTinyInfoFrom : array is not allocated !");
-  _dt=field->getTime(_iteration,_order);
+  _dt=th->getTime(_iteration,_order);
   getOrCreateAndGetArray()->setInfoAndChangeNbOfCompo(arr->getInfoOnComponents());
   if(!getOrCreateAndGetArray()->isAllocated())
     {
@@ -5717,32 +5731,6 @@ MEDFileIntField1TSWithoutSDA *MEDFileField1TSWithoutSDA::convertToInt() const
   return ret.retn();
 }
 
-/*!
- * Returns a pointer to the underground DataArrayDouble instance and a
- * sequence describing parameters of a support of each part of \a this field. The
- * caller should not decrRef() the returned DataArrayDouble. This method allows for a
- * direct access to the field values. This method is intended for the field lying on one
- * mesh only.
- *  \param [in,out] entries - the sequence describing parameters of a support of each
- *         part of \a this field. Each item of this sequence consists of two parts. The
- *         first part describes a type of mesh entity and an id of discretization of a
- *         current field part. The second part describes a range of values [begin,end)
- *         within the returned array relating to the current field part.
- *  \return DataArrayDouble * - the pointer to the field values array.
- *  \throw If the number of underlying meshes is not equal to 1.
- *  \throw If no field values are available.
- *  \sa getUndergroundDataArray()
- */
-DataArrayDouble *MEDFileField1TSWithoutSDA::getUndergroundDataArrayDoubleExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
-{
-  if(_field_per_mesh.size()!=1)
-    throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : field lies on several meshes, this method has no sense !");
-  if(_field_per_mesh[0]==0)
-    throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : no field specified !");
-  _field_per_mesh[0]->getUndergroundDataArrayExt(entries);
-  return getUndergroundDataArrayTemplate();
-}
-
 /*!
  * Returns a pointer to the underground DataArrayDouble instance and a
  * sequence describing parameters of a support of each part of \a this field. The
@@ -5761,7 +5749,7 @@ DataArrayDouble *MEDFileField1TSWithoutSDA::getUndergroundDataArrayDoubleExt(std
  */
 DataArray *MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
 {
-  return getUndergroundDataArrayDoubleExt(entries);
+  return getUndergroundDataArrayTemplateExt(entries);
 }
 
 MEDFileField1TSWithoutSDA::MEDFileField1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector<std::string>& infos):MEDFileField1TSTemplateWithoutSDA<double>(fieldName,meshName,csit,iteration,order)
@@ -5796,12 +5784,12 @@ MEDFileIntField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::New(const std::strin
   return new MEDFileIntField1TSWithoutSDA(fieldName,meshName,csit,iteration,order,infos);
 }
 
-MEDFileIntField1TSWithoutSDA::MEDFileIntField1TSWithoutSDA():MEDFileField1TSTemplateWithoutSDA<int>()
+MEDFileIntField1TSWithoutSDA::MEDFileIntField1TSWithoutSDA()
 {
 }
 
 MEDFileIntField1TSWithoutSDA::MEDFileIntField1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order,
-                                                           const std::vector<std::string>& infos):MEDFileField1TSTemplateWithoutSDA<int>(fieldName,meshName,csit,iteration,order)
+                                                           const std::vector<std::string>& infos):MEDFileField1TSNDTemplateWithoutSDA<int>(fieldName,meshName,csit,iteration,order,infos)
 {
   DataArrayInt *arr(getOrCreateAndGetArrayTemplate());
   arr->setInfoAndChangeNbOfCompo(infos);
@@ -5812,20 +5800,6 @@ const char *MEDFileIntField1TSWithoutSDA::getTypeStr() const
   return TYPE_STR;
 }
 
-MEDFileField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::convertToDouble() const
-{
-  MCAuto<MEDFileField1TSWithoutSDA> ret(new MEDFileField1TSWithoutSDA);
-  ret->MEDFileAnyTypeField1TSWithoutSDA::operator =(*this);
-  ret->deepCpyLeavesFrom(*this);
-  const DataArrayInt *arr(_arr);
-  if(arr)
-    {
-      MCAuto<DataArrayDouble> arr2(arr->convertToDblArr());
-      ret->setArray(arr2);
-    }
-  return ret.retn();
-}
-
 /*!
  * Returns a pointer to the underground DataArrayInt instance and a
  * sequence describing parameters of a support of each part of \a this field. The
@@ -5888,12 +5862,97 @@ MEDFileIntField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::deepCopy() const
   return ret.retn();
 }
 
-MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS()
+//= MEDFileFloatField1TSWithoutSDA
+
+MEDFileFloatField1TSWithoutSDA *MEDFileFloatField1TSWithoutSDA::New(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector<std::string>& infos)
+{
+  return new MEDFileFloatField1TSWithoutSDA(fieldName,meshName,csit,iteration,order,infos);
+}
+
+MEDFileFloatField1TSWithoutSDA::MEDFileFloatField1TSWithoutSDA()
+{
+}
+
+MEDFileFloatField1TSWithoutSDA::MEDFileFloatField1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order,
+                                                               const std::vector<std::string>& infos):MEDFileField1TSNDTemplateWithoutSDA<float>(fieldName,meshName,csit,iteration,order,infos)
+{
+  DataArrayFloat *arr(getOrCreateAndGetArrayTemplate());
+  arr->setInfoAndChangeNbOfCompo(infos);
+}
+
+const char *MEDFileFloatField1TSWithoutSDA::getTypeStr() const
+{
+  return TYPE_STR;
+}
+
+/*!
+ * Returns a pointer to the underground DataArrayFloat instance and a
+ * sequence describing parameters of a support of each part of \a this field. The
+ * caller should not decrRef() the returned DataArrayFloat. This method allows for a
+ * direct access to the field values. This method is intended for the field lying on one
+ * mesh only.
+ *  \param [in,out] entries - the sequence describing parameters of a support of each
+ *         part of \a this field. Each item of this sequence consists of two parts. The
+ *         first part describes a type of mesh entity and an id of discretization of a
+ *         current field part. The second part describes a range of values [begin,end)
+ *         within the returned array relating to the current field part.
+ *  \return DataArrayFloat * - the pointer to the field values array.
+ *  \throw If the number of underlying meshes is not equal to 1.
+ *  \throw If no field values are available.
+ *  \sa getUndergroundDataArray()
+ */
+DataArray *MEDFileFloatField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+{
+  return getUndergroundDataArrayFloatExt(entries);
+}
+
+/*!
+ * Returns a pointer to the underground DataArrayFloat instance and a
+ * sequence describing parameters of a support of each part of \a this field. The
+ * caller should not decrRef() the returned DataArrayFloat. This method allows for a
+ * direct access to the field values. This method is intended for the field lying on one
+ * mesh only.
+ *  \param [in,out] entries - the sequence describing parameters of a support of each
+ *         part of \a this field. Each item of this sequence consists of two parts. The
+ *         first part describes a type of mesh entity and an id of discretization of a
+ *         current field part. The second part describes a range of values [begin,end)
+ *         within the returned array relating to the current field part.
+ *  \return DataArrayFloat * - the pointer to the field values array.
+ *  \throw If the number of underlying meshes is not equal to 1.
+ *  \throw If no field values are available.
+ *  \sa getUndergroundDataArray()
+ */
+DataArrayFloat *MEDFileFloatField1TSWithoutSDA::getUndergroundDataArrayFloatExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+{
+  if(_field_per_mesh.size()!=1)
+    throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : field lies on several meshes, this method has no sense !");
+  if(_field_per_mesh[0]==0)
+    throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : no field specified !");
+  _field_per_mesh[0]->getUndergroundDataArrayExt(entries);
+  return getUndergroundDataArrayTemplate();
+}
+
+MEDFileFloatField1TSWithoutSDA *MEDFileFloatField1TSWithoutSDA::shallowCpy() const
+{
+  MCAuto<MEDFileFloatField1TSWithoutSDA> ret(new MEDFileFloatField1TSWithoutSDA(*this));
+  ret->deepCpyLeavesFrom(*this);
+  return ret.retn();
+}
+
+MEDFileFloatField1TSWithoutSDA *MEDFileFloatField1TSWithoutSDA::deepCopy() const
 {
+  MCAuto<MEDFileFloatField1TSWithoutSDA> ret(shallowCpy());
+  if(_arr.isNotNull())
+    ret->_arr=_arr->deepCopy();
+  return ret.retn();
 }
 
 //= MEDFileAnyTypeField1TS
 
+MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS()
+{
+}
+
 MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_idt fid, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities)
 {
   med_field_type typcha;
@@ -5914,6 +5973,11 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i
         ret=MEDFileIntField1TSWithoutSDA::New(fieldName,meshName,-1,-1/*iteration*/,-1/*order*/,std::vector<std::string>());
         break;
       }
+    case MED_NODE://6432
+      {
+        ret=MEDFileFloatField1TSWithoutSDA::New(fieldName,meshName,-1,-1/*iteration*/,-1/*order*/,std::vector<std::string>());
+        break;
+      }
     default:
       {
         std::ostringstream oss; oss << "MEDFileAnyTypeField1TS::BuildContentFrom(fid) : file \'" << FileNameFromFID(fid) << "\' contains field with name \'" << fieldName << "\' but the type of the first field is not in [MED_FLOAT64, MED_INT32] !";
@@ -5951,8 +6015,11 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i
   med_field_type typcha;
   std::vector<std::string> infos;
   std::string dtunit,meshName;
-  int iii=-1;
-  int nbSteps=LocateField(fid,fieldName,iii,typcha,infos,dtunit,meshName);
+  int nbSteps(0);
+  {
+    int iii=-1;
+    nbSteps=LocateField(fid,fieldName,iii,typcha,infos,dtunit,meshName);
+  }
   MCAuto<MEDFileAnyTypeField1TSWithoutSDA> ret;
   switch(typcha)
   {
@@ -5966,9 +6033,14 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i
         ret=MEDFileIntField1TSWithoutSDA::New(fieldName,meshName,-1,-1/*iteration*/,-1/*order*/,std::vector<std::string>());
         break;
       }
+    case MED_NODE://6432
+      {
+        ret=MEDFileFloatField1TSWithoutSDA::New(fieldName,meshName,-1,-1/*iteration*/,-1/*order*/,std::vector<std::string>());
+        break;
+      }
     default:
       {
-        std::ostringstream oss; oss << "MEDFileAnyTypeField1TS::BuildContentFrom(fid,fieldName) : file \'" << FileNameFromFID(fid) << "\' contains field with name \'" << fieldName << "\' but the type of field is not in [MED_FLOAT64, MED_INT32] !";
+        std::ostringstream oss; oss << "MEDFileAnyTypeField1TS::BuildContentFrom(fid,fieldName) : file \'" << FileNameFromFID(fid) << "\' contains field with name \'" << fieldName << "\' but the type of field is not in [MED_FLOAT64, MED_INT32, MED_FLOAT32] !";
         throw INTERP_KERNEL::Exception(oss.str());
       }
   }
@@ -6107,9 +6179,14 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i
         ret=MEDFileIntField1TSWithoutSDA::New(fieldName,meshName,-1,iteration,order,std::vector<std::string>());
         break;
       }
+    case MED_NODE://6432
+      {
+        ret=MEDFileFloatField1TSWithoutSDA::New(fieldName,meshName,-1,iteration,order,std::vector<std::string>());
+        break;
+      }
     default:
       {
-        std::ostringstream oss; oss << "MEDFileAnyTypeField1TS::BuildContentFrom(fid,fieldName,iteration,order) : file \'" << FileNameFromFID(fid) << "\' contains field with name \'" << fieldName << "\' but the type of field is not in [MED_FLOAT64, MED_INT32] !";
+        std::ostringstream oss; oss << "MEDFileAnyTypeField1TS::BuildContentFrom(fid,fieldName,iteration,order) : file \'" << FileNameFromFID(fid) << "\' contains field with name \'" << fieldName << "\' but the type of field is not in [MED_FLOAT64, MED_INT32, MED_FLOAT32] !";
         throw INTERP_KERNEL::Exception(oss.str());
       }
   }
@@ -6705,111 +6782,16 @@ MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::deepCopy() const
 
 int MEDFileAnyTypeField1TS::copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr)
 {
-  return contentNotNullBase()->copyTinyInfoFrom(field,arr);
-}
-
-//= MEDFileField1TS
-
-/*!
- * Returns a new instance of MEDFileField1TS holding data of the first time step of 
- * the first field that has been read from a specified MED file.
- *  \param [in] fileName - the name of the MED file to read.
- *  \return MEDFileField1TS * - a new instance of MEDFileFieldMultiTS. The caller
- *          is to delete this field using decrRef() as it is no more needed.
- *  \throw If reading the file fails.
- */
-MEDFileField1TS *MEDFileField1TS::New(const std::string& fileName, bool loadAll)
-{
-  MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
-  return New(fid,loadAll);
-}
-
-MEDFileField1TS *MEDFileField1TS::New(med_idt fid, bool loadAll)
-{
-  MCAuto<MEDFileField1TS> ret(new MEDFileField1TS(fid,loadAll,0));
-  ret->contentNotNull();
-  return ret.retn();
-}
-
-/*!
- * Returns a new instance of MEDFileField1TS holding data of the first time step of 
- * a given field that has been read from a specified MED file.
- *  \param [in] fileName - the name of the MED file to read.
- *  \param [in] fieldName - the name of the field to read.
- *  \return MEDFileField1TS * - a new instance of MEDFileFieldMultiTS. The caller
- *          is to delete this field using decrRef() as it is no more needed.
- *  \throw If reading the file fails.
- *  \throw If there is no field named \a fieldName in the file.
- */
-MEDFileField1TS *MEDFileField1TS::New(const std::string& fileName, const std::string& fieldName, bool loadAll)
-{
-  MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
-  return New(fid,fieldName,loadAll);
-}
-
-MEDFileField1TS *MEDFileField1TS::New(med_idt fid, const std::string& fieldName, bool loadAll)
-{
-  MCAuto<MEDFileField1TS> ret(new MEDFileField1TS(fid,fieldName,loadAll,0));
-  ret->contentNotNull();
-  return ret.retn();
-}
-
-/*!
- * Returns a new instance of MEDFileField1TS holding data of a given time step of 
- * a given field that has been read from a specified MED file.
- *  \param [in] fileName - the name of the MED file to read.
- *  \param [in] fieldName - the name of the field to read.
- *  \param [in] iteration - the iteration number of a required time step.
- *  \param [in] order - the iteration order number of required time step.
- *  \return MEDFileField1TS * - a new instance of MEDFileFieldMultiTS. The caller
- *          is to delete this field using decrRef() as it is no more needed.
- *  \throw If reading the file fails.
- *  \throw If there is no field named \a fieldName in the file.
- *  \throw If the required time step is missing from the file.
- */
-MEDFileField1TS *MEDFileField1TS::New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll)
-{
-  MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
-  return New(fid,fieldName,iteration,order,loadAll);
-}
-
-MEDFileField1TS *MEDFileField1TS::New(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll)
-{
-  MCAuto<MEDFileField1TS> ret(new MEDFileField1TS(fid,fieldName,iteration,order,loadAll,0));
-  ret->contentNotNull();
-  return ret.retn();
+  MCAuto<MEDCouplingFieldTemplate> ft(MEDCouplingFieldTemplate::New(*field));
+  return copyTinyInfoFrom(field->timeDiscrSafe(),ft,arr);
 }
 
-/*!
- * Returns a new instance of MEDFileField1TS. If \a shallowCopyOfContent is true the content of \a other is shallow copied.
- * If \a shallowCopyOfContent is false, \a other is taken to be the content of \a this.
- *
- * Returns a new instance of MEDFileField1TS holding either a shallow copy
- * of a given MEDFileField1TSWithoutSDA ( \a other ) or \a other itself.
- * \warning this is a shallow copy constructor
- *  \param [in] other - a MEDFileField1TSWithoutSDA to copy.
- *  \param [in] shallowCopyOfContent - if \c true, a shallow copy of \a other is created.
- *  \return MEDFileField1TS * - a new instance of MEDFileField1TS. The caller
- *          is to delete this field using decrRef() as it is no more needed.
- */
-MEDFileField1TS *MEDFileField1TS::New(const MEDFileField1TSWithoutSDA& other, bool shallowCopyOfContent)
+int MEDFileAnyTypeField1TS::copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr)
 {
-  MCAuto<MEDFileField1TS> ret(new MEDFileField1TS(other,shallowCopyOfContent));
-  ret->contentNotNull();
-  return ret.retn();
+  return contentNotNullBase()->copyTinyInfoFrom(th,field,arr);
 }
 
-/*!
- * Returns a new empty instance of MEDFileField1TS.
- *  \return MEDFileField1TS * - a new instance of MEDFileField1TS. The caller
- *          is to delete this field using decrRef() as it is no more needed.
- */
-MEDFileField1TS *MEDFileField1TS::New()
-{
-  MCAuto<MEDFileField1TS> ret(new MEDFileField1TS);
-  ret->contentNotNull();
-  return ret.retn();
-}
+//= MEDFileField1TS
 
 /*!
  * This method performs a copy with datatype modification ( float64->int32 ) of \a this. The globals information are copied
@@ -6840,119 +6822,22 @@ MEDFileIntField1TS *MEDFileField1TS::convertToInt(bool isDeepCpyGlobs) const
   return ret.retn();
 }
 
-const MEDFileField1TSWithoutSDA *MEDFileField1TS::contentNotNull() const
-{
-  const MEDFileAnyTypeField1TSWithoutSDA *pt(_content);
-  if(!pt)
-    throw INTERP_KERNEL::Exception("MEDFileField1TS::contentNotNull : the content pointer is null !");
-  const MEDFileField1TSWithoutSDA *ret=dynamic_cast<const MEDFileField1TSWithoutSDA *>(pt);
-  if(!ret)
-    throw INTERP_KERNEL::Exception("MEDFileField1TS::contentNotNull : the content pointer is not null but it is not of type double ! Reason is maybe that the read field has not the type FLOAT64 !");
-  return ret;
-}
-
-MEDFileField1TSWithoutSDA *MEDFileField1TS::contentNotNull()
-{
-  MEDFileAnyTypeField1TSWithoutSDA *pt(_content);
-  if(!pt)
-    throw INTERP_KERNEL::Exception("MEDFileField1TS::contentNotNull : the non const content pointer is null !");
-  MEDFileField1TSWithoutSDA *ret=dynamic_cast<MEDFileField1TSWithoutSDA *>(pt);
-  if(!ret)
-    throw INTERP_KERNEL::Exception("MEDFileField1TS::contentNotNull : the non const content pointer is not null but it is not of type double ! Reason is maybe that the read field has not the type FLOAT64 !");
-  return ret;
-}
-
-void MEDFileField1TS::SetDataArrayDoubleInField(MEDCouplingFieldDouble *f, MCAuto<DataArray>& arr)
-{
-  if(!f)
-    throw INTERP_KERNEL::Exception("MEDFileField1TS::SetDataArrayDoubleInField : input field is NULL !");
-  if(arr.isNull())
-    throw INTERP_KERNEL::Exception("MEDFileField1TS::SetDataArrayDoubleInField : no array !");
-  DataArrayDouble *arrOutC(dynamic_cast<DataArrayDouble *>((DataArray*)arr));
-  if(!arrOutC)
-    throw INTERP_KERNEL::Exception("MEDFileField1TS::SetDataArrayDoubleInField : mismatch between dataArrays type and MEDFileField1TS ! Expected double !");
-  f->setArray(arrOutC);
-}
-
-DataArrayDouble *MEDFileField1TS::ReturnSafelyDataArrayDouble(MCAuto<DataArray>& arr)
-{
-  if(arr.isNull())
-    throw INTERP_KERNEL::Exception("MEDFileField1TS::ReturnSafelyDataArrayDouble : no array !");
-  DataArrayDouble *arrOutC(dynamic_cast<DataArrayDouble *>((DataArray*)arr));
-  if(!arrOutC)
-    throw INTERP_KERNEL::Exception("MEDFileField1TS::ReturnSafelyDataArrayDouble : mismatch between dataArrays type and MEDFileField1TS ! Expected double !");
-  arrOutC->incrRef();
-  return arrOutC;
-}
-
-/*!
- * Return an extraction of \a this using \a extractDef map to specify the extraction.
- * The keys of \a extractDef is level relative to max ext of \a mm mesh.
- *
- * \return A new object that the caller is responsible to deallocate.
- * \sa MEDFileUMesh::deduceNodeSubPartFromCellSubPart , MEDFileUMesh::extractPart
- */
-MEDFileField1TS *MEDFileField1TS::extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const
-{
-  if(!mm)
-    throw INTERP_KERNEL::Exception("MEDFileField1TS::extractPart : input mesh is NULL !");
-  MCAuto<MEDFileField1TS> ret(MEDFileField1TS::New());
-  std::vector<TypeOfField> tof(getTypesOfFieldAvailable());
-  for(std::vector<TypeOfField>::const_iterator it0=tof.begin();it0!=tof.end();it0++)
-    {
-      if((*it0)!=ON_NODES)
-        {
-          std::vector<int> levs;
-          getNonEmptyLevels(mm->getName(),levs);
-          for(std::vector<int>::const_iterator lev=levs.begin();lev!=levs.end();lev++)
-            {
-              std::map<int, MCAuto<DataArrayInt> >::const_iterator it2(extractDef.find(*lev));
-              if(it2!=extractDef.end())
-                {
-                  MCAuto<DataArrayInt> t((*it2).second);
-                  if(t.isNull())
-                    throw INTERP_KERNEL::Exception("MEDFileField1TS::extractPart : presence of a value with null pointer 1 !");
-                  MCAuto<MEDCouplingFieldDouble> f(getFieldOnMeshAtLevel(ON_CELLS,(*lev),mm));
-                  MCAuto<MEDCouplingFieldDouble> fOut(f->buildSubPart(t));
-                  ret->setFieldNoProfileSBT(fOut);
-                }
-            }
-        }
-      else
-        {
-          std::map<int, MCAuto<DataArrayInt> >::const_iterator it2(extractDef.find(1));
-          if(it2==extractDef.end())
-            throw INTERP_KERNEL::Exception("MEDFileField1TS::extractPart : presence of a NODE field and no extract array available for NODE !");
-          MCAuto<DataArrayInt> t((*it2).second);
-          if(t.isNull())
-            throw INTERP_KERNEL::Exception("MEDFileField1TS::extractPart : presence of a value with null pointer 1 !");
-          MCAuto<MEDCouplingFieldDouble> f(getFieldOnMeshAtLevel(ON_NODES,0,mm));
-          MCAuto<MEDCouplingFieldDouble> fOut(f->deepCopy());
-          DataArrayDouble *arr(f->getArray());
-          MCAuto<DataArrayDouble> newArr(arr->selectByTupleIdSafe(t->begin(),t->end()));
-          fOut->setArray(newArr);
-          ret->setFieldNoProfileSBT(fOut);
-        }
-    }
-  return ret.retn();
-}
-
 MEDFileField1TS::MEDFileField1TS(med_idt fid, bool loadAll, const MEDFileMeshes *ms)
-try:MEDFileAnyTypeField1TS(fid,loadAll,ms)
+try:MEDFileTemplateField1TS<double>(fid,loadAll,ms)
 {
 }
 catch(INTERP_KERNEL::Exception& e)
 { throw e; }
 
 MEDFileField1TS::MEDFileField1TS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms)
-try:MEDFileAnyTypeField1TS(fid,fieldName,loadAll,ms)
+try:MEDFileTemplateField1TS<double>(fid,fieldName,loadAll,ms)
 {
 }
 catch(INTERP_KERNEL::Exception& e)
 { throw e; }
 
 MEDFileField1TS::MEDFileField1TS(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileMeshes *ms)
-try:MEDFileAnyTypeField1TS(fid,fieldName,iteration,order,loadAll,ms)
+try:MEDFileTemplateField1TS<double>(fid,fieldName,iteration,order,loadAll,ms)
 {
 }
 catch(INTERP_KERNEL::Exception& e)
@@ -6965,3409 +6850,2047 @@ catch(INTERP_KERNEL::Exception& e)
  * \warning this is a shallow copy constructor
  */
 MEDFileField1TS::MEDFileField1TS(const MEDFileField1TSWithoutSDA& other, bool shallowCopyOfContent)
-try:MEDFileAnyTypeField1TS(other,shallowCopyOfContent)
+try:MEDFileTemplateField1TS<double>(other,shallowCopyOfContent)
 {
 }
 catch(INTERP_KERNEL::Exception& e)
 { throw e; }
 
-MEDFileField1TS::MEDFileField1TS()
+MEDFileField1TS *MEDFileField1TS::shallowCpy() const
 {
-  _content=new MEDFileField1TSWithoutSDA;
+  return new MEDFileField1TS(*this);
 }
 
-/*!
- * This is the simplest version to fetch a field for MED structure. One drawback : if \a this is a complex field (multi spatial discretization inside a same field) this method will throw exception and more advance
- * method should be called (getFieldOnMeshAtLevel for example).
- * But for normal usage of field in MED file world this method is the most efficient to fetch data.
- *
- * \param [in] mesh - the mesh the field is lying on
- * \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The
- *          caller is to delete this field using decrRef() as it is no more needed. 
- */
-MEDCouplingFieldDouble *MEDFileField1TS::field(const MEDFileMesh *mesh) const
+std::vector< std::vector<DataArrayDouble *> > MEDFileField1TS::getFieldSplitedByType2(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF,
+                                                                                      std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
 {
-  MCAuto<DataArray> arrOut;
-  MCAuto<MEDCouplingFieldDouble> ret(contentNotNull()->fieldOnMesh(this,mesh,arrOut,*contentNotNull()));
-  MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
-  return ret.retn();
+  return contentNotNull()->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
 }
 
-/*!
- * Returns a new MEDCouplingFieldDouble of a given type lying on
- * mesh entities of a given dimension of the first mesh in MED file. If \a this field 
- * has not been constructed via file reading, an exception is thrown.
- * For more info, see \ref AdvMEDLoaderAPIFieldRW
- *  \param [in] type - a spatial discretization of interest.
- *  \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities.
- *  \param [in] renumPol - specifies how to permute values of the result field according to
- *          the optional numbers of cells and nodes, if any. The valid values are
- *          - 0 - do not permute.
- *          - 1 - permute cells.
- *          - 2 - permute nodes.
- *          - 3 - permute cells and nodes.
- *
- *  \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The
- *          caller is to delete this field using decrRef() as it is no more needed. 
- *  \throw If \a this field has not been constructed via file reading.
- *  \throw If the MED file is not readable.
- *  \throw If there is no mesh in the MED file.
- *  \throw If there are no mesh entities of \a meshDimRelToMax dimension in the mesh.
- *  \throw If no field values of the given \a type or given \a meshDimRelToMax are available.
- *  \sa getFieldOnMeshAtLevel()
- */
-MEDCouplingFieldDouble *MEDFileField1TS::getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol) const
+//= MEDFileIntField1TS
+
+MCAuto<MEDCouplingFieldDouble> MEDFileIntField1TS::ConvertFieldIntToFieldDouble(const MEDCouplingFieldInt *f)
 {
-  if(getFileName().empty())
-    throw INTERP_KERNEL::Exception("MEDFileField1TS::getFieldAtLevel : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtLevel method instead !");
-  MCAuto<DataArray> arrOut;
-  MCAuto<MEDCouplingFieldDouble> ret(contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arrOut,*contentNotNull()));
-  MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
-  return ret.retn();
+  if(!f)
+    throw INTERP_KERNEL::Exception("MEDFileIntField1TS::ConvertFieldIntToFieldDouble : null input field !");
+  int t1,t2;
+  double t0(f->getTime(t1,t2));
+  std::string tu(f->getTimeUnit());
+  MCAuto<MEDCouplingFieldTemplate> ft(MEDCouplingFieldTemplate::New(*f));
+  MCAuto<MEDCouplingFieldDouble> ret(MEDCouplingFieldDouble::New(*ft));
+  ret->setTime(t0,t1,t2); ret->setTimeUnit(tu);
+  return ret;
 }
 
-/*!
- * Returns a new MEDCouplingFieldDouble of a given type lying on
- * the top level cells of the first mesh in MED file. If \a this field 
- * has not been constructed via file reading, an exception is thrown.
- * For more info, see \ref AdvMEDLoaderAPIFieldRW
- *  \param [in] type - a spatial discretization of interest.
- *  \param [in] renumPol - specifies how to permute values of the result field according to
- *          the optional numbers of cells and nodes, if any. The valid values are
- *          - 0 - do not permute.
- *          - 1 - permute cells.
- *          - 2 - permute nodes.
- *          - 3 - permute cells and nodes.
- *
- *  \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The
- *          caller is to delete this field using decrRef() as it is no more needed. 
- *  \throw If \a this field has not been constructed via file reading.
- *  \throw If the MED file is not readable.
- *  \throw If there is no mesh in the MED file.
- *  \throw If no field values of the given \a type.
- *  \throw If no field values lying on the top level support.
- *  \sa getFieldAtLevel()
- */
-MEDCouplingFieldDouble *MEDFileField1TS::getFieldAtTopLevel(TypeOfField type, int renumPol) const
-{
-  if(getFileName().empty())
-    throw INTERP_KERNEL::Exception("MEDFileField1TS::getFieldAtTopLevel : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtTopLevel method instead !");
-  MCAuto<DataArray> arrOut;
-  MCAuto<MEDCouplingFieldDouble> ret(contentNotNull()->getFieldAtTopLevel(type,std::string(),renumPol,this,arrOut,*contentNotNull()));
-  MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
-  return ret.retn();
-}
-
-/*!
- * Returns a new MEDCouplingFieldDouble of given type lying on a given mesh.
- * For more info, see \ref AdvMEDLoaderAPIFieldRW
- *  \param [in] type - a spatial discretization of the new field.
- *  \param [in] mesh - the supporting mesh.
- *  \param [in] renumPol - specifies how to permute values of the result field according to
- *          the optional numbers of cells and nodes, if any. The valid values are
- *          - 0 - do not permute.
- *          - 1 - permute cells.
- *          - 2 - permute nodes.
- *          - 3 - permute cells and nodes.
- *
- *  \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The
- *          caller is to delete this field using decrRef() as it is no more needed. 
- *  \throw If no field of \a this is lying on \a mesh.
- *  \throw If the mesh is empty.
- *  \throw If no field values of the given \a type are available.
- *  \sa getFieldAtLevel()
- *  \sa getFieldOnMeshAtLevel() 
- */
-MEDCouplingFieldDouble *MEDFileField1TS::getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol) const
-{
-  MCAuto<DataArray> arrOut;
-  MCAuto<MEDCouplingFieldDouble> ret(contentNotNull()->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arrOut,*contentNotNull()));
-  MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
-  return ret.retn();
-}
+//= MEDFileFloatField1TS
 
-/*!
- * Returns a new MEDCouplingFieldDouble of a given type lying on a given support.
- * For more info, see \ref AdvMEDLoaderAPIFieldRW
- *  \param [in] type - a spatial discretization of interest.
- *  \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities.
- *  \param [in] mesh - the supporting mesh.
- *  \param [in] renumPol - specifies how to permute values of the result field according to
- *          the optional numbers of cells and nodes, if any. The valid values are
- *          - 0 - do not permute.
- *          - 1 - permute cells.
- *          - 2 - permute nodes.
- *          - 3 - permute cells and nodes.
- *
- *  \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The
- *          caller is to delete this field using decrRef() as it is no more needed. 
- *  \throw If there are no mesh entities of \a meshDimRelToMax dimension in the mesh.
- *  \throw If no field of \a this is lying on \a mesh.
- *  \throw If no field values of the given \a type or given \a meshDimRelToMax are available.
- *  \sa getFieldAtLevel()
- *  \sa getFieldOnMeshAtLevel() 
- */
-MEDCouplingFieldDouble *MEDFileField1TS::getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol) const
-{
-  MCAuto<DataArray> arrOut;
-  MCAuto<MEDCouplingFieldDouble> ret(contentNotNull()->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arrOut,*contentNotNull()));
-  MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
-  return ret.retn();
-}
+//= MEDFileFloatField1TS
 
-/*!
- * Returns a new MEDCouplingFieldDouble of a given type lying on a given support.
- * This method is called "Old" because in MED3 norm a field has only one meshName
- * attached, so this method is for readers of MED2 files. If \a this field 
- * has not been constructed via file reading, an exception is thrown.
- * For more info, see \ref AdvMEDLoaderAPIFieldRW
- *  \param [in] type - a spatial discretization of interest.
- *  \param [in] mName - a name of the supporting mesh.
- *  \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities.
- *  \param [in] renumPol - specifies how to permute values of the result field according to
- *          the optional numbers of cells and nodes, if any. The valid values are
- *          - 0 - do not permute.
- *          - 1 - permute cells.
- *          - 2 - permute nodes.
- *          - 3 - permute cells and nodes.
- *
- *  \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The
- *          caller is to delete this field using decrRef() as it is no more needed. 
- *  \throw If the MED file is not readable.
- *  \throw If there is no mesh named \a mName in the MED file.
- *  \throw If there are no mesh entities of \a meshDimRelToMax dimension in the mesh.
- *  \throw If \a this field has not been constructed via file reading.
- *  \throw If no field of \a this is lying on the mesh named \a mName.
- *  \throw If no field values of the given \a type or given \a meshDimRelToMax are available.
- *  \sa getFieldAtLevel()
- */
-MEDCouplingFieldDouble *MEDFileField1TS::getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol) const
-{
-  if(getFileName().empty())
-    throw INTERP_KERNEL::Exception("MEDFileField1TS::getFieldAtLevelOld : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtLevel method instead !");
-  MCAuto<DataArray> arrOut;
-  MCAuto<MEDCouplingFieldDouble> ret(contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arrOut,*contentNotNull()));
-  MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
-  return ret.retn();
-}
+//= MEDFileAnyTypeFieldMultiTSWithoutSDA
 
-/*!
- * Returns values and a profile of the field of a given type lying on a given support.
- * For more info, see \ref AdvMEDLoaderAPIFieldRW
- *  \param [in] type - a spatial discretization of the field.
- *  \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities.
- *  \param [in] mesh - the supporting mesh.
- *  \param [out] pfl - a new instance of DataArrayInt holding ids of mesh entities the
- *          field of interest lies on. If the field lies on all entities of the given
- *          dimension, all ids in \a pfl are zero. The caller is to delete this array
- *          using decrRef() as it is no more needed.  
- *  \return DataArrayDouble * - a new instance of DataArrayDouble holding values of the
- *          field. The caller is to delete this array using decrRef() as it is no more needed.
- *  \throw If there are no mesh entities of \a meshDimRelToMax dimension in \a mesh.
- *  \throw If no field of \a this is lying on \a mesh.
- *  \throw If no field values of the given \a type or given \a meshDimRelToMax are available.
- */
-DataArrayDouble *MEDFileField1TS::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const
+MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA()
 {
-  MCAuto<DataArray> ret=contentNotNull()->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNull());
-  return MEDFileField1TS::ReturnSafelyDataArrayDouble(ret);
 }
 
-/*!
- * Adds a MEDCouplingFieldDouble to \a this. The underlying mesh of the given field is
- * checked if its elements are sorted suitable for writing to MED file ("STB" stands for
- * "Sort By Type"), if not, an exception is thrown. 
- * For more info, see \ref AdvMEDLoaderAPIFieldRW
- *  \param [in] field - the field to add to \a this.
- *  \throw If the name of \a field is empty.
- *  \throw If the data array of \a field is not set.
- *  \throw If the data array is already allocated but has different number of components
- *         than \a field.
- *  \throw If the underlying mesh of \a field has no name.
- *  \throw If elements in the mesh are not in the order suitable for writing to the MED file.
- */
-void MEDFileField1TS::setFieldNoProfileSBT(const MEDCouplingFieldDouble *field)
+MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName):MEDFileFieldNameScope(fieldName,meshName)
 {
-  setFileName("");
-  contentNotNull()->setFieldNoProfileSBT(field,field->getArray(),*this,*contentNotNull());
 }
 
 /*!
- * Adds a MEDCouplingFieldDouble to \a this. As described in \ref MEDLoaderMainC a field in MED file sense
- * can be an aggregation of several MEDCouplingFieldDouble instances.
- * The mesh support of input parameter \a field is ignored here, it can be NULL.
- * The support of field \a field is expected to be those computed with the input parameter \a mesh, \a meshDimRelToMax,
- * and \a profile.
- *
- * This method will check that the field based on the computed support is coherent. If not an exception will be thrown.
- * A new profile is added only if no equal profile is missing.
- * For more info, see \ref AdvMEDLoaderAPIFieldRW
- *  \param [in] field - the field to add to \a this. The mesh support of field is ignored.
- *  \param [in] mesh - the supporting mesh of \a field.
- *  \param [in] meshDimRelToMax - a relative dimension of mesh entities \a field lies on (useless if field spatial discretization is ON_NODES).
- *  \param [in] profile - ids of mesh entities on which corresponding field values lie.
- *  \throw If either \a field or \a mesh or \a profile has an empty name.
- *  \throw If there are no mesh entities of \a meshDimRelToMax dimension in \a mesh.
- *  \throw If the data array of \a field is not set.
- *  \throw If the data array of \a this is already allocated but has different number of
- *         components than \a field.
- *  \throw If elements in \a mesh are not in the order suitable for writing to the MED file.
- *  \sa setFieldNoProfileSBT()
+ * \param [in] fieldId field id in C mode
  */
-void MEDFileField1TS::setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile)
+MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities)
 {
-  setFileName("");
-  contentNotNull()->setFieldProfile(field,field->getArray(),mesh,meshDimRelToMax,profile,*this,*contentNotNull());
+  med_field_type typcha;
+  std::string dtunitOut,meshName;
+  int nbOfStep(MEDFileAnyTypeField1TS::LocateField2(fid,fieldId,false,_name,typcha,_infos,dtunitOut,meshName));
+  setMeshName(meshName);
+  setDtUnit(dtunitOut.c_str());
+  loadStructureOrStructureAndBigArraysRecursively(fid,nbOfStep,typcha,loadAll,ms,entities);
 }
 
-MEDFileField1TS *MEDFileField1TS::shallowCpy() const
+MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities)
+try:MEDFileFieldNameScope(fieldName,meshName),_infos(infos)
 {
-  return new MEDFileField1TS(*this);
+  setDtUnit(dtunit.c_str());
+  loadStructureOrStructureAndBigArraysRecursively(fid,nbOfStep,fieldTyp,loadAll,ms,entities);
 }
-
-DataArrayDouble *MEDFileField1TS::getUndergroundDataArray() const
+catch(INTERP_KERNEL::Exception& e)
 {
-  return contentNotNull()->getUndergroundDataArrayTemplate();
+    throw e;
 }
 
-DataArrayDouble *MEDFileField1TS::getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+std::size_t MEDFileAnyTypeFieldMultiTSWithoutSDA::getHeapMemorySizeWithoutChildren() const
 {
-  return contentNotNull()->getUndergroundDataArrayDoubleExt(entries);
+  std::size_t ret(_mesh_name.capacity()+_name.capacity()+_infos.capacity()*sizeof(std::string)+_time_steps.capacity()*sizeof(MCAuto<MEDFileField1TSWithoutSDA>));
+  for(std::vector<std::string>::const_iterator it=_infos.begin();it!=_infos.end();it++)
+    ret+=(*it).capacity();
+  return ret;
 }
 
-std::vector< std::vector<DataArrayDouble *> > MEDFileField1TS::getFieldSplitedByType2(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF,
-                                                                                      std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
+std::vector<const BigMemoryObject *> MEDFileAnyTypeFieldMultiTSWithoutSDA::getDirectChildrenWithNull() const
 {
-  return contentNotNull()->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
+  std::vector<const BigMemoryObject *> ret;
+  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+    ret.push_back((const MEDFileAnyTypeField1TSWithoutSDA *)*it);
+  return ret;
 }
 
-//= MEDFileIntField1TS
-
-MEDFileIntField1TS *MEDFileIntField1TS::New()
+/*!
+ * If one of the id in [ \a startIds , \a endIds ) points to a null element, there is not throw. Simply, this empty element is added as if it were not
+ * NULL.
+ */
+MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds(const int *startIds, const int *endIds) const
 {
-  MCAuto<MEDFileIntField1TS> ret(new MEDFileIntField1TS);
-  ret->contentNotNull();
+  MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret=createNew();
+  ret->setInfo(_infos);
+  int sz=(int)_time_steps.size();
+  for(const int *id=startIds;id!=endIds;id++)
+    {
+      if(*id>=0 && *id<sz)
+        {
+          const MEDFileAnyTypeField1TSWithoutSDA *tse=_time_steps[*id];
+          MCAuto<MEDFileAnyTypeField1TSWithoutSDA> tse2;
+          if(tse)
+            {
+              tse->incrRef();
+              tse2=(const_cast<MEDFileAnyTypeField1TSWithoutSDA *>(tse));
+            }
+          ret->pushBackTimeStep(tse2);
+        }
+      else
+        {
+          std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds : At pos #" << std::distance(startIds,id) << " value is " << *id;
+          oss << " ! Should be in [0," << sz << ") !";
+          throw INTERP_KERNEL::Exception(oss.str());
+        }
+    }
+  if(ret->getNumberOfTS()>0)
+    ret->synchronizeNameScope();
+  ret->copyNameScope(*this);
   return ret.retn();
 }
 
-MEDFileIntField1TS *MEDFileIntField1TS::New(const std::string& fileName, bool loadAll)
-{
-  MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
-  return MEDFileIntField1TS::New(fid,loadAll);
-}
-
-MEDFileIntField1TS *MEDFileIntField1TS::New(med_idt fid, bool loadAll)
+/*!
+ * If one of the id in the input range points to a null element, there is not throw. Simply, this empty element is added as if it were not
+ * NULL.
+ */
+MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds2(int bg, int end, int step) const
 {
-  MCAuto<MEDFileIntField1TS> ret(new MEDFileIntField1TS(fid,loadAll,0));
-  ret->contentNotNull();
+  static const char msg[]="MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds2";
+  int nbOfEntriesToKeep=DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg);
+  MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret=createNew();
+  ret->setInfo(_infos);
+  int sz=(int)_time_steps.size();
+  int j=bg;
+  for(int i=0;i<nbOfEntriesToKeep;i++,j+=step)
+    {
+      if(j>=0 && j<sz)
+        {
+          const MEDFileAnyTypeField1TSWithoutSDA *tse=_time_steps[j];
+          MCAuto<MEDFileAnyTypeField1TSWithoutSDA> tse2;
+          if(tse)
+            {
+              tse->incrRef();
+              tse2=(const_cast<MEDFileAnyTypeField1TSWithoutSDA *>(tse));
+            }
+          ret->pushBackTimeStep(tse2);
+        }
+      else
+        {
+          std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds : At pos #" << i << " value is " << j;
+          oss << " ! Should be in [0," << sz << ") !";
+          throw INTERP_KERNEL::Exception(oss.str());
+        }
+    }
+  if(ret->getNumberOfTS()>0)
+    ret->synchronizeNameScope();
+  ret->copyNameScope(*this);
   return ret.retn();
 }
 
-MEDFileIntField1TS *MEDFileIntField1TS::New(const std::string& fileName, const std::string& fieldName, bool loadAll)
+MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::partOfThisLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const
 {
-  MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
-  return MEDFileIntField1TS::New(fid,fieldName,loadAll);
+  int id=0;
+  MCAuto<DataArrayInt> ids=DataArrayInt::New(); ids->alloc(0,1);
+  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,id++)
+    {
+      const MEDFileAnyTypeField1TSWithoutSDA *cur(*it);
+      if(!cur)
+        continue;
+      std::pair<int,int> p(cur->getIteration(),cur->getOrder());
+      if(std::find(timeSteps.begin(),timeSteps.end(),p)!=timeSteps.end())
+        ids->pushBackSilent(id);
+    }
+  return buildFromTimeStepIds(ids->begin(),ids->end());
 }
 
-MEDFileIntField1TS *MEDFileIntField1TS::New(med_idt fid, const std::string& fieldName, bool loadAll)
+MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::partOfThisNotLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const
 {
-  MCAuto<MEDFileIntField1TS> ret(new MEDFileIntField1TS(fid,fieldName,loadAll,0));
-  ret->contentNotNull();
-  return ret.retn();
+  int id=0;
+  MCAuto<DataArrayInt> ids=DataArrayInt::New(); ids->alloc(0,1);
+  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,id++)
+    {
+      const MEDFileAnyTypeField1TSWithoutSDA *cur(*it);
+      if(!cur)
+        continue;
+      std::pair<int,int> p(cur->getIteration(),cur->getOrder());
+      if(std::find(timeSteps.begin(),timeSteps.end(),p)==timeSteps.end())
+        ids->pushBackSilent(id);
+    }
+  return buildFromTimeStepIds(ids->begin(),ids->end());
 }
 
-MEDFileIntField1TS *MEDFileIntField1TS::New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll)
+bool MEDFileAnyTypeFieldMultiTSWithoutSDA::presenceOfStructureElements() const
 {
-  MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
-  return MEDFileIntField1TS::New(fid,fieldName,iteration,order,loadAll);
+  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+    if((*it).isNotNull())
+      if((*it)->presenceOfStructureElements())
+        return true;
+  return false;
 }
 
-MEDFileIntField1TS *MEDFileIntField1TS::New(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll)
+bool MEDFileAnyTypeFieldMultiTSWithoutSDA::onlyStructureElements() const
 {
-  MCAuto<MEDFileIntField1TS> ret(new MEDFileIntField1TS(fid,fieldName,iteration,order,loadAll,0));
-  ret->contentNotNull();
-  return ret.retn();
+  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+    if((*it).isNotNull())
+      if(!(*it)->onlyStructureElements())
+        return false;
+  return true;
 }
 
-MEDFileIntField1TS *MEDFileIntField1TS::New(const MEDFileIntField1TSWithoutSDA& other, bool shallowCopyOfContent)
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::killStructureElements()
 {
-  MCAuto<MEDFileIntField1TS> ret=new MEDFileIntField1TS(other,shallowCopyOfContent);
-  ret->contentNotNull();
-  return ret.retn();
+  std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > ret;
+  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+    if((*it).isNotNull())
+      {
+        if((*it)->presenceOfStructureElements())
+          {
+            if(!(*it)->onlyStructureElements())
+              {
+                (*it)->killStructureElements();
+                ret.push_back(*it);
+              }
+          }
+        else
+          {
+            ret.push_back(*it);
+          }
+      }
+  _time_steps=ret;
 }
 
-MEDFileIntField1TS::MEDFileIntField1TS()
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::keepOnlyStructureElements()
 {
-  _content=new MEDFileIntField1TSWithoutSDA;
+  std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > ret;
+  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+    if((*it).isNotNull())
+      {
+        if((*it)->presenceOfStructureElements())
+          {
+            if(!(*it)->onlyStructureElements())
+              (*it)->keepOnlyStructureElements();
+            ret.push_back(*it);
+          }
+      }
+  _time_steps=ret;
 }
 
-MEDFileIntField1TS::MEDFileIntField1TS(med_idt fid, bool loadAll, const MEDFileMeshes *ms)
-try:MEDFileAnyTypeField1TS(fid,loadAll,ms)
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::keepOnlyOnSE(const std::string& seName)
 {
+  std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > ret;
+  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+    if((*it).isNotNull())
+      (*it)->keepOnlyOnSE(seName);
 }
-catch(INTERP_KERNEL::Exception& e)
-{ throw e; }
 
-MEDFileIntField1TS::MEDFileIntField1TS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms)
-try:MEDFileAnyTypeField1TS(fid,fieldName,loadAll,ms)
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::getMeshSENames(std::vector< std::pair<std::string,std::string> >& ps) const
 {
+  std::vector< std::pair<std::string,std::string> > ps2;
+  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+    if((*it).isNotNull())
+      {
+        (*it)->getMeshSENames(ps2);
+        break;
+      }
+  if(ps2.empty())
+    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::getMeshSENames : this appears to not contain SE only !");
+  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+    if((*it).isNotNull())
+      {
+        std::vector< std::pair<std::string,std::string> > ps3;
+        (*it)->getMeshSENames(ps3);
+        if(ps2!=ps3)
+          throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::getMeshSENames : For the moment only homogeneous SE def through time managed !");
+      }
+  for(std::vector< std::pair<std::string,std::string> >::const_iterator it=ps2.begin();it!=ps2.end();it++)
+    {
+      std::vector< std::pair<std::string,std::string> >::iterator it2(std::find(ps.begin(),ps.end(),*it));
+      if(it2==ps.end())
+        ps.push_back(*it);
+    }
 }
-catch(INTERP_KERNEL::Exception& e)
-{ throw e; }
 
-MEDFileIntField1TS::MEDFileIntField1TS(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileMeshes *ms)
-try:MEDFileAnyTypeField1TS(fid,fieldName,iteration,order,loadAll,ms)
+bool MEDFileAnyTypeFieldMultiTSWithoutSDA::presenceOfMultiDiscPerGeoType() const
 {
+  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+    {
+      const MEDFileAnyTypeField1TSWithoutSDA *cur(*it);
+      if(!cur)
+        continue;
+      if(cur->presenceOfMultiDiscPerGeoType())
+        return true;
+    }
+  return false;
 }
-catch(INTERP_KERNEL::Exception& e)
-{ throw e; }
 
-/*!
- * This constructor is a shallow copy constructor. If \a shallowCopyOfContent is true the content of \a other is shallow copied.
- * If \a shallowCopyOfContent is false, \a other is taken to be the content of \a this.
- *
- * \warning this is a shallow copy constructor
- */
-MEDFileIntField1TS::MEDFileIntField1TS(const MEDFileIntField1TSWithoutSDA& other, bool shallowCopyOfContent):MEDFileAnyTypeField1TS(other,shallowCopyOfContent)
+const std::vector<std::string>& MEDFileAnyTypeFieldMultiTSWithoutSDA::getInfo() const
 {
+  return _infos;
 }
 
-MEDFileIntField1TS *MEDFileIntField1TS::shallowCpy() const
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::setInfo(const std::vector<std::string>& info)
 {
-  return new MEDFileIntField1TS(*this);
+  _infos=info;
 }
 
-/*!
- * This method performs a copy with datatype modification ( int32->float64 ) of \a this. The globals information are copied
- * following the given input policy.
- *
- * \param [in] isDeepCpyGlobs - a boolean that indicates the behaviour concerning globals (profiles and localizations)
- *                            By default (true) the globals are deeply copied.
- * \return MEDFileField1TS * - a new object that is the result of the conversion of \a this to float64 field.
- */
-MEDFileField1TS *MEDFileIntField1TS::convertToDouble(bool isDeepCpyGlobs) const
+int MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepPos(int iteration, int order) const
 {
-  MCAuto<MEDFileField1TS> ret;
-  const MEDFileAnyTypeField1TSWithoutSDA *content(_content);
-  if(content)
+  int ret=0;
+  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA>  >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++)
     {
-      const MEDFileIntField1TSWithoutSDA *contc=dynamic_cast<const MEDFileIntField1TSWithoutSDA *>(content);
-      if(!contc)
-        throw INTERP_KERNEL::Exception("MEDFileIntField1TS::convertToInt : the content inside this is not INT32 ! This is incoherent !");
-      MCAuto<MEDFileField1TSWithoutSDA> newc(contc->convertToDouble());
-      ret=static_cast<MEDFileField1TS *>(MEDFileAnyTypeField1TS::BuildNewInstanceFromContent((MEDFileField1TSWithoutSDA *)newc));
+      const MEDFileAnyTypeField1TSWithoutSDA *pt(*it);
+      if(pt->isDealingTS(iteration,order))
+        return ret;
     }
-  else
-    ret=MEDFileField1TS::New();
-  if(isDeepCpyGlobs)
-    ret->deepCpyGlobs(*this);
-  else
-    ret->shallowCpyGlobs(*this);
-  return ret.retn();
+  std::ostringstream oss; oss << "MEDFileFieldMultiTS::getTimeStepPos : Muli timestep field on time (" << iteration << "," << order << ") does not exist ! Available (iteration,order) are :\n";
+  std::vector< std::pair<int,int> > vp=getIterations();
+  for(std::vector< std::pair<int,int> >::const_iterator it2=vp.begin();it2!=vp.end();it2++)
+    oss << "(" << (*it2).first << "," << (*it2).second << ") ";
+  throw INTERP_KERNEL::Exception(oss.str());
 }
 
-/*!
- * Adds a MEDCouplingFieldInt to \a this. The underlying mesh of the given field is
- * checked if its elements are sorted suitable for writing to MED file ("STB" stands for
- * "Sort By Type"), if not, an exception is thrown. 
- * For more info, see \ref AdvMEDLoaderAPIFieldRW
- *  \param [in] field - the field to add to \a this.
- *  \throw If the name of \a field is empty.
- *  \throw If the data array of \a field is not set.
- *  \throw If the data array is already allocated but has different number of components
- *         than \a field.
- *  \throw If the underlying mesh of \a field has no name.
- *  \throw If elements in the mesh are not in the order suitable for writing to the MED file.
- */
-void MEDFileIntField1TS::setFieldNoProfileSBT(const MEDCouplingFieldInt *field)
+const MEDFileAnyTypeField1TSWithoutSDA& MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepEntry(int iteration, int order) const
 {
-  MCAuto<MEDCouplingFieldDouble> field2(ConvertFieldIntToFieldDouble(field));
-  setFileName("");
-  contentNotNull()->setFieldNoProfileSBT(field2,field->getArray(),*this,*contentNotNull());
+  return *_time_steps[getTimeStepPos(iteration,order)];
 }
 
-/*!
- * Adds a MEDCouplingFieldInt to \a this. As described in \ref MEDLoaderMainC a field in MED file sense
- * can be an aggregation of several MEDCouplingFieldDouble instances.
- * The mesh support of input parameter \a field is ignored here, it can be NULL.
- * The support of field \a field is expected to be those computed with the input parameter \a mesh, \a meshDimRelToMax,
- * and \a profile.
- *
- * This method will check that the field based on the computed support is coherent. If not an exception will be thrown.
- * A new profile is added only if no equal profile is missing.
- * For more info, see \ref AdvMEDLoaderAPIFieldRW
- *  \param [in] field - the field to add to \a this.
- *  \param [in] mesh - the supporting mesh of \a field.
- *  \param [in] meshDimRelToMax - a relative dimension of mesh entities \a field lies on (useless if field spatial discretization is ON_NODES).
- *  \param [in] profile - ids of mesh entities on which corresponding field values lie.
- *  \throw If either \a field or \a mesh or \a profile has an empty name.
- *  \throw If there are no mesh entities of \a meshDimRelToMax dimension in \a mesh.
- *  \throw If the data array of \a field is not set.
- *  \throw If the data array of \a this is already allocated but has different number of
- *         components than \a field.
- *  \throw If elements in \a mesh are not in the order suitable for writing to the MED file.
- *  \sa setFieldNoProfileSBT()
- */
-void MEDFileIntField1TS::setFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile)
+MEDFileAnyTypeField1TSWithoutSDA& MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepEntry(int iteration, int order)
 {
-  MCAuto<MEDCouplingFieldDouble> field2(ConvertFieldIntToFieldDouble(field));
-  setFileName("");
-  contentNotNull()->setFieldProfile(field2,field->getArray(),mesh,meshDimRelToMax,profile,*this,*contentNotNull());
+  return *_time_steps[getTimeStepPos(iteration,order)];
 }
 
-const MEDFileIntField1TSWithoutSDA *MEDFileIntField1TS::contentNotNull() const
+bool MEDFileAnyTypeFieldMultiTSWithoutSDA::changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab)
 {
-  const MEDFileAnyTypeField1TSWithoutSDA *pt(_content);
-  if(!pt)
-    throw INTERP_KERNEL::Exception("MEDFileIntField1TS::contentNotNull : the content pointer is null !");
-  const MEDFileIntField1TSWithoutSDA *ret=dynamic_cast<const MEDFileIntField1TSWithoutSDA *>(pt);
-  if(!ret)
-    throw INTERP_KERNEL::Exception("MEDFileIntField1TS::contentNotNull : the content pointer is not null but it is not of type int32 ! Reason is maybe that the read field has not the type INT32 !");
+  bool ret(false);
+  for(std::vector< std::pair<std::string,std::string> >::const_iterator it=modifTab.begin();it!=modifTab.end();it++)
+    {
+      if((*it).first==getMeshName())
+        {
+          setMeshName((*it).second);
+          ret=true;
+        }
+    }
+  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+    {
+      MEDFileAnyTypeField1TSWithoutSDA *cur(*it);
+      if(cur)
+        ret=cur->changeMeshNames(modifTab) || ret;
+    }
   return ret;
 }
 
-MEDCouplingFieldInt *MEDFileIntField1TS::getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol) const
-{
-  if(getFileName().empty())
-    throw INTERP_KERNEL::Exception("MEDFileIntField1TS::getFieldAtLevel : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtLevel method instead !");
-  MCAuto<DataArray> arrOut;
-  MCAuto<MEDCouplingFieldDouble> ret(contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arrOut,*contentNotNull()));
-  MCAuto<MEDCouplingFieldInt> ret2(SetDataArrayDoubleInIntField(ret,arrOut));
-  return ret2.retn();
-}
-
-DataArrayInt *MEDFileIntField1TS::ReturnSafelyDataArrayInt(MCAuto<DataArray>& arr)
+/*!
+ * See doc at MEDFileField1TSWithoutSDA::getUndergroundDataArray
+ */
+DataArray *MEDFileAnyTypeFieldMultiTSWithoutSDA::getUndergroundDataArray(int iteration, int order) const
 {
-  if(arr.isNull())
-    throw INTERP_KERNEL::Exception("MEDFileIntField1TS::ReturnSafelyDataArrayInt : input DataArray is NULL !");
-  DataArrayInt *arrC(dynamic_cast<DataArrayInt *>((DataArray *)arr));
-  if(!arrC)
-    throw INTERP_KERNEL::Exception("MEDFileIntField1TS::ReturnSafelyDataArrayInt : input DataArray is not of type INT32 !");
-  arrC->incrRef();
-  return arrC;
+  return getTimeStepEntry(iteration,order).getUndergroundDataArray();
 }
 
-MCAuto<MEDCouplingFieldInt> MEDFileIntField1TS::SetDataArrayDoubleInIntField(MEDCouplingFieldDouble *f, MCAuto<DataArray>& arr)
+/*!
+ * See doc at MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt
+ */
+DataArray *MEDFileAnyTypeFieldMultiTSWithoutSDA::getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
 {
-  int t1,t2;
-  double t0(f->getTime(t1,t2));
-  MCAuto<DataArrayInt> arr2(DynamicCastSafe<DataArray,DataArrayInt>(arr));
-  MCAuto<MEDCouplingFieldTemplate> ft(MEDCouplingFieldTemplate::New(*f));
-  MCAuto<MEDCouplingFieldInt> ret(MEDCouplingFieldInt::New(*ft));
-  ret->setTime(t0,t1,t2); ret->setArray(arr2);
-  return ret.retn();
+  return getTimeStepEntry(iteration,order).getUndergroundDataArrayExt(entries);
 }
 
-MCAuto<MEDCouplingFieldDouble> MEDFileIntField1TS::ConvertFieldIntToFieldDouble(const MEDCouplingFieldInt *f)
+bool MEDFileAnyTypeFieldMultiTSWithoutSDA::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N,
+                                                                       MEDFileFieldGlobsReal& glob)
 {
-  if(!f)
-    throw INTERP_KERNEL::Exception("MEDFileIntField1TS::ConvertFieldIntToFieldDouble : null input field !");
-  int t1,t2;
-  double t0(f->getTime(t1,t2));
-  MCAuto<MEDCouplingFieldTemplate> ft(MEDCouplingFieldTemplate::New(*f));
-  MCAuto<MEDCouplingFieldDouble> ret(MEDCouplingFieldDouble::New(*ft));
-  ret->setTime(t0,t1,t2);
+  bool ret=false;
+  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+    {
+      MEDFileAnyTypeField1TSWithoutSDA *f1ts(*it);
+      if(f1ts)
+        ret=f1ts->renumberEntitiesLyingOnMesh(meshName,oldCode,newCode,renumO2N,glob) || ret;
+    }
   return ret;
 }
 
-MEDFileIntField1TS *MEDFileIntField1TS::extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::accept(MEDFileFieldVisitor& visitor) const
 {
-  throw INTERP_KERNEL::Exception("MEDFileIntField1TS::extractPart : not implemented yet !");
+  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+    if((*it).isNotNull())
+      {
+        visitor.newTimeStepEntry(*it);
+        (*it)->accept(visitor);
+        visitor.endTimeStepEntry(*it);
+      }
 }
 
-/*!
- * This is the simplest version to fetch a field for MED structure. One drawback : if \a this is a complex field (multi spatial discretization inside a same field) this method will throw exception and more advance
- * method should be called (getFieldOnMeshAtLevel for example).
- * But for normal usage of field in MED file world this method is the most efficient to fetch data.
- *
- * \param [in] mesh - the mesh the field is lying on
- * \return MEDCouplingFieldInt * - a new instance of MEDCouplingFieldInt. The
- *          caller is to delete this field using decrRef() as it is no more needed. 
- */
-MEDCouplingFieldInt *MEDFileIntField1TS::field(const MEDFileMesh *mesh) const
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::simpleRepr(int bkOffset, std::ostream& oss, int fmtsId) const
 {
-  MCAuto<DataArray> arrOut;
-  MCAuto<MEDCouplingFieldDouble> ret(contentNotNull()->fieldOnMesh(this,mesh,arrOut,*contentNotNull()));
-  MCAuto<MEDCouplingFieldInt> ret2(SetDataArrayDoubleInIntField(ret,arrOut));
-  return ret2.retn();
+  std::string startLine(bkOffset,' ');
+  oss << startLine << "Field multi time steps [Type=" << getTypeStr() << "]";
+  if(fmtsId>=0)
+    oss << " (" << fmtsId << ")";
+  oss << " has the following name: \"" << _name << "\"." << std::endl;
+  oss << startLine << "Field multi time steps has " << _infos.size() << " components with the following infos :" << std::endl;
+  for(std::vector<std::string>::const_iterator it=_infos.begin();it!=_infos.end();it++)
+    {
+      oss << startLine << "  -  \"" << *it << "\"" << std::endl;
+    }
+  int i=0;
+  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++)
+    {
+      std::string chapter(17,'0'+i);
+      oss << startLine << chapter << std::endl;
+      const MEDFileAnyTypeField1TSWithoutSDA *cur=(*it);
+      if(cur)
+        cur->simpleRepr(bkOffset+2,oss,i);
+      else
+        oss << startLine << "  Field on one time step #" << i << " is not defined !" << std::endl;
+      oss << startLine << chapter << std::endl;
+    }
 }
 
-/*!
- * Returns a new MEDCouplingFieldInt of a given type lying on
- * the top level cells of the first mesh in MED file. If \a this field 
- * has not been constructed via file reading, an exception is thrown.
- * For more info, see \ref AdvMEDLoaderAPIFieldRW
- *  \param [in] type - a spatial discretization of interest.
- *  \param [in] renumPol - specifies how to permute values of the result field according to
- *          the optional numbers of cells and nodes, if any. The valid values are
- *          - 0 - do not permute.
- *          - 1 - permute cells.
- *          - 2 - permute nodes.
- *          - 3 - permute cells and nodes.
- *
- *  \return MEDCouplingFieldInt * - a new instance of MEDCouplingFieldDouble. The
- *          caller is to delete this field using decrRef() as it is no more needed. 
- *  \throw If \a this field has not been constructed via file reading.
- *  \throw If the MED file is not readable.
- *  \throw If there is no mesh in the MED file.
- *  \throw If no field values of the given \a type.
- *  \throw If no field values lying on the top level support.
- *  \sa getFieldAtLevel()
- */
-MEDCouplingFieldInt *MEDFileIntField1TS::getFieldAtTopLevel(TypeOfField type, int renumPol) const
+std::vector< std::pair<int,int> > MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeSteps(std::vector<double>& ret1) const
 {
-  if(getFileName().empty())
-    throw INTERP_KERNEL::Exception("MEDFileField1TS::getFieldAtTopLevel : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtTopLevel method instead !");
-  MCAuto<DataArray> arrOut;
-  MCAuto<MEDCouplingFieldDouble> ret(contentNotNull()->getFieldAtTopLevel(type,std::string(),renumPol,this,arrOut,*contentNotNull()));
-  MCAuto<MEDCouplingFieldInt> ret2(SetDataArrayDoubleInIntField(ret,arrOut));
-  return ret2.retn();
+  std::size_t sz=_time_steps.size();
+  std::vector< std::pair<int,int> > ret(sz);
+  ret1.resize(sz);
+  for(std::size_t i=0;i<sz;i++)
+    {
+      const MEDFileAnyTypeField1TSWithoutSDA *f1ts=_time_steps[i];
+      if(f1ts)
+        {
+          ret1[i]=f1ts->getTime(ret[i].first,ret[i].second);
+        }
+      else
+        {
+          std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::getTimeSteps : At rank #" << i << " time step is not defined. Invoke eraseEmptyTS method !";
+          throw INTERP_KERNEL::Exception(oss.str());
+        }
+    }
+  return ret;
 }
 
-/*!
- * Returns a new MEDCouplingFieldInt of given type lying on a given mesh.
- * For more info, see \ref AdvMEDLoaderAPIFieldRW
- *  \param [in] type - a spatial discretization of the new field.
- *  \param [in] mesh - the supporting mesh.
- *  \param [in] renumPol - specifies how to permute values of the result field according to
- *          the optional numbers of cells and nodes, if any. The valid values are
- *          - 0 - do not permute.
- *          - 1 - permute cells.
- *          - 2 - permute nodes.
- *          - 3 - permute cells and nodes.
- *
- *  \return MEDCouplingFieldInt * - a new instance of MEDCouplingFieldDouble. The
- *          caller is to delete this field using decrRef() as it is no more needed. 
- *  \throw If no field of \a this is lying on \a mesh.
- *  \throw If the mesh is empty.
- *  \throw If no field values of the given \a type are available.
- *  \sa getFieldAtLevel()
- *  \sa getFieldOnMeshAtLevel() 
- */
-MEDCouplingFieldInt *MEDFileIntField1TS::getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol) const
-{
-  MCAuto<DataArray> arrOut;
-  MCAuto<MEDCouplingFieldDouble> ret(contentNotNull()->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arrOut,*contentNotNull()));
-  MCAuto<MEDCouplingFieldInt> ret2(SetDataArrayDoubleInIntField(ret,arrOut));
-  return ret2.retn();
-}
-
-/*!
- * Returns a new MEDCouplingFieldInt of a given type lying on a given support.
- * For more info, see \ref AdvMEDLoaderAPIFieldRW
- *  \param [in] type - a spatial discretization of interest.
- *  \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities.
- *  \param [in] mesh - the supporting mesh.
- *  \param [in] renumPol - specifies how to permute values of the result field according to
- *          the optional numbers of cells and nodes, if any. The valid values are
- *          - 0 - do not permute.
- *          - 1 - permute cells.
- *          - 2 - permute nodes.
- *          - 3 - permute cells and nodes.
- *
- *  \return MEDCouplingFieldInt * - a new instance of MEDCouplingFieldDouble. The
- *          caller is to delete this field using decrRef() as it is no more needed. 
- *  \throw If there are no mesh entities of \a meshDimRelToMax dimension in the mesh.
- *  \throw If no field of \a this is lying on \a mesh.
- *  \throw If no field values of the given \a type or given \a meshDimRelToMax are available.
- *  \sa getFieldAtLevel()
- *  \sa getFieldOnMeshAtLevel() 
- */
-MEDCouplingFieldInt *MEDFileIntField1TS::getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol) const
-{
-  MCAuto<DataArray> arrOut;
-  MCAuto<MEDCouplingFieldDouble> ret(contentNotNull()->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arrOut,*contentNotNull()));
-  MCAuto<MEDCouplingFieldInt> ret2(SetDataArrayDoubleInIntField(ret,arrOut));
-  return ret2.retn();
-}
-
-/*!
- * Returns a new MEDCouplingFieldDouble of a given type lying on a given support.
- * This method is called "Old" because in MED3 norm a field has only one meshName
- * attached, so this method is for readers of MED2 files. If \a this field 
- * has not been constructed via file reading, an exception is thrown.
- * For more info, see \ref AdvMEDLoaderAPIFieldRW
- *  \param [in] type - a spatial discretization of interest.
- *  \param [in] mName - a name of the supporting mesh.
- *  \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities.
- *  \param [in] renumPol - specifies how to permute values of the result field according to
- *          the optional numbers of cells and nodes, if any. The valid values are
- *          - 0 - do not permute.
- *          - 1 - permute cells.
- *          - 2 - permute nodes.
- *          - 3 - permute cells and nodes.
- *
- *  \return MEDCouplingFieldInt * - a new instance of MEDCouplingFieldDouble. The
- *          caller is to delete this field using decrRef() as it is no more needed. 
- *  \throw If the MED file is not readable.
- *  \throw If there is no mesh named \a mName in the MED file.
- *  \throw If there are no mesh entities of \a meshDimRelToMax dimension in the mesh.
- *  \throw If \a this field has not been constructed via file reading.
- *  \throw If no field of \a this is lying on the mesh named \a mName.
- *  \throw If no field values of the given \a type or given \a meshDimRelToMax are available.
- *  \sa getFieldAtLevel()
- */
-MEDCouplingFieldInt *MEDFileIntField1TS::getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol) const
-{
-  if(getFileName().empty())
-    throw INTERP_KERNEL::Exception("MEDFileIntField1TS::getFieldAtLevelOld : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtLevel method instead !");
-  MCAuto<DataArray> arrOut;
-  MCAuto<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arrOut,*contentNotNull());
-  MCAuto<MEDCouplingFieldInt> ret2(SetDataArrayDoubleInIntField(ret,arrOut));
-  return ret2.retn();
-}
-
-/*!
- * Returns values and a profile of the field of a given type lying on a given support.
- * For more info, see \ref AdvMEDLoaderAPIFieldRW
- *  \param [in] type - a spatial discretization of the field.
- *  \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities.
- *  \param [in] mesh - the supporting mesh.
- *  \param [out] pfl - a new instance of DataArrayInt holding ids of mesh entities the
- *          field of interest lies on. If the field lies on all entities of the given
- *          dimension, all ids in \a pfl are zero. The caller is to delete this array
- *          using decrRef() as it is no more needed.  
- *  \return DataArrayInt * - a new instance of DataArrayInt holding values of the
- *          field. The caller is to delete this array using decrRef() as it is no more needed.
- *  \throw If there are no mesh entities of \a meshDimRelToMax dimension in \a mesh.
- *  \throw If no field of \a this is lying on \a mesh.
- *  \throw If no field values of the given \a type or given \a meshDimRelToMax are available.
- */
-DataArrayInt *MEDFileIntField1TS::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::pushBackTimeStep(MCAuto<MEDFileAnyTypeField1TSWithoutSDA>& tse)
 {
-  MCAuto<DataArray> arr=contentNotNull()->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNull());
-  return MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr);
+  MEDFileAnyTypeField1TSWithoutSDA *tse2(tse);
+  if(!tse2)
+    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::pushBackTimeStep : input content object is null !");
+  checkCoherencyOfType(tse2);
+  if(_time_steps.empty())
+    {
+      setName(tse2->getName());
+      setMeshName(tse2->getMeshName());
+      setInfo(tse2->getInfo());
+    }
+  checkThatComponentsMatch(tse2->getInfo());
+  if(getDtUnit().empty() && !tse->getDtUnit().empty())
+    setDtUnit(tse->getDtUnit());
+  _time_steps.push_back(tse);
 }
 
-MEDFileIntField1TSWithoutSDA *MEDFileIntField1TS::contentNotNull()
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::synchronizeNameScope()
 {
-  MEDFileAnyTypeField1TSWithoutSDA *pt(_content);
-  if(!pt)
-    throw INTERP_KERNEL::Exception("MEDFileIntField1TS::contentNotNull : the non const content pointer is null !");
-  MEDFileIntField1TSWithoutSDA *ret=dynamic_cast<MEDFileIntField1TSWithoutSDA *>(pt);
-  if(!ret)
-    throw INTERP_KERNEL::Exception("MEDFileIntField1TS::contentNotNull : the non const content pointer is not null but it is not of type int32 ! Reason is maybe that the read field has not the type INT32 !");
-  return ret;
+  std::size_t nbOfCompo=_infos.size();
+  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+    {
+      MEDFileAnyTypeField1TSWithoutSDA *cur=(*it);
+      if(cur)
+        {
+          if((cur->getInfo()).size()!=nbOfCompo)
+            {
+              std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::synchronizeNameScope : Mismatch in the number of components of parts ! Should be " << nbOfCompo;
+              oss << " ! but the field at iteration=" << cur->getIteration() << " order=" << cur->getOrder() << " has " << (cur->getInfo()).size() << " components !";
+              throw INTERP_KERNEL::Exception(oss.str());
+            }
+          cur->copyNameScope(*this);
+        }
+    }
 }
 
-DataArrayInt *MEDFileIntField1TS::getUndergroundDataArray() const
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadStructureOrStructureAndBigArraysRecursively(med_idt fid, int nbPdt, med_field_type fieldTyp, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities)
 {
-  return contentNotNull()->getUndergroundDataArrayTemplate();
+  _time_steps.resize(nbPdt);
+  for(int i=0;i<nbPdt;i++)
+    {
+      std::vector< std::pair<int,int> > ts;
+      med_int numdt=0,numo=0;
+      med_float dt=0.0;
+      MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,_name.c_str(),i+1,&numdt,&numo,&dt));
+      switch(fieldTyp)
+      {
+        case MED_FLOAT64:
+          {
+            _time_steps[i]=MEDFileField1TSWithoutSDA::New(getName(),getMeshName(),i+1,numdt,numo,_infos);
+            break;
+          }
+        case MED_INT32:
+          {
+            _time_steps[i]=MEDFileIntField1TSWithoutSDA::New(getName(),getMeshName(),i+1,numdt,numo,_infos);
+            break;
+          }
+        case MED_NODE://6432
+          {
+            _time_steps[i]=MEDFileFloatField1TSWithoutSDA::New(getName(),getMeshName(),i+1,numdt,numo,_infos);
+            break;
+          }
+        default:
+          throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::loadStructureOrStructureAndBigArraysRecursively : managed field type are : FLOAT64, INT32, FLOAT32 !");
+      }
+      if(loadAll)
+        _time_steps[i]->loadStructureAndBigArraysRecursively(fid,*this,ms,entities);
+      else
+        _time_steps[i]->loadOnlyStructureOfDataRecursively(fid,*this,ms,entities);
+      synchronizeNameScope();
+    }
 }
 
-//= MEDFileAnyTypeFieldMultiTSWithoutSDA
-
-MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA()
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::writeLL(med_idt fid, const MEDFileWritable& opts) const
 {
+  if(_time_steps.empty())
+    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::writeLL : no time steps set !");
+  checkThatNbOfCompoOfTSMatchThis();
+  std::vector<std::string> infos(getInfo());
+  int nbComp=infos.size();
+  INTERP_KERNEL::AutoPtr<char> comp=MEDLoaderBase::buildEmptyString(nbComp*MED_SNAME_SIZE);
+  INTERP_KERNEL::AutoPtr<char> unit=MEDLoaderBase::buildEmptyString(nbComp*MED_SNAME_SIZE);
+  for(int i=0;i<nbComp;i++)
+    {
+      std::string info=infos[i];
+      std::string c,u;
+      MEDLoaderBase::splitIntoNameAndUnit(info,c,u);
+      MEDLoaderBase::safeStrCpy2(c.c_str(),MED_SNAME_SIZE,comp+i*MED_SNAME_SIZE,opts.getTooLongStrPolicy());
+      MEDLoaderBase::safeStrCpy2(u.c_str(),MED_SNAME_SIZE,unit+i*MED_SNAME_SIZE,opts.getTooLongStrPolicy());
+    }
+  if(_name.empty())
+    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::write : MED file does not accept field with empty name !");
+  MEDFILESAFECALLERWR0(MEDfieldCr,(fid,_name.c_str(),getMEDFileFieldType(),nbComp,comp,unit,getDtUnit().c_str(),getMeshName().c_str()));
+  int nbOfTS=_time_steps.size();
+  for(int i=0;i<nbOfTS;i++)
+    _time_steps[i]->writeLL(fid,opts,*this);
 }
 
-MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName):MEDFileFieldNameScope(fieldName,meshName)
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc)
 {
+  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+    {
+      MEDFileAnyTypeField1TSWithoutSDA *elt(*it);
+      if(elt)
+        elt->loadBigArraysRecursively(fid,nasc);
+    }
 }
 
-/*!
- * \param [in] fieldId field id in C mode
- */
-MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities)
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadBigArraysRecursivelyIfNecessary(med_idt fid, const MEDFileFieldNameScope& nasc)
 {
-  med_field_type typcha;
-  std::string dtunitOut,meshName;
-  int nbOfStep(MEDFileAnyTypeField1TS::LocateField2(fid,fieldId,false,_name,typcha,_infos,dtunitOut,meshName));
-  setMeshName(meshName);
-  setDtUnit(dtunitOut.c_str());
-  loadStructureOrStructureAndBigArraysRecursively(fid,nbOfStep,typcha,loadAll,ms,entities);
+  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+    {
+      MEDFileAnyTypeField1TSWithoutSDA *elt(*it);
+      if(elt)
+        elt->loadBigArraysRecursivelyIfNecessary(fid,nasc);
+    }
 }
 
-MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities)
-try:MEDFileFieldNameScope(fieldName,meshName),_infos(infos)
-{
-  setDtUnit(dtunit.c_str());
-  loadStructureOrStructureAndBigArraysRecursively(fid,nbOfStep,fieldTyp,loadAll,ms,entities);
-}
-catch(INTERP_KERNEL::Exception& e)
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::unloadArrays()
 {
-    throw e;
+  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+    {
+      MEDFileAnyTypeField1TSWithoutSDA *elt(*it);
+      if(elt)
+        elt->unloadArrays();
+    }
 }
 
-std::size_t MEDFileAnyTypeFieldMultiTSWithoutSDA::getHeapMemorySizeWithoutChildren() const
+int MEDFileAnyTypeFieldMultiTSWithoutSDA::getNumberOfTS() const
 {
-  std::size_t ret(_mesh_name.capacity()+_name.capacity()+_infos.capacity()*sizeof(std::string)+_time_steps.capacity()*sizeof(MCAuto<MEDFileField1TSWithoutSDA>));
-  for(std::vector<std::string>::const_iterator it=_infos.begin();it!=_infos.end();it++)
-    ret+=(*it).capacity();
-  return ret;
+  return _time_steps.size();
 }
 
-std::vector<const BigMemoryObject *> MEDFileAnyTypeFieldMultiTSWithoutSDA::getDirectChildrenWithNull() const
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseEmptyTS()
 {
-  std::vector<const BigMemoryObject *> ret;
-  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
-    ret.push_back((const MEDFileAnyTypeField1TSWithoutSDA *)*it);
-  return ret;
+  std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA>  > newTS;
+  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA>  >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+    {
+      const MEDFileAnyTypeField1TSWithoutSDA *tmp=(*it);
+      if(tmp)
+        newTS.push_back(*it);
+    }
+  _time_steps=newTS;
 }
 
-/*!
- * If one of the id in [ \a startIds , \a endIds ) points to a null element, there is not throw. Simply, this empty element is added as if it were not
- * NULL.
- */
-MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds(const int *startIds, const int *endIds) const
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseTimeStepIds(const int *startIds, const int *endIds)
 {
-  MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret=createNew();
-  ret->setInfo(_infos);
-  int sz=(int)_time_steps.size();
-  for(const int *id=startIds;id!=endIds;id++)
+  std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > newTS;
+  int maxId=(int)_time_steps.size();
+  int ii=0;
+  std::set<int> idsToDel;
+  for(const int *id=startIds;id!=endIds;id++,ii++)
     {
-      if(*id>=0 && *id<sz)
+      if(*id>=0 && *id<maxId)
         {
-          const MEDFileAnyTypeField1TSWithoutSDA *tse=_time_steps[*id];
-          MCAuto<MEDFileAnyTypeField1TSWithoutSDA> tse2;
-          if(tse)
-            {
-              tse->incrRef();
-              tse2=(const_cast<MEDFileAnyTypeField1TSWithoutSDA *>(tse));
-            }
-          ret->pushBackTimeStep(tse2);
+          idsToDel.insert(*id);
         }
       else
         {
-          std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds : At pos #" << std::distance(startIds,id) << " value is " << *id;
-          oss << " ! Should be in [0," << sz << ") !";
+          std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::eraseTimeStepIds : At pos #" << ii << " request for id=" << *id << " not in [0," << maxId << ") !";
           throw INTERP_KERNEL::Exception(oss.str());
         }
     }
-  if(ret->getNumberOfTS()>0)
-    ret->synchronizeNameScope();
-  ret->copyNameScope(*this);
-  return ret.retn();
+  for(int iii=0;iii<maxId;iii++)
+    if(idsToDel.find(iii)==idsToDel.end())
+      newTS.push_back(_time_steps[iii]);
+  _time_steps=newTS;
 }
 
-/*!
- * If one of the id in the input range points to a null element, there is not throw. Simply, this empty element is added as if it were not
- * NULL.
- */
-MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds2(int bg, int end, int step) const
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseTimeStepIds2(int bg, int end, int step)
 {
-  static const char msg[]="MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds2";
-  int nbOfEntriesToKeep=DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg);
-  MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret=createNew();
-  ret->setInfo(_infos);
-  int sz=(int)_time_steps.size();
+  static const char msg[]="MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseTimeStepIds2";
+  int nbOfEntriesToKill=DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg);
+  if(nbOfEntriesToKill==0)
+    return ;
+  std::size_t sz=_time_steps.size();
+  std::vector<bool> b(sz,true);
   int j=bg;
-  for(int i=0;i<nbOfEntriesToKeep;i++,j+=step)
+  for(int i=0;i<nbOfEntriesToKill;i++,j+=step)
+    b[j]=false;
+  std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > newTS;
+  for(std::size_t i=0;i<sz;i++)
+    if(b[i])
+      newTS.push_back(_time_steps[i]);
+  _time_steps=newTS;
+}
+
+int MEDFileAnyTypeFieldMultiTSWithoutSDA::getPosOfTimeStep(int iteration, int order) const
+{
+  int ret=0;
+  std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::getPosOfTimeStep : No such time step (" << iteration << "," << order << ") !\nPossibilities are : "; 
+  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA>  >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++)
     {
-      if(j>=0 && j<sz)
-        {
-          const MEDFileAnyTypeField1TSWithoutSDA *tse=_time_steps[j];
-          MCAuto<MEDFileAnyTypeField1TSWithoutSDA> tse2;
-          if(tse)
-            {
-              tse->incrRef();
-              tse2=(const_cast<MEDFileAnyTypeField1TSWithoutSDA *>(tse));
-            }
-          ret->pushBackTimeStep(tse2);
-        }
-      else
+      const MEDFileAnyTypeField1TSWithoutSDA *tmp(*it);
+      if(tmp)
         {
-          std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds : At pos #" << i << " value is " << j;
-          oss << " ! Should be in [0," << sz << ") !";
-          throw INTERP_KERNEL::Exception(oss.str());
+          int it2,ord;
+          tmp->getTime(it2,ord);
+          if(it2==iteration && order==ord)
+            return ret;
+          else
+            oss << "(" << it2 << ","  << ord << "), ";
         }
     }
-  if(ret->getNumberOfTS()>0)
-    ret->synchronizeNameScope();
-  ret->copyNameScope(*this);
-  return ret.retn();
+  throw INTERP_KERNEL::Exception(oss.str());
 }
 
-MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::partOfThisLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const
+int MEDFileAnyTypeFieldMultiTSWithoutSDA::getPosGivenTime(double time, double eps) const
 {
-  int id=0;
-  MCAuto<DataArrayInt> ids=DataArrayInt::New(); ids->alloc(0,1);
-  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,id++)
+  int ret=0;
+  std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::getPosGivenTime : No such time step " << time << "! \nPossibilities are : ";
+  oss.precision(15);
+  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA>  >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++)
     {
-      const MEDFileAnyTypeField1TSWithoutSDA *cur(*it);
-      if(!cur)
-        continue;
-      std::pair<int,int> p(cur->getIteration(),cur->getOrder());
-      if(std::find(timeSteps.begin(),timeSteps.end(),p)!=timeSteps.end())
-        ids->pushBackSilent(id);
+      const MEDFileAnyTypeField1TSWithoutSDA *tmp(*it);
+      if(tmp)
+        {
+          int it2,ord;
+          double ti=tmp->getTime(it2,ord);
+          if(fabs(time-ti)<eps)
+            return ret;
+          else
+            oss << ti << ", ";
+        }
     }
-  return buildFromTimeStepIds(ids->begin(),ids->end());
+  throw INTERP_KERNEL::Exception(oss.str());
 }
 
-MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::partOfThisNotLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const
+std::vector< std::pair<int,int> > MEDFileAnyTypeFieldMultiTSWithoutSDA::getIterations() const
 {
-  int id=0;
-  MCAuto<DataArrayInt> ids=DataArrayInt::New(); ids->alloc(0,1);
-  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,id++)
-    {
-      const MEDFileAnyTypeField1TSWithoutSDA *cur(*it);
-      if(!cur)
-        continue;
-      std::pair<int,int> p(cur->getIteration(),cur->getOrder());
-      if(std::find(timeSteps.begin(),timeSteps.end(),p)==timeSteps.end())
-        ids->pushBackSilent(id);
-    }
-  return buildFromTimeStepIds(ids->begin(),ids->end());
+  int lgth=_time_steps.size();
+  std::vector< std::pair<int,int> > ret(lgth);
+  for(int i=0;i<lgth;i++)
+    _time_steps[i]->fillIteration(ret[i]);
+  return ret;
 }
 
-bool MEDFileAnyTypeFieldMultiTSWithoutSDA::presenceOfStructureElements() const
+/*!
+ * This method has 3 inputs 'iteration' 'order' 'mname'. 'mname' can be null if the user is the general case where there is only one meshName lying on 'this'
+ * This method returns two things.
+ * - The absolute dimension of 'this' in first parameter. 
+ * - The available ext levels relative to the absolute dimension returned in first parameter. These relative levels are relative
+ *   to the first output parameter. The values in 'levs' will be returned in decreasing order.
+ *
+ * This method is designed for MEDFileFieldMultiTS instances that have a discritization ON_CELLS, ON_GAUSS_NE and ON_GAUSS.
+ * Only these 3 discretizations will be taken into account here.
+ *
+ * If 'this' is empty this method will throw an INTERP_KERNEL::Exception.
+ * If there is \b only node fields defined in 'this' -1 is returned and 'levs' output parameter will be empty. In this
+ * case the caller has to know the underlying mesh it refers to. By defaut it is the level 0 of the corresponding mesh.
+ *
+ * This method is usefull to make the link between meshDimension of the underlying mesh in 'this' and the levels on 'this'.
+ * It is possible (even if it is not common) that the highest level in 'this' were not equal to the meshDimension of the underlying mesh in 'this'.
+ * 
+ * Let's consider the typical following case :
+ * - a mesh 'm1' has a meshDimension 3 and has the following non empty levels
+ * [0,-1,-2] for example 'm1' lies on TETRA4, HEXA8 TRI3 and SEG2
+ * - 'f1' lies on 'm1' and is defined on 3D and 1D cells for example
+ *   TETRA4 and SEG2
+ * - 'f2' lies on 'm1' too and is defined on 2D and 1D cells for example TRI3 and SEG2
+ *
+ * In this case f1->getNonEmptyLevelsExt will return (3,[0,-2]) and f2->getNonEmptyLevelsExt will return (2,[0,-1])
+ * 
+ * To retrieve the highest level of f1 it should be done, f1->getFieldAtLevel(ON_CELLS,3-3+0);//absDim-meshDim+relativeLev
+ * To retrieve the lowest level of f1 it should be done, f1->getFieldAtLevel(ON_CELLS,3-3+(-2));//absDim-meshDim+relativeLev
+ * To retrieve the highest level of f2 it should be done, f1->getFieldAtLevel(ON_CELLS,2-3+0);//absDim-meshDim+relativeLev
+ * To retrieve the lowest level of f2 it should be done, f1->getFieldAtLevel(ON_CELLS,2-3+(-1));//absDim-meshDim+relativeLev
+ */
+int MEDFileAnyTypeFieldMultiTSWithoutSDA::getNonEmptyLevels(int iteration, int order, const std::string& mname, std::vector<int>& levs) const
 {
-  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
-    if((*it).isNotNull())
-      if((*it)->presenceOfStructureElements())
-        return true;
-  return false;
+  return getTimeStepEntry(iteration,order).getNonEmptyLevels(mname,levs);
 }
 
-bool MEDFileAnyTypeFieldMultiTSWithoutSDA::onlyStructureElements() const
+const MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepAtPos2(int pos) const
 {
-  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
-    if((*it).isNotNull())
-      if(!(*it)->onlyStructureElements())
-        return false;
-  return true;
+  if(pos<0 || pos>=(int)_time_steps.size())
+    {
+      std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepAtPos2 : request for pos #" << pos << " whereas should be in [0," << _time_steps.size() << ") !";
+      throw INTERP_KERNEL::Exception(oss.str());
+    }
+  const MEDFileAnyTypeField1TSWithoutSDA *item=_time_steps[pos];
+  if(item==0)
+    {
+      std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepAtPos2 : request for pos #" << pos << ", this pos id exists but the underlying Field1TS is null !";
+      oss << "\nTry to use following method eraseEmptyTS !";
+      throw INTERP_KERNEL::Exception(oss.str());
+    }
+  return item;
 }
 
-void MEDFileAnyTypeFieldMultiTSWithoutSDA::killStructureElements()
+MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepAtPos2(int pos)
 {
-  std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > ret;
-  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
-    if((*it).isNotNull())
-      {
-        if((*it)->presenceOfStructureElements())
-          {
-            if(!(*it)->onlyStructureElements())
-              {
-                (*it)->killStructureElements();
-                ret.push_back(*it);
-              }
-          }
-        else
+  if(pos<0 || pos>=(int)_time_steps.size())
+    {
+      std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepAtPos2 : request for pos #" << pos << " whereas should be in [0," << _time_steps.size() << ") !";
+      throw INTERP_KERNEL::Exception(oss.str());
+    }
+  MEDFileAnyTypeField1TSWithoutSDA *item=_time_steps[pos];
+  if(item==0)
+    {
+      std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepAtPos2 : request for pos #" << pos << ", this pos id exists but the underlying Field1TS is null !";
+      oss << "\nTry to use following method eraseEmptyTS !";
+      throw INTERP_KERNEL::Exception(oss.str());
+    }
+  return item;
+}
+
+std::vector<std::string> MEDFileAnyTypeFieldMultiTSWithoutSDA::getPflsReallyUsed2() const
+{
+  std::vector<std::string> ret;
+  std::set<std::string> ret2;
+  for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+    {
+      std::vector<std::string> tmp=(*it)->getPflsReallyUsed2();
+      for(std::vector<std::string>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
+        if(ret2.find(*it2)==ret2.end())
           {
-            ret.push_back(*it);
+            ret.push_back(*it2);
+            ret2.insert(*it2);
           }
-      }
-  _time_steps=ret;
+    }
+  return ret;
 }
 
-void MEDFileAnyTypeFieldMultiTSWithoutSDA::keepOnlyStructureElements()
+std::vector<std::string> MEDFileAnyTypeFieldMultiTSWithoutSDA::getLocsReallyUsed2() const
 {
-  std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > ret;
-  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
-    if((*it).isNotNull())
-      {
-        if((*it)->presenceOfStructureElements())
+  std::vector<std::string> ret;
+  std::set<std::string> ret2;
+  for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+    {
+      std::vector<std::string> tmp=(*it)->getLocsReallyUsed2();
+      for(std::vector<std::string>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
+        if(ret2.find(*it2)==ret2.end())
           {
-            if(!(*it)->onlyStructureElements())
-              (*it)->keepOnlyStructureElements();
-            ret.push_back(*it);
+            ret.push_back(*it2);
+            ret2.insert(*it2);
           }
-      }
-  _time_steps=ret;
+    }
+  return ret;
 }
 
-void MEDFileAnyTypeFieldMultiTSWithoutSDA::keepOnlyOnSE(const std::string& seName)
+std::vector<std::string> MEDFileAnyTypeFieldMultiTSWithoutSDA::getPflsReallyUsedMulti2() const
 {
-  std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > ret;
-  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
-    if((*it).isNotNull())
-      (*it)->keepOnlyOnSE(seName);
+  std::vector<std::string> ret;
+  for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+    {
+      std::vector<std::string> tmp=(*it)->getPflsReallyUsedMulti2();
+      ret.insert(ret.end(),tmp.begin(),tmp.end());
+    }
+  return ret;
 }
 
-void MEDFileAnyTypeFieldMultiTSWithoutSDA::getMeshSENames(std::vector< std::pair<std::string,std::string> >& ps) const
+std::vector<std::string> MEDFileAnyTypeFieldMultiTSWithoutSDA::getLocsReallyUsedMulti2() const
 {
-  std::vector< std::pair<std::string,std::string> > ps2;
-  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
-    if((*it).isNotNull())
-      {
-        (*it)->getMeshSENames(ps2);
-        break;
-      }
-  if(ps2.empty())
-    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::getMeshSENames : this appears to not contain SE only !");
-  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
-    if((*it).isNotNull())
-      {
-        std::vector< std::pair<std::string,std::string> > ps3;
-        (*it)->getMeshSENames(ps3);
-        if(ps2!=ps3)
-          throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::getMeshSENames : For the moment only homogeneous SE def through time managed !");
-      }
-  for(std::vector< std::pair<std::string,std::string> >::const_iterator it=ps2.begin();it!=ps2.end();it++)
+  std::vector<std::string> ret;
+  for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
     {
-      std::vector< std::pair<std::string,std::string> >::iterator it2(std::find(ps.begin(),ps.end(),*it));
-      if(it2==ps.end())
-        ps.push_back(*it);
+      std::vector<std::string> tmp=(*it)->getLocsReallyUsedMulti2();
+      ret.insert(ret.end(),tmp.begin(),tmp.end());
     }
+  return ret;
 }
 
-bool MEDFileAnyTypeFieldMultiTSWithoutSDA::presenceOfMultiDiscPerGeoType() const
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::changePflsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
 {
-  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
-    {
-      const MEDFileAnyTypeField1TSWithoutSDA *cur(*it);
-      if(!cur)
-        continue;
-      if(cur->presenceOfMultiDiscPerGeoType())
-        return true;
-    }
-  return false;
+  for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+    (*it)->changePflsRefsNamesGen2(mapOfModif);
 }
 
-const std::vector<std::string>& MEDFileAnyTypeFieldMultiTSWithoutSDA::getInfo() const
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::changeLocsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
 {
-  return _infos;
+  for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+    (*it)->changeLocsRefsNamesGen2(mapOfModif);
 }
 
-void MEDFileAnyTypeFieldMultiTSWithoutSDA::setInfo(const std::vector<std::string>& info)
+std::vector< std::vector<TypeOfField> > MEDFileAnyTypeFieldMultiTSWithoutSDA::getTypesOfFieldAvailable() const
 {
-  _infos=info;
+  int lgth=_time_steps.size();
+  std::vector< std::vector<TypeOfField> > ret(lgth);
+  for(int i=0;i<lgth;i++)
+    _time_steps[i]->fillTypesOfFieldAvailable(ret[i]);
+  return ret;
 }
 
-int MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepPos(int iteration, int order) const
+/*!
+ * entry point for users that want to iterate into MEDFile DataStructure without any overhead.
+ */
+std::vector< std::vector< std::pair<int,int> > > MEDFileAnyTypeFieldMultiTSWithoutSDA::getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
 {
-  int ret=0;
-  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA>  >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++)
-    {
-      const MEDFileAnyTypeField1TSWithoutSDA *pt(*it);
-      if(pt->isDealingTS(iteration,order))
-        return ret;
-    }
-  std::ostringstream oss; oss << "MEDFileFieldMultiTS::getTimeStepPos : Muli timestep field on time (" << iteration << "," << order << ") does not exist ! Available (iteration,order) are :\n";
-  std::vector< std::pair<int,int> > vp=getIterations();
-  for(std::vector< std::pair<int,int> >::const_iterator it2=vp.begin();it2!=vp.end();it2++)
-    oss << "(" << (*it2).first << "," << (*it2).second << ") ";
-  throw INTERP_KERNEL::Exception(oss.str());
+  return getTimeStepEntry(iteration,order).getFieldSplitedByType(mname,types,typesF,pfls,locs);
 }
 
-const MEDFileAnyTypeField1TSWithoutSDA& MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepEntry(int iteration, int order) const
+MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::deepCopy() const
 {
-  return *_time_steps[getTimeStepPos(iteration,order)];
+  MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret=shallowCpy();
+  std::size_t i=0;
+  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++)
+    {
+      if((const MEDFileAnyTypeField1TSWithoutSDA *)*it)
+        ret->_time_steps[i]=(*it)->deepCopy();
+    }
+  return ret.retn();
 }
 
-MEDFileAnyTypeField1TSWithoutSDA& MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepEntry(int iteration, int order)
+std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitComponents() const
 {
-  return *_time_steps[getTimeStepPos(iteration,order)];
+  std::size_t sz(_infos.size()),sz2(_time_steps.size());
+  std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > ret(sz);
+  std::vector< std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > > ts(sz2);
+  for(std::size_t i=0;i<sz;i++)
+    {
+      ret[i]=shallowCpy();
+      ret[i]->_infos.resize(1); ret[i]->_infos[0]=_infos[i];
+    }
+  for(std::size_t i=0;i<sz2;i++)
+    {
+      std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > ret1=_time_steps[i]->splitComponents();
+      if(ret1.size()!=sz)
+        {
+          std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::splitComponents : At rank #" << i << " number of components is " << ret1.size() << " whereas it should be for all time steps " << sz << " !";
+          throw INTERP_KERNEL::Exception(oss.str());
+        }
+      ts[i]=ret1;
+    }
+  for(std::size_t i=0;i<sz;i++)
+    for(std::size_t j=0;j<sz2;j++)
+      ret[i]->_time_steps[j]=ts[j][i];
+  return ret;
 }
 
-bool MEDFileAnyTypeFieldMultiTSWithoutSDA::changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab)
+/*!
+ * This method splits into discretization each time steps in \a this.
+ * ** WARNING ** the returned instances are not compulsary defined on the same time steps series !
+ */
+std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitDiscretizations() const
 {
-  bool ret(false);
-  for(std::vector< std::pair<std::string,std::string> >::const_iterator it=modifTab.begin();it!=modifTab.end();it++)
+  std::size_t sz(_time_steps.size());
+  std::vector< std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > > items(sz);
+  for(std::size_t i=0;i<sz;i++)
     {
-      if((*it).first==getMeshName())
+      const MEDFileAnyTypeField1TSWithoutSDA *timeStep(_time_steps[i]);
+      if(!timeStep)
         {
-          setMeshName((*it).second);
-          ret=true;
+          std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::splitDiscretizations : time step #" << i << " is null !"; 
+          throw INTERP_KERNEL::Exception(oss.str());
         }
+      items[i]=timeStep->splitDiscretizations();  
     }
-  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+  //
+  std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > ret;
+  std::vector< std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > > ret2;
+  std::vector< TypeOfField > types;
+  for(std::vector< std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > >::const_iterator it0=items.begin();it0!=items.end();it0++)
+    for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++)
+      {
+        std::vector<TypeOfField> ts=(*it1)->getTypesOfFieldAvailable();
+        if(ts.size()!=1)
+          throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::splitDiscretizations : it appears that the splitting of MEDFileAnyTypeField1TSWithoutSDA::splitDiscretizations has returned invalid result !");
+        std::vector< TypeOfField >::iterator it2=std::find(types.begin(),types.end(),ts[0]);
+        if(it2==types.end())
+          types.push_back(ts[0]);
+      }
+  ret.resize(types.size()); ret2.resize(types.size());
+  for(std::vector< std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > >::const_iterator it0=items.begin();it0!=items.end();it0++)
+    for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++)
+      {
+        TypeOfField typ=(*it1)->getTypesOfFieldAvailable()[0];
+        std::size_t pos=std::distance(types.begin(),std::find(types.begin(),types.end(),typ));
+        ret2[pos].push_back(*it1);
+      }
+  for(std::size_t i=0;i<types.size();i++)
     {
-      MEDFileAnyTypeField1TSWithoutSDA *cur(*it);
-      if(cur)
-        ret=cur->changeMeshNames(modifTab) || ret;
+      MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> elt(createNew());
+      for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it1=ret2[i].begin();it1!=ret2[i].end();it1++)
+        elt->pushBackTimeStep(*it1);//also updates infos in elt
+      ret[i]=elt;
+      elt->MEDFileFieldNameScope::operator=(*this);
     }
   return ret;
 }
 
 /*!
- * See doc at MEDFileField1TSWithoutSDA::getUndergroundDataArray
+ * Contrary to splitDiscretizations method this method makes the hypothesis that the times series are **NOT** impacted by the splitting of multi discretization.
  */
-DataArray *MEDFileAnyTypeFieldMultiTSWithoutSDA::getUndergroundDataArray(int iteration, int order) const
+std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitMultiDiscrPerGeoTypes() const
 {
-  return getTimeStepEntry(iteration,order).getUndergroundDataArray();
+  std::size_t sz(_time_steps.size());
+  std::vector< std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > > items(sz);
+  std::size_t szOut(std::numeric_limits<std::size_t>::max());
+  for(std::size_t i=0;i<sz;i++)
+    {
+      const MEDFileAnyTypeField1TSWithoutSDA *timeStep(_time_steps[i]);
+      if(!timeStep)
+        {
+          std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::splitMultiDiscrPerGeoTypes : time step #" << i << " is null !";
+          throw INTERP_KERNEL::Exception(oss.str());
+        }
+      items[i]=timeStep->splitMultiDiscrPerGeoTypes();
+      if(szOut==std::numeric_limits<std::size_t>::max())
+        szOut=items[i].size();
+      else
+        if(items[i].size()!=szOut)
+          throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::splitMultiDiscrPerGeoTypes : The splitting per discretization is expected to be same among time steps !");
+    }
+  if(szOut==std::numeric_limits<std::size_t>::max())
+    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::splitMultiDiscrPerGeoTypes : empty field !");
+  std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > ret(szOut);
+  for(std::size_t i=0;i<szOut;i++)
+    {
+      MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> elt(createNew());
+      for(std::size_t j=0;j<sz;j++)
+        elt->pushBackTimeStep(items[j][i]);
+      ret[i]=elt;
+      elt->MEDFileFieldNameScope::operator=(*this);
+    }
+  return ret;
 }
 
-/*!
- * See doc at MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt
- */
-DataArray *MEDFileAnyTypeFieldMultiTSWithoutSDA::getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr)
 {
-  return getTimeStepEntry(iteration,order).getUndergroundDataArrayExt(entries);
+  setName(field->getName());
+  if(field->getMesh())
+    setMeshName(field->getMesh()->getName());
+  if(_name.empty())
+    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::copyTinyInfoFrom : unsupported fields with no name in MED file !");
+  if(!arr)
+    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::copyTinyInfoFrom : no array set !");
+  _infos=arr->getInfoOnComponents();
 }
 
-bool MEDFileAnyTypeFieldMultiTSWithoutSDA::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N,
-                                                                       MEDFileFieldGlobsReal& glob)
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::checkCoherencyOfTinyInfo(const MEDCouplingFieldDouble *field, const DataArray *arr) const
 {
-  bool ret=false;
-  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+  static const char MSG[]="MEDFileFieldMultiTSWithoutSDA::checkCoherencyOfTinyInfo : invalid ";
+  if(_name!=field->getName())
     {
-      MEDFileAnyTypeField1TSWithoutSDA *f1ts(*it);
-      if(f1ts)
-        ret=f1ts->renumberEntitiesLyingOnMesh(meshName,oldCode,newCode,renumO2N,glob) || ret;
+      std::ostringstream oss; oss << MSG << "name ! should be \"" << _name;
+      oss << "\" and it is set in input field to \"" << field->getName() << "\" !";
+      throw INTERP_KERNEL::Exception(oss.str());
     }
-  return ret;
-}
-
-void MEDFileAnyTypeFieldMultiTSWithoutSDA::accept(MEDFileFieldVisitor& visitor) const
-{
-  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
-    if((*it).isNotNull())
-      {
-        visitor.newTimeStepEntry(*it);
-        (*it)->accept(visitor);
-        visitor.endTimeStepEntry(*it);
-      }
+  if(!arr)
+    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::checkCoherencyOfTinyInfo : no array set !");
+  checkThatComponentsMatch(arr->getInfoOnComponents());
 }
 
-void MEDFileAnyTypeFieldMultiTSWithoutSDA::simpleRepr(int bkOffset, std::ostream& oss, int fmtsId) const
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::checkThatComponentsMatch(const std::vector<std::string>& compos) const
 {
-  std::string startLine(bkOffset,' ');
-  oss << startLine << "Field multi time steps [Type=" << getTypeStr() << "]";
-  if(fmtsId>=0)
-    oss << " (" << fmtsId << ")";
-  oss << " has the following name: \"" << _name << "\"." << std::endl;
-  oss << startLine << "Field multi time steps has " << _infos.size() << " components with the following infos :" << std::endl;
-  for(std::vector<std::string>::const_iterator it=_infos.begin();it!=_infos.end();it++)
+  static const char MSG[]="MEDFileFieldMultiTSWithoutSDA::checkThatComponentsMatch : ";
+  if(getInfo().size()!=compos.size())
     {
-      oss << startLine << "  -  \"" << *it << "\"" << std::endl;
+      std::ostringstream oss; oss << MSG << "mismatch of number of components between this (" << getInfo().size() << ") and ";
+      oss << " number of components of element to append (" << compos.size() << ") !";
+      throw INTERP_KERNEL::Exception(oss.str());
     }
-  int i=0;
-  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++)
+  if(_infos!=compos)
     {
-      std::string chapter(17,'0'+i);
-      oss << startLine << chapter << std::endl;
-      const MEDFileAnyTypeField1TSWithoutSDA *cur=(*it);
-      if(cur)
-        cur->simpleRepr(bkOffset+2,oss,i);
-      else
-        oss << startLine << "  Field on one time step #" << i << " is not defined !" << std::endl;
-      oss << startLine << chapter << std::endl;
+      std::ostringstream oss; oss << MSG << "components have same size but are different ! should be \"";
+      std::copy(_infos.begin(),_infos.end(),std::ostream_iterator<std::string>(oss,", "));
+      oss << " But compo in input fields are : ";
+      std::copy(compos.begin(),compos.end(),std::ostream_iterator<std::string>(oss,", "));
+      oss << " !";
+      throw INTERP_KERNEL::Exception(oss.str());
     }
 }
 
-std::vector< std::pair<int,int> > MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeSteps(std::vector<double>& ret1) const
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::checkThatNbOfCompoOfTSMatchThis() const
 {
-  std::size_t sz=_time_steps.size();
-  std::vector< std::pair<int,int> > ret(sz);
-  ret1.resize(sz);
-  for(std::size_t i=0;i<sz;i++)
+  std::size_t sz=_infos.size();
+  int j=0;
+  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,j++)
     {
-      const MEDFileAnyTypeField1TSWithoutSDA *f1ts=_time_steps[i];
-      if(f1ts)
-        {
-          ret1[i]=f1ts->getTime(ret[i].first,ret[i].second);
-        }
-      else
-        {
-          std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::getTimeSteps : At rank #" << i << " time step is not defined. Invoke eraseEmptyTS method !";
-          throw INTERP_KERNEL::Exception(oss.str());
-        }
+      const MEDFileAnyTypeField1TSWithoutSDA *elt(*it);
+      if(elt)
+        if(elt->getInfo().size()!=sz)
+          {
+            std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::checkThatNbOfCompoOfTSMatchThis : At pos #" << j << " the number of components is equal to ";
+            oss << elt->getInfo().size() << " whereas it is expected to be equal to " << sz << " !";
+            throw INTERP_KERNEL::Exception(oss.str());
+          }
     }
-  return ret;
 }
 
-void MEDFileAnyTypeFieldMultiTSWithoutSDA::pushBackTimeStep(MCAuto<MEDFileAnyTypeField1TSWithoutSDA>& tse)
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob)
 {
-  MEDFileAnyTypeField1TSWithoutSDA *tse2(tse);
-  if(!tse2)
-    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::pushBackTimeStep : input content object is null !");
-  checkCoherencyOfType(tse2);
-  if(_time_steps.empty())
-    {
-      setName(tse2->getName());
-      setMeshName(tse2->getMeshName());
-      setInfo(tse2->getInfo());
-    }
-  checkThatComponentsMatch(tse2->getInfo());
-  if(getDtUnit().empty() && !tse->getDtUnit().empty())
-    setDtUnit(tse->getDtUnit());
-  _time_steps.push_back(tse);
+  if(!field)
+    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldNoProfileSBT : input field is NULL !");
+  if(!_time_steps.empty())
+    checkCoherencyOfTinyInfo(field,arr);
+  MEDFileAnyTypeField1TSWithoutSDA *objC(createNew1TSWithoutSDAEmptyInstance());
+  MCAuto<MEDFileAnyTypeField1TSWithoutSDA> obj(objC);
+  {
+    MCAuto<MEDCouplingFieldTemplate> ft(MEDCouplingFieldTemplate::New(*field));
+    objC->setFieldNoProfileSBT(field->timeDiscrSafe(),ft,arr,glob,*this);
+  }
+  copyTinyInfoFrom(field,arr);
+  _time_steps.push_back(obj);
 }
 
-void MEDFileAnyTypeFieldMultiTSWithoutSDA::synchronizeNameScope()
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob)
 {
-  std::size_t nbOfCompo=_infos.size();
-  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
-    {
-      MEDFileAnyTypeField1TSWithoutSDA *cur=(*it);
-      if(cur)
-        {
-          if((cur->getInfo()).size()!=nbOfCompo)
-            {
-              std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::synchronizeNameScope : Mismatch in the number of components of parts ! Should be " << nbOfCompo;
-              oss << " ! but the field at iteration=" << cur->getIteration() << " order=" << cur->getOrder() << " has " << (cur->getInfo()).size() << " components !";
-              throw INTERP_KERNEL::Exception(oss.str());
-            }
-          cur->copyNameScope(*this);
-        }
-    }
+  if(!field)
+    throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTSWithoutSDA::appendFieldNoProfileSBT : input field is NULL !");
+  if(!_time_steps.empty())
+    checkCoherencyOfTinyInfo(field,arr);
+  MEDFileAnyTypeField1TSWithoutSDA *objC=createNew1TSWithoutSDAEmptyInstance();
+  MCAuto<MEDFileAnyTypeField1TSWithoutSDA> obj(objC);
+  {
+    MCAuto<MEDCouplingFieldTemplate> ft(MEDCouplingFieldTemplate::NewWithoutCheck(*field));
+    objC->setFieldProfile(field->timeDiscrSafe(),ft,arr,mesh,meshDimRelToMax,profile,glob,*this);
+  }
+  copyTinyInfoFrom(field,arr);
+  setMeshName(objC->getMeshName());
+  _time_steps.push_back(obj);
 }
 
-void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadStructureOrStructureAndBigArraysRecursively(med_idt fid, int nbPdt, med_field_type fieldTyp, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities)
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::setIteration(int i, MCAuto<MEDFileAnyTypeField1TSWithoutSDA> ts)
 {
-  _time_steps.resize(nbPdt);
-  for(int i=0;i<nbPdt;i++)
+  int sz=(int)_time_steps.size();
+  if(i<0 || i>=sz)
     {
-      std::vector< std::pair<int,int> > ts;
-      med_int numdt=0,numo=0;
-      med_float dt=0.0;
-      MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,_name.c_str(),i+1,&numdt,&numo,&dt));
-      switch(fieldTyp)
-      {
-        case MED_FLOAT64:
-          {
-            _time_steps[i]=MEDFileField1TSWithoutSDA::New(getName(),getMeshName(),i+1,numdt,numo,_infos);
-            break;
-          }
-        case MED_INT32:
-          {
-            _time_steps[i]=MEDFileIntField1TSWithoutSDA::New(getName(),getMeshName(),i+1,numdt,numo,_infos);
-            break;
-          }
-        default:
-          throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::loadStructureOrStructureAndBigArraysRecursively : managed field type are : FLOAT64, INT32 !");
-      }
-      if(loadAll)
-        _time_steps[i]->loadStructureAndBigArraysRecursively(fid,*this,ms,entities);
-      else
-        _time_steps[i]->loadOnlyStructureOfDataRecursively(fid,*this,ms,entities);
-      synchronizeNameScope();
+      std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::setIteration : trying to set element at place #" << i << " should be in [0," << sz << ") !";
+      throw INTERP_KERNEL::Exception(oss.str());
     }
-}
-
-void MEDFileAnyTypeFieldMultiTSWithoutSDA::writeLL(med_idt fid, const MEDFileWritable& opts) const
-{
-  if(_time_steps.empty())
-    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::writeLL : no time steps set !");
-  checkThatNbOfCompoOfTSMatchThis();
-  std::vector<std::string> infos(getInfo());
-  int nbComp=infos.size();
-  INTERP_KERNEL::AutoPtr<char> comp=MEDLoaderBase::buildEmptyString(nbComp*MED_SNAME_SIZE);
-  INTERP_KERNEL::AutoPtr<char> unit=MEDLoaderBase::buildEmptyString(nbComp*MED_SNAME_SIZE);
-  for(int i=0;i<nbComp;i++)
+  const MEDFileAnyTypeField1TSWithoutSDA *tsPtr(ts);
+  if(tsPtr)
     {
-      std::string info=infos[i];
-      std::string c,u;
-      MEDLoaderBase::splitIntoNameAndUnit(info,c,u);
-      MEDLoaderBase::safeStrCpy2(c.c_str(),MED_SNAME_SIZE,comp+i*MED_SNAME_SIZE,opts.getTooLongStrPolicy());
-      MEDLoaderBase::safeStrCpy2(u.c_str(),MED_SNAME_SIZE,unit+i*MED_SNAME_SIZE,opts.getTooLongStrPolicy());
+      if(tsPtr->getNumberOfComponents()!=(int)_infos.size())
+        {
+          std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::setIteration : trying to set element with " << tsPtr->getNumberOfComponents() << " components ! Should be " << _infos.size() <<  " !";
+          throw INTERP_KERNEL::Exception(oss.str());
+        }
     }
-  if(_name.empty())
-    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::write : MED file does not accept field with empty name !");
-  MEDFILESAFECALLERWR0(MEDfieldCr,(fid,_name.c_str(),getMEDFileFieldType(),nbComp,comp,unit,getDtUnit().c_str(),getMeshName().c_str()));
-  int nbOfTS=_time_steps.size();
-  for(int i=0;i<nbOfTS;i++)
-    _time_steps[i]->writeLL(fid,opts,*this);
+  _time_steps[i]=ts;
 }
 
-void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc)
-{
-  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
-    {
-      MEDFileAnyTypeField1TSWithoutSDA *elt(*it);
-      if(elt)
-        elt->loadBigArraysRecursively(fid,nasc);
-    }
-}
+//= MEDFileFieldMultiTSWithoutSDA
 
-void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadBigArraysRecursivelyIfNecessary(med_idt fid, const MEDFileFieldNameScope& nasc)
+/*!
+ * entry point for users that want to iterate into MEDFile DataStructure with a reduced overhead because output arrays are extracted (created) specially
+ * for the call of this method. That's why the DataArrayDouble instance in returned vector of vector should be dealed by the caller.
+ */
+std::vector< std::vector<DataArrayDouble *> > MEDFileFieldMultiTSWithoutSDA::getFieldSplitedByType2(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
 {
-  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
-    {
-      MEDFileAnyTypeField1TSWithoutSDA *elt(*it);
-      if(elt)
-        elt->loadBigArraysRecursivelyIfNecessary(fid,nasc);
-    }
+  const MEDFileAnyTypeField1TSWithoutSDA& myF1TS=getTimeStepEntry(iteration,order);
+  const MEDFileField1TSWithoutSDA *myF1TSC=dynamic_cast<const MEDFileField1TSWithoutSDA *>(&myF1TS);
+  if(!myF1TSC)
+    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::getFieldSplitedByType2 : mismatch of type of field expecting FLOAT64 !");
+  return myF1TSC->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
 }
 
-void MEDFileAnyTypeFieldMultiTSWithoutSDA::unloadArrays()
+MEDFileIntFieldMultiTSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::convertToInt() const
 {
-  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+  MCAuto<MEDFileIntFieldMultiTSWithoutSDA> ret(new MEDFileIntFieldMultiTSWithoutSDA);
+  ret->MEDFileAnyTypeFieldMultiTSWithoutSDA::operator =(*this);
+  int i=0;
+  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++)
     {
-      MEDFileAnyTypeField1TSWithoutSDA *elt(*it);
-      if(elt)
-        elt->unloadArrays();
+      const MEDFileAnyTypeField1TSWithoutSDA *eltToConv(*it);
+      if(eltToConv)
+        {
+          const MEDFileField1TSWithoutSDA *eltToConvC=dynamic_cast<const MEDFileField1TSWithoutSDA *>(eltToConv);
+          if(!eltToConvC)
+            throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::convertToInt : presence of an invalid 1TS type ! Should be of type FLOAT64 !");
+          MCAuto<MEDFileAnyTypeField1TSWithoutSDA> elt=eltToConvC->convertToInt();
+          ret->setIteration(i,elt);
+        }
     }
+  return ret.retn();
 }
 
-int MEDFileAnyTypeFieldMultiTSWithoutSDA::getNumberOfTS() const
-{
-  return _time_steps.size();
-}
+//= MEDFileAnyTypeFieldMultiTS
 
-void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseEmptyTS()
+MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS()
 {
-  std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA>  > newTS;
-  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA>  >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
-    {
-      const MEDFileAnyTypeField1TSWithoutSDA *tmp=(*it);
-      if(tmp)
-        newTS.push_back(*it);
-    }
-  _time_steps=newTS;
 }
 
-void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseTimeStepIds(const int *startIds, const int *endIds)
+MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms)
+try:MEDFileFieldGlobsReal(fid)
 {
-  std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > newTS;
-  int maxId=(int)_time_steps.size();
-  int ii=0;
-  std::set<int> idsToDel;
-  for(const int *id=startIds;id!=endIds;id++,ii++)
-    {
-      if(*id>=0 && *id<maxId)
-        {
-          idsToDel.insert(*id);
-        }
-      else
-        {
-          std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::eraseTimeStepIds : At pos #" << ii << " request for id=" << *id << " not in [0," << maxId << ") !";
-          throw INTERP_KERNEL::Exception(oss.str());
-        }
-    }
-  for(int iii=0;iii<maxId;iii++)
-    if(idsToDel.find(iii)==idsToDel.end())
-      newTS.push_back(_time_steps[iii]);
-  _time_steps=newTS;
+  _content=BuildContentFrom(fid,loadAll,ms);
+  loadGlobals(fid);
 }
-
-void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseTimeStepIds2(int bg, int end, int step)
+catch(INTERP_KERNEL::Exception& e)
 {
-  static const char msg[]="MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseTimeStepIds2";
-  int nbOfEntriesToKill=DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg);
-  if(nbOfEntriesToKill==0)
-    return ;
-  std::size_t sz=_time_steps.size();
-  std::vector<bool> b(sz,true);
-  int j=bg;
-  for(int i=0;i<nbOfEntriesToKill;i++,j+=step)
-    b[j]=false;
-  std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > newTS;
-  for(std::size_t i=0;i<sz;i++)
-    if(b[i])
-      newTS.push_back(_time_steps[i]);
-  _time_steps=newTS;
+    throw e;
 }
 
-int MEDFileAnyTypeFieldMultiTSWithoutSDA::getPosOfTimeStep(int iteration, int order) const
+MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFrom(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities)
 {
-  int ret=0;
-  std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::getPosOfTimeStep : No such time step (" << iteration << "," << order << ") !\nPossibilities are : "; 
-  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA>  >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++)
-    {
-      const MEDFileAnyTypeField1TSWithoutSDA *tmp(*it);
-      if(tmp)
-        {
-          int it2,ord;
-          tmp->getTime(it2,ord);
-          if(it2==iteration && order==ord)
-            return ret;
-          else
-            oss << "(" << it2 << ","  << ord << "), ";
-        }
-    }
-  throw INTERP_KERNEL::Exception(oss.str());
+  med_field_type typcha;
+  std::vector<std::string> infos;
+  std::string dtunit;
+  std::string meshName;
+  int i(-1);
+  MEDFileAnyTypeField1TS::LocateField(fid,fieldName,i,typcha,infos,dtunit,meshName);
+  MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret;
+  switch(typcha)
+  {
+    case MED_FLOAT64:
+      {
+        ret=new MEDFileFieldMultiTSWithoutSDA(fid,i,loadAll,ms,entities);
+        break;
+      }
+    case MED_INT32:
+      {
+        ret=new MEDFileIntFieldMultiTSWithoutSDA(fid,i,loadAll,ms,entities);
+        break;
+      }
+    case MED_NODE://6432
+      {
+        ret=new MEDFileFloatFieldMultiTSWithoutSDA(fid,i,loadAll,ms,entities);
+        break;
+      }
+    default:
+      {
+        std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::BuildContentFrom(fid,fieldName) : file \'" << FileNameFromFID(fid) << "\' contains field with name \'" << fieldName << "\' but the type of field is not in [MED_FLOAT64, MED_INT32, MED_FLOAT32] !";
+        throw INTERP_KERNEL::Exception(oss.str());
+      }
+  }
+  ret->setMeshName(meshName);
+  ret->setDtUnit(dtunit.c_str());
+  return ret.retn();
 }
 
-int MEDFileAnyTypeFieldMultiTSWithoutSDA::getPosGivenTime(double time, double eps) const
+MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFrom(med_idt fid, bool loadAll, const MEDFileMeshes *ms)
 {
-  int ret=0;
-  std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::getPosGivenTime : No such time step " << time << "! \nPossibilities are : ";
-  oss.precision(15);
-  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA>  >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++)
+  med_field_type typcha;
+  //
+  std::vector<std::string> infos;
+  std::string dtunit,fieldName,meshName;
+  MEDFileAnyTypeField1TS::LocateField2(fid,0,true,fieldName,typcha,infos,dtunit,meshName);
+  MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret;
+  switch(typcha)
+  {
+    case MED_FLOAT64:
+      {
+        ret=new MEDFileFieldMultiTSWithoutSDA(fid,0,loadAll,ms,0);
+        break;
+      }
+    case MED_INT32:
+      {
+        ret=new MEDFileIntFieldMultiTSWithoutSDA(fid,0,loadAll,ms,0);
+        break;
+      }
+    case MED_NODE://6432
+      {
+        ret=new MEDFileFloatFieldMultiTSWithoutSDA(fid,0,loadAll,ms,0);
+        break;
+      }
+    default:
+      {
+        std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::BuildContentFrom(fid) : file \'" << FileNameFromFID(fid) << "\' contains field with name \'" << fieldName << "\' but the type of the first field is not in [MED_FLOAT64, MED_INT32, MED_FLOAT32] !";
+        throw INTERP_KERNEL::Exception(oss.str());
+      }
+  }
+  ret->setMeshName(meshName);
+  ret->setDtUnit(dtunit.c_str());
+  return ret.retn();
+}
+
+MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent(MEDFileAnyTypeFieldMultiTSWithoutSDA *c)
+{
+  if(!c)
+    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent : empty content in input : unable to build a new instance !");
+  if(dynamic_cast<const MEDFileFieldMultiTSWithoutSDA *>(c))
     {
-      const MEDFileAnyTypeField1TSWithoutSDA *tmp(*it);
-      if(tmp)
-        {
-          int it2,ord;
-          double ti=tmp->getTime(it2,ord);
-          if(fabs(time-ti)<eps)
-            return ret;
-          else
-            oss << ti << ", ";
-        }
+      MCAuto<MEDFileFieldMultiTS> ret(MEDFileFieldMultiTS::New());
+      ret->_content=c;  c->incrRef();
+      return ret.retn();
     }
-  throw INTERP_KERNEL::Exception(oss.str());
+  if(dynamic_cast<const MEDFileIntFieldMultiTSWithoutSDA *>(c))
+    {
+      MCAuto<MEDFileIntFieldMultiTS> ret(MEDFileIntFieldMultiTS::New());
+      ret->_content=c;  c->incrRef();
+      return ret.retn();
+    }
+  throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent : internal error ! a content of type different from FLOAT64 and INT32 has been built but not intercepted !");
 }
 
-std::vector< std::pair<int,int> > MEDFileAnyTypeFieldMultiTSWithoutSDA::getIterations() const
+MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent(MEDFileAnyTypeFieldMultiTSWithoutSDA *c, med_idt fid)
 {
-  int lgth=_time_steps.size();
-  std::vector< std::pair<int,int> > ret(lgth);
-  for(int i=0;i<lgth;i++)
-    _time_steps[i]->fillIteration(ret[i]);
+  MEDFileAnyTypeFieldMultiTS *ret(BuildNewInstanceFromContent(c));
+  std::string fileName(FileNameFromFID(fid));
+  ret->setFileName(fileName);
   return ret;
 }
 
+MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities)
+try:MEDFileFieldGlobsReal(fid)
+{
+  _content=BuildContentFrom(fid,fieldName,loadAll,ms,entities);
+  loadGlobals(fid);
+}
+catch(INTERP_KERNEL::Exception& e)
+{
+    throw e;
+}
+
+//= MEDFileAnyTypeFieldMultiTS
+
 /*!
- * This method has 3 inputs 'iteration' 'order' 'mname'. 'mname' can be null if the user is the general case where there is only one meshName lying on 'this'
- * This method returns two things.
- * - The absolute dimension of 'this' in first parameter. 
- * - The available ext levels relative to the absolute dimension returned in first parameter. These relative levels are relative
- *   to the first output parameter. The values in 'levs' will be returned in decreasing order.
- *
- * This method is designed for MEDFileFieldMultiTS instances that have a discritization ON_CELLS, ON_GAUSS_NE and ON_GAUSS.
- * Only these 3 discretizations will be taken into account here.
- *
- * If 'this' is empty this method will throw an INTERP_KERNEL::Exception.
- * If there is \b only node fields defined in 'this' -1 is returned and 'levs' output parameter will be empty. In this
- * case the caller has to know the underlying mesh it refers to. By defaut it is the level 0 of the corresponding mesh.
- *
- * This method is usefull to make the link between meshDimension of the underlying mesh in 'this' and the levels on 'this'.
- * It is possible (even if it is not common) that the highest level in 'this' were not equal to the meshDimension of the underlying mesh in 'this'.
- * 
- * Let's consider the typical following case :
- * - a mesh 'm1' has a meshDimension 3 and has the following non empty levels
- * [0,-1,-2] for example 'm1' lies on TETRA4, HEXA8 TRI3 and SEG2
- * - 'f1' lies on 'm1' and is defined on 3D and 1D cells for example
- *   TETRA4 and SEG2
- * - 'f2' lies on 'm1' too and is defined on 2D and 1D cells for example TRI3 and SEG2
- *
- * In this case f1->getNonEmptyLevelsExt will return (3,[0,-2]) and f2->getNonEmptyLevelsExt will return (2,[0,-1])
- * 
- * To retrieve the highest level of f1 it should be done, f1->getFieldAtLevel(ON_CELLS,3-3+0);//absDim-meshDim+relativeLev
- * To retrieve the lowest level of f1 it should be done, f1->getFieldAtLevel(ON_CELLS,3-3+(-2));//absDim-meshDim+relativeLev
- * To retrieve the highest level of f2 it should be done, f1->getFieldAtLevel(ON_CELLS,2-3+0);//absDim-meshDim+relativeLev
- * To retrieve the lowest level of f2 it should be done, f1->getFieldAtLevel(ON_CELLS,2-3+(-1));//absDim-meshDim+relativeLev
+ * Returns a new instance of MEDFileFieldMultiTS or MEDFileIntFieldMultiTS holding data of the first field
+ * that has been read from a specified MED file.
+ *  \param [in] fileName - the name of the MED file to read.
+ *  \return MEDFileFieldMultiTS * - a new instance of MEDFileFieldMultiTS or MEDFileIntFieldMultiTS. The caller
+ *          is to delete this field using decrRef() as it is no more needed.
+ *  \throw If reading the file fails.
  */
-int MEDFileAnyTypeFieldMultiTSWithoutSDA::getNonEmptyLevels(int iteration, int order, const std::string& mname, std::vector<int>& levs) const
+MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(const std::string& fileName, bool loadAll)
 {
-  return getTimeStepEntry(iteration,order).getNonEmptyLevels(mname,levs);
+  MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
+  return New(fid,loadAll);
 }
 
-const MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepAtPos2(int pos) const
+MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(med_idt fid, bool loadAll)
 {
-  if(pos<0 || pos>=(int)_time_steps.size())
-    {
-      std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepAtPos2 : request for pos #" << pos << " whereas should be in [0," << _time_steps.size() << ") !";
-      throw INTERP_KERNEL::Exception(oss.str());
-    }
-  const MEDFileAnyTypeField1TSWithoutSDA *item=_time_steps[pos];
-  if(item==0)
-    {
-      std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepAtPos2 : request for pos #" << pos << ", this pos id exists but the underlying Field1TS is null !";
-      oss << "\nTry to use following method eraseEmptyTS !";
-      throw INTERP_KERNEL::Exception(oss.str());
-    }
-  return item;
+  MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> c(BuildContentFrom(fid,loadAll,0));
+  MCAuto<MEDFileAnyTypeFieldMultiTS> ret(BuildNewInstanceFromContent(c,fid));
+  ret->loadGlobals(fid);
+  return ret.retn();
 }
 
-MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepAtPos2(int pos)
+/*!
+ * Returns a new instance of MEDFileFieldMultiTS or MEDFileIntFieldMultiTS holding data of a given field
+ * that has been read from a specified MED file.
+ *  \param [in] fileName - the name of the MED file to read.
+ *  \param [in] fieldName - the name of the field to read.
+ *  \return MEDFileFieldMultiTS * - a new instance of MEDFileFieldMultiTS or MEDFileIntFieldMultiTS. The caller
+ *          is to delete this field using decrRef() as it is no more needed.
+ *  \throw If reading the file fails.
+ *  \throw If there is no field named \a fieldName in the file.
+ */
+MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(const std::string& fileName, const std::string& fieldName, bool loadAll)
 {
-  if(pos<0 || pos>=(int)_time_steps.size())
+  MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
+  return New(fid,fieldName,loadAll);
+}
+
+MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(med_idt fid, const std::string& fieldName, bool loadAll)
+{
+  MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> c(BuildContentFrom(fid,fieldName,loadAll,0,0));
+  MCAuto<MEDFileAnyTypeFieldMultiTS> ret(BuildNewInstanceFromContent(c,fid));
+  ret->loadGlobals(fid);
+  return ret.retn();
+}
+
+/*!
+ * This constructor is a shallow copy constructor. If \a shallowCopyOfContent is true the content of \a other is shallow copied.
+ * If \a shallowCopyOfContent is false, \a other is taken to be the content of \a this.
+ *
+ * \warning this is a shallow copy constructor
+ */
+MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS(const MEDFileAnyTypeFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent)
+{
+  if(!shallowCopyOfContent)
     {
-      std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepAtPos2 : request for pos #" << pos << " whereas should be in [0," << _time_steps.size() << ") !";
-      throw INTERP_KERNEL::Exception(oss.str());
+      const MEDFileAnyTypeFieldMultiTSWithoutSDA *otherPtr(&other);
+      otherPtr->incrRef();
+      _content=const_cast<MEDFileAnyTypeFieldMultiTSWithoutSDA *>(otherPtr);
     }
-  MEDFileAnyTypeField1TSWithoutSDA *item=_time_steps[pos];
-  if(item==0)
+  else
     {
-      std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepAtPos2 : request for pos #" << pos << ", this pos id exists but the underlying Field1TS is null !";
-      oss << "\nTry to use following method eraseEmptyTS !";
-      throw INTERP_KERNEL::Exception(oss.str());
+      _content=other.shallowCpy();
     }
-  return item;
 }
 
-std::vector<std::string> MEDFileAnyTypeFieldMultiTSWithoutSDA::getPflsReallyUsed2() const
+MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::contentNotNullBase()
 {
-  std::vector<std::string> ret;
-  std::set<std::string> ret2;
-  for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
-    {
-      std::vector<std::string> tmp=(*it)->getPflsReallyUsed2();
-      for(std::vector<std::string>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
-        if(ret2.find(*it2)==ret2.end())
-          {
-            ret.push_back(*it2);
-            ret2.insert(*it2);
-          }
-    }
+  MEDFileAnyTypeFieldMultiTSWithoutSDA *ret=_content;
+  if(!ret)
+    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS : content is expected to be not null !");
   return ret;
 }
 
-std::vector<std::string> MEDFileAnyTypeFieldMultiTSWithoutSDA::getLocsReallyUsed2() const
+const MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::contentNotNullBase() const
 {
-  std::vector<std::string> ret;
-  std::set<std::string> ret2;
-  for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
-    {
-      std::vector<std::string> tmp=(*it)->getLocsReallyUsed2();
-      for(std::vector<std::string>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
-        if(ret2.find(*it2)==ret2.end())
-          {
-            ret.push_back(*it2);
-            ret2.insert(*it2);
-          }
-    }
+  const MEDFileAnyTypeFieldMultiTSWithoutSDA *ret=_content;
+  if(!ret)
+    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS : const content is expected to be not null !");
   return ret;
 }
 
-std::vector<std::string> MEDFileAnyTypeFieldMultiTSWithoutSDA::getPflsReallyUsedMulti2() const
+std::vector<std::string> MEDFileAnyTypeFieldMultiTS::getPflsReallyUsed() const
 {
-  std::vector<std::string> ret;
-  for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
-    {
-      std::vector<std::string> tmp=(*it)->getPflsReallyUsedMulti2();
-      ret.insert(ret.end(),tmp.begin(),tmp.end());
-    }
-  return ret;
+  return contentNotNullBase()->getPflsReallyUsed2();
 }
 
-std::vector<std::string> MEDFileAnyTypeFieldMultiTSWithoutSDA::getLocsReallyUsedMulti2() const
+std::vector<std::string> MEDFileAnyTypeFieldMultiTS::getLocsReallyUsed() const
 {
-  std::vector<std::string> ret;
-  for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
-    {
-      std::vector<std::string> tmp=(*it)->getLocsReallyUsedMulti2();
-      ret.insert(ret.end(),tmp.begin(),tmp.end());
-    }
-  return ret;
+  return contentNotNullBase()->getLocsReallyUsed2();
 }
 
-void MEDFileAnyTypeFieldMultiTSWithoutSDA::changePflsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
+std::vector<std::string> MEDFileAnyTypeFieldMultiTS::getPflsReallyUsedMulti() const
 {
-  for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
-    (*it)->changePflsRefsNamesGen2(mapOfModif);
+  return contentNotNullBase()->getPflsReallyUsedMulti2();
 }
 
-void MEDFileAnyTypeFieldMultiTSWithoutSDA::changeLocsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
+std::vector<std::string> MEDFileAnyTypeFieldMultiTS::getLocsReallyUsedMulti() const
 {
-  for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
-    (*it)->changeLocsRefsNamesGen2(mapOfModif);
+  return contentNotNullBase()->getLocsReallyUsedMulti2();
 }
 
-std::vector< std::vector<TypeOfField> > MEDFileAnyTypeFieldMultiTSWithoutSDA::getTypesOfFieldAvailable() const
+void MEDFileAnyTypeFieldMultiTS::changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
 {
-  int lgth=_time_steps.size();
-  std::vector< std::vector<TypeOfField> > ret(lgth);
-  for(int i=0;i<lgth;i++)
-    _time_steps[i]->fillTypesOfFieldAvailable(ret[i]);
-  return ret;
+  contentNotNullBase()->changePflsRefsNamesGen2(mapOfModif);
 }
 
-/*!
- * entry point for users that want to iterate into MEDFile DataStructure without any overhead.
- */
-std::vector< std::vector< std::pair<int,int> > > MEDFileAnyTypeFieldMultiTSWithoutSDA::getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
+void MEDFileAnyTypeFieldMultiTS::changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
 {
-  return getTimeStepEntry(iteration,order).getFieldSplitedByType(mname,types,typesF,pfls,locs);
+  contentNotNullBase()->changeLocsRefsNamesGen2(mapOfModif);
 }
 
-MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::deepCopy() const
+int MEDFileAnyTypeFieldMultiTS::getNumberOfTS() const
 {
-  MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret=shallowCpy();
-  std::size_t i=0;
-  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++)
-    {
-      if((const MEDFileAnyTypeField1TSWithoutSDA *)*it)
-        ret->_time_steps[i]=(*it)->deepCopy();
-    }
-  return ret.retn();
+  return contentNotNullBase()->getNumberOfTS();
 }
 
-std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitComponents() const
+void MEDFileAnyTypeFieldMultiTS::eraseEmptyTS()
 {
-  std::size_t sz(_infos.size()),sz2(_time_steps.size());
-  std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > ret(sz);
-  std::vector< std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > > ts(sz2);
-  for(std::size_t i=0;i<sz;i++)
-    {
-      ret[i]=shallowCpy();
-      ret[i]->_infos.resize(1); ret[i]->_infos[0]=_infos[i];
-    }
-  for(std::size_t i=0;i<sz2;i++)
-    {
-      std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > ret1=_time_steps[i]->splitComponents();
-      if(ret1.size()!=sz)
-        {
-          std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::splitComponents : At rank #" << i << " number of components is " << ret1.size() << " whereas it should be for all time steps " << sz << " !";
-          throw INTERP_KERNEL::Exception(oss.str());
-        }
-      ts[i]=ret1;
-    }
-  for(std::size_t i=0;i<sz;i++)
-    for(std::size_t j=0;j<sz2;j++)
-      ret[i]->_time_steps[j]=ts[j][i];
-  return ret;
+  contentNotNullBase()->eraseEmptyTS();
 }
 
-/*!
- * This method splits into discretization each time steps in \a this.
- * ** WARNING ** the returned instances are not compulsary defined on the same time steps series !
- */
-std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitDiscretizations() const
+void MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds(const int *startIds, const int *endIds)
 {
-  std::size_t sz(_time_steps.size());
-  std::vector< std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > > items(sz);
-  for(std::size_t i=0;i<sz;i++)
-    {
-      const MEDFileAnyTypeField1TSWithoutSDA *timeStep(_time_steps[i]);
-      if(!timeStep)
-        {
-          std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::splitDiscretizations : time step #" << i << " is null !"; 
-          throw INTERP_KERNEL::Exception(oss.str());
-        }
-      items[i]=timeStep->splitDiscretizations();  
-    }
-  //
-  std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > ret;
-  std::vector< std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > > ret2;
-  std::vector< TypeOfField > types;
-  for(std::vector< std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > >::const_iterator it0=items.begin();it0!=items.end();it0++)
-    for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++)
-      {
-        std::vector<TypeOfField> ts=(*it1)->getTypesOfFieldAvailable();
-        if(ts.size()!=1)
-          throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::splitDiscretizations : it appears that the splitting of MEDFileAnyTypeField1TSWithoutSDA::splitDiscretizations has returned invalid result !");
-        std::vector< TypeOfField >::iterator it2=std::find(types.begin(),types.end(),ts[0]);
-        if(it2==types.end())
-          types.push_back(ts[0]);
-      }
-  ret.resize(types.size()); ret2.resize(types.size());
-  for(std::vector< std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > >::const_iterator it0=items.begin();it0!=items.end();it0++)
-    for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++)
-      {
-        TypeOfField typ=(*it1)->getTypesOfFieldAvailable()[0];
-        std::size_t pos=std::distance(types.begin(),std::find(types.begin(),types.end(),typ));
-        ret2[pos].push_back(*it1);
-      }
-  for(std::size_t i=0;i<types.size();i++)
-    {
-      MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> elt(createNew());
-      for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it1=ret2[i].begin();it1!=ret2[i].end();it1++)
-        elt->pushBackTimeStep(*it1);//also updates infos in elt
-      ret[i]=elt;
-      elt->MEDFileFieldNameScope::operator=(*this);
-    }
-  return ret;
+  contentNotNullBase()->eraseTimeStepIds(startIds,endIds);
 }
 
-/*!
- * Contrary to splitDiscretizations method this method makes the hypothesis that the times series are **NOT** impacted by the splitting of multi discretization.
- */
-std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitMultiDiscrPerGeoTypes() const
+void MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds2(int bg, int end, int step)
 {
-  std::size_t sz(_time_steps.size());
-  std::vector< std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > > items(sz);
-  std::size_t szOut(std::numeric_limits<std::size_t>::max());
-  for(std::size_t i=0;i<sz;i++)
-    {
-      const MEDFileAnyTypeField1TSWithoutSDA *timeStep(_time_steps[i]);
-      if(!timeStep)
-        {
-          std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::splitMultiDiscrPerGeoTypes : time step #" << i << " is null !";
-          throw INTERP_KERNEL::Exception(oss.str());
-        }
-      items[i]=timeStep->splitMultiDiscrPerGeoTypes();
-      if(szOut==std::numeric_limits<std::size_t>::max())
-        szOut=items[i].size();
-      else
-        if(items[i].size()!=szOut)
-          throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::splitMultiDiscrPerGeoTypes : The splitting per discretization is expected to be same among time steps !");
-    }
-  if(szOut==std::numeric_limits<std::size_t>::max())
-    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::splitMultiDiscrPerGeoTypes : empty field !");
-  std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > ret(szOut);
-  for(std::size_t i=0;i<szOut;i++)
-    {
-      MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> elt(createNew());
-      for(std::size_t j=0;j<sz;j++)
-        elt->pushBackTimeStep(items[j][i]);
-      ret[i]=elt;
-      elt->MEDFileFieldNameScope::operator=(*this);
-    }
-  return ret;
+  contentNotNullBase()->eraseTimeStepIds2(bg,end,step);
 }
 
-void MEDFileAnyTypeFieldMultiTSWithoutSDA::copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr)
+MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::buildSubPart(const int *startIds, const int *endIds) const
 {
-  setName(field->getName());
-  if(field->getMesh())
-    setMeshName(field->getMesh()->getName());
-  if(_name.empty())
-    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::copyTinyInfoFrom : unsupported fields with no name in MED file !");
-  if(!arr)
-    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::copyTinyInfoFrom : no array set !");
-  _infos=arr->getInfoOnComponents();
+  MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> c=contentNotNullBase()->buildFromTimeStepIds(startIds,endIds);
+  MCAuto<MEDFileAnyTypeFieldMultiTS> ret=shallowCpy();
+  ret->_content=c;
+  return ret.retn();
 }
 
-void MEDFileAnyTypeFieldMultiTSWithoutSDA::checkCoherencyOfTinyInfo(const MEDCouplingFieldDouble *field, const DataArray *arr) const
+MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::buildSubPartSlice(int bg, int end, int step) const
 {
-  static const char MSG[]="MEDFileFieldMultiTSWithoutSDA::checkCoherencyOfTinyInfo : invalid ";
-  if(_name!=field->getName())
-    {
-      std::ostringstream oss; oss << MSG << "name ! should be \"" << _name;
-      oss << "\" and it is set in input field to \"" << field->getName() << "\" !";
-      throw INTERP_KERNEL::Exception(oss.str());
-    }
-  if(!arr)
-    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::checkCoherencyOfTinyInfo : no array set !");
-  checkThatComponentsMatch(arr->getInfoOnComponents());
+  MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> c=contentNotNullBase()->buildFromTimeStepIds2(bg,end,step);
+  MCAuto<MEDFileAnyTypeFieldMultiTS> ret=shallowCpy();
+  ret->_content=c;
+  return ret.retn();
 }
 
-void MEDFileAnyTypeFieldMultiTSWithoutSDA::checkThatComponentsMatch(const std::vector<std::string>& compos) const
+std::vector< std::pair<int,int> > MEDFileAnyTypeFieldMultiTS::getIterations() const
 {
-  static const char MSG[]="MEDFileFieldMultiTSWithoutSDA::checkThatComponentsMatch : ";
-  if(getInfo().size()!=compos.size())
-    {
-      std::ostringstream oss; oss << MSG << "mismatch of number of components between this (" << getInfo().size() << ") and ";
-      oss << " number of components of element to append (" << compos.size() << ") !";
-      throw INTERP_KERNEL::Exception(oss.str());
-    }
-  if(_infos!=compos)
-    {
-      std::ostringstream oss; oss << MSG << "components have same size but are different ! should be \"";
-      std::copy(_infos.begin(),_infos.end(),std::ostream_iterator<std::string>(oss,", "));
-      oss << " But compo in input fields are : ";
-      std::copy(compos.begin(),compos.end(),std::ostream_iterator<std::string>(oss,", "));
-      oss << " !";
-      throw INTERP_KERNEL::Exception(oss.str());
-    }
+  return contentNotNullBase()->getIterations();
 }
 
-void MEDFileAnyTypeFieldMultiTSWithoutSDA::checkThatNbOfCompoOfTSMatchThis() const
+void MEDFileAnyTypeFieldMultiTS::pushBackTimeSteps(const std::vector<MEDFileAnyTypeField1TS *>& f1ts)
 {
-  std::size_t sz=_infos.size();
-  int j=0;
-  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,j++)
+  for(std::vector<MEDFileAnyTypeField1TS *>::const_iterator it=f1ts.begin();it!=f1ts.end();it++)
+    pushBackTimeStep(*it);
+}
+
+void MEDFileAnyTypeFieldMultiTS::pushBackTimeSteps(MEDFileAnyTypeFieldMultiTS *fmts)
+{
+  if(!fmts)
+    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::pushBackTimeSteps : Input fmts is NULL !");
+  int nbOfTS(fmts->getNumberOfTS());
+  for(int i=0;i<nbOfTS;i++)
     {
-      const MEDFileAnyTypeField1TSWithoutSDA *elt(*it);
-      if(elt)
-        if(elt->getInfo().size()!=sz)
-          {
-            std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::checkThatNbOfCompoOfTSMatchThis : At pos #" << j << " the number of components is equal to ";
-            oss << elt->getInfo().size() << " whereas it is expected to be equal to " << sz << " !";
-            throw INTERP_KERNEL::Exception(oss.str());
-          }
+      MCAuto<MEDFileAnyTypeField1TS> elt(fmts->getTimeStepAtPos(i));
+      pushBackTimeStep(elt);
     }
 }
 
-void MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob)
+void MEDFileAnyTypeFieldMultiTS::pushBackTimeStep(MEDFileAnyTypeField1TS *f1ts)
 {
-  if(!field)
-    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldNoProfileSBT : input field is NULL !");
-  if(!_time_steps.empty())
-    checkCoherencyOfTinyInfo(field,arr);
-  MEDFileAnyTypeField1TSWithoutSDA *objC=createNew1TSWithoutSDAEmptyInstance();
-  MCAuto<MEDFileAnyTypeField1TSWithoutSDA> obj(objC);
-  objC->setFieldNoProfileSBT(field,arr,glob,*this);
-  copyTinyInfoFrom(field,arr);
-  _time_steps.push_back(obj);
-}
-
-void MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob)
-{
-  if(!field)
-    throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTSWithoutSDA::appendFieldNoProfileSBT : input field is NULL !");
-  if(!_time_steps.empty())
-    checkCoherencyOfTinyInfo(field,arr);
-  MEDFileAnyTypeField1TSWithoutSDA *objC=createNew1TSWithoutSDAEmptyInstance();
-  MCAuto<MEDFileAnyTypeField1TSWithoutSDA> obj(objC);
-  objC->setFieldProfile(field,arr,mesh,meshDimRelToMax,profile,glob,*this);
-  copyTinyInfoFrom(field,arr);
-  setMeshName(objC->getMeshName());
-  _time_steps.push_back(obj);
+  if(!f1ts)
+    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::pushBackTimeStep : input pointer is NULL !");
+  checkCoherencyOfType(f1ts);
+  f1ts->incrRef();
+  MCAuto<MEDFileAnyTypeField1TS> f1tsSafe(f1ts);
+  MEDFileAnyTypeField1TSWithoutSDA *c=f1ts->contentNotNullBase();
+  c->incrRef();
+  MCAuto<MEDFileAnyTypeField1TSWithoutSDA> cSafe(c);
+  if(!((MEDFileAnyTypeFieldMultiTSWithoutSDA *)_content))
+    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::pushBackTimeStep : no content in this !");
+  _content->pushBackTimeStep(cSafe);
+  appendGlobs(*f1ts,1e-12);
 }
 
-void MEDFileAnyTypeFieldMultiTSWithoutSDA::setIteration(int i, MCAuto<MEDFileAnyTypeField1TSWithoutSDA> ts)
+void MEDFileAnyTypeFieldMultiTS::synchronizeNameScope()
 {
-  int sz=(int)_time_steps.size();
-  if(i<0 || i>=sz)
-    {
-      std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::setIteration : trying to set element at place #" << i << " should be in [0," << sz << ") !";
-      throw INTERP_KERNEL::Exception(oss.str());
-    }
-  const MEDFileAnyTypeField1TSWithoutSDA *tsPtr(ts);
-  if(tsPtr)
-    {
-      if(tsPtr->getNumberOfComponents()!=(int)_infos.size())
-        {
-          std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::setIteration : trying to set element with " << tsPtr->getNumberOfComponents() << " components ! Should be " << _infos.size() <<  " !";
-          throw INTERP_KERNEL::Exception(oss.str());
-        }
-    }
-  _time_steps[i]=ts;
+  contentNotNullBase()->synchronizeNameScope();
 }
 
-//= MEDFileFieldMultiTSWithoutSDA
-
-MEDFileFieldMultiTSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::New(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities)
+int MEDFileAnyTypeFieldMultiTS::getPosOfTimeStep(int iteration, int order) const
 {
-  return new MEDFileFieldMultiTSWithoutSDA(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities);
+  return contentNotNullBase()->getPosOfTimeStep(iteration,order);
 }
 
-MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA()
+int MEDFileAnyTypeFieldMultiTS::getPosGivenTime(double time, double eps) const
 {
+  return contentNotNullBase()->getPosGivenTime(time,eps);
 }
 
-MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName):MEDFileAnyTypeFieldMultiTSWithoutSDA(fieldName,meshName)
+int MEDFileAnyTypeFieldMultiTS::getNonEmptyLevels(int iteration, int order, const std::string& mname, std::vector<int>& levs) const
 {
+  return contentNotNullBase()->getNonEmptyLevels(iteration,order,mname,levs);
 }
 
-/*!
- * \param [in] fieldId field id in C mode
- */
-MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities)
-try:MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldId,loadAll,ms,entities)
+std::vector< std::vector<TypeOfField> > MEDFileAnyTypeFieldMultiTS::getTypesOfFieldAvailable() const
 {
+  return contentNotNullBase()->getTypesOfFieldAvailable();
 }
-catch(INTERP_KERNEL::Exception& e)
-{ throw e; }
 
-MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities)
-try:MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities)
+std::vector< std::vector< std::pair<int,int> > > MEDFileAnyTypeFieldMultiTS::getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
 {
+  return contentNotNullBase()->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
 }
-catch(INTERP_KERNEL::Exception& e)
-{ throw e; }
 
-MEDFileAnyTypeField1TSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::createNew1TSWithoutSDAEmptyInstance() const
+std::string MEDFileAnyTypeFieldMultiTS::getName() const
 {
-  return new MEDFileField1TSWithoutSDA;
+  return contentNotNullBase()->getName();
 }
 
-void MEDFileFieldMultiTSWithoutSDA::checkCoherencyOfType(const MEDFileAnyTypeField1TSWithoutSDA *f1ts) const
+void MEDFileAnyTypeFieldMultiTS::setName(const std::string& name)
 {
-  if(!f1ts)
-    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::checkCoherencyOfType : input field1TS is NULL ! Impossible to check !");
-  const MEDFileField1TSWithoutSDA *f1tsC=dynamic_cast<const MEDFileField1TSWithoutSDA *>(f1ts);
-  if(!f1tsC)
-    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::checkCoherencyOfType : the input field1TS is not a FLOAT64 type !");
+  contentNotNullBase()->setName(name);
 }
 
-const char *MEDFileFieldMultiTSWithoutSDA::getTypeStr() const
+std::string MEDFileAnyTypeFieldMultiTS::getDtUnit() const
 {
-  return MEDFileField1TSWithoutSDA::TYPE_STR;
+  return contentNotNullBase()->getDtUnit();
 }
 
-MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::shallowCpy() const
+void MEDFileAnyTypeFieldMultiTS::setDtUnit(const std::string& dtUnit)
 {
-  return new MEDFileFieldMultiTSWithoutSDA(*this);
+  contentNotNullBase()->setDtUnit(dtUnit);
 }
 
-MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::createNew() const
+void MEDFileAnyTypeFieldMultiTS::simpleRepr(int bkOffset, std::ostream& oss, int fmtsId) const
 {
-  return new MEDFileFieldMultiTSWithoutSDA;
+  contentNotNullBase()->simpleRepr(bkOffset,oss,fmtsId);
 }
 
-/*!
- * entry point for users that want to iterate into MEDFile DataStructure with a reduced overhead because output arrays are extracted (created) specially
- * for the call of this method. That's why the DataArrayDouble instance in returned vector of vector should be dealed by the caller.
- */
-std::vector< std::vector<DataArrayDouble *> > MEDFileFieldMultiTSWithoutSDA::getFieldSplitedByType2(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
+std::vector< std::pair<int,int> > MEDFileAnyTypeFieldMultiTS::getTimeSteps(std::vector<double>& ret1) const
 {
-  const MEDFileAnyTypeField1TSWithoutSDA& myF1TS=getTimeStepEntry(iteration,order);
-  const MEDFileField1TSWithoutSDA *myF1TSC=dynamic_cast<const MEDFileField1TSWithoutSDA *>(&myF1TS);
-  if(!myF1TSC)
-    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::getFieldSplitedByType2 : mismatch of type of field expecting FLOAT64 !");
-  return myF1TSC->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
+  return contentNotNullBase()->getTimeSteps(ret1);
 }
 
-MEDFileIntFieldMultiTSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::convertToInt() const
+std::string MEDFileAnyTypeFieldMultiTS::getMeshName() const
 {
-  MCAuto<MEDFileIntFieldMultiTSWithoutSDA> ret(new MEDFileIntFieldMultiTSWithoutSDA);
-  ret->MEDFileAnyTypeFieldMultiTSWithoutSDA::operator =(*this);
-  int i=0;
-  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++)
-    {
-      const MEDFileAnyTypeField1TSWithoutSDA *eltToConv(*it);
-      if(eltToConv)
-        {
-          const MEDFileField1TSWithoutSDA *eltToConvC=dynamic_cast<const MEDFileField1TSWithoutSDA *>(eltToConv);
-          if(!eltToConvC)
-            throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::convertToInt : presence of an invalid 1TS type ! Should be of type FLOAT64 !");
-          MCAuto<MEDFileAnyTypeField1TSWithoutSDA> elt=eltToConvC->convertToInt();
-          ret->setIteration(i,elt);
-        }
-    }
-  return ret.retn();
+  return contentNotNullBase()->getMeshName();
 }
 
-//= MEDFileAnyTypeFieldMultiTS
-
-MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS()
+void MEDFileAnyTypeFieldMultiTS::setMeshName(const std::string& newMeshName)
 {
+  contentNotNullBase()->setMeshName(newMeshName);
 }
 
-MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms)
-try:MEDFileFieldGlobsReal(fid)
-{
-  _content=BuildContentFrom(fid,loadAll,ms);
-  loadGlobals(fid);
-}
-catch(INTERP_KERNEL::Exception& e)
+bool MEDFileAnyTypeFieldMultiTS::changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab)
 {
-    throw e;
+  return contentNotNullBase()->changeMeshNames(modifTab);
 }
 
-MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFrom(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities)
+const std::vector<std::string>& MEDFileAnyTypeFieldMultiTS::getInfo() const
 {
-  med_field_type typcha;
-  std::vector<std::string> infos;
-  std::string dtunit;
-  std::string meshName;
-  int i(-1);
-  MEDFileAnyTypeField1TS::LocateField(fid,fieldName,i,typcha,infos,dtunit,meshName);
-  MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret;
-  switch(typcha)
-  {
-    case MED_FLOAT64:
-      {
-        ret=new MEDFileFieldMultiTSWithoutSDA(fid,i,loadAll,ms,entities);
-        break;
-      }
-    case MED_INT32:
-      {
-        ret=new MEDFileIntFieldMultiTSWithoutSDA(fid,i,loadAll,ms,entities);
-        break;
-      }
-    default:
-      {
-        std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::BuildContentFrom(fid,fieldName) : file \'" << FileNameFromFID(fid) << "\' contains field with name \'" << fieldName << "\' but the type of field is not in [MED_FLOAT64, MED_INT32] !";
-        throw INTERP_KERNEL::Exception(oss.str());
-      }
-  }
-  ret->setMeshName(meshName);
-  ret->setDtUnit(dtunit.c_str());
-  return ret.retn();
+  return contentNotNullBase()->getInfo();
 }
 
-MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFrom(med_idt fid, bool loadAll, const MEDFileMeshes *ms)
+bool MEDFileAnyTypeFieldMultiTS::presenceOfMultiDiscPerGeoType() const
 {
-  med_field_type typcha;
-  //
-  std::vector<std::string> infos;
-  std::string dtunit,fieldName,meshName;
-  MEDFileAnyTypeField1TS::LocateField2(fid,0,true,fieldName,typcha,infos,dtunit,meshName);
-  MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret;
-  switch(typcha)
-  {
-    case MED_FLOAT64:
-      {
-        ret=new MEDFileFieldMultiTSWithoutSDA(fid,0,loadAll,ms,0);
-        break;
-      }
-    case MED_INT32:
-      {
-        ret=new MEDFileIntFieldMultiTSWithoutSDA(fid,0,loadAll,ms,0);
-        break;
-      }
-    default:
-      {
-        std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::BuildContentFrom(fid) : file \'" << FileNameFromFID(fid) << "\' contains field with name \'" << fieldName << "\' but the type of the first field is not in [MED_FLOAT64, MED_INT32] !";
-        throw INTERP_KERNEL::Exception(oss.str());
-      }
-  }
-  ret->setMeshName(meshName);
-  ret->setDtUnit(dtunit.c_str());
-  return ret.retn();
+  return contentNotNullBase()->presenceOfMultiDiscPerGeoType();
 }
 
-MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent(MEDFileAnyTypeFieldMultiTSWithoutSDA *c)
+void MEDFileAnyTypeFieldMultiTS::setInfo(const std::vector<std::string>& info)
 {
-  if(!c)
-    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent : empty content in input : unable to build a new instance !");
-  if(dynamic_cast<const MEDFileFieldMultiTSWithoutSDA *>(c))
-    {
-      MCAuto<MEDFileFieldMultiTS> ret(MEDFileFieldMultiTS::New());
-      ret->_content=c;  c->incrRef();
-      return ret.retn();
-    }
-  if(dynamic_cast<const MEDFileIntFieldMultiTSWithoutSDA *>(c))
-    {
-      MCAuto<MEDFileIntFieldMultiTS> ret(MEDFileIntFieldMultiTS::New());
-      ret->_content=c;  c->incrRef();
-      return ret.retn();
-    }
-  throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent : internal error ! a content of type different from FLOAT64 and INT32 has been built but not intercepted !");
+  return contentNotNullBase()->setInfo(info);
 }
 
-MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent(MEDFileAnyTypeFieldMultiTSWithoutSDA *c, med_idt fid)
+int MEDFileAnyTypeFieldMultiTS::getNumberOfComponents() const
 {
-  MEDFileAnyTypeFieldMultiTS *ret(BuildNewInstanceFromContent(c));
-  std::string fileName(FileNameFromFID(fid));
-  ret->setFileName(fileName);
-  return ret;
+  const std::vector<std::string> ret=getInfo();
+  return (int)ret.size();
 }
 
-MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities)
-try:MEDFileFieldGlobsReal(fid)
-{
-  _content=BuildContentFrom(fid,fieldName,loadAll,ms,entities);
-  loadGlobals(fid);
-}
-catch(INTERP_KERNEL::Exception& e)
+void MEDFileAnyTypeFieldMultiTS::writeLL(med_idt fid) const
 {
-    throw e;
+  writeGlobals(fid,*this);
+  contentNotNullBase()->writeLL(fid,*this);
 }
 
-//= MEDFileIntFieldMultiTSWithoutSDA
-
-MEDFileIntFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTSWithoutSDA::New(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities)
+/*!
+ * This method alloc the arrays and load potentially huge arrays contained in this field.
+ * This method should be called when a MEDFileAnyTypeFieldMultiTS::New constructor has been with false as the last parameter.
+ * This method can be also called to refresh or reinit values from a file.
+ * 
+ * \throw If the fileName is not set or points to a non readable MED file.
+ */
+void MEDFileAnyTypeFieldMultiTS::loadArrays()
 {
-  return new MEDFileIntFieldMultiTSWithoutSDA(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities);
+  if(getFileName().empty())
+    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::loadArrays : the structure does not come from a file !");
+  MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(getFileName()));
+  contentNotNullBase()->loadBigArraysRecursively(fid,*contentNotNullBase());
 }
 
-MEDFileIntFieldMultiTSWithoutSDA::MEDFileIntFieldMultiTSWithoutSDA()
+/*!
+ * This method behaves as MEDFileAnyTypeFieldMultiTS::loadArrays does, the first call, if \a this was built using a file without loading big arrays.
+ * But once data loaded once, this method does nothing.
+ * 
+ * \throw If the fileName is not set or points to a non readable MED file.
+ * \sa MEDFileAnyTypeFieldMultiTS::loadArrays, MEDFileAnyTypeFieldMultiTS::unloadArrays
+ */
+void MEDFileAnyTypeFieldMultiTS::loadArraysIfNecessary()
 {
+  if(!getFileName().empty())
+    {
+      MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(getFileName()));
+      contentNotNullBase()->loadBigArraysRecursivelyIfNecessary(fid,*contentNotNullBase());
+    }
 }
 
-MEDFileIntFieldMultiTSWithoutSDA::MEDFileIntFieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName):MEDFileAnyTypeFieldMultiTSWithoutSDA(fieldName,meshName)
+/*!
+ * This method releases potentially big data arrays and so returns to the same heap memory than status loaded with 'loadAll' parameter set to false.
+ * \b WARNING, this method does release arrays even if \a this does not come from a load of a MED file.
+ * So this method can lead to a loss of data. If you want to unload arrays safely call MEDFileAnyTypeFieldMultiTS::unloadArraysWithoutDataLoss instead.
+ * 
+ * \sa MEDFileAnyTypeFieldMultiTS::loadArrays, MEDFileAnyTypeFieldMultiTS::loadArraysIfNecessary, MEDFileAnyTypeFieldMultiTS::unloadArraysWithoutDataLoss
+ */
+void MEDFileAnyTypeFieldMultiTS::unloadArrays()
 {
+  contentNotNullBase()->unloadArrays();
 }
 
-MEDFileIntFieldMultiTSWithoutSDA::MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities)
-try:MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities)
-{
-}
-catch(INTERP_KERNEL::Exception& e)
-{ throw e; }
-
 /*!
- * \param [in] fieldId field id in C mode
+ * This method potentially releases big data arrays if \a this is coming from a file. If \a this has been built from scratch this method will have no effect.
+ * This method is the symetrical method of MEDFileAnyTypeFieldMultiTS::loadArraysIfNecessary.
+ * This method is useful to reduce \b safely amount of heap memory necessary for \a this by using MED file as database.
+ * 
+ * \sa MEDFileAnyTypeFieldMultiTS::loadArraysIfNecessary
  */
-MEDFileIntFieldMultiTSWithoutSDA::MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities)
-try:MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldId,loadAll,ms,entities)
-{
-}
-catch(INTERP_KERNEL::Exception& e)
-{ throw e; }
-
-MEDFileAnyTypeField1TSWithoutSDA *MEDFileIntFieldMultiTSWithoutSDA::createNew1TSWithoutSDAEmptyInstance() const
+void MEDFileAnyTypeFieldMultiTS::unloadArraysWithoutDataLoss()
 {
-  return new MEDFileIntField1TSWithoutSDA;
+  if(!getFileName().empty())
+    contentNotNullBase()->unloadArrays();
 }
 
-void MEDFileIntFieldMultiTSWithoutSDA::checkCoherencyOfType(const MEDFileAnyTypeField1TSWithoutSDA *f1ts) const
+std::string MEDFileAnyTypeFieldMultiTS::simpleRepr() const
 {
-  if(!f1ts)
-    throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTSWithoutSDA::checkCoherencyOfType : input field1TS is NULL ! Impossible to check !");
-  const MEDFileIntField1TSWithoutSDA *f1tsC=dynamic_cast<const MEDFileIntField1TSWithoutSDA *>(f1ts);
-  if(!f1tsC)
-    throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTSWithoutSDA::checkCoherencyOfType : the input field1TS is not a INT32 type !");
+  std::ostringstream oss;
+  contentNotNullBase()->simpleRepr(0,oss,-1);
+  simpleReprGlobs(oss);
+  return oss.str();
 }
 
-const char *MEDFileIntFieldMultiTSWithoutSDA::getTypeStr() const
+std::size_t MEDFileAnyTypeFieldMultiTS::getHeapMemorySizeWithoutChildren() const
 {
-  return MEDFileIntField1TSWithoutSDA::TYPE_STR;
+  return MEDFileFieldGlobsReal::getHeapMemorySizeWithoutChildren();
 }
 
-MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTSWithoutSDA::shallowCpy() const
+std::vector<const BigMemoryObject *> MEDFileAnyTypeFieldMultiTS::getDirectChildrenWithNull() const
 {
-  return new MEDFileIntFieldMultiTSWithoutSDA(*this);
+  std::vector<const BigMemoryObject *> ret(MEDFileFieldGlobsReal::getDirectChildrenWithNull());
+  ret.push_back((const MEDFileAnyTypeFieldMultiTSWithoutSDA *)_content);
+  return ret;
 }
 
-MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTSWithoutSDA::createNew() const
+/*!
+ * This method returns as MEDFileAnyTypeFieldMultiTS new instances as number of components in \a this.
+ * The returned instances are deep copy of \a this except that for globals that are share with those contained in \a this.
+ * ** WARNING ** do no forget to rename the ouput instances to avoid to write n-times in the same MED file field !
+ */
+std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > MEDFileAnyTypeFieldMultiTS::splitComponents() const
 {
-  return new MEDFileIntFieldMultiTSWithoutSDA;
+  const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(_content);
+  if(!content)
+    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::splitComponents : no content in this ! Unable to split components !");
+  std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > contentsSplit=content->splitComponents();
+  std::size_t sz(contentsSplit.size());
+  std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret(sz);
+  for(std::size_t i=0;i<sz;i++)
+    {
+      ret[i]=shallowCpy();
+      ret[i]->_content=contentsSplit[i];
+    }
+  return ret;
 }
 
-MEDFileFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTSWithoutSDA::convertToDouble() const
+/*!
+ * This method returns as MEDFileAnyTypeFieldMultiTS new instances as number of discretizations over time steps in \a this.
+ * The returned instances are shallow copied of \a this included globals that are share with those contained in \a this.
+ */
+std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > MEDFileAnyTypeFieldMultiTS::splitDiscretizations() const
 {
-  MCAuto<MEDFileFieldMultiTSWithoutSDA> ret(new MEDFileFieldMultiTSWithoutSDA);
-  ret->MEDFileAnyTypeFieldMultiTSWithoutSDA::operator =(*this);
-  int i=0;
-  for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++)
+  const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(_content);
+  if(!content)
+    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::splitDiscretizations : no content in this ! Unable to split discretizations !");
+  std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > contentsSplit(content->splitDiscretizations());
+  std::size_t sz(contentsSplit.size());
+  std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret(sz);
+  for(std::size_t i=0;i<sz;i++)
     {
-      const MEDFileAnyTypeField1TSWithoutSDA *eltToConv(*it);
-      if(eltToConv)
-        {
-          const MEDFileIntField1TSWithoutSDA *eltToConvC=dynamic_cast<const MEDFileIntField1TSWithoutSDA *>(eltToConv);
-          if(!eltToConvC)
-            throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTSWithoutSDA::convertToInt : presence of an invalid 1TS type ! Should be of type INT32 !");
-          MCAuto<MEDFileAnyTypeField1TSWithoutSDA> elt=eltToConvC->convertToDouble();
-          ret->setIteration(i,elt);
-        }
+      ret[i]=shallowCpy();
+      ret[i]->_content=contentsSplit[i];
     }
-  return ret.retn();
+  return ret;
 }
 
-//= MEDFileAnyTypeFieldMultiTS
-
 /*!
- * Returns a new instance of MEDFileFieldMultiTS or MEDFileIntFieldMultiTS holding data of the first field
- * that has been read from a specified MED file.
- *  \param [in] fileName - the name of the MED file to read.
- *  \return MEDFileFieldMultiTS * - a new instance of MEDFileFieldMultiTS or MEDFileIntFieldMultiTS. The caller
- *          is to delete this field using decrRef() as it is no more needed.
- *  \throw If reading the file fails.
+ * This method returns as MEDFileAnyTypeFieldMultiTS new instances as number of sub-discretizations over time steps in \a this.
+ * The returned instances are shallow copied of \a this included globals that are share with those contained in \a this.
  */
-MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(const std::string& fileName, bool loadAll)
+std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > MEDFileAnyTypeFieldMultiTS::splitMultiDiscrPerGeoTypes() const
 {
-  MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
-  return New(fid,loadAll);
+  const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(_content);
+  if(!content)
+    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::splitMultiDiscrPerGeoTypes : no content in this ! Unable to split discretizations !");
+  std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > contentsSplit(content->splitMultiDiscrPerGeoTypes());
+  std::size_t sz(contentsSplit.size());
+  std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret(sz);
+  for(std::size_t i=0;i<sz;i++)
+    {
+      ret[i]=shallowCpy();
+      ret[i]->_content=contentsSplit[i];
+    }
+  return ret;
 }
 
-MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(med_idt fid, bool loadAll)
+MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::deepCopy() const
 {
-  MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> c(BuildContentFrom(fid,loadAll,0));
-  MCAuto<MEDFileAnyTypeFieldMultiTS> ret(BuildNewInstanceFromContent(c,fid));
-  ret->loadGlobals(fid);
+  MCAuto<MEDFileAnyTypeFieldMultiTS> ret=shallowCpy();
+  if((const MEDFileAnyTypeFieldMultiTSWithoutSDA *)_content)
+    ret->_content=_content->deepCopy();
+  ret->deepCpyGlobs(*this);
   return ret.retn();
 }
 
+MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> MEDFileAnyTypeFieldMultiTS::getContent()
+{
+  return _content;
+}
+
 /*!
- * Returns a new instance of MEDFileFieldMultiTS or MEDFileIntFieldMultiTS holding data of a given field
- * that has been read from a specified MED file.
- *  \param [in] fileName - the name of the MED file to read.
- *  \param [in] fieldName - the name of the field to read.
- *  \return MEDFileFieldMultiTS * - a new instance of MEDFileFieldMultiTS or MEDFileIntFieldMultiTS. The caller
- *          is to delete this field using decrRef() as it is no more needed.
- *  \throw If reading the file fails.
- *  \throw If there is no field named \a fieldName in the file.
+ * Returns a new MEDFileField1TS or MEDFileIntField1TS holding data of a given time step of \a this field.
+ *  \param [in] iteration - the iteration number of a required time step.
+ *  \param [in] order - the iteration order number of required time step.
+ *  \return MEDFileField1TS * or MEDFileIntField1TS *- a new instance of MEDFileField1TS or MEDFileIntField1TS. The caller is to
+ *          delete this field using decrRef() as it is no more needed.
+ *  \throw If there is no required time step in \a this field.
  */
-MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(const std::string& fileName, const std::string& fieldName, bool loadAll)
+MEDFileAnyTypeField1TS *MEDFileAnyTypeFieldMultiTS::getTimeStep(int iteration, int order) const
 {
-  MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
-  return New(fid,fieldName,loadAll);
+  int pos=getPosOfTimeStep(iteration,order);
+  return getTimeStepAtPos(pos);
 }
 
-MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(med_idt fid, const std::string& fieldName, bool loadAll)
+/*!
+ * Returns a new MEDFileField1TS or MEDFileIntField1TS holding data of a given time step of \a this field.
+ *  \param [in] time - the time of the time step of interest.
+ *  \param [in] eps - a precision used to compare time values.
+ *  \return MEDFileField1TS * - a new instance of MEDFileField1TS. The caller is to
+ *          delete this field using decrRef() as it is no more needed.
+ *  \throw If there is no required time step in \a this field.
+ */
+MEDFileAnyTypeField1TS *MEDFileAnyTypeFieldMultiTS::getTimeStepGivenTime(double time, double eps) const
 {
-  MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> c(BuildContentFrom(fid,fieldName,loadAll,0,0));
-  MCAuto<MEDFileAnyTypeFieldMultiTS> ret(BuildNewInstanceFromContent(c,fid));
-  ret->loadGlobals(fid);
-  return ret.retn();
+  int pos=getPosGivenTime(time,eps);
+  return getTimeStepAtPos(pos);
 }
 
 /*!
- * This constructor is a shallow copy constructor. If \a shallowCopyOfContent is true the content of \a other is shallow copied.
- * If \a shallowCopyOfContent is false, \a other is taken to be the content of \a this.
+ * This method groups not null items in \a vectFMTS per time step series. Two time series are considered equal if the list of their pair of integers iteration,order are equal.
+ * The float64 value of time attached to the pair of integers are not considered here.
+ * WARNING the returned pointers are not incremented. The caller is \b not responsible to deallocate them ! This method only reorganizes entries in \a vectFMTS.
  *
- * \warning this is a shallow copy constructor
+ * \param [in] vectFMTS - vector of not null fields defined on a same global data pointer.
+ * \throw If there is a null pointer in \a vectFMTS.
  */
-MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS(const MEDFileAnyTypeFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent)
+std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(const std::vector<MEDFileAnyTypeFieldMultiTS *>& vectFMTS)
 {
-  if(!shallowCopyOfContent)
-    {
-      const MEDFileAnyTypeFieldMultiTSWithoutSDA *otherPtr(&other);
-      otherPtr->incrRef();
-      _content=const_cast<MEDFileAnyTypeFieldMultiTSWithoutSDA *>(otherPtr);
-    }
-  else
+  static const char msg[]="MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries : presence of null instance in input vector !";
+  std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret;
+  std::list<MEDFileAnyTypeFieldMultiTS *> lstFMTS(vectFMTS.begin(),vectFMTS.end());
+  while(!lstFMTS.empty())
     {
-      _content=other.shallowCpy();
+      std::list<MEDFileAnyTypeFieldMultiTS *>::iterator it(lstFMTS.begin());
+      MEDFileAnyTypeFieldMultiTS *curIt(*it);
+      if(!curIt)
+        throw INTERP_KERNEL::Exception(msg);
+      std::vector< std::pair<int,int> > refIts=curIt->getIterations();
+      std::vector<MEDFileAnyTypeFieldMultiTS *> elt;
+      elt.push_back(curIt); it=lstFMTS.erase(it);
+      while(it!=lstFMTS.end())
+        {
+          curIt=*it;
+          if(!curIt)
+            throw INTERP_KERNEL::Exception(msg);
+          std::vector< std::pair<int,int> > curIts=curIt->getIterations();
+          if(refIts==curIts)
+            { elt.push_back(curIt); it=lstFMTS.erase(it); }
+          else
+            it++;
+        }
+      ret.push_back(elt);
     }
-}
-
-MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::contentNotNullBase()
-{
-  MEDFileAnyTypeFieldMultiTSWithoutSDA *ret=_content;
-  if(!ret)
-    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS : content is expected to be not null !");
-  return ret;
-}
-
-const MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::contentNotNullBase() const
-{
-  const MEDFileAnyTypeFieldMultiTSWithoutSDA *ret=_content;
-  if(!ret)
-    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS : const content is expected to be not null !");
   return ret;
 }
 
-std::vector<std::string> MEDFileAnyTypeFieldMultiTS::getPflsReallyUsed() const
-{
-  return contentNotNullBase()->getPflsReallyUsed2();
-}
-
-std::vector<std::string> MEDFileAnyTypeFieldMultiTS::getLocsReallyUsed() const
-{
-  return contentNotNullBase()->getLocsReallyUsed2();
-}
-
-std::vector<std::string> MEDFileAnyTypeFieldMultiTS::getPflsReallyUsedMulti() const
-{
-  return contentNotNullBase()->getPflsReallyUsedMulti2();
-}
-
-std::vector<std::string> MEDFileAnyTypeFieldMultiTS::getLocsReallyUsedMulti() const
-{
-  return contentNotNullBase()->getLocsReallyUsedMulti2();
-}
-
-void MEDFileAnyTypeFieldMultiTS::changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
-{
-  contentNotNullBase()->changePflsRefsNamesGen2(mapOfModif);
-}
-
-void MEDFileAnyTypeFieldMultiTS::changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
+/*!
+ * This method splits the input list \a vectFMTS considering the aspect of the geometrical support over time.
+ * All returned instances in a subvector can be safely loaded, rendered along time
+ * All items must be defined on the same time step ids ( see MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries method ).
+ * Each item in \a vectFMTS is expected to have one and exactly one spatial discretization along time.
+ * All items in \a vectFMTS must lie on the mesh (located by meshname and time step) and compatible with the input mesh \a mesh (having the same name than those in items).
+ * All items in \a vectFMTS whose spatial discretization is not ON_NODES will appear once.
+ * For items in \a vectFMTS that are ON_NODES it is possible to appear several times (more than once or once) in the returned vector.
+ *
+ * \param [in] vectFMTS - list of multi times step part all defined each on a same spatial discretization along time and pointing to a mesh whose name is equal to \c mesh->getName().
+ * \param [in] mesh - the mesh shared by all items in \a vectFMTS across time.
+ * \param [out] fsc - A vector having same size than returned vector. It specifies the support comporator of the corresponding vector of MEDFileAnyTypeFieldMultiTS in returned vector of vector.
+ * \return - A vector of vector of objects that contains the same pointers (objects) than thoose in \a vectFMTS except that there are organized differently. So pointers included in returned vector of vector should \b not been dealt by the caller.
+ *
+ * \throw If an element in \a vectFMTS has not only one spatial discretization set.
+ * \throw If an element in \a vectFMTS change of spatial discretization along time.
+ * \throw If an element in \a vectFMTS lies on a mesh with meshname different from those in \a mesh.
+ * \thorw If some elements in \a vectFMTS do not have the same times steps.
+ * \throw If mesh is null.
+ * \throw If an element in \a vectFMTS is null.
+ * \sa MEDFileAnyTypeFieldMultiTS::AreOnSameSupportAcrossTime
+ */
+std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(const std::vector<MEDFileAnyTypeFieldMultiTS *>& vectFMTS, const MEDFileMesh *mesh, std::vector< MCAuto<MEDFileFastCellSupportComparator> >& fsc)
 {
-  contentNotNullBase()->changeLocsRefsNamesGen2(mapOfModif);
-}
-
-int MEDFileAnyTypeFieldMultiTS::getNumberOfTS() const
-{
-  return contentNotNullBase()->getNumberOfTS();
-}
-
-void MEDFileAnyTypeFieldMultiTS::eraseEmptyTS()
-{
-  contentNotNullBase()->eraseEmptyTS();
-}
-
-void MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds(const int *startIds, const int *endIds)
-{
-  contentNotNullBase()->eraseTimeStepIds(startIds,endIds);
-}
-
-void MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds2(int bg, int end, int step)
-{
-  contentNotNullBase()->eraseTimeStepIds2(bg,end,step);
-}
-
-MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::buildSubPart(const int *startIds, const int *endIds) const
-{
-  MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> c=contentNotNullBase()->buildFromTimeStepIds(startIds,endIds);
-  MCAuto<MEDFileAnyTypeFieldMultiTS> ret=shallowCpy();
-  ret->_content=c;
-  return ret.retn();
-}
-
-MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::buildSubPartSlice(int bg, int end, int step) const
-{
-  MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> c=contentNotNullBase()->buildFromTimeStepIds2(bg,end,step);
-  MCAuto<MEDFileAnyTypeFieldMultiTS> ret=shallowCpy();
-  ret->_content=c;
-  return ret.retn();
-}
-
-std::vector< std::pair<int,int> > MEDFileAnyTypeFieldMultiTS::getIterations() const
-{
-  return contentNotNullBase()->getIterations();
-}
-
-void MEDFileAnyTypeFieldMultiTS::pushBackTimeSteps(const std::vector<MEDFileAnyTypeField1TS *>& f1ts)
-{
-  for(std::vector<MEDFileAnyTypeField1TS *>::const_iterator it=f1ts.begin();it!=f1ts.end();it++)
-    pushBackTimeStep(*it);
-}
-
-void MEDFileAnyTypeFieldMultiTS::pushBackTimeSteps(MEDFileAnyTypeFieldMultiTS *fmts)
-{
-  if(!fmts)
-    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::pushBackTimeSteps : Input fmts is NULL !");
-  int nbOfTS(fmts->getNumberOfTS());
-  for(int i=0;i<nbOfTS;i++)
-    {
-      MCAuto<MEDFileAnyTypeField1TS> elt(fmts->getTimeStepAtPos(i));
-      pushBackTimeStep(elt);
-    }
-}
-
-void MEDFileAnyTypeFieldMultiTS::pushBackTimeStep(MEDFileAnyTypeField1TS *f1ts)
-{
-  if(!f1ts)
-    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::pushBackTimeStep : input pointer is NULL !");
-  checkCoherencyOfType(f1ts);
-  f1ts->incrRef();
-  MCAuto<MEDFileAnyTypeField1TS> f1tsSafe(f1ts);
-  MEDFileAnyTypeField1TSWithoutSDA *c=f1ts->contentNotNullBase();
-  c->incrRef();
-  MCAuto<MEDFileAnyTypeField1TSWithoutSDA> cSafe(c);
-  if(!((MEDFileAnyTypeFieldMultiTSWithoutSDA *)_content))
-    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::pushBackTimeStep : no content in this !");
-  _content->pushBackTimeStep(cSafe);
-  appendGlobs(*f1ts,1e-12);
-}
-
-void MEDFileAnyTypeFieldMultiTS::synchronizeNameScope()
-{
-  contentNotNullBase()->synchronizeNameScope();
-}
-
-int MEDFileAnyTypeFieldMultiTS::getPosOfTimeStep(int iteration, int order) const
-{
-  return contentNotNullBase()->getPosOfTimeStep(iteration,order);
-}
-
-int MEDFileAnyTypeFieldMultiTS::getPosGivenTime(double time, double eps) const
-{
-  return contentNotNullBase()->getPosGivenTime(time,eps);
-}
-
-int MEDFileAnyTypeFieldMultiTS::getNonEmptyLevels(int iteration, int order, const std::string& mname, std::vector<int>& levs) const
-{
-  return contentNotNullBase()->getNonEmptyLevels(iteration,order,mname,levs);
-}
-
-std::vector< std::vector<TypeOfField> > MEDFileAnyTypeFieldMultiTS::getTypesOfFieldAvailable() const
-{
-  return contentNotNullBase()->getTypesOfFieldAvailable();
-}
-
-std::vector< std::vector< std::pair<int,int> > > MEDFileAnyTypeFieldMultiTS::getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
-{
-  return contentNotNullBase()->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
-}
-
-std::string MEDFileAnyTypeFieldMultiTS::getName() const
-{
-  return contentNotNullBase()->getName();
-}
-
-void MEDFileAnyTypeFieldMultiTS::setName(const std::string& name)
-{
-  contentNotNullBase()->setName(name);
-}
-
-std::string MEDFileAnyTypeFieldMultiTS::getDtUnit() const
-{
-  return contentNotNullBase()->getDtUnit();
-}
-
-void MEDFileAnyTypeFieldMultiTS::setDtUnit(const std::string& dtUnit)
-{
-  contentNotNullBase()->setDtUnit(dtUnit);
-}
-
-void MEDFileAnyTypeFieldMultiTS::simpleRepr(int bkOffset, std::ostream& oss, int fmtsId) const
-{
-  contentNotNullBase()->simpleRepr(bkOffset,oss,fmtsId);
-}
-
-std::vector< std::pair<int,int> > MEDFileAnyTypeFieldMultiTS::getTimeSteps(std::vector<double>& ret1) const
-{
-  return contentNotNullBase()->getTimeSteps(ret1);
-}
-
-std::string MEDFileAnyTypeFieldMultiTS::getMeshName() const
-{
-  return contentNotNullBase()->getMeshName();
-}
-
-void MEDFileAnyTypeFieldMultiTS::setMeshName(const std::string& newMeshName)
-{
-  contentNotNullBase()->setMeshName(newMeshName);
-}
-
-bool MEDFileAnyTypeFieldMultiTS::changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab)
-{
-  return contentNotNullBase()->changeMeshNames(modifTab);
-}
-
-const std::vector<std::string>& MEDFileAnyTypeFieldMultiTS::getInfo() const
-{
-  return contentNotNullBase()->getInfo();
-}
-
-bool MEDFileAnyTypeFieldMultiTS::presenceOfMultiDiscPerGeoType() const
-{
-  return contentNotNullBase()->presenceOfMultiDiscPerGeoType();
-}
-
-void MEDFileAnyTypeFieldMultiTS::setInfo(const std::vector<std::string>& info)
-{
-  return contentNotNullBase()->setInfo(info);
-}
-
-int MEDFileAnyTypeFieldMultiTS::getNumberOfComponents() const
-{
-  const std::vector<std::string> ret=getInfo();
-  return (int)ret.size();
-}
-
-void MEDFileAnyTypeFieldMultiTS::writeLL(med_idt fid) const
-{
-  writeGlobals(fid,*this);
-  contentNotNullBase()->writeLL(fid,*this);
-}
-
-/*!
- * This method alloc the arrays and load potentially huge arrays contained in this field.
- * This method should be called when a MEDFileAnyTypeFieldMultiTS::New constructor has been with false as the last parameter.
- * This method can be also called to refresh or reinit values from a file.
- * 
- * \throw If the fileName is not set or points to a non readable MED file.
- */
-void MEDFileAnyTypeFieldMultiTS::loadArrays()
-{
-  if(getFileName().empty())
-    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::loadArrays : the structure does not come from a file !");
-  MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(getFileName()));
-  contentNotNullBase()->loadBigArraysRecursively(fid,*contentNotNullBase());
-}
-
-/*!
- * This method behaves as MEDFileAnyTypeFieldMultiTS::loadArrays does, the first call, if \a this was built using a file without loading big arrays.
- * But once data loaded once, this method does nothing.
- * 
- * \throw If the fileName is not set or points to a non readable MED file.
- * \sa MEDFileAnyTypeFieldMultiTS::loadArrays, MEDFileAnyTypeFieldMultiTS::unloadArrays
- */
-void MEDFileAnyTypeFieldMultiTS::loadArraysIfNecessary()
-{
-  if(!getFileName().empty())
-    {
-      MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(getFileName()));
-      contentNotNullBase()->loadBigArraysRecursivelyIfNecessary(fid,*contentNotNullBase());
-    }
-}
-
-/*!
- * This method releases potentially big data arrays and so returns to the same heap memory than status loaded with 'loadAll' parameter set to false.
- * \b WARNING, this method does release arrays even if \a this does not come from a load of a MED file.
- * So this method can lead to a loss of data. If you want to unload arrays safely call MEDFileAnyTypeFieldMultiTS::unloadArraysWithoutDataLoss instead.
- * 
- * \sa MEDFileAnyTypeFieldMultiTS::loadArrays, MEDFileAnyTypeFieldMultiTS::loadArraysIfNecessary, MEDFileAnyTypeFieldMultiTS::unloadArraysWithoutDataLoss
- */
-void MEDFileAnyTypeFieldMultiTS::unloadArrays()
-{
-  contentNotNullBase()->unloadArrays();
-}
-
-/*!
- * This method potentially releases big data arrays if \a this is coming from a file. If \a this has been built from scratch this method will have no effect.
- * This method is the symetrical method of MEDFileAnyTypeFieldMultiTS::loadArraysIfNecessary.
- * This method is useful to reduce \b safely amount of heap memory necessary for \a this by using MED file as database.
- * 
- * \sa MEDFileAnyTypeFieldMultiTS::loadArraysIfNecessary
- */
-void MEDFileAnyTypeFieldMultiTS::unloadArraysWithoutDataLoss()
-{
-  if(!getFileName().empty())
-    contentNotNullBase()->unloadArrays();
-}
-
-std::string MEDFileAnyTypeFieldMultiTS::simpleRepr() const
-{
-  std::ostringstream oss;
-  contentNotNullBase()->simpleRepr(0,oss,-1);
-  simpleReprGlobs(oss);
-  return oss.str();
-}
-
-std::size_t MEDFileAnyTypeFieldMultiTS::getHeapMemorySizeWithoutChildren() const
-{
-  return MEDFileFieldGlobsReal::getHeapMemorySizeWithoutChildren();
-}
-
-std::vector<const BigMemoryObject *> MEDFileAnyTypeFieldMultiTS::getDirectChildrenWithNull() const
-{
-  std::vector<const BigMemoryObject *> ret(MEDFileFieldGlobsReal::getDirectChildrenWithNull());
-  ret.push_back((const MEDFileAnyTypeFieldMultiTSWithoutSDA *)_content);
-  return ret;
-}
-
-/*!
- * This method returns as MEDFileAnyTypeFieldMultiTS new instances as number of components in \a this.
- * The returned instances are deep copy of \a this except that for globals that are share with those contained in \a this.
- * ** WARNING ** do no forget to rename the ouput instances to avoid to write n-times in the same MED file field !
- */
-std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > MEDFileAnyTypeFieldMultiTS::splitComponents() const
-{
-  const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(_content);
-  if(!content)
-    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::splitComponents : no content in this ! Unable to split components !");
-  std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > contentsSplit=content->splitComponents();
-  std::size_t sz(contentsSplit.size());
-  std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret(sz);
-  for(std::size_t i=0;i<sz;i++)
-    {
-      ret[i]=shallowCpy();
-      ret[i]->_content=contentsSplit[i];
-    }
-  return ret;
-}
-
-/*!
- * This method returns as MEDFileAnyTypeFieldMultiTS new instances as number of discretizations over time steps in \a this.
- * The returned instances are shallow copied of \a this included globals that are share with those contained in \a this.
- */
-std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > MEDFileAnyTypeFieldMultiTS::splitDiscretizations() const
-{
-  const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(_content);
-  if(!content)
-    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::splitDiscretizations : no content in this ! Unable to split discretizations !");
-  std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > contentsSplit(content->splitDiscretizations());
-  std::size_t sz(contentsSplit.size());
-  std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret(sz);
-  for(std::size_t i=0;i<sz;i++)
-    {
-      ret[i]=shallowCpy();
-      ret[i]->_content=contentsSplit[i];
-    }
-  return ret;
-}
-
-/*!
- * This method returns as MEDFileAnyTypeFieldMultiTS new instances as number of sub-discretizations over time steps in \a this.
- * The returned instances are shallow copied of \a this included globals that are share with those contained in \a this.
- */
-std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > MEDFileAnyTypeFieldMultiTS::splitMultiDiscrPerGeoTypes() const
-{
-  const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(_content);
-  if(!content)
-    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::splitMultiDiscrPerGeoTypes : no content in this ! Unable to split discretizations !");
-  std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > contentsSplit(content->splitMultiDiscrPerGeoTypes());
-  std::size_t sz(contentsSplit.size());
-  std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret(sz);
-  for(std::size_t i=0;i<sz;i++)
-    {
-      ret[i]=shallowCpy();
-      ret[i]->_content=contentsSplit[i];
-    }
-  return ret;
-}
-
-MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::deepCopy() const
-{
-  MCAuto<MEDFileAnyTypeFieldMultiTS> ret=shallowCpy();
-  if((const MEDFileAnyTypeFieldMultiTSWithoutSDA *)_content)
-    ret->_content=_content->deepCopy();
-  ret->deepCpyGlobs(*this);
-  return ret.retn();
-}
-
-MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> MEDFileAnyTypeFieldMultiTS::getContent()
-{
-  return _content;
-}
-
-/*!
- * Returns a new MEDFileField1TS or MEDFileIntField1TS holding data of a given time step of \a this field.
- *  \param [in] iteration - the iteration number of a required time step.
- *  \param [in] order - the iteration order number of required time step.
- *  \return MEDFileField1TS * or MEDFileIntField1TS *- a new instance of MEDFileField1TS or MEDFileIntField1TS. The caller is to
- *          delete this field using decrRef() as it is no more needed.
- *  \throw If there is no required time step in \a this field.
- */
-MEDFileAnyTypeField1TS *MEDFileAnyTypeFieldMultiTS::getTimeStep(int iteration, int order) const
-{
-  int pos=getPosOfTimeStep(iteration,order);
-  return getTimeStepAtPos(pos);
-}
-
-/*!
- * Returns a new MEDFileField1TS or MEDFileIntField1TS holding data of a given time step of \a this field.
- *  \param [in] time - the time of the time step of interest.
- *  \param [in] eps - a precision used to compare time values.
- *  \return MEDFileField1TS * - a new instance of MEDFileField1TS. The caller is to
- *          delete this field using decrRef() as it is no more needed.
- *  \throw If there is no required time step in \a this field.
- */
-MEDFileAnyTypeField1TS *MEDFileAnyTypeFieldMultiTS::getTimeStepGivenTime(double time, double eps) const
-{
-  int pos=getPosGivenTime(time,eps);
-  return getTimeStepAtPos(pos);
-}
-
-/*!
- * This method groups not null items in \a vectFMTS per time step series. Two time series are considered equal if the list of their pair of integers iteration,order are equal.
- * The float64 value of time attached to the pair of integers are not considered here.
- * WARNING the returned pointers are not incremented. The caller is \b not responsible to deallocate them ! This method only reorganizes entries in \a vectFMTS.
- *
- * \param [in] vectFMTS - vector of not null fields defined on a same global data pointer.
- * \throw If there is a null pointer in \a vectFMTS.
- */
-std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(const std::vector<MEDFileAnyTypeFieldMultiTS *>& vectFMTS)
-{
-  static const char msg[]="MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries : presence of null instance in input vector !";
-  std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret;
-  std::list<MEDFileAnyTypeFieldMultiTS *> lstFMTS(vectFMTS.begin(),vectFMTS.end());
-  while(!lstFMTS.empty())
-    {
-      std::list<MEDFileAnyTypeFieldMultiTS *>::iterator it(lstFMTS.begin());
-      MEDFileAnyTypeFieldMultiTS *curIt(*it);
-      if(!curIt)
-        throw INTERP_KERNEL::Exception(msg);
-      std::vector< std::pair<int,int> > refIts=curIt->getIterations();
-      std::vector<MEDFileAnyTypeFieldMultiTS *> elt;
-      elt.push_back(curIt); it=lstFMTS.erase(it);
-      while(it!=lstFMTS.end())
-        {
-          curIt=*it;
-          if(!curIt)
-            throw INTERP_KERNEL::Exception(msg);
-          std::vector< std::pair<int,int> > curIts=curIt->getIterations();
-          if(refIts==curIts)
-            { elt.push_back(curIt); it=lstFMTS.erase(it); }
-          else
-            it++;
-        }
-      ret.push_back(elt);
-    }
-  return ret;
-}
-
-/*!
- * This method splits the input list \a vectFMTS considering the aspect of the geometrical support over time.
- * All returned instances in a subvector can be safely loaded, rendered along time
- * All items must be defined on the same time step ids ( see MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries method ).
- * Each item in \a vectFMTS is expected to have one and exactly one spatial discretization along time.
- * All items in \a vectFMTS must lie on the mesh (located by meshname and time step) and compatible with the input mesh \a mesh (having the same name than those in items).
- * All items in \a vectFMTS whose spatial discretization is not ON_NODES will appear once.
- * For items in \a vectFMTS that are ON_NODES it is possible to appear several times (more than once or once) in the returned vector.
- *
- * \param [in] vectFMTS - list of multi times step part all defined each on a same spatial discretization along time and pointing to a mesh whose name is equal to \c mesh->getName().
- * \param [in] mesh - the mesh shared by all items in \a vectFMTS across time.
- * \param [out] fsc - A vector having same size than returned vector. It specifies the support comporator of the corresponding vector of MEDFileAnyTypeFieldMultiTS in returned vector of vector.
- * \return - A vector of vector of objects that contains the same pointers (objects) than thoose in \a vectFMTS except that there are organized differently. So pointers included in returned vector of vector should \b not been dealt by the caller.
- *
- * \throw If an element in \a vectFMTS has not only one spatial discretization set.
- * \throw If an element in \a vectFMTS change of spatial discretization along time.
- * \throw If an element in \a vectFMTS lies on a mesh with meshname different from those in \a mesh.
- * \thorw If some elements in \a vectFMTS do not have the same times steps.
- * \throw If mesh is null.
- * \throw If an element in \a vectFMTS is null.
- * \sa MEDFileAnyTypeFieldMultiTS::AreOnSameSupportAcrossTime
- */
-std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(const std::vector<MEDFileAnyTypeFieldMultiTS *>& vectFMTS, const MEDFileMesh *mesh, std::vector< MCAuto<MEDFileFastCellSupportComparator> >& fsc)
-{
-  static const char msg[]="MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport : presence of a null instance in the input vector !";
-  if(!mesh)
-    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport : input mesh is null !");
-  std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret;
-  if(vectFMTS.empty())
-    return ret;
-  std::vector<MEDFileAnyTypeFieldMultiTS *>::const_iterator it(vectFMTS.begin());
-  MEDFileAnyTypeFieldMultiTS *frstElt(*it);
-  if(!frstElt)
-    throw INTERP_KERNEL::Exception(msg);
-  std::size_t i=0;
-  std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTSNotNodes;
-  std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTSNodes;
-  for(;it!=vectFMTS.end();it++,i++)
-    {
-      if(!(*it))
-        throw INTERP_KERNEL::Exception(msg);
-      TypeOfField tof0,tof1;
-      if(CheckSupportAcrossTime(frstElt,*it,mesh,tof0,tof1)>0)
-        {
-          if(tof1!=ON_NODES)
-            vectFMTSNotNodes.push_back(*it);
-          else
-            vectFMTSNodes.push_back(*it);
-        }
-      else
-        vectFMTSNotNodes.push_back(*it);
-    }
-  std::vector< MCAuto<MEDFileFastCellSupportComparator> > cmps;
-  std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > retCell=SplitPerCommonSupportNotNodesAlg(vectFMTSNotNodes,mesh,cmps);
-  ret=retCell;
-  for(std::vector<MEDFileAnyTypeFieldMultiTS *>::const_iterator it2=vectFMTSNodes.begin();it2!=vectFMTSNodes.end();it2++)
-    {
-      i=0;
-      bool isFetched(false);
-      for(std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> >::const_iterator it0=retCell.begin();it0!=retCell.end();it0++,i++)
-        {
-          if((*it0).empty())
-            throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport : internal error !");
-          if(cmps[i]->isCompatibleWithNodesDiscr(*it2))
-            { ret[i].push_back(*it2); isFetched=true; }
-        }
-      if(!isFetched)
-        {
-          std::vector<MEDFileAnyTypeFieldMultiTS *> tmp(1,*it2);
-          MCAuto<MEDFileMeshStruct> tmp2(MEDFileMeshStruct::New(mesh));
-          ret.push_back(tmp); retCell.push_back(tmp); cmps.push_back(MEDFileFastCellSupportComparator::New(tmp2,*it2));
-        }
-    }
-  fsc=cmps;
-  return ret;
-}
-
-/*!
- * WARNING no check here. The caller must be sure that all items in vectFMTS are coherent each other in time steps, only one same spatial discretization and not ON_NODES.
- * \param [out] cmps - same size than the returned vector.
- */
-std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupportNotNodesAlg(const std::vector<MEDFileAnyTypeFieldMultiTS *>& vectFMTS, const MEDFileMesh *mesh, std::vector< MCAuto<MEDFileFastCellSupportComparator> >& cmps)
-{
-  std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret;
-  std::list<MEDFileAnyTypeFieldMultiTS *> lstFMTS(vectFMTS.begin(),vectFMTS.end());
-  while(!lstFMTS.empty())
-    {
-      std::list<MEDFileAnyTypeFieldMultiTS *>::iterator it(lstFMTS.begin());
-      MEDFileAnyTypeFieldMultiTS *ref(*it);
-      std::vector<MEDFileAnyTypeFieldMultiTS *> elt;
-      elt.push_back(ref); it=lstFMTS.erase(it);
-      MCAuto<MEDFileMeshStruct> mst(MEDFileMeshStruct::New(mesh));
-      MCAuto<MEDFileFastCellSupportComparator> cmp(MEDFileFastCellSupportComparator::New(mst,ref));
-      while(it!=lstFMTS.end())
-        {
-          MEDFileAnyTypeFieldMultiTS *curIt(*it);
-          if(cmp->isEqual(curIt))
-            { elt.push_back(curIt); it=lstFMTS.erase(it); }
-          else
-            it++;
-        }
-      ret.push_back(elt); cmps.push_back(cmp);
-    }
-  return ret;
-}
-
-/*!
- * This method scan the two main structs along time of \a f0 and \a f1 to see if there are all lying on the same mesh along time than those in \a mesh.
- * \a f0 and \a f1 must be defined each only on a same spatial discretization even if this can be different each other.
- *
- * \throw If \a f0 or \a f1 has not only one spatial discretization set.
- * \throw If \a f0 or \a f1 change of spatial discretization along time.
- * \throw If \a f0 or \a f1 on a mesh with meshname different from those in \a mesh.
- * \thorw If \a f0 and \a f1 do not have the same times steps.
- * \throw If mesh is null.
- * \throw If \a f0 or \a f1 is null.
- * \sa MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport
- */
-int MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime(MEDFileAnyTypeFieldMultiTS *f0, MEDFileAnyTypeFieldMultiTS *f1, const MEDFileMesh *mesh, TypeOfField& tof0, TypeOfField& tof1)
-{
-  if(!mesh)
-    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : input mesh is null !");
-  if(!f0 || !f1)
-    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : presence of null instance in fields over time !");
-  if(f0->getMeshName()!=mesh->getName())
-    {
-      std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : first field points to mesh \""<< f0->getMeshName() << "\" and input mesh to compare has name \"" << mesh->getName() << "\" !";
-      throw INTERP_KERNEL::Exception(oss.str());
-    }
-  if(f1->getMeshName()!=mesh->getName())
-    {
-      std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : second field points to mesh \""<< f1->getMeshName() << "\" and input mesh to compare has name \"" << mesh->getName() << "\" !";
-      throw INTERP_KERNEL::Exception(oss.str());
-    }
-  int nts=f0->getNumberOfTS();
-  if(nts!=f1->getNumberOfTS())
-    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : number of time steps are not the same !");
-  if(nts==0)
-    return nts;
-  for(int i=0;i<nts;i++)
-    {
-      MCAuto<MEDFileAnyTypeField1TS> f0cur=f0->getTimeStepAtPos(i);
-      MCAuto<MEDFileAnyTypeField1TS> f1cur=f1->getTimeStepAtPos(i);
-      std::vector<TypeOfField> tofs0(f0cur->getTypesOfFieldAvailable()),tofs1(f1cur->getTypesOfFieldAvailable());
-      if(tofs0.size()!=1 || tofs1.size()!=1)
-        throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : All time steps must be defined on only one spatial discretization !");
-      if(i!=0)
-        {
-          if(tof0!=tofs0[0] || tof1!=tofs1[0])
-            throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : Across times steps MEDFileAnyTypeFieldMultiTS instances have to keep the same unique spatial discretization !");
-        }
-      else
-        { tof0=tofs0[0]; tof1=tofs1[0]; }
-      if(f0cur->getMeshIteration()!=mesh->getIteration() || f0cur->getMeshOrder()!=mesh->getOrder())
-        {
-          std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : first field points to mesh time step (" << f0cur->getMeshIteration() << ","<< f0cur->getMeshOrder() << ") whereas input mesh points to time step (" << mesh->getIteration() << "," << mesh->getOrder() << ") !";
-          throw INTERP_KERNEL::Exception(oss.str());
-        }
-      if(f1cur->getMeshIteration()!=mesh->getIteration() || f1cur->getMeshOrder()!=mesh->getOrder())
-        {
-          std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : second field points to mesh time step (" << f1cur->getMeshIteration() << ","<< f1cur->getMeshOrder() << ") whereas input mesh points to time step (" << mesh->getIteration() << "," << mesh->getOrder() << ") !";
-          throw INTERP_KERNEL::Exception(oss.str());
-        }
-      if(f0cur->getIteration()!=f1cur->getIteration() || f0cur->getOrder()!=f1cur->getOrder())
-        {
-          std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : all the time steps must be the same ! it is not the case (" << f0cur->getIteration() << "," << f0cur->getOrder() << ")!=(" << f1cur->getIteration() << "," << f1cur->getOrder() << ") !";
-          throw INTERP_KERNEL::Exception(oss.str());
-        }
-    }
-  return nts;
-}
-
-/*!
- * Return an extraction of \a this using \a extractDef map to specify the extraction.
- * The keys of \a extractDef is level relative to max ext of \a mm mesh.
- *
- * \return A new object that the caller is responsible to deallocate.
- */
-MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const
-{
-  if(!mm)
-    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::extractPart : mesh is null !");
-  MCAuto<MEDFileAnyTypeFieldMultiTS> fmtsOut(buildNewEmpty());
-  int nbTS(getNumberOfTS());
-  for(int i=0;i<nbTS;i++)
-    {
-      MCAuto<MEDFileAnyTypeField1TS> f1ts(getTimeStepAtPos(i));
-      MCAuto<MEDFileAnyTypeField1TS> f1tsOut(f1ts->extractPart(extractDef,mm));
-      fmtsOut->pushBackTimeStep(f1tsOut);
-    }
-  return fmtsOut.retn();
-}
-
-template<class T>
-MCAuto<MEDFileAnyTypeField1TS> AggregateHelperF1TS(const std::vector< typename MLFieldTraits<T>::F1TSType const *>& f1tss, const std::vector< std::vector< std::pair<int,int> > >& dts)
-{
-  MCAuto< typename MLFieldTraits<T>::F1TSType > ret(MLFieldTraits<T>::F1TSType::New());
-  if(f1tss.empty())
-    throw INTERP_KERNEL::Exception("AggregateHelperF1TS : empty vector !");
-  std::size_t sz(f1tss.size()),i(0);
-  std::vector< typename MLFieldTraits<T>::F1TSWSDAType const *> f1tsw(sz);
-  for(typename std::vector< typename MLFieldTraits<T>::F1TSType const *>::const_iterator it=f1tss.begin();it!=f1tss.end();it++,i++)
-    {
-      typename MLFieldTraits<T>::F1TSType const *elt(*it);
-      if(!elt)
-        throw INTERP_KERNEL::Exception("AggregateHelperF1TS : presence of a null pointer !");
-      f1tsw[i]=dynamic_cast<typename MLFieldTraits<T>::F1TSWSDAType const *>(elt->contentNotNullBase());
-    }
-  typename MLFieldTraits<T>::F1TSWSDAType *retc(dynamic_cast<typename MLFieldTraits<T>::F1TSWSDAType *>(ret->contentNotNullBase()));
-  if(!retc)
-    throw INTERP_KERNEL::Exception("AggregateHelperF1TS : internal error 1 !");
-  retc->aggregate(f1tsw,dts);
-  ret->setDtUnit(f1tss[0]->getDtUnit());
-  return DynamicCast<typename MLFieldTraits<T>::F1TSType , MEDFileAnyTypeField1TS>(ret);
-}
-
-template<class T>
-MCAuto< MEDFileAnyTypeFieldMultiTS > AggregateHelperFMTS(const std::vector< typename MLFieldTraits<T>::FMTSType const *>& fmtss, const std::vector< std::vector< std::pair<int,int> > >& dts)
-{
-  MCAuto< typename MLFieldTraits<T>::FMTSType > ret(MLFieldTraits<T>::FMTSType::New());
-  if(fmtss.empty())
-    throw INTERP_KERNEL::Exception("AggregateHelperFMTS : empty vector !");
-  std::size_t sz(fmtss.size());
-  for(typename std::vector< typename MLFieldTraits<T>::FMTSType const *>::const_iterator it=fmtss.begin();it!=fmtss.end();it++)
-    {
-      typename MLFieldTraits<T>::FMTSType const *elt(*it);
-      if(!elt)
-        throw INTERP_KERNEL::Exception("AggregateHelperFMTS : presence of null pointer !");
-    }
-  int nbTS(fmtss[0]->getNumberOfTS());
-  for(typename std::vector< typename MLFieldTraits<T>::FMTSType const *>::const_iterator it=fmtss.begin();it!=fmtss.end();it++)
-    if((*it)->getNumberOfTS()!=nbTS)
-      throw INTERP_KERNEL::Exception("AggregateHelperFMTS : all fields must have the same number of TS !");
-  for(int iterTS=0;iterTS<nbTS;iterTS++)
-    {
-      std::size_t i(0);
-      std::vector< typename MLFieldTraits<T>::F1TSType const *> f1tss(sz);
-      std::vector< MCAuto<typename MLFieldTraits<T>::F1TSType> > f1tss2(sz);
-      for(typename std::vector< typename MLFieldTraits<T>::FMTSType const *>::const_iterator it=fmtss.begin();it!=fmtss.end();it++,i++)
-        { f1tss2[i]=(*it)->getTimeStepAtPos(iterTS); f1tss[i]=f1tss2[i]; }
-      MCAuto<MEDFileAnyTypeField1TS> f1ts(AggregateHelperF1TS<T>(f1tss,dts));
-      ret->pushBackTimeStep(f1ts);
-      ret->setDtUnit(f1ts->getDtUnit());
-    }
-  return DynamicCast<typename MLFieldTraits<T>::FMTSType , MEDFileAnyTypeFieldMultiTS>(ret);
-}
-
-/*!
- * \a dts and \a ftmss are expected to have same size.
- */
-MCAuto<MEDFileAnyTypeFieldMultiTS> MEDFileAnyTypeFieldMultiTS::Aggregate(const std::vector<const MEDFileAnyTypeFieldMultiTS *>& fmtss, const std::vector< std::vector< std::pair<int,int> > >& dts)
-{
-  if(fmtss.empty())
-    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::Aggregate : input vector is empty !");
-  std::size_t sz(fmtss.size());
-  std::vector<const MEDFileFieldMultiTS *> fmtss1;
-  std::vector<const MEDFileIntFieldMultiTS *> fmtss2;
-  for(std::vector<const MEDFileAnyTypeFieldMultiTS *>::const_iterator it=fmtss.begin();it!=fmtss.end();it++)
-    {
-      if(!(*it))
-        throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::Aggregate : presence of null instance in input vector !");
-      const MEDFileFieldMultiTS *elt1(dynamic_cast<const MEDFileFieldMultiTS *>(*it));
-      if(elt1)
-        {
-          fmtss1.push_back(elt1);
-          continue;
-        }
-      const MEDFileIntFieldMultiTS *elt2(dynamic_cast<const MEDFileIntFieldMultiTS *>(*it));
-      if(elt2)
-        {
-          fmtss2.push_back(elt2);
-          continue;
-        }
-      throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::Aggregate : not recognized type !");
-    }
-  if(fmtss1.size()!=sz && fmtss2.size()!=sz)
-    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::Aggregate : type of data is not homogeneous !");
-  if(fmtss1.size()==sz)
-    return AggregateHelperFMTS<double>(fmtss1,dts);
-  if(fmtss2.size()!=sz)
-    return AggregateHelperFMTS<int>(fmtss2,dts);
-  throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::Aggregate : not implemented yet !");
-}
-
-MEDFileAnyTypeFieldMultiTSIterator *MEDFileAnyTypeFieldMultiTS::iterator()
-{
-  return new MEDFileAnyTypeFieldMultiTSIterator(this);
-}
-
-//= MEDFileFieldMultiTS
-
-/*!
- * Returns a new empty instance of MEDFileFieldMultiTS.
- *  \return MEDFileFieldMultiTS * - a new instance of MEDFileFieldMultiTS. The caller
- *          is to delete this field using decrRef() as it is no more needed.
- */
-MEDFileFieldMultiTS *MEDFileFieldMultiTS::New()
-{
-  return new MEDFileFieldMultiTS;
-}
-
-/*!
- * Returns a new instance of MEDFileFieldMultiTS holding data of the first field
- * that has been read from a specified MED file.
- *  \param [in] fileName - the name of the MED file to read.
- *  \return MEDFileFieldMultiTS * - a new instance of MEDFileFieldMultiTS. The caller
- *          is to delete this field using decrRef() as it is no more needed.
- *  \throw If reading the file fails.
- */
-MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(const std::string& fileName, bool loadAll)
-{
-  MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
-  return New(fid,loadAll);
-}
-
-MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(med_idt fid, bool loadAll)
-{
-  MCAuto<MEDFileFieldMultiTS> ret(new MEDFileFieldMultiTS(fid,loadAll,0));
-  ret->contentNotNull();//to check that content type matches with \a this type.
-  return ret.retn();
-}
-
-/*!
- * Returns a new instance of MEDFileFieldMultiTS holding data of a given field
- * that has been read from a specified MED file.
- *  \param [in] fileName - the name of the MED file to read.
- *  \param [in] fieldName - the name of the field to read.
- *  \return MEDFileFieldMultiTS * - a new instance of MEDFileFieldMultiTS. The caller
- *          is to delete this field using decrRef() as it is no more needed.
- *  \throw If reading the file fails.
- *  \throw If there is no field named \a fieldName in the file.
- */
-MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(const std::string& fileName, const std::string& fieldName, bool loadAll)
-{
-  MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
-  return New(fid,fieldName,loadAll);
-}
-
-MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(med_idt fid, const std::string& fieldName, bool loadAll)
-{
-  MCAuto<MEDFileFieldMultiTS> ret(new MEDFileFieldMultiTS(fid,fieldName,loadAll,0));
-  ret->contentNotNull();//to check that content type matches with \a this type.
-  return ret.retn();
-}
-
-/*!
- * Returns a new instance of MEDFileFieldMultiTS. If \a shallowCopyOfContent is true the content of \a other is shallow copied.
- * If \a shallowCopyOfContent is false, \a other is taken to be the content of \a this.
- *
- * Returns a new instance of MEDFileFieldMultiTS holding either a shallow copy
- * of a given MEDFileFieldMultiTSWithoutSDA ( \a other ) or \a other itself.
- * \warning this is a shallow copy constructor
- *  \param [in] other - a MEDFileField1TSWithoutSDA to copy.
- *  \param [in] shallowCopyOfContent - if \c true, a shallow copy of \a other is created.
- *  \return MEDFileFieldMultiTS * - a new instance of MEDFileFieldMultiTS. The caller
- *          is to delete this field using decrRef() as it is no more needed.
- */
-MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(const MEDFileFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent)
-{
-  return new MEDFileFieldMultiTS(other,shallowCopyOfContent);
-}
-
-MEDFileFieldMultiTS *MEDFileFieldMultiTS::LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, const std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> >& entities, bool loadAll)
-{
-  MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
-  INTERP_KERNEL::AutoCppPtr<MEDFileEntities> ent(new MEDFileStaticEntities(entities));
-  MCAuto<MEDFileFieldMultiTS> ret(new MEDFileFieldMultiTS(fid,fieldName,loadAll,0,ent));
-  ret->contentNotNull();//to check that content type matches with \a this type.
-  return ret.retn();
-}
-
-MEDFileAnyTypeFieldMultiTS *MEDFileFieldMultiTS::shallowCpy() const
-{
-  return new MEDFileFieldMultiTS(*this);
-}
-
-void MEDFileFieldMultiTS::checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const
-{
-  if(!f1ts)
-    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::checkCoherencyOfType : input field1TS is NULL ! Impossible to check !");
-  const MEDFileField1TS *f1tsC=dynamic_cast<const MEDFileField1TS *>(f1ts);
-  if(!f1tsC)
-    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::checkCoherencyOfType : the input field1TS is not a FLOAT64 type !");
-}
-
-/*!
- * This method performs a copy with datatype modification ( float64->int32 ) of \a this. The globals information are copied
- * following the given input policy.
- *
- * \param [in] isDeepCpyGlobs - a boolean that indicates the behaviour concerning globals (profiles and localizations)
- *                            By default (true) the globals are deeply copied.
- * \return MEDFileIntFieldMultiTS * - a new object that is the result of the conversion of \a this to int32 field.
- */
-MEDFileIntFieldMultiTS *MEDFileFieldMultiTS::convertToInt(bool isDeepCpyGlobs) const
-{
-  MCAuto<MEDFileIntFieldMultiTS> ret;
-  const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(_content);
-  if(content)
-    {
-      const MEDFileFieldMultiTSWithoutSDA *contc=dynamic_cast<const MEDFileFieldMultiTSWithoutSDA *>(content);
-      if(!contc)
-        throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::convertToInt : the content inside this is not FLOAT64 ! This is incoherent !");
-      MCAuto<MEDFileIntFieldMultiTSWithoutSDA> newc(contc->convertToInt());
-      ret=static_cast<MEDFileIntFieldMultiTS *>(MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent((MEDFileIntFieldMultiTSWithoutSDA *)newc));
-    }
-  else
-    ret=MEDFileIntFieldMultiTS::New();
-  if(isDeepCpyGlobs)
-    ret->deepCpyGlobs(*this);
-  else
-    ret->shallowCpyGlobs(*this);
-  return ret.retn();
-}
-
-/*!
- * Returns a new MEDFileField1TS holding data of a given time step of \a this field.
- *  \param [in] pos - a time step id.
- *  \return MEDFileField1TS * - a new instance of MEDFileField1TS. The caller is to
- *          delete this field using decrRef() as it is no more needed.
- *  \throw If \a pos is not a valid time step id.
- */
-MEDFileField1TS *MEDFileFieldMultiTS::getTimeStepAtPos(int pos) const
-{
-  const MEDFileAnyTypeField1TSWithoutSDA *item=contentNotNullBase()->getTimeStepAtPos2(pos);
-  if(!item)
-    {
-      std::ostringstream oss; oss << "MEDFileFieldMultiTS::getTimeStepAtPos : field at pos #" << pos << " is null !";
-      throw INTERP_KERNEL::Exception(oss.str());
-    }
-  const MEDFileField1TSWithoutSDA *itemC=dynamic_cast<const MEDFileField1TSWithoutSDA *>(item);
-  if(itemC)
-    {
-      MCAuto<MEDFileField1TS> ret=MEDFileField1TS::New(*itemC,false);
-      ret->shallowCpyGlobs(*this);
-      return ret.retn();
-    }
-  std::ostringstream oss; oss << "MEDFileFieldMultiTS::getTimeStepAtPos : type of field at pos #" << pos << " is not FLOAT64 !";
-  throw INTERP_KERNEL::Exception(oss.str());
-}
-
-/*!
- * Returns a new MEDCouplingFieldDouble of a given type, of a given time step, lying on
- * mesh entities of a given dimension of the first mesh in MED file.
- * For more info, see \ref AdvMEDLoaderAPIFieldRW
- *  \param [in] type - a spatial discretization of interest.
- *  \param [in] iteration - the iteration number of a required time step.
- *  \param [in] order - the iteration order number of required time step.
- *  \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities.
- *  \param [in] renumPol - specifies how to permute values of the result field according to
- *          the optional numbers of cells and nodes, if any. The valid values are
- *          - 0 - do not permute.
- *          - 1 - permute cells.
- *          - 2 - permute nodes.
- *          - 3 - permute cells and nodes.
- *
- *  \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The
- *          caller is to delete this field using decrRef() as it is no more needed. 
- *  \throw If the MED file is not readable.
- *  \throw If there is no mesh in the MED file.
- *  \throw If there are no mesh entities of \a meshDimRelToMax dimension in the mesh.
- *  \throw If no field values of the required parameters are available.
- */
-MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol) const
-{
-  const MEDFileAnyTypeField1TSWithoutSDA& myF1TS=contentNotNullBase()->getTimeStepEntry(iteration,order);
-  const MEDFileField1TSWithoutSDA *myF1TSC=dynamic_cast<const MEDFileField1TSWithoutSDA *>(&myF1TS);
-  if(!myF1TSC)
-    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldAtLevel : mismatch of type of field expecting FLOAT64 !");
-  MCAuto<DataArray> arrOut;
-  MCAuto<MEDCouplingFieldDouble> ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arrOut,*contentNotNullBase());
-  MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
-  return ret.retn();
-}
-
-/*!
- * Returns a new MEDCouplingFieldDouble of a given type, of a given time step, lying on
- * the top level cells of the first mesh in MED file.
- * For more info, see \ref AdvMEDLoaderAPIFieldRW
- *  \param [in] type - a spatial discretization of interest.
- *  \param [in] iteration - the iteration number of a required time step.
- *  \param [in] order - the iteration order number of required time step.
- *  \param [in] renumPol - specifies how to permute values of the result field according to
- *          the optional numbers of cells and nodes, if any. The valid values are
- *          - 0 - do not permute.
- *          - 1 - permute cells.
- *          - 2 - permute nodes.
- *          - 3 - permute cells and nodes.
- *
- *  \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The
- *          caller is to delete this field using decrRef() as it is no more needed. 
- *  \throw If the MED file is not readable.
- *  \throw If there is no mesh in the MED file.
- *  \throw If no field values of the required parameters are available.
- */
-MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol) const
-{
-  const MEDFileAnyTypeField1TSWithoutSDA& myF1TS=contentNotNullBase()->getTimeStepEntry(iteration,order);
-  const MEDFileField1TSWithoutSDA *myF1TSC=dynamic_cast<const MEDFileField1TSWithoutSDA *>(&myF1TS);
-  if(!myF1TSC)
-    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldAtTopLevel : mismatch of type of field !");
-  MCAuto<DataArray> arrOut;
-  MCAuto<MEDCouplingFieldDouble> ret=myF1TSC->getFieldAtTopLevel(type,std::string(),renumPol,this,arrOut,*contentNotNullBase());
-  MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
-  return ret.retn();
-}
-
-/*!
- * This is the simplest version to fetch a field for MED structure. One drawback : if \a this is a complex field (multi spatial discretization inside a same field) this method will throw exception and more advance
- * method should be called (getFieldOnMeshAtLevel for example).
- * But for normal usage of field in MED file world this method is the most efficient to fetch data.
- *
- * \param [in] iteration - the iteration number of a required time step.
- * \param [in] order - the iteration order number of required time step.
- * \param [in] mesh - the mesh the field is lying on
- * \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The
- *          caller is to delete this field using decrRef() as it is no more needed. 
- */
-MEDCouplingFieldDouble *MEDFileFieldMultiTS::field(int iteration, int order, const MEDFileMesh *mesh) const
-{
-  const MEDFileAnyTypeField1TSWithoutSDA& myF1TS(contentNotNullBase()->getTimeStepEntry(iteration,order));
-  MCAuto<DataArray> arrOut;
-  MCAuto<MEDCouplingFieldDouble> ret(myF1TS.fieldOnMesh(this,mesh,arrOut,*contentNotNullBase()));
-  MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
-  return ret.retn();
-}
-
-/*!
- * Returns a new MEDCouplingFieldDouble of a given type, of a given time step, lying on
- * a given support.
- * For more info, see \ref AdvMEDLoaderAPIFieldRW
- *  \param [in] type - a spatial discretization of interest.
- *  \param [in] iteration - the iteration number of a required time step.
- *  \param [in] order - the iteration order number of required time step.
- *  \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities.
- *  \param [in] mesh - the supporting mesh.
- *  \param [in] renumPol - specifies how to permute values of the result field according to
- *          the optional numbers of cells and nodes, if any. The valid values are
- *          - 0 - do not permute.
- *          - 1 - permute cells.
- *          - 2 - permute nodes.
- *          - 3 - permute cells and nodes.
- *
- *  \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The
- *          caller is to delete this field using decrRef() as it is no more needed. 
- *  \throw If there are no mesh entities of \a meshDimRelToMax dimension in the mesh.
- *  \throw If no field of \a this is lying on \a mesh.
- *  \throw If no field values of the required parameters are available.
- */
-MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol) const
-{
-  const MEDFileAnyTypeField1TSWithoutSDA& myF1TS(contentNotNullBase()->getTimeStepEntry(iteration,order));
-  const MEDFileField1TSWithoutSDA *myF1TSC=dynamic_cast<const MEDFileField1TSWithoutSDA *>(&myF1TS);
-  if(!myF1TSC)
-    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldOnMeshAtLevel : mismatch of type of field !");
-  MCAuto<DataArray> arrOut;
-  MCAuto<MEDCouplingFieldDouble> ret=myF1TSC->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arrOut,*contentNotNullBase());
-  MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
-  return ret.retn();
-}
-
-/*!
- * Returns a new MEDCouplingFieldDouble of given type, of a given time step, lying on a
- * given support. 
- * For more info, see \ref AdvMEDLoaderAPIFieldRW
- *  \param [in] type - a spatial discretization of the new field.
- *  \param [in] iteration - the iteration number of a required time step.
- *  \param [in] order - the iteration order number of required time step.
- *  \param [in] mesh - the supporting mesh.
- *  \param [in] renumPol - specifies how to permute values of the result field according to
- *          the optional numbers of cells and nodes, if any. The valid values are
- *          - 0 - do not permute.
- *          - 1 - permute cells.
- *          - 2 - permute nodes.
- *          - 3 - permute cells and nodes.
- *
- *  \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The
- *          caller is to delete this field using decrRef() as it is no more needed. 
- *  \throw If no field of \a this is lying on \a mesh.
- *  \throw If no field values of the required parameters are available.
- */
-MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol) const
-{
-  const MEDFileAnyTypeField1TSWithoutSDA& myF1TS=contentNotNullBase()->getTimeStepEntry(iteration,order);
-  const MEDFileField1TSWithoutSDA *myF1TSC=dynamic_cast<const MEDFileField1TSWithoutSDA *>(&myF1TS);
-  if(!myF1TSC)
-    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldOnMeshAtLevel : mismatch of type of field !");
-  MCAuto<DataArray> arrOut;
-  MCAuto<MEDCouplingFieldDouble> ret=myF1TSC->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arrOut,*contentNotNullBase());
-  MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
-  return ret.retn();
-}
-
-/*!
- * This method has a close behaviour than MEDFileFieldMultiTS::getFieldAtLevel.
- * This method is called 'old' because the user should give the mesh name he wants to use for it's field.
- * This method is useful for MED2 file format when field on different mesh was autorized.
- */
-MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldAtLevelOld(TypeOfField type, const std::string& mname, int iteration, int order, int meshDimRelToMax, int renumPol) const
-{
-  const MEDFileAnyTypeField1TSWithoutSDA& myF1TS=contentNotNullBase()->getTimeStepEntry(iteration,order);
-  const MEDFileField1TSWithoutSDA *myF1TSC=dynamic_cast<const MEDFileField1TSWithoutSDA *>(&myF1TS);
-  if(!myF1TSC)
-    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldAtLevelOld : mismatch of type of field !");
-  MCAuto<DataArray> arrOut;
-  MCAuto<MEDCouplingFieldDouble> ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arrOut,*contentNotNullBase());
-  MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
-  return ret.retn();
-}
-
-/*!
- * Returns values and a profile of the field of a given type, of a given time step,
- * lying on a given support.
- * For more info, see \ref AdvMEDLoaderAPIFieldRW
- *  \param [in] type - a spatial discretization of the field.
- *  \param [in] iteration - the iteration number of a required time step.
- *  \param [in] order - the iteration order number of required time step.
- *  \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities.
- *  \param [in] mesh - the supporting mesh.
- *  \param [out] pfl - a new instance of DataArrayInt holding ids of mesh entities the
- *          field of interest lies on. If the field lies on all entities of the given
- *          dimension, all ids in \a pfl are zero. The caller is to delete this array
- *          using decrRef() as it is no more needed.  
- *  \param [in] glob - the global data storing profiles and localization.
- *  \return DataArrayDouble * - a new instance of DataArrayDouble holding values of the
- *          field. The caller is to delete this array using decrRef() as it is no more needed.
- *  \throw If there are no mesh entities of \a meshDimRelToMax dimension in \a mesh.
- *  \throw If no field of \a this is lying on \a mesh.
- *  \throw If no field values of the required parameters are available.
- */
-DataArrayDouble *MEDFileFieldMultiTS::getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const
-{
-  const MEDFileAnyTypeField1TSWithoutSDA& myF1TS=contentNotNullBase()->getTimeStepEntry(iteration,order);
-  const MEDFileField1TSWithoutSDA *myF1TSC=dynamic_cast<const MEDFileField1TSWithoutSDA *>(&myF1TS);
-  if(!myF1TSC)
-    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldWithProfile : mismatch of type of field !");
-  MCAuto<DataArray> ret=myF1TSC->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNullBase());
-  return MEDFileField1TS::ReturnSafelyDataArrayDouble(ret);
-}
-
-const MEDFileFieldMultiTSWithoutSDA *MEDFileFieldMultiTS::contentNotNull() const
-{
-  const MEDFileAnyTypeFieldMultiTSWithoutSDA *pt(_content);
-  if(!pt)
-    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::contentNotNull : the content pointer is null !");
-  const MEDFileFieldMultiTSWithoutSDA *ret=dynamic_cast<const MEDFileFieldMultiTSWithoutSDA *>(pt);
-  if(!ret)
-    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::contentNotNull : the content pointer is not null but it is not of type double ! Reason is maybe that the read field has not the type FLOAT64 !");
-  return ret;
-}
-
-MEDFileFieldMultiTSWithoutSDA *MEDFileFieldMultiTS::contentNotNull()
-{
-  MEDFileAnyTypeFieldMultiTSWithoutSDA *pt(_content);
-  if(!pt)
-    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::contentNotNull : the non const content pointer is null !");
-  MEDFileFieldMultiTSWithoutSDA *ret=dynamic_cast<MEDFileFieldMultiTSWithoutSDA *>(pt);
-  if(!ret)
-    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::contentNotNull : the non const content pointer is not null but it is not of type double ! Reason is maybe that the read field has not the type FLOAT64 !");
+  static const char msg[]="MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport : presence of a null instance in the input vector !";
+  if(!mesh)
+    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport : input mesh is null !");
+  std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret;
+  if(vectFMTS.empty())
+    return ret;
+  std::vector<MEDFileAnyTypeFieldMultiTS *>::const_iterator it(vectFMTS.begin());
+  MEDFileAnyTypeFieldMultiTS *frstElt(*it);
+  if(!frstElt)
+    throw INTERP_KERNEL::Exception(msg);
+  std::size_t i=0;
+  std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTSNotNodes;
+  std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTSNodes;
+  for(;it!=vectFMTS.end();it++,i++)
+    {
+      if(!(*it))
+        throw INTERP_KERNEL::Exception(msg);
+      TypeOfField tof0,tof1;
+      if(CheckSupportAcrossTime(frstElt,*it,mesh,tof0,tof1)>0)
+        {
+          if(tof1!=ON_NODES)
+            vectFMTSNotNodes.push_back(*it);
+          else
+            vectFMTSNodes.push_back(*it);
+        }
+      else
+        vectFMTSNotNodes.push_back(*it);
+    }
+  std::vector< MCAuto<MEDFileFastCellSupportComparator> > cmps;
+  std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > retCell=SplitPerCommonSupportNotNodesAlg(vectFMTSNotNodes,mesh,cmps);
+  ret=retCell;
+  for(std::vector<MEDFileAnyTypeFieldMultiTS *>::const_iterator it2=vectFMTSNodes.begin();it2!=vectFMTSNodes.end();it2++)
+    {
+      i=0;
+      bool isFetched(false);
+      for(std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> >::const_iterator it0=retCell.begin();it0!=retCell.end();it0++,i++)
+        {
+          if((*it0).empty())
+            throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport : internal error !");
+          if(cmps[i]->isCompatibleWithNodesDiscr(*it2))
+            { ret[i].push_back(*it2); isFetched=true; }
+        }
+      if(!isFetched)
+        {
+          std::vector<MEDFileAnyTypeFieldMultiTS *> tmp(1,*it2);
+          MCAuto<MEDFileMeshStruct> tmp2(MEDFileMeshStruct::New(mesh));
+          ret.push_back(tmp); retCell.push_back(tmp); cmps.push_back(MEDFileFastCellSupportComparator::New(tmp2,*it2));
+        }
+    }
+  fsc=cmps;
   return ret;
 }
 
 /*!
- * Adds a MEDCouplingFieldDouble to \a this as another time step. The underlying mesh of
- * the given field is checked if its elements are sorted suitable for writing to MED file
- * ("STB" stands for "Sort By Type"), if not, an exception is thrown. 
- * For more info, see \ref AdvMEDLoaderAPIFieldRW
- *  \param [in] field - the field to add to \a this.
- *  \throw If the name of \a field is empty.
- *  \throw If the data array of \a field is not set.
- *  \throw If existing time steps have different name or number of components than \a field.
- *  \throw If the underlying mesh of \a field has no name.
- *  \throw If elements in the mesh are not in the order suitable for writing to the MED file.
+ * WARNING no check here. The caller must be sure that all items in vectFMTS are coherent each other in time steps, only one same spatial discretization and not ON_NODES.
+ * \param [out] cmps - same size than the returned vector.
  */
-void MEDFileFieldMultiTS::appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field)
+std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupportNotNodesAlg(const std::vector<MEDFileAnyTypeFieldMultiTS *>& vectFMTS, const MEDFileMesh *mesh, std::vector< MCAuto<MEDFileFastCellSupportComparator> >& cmps)
 {
-  const DataArrayDouble *arr=0;
-  if(field)
-    arr=field->getArray();
-  contentNotNull()->appendFieldNoProfileSBT(field,arr,*this);
+  std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret;
+  std::list<MEDFileAnyTypeFieldMultiTS *> lstFMTS(vectFMTS.begin(),vectFMTS.end());
+  while(!lstFMTS.empty())
+    {
+      std::list<MEDFileAnyTypeFieldMultiTS *>::iterator it(lstFMTS.begin());
+      MEDFileAnyTypeFieldMultiTS *ref(*it);
+      std::vector<MEDFileAnyTypeFieldMultiTS *> elt;
+      elt.push_back(ref); it=lstFMTS.erase(it);
+      MCAuto<MEDFileMeshStruct> mst(MEDFileMeshStruct::New(mesh));
+      MCAuto<MEDFileFastCellSupportComparator> cmp(MEDFileFastCellSupportComparator::New(mst,ref));
+      while(it!=lstFMTS.end())
+        {
+          MEDFileAnyTypeFieldMultiTS *curIt(*it);
+          if(cmp->isEqual(curIt))
+            { elt.push_back(curIt); it=lstFMTS.erase(it); }
+          else
+            it++;
+        }
+      ret.push_back(elt); cmps.push_back(cmp);
+    }
+  return ret;
 }
 
 /*!
- * Adds a MEDCouplingFieldDouble to \a this as another time step.
- * The mesh support of input parameter \a field is ignored here, it can be NULL.
- * The support of field \a field is expected to be those computed with the input parameter \a mesh, \a meshDimRelToMax,
- * and \a profile.
+ * This method scan the two main structs along time of \a f0 and \a f1 to see if there are all lying on the same mesh along time than those in \a mesh.
+ * \a f0 and \a f1 must be defined each only on a same spatial discretization even if this can be different each other.
  *
- * This method will check that the field based on the computed support is coherent. If not an exception will be thrown.
- * A new profile is added only if no equal profile is missing.
- * For more info, see \ref AdvMEDLoaderAPIFieldRW
- *  \param [in] field - the field to add to \a this. The mesh support of field is ignored.
- *  \param [in] mesh - the supporting mesh of \a field.
- *  \param [in] meshDimRelToMax - a relative dimension of mesh entities \a field lies on (useless if field spatial discretization is ON_NODES).
- *  \param [in] profile - ids of mesh entities on which corresponding field values lie.
- *  \throw If either \a field or \a mesh or \a profile has an empty name.
- *  \throw If there are no mesh entities of \a meshDimRelToMax dimension in \a mesh.
- *  \throw If the data array of \a field is not set.
- *  \throw If the data array of \a this is already allocated but has different number of
- *         components than \a field.
- *  \throw If elements in \a mesh are not in the order suitable for writing to the MED file.
- *  \sa setFieldNoProfileSBT()
+ * \throw If \a f0 or \a f1 has not only one spatial discretization set.
+ * \throw If \a f0 or \a f1 change of spatial discretization along time.
+ * \throw If \a f0 or \a f1 on a mesh with meshname different from those in \a mesh.
+ * \thorw If \a f0 and \a f1 do not have the same times steps.
+ * \throw If mesh is null.
+ * \throw If \a f0 or \a f1 is null.
+ * \sa MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport
  */
-void MEDFileFieldMultiTS::appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile)
-{
-  const DataArrayDouble *arr=0;
-  if(field)
-    arr=field->getArray();
-  contentNotNull()->appendFieldProfile(field,arr,mesh,meshDimRelToMax,profile,*this);
-}
-
-MEDFileFieldMultiTS::MEDFileFieldMultiTS()
-{
-  _content=new MEDFileFieldMultiTSWithoutSDA;
-}
-
-MEDFileFieldMultiTS::MEDFileFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms)
-try:MEDFileAnyTypeFieldMultiTS(fid,loadAll,ms)
-{
-}
-catch(INTERP_KERNEL::Exception& e)
-{ throw e; }
-
-MEDFileFieldMultiTS::MEDFileFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities)
-try:MEDFileAnyTypeFieldMultiTS(fid,fieldName,loadAll,ms,entities)
-{
-}
-catch(INTERP_KERNEL::Exception& e)
-{ throw e; }
-
-MEDFileFieldMultiTS::MEDFileFieldMultiTS(const MEDFileFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent):MEDFileAnyTypeFieldMultiTS(other,shallowCopyOfContent)
-{
-}
-
-std::vector< std::vector<DataArrayDouble *> > MEDFileFieldMultiTS::getFieldSplitedByType2(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
-{
-  return contentNotNull()->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
-}
-
-DataArrayDouble *MEDFileFieldMultiTS::getUndergroundDataArray(int iteration, int order) const
-{
-  return static_cast<DataArrayDouble *>(contentNotNull()->getUndergroundDataArray(iteration,order));
-}
-
-DataArrayDouble *MEDFileFieldMultiTS::getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
-{
-  return static_cast<DataArrayDouble *>(contentNotNull()->getUndergroundDataArrayExt(iteration,order,entries));
-}
-
-MEDFileFieldMultiTS *MEDFileFieldMultiTS::buildNewEmpty() const
-{
-  return MEDFileFieldMultiTS::New();
-}
-
-//= MEDFileAnyTypeFieldMultiTSIterator
-
-MEDFileAnyTypeFieldMultiTSIterator::MEDFileAnyTypeFieldMultiTSIterator(MEDFileAnyTypeFieldMultiTS *fmts):_fmts(fmts),_iter_id(0),_nb_iter(0)
+int MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime(MEDFileAnyTypeFieldMultiTS *f0, MEDFileAnyTypeFieldMultiTS *f1, const MEDFileMesh *mesh, TypeOfField& tof0, TypeOfField& tof1)
 {
-  if(fmts)
+  if(!mesh)
+    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : input mesh is null !");
+  if(!f0 || !f1)
+    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : presence of null instance in fields over time !");
+  if(f0->getMeshName()!=mesh->getName())
     {
-      fmts->incrRef();
-      _nb_iter=fmts->getNumberOfTS();
+      std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : first field points to mesh \""<< f0->getMeshName() << "\" and input mesh to compare has name \"" << mesh->getName() << "\" !";
+      throw INTERP_KERNEL::Exception(oss.str());
     }
-}
-
-MEDFileAnyTypeFieldMultiTSIterator::~MEDFileAnyTypeFieldMultiTSIterator() 
-{
-}
-
-MEDFileAnyTypeField1TS *MEDFileAnyTypeFieldMultiTSIterator::nextt()
-{
-  if(_iter_id<_nb_iter)
+  if(f1->getMeshName()!=mesh->getName())
     {
-      MEDFileAnyTypeFieldMultiTS *fmts(_fmts);
-      if(fmts)
-        return fmts->getTimeStepAtPos(_iter_id++);
+      std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : second field points to mesh \""<< f1->getMeshName() << "\" and input mesh to compare has name \"" << mesh->getName() << "\" !";
+      throw INTERP_KERNEL::Exception(oss.str());
+    }
+  int nts=f0->getNumberOfTS();
+  if(nts!=f1->getNumberOfTS())
+    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : number of time steps are not the same !");
+  if(nts==0)
+    return nts;
+  for(int i=0;i<nts;i++)
+    {
+      MCAuto<MEDFileAnyTypeField1TS> f0cur=f0->getTimeStepAtPos(i);
+      MCAuto<MEDFileAnyTypeField1TS> f1cur=f1->getTimeStepAtPos(i);
+      std::vector<TypeOfField> tofs0(f0cur->getTypesOfFieldAvailable()),tofs1(f1cur->getTypesOfFieldAvailable());
+      if(tofs0.size()!=1 || tofs1.size()!=1)
+        throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : All time steps must be defined on only one spatial discretization !");
+      if(i!=0)
+        {
+          if(tof0!=tofs0[0] || tof1!=tofs1[0])
+            throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : Across times steps MEDFileAnyTypeFieldMultiTS instances have to keep the same unique spatial discretization !");
+        }
       else
-        return 0;
+        { tof0=tofs0[0]; tof1=tofs1[0]; }
+      if(f0cur->getMeshIteration()!=mesh->getIteration() || f0cur->getMeshOrder()!=mesh->getOrder())
+        {
+          std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : first field points to mesh time step (" << f0cur->getMeshIteration() << ","<< f0cur->getMeshOrder() << ") whereas input mesh points to time step (" << mesh->getIteration() << "," << mesh->getOrder() << ") !";
+          throw INTERP_KERNEL::Exception(oss.str());
+        }
+      if(f1cur->getMeshIteration()!=mesh->getIteration() || f1cur->getMeshOrder()!=mesh->getOrder())
+        {
+          std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : second field points to mesh time step (" << f1cur->getMeshIteration() << ","<< f1cur->getMeshOrder() << ") whereas input mesh points to time step (" << mesh->getIteration() << "," << mesh->getOrder() << ") !";
+          throw INTERP_KERNEL::Exception(oss.str());
+        }
+      if(f0cur->getIteration()!=f1cur->getIteration() || f0cur->getOrder()!=f1cur->getOrder())
+        {
+          std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : all the time steps must be the same ! it is not the case (" << f0cur->getIteration() << "," << f0cur->getOrder() << ")!=(" << f1cur->getIteration() << "," << f1cur->getOrder() << ") !";
+          throw INTERP_KERNEL::Exception(oss.str());
+        }
     }
-  else
-    return 0;
-}
-
-//= MEDFileIntFieldMultiTS
-
-/*!
- * Returns a new empty instance of MEDFileFieldMultiTS.
- *  \return MEDFileIntFieldMultiTS * - a new instance of MEDFileIntFieldMultiTS. The caller
- *          is to delete this field using decrRef() as it is no more needed.
- */
-MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New()
-{
-  return new MEDFileIntFieldMultiTS;
+  return nts;
 }
 
-/*!
- * Returns a new instance of MEDFileIntFieldMultiTS holding data of the first field
- * that has been read from a specified MED file.
- *  \param [in] fileName - the name of the MED file to read.
- *  \return MEDFileFieldMultiTS * - a new instance of MEDFileIntFieldMultiTS. The caller
- *          is to delete this field using decrRef() as it is no more needed.
- *  \throw If reading the file fails.
- */
-MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New(const std::string& fileName, bool loadAll)
+template<class T>
+MCAuto<MEDFileAnyTypeField1TS> AggregateHelperF1TS(const std::vector< typename MLFieldTraits<T>::F1TSType const *>& f1tss, const std::vector< std::vector< std::pair<int,int> > >& dts)
 {
-  MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
-  return New(fid,loadAll);
+  MCAuto< typename MLFieldTraits<T>::F1TSType > ret(MLFieldTraits<T>::F1TSType::New());
+  if(f1tss.empty())
+    throw INTERP_KERNEL::Exception("AggregateHelperF1TS : empty vector !");
+  std::size_t sz(f1tss.size()),i(0);
+  std::vector< typename MLFieldTraits<T>::F1TSWSDAType const *> f1tsw(sz);
+  for(typename std::vector< typename MLFieldTraits<T>::F1TSType const *>::const_iterator it=f1tss.begin();it!=f1tss.end();it++,i++)
+    {
+      typename MLFieldTraits<T>::F1TSType const *elt(*it);
+      if(!elt)
+        throw INTERP_KERNEL::Exception("AggregateHelperF1TS : presence of a null pointer !");
+      f1tsw[i]=dynamic_cast<typename MLFieldTraits<T>::F1TSWSDAType const *>(elt->contentNotNullBase());
+    }
+  typename MLFieldTraits<T>::F1TSWSDAType *retc(dynamic_cast<typename MLFieldTraits<T>::F1TSWSDAType *>(ret->contentNotNullBase()));
+  if(!retc)
+    throw INTERP_KERNEL::Exception("AggregateHelperF1TS : internal error 1 !");
+  retc->aggregate(f1tsw,dts);
+  ret->setDtUnit(f1tss[0]->getDtUnit());
+  return DynamicCast<typename MLFieldTraits<T>::F1TSType , MEDFileAnyTypeField1TS>(ret);
 }
 
-MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New(med_idt fid, bool loadAll)
+template<class T>
+MCAuto< MEDFileAnyTypeFieldMultiTS > AggregateHelperFMTS(const std::vector< typename MLFieldTraits<T>::FMTSType const *>& fmtss, const std::vector< std::vector< std::pair<int,int> > >& dts)
 {
-  MCAuto<MEDFileIntFieldMultiTS> ret(new MEDFileIntFieldMultiTS(fid,loadAll,0));
-  ret->contentNotNull();//to check that content type matches with \a this type.
-  return ret.retn();
+  MCAuto< typename MLFieldTraits<T>::FMTSType > ret(MLFieldTraits<T>::FMTSType::New());
+  if(fmtss.empty())
+    throw INTERP_KERNEL::Exception("AggregateHelperFMTS : empty vector !");
+  std::size_t sz(fmtss.size());
+  for(typename std::vector< typename MLFieldTraits<T>::FMTSType const *>::const_iterator it=fmtss.begin();it!=fmtss.end();it++)
+    {
+      typename MLFieldTraits<T>::FMTSType const *elt(*it);
+      if(!elt)
+        throw INTERP_KERNEL::Exception("AggregateHelperFMTS : presence of null pointer !");
+    }
+  int nbTS(fmtss[0]->getNumberOfTS());
+  for(typename std::vector< typename MLFieldTraits<T>::FMTSType const *>::const_iterator it=fmtss.begin();it!=fmtss.end();it++)
+    if((*it)->getNumberOfTS()!=nbTS)
+      throw INTERP_KERNEL::Exception("AggregateHelperFMTS : all fields must have the same number of TS !");
+  for(int iterTS=0;iterTS<nbTS;iterTS++)
+    {
+      std::size_t i(0);
+      std::vector< typename MLFieldTraits<T>::F1TSType const *> f1tss(sz);
+      std::vector< MCAuto<typename MLFieldTraits<T>::F1TSType> > f1tss2(sz);
+      for(typename std::vector< typename MLFieldTraits<T>::FMTSType const *>::const_iterator it=fmtss.begin();it!=fmtss.end();it++,i++)
+        { f1tss2[i]=(*it)->getTimeStepAtPos(iterTS); f1tss[i]=f1tss2[i]; }
+      MCAuto<MEDFileAnyTypeField1TS> f1ts(AggregateHelperF1TS<T>(f1tss,dts));
+      ret->pushBackTimeStep(f1ts);
+      ret->setDtUnit(f1ts->getDtUnit());
+    }
+  return DynamicCast<typename MLFieldTraits<T>::FMTSType , MEDFileAnyTypeFieldMultiTS>(ret);
 }
 
 /*!
- * Returns a new instance of MEDFileIntFieldMultiTS holding data of a given field
- * that has been read from a specified MED file.
- *  \param [in] fileName - the name of the MED file to read.
- *  \param [in] fieldName - the name of the field to read.
- *  \return MEDFileFieldMultiTS * - a new instance of MEDFileIntFieldMultiTS. The caller
- *          is to delete this field using decrRef() as it is no more needed.
- *  \throw If reading the file fails.
- *  \throw If there is no field named \a fieldName in the file.
+ * \a dts and \a ftmss are expected to have same size.
  */
-MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New(const std::string& fileName, const std::string& fieldName, bool loadAll)
+MCAuto<MEDFileAnyTypeFieldMultiTS> MEDFileAnyTypeFieldMultiTS::Aggregate(const std::vector<const MEDFileAnyTypeFieldMultiTS *>& fmtss, const std::vector< std::vector< std::pair<int,int> > >& dts)
 {
-  MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
-  return New(fid,fieldName,loadAll);
+  if(fmtss.empty())
+    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::Aggregate : input vector is empty !");
+  std::size_t sz(fmtss.size());
+  std::vector<const MEDFileFieldMultiTS *> fmtss1;
+  std::vector<const MEDFileIntFieldMultiTS *> fmtss2;
+  for(std::vector<const MEDFileAnyTypeFieldMultiTS *>::const_iterator it=fmtss.begin();it!=fmtss.end();it++)
+    {
+      if(!(*it))
+        throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::Aggregate : presence of null instance in input vector !");
+      const MEDFileFieldMultiTS *elt1(dynamic_cast<const MEDFileFieldMultiTS *>(*it));
+      if(elt1)
+        {
+          fmtss1.push_back(elt1);
+          continue;
+        }
+      const MEDFileIntFieldMultiTS *elt2(dynamic_cast<const MEDFileIntFieldMultiTS *>(*it));
+      if(elt2)
+        {
+          fmtss2.push_back(elt2);
+          continue;
+        }
+      throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::Aggregate : not recognized type !");
+    }
+  if(fmtss1.size()!=sz && fmtss2.size()!=sz)
+    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::Aggregate : type of data is not homogeneous !");
+  if(fmtss1.size()==sz)
+    return AggregateHelperFMTS<double>(fmtss1,dts);
+  if(fmtss2.size()!=sz)
+    return AggregateHelperFMTS<int>(fmtss2,dts);
+  throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::Aggregate : not implemented yet !");
 }
 
-MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New(med_idt fid, const std::string& fieldName, bool loadAll)
+MEDFileAnyTypeFieldMultiTSIterator *MEDFileAnyTypeFieldMultiTS::iterator()
 {
-  MCAuto<MEDFileIntFieldMultiTS> ret(new MEDFileIntFieldMultiTS(fid,fieldName,loadAll,0));
-  ret->contentNotNull();//to check that content type matches with \a this type.
-  return ret.retn();
+  return new MEDFileAnyTypeFieldMultiTSIterator(this);
 }
 
-/*!
- * Returns a new instance of MEDFileIntFieldMultiTS. If \a shallowCopyOfContent is true the content of \a other is shallow copied.
- * If \a shallowCopyOfContent is false, \a other is taken to be the content of \a this.
- *
- * Returns a new instance of MEDFileIntFieldMultiTS holding either a shallow copy
- * of a given MEDFileIntFieldMultiTSWithoutSDA ( \a other ) or \a other itself.
- * \warning this is a shallow copy constructor
- *  \param [in] other - a MEDFileIntField1TSWithoutSDA to copy.
- *  \param [in] shallowCopyOfContent - if \c true, a shallow copy of \a other is created.
- *  \return MEDFileIntFieldMultiTS * - a new instance of MEDFileIntFieldMultiTS. The caller
- *          is to delete this field using decrRef() as it is no more needed.
- */
-MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New(const MEDFileIntFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent)
-{
-  return new MEDFileIntFieldMultiTS(other,shallowCopyOfContent);
-}
+//= MEDFileFieldMultiTS
 
-MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, const std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> >& entities, bool loadAll)
+MEDFileAnyTypeFieldMultiTS *MEDFileFieldMultiTS::shallowCpy() const
 {
-  MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
-  INTERP_KERNEL::AutoCppPtr<MEDFileEntities> ent(new MEDFileStaticEntities(entities));
-  MCAuto<MEDFileIntFieldMultiTS> ret(new MEDFileIntFieldMultiTS(fid,fieldName,loadAll,0,ent));
-  ret->contentNotNull();//to check that content type matches with \a this type.
-  return ret.retn();
+  return new MEDFileFieldMultiTS(*this);
 }
 
 /*!
- * This method performs a copy with datatype modification ( int32->float64 ) of \a this. The globals information are copied
+ * This method performs a copy with datatype modification ( float64->int32 ) of \a this. The globals information are copied
  * following the given input policy.
  *
  * \param [in] isDeepCpyGlobs - a boolean that indicates the behaviour concerning globals (profiles and localizations)
  *                            By default (true) the globals are deeply copied.
- * \return MEDFileFieldMultiTS * - a new object that is the result of the conversion of \a this to float64 field.
+ * \return MEDFileIntFieldMultiTS * - a new object that is the result of the conversion of \a this to int32 field.
  */
-MEDFileFieldMultiTS *MEDFileIntFieldMultiTS::convertToDouble(bool isDeepCpyGlobs) const
+MEDFileIntFieldMultiTS *MEDFileFieldMultiTS::convertToInt(bool isDeepCpyGlobs) const
 {
-  MCAuto<MEDFileFieldMultiTS> ret;
+  MCAuto<MEDFileIntFieldMultiTS> ret;
   const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(_content);
   if(content)
     {
-      const MEDFileIntFieldMultiTSWithoutSDA *contc=dynamic_cast<const MEDFileIntFieldMultiTSWithoutSDA *>(content);
+      const MEDFileFieldMultiTSWithoutSDA *contc=dynamic_cast<const MEDFileFieldMultiTSWithoutSDA *>(content);
       if(!contc)
-        throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::convertToInt : the content inside this is not INT32 ! This is incoherent !");
-      MCAuto<MEDFileFieldMultiTSWithoutSDA> newc(contc->convertToDouble());
-      ret=static_cast<MEDFileFieldMultiTS *>(MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent((MEDFileFieldMultiTSWithoutSDA *)newc));
+        throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::convertToInt : the content inside this is not FLOAT64 ! This is incoherent !");
+      MCAuto<MEDFileIntFieldMultiTSWithoutSDA> newc(contc->convertToInt());
+      ret=static_cast<MEDFileIntFieldMultiTS *>(MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent((MEDFileIntFieldMultiTSWithoutSDA *)newc));
     }
   else
-    ret=MEDFileFieldMultiTS::New();
+    ret=MEDFileIntFieldMultiTS::New();
   if(isDeepCpyGlobs)
     ret->deepCpyGlobs(*this);
   else
@@ -10375,349 +8898,59 @@ MEDFileFieldMultiTS *MEDFileIntFieldMultiTS::convertToDouble(bool isDeepCpyGlobs
   return ret.retn();
 }
 
-MEDFileAnyTypeFieldMultiTS *MEDFileIntFieldMultiTS::shallowCpy() const
-{
-  return new MEDFileIntFieldMultiTS(*this);
-}
-
-void MEDFileIntFieldMultiTS::checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const
-{
-  if(!f1ts)
-    throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::checkCoherencyOfType : input field1TS is NULL ! Impossible to check !");
-  const MEDFileIntField1TS *f1tsC=dynamic_cast<const MEDFileIntField1TS *>(f1ts);
-  if(!f1tsC)
-    throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::checkCoherencyOfType : the input field1TS is not a INT32 type !");
-}
-
-/*!
- * This is the simplest version to fetch a field for MED structure. One drawback : if \a this is a complex field (multi spatial discretization inside a same field) this method will throw exception and more advance
- * method should be called (getFieldOnMeshAtLevel for example).
- * But for normal usage of field in MED file world this method is the most efficient to fetch data.
- *
- * \param [in] iteration - the iteration number of a required time step.
- * \param [in] order - the iteration order number of required time step.
- * \param [in] mesh - the mesh the field is lying on
- * \return MEDCouplingFieldInt * - a new instance of MEDCouplingFieldInt. The
- *          caller is to delete this field using decrRef() as it is no more needed. 
- */
-MEDCouplingFieldInt *MEDFileIntFieldMultiTS::field(int iteration, int order, const MEDFileMesh *mesh) const
-{
-  const MEDFileAnyTypeField1TSWithoutSDA& myF1TS(contentNotNullBase()->getTimeStepEntry(iteration,order));
-  const MEDFileIntField1TSWithoutSDA *myF1TSC(dynamic_cast<const MEDFileIntField1TSWithoutSDA *>(&myF1TS));
-  if(!myF1TSC)
-    throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::field : mismatch of type of field expecting INT32 !");
-  MCAuto<DataArray> arrOut;
-  MCAuto<MEDCouplingFieldDouble> ret(myF1TS.fieldOnMesh(this,mesh,arrOut,*contentNotNullBase()));
-  MCAuto<MEDCouplingFieldInt> ret2(MEDFileIntField1TS::SetDataArrayDoubleInIntField(ret,arrOut));
-  return ret2.retn();
-}
-
-/*!
- * Returns a new MEDCouplingFieldInt of a given type, of a given time step, lying on
- * mesh entities of a given dimension of the first mesh in MED file.
- * For more info, see \ref AdvMEDLoaderAPIFieldRW
- *  \param [in] type - a spatial discretization of interest.
- *  \param [in] iteration - the iteration number of a required time step.
- *  \param [in] order - the iteration order number of required time step.
- *  \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities.
- *  \param [in] renumPol - specifies how to permute values of the result field according to
- *          the optional numbers of cells and nodes, if any. The valid values are
- *          - 0 - do not permute.
- *          - 1 - permute cells.
- *          - 2 - permute nodes.
- *          - 3 - permute cells and nodes.
- *
- *  \return MEDCouplingFieldInt * - a new instance of MEDCouplingFieldDouble. The
- *          caller is to delete this field using decrRef() as it is no more needed. 
- *  \throw If the MED file is not readable.
- *  \throw If there is no mesh in the MED file.
- *  \throw If there are no mesh entities of \a meshDimRelToMax dimension in the mesh.
- *  \throw If no field values of the required parameters are available.
- */
-MEDCouplingFieldInt *MEDFileIntFieldMultiTS::getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol) const
-{
-  const MEDFileAnyTypeField1TSWithoutSDA& myF1TS(contentNotNullBase()->getTimeStepEntry(iteration,order));
-  const MEDFileIntField1TSWithoutSDA *myF1TSC(dynamic_cast<const MEDFileIntField1TSWithoutSDA *>(&myF1TS));
-  if(!myF1TSC)
-    throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::getFieldAtLevel : mismatch of type of field expecting INT32 !");
-  MCAuto<DataArray> arr;
-  MCAuto<MEDCouplingFieldDouble> ret(myF1TSC->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arr,*contentNotNullBase()));
-  MCAuto<MEDCouplingFieldInt> ret2(MEDFileIntField1TS::SetDataArrayDoubleInIntField(ret,arr));
-  return ret2.retn();
-}
-
-/*!
- * Returns a new MEDCouplingFieldInt of a given type, of a given time step, lying on
- * the top level cells of the first mesh in MED file.
- * For more info, see \ref AdvMEDLoaderAPIFieldRW
- *  \param [in] type - a spatial discretization of interest.
- *  \param [in] iteration - the iteration number of a required time step.
- *  \param [in] order - the iteration order number of required time step.
- *  \param [in] renumPol - specifies how to permute values of the result field according to
- *          the optional numbers of cells and nodes, if any. The valid values are
- *          - 0 - do not permute.
- *          - 1 - permute cells.
- *          - 2 - permute nodes.
- *          - 3 - permute cells and nodes.
- *
- *  \return MEDCouplingFieldInt * - a new instance of MEDCouplingFieldDouble. The
- *          caller is to delete this field using decrRef() as it is no more needed. 
- *  \throw If the MED file is not readable.
- *  \throw If there is no mesh in the MED file.
- *  \throw If no field values of the required parameters are available.
- */
-MEDCouplingFieldInt *MEDFileIntFieldMultiTS::getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol) const
+MEDFileFieldMultiTS::MEDFileFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms)
+try:MEDFileTemplateFieldMultiTS<double>(fid,loadAll,ms)
 {
-  const MEDFileAnyTypeField1TSWithoutSDA& myF1TS(contentNotNullBase()->getTimeStepEntry(iteration,order));
-  const MEDFileIntField1TSWithoutSDA *myF1TSC(dynamic_cast<const MEDFileIntField1TSWithoutSDA *>(&myF1TS));
-  if(!myF1TSC)
-    throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::getFieldAtTopLevel : mismatch of type of field ! INT32 expected !");
-  MCAuto<DataArray> arr;
-  MCAuto<MEDCouplingFieldDouble> ret(myF1TSC->getFieldAtTopLevel(type,std::string(),renumPol,this,arr,*contentNotNullBase()));
-  MCAuto<MEDCouplingFieldInt> ret2(MEDFileIntField1TS::SetDataArrayDoubleInIntField(ret,arr));
-  return ret2.retn();
 }
+catch(INTERP_KERNEL::Exception& e)
+{ throw e; }
 
-/*!
- * Returns a new MEDCouplingFieldInt of a given type, of a given time step, lying on
- * a given support.
- * For more info, see \ref AdvMEDLoaderAPIFieldRW
- *  \param [in] type - a spatial discretization of interest.
- *  \param [in] iteration - the iteration number of a required time step.
- *  \param [in] order - the iteration order number of required time step.
- *  \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities.
- *  \param [in] mesh - the supporting mesh.
- *  \param [in] renumPol - specifies how to permute values of the result field according to
- *          the optional numbers of cells and nodes, if any. The valid values are
- *          - 0 - do not permute.
- *          - 1 - permute cells.
- *          - 2 - permute nodes.
- *          - 3 - permute cells and nodes.
- *
- *  \return MEDCouplingFieldInt * - a new instance of MEDCouplingFieldDouble. The
- *          caller is to delete this field using decrRef() as it is no more needed. 
- *  \throw If there are no mesh entities of \a meshDimRelToMax dimension in the mesh.
- *  \throw If no field of \a this is lying on \a mesh.
- *  \throw If no field values of the required parameters are available.
- */
-MEDCouplingFieldInt *MEDFileIntFieldMultiTS::getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol) const
+MEDFileFieldMultiTS::MEDFileFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities)
+try:MEDFileTemplateFieldMultiTS<double>(fid,fieldName,loadAll,ms,entities)
 {
-  const MEDFileAnyTypeField1TSWithoutSDA& myF1TS(contentNotNullBase()->getTimeStepEntry(iteration,order));
-  const MEDFileIntField1TSWithoutSDA *myF1TSC(dynamic_cast<const MEDFileIntField1TSWithoutSDA *>(&myF1TS));
-  if(!myF1TSC)
-    throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::getFieldOnMeshAtLevel : mismatch of type of field ! INT32 expected !");
-  MCAuto<DataArray> arr;
-  MCAuto<MEDCouplingFieldDouble> ret(myF1TSC->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arr,*contentNotNullBase()));
-  MCAuto<MEDCouplingFieldInt> ret2(MEDFileIntField1TS::SetDataArrayDoubleInIntField(ret,arr));
-  return ret2.retn();
 }
+catch(INTERP_KERNEL::Exception& e)
+{ throw e; }
 
-/*!
- * Returns a new MEDCouplingFieldInt of given type, of a given time step, lying on a
- * given support. 
- * For more info, see \ref AdvMEDLoaderAPIFieldRW
- *  \param [in] type - a spatial discretization of the new field.
- *  \param [in] iteration - the iteration number of a required time step.
- *  \param [in] order - the iteration order number of required time step.
- *  \param [in] mesh - the supporting mesh.
- *  \param [out] arrOut - the DataArrayInt containing values of field.
- *  \param [in] renumPol - specifies how to permute values of the result field according to
- *          the optional numbers of cells and nodes, if any. The valid values are
- *          - 0 - do not permute.
- *          - 1 - permute cells.
- *          - 2 - permute nodes.
- *          - 3 - permute cells and nodes.
- *
- *  \return MEDCouplingFieldInt * - a new instance of MEDCouplingFieldDouble. The
- *          caller is to delete this field using decrRef() as it is no more needed. 
- *  \throw If no field of \a this is lying on \a mesh.
- *  \throw If no field values of the required parameters are available.
- */
-MEDCouplingFieldInt *MEDFileIntFieldMultiTS::getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol) const
+MEDFileFieldMultiTS::MEDFileFieldMultiTS(const MEDFileFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent):MEDFileTemplateFieldMultiTS<double>(other,shallowCopyOfContent)
 {
-  const MEDFileAnyTypeField1TSWithoutSDA& myF1TS(contentNotNullBase()->getTimeStepEntry(iteration,order));
-  const MEDFileIntField1TSWithoutSDA *myF1TSC(dynamic_cast<const MEDFileIntField1TSWithoutSDA *>(&myF1TS));
-  if(!myF1TSC)
-    throw INTERP_KERNEL::Exception("MEDFileFieldIntMultiTS::getFieldOnMeshAtLevel : mismatch of type of field ! INT32 expected !");
-  MCAuto<DataArray> arr;
-  MCAuto<MEDCouplingFieldDouble> ret(myF1TSC->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arr,*contentNotNullBase()));
-  MCAuto<MEDCouplingFieldInt> ret2(MEDFileIntField1TS::SetDataArrayDoubleInIntField(ret,arr));
-  return ret2.retn();
 }
 
-/*!
- * This method has a close behaviour than MEDFileIntFieldMultiTS::getFieldAtLevel.
- * This method is called 'old' because the user should give the mesh name he wants to use for it's field.
- * This method is useful for MED2 file format when field on different mesh was autorized.
- */
-MEDCouplingFieldInt *MEDFileIntFieldMultiTS::getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol) const
+std::vector< std::vector<DataArrayDouble *> > MEDFileFieldMultiTS::getFieldSplitedByType2(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
 {
-  const MEDFileAnyTypeField1TSWithoutSDA& myF1TS(contentNotNullBase()->getTimeStepEntry(iteration,order));
-  const MEDFileIntField1TSWithoutSDA *myF1TSC(dynamic_cast<const MEDFileIntField1TSWithoutSDA *>(&myF1TS));
-  if(!myF1TSC)
-    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldOnMeshAtLevel : mismatch of type of field ! INT32 expected !");
-  MCAuto<DataArray> arr;
-  MCAuto<MEDCouplingFieldDouble> ret(myF1TSC->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arr,*contentNotNullBase()));
-  MCAuto<MEDCouplingFieldInt> ret2(MEDFileIntField1TS::SetDataArrayDoubleInIntField(ret,arr));
-  return ret2.retn();
+  return contentNotNull()->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
 }
 
-/*!
- * Returns values and a profile of the field of a given type, of a given time step,
- * lying on a given support.
- * For more info, see \ref AdvMEDLoaderAPIFieldRW
- *  \param [in] type - a spatial discretization of the field.
- *  \param [in] iteration - the iteration number of a required time step.
- *  \param [in] order - the iteration order number of required time step.
- *  \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities.
- *  \param [in] mesh - the supporting mesh.
- *  \param [out] pfl - a new instance of DataArrayInt holding ids of mesh entities the
- *          field of interest lies on. If the field lies on all entities of the given
- *          dimension, all ids in \a pfl are zero. The caller is to delete this array
- *          using decrRef() as it is no more needed.  
- *  \param [in] glob - the global data storing profiles and localization.
- *  \return DataArrayInt * - a new instance of DataArrayInt holding values of the
- *          field. The caller is to delete this array using decrRef() as it is no more needed.
- *  \throw If there are no mesh entities of \a meshDimRelToMax dimension in \a mesh.
- *  \throw If no field of \a this is lying on \a mesh.
- *  \throw If no field values of the required parameters are available.
- */
-DataArrayInt *MEDFileIntFieldMultiTS::getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const
-{
-  const MEDFileAnyTypeField1TSWithoutSDA& myF1TS=contentNotNullBase()->getTimeStepEntry(iteration,order);
-  const MEDFileIntField1TSWithoutSDA *myF1TSC=dynamic_cast<const MEDFileIntField1TSWithoutSDA *>(&myF1TS);
-  if(!myF1TSC)
-    throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::getFieldWithProfile : mismatch of type of field ! INT32 expected !");
-  MCAuto<DataArray> ret=myF1TSC->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNullBase());
-  return MEDFileIntField1TS::ReturnSafelyDataArrayInt(ret);
-}
+//= MEDFileAnyTypeFieldMultiTSIterator
 
-/*!
- * Returns a new MEDFileIntField1TS holding data of a given time step of \a this field.
- *  \param [in] pos - a time step id.
- *  \return MEDFileIntField1TS * - a new instance of MEDFileIntField1TS. The caller is to
- *          delete this field using decrRef() as it is no more needed.
- *  \throw If \a pos is not a valid time step id.
- */
-MEDFileIntField1TS *MEDFileIntFieldMultiTS::getTimeStepAtPos(int pos) const
+MEDFileAnyTypeFieldMultiTSIterator::MEDFileAnyTypeFieldMultiTSIterator(MEDFileAnyTypeFieldMultiTS *fmts):_fmts(fmts),_iter_id(0),_nb_iter(0)
 {
-  const MEDFileAnyTypeField1TSWithoutSDA *item=contentNotNullBase()->getTimeStepAtPos2(pos);
-  if(!item)
-    {
-      std::ostringstream oss; oss << "MEDFileIntFieldMultiTS::getTimeStepAtPos : field at pos #" << pos << " is null !";
-      throw INTERP_KERNEL::Exception(oss.str());
-    }
-  const MEDFileIntField1TSWithoutSDA *itemC=dynamic_cast<const MEDFileIntField1TSWithoutSDA *>(item);
-  if(itemC)
+  if(fmts)
     {
-      MCAuto<MEDFileIntField1TS> ret=MEDFileIntField1TS::New(*itemC,false);
-      ret->shallowCpyGlobs(*this);
-      return ret.retn();
+      fmts->incrRef();
+      _nb_iter=fmts->getNumberOfTS();
     }
-  std::ostringstream oss; oss << "MEDFileIntFieldMultiTS::getTimeStepAtPos : type of field at pos #" << pos << " is not INT32 !";
-  throw INTERP_KERNEL::Exception(oss.str());
-}
-
-/*!
- * Adds a MEDCouplingFieldInt to \a this as another time step. The underlying mesh of
- * the given field is checked if its elements are sorted suitable for writing to MED file
- * ("STB" stands for "Sort By Type"), if not, an exception is thrown. 
- * For more info, see \ref AdvMEDLoaderAPIFieldRW
- *  \param [in] field - the field to add to \a this.
- *  \throw If the name of \a field is empty.
- *  \throw If the data array of \a field is not set.
- *  \throw If existing time steps have different name or number of components than \a field.
- *  \throw If the underlying mesh of \a field has no name.
- *  \throw If elements in the mesh are not in the order suitable for writing to the MED file.
- */
-void MEDFileIntFieldMultiTS::appendFieldNoProfileSBT(const MEDCouplingFieldInt *field)
-{
-  MCAuto<MEDCouplingFieldDouble> field2(MEDFileIntField1TS::ConvertFieldIntToFieldDouble(field));
-  contentNotNull()->appendFieldNoProfileSBT(field2,field->getArray(),*this);
-}
-
-/*!
- * Adds a MEDCouplingFieldDouble to \a this as another time step. 
- * The mesh support of input parameter \a field is ignored here, it can be NULL.
- * The support of field \a field is expected to be those computed with the input parameter \a mesh, \a meshDimRelToMax,
- * and \a profile.
- *
- * This method will check that the field based on the computed support is coherent. If not an exception will be thrown.
- * A new profile is added only if no equal profile is missing.
- * For more info, see \ref AdvMEDLoaderAPIFieldRW
- *  \param [in] field - the field to add to \a this. The field double values and mesh support are ignored.
- *  \param [in] arrOfVals - the values of the field \a field used.
- *  \param [in] mesh - the supporting mesh of \a field.
- *  \param [in] meshDimRelToMax - a relative dimension of mesh entities \a field lies on (useless if field spatial discretization is ON_NODES).
- *  \param [in] profile - ids of mesh entities on which corresponding field values lie.
- *  \throw If either \a field or \a mesh or \a profile has an empty name.
- *  \throw If there are no mesh entities of \a meshDimRelToMax dimension in \a mesh.
- *  \throw If the data array of \a field is not set.
- *  \throw If the data array of \a this is already allocated but has different number of
- *         components than \a field.
- *  \throw If elements in \a mesh are not in the order suitable for writing to the MED file.
- *  \sa setFieldNoProfileSBT()
- */
-void MEDFileIntFieldMultiTS::appendFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile)
-{
-  MCAuto<MEDCouplingFieldDouble> field2(MEDFileIntField1TS::ConvertFieldIntToFieldDouble(field));
-  contentNotNull()->appendFieldProfile(field2,field->getArray(),mesh,meshDimRelToMax,profile,*this);
-}
-
-const MEDFileIntFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTS::contentNotNull() const
-{
-  const MEDFileAnyTypeFieldMultiTSWithoutSDA *pt(_content);
-  if(!pt)
-    throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::contentNotNull : the content pointer is null !");
-  const MEDFileIntFieldMultiTSWithoutSDA *ret=dynamic_cast<const MEDFileIntFieldMultiTSWithoutSDA *>(pt);
-  if(!ret)
-    throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::contentNotNull : the content pointer is not null but it is not of type int ! Reason is maybe that the read field has not the type INT32 !");
-  return ret;
-}
-
-MEDFileIntFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTS::contentNotNull()
-{
-  MEDFileAnyTypeFieldMultiTSWithoutSDA *pt(_content);
-  if(!pt)
-    throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::contentNotNull : the non const content pointer is null !");
-  MEDFileIntFieldMultiTSWithoutSDA *ret=dynamic_cast<MEDFileIntFieldMultiTSWithoutSDA *>(pt);
-  if(!ret)
-    throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::contentNotNull : the non const content pointer is not null but it is not of type int ! Reason is maybe that the read field has not the type INT32 !");
-  return ret;
-}
-
-MEDFileIntFieldMultiTS::MEDFileIntFieldMultiTS()
-{
-  _content=new MEDFileIntFieldMultiTSWithoutSDA;
-}
-
-MEDFileIntFieldMultiTS::MEDFileIntFieldMultiTS(const MEDFileIntFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent):MEDFileAnyTypeFieldMultiTS(other,shallowCopyOfContent)
-{
-}
-
-MEDFileIntFieldMultiTS::MEDFileIntFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms)
-try:MEDFileAnyTypeFieldMultiTS(fid,loadAll,ms)
-{
 }
-catch(INTERP_KERNEL::Exception& e)
-{ throw e; }
 
-MEDFileIntFieldMultiTS::MEDFileIntFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities)
-try:MEDFileAnyTypeFieldMultiTS(fid,fieldName,loadAll,ms,entities)
+MEDFileAnyTypeFieldMultiTSIterator::~MEDFileAnyTypeFieldMultiTSIterator() 
 {
 }
-catch(INTERP_KERNEL::Exception& e)
-{ throw e; }
 
-DataArrayInt *MEDFileIntFieldMultiTS::getUndergroundDataArray(int iteration, int order) const
+MEDFileAnyTypeField1TS *MEDFileAnyTypeFieldMultiTSIterator::nextt()
 {
-  return static_cast<DataArrayInt *>(contentNotNull()->getUndergroundDataArray(iteration,order));
+  if(_iter_id<_nb_iter)
+    {
+      MEDFileAnyTypeFieldMultiTS *fmts(_fmts);
+      if(fmts)
+        return fmts->getTimeStepAtPos(_iter_id++);
+      else
+        return 0;
+    }
+  else
+    return 0;
 }
 
-MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::buildNewEmpty() const
-{
-  return MEDFileIntFieldMultiTS::New();
-}
+//= MEDFileIntFieldMultiTS
 
 //= MEDFileFields
 
@@ -10954,9 +9187,14 @@ try:MEDFileFieldGlobsReal(fid)
             _fields[i]=MEDFileIntFieldMultiTSWithoutSDA::New(fid,fieldName,meshName,typcha,infos,nbOfStep,dtunit,loadAll,ms,entities);
             break;
           }
+        case MED_NODE://6432
+          {
+            _fields[i]=MEDFileFloatFieldMultiTSWithoutSDA::New(fid,fieldName,meshName,typcha,infos,nbOfStep,dtunit,loadAll,ms,entities);
+            break;
+          }
         default:
           {
-            std::ostringstream oss; oss << "constructor MEDFileFields(fileName) : file \'" << FileNameFromFID(fid) << "\' at pos #" << i << " field has name \'" << fieldName << "\' but the type of field is not in [MED_FLOAT64, MED_INT32] !";
+            std::ostringstream oss; oss << "constructor MEDFileFields(fileName) : file \'" << FileNameFromFID(fid) << "\' at pos #" << i << " field has name \'" << fieldName << "\' but the type of field is not in [MED_FLOAT64, MED_INT32, MED_FLOAT32] !";
             throw INTERP_KERNEL::Exception(oss.str());
           }
       }
index f2c3b324c93d806ffcdcc88c95a7742e8fed062d..c39bfdafdffd61fb68b1a43225e73b1bcccc0825 100644 (file)
@@ -16,7 +16,7 @@
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-// Author : Anthony Geay (CEA/DEN)
+// Author : Anthony Geay (EDF R&D)
 
 #ifndef __MEDFILEFIELD_HXX__
 #define __MEDFILEFIELD_HXX__
@@ -153,9 +153,9 @@ namespace MEDCoupling
     std::size_t getHeapMemorySizeWithoutChildren() const;
     std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
     MEDFileFieldPerMeshPerTypePerDisc *deepCopy(MEDFileFieldPerMeshPerTypeCommon *father) const;
-    void assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldDouble *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
-    void assignFieldProfile(bool isPflAlone, int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldDouble *field, const DataArray *arrr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
-    void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldDouble *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob);
+    void assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
+    void assignFieldProfile(bool isPflAlone, int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arrr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
+    void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob);
     void getCoarseData(TypeOfField& type, std::pair<int,int>& dad, std::string& pfl, std::string& loc) const;
     void writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const;
     const MEDFileFieldPerMeshPerTypeCommon *getFather() const;
@@ -233,10 +233,10 @@ namespace MEDCoupling
   public:
     std::size_t getHeapMemorySizeWithoutChildren() const;
     std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
-    void assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
-    void assignFieldProfile(bool isPflAlone, int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
-    void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob);
-    void assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
+    void assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
+    void assignFieldProfile(bool isPflAlone, int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
+    void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob);
+    void assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
     const MEDFileFieldPerMesh *getFather() const;
     void loadOnlyStructureOfDataRecursively(med_idt fid, int &start, const MEDFileFieldNameScope& nasc);
     void loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc);
@@ -283,10 +283,10 @@ namespace MEDCoupling
     virtual void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<int,int> >& dads, std::vector<const DataArrayInt *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const = 0;
   protected:
     void deepCopyElements();
-    std::vector<int> addNewEntryIfNecessary(const MEDCouplingFieldDouble *field, int offset, int nbOfCells);
-    std::vector<int> addNewEntryIfNecessaryGauss(const MEDCouplingFieldDouble *field, int offset, int nbOfCells);
-    std::vector<int> addNewEntryIfNecessary(const MEDCouplingFieldDouble *field, const DataArrayInt *subCells);
-    std::vector<int> addNewEntryIfNecessaryGauss(const MEDCouplingFieldDouble *field, const DataArrayInt *subCells);
+    std::vector<int> addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, int offset, int nbOfCells);
+    std::vector<int> addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, int offset, int nbOfCells);
+    std::vector<int> addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, const DataArrayInt *subCells);
+    std::vector<int> addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, const DataArrayInt *subCells);
   private:
     MEDFileFieldPerMesh *_father;
   protected:
@@ -346,10 +346,10 @@ namespace MEDCoupling
     MEDFileFieldPerMesh *deepCopy(MEDFileAnyTypeField1TSWithoutSDA *father) const;
     void simpleRepr(int bkOffset,std::ostream& oss, int id) const;
     void copyTinyInfoFrom(const MEDCouplingMesh *mesh);
-    void assignFieldProfile(int& start, const DataArrayInt *multiTypePfl, const std::vector<int>& code, const std::vector<int>& code2, const std::vector<DataArrayInt *>& idsInPflPerType, const std::vector<DataArrayInt *>& idsPerType, const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
-    void assignFieldNoProfileNoRenum(int& start, const std::vector<int>& code, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
-    void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob);
-    void assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
+    void assignFieldProfile(int& start, const DataArrayInt *multiTypePfl, const std::vector<int>& code, const std::vector<int>& code2, const std::vector<DataArrayInt *>& idsInPflPerType, const std::vector<DataArrayInt *>& idsPerType, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
+    void assignFieldNoProfileNoRenum(int& start, const std::vector<int>& code, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
+    void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob);
+    void assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
     void loadOnlyStructureOfDataRecursively(med_idt fid, int &start, const MEDFileFieldNameScope& nasc);
     void loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc);
     void writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const;
@@ -626,9 +626,9 @@ namespace MEDCoupling
     MEDLOADER_EXPORT void setInfo(const std::vector<std::string>& infos);
     MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
     MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
-    MEDLOADER_EXPORT int copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr);
-    MEDLOADER_EXPORT void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
-    MEDLOADER_EXPORT void setFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
+    MEDLOADER_EXPORT int copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr);
+    MEDLOADER_EXPORT void setFieldNoProfileSBT(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
+    MEDLOADER_EXPORT void setFieldProfile(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
     MEDLOADER_EXPORT virtual void simpleRepr(int bkOffset, std::ostream& oss, int f1tsId) const;
     MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TSWithoutSDA *deepCopy() const = 0;
     MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TSWithoutSDA *shallowCpy() const = 0;
@@ -688,13 +688,14 @@ namespace MEDCoupling
   {
   protected:
     MEDFileField1TSTemplateWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order):MEDFileAnyTypeField1TSWithoutSDA(fieldName,meshName,csit,iteration,order) { }
-    MEDFileField1TSTemplateWithoutSDA():MEDFileAnyTypeField1TSWithoutSDA() { }
+    MEDFileField1TSTemplateWithoutSDA() { }
   public:
     MEDLOADER_EXPORT void setArray(DataArray *arr);
     MEDLOADER_EXPORT DataArray *createNewEmptyDataArrayInstance() const;
     MEDLOADER_EXPORT typename Traits<T>::ArrayType *getOrCreateAndGetArrayTemplate();
     MEDLOADER_EXPORT typename Traits<T>::ArrayType const *getOrCreateAndGetArrayTemplate() const;
     MEDLOADER_EXPORT typename Traits<T>::ArrayType *getUndergroundDataArrayTemplate() const;
+    MEDLOADER_EXPORT typename Traits<T>::ArrayType *getUndergroundDataArrayTemplateExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
     MEDLOADER_EXPORT DataArray *getOrCreateAndGetArray();
     MEDLOADER_EXPORT const DataArray *getOrCreateAndGetArray() const;
     MEDLOADER_EXPORT DataArray *getUndergroundDataArray() const;
@@ -711,7 +712,6 @@ namespace MEDCoupling
   public:
     MEDLOADER_EXPORT const char *getTypeStr() const;
     MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
-    MEDLOADER_EXPORT DataArrayDouble *getUndergroundDataArrayDoubleExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
     MEDLOADER_EXPORT std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
     MEDLOADER_EXPORT static void CheckMeshDimRel(int meshDimRelToMax);
     MEDLOADER_EXPORT static std::vector<int> CheckSBTMesh(const MEDCouplingMesh *mesh);
@@ -726,10 +726,20 @@ namespace MEDCoupling
     static const char TYPE_STR[];
   };
 
+  template<class T>
+  class MEDFileField1TSNDTemplateWithoutSDA : public MEDFileField1TSTemplateWithoutSDA<T>
+  {
+  public:
+    MEDLOADER_EXPORT MEDFileField1TSWithoutSDA *convertToDouble() const;
+  protected:
+    MEDFileField1TSNDTemplateWithoutSDA() { }
+    MEDFileField1TSNDTemplateWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector<std::string>& infos):MEDFileField1TSTemplateWithoutSDA<T>(fieldName,meshName,csit,iteration,order) { }
+  };
+  
   /*!
    * SDA is for Shared Data Arrays such as profiles.
    */
-  class MEDFileIntField1TSWithoutSDA : public MEDFileField1TSTemplateWithoutSDA<int>
+  class MEDFileIntField1TSWithoutSDA : public MEDFileField1TSNDTemplateWithoutSDA<int>
   {
   public:
     MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA();
@@ -739,13 +749,31 @@ namespace MEDCoupling
     MEDLOADER_EXPORT const char *getTypeStr() const;
     MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
     MEDLOADER_EXPORT DataArrayInt *getUndergroundDataArrayIntExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
-    MEDLOADER_EXPORT MEDFileField1TSWithoutSDA *convertToDouble() const;
   protected:
     MEDFileIntField1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector<std::string>& infos);
   public:
     MEDLOADER_EXPORT static const char TYPE_STR[];
   };
 
+  /*!
+   * SDA is for Shared Data Arrays such as profiles.
+   */
+  class MEDFileFloatField1TSWithoutSDA : public MEDFileField1TSNDTemplateWithoutSDA<float>
+  {
+  public:
+    MEDLOADER_EXPORT MEDFileFloatField1TSWithoutSDA();
+    MEDLOADER_EXPORT static MEDFileFloatField1TSWithoutSDA *New(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector<std::string>& infos);
+    MEDLOADER_EXPORT MEDFileFloatField1TSWithoutSDA *deepCopy() const;
+    MEDLOADER_EXPORT MEDFileFloatField1TSWithoutSDA *shallowCpy() const;
+    MEDLOADER_EXPORT const char *getTypeStr() const;
+    MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
+    MEDLOADER_EXPORT DataArrayFloat *getUndergroundDataArrayFloatExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
+  protected:
+    MEDFileFloatField1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector<std::string>& infos);
+  public:
+    MEDLOADER_EXPORT static const char TYPE_STR[];
+  };
+
   /*!
    * User class.
    */
@@ -806,6 +834,8 @@ namespace MEDCoupling
     MEDLOADER_EXPORT int getNonEmptyLevels(const std::string& mname, std::vector<int>& levs) const;
     MEDLOADER_EXPORT void convertMedBallIntoClassic();
     MEDLOADER_EXPORT void makeReduction(INTERP_KERNEL::NormalizedCellType ct, TypeOfField tof, const DataArrayInt *pfl);
+    MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TS *extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const = 0;
+    MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TS *shallowCpy() const = 0;
   public:
     MEDLOADER_EXPORT void loadArrays();
     MEDLOADER_EXPORT void loadArraysIfNecessary();
@@ -816,7 +846,7 @@ namespace MEDCoupling
     MEDLOADER_EXPORT std::vector< MCAuto< MEDFileAnyTypeField1TS > > splitMultiDiscrPerGeoTypes() const;
     MEDLOADER_EXPORT MEDFileAnyTypeField1TS *deepCopy() const;
     MEDLOADER_EXPORT int copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr);
-    MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TS *shallowCpy() const = 0;
+    MEDLOADER_EXPORT int copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr);
   public:
     //! underground method see MEDFileField1TSWithoutSDA::setProfileNameOnLeaf
     MEDLOADER_EXPORT void setProfileNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false);
@@ -833,8 +863,6 @@ namespace MEDCoupling
   public:
     MEDLOADER_EXPORT static int LocateField2(med_idt fid, int fieldIdCFormat, bool checkFieldId, std::string& fieldName, med_field_type& typcha, std::vector<std::string>& infos, std::string& dtunitOut, std::string& meshName);
     MEDLOADER_EXPORT static int LocateField(med_idt fid, const std::string& fieldName, int& posCFormat, med_field_type& typcha, std::vector<std::string>& infos, std::string& dtunitOut, std::string& meshName);
-  public:
-    MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TS *extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const = 0;
   public:
     MEDLOADER_EXPORT virtual med_field_type getMEDFileFieldType() const = 0;
     MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA *contentNotNullBase();
@@ -845,102 +873,129 @@ namespace MEDCoupling
 
   class MEDFileIntField1TS;
 
+  template<class T>
+  class MEDFileTemplateField1TS : public MEDFileAnyTypeField1TS
+  {
+  public:
+    MEDLOADER_EXPORT static typename MLFieldTraits<T>::F1TSType *New();
+    MEDLOADER_EXPORT static typename MLFieldTraits<T>::F1TSType *New(const std::string& fileName, bool loadAll=true);
+    MEDLOADER_EXPORT static typename MLFieldTraits<T>::F1TSType *New(med_idt fid, bool loadAll=true);
+    MEDLOADER_EXPORT static typename MLFieldTraits<T>::F1TSType *New(DataArrayByte *db) { return BuildFromMemoryChunk<typename MLFieldTraits<T>::F1TSType>(db); }
+    MEDLOADER_EXPORT static typename MLFieldTraits<T>::F1TSType *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
+    MEDLOADER_EXPORT static typename MLFieldTraits<T>::F1TSType *New(med_idt fid, const std::string& fieldName, bool loadAll=true);
+    MEDLOADER_EXPORT static typename MLFieldTraits<T>::F1TSType *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
+    MEDLOADER_EXPORT static typename MLFieldTraits<T>::F1TSType *New(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll=true);
+    MEDLOADER_EXPORT static typename MLFieldTraits<T>::F1TSType *New(const typename MLFieldTraits<T>::F1TSWSDAType& other, bool shallowCopyOfContent);
+  public:
+    MEDLOADER_EXPORT static typename Traits<T>::ArrayType *ReturnSafelyTypedDataArray(MCAuto<DataArray>& arr);
+    MEDLOADER_EXPORT typename Traits<T>::ArrayType *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const;
+    MEDLOADER_EXPORT typename Traits<T>::ArrayType *getUndergroundDataArray() const;
+    MEDLOADER_EXPORT typename Traits<T>::ArrayType *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
+    MEDLOADER_EXPORT static MCAuto<typename Traits<T>::FieldType> SetDataArrayInField(MEDCouplingFieldDouble *f, MCAuto<DataArray>& arr);
+    MEDLOADER_EXPORT static MCAuto<MEDCouplingFieldDouble> ToFieldTemplateWithTime(const typename Traits<T>::FieldType *f);
+  public:
+    MEDLOADER_EXPORT typename Traits<T>::FieldType *field(const MEDFileMesh *mesh) const;
+    MEDLOADER_EXPORT typename Traits<T>::FieldType *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
+    MEDLOADER_EXPORT typename Traits<T>::FieldType *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
+    MEDLOADER_EXPORT typename Traits<T>::FieldType *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
+    MEDLOADER_EXPORT typename Traits<T>::FieldType *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
+    MEDLOADER_EXPORT typename Traits<T>::FieldType *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
+    MEDLOADER_EXPORT void setFieldNoProfileSBT(const typename Traits<T>::FieldType *field);
+    MEDLOADER_EXPORT void setFieldProfile(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
+    MEDLOADER_EXPORT typename MLFieldTraits<T>::F1TSType *extractPartImpl(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const;
+    MEDLOADER_EXPORT MEDFileAnyTypeField1TS *extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const { return this->extractPartImpl(extractDef,mm); }
+  protected:
+    ~MEDFileTemplateField1TS() { }
+    MEDFileTemplateField1TS();
+    MEDFileTemplateField1TS(med_idt fid, bool loadAll, const MEDFileMeshes *ms):MEDFileAnyTypeField1TS(fid,loadAll,ms) { }
+    MEDFileTemplateField1TS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms):MEDFileAnyTypeField1TS(fid,fieldName,loadAll,ms) { }
+    MEDFileTemplateField1TS(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileMeshes *ms):MEDFileAnyTypeField1TS(fid,fieldName,iteration,order,loadAll,ms) { }
+    MEDFileTemplateField1TS(const typename MLFieldTraits<T>::F1TSWSDAType& other, bool shallowCopyOfContent):MEDFileAnyTypeField1TS(other,shallowCopyOfContent) { }
+    const typename MLFieldTraits<T>::F1TSWSDAType *contentNotNull() const;
+    typename MLFieldTraits<T>::F1TSWSDAType *contentNotNull();
+  };
+
   /*!
    * User class.
    */
-  class MEDFileField1TS : public MEDFileAnyTypeField1TS
+  class MEDFileField1TS : public MEDFileTemplateField1TS<double>
   {
+    friend class MEDFileTemplateField1TS<double>;
   public:
-    MEDLOADER_EXPORT static MEDFileField1TS *New(const std::string& fileName, bool loadAll=true);
-    MEDLOADER_EXPORT static MEDFileField1TS *New(med_idt fid, bool loadAll=true);
-    MEDLOADER_EXPORT static MEDFileField1TS *New(DataArrayByte *db) { return BuildFromMemoryChunk<MEDFileField1TS>(db); }
-    MEDLOADER_EXPORT static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
-    MEDLOADER_EXPORT static MEDFileField1TS *New(med_idt fid, const std::string& fieldName, bool loadAll=true);
-    MEDLOADER_EXPORT static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
-    MEDLOADER_EXPORT static MEDFileField1TS *New(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll=true);
-    MEDLOADER_EXPORT static MEDFileField1TS *New(const MEDFileField1TSWithoutSDA& other, bool shallowCopyOfContent);
-    MEDLOADER_EXPORT static MEDFileField1TS *New();
     MEDLOADER_EXPORT MEDFileIntField1TS *convertToInt(bool isDeepCpyGlobs=true) const;
-    //
-    MEDLOADER_EXPORT MEDCouplingFieldDouble *field(const MEDFileMesh *mesh) const;
-    MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
-    MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
-    MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
-    MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
-    MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
-    MEDLOADER_EXPORT DataArrayDouble *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const;
-    //
-    MEDLOADER_EXPORT void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field);
-    MEDLOADER_EXPORT void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
-    // direct forwarding to MEDFileField1TSWithoutSDA instance _content
   public:
     MEDLOADER_EXPORT MEDFileField1TS *shallowCpy() const;
-    MEDLOADER_EXPORT DataArrayDouble *getUndergroundDataArray() const;
-    MEDLOADER_EXPORT DataArrayDouble *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
-
     MEDLOADER_EXPORT std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF,
-        std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
-  public:
-    MEDLOADER_EXPORT static void SetDataArrayDoubleInField(MEDCouplingFieldDouble *f, MCAuto<DataArray>& arr);
-    MEDLOADER_EXPORT static DataArrayDouble *ReturnSafelyDataArrayDouble(MCAuto<DataArray>& arr);
+                                                                                          std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
   public:
-    MEDLOADER_EXPORT MEDFileField1TS *extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const;
   private:
     med_field_type getMEDFileFieldType() const { return MED_FLOAT64; }
-    const MEDFileField1TSWithoutSDA *contentNotNull() const;
-    MEDFileField1TSWithoutSDA *contentNotNull();
   private:
     ~MEDFileField1TS() { }
     MEDFileField1TS(med_idt fid, bool loadAll, const MEDFileMeshes *ms);
     MEDFileField1TS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms);
     MEDFileField1TS(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileMeshes *ms);
     MEDFileField1TS(const MEDFileField1TSWithoutSDA& other, bool shallowCopyOfContent);
-    MEDFileField1TS();
+    MEDFileField1TS() { }
   };
 
-  class MEDFileIntField1TS : public MEDFileAnyTypeField1TS
+  template<class T>
+  class MEDFileNDTemplateField1TS : public MEDFileTemplateField1TS<T>
   {
   public:
-    MEDLOADER_EXPORT static MEDFileIntField1TS *New();
-    MEDLOADER_EXPORT static MEDFileIntField1TS *New(const std::string& fileName, bool loadAll=true);
-    MEDLOADER_EXPORT static MEDFileIntField1TS *New(med_idt fid, bool loadAll=true);
-    MEDLOADER_EXPORT static MEDFileIntField1TS *New(DataArrayByte *db) { return BuildFromMemoryChunk<MEDFileIntField1TS>(db); }
-    MEDLOADER_EXPORT static MEDFileIntField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
-    MEDLOADER_EXPORT static MEDFileIntField1TS *New(med_idt fid, const std::string& fieldName, bool loadAll=true);
-    MEDLOADER_EXPORT static MEDFileIntField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
-    MEDLOADER_EXPORT static MEDFileIntField1TS *New(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll=true);
-    MEDLOADER_EXPORT static MEDFileIntField1TS *New(const MEDFileIntField1TSWithoutSDA& other, bool shallowCopyOfContent);
     MEDLOADER_EXPORT MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const;
-    MEDLOADER_EXPORT MEDFileIntField1TS *shallowCpy() const;
-    //
-    MEDLOADER_EXPORT MEDCouplingFieldInt *field(const MEDFileMesh *mesh) const;
-    MEDLOADER_EXPORT MEDCouplingFieldInt *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
-    MEDLOADER_EXPORT MEDCouplingFieldInt *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
-    MEDLOADER_EXPORT MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
-    MEDLOADER_EXPORT MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
-    MEDLOADER_EXPORT MEDCouplingFieldInt *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
-    MEDLOADER_EXPORT DataArrayInt *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const;
-    //
-    MEDLOADER_EXPORT void setFieldNoProfileSBT(const MEDCouplingFieldInt *field);
-    MEDLOADER_EXPORT void setFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
-    MEDLOADER_EXPORT DataArrayInt *getUndergroundDataArray() const;
+  protected:
+    ~MEDFileNDTemplateField1TS() { }
+    MEDFileNDTemplateField1TS() { }
+    MEDFileNDTemplateField1TS(med_idt fid, bool loadAll, const MEDFileMeshes *ms):MEDFileTemplateField1TS<T>(fid,loadAll,ms) { }
+    MEDFileNDTemplateField1TS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms):MEDFileTemplateField1TS<T>(fid,fieldName,loadAll,ms) { }
+    MEDFileNDTemplateField1TS(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileMeshes *ms):MEDFileTemplateField1TS<T>(fid,fieldName,iteration,order,loadAll,ms) { }
+    MEDFileNDTemplateField1TS(const typename MLFieldTraits<T>::F1TSWSDAType& other, bool shallowCopyOfContent):MEDFileTemplateField1TS<T>(other,shallowCopyOfContent) { }
+  };
+
+  class MEDFileIntField1TS : public MEDFileNDTemplateField1TS<int>
+  {
+    friend class MEDFileTemplateField1TS<int>;
   public:
-    MEDLOADER_EXPORT static DataArrayInt *ReturnSafelyDataArrayInt(MCAuto<DataArray>& arr);
-    MEDLOADER_EXPORT static MCAuto<MEDCouplingFieldInt> SetDataArrayDoubleInIntField(MEDCouplingFieldDouble *f, MCAuto<DataArray>& arr);
-    MEDLOADER_EXPORT static MCAuto<MEDCouplingFieldDouble> ConvertFieldIntToFieldDouble(const MEDCouplingFieldInt *f);
+    MEDLOADER_EXPORT MEDFileIntField1TS *shallowCpy() const { return new MEDFileIntField1TS(*this); }
   public:
-    MEDLOADER_EXPORT MEDFileIntField1TS *extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const;
+    MEDLOADER_EXPORT static MCAuto<MEDCouplingFieldDouble> ConvertFieldIntToFieldDouble(const MEDCouplingFieldInt *f);
   private:
     med_field_type getMEDFileFieldType() const { return MED_INT32; }
-    const MEDFileIntField1TSWithoutSDA *contentNotNull() const;
-    MEDFileIntField1TSWithoutSDA *contentNotNull();
   private:
     ~MEDFileIntField1TS() { }
-    MEDFileIntField1TS();
-    MEDFileIntField1TS(med_idt fid, bool loadAll, const MEDFileMeshes *ms);
-    MEDFileIntField1TS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms);
-    MEDFileIntField1TS(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileMeshes *ms);
-    MEDFileIntField1TS(const MEDFileIntField1TSWithoutSDA& other, bool shallowCopyOfContent);
+    MEDFileIntField1TS() { }
+    MEDFileIntField1TS(med_idt fid, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateField1TS<int>(fid,loadAll,ms) { }
+    MEDFileIntField1TS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateField1TS<int>(fid,fieldName,loadAll,ms) { }
+    MEDFileIntField1TS(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateField1TS<int>(fid,fieldName,iteration,order,loadAll,ms) { }
+    /*!
+     * This constructor is a shallow copy constructor. If \a shallowCopyOfContent is true the content of \a other is shallow copied.
+     * If \a shallowCopyOfContent is false, \a other is taken to be the content of \a this.
+     *
+     * \warning this is a shallow copy constructor
+     */
+    MEDFileIntField1TS(const MEDFileIntField1TSWithoutSDA& other, bool shallowCopyOfContent):MEDFileNDTemplateField1TS<int>(other,shallowCopyOfContent) { }
+  };
+
+  class MEDFileFloatField1TS : public MEDFileNDTemplateField1TS<float>
+  {
+    friend class MEDFileTemplateField1TS<float>;
+  private:
+    med_field_type getMEDFileFieldType() const { return MED_INT32; }//6432
+    MEDLOADER_EXPORT MEDFileFloatField1TS *shallowCpy() const { return new MEDFileFloatField1TS(*this); }
+  private:
+    ~MEDFileFloatField1TS() { }
+    MEDFileFloatField1TS() { }
+    MEDFileFloatField1TS(med_idt fid, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateField1TS<float>(fid,loadAll,ms) { }
+    MEDFileFloatField1TS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateField1TS<float>(fid,fieldName,loadAll,ms) { }
+    MEDFileFloatField1TS(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateField1TS<float>(fid,fieldName,iteration,order,loadAll,ms) { }
+    /*!
+     * This constructor is a shallow copy constructor. If \a shallowCopyOfContent is true the content of \a other is shallow copied.
+     * If \a shallowCopyOfContent is false, \a other is taken to be the content of \a this.
+     *
+     * \warning this is a shallow copy constructor
+     */
+    MEDFileFloatField1TS(const MEDFileFloatField1TSWithoutSDA& other, bool shallowCopyOfContent):MEDFileNDTemplateField1TS<float>(other,shallowCopyOfContent) { }
   };
 
   class MEDFileAnyTypeFieldMultiTSWithoutSDA : public RefCountObject, public MEDFileFieldNameScope
@@ -1027,43 +1082,77 @@ namespace MEDCoupling
 
   class MEDFileIntFieldMultiTSWithoutSDA;
 
-  class MEDFileFieldMultiTSWithoutSDA : public MEDFileAnyTypeFieldMultiTSWithoutSDA
+  template<class T>
+  class MEDFileTemplateFieldMultiTSWithoutSDA : public MEDFileAnyTypeFieldMultiTSWithoutSDA
   {
   public:
-    MEDLOADER_EXPORT static MEDFileFieldMultiTSWithoutSDA *New(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities);
-    MEDLOADER_EXPORT MEDFileFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities);
+    MEDLOADER_EXPORT static typename MLFieldTraits<T>::FMTSWSDAType *New(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities);
     MEDLOADER_EXPORT const char *getTypeStr() const;
-    MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const;
     MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *createNew() const;
+    MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA *createNew1TSWithoutSDAEmptyInstance() const;
+  protected:
+    MEDFileTemplateFieldMultiTSWithoutSDA() { }
+    MEDFileTemplateFieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName):MEDFileAnyTypeFieldMultiTSWithoutSDA(fieldName,meshName) { }
+    /** \param [in] fieldId field id in C mode */
+    MEDFileTemplateFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldId,loadAll,ms,entities) { }
+    MEDFileTemplateFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities) { }
+    void checkCoherencyOfType(const MEDFileAnyTypeField1TSWithoutSDA *f1ts) const;
+  };
+  
+  class MEDFileFieldMultiTSWithoutSDA : public MEDFileTemplateFieldMultiTSWithoutSDA<double>
+  {
+    friend class MEDFileTemplateFieldMultiTSWithoutSDA<double>;
+  public:
+    MEDLOADER_EXPORT MEDFileFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileTemplateFieldMultiTSWithoutSDA<double>(fid,fieldId,loadAll,ms,entities) { }
     MEDLOADER_EXPORT std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
     MEDLOADER_EXPORT MEDFileIntFieldMultiTSWithoutSDA *convertToInt() const;
+    MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const { return new MEDFileFieldMultiTSWithoutSDA(*this); }
   protected:
-    MEDFileFieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName);
-    MEDFileFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities);
+    MEDFileFieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName):MEDFileTemplateFieldMultiTSWithoutSDA<double>(fieldName,meshName) { }
+    MEDFileFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileTemplateFieldMultiTSWithoutSDA<double>(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities) { }
     med_field_type getMEDFileFieldType() const { return MED_FLOAT64; }
-    MEDFileAnyTypeField1TSWithoutSDA *createNew1TSWithoutSDAEmptyInstance() const;
-    void checkCoherencyOfType(const MEDFileAnyTypeField1TSWithoutSDA *f1ts) const;
   public:
-    MEDLOADER_EXPORT MEDFileFieldMultiTSWithoutSDA();
+    MEDLOADER_EXPORT MEDFileFieldMultiTSWithoutSDA() { }
   };
 
-  class MEDFileIntFieldMultiTSWithoutSDA : public MEDFileAnyTypeFieldMultiTSWithoutSDA
+  template<class T>
+  class MEDFileNDTemplateFieldMultiTSWithoutSDA : public MEDFileTemplateFieldMultiTSWithoutSDA<T>
   {
   public:
-    MEDLOADER_EXPORT static MEDFileIntFieldMultiTSWithoutSDA *New(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities);
-    MEDLOADER_EXPORT MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities);
-    MEDLOADER_EXPORT const char *getTypeStr() const;
-    MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const;
-    MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *createNew() const;
     MEDLOADER_EXPORT MEDFileFieldMultiTSWithoutSDA *convertToDouble() const;
   protected:
-    MEDFileIntFieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName);
-    MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities);
+    MEDFileNDTemplateFieldMultiTSWithoutSDA() { }
+    MEDFileNDTemplateFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileTemplateFieldMultiTSWithoutSDA<T>(fid,fieldId,loadAll,ms,entities) { }
+    MEDFileNDTemplateFieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName):MEDFileTemplateFieldMultiTSWithoutSDA<T>(fieldName,meshName) { }
+    MEDFileNDTemplateFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileTemplateFieldMultiTSWithoutSDA<T>(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities) { }
+  };
+
+  class MEDFileIntFieldMultiTSWithoutSDA : public MEDFileNDTemplateFieldMultiTSWithoutSDA<int>
+  {
+    friend class MEDFileTemplateFieldMultiTSWithoutSDA<int>;
+  public:
+    MEDLOADER_EXPORT MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileNDTemplateFieldMultiTSWithoutSDA<int>(fid,fieldId,loadAll,ms,entities) { }
+    MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const { return new MEDFileIntFieldMultiTSWithoutSDA(*this); }
+  protected:
+    MEDFileIntFieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName):MEDFileNDTemplateFieldMultiTSWithoutSDA<int>(fieldName,meshName) { }
+    MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileNDTemplateFieldMultiTSWithoutSDA<int>(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities) { }
     med_field_type getMEDFileFieldType() const { return MED_INT32; }
-    MEDFileAnyTypeField1TSWithoutSDA *createNew1TSWithoutSDAEmptyInstance() const;
-    void checkCoherencyOfType(const MEDFileAnyTypeField1TSWithoutSDA *f1ts) const;
   public:
-    MEDLOADER_EXPORT MEDFileIntFieldMultiTSWithoutSDA();
+    MEDLOADER_EXPORT MEDFileIntFieldMultiTSWithoutSDA() { }
+  };
+
+  class MEDFileFloatFieldMultiTSWithoutSDA : public MEDFileNDTemplateFieldMultiTSWithoutSDA<float>
+  {
+    friend class MEDFileTemplateFieldMultiTSWithoutSDA<float>;
+  public:
+    MEDLOADER_EXPORT MEDFileFloatFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileNDTemplateFieldMultiTSWithoutSDA<float>(fid,fieldId,loadAll,ms,entities) { }
+    MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const { return new MEDFileFloatFieldMultiTSWithoutSDA(*this); }
+  protected:
+    MEDFileFloatFieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName):MEDFileNDTemplateFieldMultiTSWithoutSDA<float>(fieldName,meshName) { }
+    MEDFileFloatFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileNDTemplateFieldMultiTSWithoutSDA<float>(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities) { }
+    med_field_type getMEDFileFieldType() const { return MED_INT32; }//6432
+  public:
+    MEDLOADER_EXPORT MEDFileFloatFieldMultiTSWithoutSDA() { }
   };
 
   class MEDFileAnyTypeFieldMultiTSIterator;
@@ -1142,7 +1231,7 @@ namespace MEDCoupling
     MEDLOADER_EXPORT MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> getContent();
   public:
     MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTS *buildNewEmpty() const = 0;
-    MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const;
+    MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTS *extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const = 0;
     MEDLOADER_EXPORT static MCAuto<MEDFileAnyTypeFieldMultiTS> Aggregate(const std::vector<const MEDFileAnyTypeFieldMultiTS *>& fmtss, const std::vector< std::vector< std::pair<int,int> > >& dts);
   public:
     MEDLOADER_EXPORT std::vector<std::string> getPflsReallyUsed() const;
@@ -1160,98 +1249,116 @@ namespace MEDCoupling
     MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> _content;
   };
 
+  template<class T>
+  class MEDFileTemplateFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
+  {
+  public:
+    MEDLOADER_EXPORT static typename MLFieldTraits<T>::FMTSType *New();
+    MEDLOADER_EXPORT static typename MLFieldTraits<T>::FMTSType *New(const std::string& fileName, bool loadAll=true);
+    MEDLOADER_EXPORT static typename MLFieldTraits<T>::FMTSType *New(med_idt fid, bool loadAll=true);
+    MEDLOADER_EXPORT static typename MLFieldTraits<T>::FMTSType *New(DataArrayByte *db) { return BuildFromMemoryChunk<typename MLFieldTraits<T>::FMTSType>(db); }
+    MEDLOADER_EXPORT static typename MLFieldTraits<T>::FMTSType *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
+    MEDLOADER_EXPORT static typename MLFieldTraits<T>::FMTSType *New(med_idt fid, const std::string& fieldName, bool loadAll=true);
+    MEDLOADER_EXPORT static typename MLFieldTraits<T>::FMTSType *New(const typename MLFieldTraits<T>::FMTSWSDAType& other, bool shallowCopyOfContent);
+    MEDLOADER_EXPORT static typename MLFieldTraits<T>::FMTSType *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, const std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> >& entities, bool loadAll=true);
+    MEDLOADER_EXPORT typename MLFieldTraits<T>::FMTSType *extractPartImpl(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const;
+    MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const { return this->extractPartImpl(extractDef,mm); }
+    //
+    MEDLOADER_EXPORT typename Traits<T>::FieldType *field(int iteration, int order, const MEDFileMesh *mesh) const;
+    MEDLOADER_EXPORT typename Traits<T>::FieldType *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
+    MEDLOADER_EXPORT typename Traits<T>::FieldType *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
+    MEDLOADER_EXPORT typename Traits<T>::FieldType *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
+    MEDLOADER_EXPORT typename Traits<T>::FieldType *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
+    MEDLOADER_EXPORT typename Traits<T>::FieldType *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
+    MEDLOADER_EXPORT typename Traits<T>::ArrayType *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const;
+    //
+    MEDLOADER_EXPORT void appendFieldNoProfileSBT(const typename Traits<T>::FieldType *field);
+    MEDLOADER_EXPORT void appendFieldProfile(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
+    //
+    MEDLOADER_EXPORT typename MLFieldTraits<T>::F1TSType *getTimeStepAtPos(int pos) const;
+    MEDLOADER_EXPORT typename Traits<T>::ArrayType *getUndergroundDataArray(int iteration, int order) const;
+    MEDLOADER_EXPORT typename Traits<T>::ArrayType *getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
+    MEDLOADER_EXPORT typename MLFieldTraits<T>::FMTSType *buildNewEmptyImpl() const;
+    MEDLOADER_EXPORT void checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const;
+  protected:
+    const typename MLFieldTraits<T>::FMTSWSDAType *contentNotNull() const;
+    typename MLFieldTraits<T>::FMTSWSDAType *contentNotNull();
+  protected:
+    ~MEDFileTemplateFieldMultiTS() { }
+    MEDFileTemplateFieldMultiTS();
+    MEDFileTemplateFieldMultiTS(const typename MLFieldTraits<T>::FMTSWSDAType& other, bool shallowCopyOfContent);
+    MEDFileTemplateFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms);
+    MEDFileTemplateFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0);
+  };
+  
   class MEDFileIntFieldMultiTS;
 
   /*!
    * User class.
    */
-  class MEDFileFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
+  class MEDFileFieldMultiTS : public MEDFileTemplateFieldMultiTS<double>
   {
+    friend class MEDFileTemplateFieldMultiTS<double>;
   public:
-    MEDLOADER_EXPORT static MEDFileFieldMultiTS *New();
-    MEDLOADER_EXPORT static MEDFileFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
-    MEDLOADER_EXPORT static MEDFileFieldMultiTS *New(med_idt fid, bool loadAll=true);
-    MEDLOADER_EXPORT static MEDFileFieldMultiTS *New(DataArrayByte *db) { return BuildFromMemoryChunk<MEDFileFieldMultiTS>(db); }
-    MEDLOADER_EXPORT static MEDFileFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
-    MEDLOADER_EXPORT static MEDFileFieldMultiTS *New(med_idt fid, const std::string& fieldName, bool loadAll=true);
-    MEDLOADER_EXPORT static MEDFileFieldMultiTS *New(const MEDFileFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent);
-    MEDLOADER_EXPORT static MEDFileFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, const std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> >& entities, bool loadAll=true);
     MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const;
-    MEDLOADER_EXPORT void checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const;
     MEDLOADER_EXPORT MEDFileIntFieldMultiTS *convertToInt(bool isDeepCpyGlobs=true) const;
     //
-    MEDLOADER_EXPORT MEDFileField1TS *getTimeStepAtPos(int pos) const;
-    MEDLOADER_EXPORT MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const;
-    MEDLOADER_EXPORT MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const;
-    //
-    MEDLOADER_EXPORT MEDCouplingFieldDouble *field(int iteration, int order, const MEDFileMesh *mesh) const;
-    MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
-    MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
-    MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
-    MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
-    MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
-    MEDLOADER_EXPORT DataArrayDouble *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const;
-    //
-    MEDLOADER_EXPORT void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field);
-    MEDLOADER_EXPORT void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
     MEDLOADER_EXPORT std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
-    MEDLOADER_EXPORT DataArrayDouble *getUndergroundDataArray(int iteration, int order) const;
-    MEDLOADER_EXPORT DataArrayDouble *getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
+    MEDLOADER_EXPORT MEDFileFieldMultiTS *buildNewEmpty() const { return buildNewEmptyImpl(); }
   public:
-    MEDLOADER_EXPORT MEDFileFieldMultiTS *buildNewEmpty() const;
-  private:
-    const MEDFileFieldMultiTSWithoutSDA *contentNotNull() const;
-    MEDFileFieldMultiTSWithoutSDA *contentNotNull();
   private:
     ~MEDFileFieldMultiTS() { }
-    MEDFileFieldMultiTS();
+    MEDFileFieldMultiTS() { }
     MEDFileFieldMultiTS(const MEDFileFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent);
     MEDFileFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms);
     MEDFileFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0);
   };
 
+  template<class T>
+  class MEDFileNDTemplateFieldMultiTS : public MEDFileTemplateFieldMultiTS<T>
+  {
+  public:
+    MEDLOADER_EXPORT MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const;
+  protected:
+    ~MEDFileNDTemplateFieldMultiTS() { }
+    MEDFileNDTemplateFieldMultiTS() { }
+    MEDFileNDTemplateFieldMultiTS(const typename MLFieldTraits<T>::FMTSWSDAType& other, bool shallowCopyOfContent):MEDFileTemplateFieldMultiTS<T>(other,shallowCopyOfContent) { }
+    MEDFileNDTemplateFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms):MEDFileTemplateFieldMultiTS<T>(fid,loadAll,ms) { }
+    MEDFileNDTemplateFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileTemplateFieldMultiTS<T>(fid,fieldName,loadAll,ms,entities) { }
+  };
+
   /*!
    * User class.
    */
-  class MEDFileIntFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
+  class MEDFileIntFieldMultiTS : public MEDFileNDTemplateFieldMultiTS<int>
   {
+    friend class MEDFileTemplateFieldMultiTS<int>;
   public:
-    MEDLOADER_EXPORT static MEDFileIntFieldMultiTS *New();
-    MEDLOADER_EXPORT static MEDFileIntFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
-    MEDLOADER_EXPORT static MEDFileIntFieldMultiTS *New(med_idt fid, bool loadAll=true);
-    MEDLOADER_EXPORT static MEDFileIntFieldMultiTS *New(DataArrayByte *db) { return BuildFromMemoryChunk<MEDFileIntFieldMultiTS>(db); }
-    MEDLOADER_EXPORT static MEDFileIntFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
-    MEDLOADER_EXPORT static MEDFileIntFieldMultiTS *New(med_idt fid, const std::string& fieldName, bool loadAll=true);
-    MEDLOADER_EXPORT static MEDFileIntFieldMultiTS *New(const MEDFileIntFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent);
-    MEDLOADER_EXPORT static MEDFileIntFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, const std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> >& entities, bool loadAll=true);
-    MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const;
-    MEDLOADER_EXPORT void checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const;
-    MEDLOADER_EXPORT MEDFileIntField1TS *getTimeStepAtPos(int pos) const;
-    MEDLOADER_EXPORT MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const;
-    //
-    MEDLOADER_EXPORT MEDCouplingFieldInt *field(int iteration, int order, const MEDFileMesh *mesh) const;
-    MEDLOADER_EXPORT MEDCouplingFieldInt *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
-    MEDLOADER_EXPORT MEDCouplingFieldInt *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
-    MEDLOADER_EXPORT MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
-    MEDLOADER_EXPORT MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
-    MEDLOADER_EXPORT MEDCouplingFieldInt *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
-    MEDLOADER_EXPORT DataArrayInt *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const;
-    //
-    MEDLOADER_EXPORT void appendFieldNoProfileSBT(const MEDCouplingFieldInt *field);
-    MEDLOADER_EXPORT void appendFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
-    //
-    MEDLOADER_EXPORT DataArrayInt *getUndergroundDataArray(int iteration, int order) const;
-  public:
-    MEDLOADER_EXPORT MEDFileIntFieldMultiTS *buildNewEmpty() const;
-  private:
-    const MEDFileIntFieldMultiTSWithoutSDA *contentNotNull() const;
-    MEDFileIntFieldMultiTSWithoutSDA *contentNotNull();
+    MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const { return new MEDFileIntFieldMultiTS(*this); }
+    MEDLOADER_EXPORT MEDFileIntFieldMultiTS *buildNewEmpty() const { return buildNewEmptyImpl(); }
   private:
     ~MEDFileIntFieldMultiTS() { }
-    MEDFileIntFieldMultiTS();
-    MEDFileIntFieldMultiTS(const MEDFileIntFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent);
-    MEDFileIntFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms);
-    MEDFileIntFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0);
+    MEDFileIntFieldMultiTS() { }
+    MEDFileIntFieldMultiTS(const MEDFileIntFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent):MEDFileNDTemplateFieldMultiTS<int>(other,shallowCopyOfContent) { }
+    MEDFileIntFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateFieldMultiTS<int>(fid,loadAll,ms) { }
+    MEDFileIntFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0):MEDFileNDTemplateFieldMultiTS<int>(fid,fieldName,loadAll,ms,entities) { }
+  };
+
+  /*!
+   * User class.
+   */
+  class MEDFileFloatFieldMultiTS : public MEDFileNDTemplateFieldMultiTS<float>
+  {
+    friend class MEDFileTemplateFieldMultiTS<float>;
+  public:
+    MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const { return new MEDFileFloatFieldMultiTS(*this); }
+    MEDLOADER_EXPORT MEDFileFloatFieldMultiTS *buildNewEmpty() const { return buildNewEmptyImpl(); }
+  private:
+    ~MEDFileFloatFieldMultiTS() { }
+    MEDFileFloatFieldMultiTS() { }
+    MEDFileFloatFieldMultiTS(const MEDFileFloatFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent):MEDFileNDTemplateFieldMultiTS<float>(other,shallowCopyOfContent) { }
+    MEDFileFloatFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateFieldMultiTS<float>(fid,loadAll,ms) { }
+    MEDFileFloatFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0):MEDFileNDTemplateFieldMultiTS<float>(fid,fieldName,loadAll,ms,entities) { }
   };
 
   class MEDFileAnyTypeFieldMultiTSIterator
index ae2b3a93a82a8311a959342fd9e6ad9bbfda81b9..e3ba8eeb8b73a72b4109c2728da48b0fe06e4cd0 100644 (file)
 
 #include "MEDFileField.hxx"
 #include "MEDCouplingTraits.hxx"
+#include "MEDCouplingFieldInt.hxx"
+#include "MEDCouplingFieldFloat.hxx"
+#include "MEDCouplingFieldDouble.hxx"
+#include "MEDCouplingFieldTemplate.hxx"
 
 namespace MEDCoupling
 {
@@ -106,6 +110,33 @@ namespace MEDCoupling
       return 0;
   }
   
+  /*!
+   * Returns a pointer to the underground DataArrayDouble instance and a
+   * sequence describing parameters of a support of each part of \a this field. The
+   * caller should not decrRef() the returned DataArrayDouble. This method allows for a
+   * direct access to the field values. This method is intended for the field lying on one
+   * mesh only.
+   *  \param [in,out] entries - the sequence describing parameters of a support of each
+   *         part of \a this field. Each item of this sequence consists of two parts. The
+   *         first part describes a type of mesh entity and an id of discretization of a
+   *         current field part. The second part describes a range of values [begin,end)
+   *         within the returned array relating to the current field part.
+   *  \return DataArrayDouble * - the pointer to the field values array.
+   *  \throw If the number of underlying meshes is not equal to 1.
+   *  \throw If no field values are available.
+   *  \sa getUndergroundDataArrayTemplate()
+   */
+  template<class T>
+  typename Traits<T>::ArrayType *MEDFileField1TSTemplateWithoutSDA<T>::getUndergroundDataArrayTemplateExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+  {
+    if(this->_field_per_mesh.size()!=1)
+      throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : field lies on several meshes, this method has no sense !");
+    if(this->_field_per_mesh[0]==0)
+      throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : no field specified !");
+    this->_field_per_mesh[0]->getUndergroundDataArrayExt(entries);
+    return getUndergroundDataArrayTemplate();
+  }
+  
   /*!
    * Returns a pointer to the underground DataArrayDouble instance. So the
    * caller should not decrRef() it. This method allows for a direct access to the field
@@ -167,6 +198,1151 @@ namespace MEDCoupling
         start+=(*it).second.second-(*it).second.first;
       }
   }
+
+  ///////////////////////////////////////////////////////
+
+  template<class T>
+  MEDFileField1TSWithoutSDA *MEDFileField1TSNDTemplateWithoutSDA<T>::convertToDouble() const
+  {
+    MCAuto<MEDFileField1TSWithoutSDA> ret(new MEDFileField1TSWithoutSDA);
+    ret->MEDFileAnyTypeField1TSWithoutSDA::operator =(*this);
+    ret->deepCpyLeavesFrom(*this);
+    if(this->_arr.isNotNull())
+      {
+        MCAuto<DataArrayDouble> arr2(this->_arr->convertToDblArr());
+        ret->setArray(arr2);
+      }
+    return ret.retn();
+  }
+  
+  ///////////////////////////////////////////////////////
+
+  template<class T>
+  MEDFileTemplateField1TS<T>::MEDFileTemplateField1TS()
+  {
+    _content=new typename MLFieldTraits<T>::F1TSWSDAType;
+  }
+
+  /*!
+   * Returns a new empty instance of MEDFileField1TS.
+   *  \return MEDFileField1TS * - a new instance of MEDFileField1TS. The caller
+   *          is to delete this field using decrRef() as it is no more needed.
+   */
+  template<class T>
+  typename MLFieldTraits<T>::F1TSType *MEDFileTemplateField1TS<T>::New()
+  {
+    MCAuto<typename MLFieldTraits<T>::F1TSType> ret(new typename MLFieldTraits<T>::F1TSType);
+    ret->contentNotNull();
+    return ret.retn();
+  }
+
+  /*!
+   * Returns a new instance of MEDFileField1TS holding data of the first time step of 
+   * the first field that has been read from a specified MED file.
+   *  \param [in] fileName - the name of the MED file to read.
+   *  \return MEDFileField1TS * - a new instance of MEDFileFieldMultiTS. The caller
+   *          is to delete this field using decrRef() as it is no more needed.
+   *  \throw If reading the file fails.
+   */
+  template<class T>
+  typename MLFieldTraits<T>::F1TSType *MEDFileTemplateField1TS<T>::New(const std::string& fileName, bool loadAll)
+  {
+    MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
+    return New(fid,loadAll);
+  }
+  
+  template<class T>
+  typename MLFieldTraits<T>::F1TSType *MEDFileTemplateField1TS<T>::New(med_idt fid, bool loadAll)
+  {
+    MCAuto<typename MLFieldTraits<T>::F1TSType> ret(new typename MLFieldTraits<T>::F1TSType(fid,loadAll,0));
+    ret->contentNotNull();
+    return ret.retn();
+  }
+
+  /*!
+   * Returns a new instance of MEDFileField1TS holding data of the first time step of 
+   * a given field that has been read from a specified MED file.
+   *  \param [in] fileName - the name of the MED file to read.
+   *  \param [in] fieldName - the name of the field to read.
+   *  \return MEDFileField1TS * - a new instance of MEDFileFieldMultiTS. The caller
+   *          is to delete this field using decrRef() as it is no more needed.
+   *  \throw If reading the file fails.
+   *  \throw If there is no field named \a fieldName in the file.
+   */
+  template<class T>
+  typename MLFieldTraits<T>::F1TSType *MEDFileTemplateField1TS<T>::New(const std::string& fileName, const std::string& fieldName, bool loadAll)
+  {
+    MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
+    return New(fid,fieldName,loadAll);
+  }
+
+  template<class T>
+  typename MLFieldTraits<T>::F1TSType *MEDFileTemplateField1TS<T>::New(med_idt fid, const std::string& fieldName, bool loadAll)
+  {
+    MCAuto<typename MLFieldTraits<T>::F1TSType> ret(new typename MLFieldTraits<T>::F1TSType(fid,fieldName,loadAll,0));
+    ret->contentNotNull();
+    return ret.retn();
+  }
+
+  /*!
+   * Returns a new instance of MEDFileField1TS holding data of a given time step of 
+   * a given field that has been read from a specified MED file.
+   *  \param [in] fileName - the name of the MED file to read.
+   *  \param [in] fieldName - the name of the field to read.
+   *  \param [in] iteration - the iteration number of a required time step.
+   *  \param [in] order - the iteration order number of required time step.
+   *  \return MEDFileField1TS * - a new instance of MEDFileFieldMultiTS. The caller
+   *          is to delete this field using decrRef() as it is no more needed.
+   *  \throw If reading the file fails.
+   *  \throw If there is no field named \a fieldName in the file.
+   *  \throw If the required time step is missing from the file.
+   */
+  template<class T>
+  typename MLFieldTraits<T>::F1TSType *MEDFileTemplateField1TS<T>::New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll)
+  {
+    MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
+    return New(fid,fieldName,iteration,order,loadAll);
+  }
+  
+  template<class T>
+  typename MLFieldTraits<T>::F1TSType *MEDFileTemplateField1TS<T>::New(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll)
+  {
+    MCAuto<typename MLFieldTraits<T>::F1TSType> ret(new typename MLFieldTraits<T>::F1TSType(fid,fieldName,iteration,order,loadAll,0));
+    ret->contentNotNull();
+    return ret.retn();
+  }
+
+  /*!
+   * Returns a new instance of MEDFileField1TS. If \a shallowCopyOfContent is true the content of \a other is shallow copied.
+   * If \a shallowCopyOfContent is false, \a other is taken to be the content of \a this.
+   *
+   * Returns a new instance of MEDFileField1TS holding either a shallow copy
+   * of a given MEDFileField1TSWithoutSDA ( \a other ) or \a other itself.
+   * \warning this is a shallow copy constructor
+   *  \param [in] other - a MEDFileField1TSWithoutSDA to copy.
+   *  \param [in] shallowCopyOfContent - if \c true, a shallow copy of \a other is created.
+   *  \return MEDFileField1TS * - a new instance of MEDFileField1TS. The caller
+   *          is to delete this field using decrRef() as it is no more needed.
+   */
+  template<class T>
+  typename MLFieldTraits<T>::F1TSType *MEDFileTemplateField1TS<T>::New(const typename MLFieldTraits<T>::F1TSWSDAType& other, bool shallowCopyOfContent)
+  {
+    MCAuto<typename MLFieldTraits<T>::F1TSType> ret(new typename MLFieldTraits<T>::F1TSType(other,shallowCopyOfContent));
+    ret->contentNotNull();
+    return ret.retn();
+  }
+  
+  template<class T>
+  const typename MLFieldTraits<T>::F1TSWSDAType *MEDFileTemplateField1TS<T>::contentNotNull() const
+  {
+    const MEDFileAnyTypeField1TSWithoutSDA *pt(_content);
+    if(!pt)
+      throw INTERP_KERNEL::Exception("MEDFileTemplateField1TS<T>::contentNotNull : the content pointer is null !");
+    const typename MLFieldTraits<T>::F1TSWSDAType *ret(dynamic_cast<const typename MLFieldTraits<T>::F1TSWSDAType *>(pt));
+    if(!ret)
+      {
+        std::ostringstream oss; oss << "MEDFileTemplateField1TS<T>::contentNotNull : the content pointer is not null but it is not of type double ! Reason is maybe that the read field has not the type " << MLFieldTraits<T>::F1TSWSDAType::TYPE_STR;
+        throw INTERP_KERNEL::Exception(oss.str());
+      }
+    return ret;
+  }
+  
+  template<class T>
+  typename MLFieldTraits<T>::F1TSWSDAType *MEDFileTemplateField1TS<T>::contentNotNull()
+  {
+    MEDFileAnyTypeField1TSWithoutSDA *pt(_content);
+    if(!pt)
+      throw INTERP_KERNEL::Exception("MEDFileTemplateField1TS<T>::contentNotNull : the non const content pointer is null !");
+    typename MLFieldTraits<T>::F1TSWSDAType *ret(dynamic_cast<typename MLFieldTraits<T>::F1TSWSDAType *>(pt));
+    if(!ret)
+      {
+        std::ostringstream oss; oss << "MEDFileTemplateField1TS<T>::contentNotNull : the non const content pointer is not null but it is not of type double ! Reason is maybe that the read field has not the type " << MLFieldTraits<T>::F1TSWSDAType::TYPE_STR;
+        throw INTERP_KERNEL::Exception(oss.str());
+      }
+    return ret;
+  }
+  
+  template<class T>
+  typename Traits<T>::ArrayType *MEDFileTemplateField1TS<T>::ReturnSafelyTypedDataArray(MCAuto<DataArray>& arr)
+  {
+    if(arr.isNull())
+      throw INTERP_KERNEL::Exception("MEDFileField1TS::ReturnSafelyTypedDataArray : no array !");
+    typename Traits<T>::ArrayType *arrOutC(dynamic_cast<typename Traits<T>::ArrayType *>((DataArray*)arr));
+    if(!arrOutC)
+      throw INTERP_KERNEL::Exception("MEDFileField1TS::ReturnSafelyTypedDataArray : mismatch between dataArrays type and MEDFileField1TS ! Expected double !");
+    arrOutC->incrRef();
+    return arrOutC;
+  }
+
+  /*!
+   * Returns values and a profile of the field of a given type lying on a given support.
+   * For more info, see \ref AdvMEDLoaderAPIFieldRW
+   *  \param [in] type - a spatial discretization of the field.
+   *  \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities.
+   *  \param [in] mesh - the supporting mesh.
+   *  \param [out] pfl - a new instance of DataArrayInt holding ids of mesh entities the
+   *          field of interest lies on. If the field lies on all entities of the given
+   *          dimension, all ids in \a pfl are zero. The caller is to delete this array
+   *          using decrRef() as it is no more needed.  
+   *  \return DataArrayInt * - a new instance of DataArrayInt holding values of the
+   *          field. The caller is to delete this array using decrRef() as it is no more needed.
+   *  \throw If there are no mesh entities of \a meshDimRelToMax dimension in \a mesh.
+   *  \throw If no field of \a this is lying on \a mesh.
+   *  \throw If no field values of the given \a type or given \a meshDimRelToMax are available.
+   */
+  template<class T>
+  typename Traits<T>::ArrayType *MEDFileTemplateField1TS<T>::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const
+  {
+    MCAuto<DataArray> arr(contentNotNull()->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNull()));
+    return ReturnSafelyTypedDataArray(arr);
+  }
+
+  template<class T>
+  typename Traits<T>::ArrayType *MEDFileTemplateField1TS<T>::getUndergroundDataArray() const
+  {
+    return contentNotNull()->getUndergroundDataArrayTemplate();
+  }
+  
+  template<class T>
+  typename Traits<T>::ArrayType *MEDFileTemplateField1TS<T>::getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+  {
+    return contentNotNull()->getUndergroundDataArrayTemplateExt(entries);
+  }
+
+  template<class T>
+  MCAuto<typename Traits<T>::FieldType> MEDFileTemplateField1TS<T>::SetDataArrayInField(MEDCouplingFieldDouble *f, MCAuto<DataArray>& arr)
+  {
+    if(!f)
+      throw INTERP_KERNEL::Exception("MEDFileTemplateField1TS<T>::SetDataArrayInField : input field is NULL !");
+    if(arr.isNull())
+      throw INTERP_KERNEL::Exception("MEDFileTemplateField1TS<T>::SetDataArrayInField : no array !");
+    int t1,t2;
+    double t0(f->getTime(t1,t2));
+    std::string tu(f->getTimeUnit());
+    MCAuto<typename Traits<T>::ArrayType> arr2(DynamicCastSafe<DataArray,typename Traits<T>::ArrayType>(arr));
+    MCAuto<MEDCouplingFieldTemplate> ft(MEDCouplingFieldTemplate::New(*f));
+    MCAuto<typename Traits<T>::FieldType> ret(Traits<T>::FieldType::New(*ft));
+    ret->setTime(t0,t1,t2); ret->setArray(arr2); ret->setTimeUnit(tu);
+    return ret.retn();
+  }
+
+  template<class T>
+  MCAuto<MEDCouplingFieldDouble> MEDFileTemplateField1TS<T>::ToFieldTemplateWithTime(const typename Traits<T>::FieldType *f)
+  {
+    int t1,t2;
+    double t0(f->getTime(t1,t2));
+    std::string tu(f->getTimeUnit());
+    MCAuto<MEDCouplingFieldTemplate> ft(MEDCouplingFieldTemplate::NewWithoutCheck(*f));
+    MCAuto<MEDCouplingFieldDouble> ret(MEDCouplingFieldDouble::New(*ft));
+    ret->setTime(t0,t1,t2); ret->setTimeUnit(tu);
+    return ret.retn();
+  }
+
+  /*!
+   * This is the simplest version to fetch a field for MED structure. One drawback : if \a this is a complex field (multi spatial discretization inside a same field) this method will throw exception and more advance
+   * method should be called (getFieldOnMeshAtLevel for example).
+   * But for normal usage of field in MED file world this method is the most efficient to fetch data.
+   *
+   * \param [in] mesh - the mesh the field is lying on
+   * \return typename Traits<T>::FieldType * - a new instance of typename Traits<T>::FieldType. The
+   *          caller is to delete this field using decrRef() as it is no more needed. 
+   */
+  template<class T>
+  typename Traits<T>::FieldType *MEDFileTemplateField1TS<T>::field(const MEDFileMesh *mesh) const
+  {
+    MCAuto<DataArray> arrOut;
+    MCAuto<MEDCouplingFieldDouble> ret(contentNotNull()->fieldOnMesh(this,mesh,arrOut,*contentNotNull()));
+    MCAuto<typename Traits<T>::FieldType> ret2(MEDFileTemplateField1TS<T>::SetDataArrayInField(ret,arrOut));
+    return ret2.retn();
+  }
+
+  /*!
+   * Returns a new typename Traits<T>::FieldType of a given type lying on
+   * mesh entities of a given dimension of the first mesh in MED file. If \a this field 
+   * has not been constructed via file reading, an exception is thrown.
+   * For more info, see \ref AdvMEDLoaderAPIFieldRW
+   *  \param [in] type - a spatial discretization of interest.
+   *  \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities.
+   *  \param [in] renumPol - specifies how to permute values of the result field according to
+   *          the optional numbers of cells and nodes, if any. The valid values are
+   *          - 0 - do not permute.
+   *          - 1 - permute cells.
+   *          - 2 - permute nodes.
+   *          - 3 - permute cells and nodes.
+   *
+   *  \return typename Traits<T>::FieldType * - a new instance of typename Traits<T>::FieldType. The
+   *          caller is to delete this field using decrRef() as it is no more needed. 
+   *  \throw If \a this field has not been constructed via file reading.
+   *  \throw If the MED file is not readable.
+   *  \throw If there is no mesh in the MED file.
+   *  \throw If there are no mesh entities of \a meshDimRelToMax dimension in the mesh.
+   *  \throw If no field values of the given \a type or given \a meshDimRelToMax are available.
+   *  \sa getFieldOnMeshAtLevel()
+   */
+  template<class T>
+  typename Traits<T>::FieldType *MEDFileTemplateField1TS<T>::getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol) const
+  {
+    if(getFileName().empty())
+      throw INTERP_KERNEL::Exception("MEDFileTemplateField1TS<T>::getFieldAtLevel : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtLevel method instead !");
+    MCAuto<DataArray> arrOut;
+    MCAuto<MEDCouplingFieldDouble> ret(contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arrOut,*contentNotNull()));
+    MCAuto<typename Traits<T>::FieldType> ret2(MEDFileTemplateField1TS<T>::SetDataArrayInField(ret,arrOut));
+    return ret2.retn();
+  }
+
+  /*!
+   * Returns a new typename Traits<T>::FieldType of a given type lying on
+   * the top level cells of the first mesh in MED file. If \a this field 
+   * has not been constructed via file reading, an exception is thrown.
+   * For more info, see \ref AdvMEDLoaderAPIFieldRW
+   *  \param [in] type - a spatial discretization of interest.
+   *  \param [in] renumPol - specifies how to permute values of the result field according to
+   *          the optional numbers of cells and nodes, if any. The valid values are
+   *          - 0 - do not permute.
+   *          - 1 - permute cells.
+   *          - 2 - permute nodes.
+   *          - 3 - permute cells and nodes.
+   *
+   *  \return typename Traits<T>::FieldType * - a new instance of typename Traits<T>::FieldType. The
+   *          caller is to delete this field using decrRef() as it is no more needed. 
+   *  \throw If \a this field has not been constructed via file reading.
+   *  \throw If the MED file is not readable.
+   *  \throw If there is no mesh in the MED file.
+   *  \throw If no field values of the given \a type.
+   *  \throw If no field values lying on the top level support.
+   *  \sa getFieldAtLevel()
+   */
+  template<class T>
+  typename Traits<T>::FieldType *MEDFileTemplateField1TS<T>::getFieldAtTopLevel(TypeOfField type, int renumPol) const
+  {
+    if(getFileName().empty())
+      throw INTERP_KERNEL::Exception("MEDFileTemplateField1TS<T>::getFieldAtTopLevel : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtTopLevel method instead !");
+    MCAuto<DataArray> arrOut;
+    MCAuto<MEDCouplingFieldDouble> ret(contentNotNull()->getFieldAtTopLevel(type,std::string(),renumPol,this,arrOut,*contentNotNull()));
+    MCAuto<typename Traits<T>::FieldType> ret2(MEDFileTemplateField1TS<T>::SetDataArrayInField(ret,arrOut));
+    return ret2.retn();
+  }
+
+  /*!
+   * Returns a new typename Traits<T>::FieldType of given type lying on a given mesh.
+   * For more info, see \ref AdvMEDLoaderAPIFieldRW
+   *  \param [in] type - a spatial discretization of the new field.
+   *  \param [in] mesh - the supporting mesh.
+   *  \param [in] renumPol - specifies how to permute values of the result field according to
+   *          the optional numbers of cells and nodes, if any. The valid values are
+   *          - 0 - do not permute.
+   *          - 1 - permute cells.
+   *          - 2 - permute nodes.
+   *          - 3 - permute cells and nodes.
+   *
+   *  \return typename Traits<T>::FieldType * - a new instance of typename Traits<T>::FieldType. The
+   *          caller is to delete this field using decrRef() as it is no more needed. 
+   *  \throw If no field of \a this is lying on \a mesh.
+   *  \throw If the mesh is empty.
+   *  \throw If no field values of the given \a type are available.
+   *  \sa getFieldAtLevel()
+   *  \sa getFieldOnMeshAtLevel() 
+   */
+  template<class T>
+  typename Traits<T>::FieldType *MEDFileTemplateField1TS<T>::getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol) const
+  {
+    MCAuto<DataArray> arrOut;
+    MCAuto<MEDCouplingFieldDouble> ret(contentNotNull()->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arrOut,*contentNotNull()));
+    MCAuto<typename Traits<T>::FieldType> ret2(MEDFileTemplateField1TS<T>::SetDataArrayInField(ret,arrOut));
+    return ret2.retn();
+  }
+
+  /*!
+   * Returns a new typename Traits<T>::FieldType of a given type lying on a given support.
+   * For more info, see \ref AdvMEDLoaderAPIFieldRW
+   *  \param [in] type - a spatial discretization of interest.
+   *  \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities.
+   *  \param [in] mesh - the supporting mesh.
+   *  \param [in] renumPol - specifies how to permute values of the result field according to
+   *          the optional numbers of cells and nodes, if any. The valid values are
+   *          - 0 - do not permute.
+   *          - 1 - permute cells.
+   *          - 2 - permute nodes.
+   *          - 3 - permute cells and nodes.
+   *
+   *  \return typename Traits<T>::FieldType * - a new instance of typename Traits<T>::FieldType. The
+   *          caller is to delete this field using decrRef() as it is no more needed. 
+   *  \throw If there are no mesh entities of \a meshDimRelToMax dimension in the mesh.
+   *  \throw If no field of \a this is lying on \a mesh.
+   *  \throw If no field values of the given \a type or given \a meshDimRelToMax are available.
+   *  \sa getFieldAtLevel()
+   *  \sa getFieldOnMeshAtLevel() 
+   */
+  template<class T>
+  typename Traits<T>::FieldType *MEDFileTemplateField1TS<T>::getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol) const
+  {
+    MCAuto<DataArray> arrOut;
+    MCAuto<MEDCouplingFieldDouble> ret(contentNotNull()->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arrOut,*contentNotNull()));
+    MCAuto<typename Traits<T>::FieldType> ret2(MEDFileTemplateField1TS<T>::SetDataArrayInField(ret,arrOut));
+    return ret2.retn();
+  }
+
+  /*!
+   * Returns a new typename Traits<T>::FieldType of a given type lying on a given support.
+   * This method is called "Old" because in MED3 norm a field has only one meshName
+   * attached, so this method is for readers of MED2 files. If \a this field 
+   * has not been constructed via file reading, an exception is thrown.
+   * For more info, see \ref AdvMEDLoaderAPIFieldRW
+   *  \param [in] type - a spatial discretization of interest.
+   *  \param [in] mName - a name of the supporting mesh.
+   *  \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities.
+   *  \param [in] renumPol - specifies how to permute values of the result field according to
+   *          the optional numbers of cells and nodes, if any. The valid values are
+   *          - 0 - do not permute.
+   *          - 1 - permute cells.
+   *          - 2 - permute nodes.
+   *          - 3 - permute cells and nodes.
+   *
+   *  \return typename Traits<T>::FieldType * - a new instance of typename Traits<T>::FieldType. The
+   *          caller is to delete this field using decrRef() as it is no more needed. 
+   *  \throw If the MED file is not readable.
+   *  \throw If there is no mesh named \a mName in the MED file.
+   *  \throw If there are no mesh entities of \a meshDimRelToMax dimension in the mesh.
+   *  \throw If \a this field has not been constructed via file reading.
+   *  \throw If no field of \a this is lying on the mesh named \a mName.
+   *  \throw If no field values of the given \a type or given \a meshDimRelToMax are available.
+   *  \sa getFieldAtLevel()
+   */
+  template<class T>
+  typename Traits<T>::FieldType *MEDFileTemplateField1TS<T>::getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol) const
+  {
+    if(getFileName().empty())
+      throw INTERP_KERNEL::Exception("MEDFileTemplateField1TS<T>::getFieldAtLevelOld : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtLevel method instead !");
+    MCAuto<DataArray> arrOut;
+    MCAuto<MEDCouplingFieldDouble> ret(contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arrOut,*contentNotNull()));
+    MCAuto<typename Traits<T>::FieldType> ret2(MEDFileTemplateField1TS<T>::SetDataArrayInField(ret,arrOut));
+    return ret2.retn();
+  }
+
+  /*!
+   * Adds a MEDCouplingFieldDouble to \a this. The underlying mesh of the given field is
+   * checked if its elements are sorted suitable for writing to MED file ("STB" stands for
+   * "Sort By Type"), if not, an exception is thrown. 
+   * For more info, see \ref AdvMEDLoaderAPIFieldRW
+   *  \param [in] field - the field to add to \a this.
+   *  \throw If the name of \a field is empty.
+   *  \throw If the data array of \a field is not set.
+   *  \throw If the data array is already allocated but has different number of components
+   *         than \a field.
+   *  \throw If the underlying mesh of \a field has no name.
+   *  \throw If elements in the mesh are not in the order suitable for writing to the MED file.
+   */
+  template<class T>
+  void MEDFileTemplateField1TS<T>::setFieldNoProfileSBT(const typename Traits<T>::FieldType *field)
+  {
+    setFileName("");
+    MCAuto<MEDCouplingFieldTemplate> ft(MEDCouplingFieldTemplate::New(*field));
+    contentNotNull()->setFieldNoProfileSBT(field->timeDiscrSafe(),ft,field->getArray(),*this,*contentNotNull());
+  }
+
+  /*!
+   * Adds a MEDCouplingFieldDouble to \a this. As described in \ref MEDLoaderMainC a field in MED file sense
+   * can be an aggregation of several MEDCouplingFieldDouble instances.
+   * The mesh support of input parameter \a field is ignored here, it can be NULL.
+   * The support of field \a field is expected to be those computed with the input parameter \a mesh, \a meshDimRelToMax,
+   * and \a profile.
+   *
+   * This method will check that the field based on the computed support is coherent. If not an exception will be thrown.
+   * A new profile is added only if no equal profile is missing.
+   * For more info, see \ref AdvMEDLoaderAPIFieldRW
+   *  \param [in] field - the field to add to \a this. The mesh support of field is ignored.
+   *  \param [in] mesh - the supporting mesh of \a field.
+   *  \param [in] meshDimRelToMax - a relative dimension of mesh entities \a field lies on (useless if field spatial discretization is ON_NODES).
+   *  \param [in] profile - ids of mesh entities on which corresponding field values lie.
+   *  \throw If either \a field or \a mesh or \a profile has an empty name.
+   *  \throw If there are no mesh entities of \a meshDimRelToMax dimension in \a mesh.
+   *  \throw If the data array of \a field is not set.
+   *  \throw If the data array of \a this is already allocated but has different number of
+   *         components than \a field.
+   *  \throw If elements in \a mesh are not in the order suitable for writing to the MED file.
+   *  \sa setFieldNoProfileSBT()
+   */
+  template<class T>
+  void MEDFileTemplateField1TS<T>::setFieldProfile(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile)
+  {
+    setFileName("");
+    MCAuto<MEDCouplingFieldTemplate> ft(MEDCouplingFieldTemplate::NewWithoutCheck(*field));
+    contentNotNull()->setFieldProfile(field->timeDiscrSafe(),ft,field->getArray(),mesh,meshDimRelToMax,profile,*this,*contentNotNull());
+  }
+
+  /*!
+   * Return an extraction of \a this using \a extractDef map to specify the extraction.
+   * The keys of \a extractDef is level relative to max ext of \a mm mesh.
+   *
+   * \return A new object that the caller is responsible to deallocate.
+   * \sa MEDFileUMesh::deduceNodeSubPartFromCellSubPart , MEDFileUMesh::extractPart
+   */
+  template<class T>
+  typename MLFieldTraits<T>::F1TSType *MEDFileTemplateField1TS<T>::extractPartImpl(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const
+  {
+    if(!mm)
+      throw INTERP_KERNEL::Exception("MEDFileField1TS::extractPart : input mesh is NULL !");
+    MCAuto<typename MLFieldTraits<T>::F1TSType> ret(MLFieldTraits<T>::F1TSType::New());
+    std::vector<TypeOfField> tof(getTypesOfFieldAvailable());
+    for(std::vector<TypeOfField>::const_iterator it0=tof.begin();it0!=tof.end();it0++)
+      {
+        if((*it0)!=ON_NODES)
+          {
+            std::vector<int> levs;
+            getNonEmptyLevels(mm->getName(),levs);
+            for(std::vector<int>::const_iterator lev=levs.begin();lev!=levs.end();lev++)
+              {
+                std::map<int, MCAuto<DataArrayInt> >::const_iterator it2(extractDef.find(*lev));
+                if(it2!=extractDef.end())
+                  {
+                    MCAuto<DataArrayInt> t((*it2).second);
+                    if(t.isNull())
+                      throw INTERP_KERNEL::Exception("MEDFileField1TS::extractPart : presence of a value with null pointer 1 !");
+                    MCAuto<typename Traits<T>::FieldType> f(getFieldOnMeshAtLevel(ON_CELLS,(*lev),mm));
+                    MCAuto<typename Traits<T>::FieldType> fOut(f->buildSubPart(t));
+                    ret->setFieldNoProfileSBT(fOut);
+                  }
+              }
+          }
+        else
+          {
+            std::map<int, MCAuto<DataArrayInt> >::const_iterator it2(extractDef.find(1));
+            if(it2==extractDef.end())
+              throw INTERP_KERNEL::Exception("MEDFileField1TS::extractPart : presence of a NODE field and no extract array available for NODE !");
+            MCAuto<DataArrayInt> t((*it2).second);
+            if(t.isNull())
+              throw INTERP_KERNEL::Exception("MEDFileField1TS::extractPart : presence of a value with null pointer 1 !");
+            MCAuto<typename Traits<T>::FieldType> f(getFieldOnMeshAtLevel(ON_NODES,0,mm));
+            MCAuto<typename Traits<T>::FieldType> fOut(f->deepCopy());
+            typename Traits<T>::ArrayType *arr(f->getArray());
+            MCAuto<typename Traits<T>::ArrayType> newArr(arr->selectByTupleIdSafe(t->begin(),t->end()));
+            fOut->setArray(newArr);
+            ret->setFieldNoProfileSBT(fOut);
+          }
+      }
+    return ret.retn();
+  }
+
+  //////////////////////////
+
+  /*!
+   * This method performs a copy with datatype modification ( int32->float64 ) of \a this. The globals information are copied
+   * following the given input policy.
+   *
+   * \param [in] isDeepCpyGlobs - a boolean that indicates the behaviour concerning globals (profiles and localizations)
+   *                            By default (true) the globals are deeply copied.
+   * \return MEDFileField1TS * - a new object that is the result of the conversion of \a this to float64 field.
+   */
+  template<class T>
+  MEDFileField1TS *MEDFileNDTemplateField1TS<T>::convertToDouble(bool isDeepCpyGlobs) const
+  {
+    MCAuto<MEDFileField1TS> ret;
+    const MEDFileAnyTypeField1TSWithoutSDA *content(this->_content);
+    if(content)
+      {
+        const typename MLFieldTraits<T>::F1TSWSDAType *contc(dynamic_cast<const typename MLFieldTraits<T>::F1TSWSDAType *>(content));
+        if(!contc)
+          {
+            std::ostringstream oss; oss << "MEDFileNDTemplateField1TS<T>::convertToDouble : the content inside this is not " << MLFieldTraits<T>::F1TSWSDAType::TYPE_STR << " ! This is incoherent !";
+            throw INTERP_KERNEL::Exception(oss.str());
+          }
+        MCAuto<MEDFileField1TSWithoutSDA> newc(contc->convertToDouble());
+        ret=static_cast<MEDFileField1TS *>(MEDFileAnyTypeField1TS::BuildNewInstanceFromContent((MEDFileField1TSWithoutSDA *)newc));
+      }
+    else
+      ret=MEDFileField1TS::New();
+    if(isDeepCpyGlobs)
+      ret->deepCpyGlobs(*this);
+    else
+      ret->shallowCpyGlobs(*this);
+    return ret.retn();
+  }
+
+  //////////////////////////
+
+  template<class T>
+  typename MLFieldTraits<T>::FMTSWSDAType *MEDFileTemplateFieldMultiTSWithoutSDA<T>::New(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities)
+  {
+    return new typename MLFieldTraits<T>::FMTSWSDAType(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities);
+  }
+  
+  template<class T>
+  void MEDFileTemplateFieldMultiTSWithoutSDA<T>::checkCoherencyOfType(const MEDFileAnyTypeField1TSWithoutSDA *f1ts) const
+  {
+    if(!f1ts)
+      throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::checkCoherencyOfType : input field1TS is NULL ! Impossible to check !");
+    const typename MLFieldTraits<T>::F1TSWSDAType *f1tsC(dynamic_cast<const typename MLFieldTraits<T>::F1TSWSDAType *>(f1ts));
+    if(!f1tsC)
+      {
+        std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::checkCoherencyOfType : the input field1TS is not a " << MLFieldTraits<T>::F1TSWSDAType::TYPE_STR << " type !";
+        throw INTERP_KERNEL::Exception(oss.str());
+      }
+  }
+  
+  template<class T>
+  const char *MEDFileTemplateFieldMultiTSWithoutSDA<T>::getTypeStr() const
+  {
+    return MLFieldTraits<T>::F1TSWSDAType::TYPE_STR;
+  }
+  
+  template<class T>
+  MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileTemplateFieldMultiTSWithoutSDA<T>::createNew() const
+  {
+    return new typename MLFieldTraits<T>::FMTSWSDAType;
+  }
+  
+  template<class T>
+  MEDFileAnyTypeField1TSWithoutSDA *MEDFileTemplateFieldMultiTSWithoutSDA<T>::createNew1TSWithoutSDAEmptyInstance() const
+  {
+    return new typename MLFieldTraits<T>::F1TSWSDAType;
+  }
+  
+  //////////////////////////
+
+  template<class T>
+  MEDFileFieldMultiTSWithoutSDA *MEDFileNDTemplateFieldMultiTSWithoutSDA<T>::convertToDouble() const
+  {
+    MCAuto<MEDFileFieldMultiTSWithoutSDA> ret(new MEDFileFieldMultiTSWithoutSDA);
+    ret->MEDFileAnyTypeFieldMultiTSWithoutSDA::operator =(*this);
+    int i=0;
+    for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=this->_time_steps.begin();it!=this->_time_steps.end();it++,i++)
+      {
+        const MEDFileAnyTypeField1TSWithoutSDA *eltToConv(*it);
+        if(eltToConv)
+          {
+            const typename MLFieldTraits<T>::F1TSWSDAType *eltToConvC(dynamic_cast<const typename MLFieldTraits<T>::F1TSWSDAType *>(eltToConv));
+            if(!eltToConvC)
+              throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTSWithoutSDA::convertToInt : presence of an invalid 1TS type ! Should be of type INT32 !");
+          MCAuto<MEDFileAnyTypeField1TSWithoutSDA> elt(eltToConvC->convertToDouble());
+          ret->setIteration(i,elt);
+          }
+      }
+    return ret.retn();
+  }
+  
+  //////////////////////////
+  
+  template<class T>
+  MEDFileTemplateFieldMultiTS<T>::MEDFileTemplateFieldMultiTS()
+  {
+    _content=new typename MLFieldTraits<T>::FMTSWSDAType;
+  }
+
+  template<class T>
+  MEDFileTemplateFieldMultiTS<T>::MEDFileTemplateFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms):MEDFileAnyTypeFieldMultiTS(fid,loadAll,ms)
+  {
+  }
+  
+  template<class T>
+  MEDFileTemplateFieldMultiTS<T>::MEDFileTemplateFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileAnyTypeFieldMultiTS(fid,fieldName,loadAll,ms,entities)
+  {
+  }
+  
+  template<class T>
+  MEDFileTemplateFieldMultiTS<T>::MEDFileTemplateFieldMultiTS(const typename MLFieldTraits<T>::FMTSWSDAType& other, bool shallowCopyOfContent):MEDFileAnyTypeFieldMultiTS(other,shallowCopyOfContent)
+  {
+  }
+
+  /*!
+   * Return an extraction of \a this using \a extractDef map to specify the extraction.
+   * The keys of \a extractDef is level relative to max ext of \a mm mesh.
+   *
+   * \return A new object that the caller is responsible to deallocate.
+   */
+  template<class T>
+  typename MLFieldTraits<T>::FMTSType *MEDFileTemplateFieldMultiTS<T>::extractPartImpl(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const
+  {
+    if(!mm)
+      throw INTERP_KERNEL::Exception("MEDFileTemplateFieldMultiTS<T>::extractPart : mesh is null !");
+    MCAuto<typename MLFieldTraits<T>::FMTSType> fmtsOut(MLFieldTraits<T>::FMTSType::New());
+    int nbTS(getNumberOfTS());
+    for(int i=0;i<nbTS;i++)
+      {
+        MCAuto<MEDFileAnyTypeField1TS> f1ts(getTimeStepAtPos(i));
+        MCAuto<typename MLFieldTraits<T>::F1TSType> f1ts2(DynamicCastSafe<MEDFileAnyTypeField1TS,typename MLFieldTraits<T>::F1TSType>(f1ts));
+        MCAuto<typename MLFieldTraits<T>::F1TSType> f1tsOut(f1ts2->extractPartImpl(extractDef,mm));
+        fmtsOut->pushBackTimeStep(f1tsOut);
+      }
+    return fmtsOut.retn();
+  }
+
+  /*!
+   * Returns a new empty instance of MEDFileFieldMultiTS.
+   *  \return MEDFileFieldMultiTS * - a new instance of MEDFileFieldMultiTS. The caller
+   *          is to delete this field using decrRef() as it is no more needed.
+   */
+  template<class T>
+  typename MLFieldTraits<T>::FMTSType *MEDFileTemplateFieldMultiTS<T>::New()
+  {
+    return new typename MLFieldTraits<T>::FMTSType;
+  }
+
+  /*!
+   * Returns a new instance of MEDFileTemplateFieldMultiTS<T> holding data of the first field
+   * that has been read from a specified MED file.
+   *  \param [in] fileName - the name of the MED file to read.
+   *  \return MEDFileTemplateFieldMultiTS<T> * - a new instance of MEDFileTemplateFieldMultiTS<T>. The caller
+   *          is to delete this field using decrRef() as it is no more needed.
+   *  \throw If reading the file fails.
+   */
+  template<class T>
+  typename MLFieldTraits<T>::FMTSType *MEDFileTemplateFieldMultiTS<T>::New(const std::string& fileName, bool loadAll)
+  {
+    MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
+    return New(fid,loadAll);
+  }
+
+  template<class T>
+  typename MLFieldTraits<T>::FMTSType *MEDFileTemplateFieldMultiTS<T>::New(med_idt fid, bool loadAll)
+  {
+    MCAuto<typename MLFieldTraits<T>::FMTSType> ret(new typename MLFieldTraits<T>::FMTSType(fid,loadAll,0));
+    ret->contentNotNull();//to check that content type matches with \a this type.
+    return ret.retn();
+  }
+
+  /*!
+   * Returns a new instance of MEDFileFieldMultiTS holding data of a given field
+   * that has been read from a specified MED file.
+   *  \param [in] fileName - the name of the MED file to read.
+   *  \param [in] fieldName - the name of the field to read.
+   *  \return MEDFileTemplateFieldMultiTS<T> * - a new instance of MEDFileTemplateFieldMultiTS<T>. The caller
+   *          is to delete this field using decrRef() as it is no more needed.
+   *  \throw If reading the file fails.
+   *  \throw If there is no field named \a fieldName in the file.
+   */
+  template<class T>
+  typename MLFieldTraits<T>::FMTSType *MEDFileTemplateFieldMultiTS<T>::New(const std::string& fileName, const std::string& fieldName, bool loadAll)
+  {
+    MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
+    return New(fid,fieldName,loadAll);
+  }
+
+  template<class T>
+  typename MLFieldTraits<T>::FMTSType *MEDFileTemplateFieldMultiTS<T>::New(med_idt fid, const std::string& fieldName, bool loadAll)
+  {
+    MCAuto<typename MLFieldTraits<T>::FMTSType> ret(new typename MLFieldTraits<T>::FMTSType(fid,fieldName,loadAll,0));
+    ret->contentNotNull();//to check that content type matches with \a this type.
+    return ret.retn();
+  }
+
+  /*!
+   * Returns a new instance of MEDFileFieldMultiTS. If \a shallowCopyOfContent is true the content of \a other is shallow copied.
+   * If \a shallowCopyOfContent is false, \a other is taken to be the content of \a this.
+   *
+   * Returns a new instance of MEDFileTemplateFieldMultiTS<T> holding either a shallow copy
+   * of a given MEDFileTemplateFieldMultiTS<T>WithoutSDA ( \a other ) or \a other itself.
+   * \warning this is a shallow copy constructor
+   *  \param [in] other - a MEDFileField1TSWithoutSDA to copy.
+   *  \param [in] shallowCopyOfContent - if \c true, a shallow copy of \a other is created.
+   *  \return MEDFileTemplateFieldMultiTS<T> * - a new instance of MEDFileTemplateFieldMultiTS<T>. The caller
+   *          is to delete this field using decrRef() as it is no more needed.
+   */
+  template<class T>
+  typename MLFieldTraits<T>::FMTSType *MEDFileTemplateFieldMultiTS<T>::New(const typename MLFieldTraits<T>::FMTSWSDAType& other, bool shallowCopyOfContent)
+  {
+    return new typename MLFieldTraits<T>::FMTSType(other,shallowCopyOfContent);
+  }
+
+  template<class T>
+  typename MLFieldTraits<T>::FMTSType *MEDFileTemplateFieldMultiTS<T>::LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, const std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> >& entities, bool loadAll)
+  {
+    MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
+    INTERP_KERNEL::AutoCppPtr<MEDFileEntities> ent(new MEDFileStaticEntities(entities));
+    MCAuto<typename MLFieldTraits<T>::FMTSType> ret(new typename MLFieldTraits<T>::FMTSType(fid,fieldName,loadAll,0,ent));
+    ret->contentNotNull();//to check that content type matches with \a this type.
+    return ret.retn();
+  }
+
+  /*!
+   * This is the simplest version to fetch a field for MED structure. One drawback : if \a this is a complex field (multi spatial discretization inside a same field) this method will throw exception and more advance
+   * method should be called (getFieldOnMeshAtLevel for example).
+   * But for normal usage of field in MED file world this method is the most efficient to fetch data.
+   *
+   * \param [in] iteration - the iteration number of a required time step.
+   * \param [in] order - the iteration order number of required time step.
+   * \param [in] mesh - the mesh the field is lying on
+   * \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The
+   *          caller is to delete this field using decrRef() as it is no more needed. 
+   */
+  template<class T>
+  typename Traits<T>::FieldType *MEDFileTemplateFieldMultiTS<T>::field(int iteration, int order, const MEDFileMesh *mesh) const
+  {
+    const MEDFileAnyTypeField1TSWithoutSDA& myF1TS(contentNotNullBase()->getTimeStepEntry(iteration,order));
+    MCAuto<DataArray> arrOut;
+    MCAuto<MEDCouplingFieldDouble> ret(myF1TS.fieldOnMesh(this,mesh,arrOut,*contentNotNullBase()));
+    MCAuto<typename Traits<T>::FieldType> ret2(MEDFileTemplateField1TS<T>::SetDataArrayInField(ret,arrOut));
+    return ret2.retn();
+  }
+
+  /*!
+   * Returns a new MEDCouplingFieldDouble of a given type, of a given time step, lying on
+   * mesh entities of a given dimension of the first mesh in MED file.
+   * For more info, see \ref AdvMEDLoaderAPIFieldRW
+   *  \param [in] type - a spatial discretization of interest.
+   *  \param [in] iteration - the iteration number of a required time step.
+   *  \param [in] order - the iteration order number of required time step.
+   *  \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities.
+   *  \param [in] renumPol - specifies how to permute values of the result field according to
+   *          the optional numbers of cells and nodes, if any. The valid values are
+   *          - 0 - do not permute.
+   *          - 1 - permute cells.
+   *          - 2 - permute nodes.
+   *          - 3 - permute cells and nodes.
+   *
+   *  \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The
+   *          caller is to delete this field using decrRef() as it is no more needed. 
+   *  \throw If the MED file is not readable.
+   *  \throw If there is no mesh in the MED file.
+   *  \throw If there are no mesh entities of \a meshDimRelToMax dimension in the mesh.
+   *  \throw If no field values of the required parameters are available.
+   */
+  template<class T>
+  typename Traits<T>::FieldType *MEDFileTemplateFieldMultiTS<T>::getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol) const
+  {
+    const MEDFileAnyTypeField1TSWithoutSDA& myF1TS(contentNotNullBase()->getTimeStepEntry(iteration,order));
+    const typename MLFieldTraits<T>::F1TSWSDAType *myF1TSC(dynamic_cast<const typename MLFieldTraits<T>::F1TSWSDAType *>(&myF1TS));
+    if(!myF1TSC)
+      throw INTERP_KERNEL::Exception("MEDFileTemplateFieldMultiTS<T>::getFieldAtLevel : mismatch of type of field expecting FLOAT64 !");
+    MCAuto<DataArray> arrOut;
+    MCAuto<MEDCouplingFieldDouble> ret(myF1TSC->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arrOut,*contentNotNullBase()));
+    MCAuto<typename Traits<T>::FieldType> ret2(MEDFileTemplateField1TS<T>::SetDataArrayInField(ret,arrOut));
+    return ret2.retn();
+  }
+
+  /*!
+   * Returns a new MEDCouplingFieldDouble of a given type, of a given time step, lying on
+   * the top level cells of the first mesh in MED file.
+   * For more info, see \ref AdvMEDLoaderAPIFieldRW
+   *  \param [in] type - a spatial discretization of interest.
+   *  \param [in] iteration - the iteration number of a required time step.
+   *  \param [in] order - the iteration order number of required time step.
+   *  \param [in] renumPol - specifies how to permute values of the result field according to
+   *          the optional numbers of cells and nodes, if any. The valid values are
+   *          - 0 - do not permute.
+   *          - 1 - permute cells.
+   *          - 2 - permute nodes.
+   *          - 3 - permute cells and nodes.
+   *
+   *  \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The
+   *          caller is to delete this field using decrRef() as it is no more needed. 
+   *  \throw If the MED file is not readable.
+   *  \throw If there is no mesh in the MED file.
+   *  \throw If no field values of the required parameters are available.
+   */
+  template<class T>
+  typename Traits<T>::FieldType *MEDFileTemplateFieldMultiTS<T>::getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol) const
+  {
+    const MEDFileAnyTypeField1TSWithoutSDA& myF1TS(contentNotNullBase()->getTimeStepEntry(iteration,order));
+    const typename MLFieldTraits<T>::F1TSWSDAType *myF1TSC(dynamic_cast<const typename MLFieldTraits<T>::F1TSWSDAType *>(&myF1TS));
+    if(!myF1TSC)
+      throw INTERP_KERNEL::Exception("MEDFileTemplateFieldMultiTS<T>::getFieldAtTopLevel : mismatch of type of field !");
+    MCAuto<DataArray> arrOut;
+    MCAuto<MEDCouplingFieldDouble> ret(myF1TSC->getFieldAtTopLevel(type,std::string(),renumPol,this,arrOut,*contentNotNullBase()));
+    MCAuto<typename Traits<T>::FieldType> ret2(MEDFileTemplateField1TS<T>::SetDataArrayInField(ret,arrOut));
+    return ret2.retn();
+  }
+
+  /*!
+   * Returns a new MEDCouplingFieldDouble of a given type, of a given time step, lying on
+   * a given support.
+   * For more info, see \ref AdvMEDLoaderAPIFieldRW
+   *  \param [in] type - a spatial discretization of interest.
+   *  \param [in] iteration - the iteration number of a required time step.
+   *  \param [in] order - the iteration order number of required time step.
+   *  \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities.
+   *  \param [in] mesh - the supporting mesh.
+   *  \param [in] renumPol - specifies how to permute values of the result field according to
+   *          the optional numbers of cells and nodes, if any. The valid values are
+   *          - 0 - do not permute.
+   *          - 1 - permute cells.
+   *          - 2 - permute nodes.
+   *          - 3 - permute cells and nodes.
+   *
+   *  \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The
+   *          caller is to delete this field using decrRef() as it is no more needed. 
+   *  \throw If there are no mesh entities of \a meshDimRelToMax dimension in the mesh.
+   *  \throw If no field of \a this is lying on \a mesh.
+   *  \throw If no field values of the required parameters are available.
+   */
+  template<class T>
+  typename Traits<T>::FieldType *MEDFileTemplateFieldMultiTS<T>::getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol) const
+  {
+    const MEDFileAnyTypeField1TSWithoutSDA& myF1TS(contentNotNullBase()->getTimeStepEntry(iteration,order));
+    const typename MLFieldTraits<T>::F1TSWSDAType *myF1TSC(dynamic_cast<const typename MLFieldTraits<T>::F1TSWSDAType *>(&myF1TS));
+    if(!myF1TSC)
+      throw INTERP_KERNEL::Exception("MEDFileTemplateFieldMultiTS<T>::getFieldOnMeshAtLevel : mismatch of type of field !");
+    MCAuto<DataArray> arrOut;
+    MCAuto<MEDCouplingFieldDouble> ret(myF1TSC->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arrOut,*contentNotNullBase()));
+    MCAuto<typename Traits<T>::FieldType> ret2(MEDFileTemplateField1TS<T>::SetDataArrayInField(ret,arrOut));
+    return ret2.retn();
+  }
+
+  /*!
+   * Returns a new MEDCouplingFieldDouble of given type, of a given time step, lying on a
+   * given support. 
+   * For more info, see \ref AdvMEDLoaderAPIFieldRW
+   *  \param [in] type - a spatial discretization of the new field.
+   *  \param [in] iteration - the iteration number of a required time step.
+   *  \param [in] order - the iteration order number of required time step.
+   *  \param [in] mesh - the supporting mesh.
+   *  \param [in] renumPol - specifies how to permute values of the result field according to
+   *          the optional numbers of cells and nodes, if any. The valid values are
+   *          - 0 - do not permute.
+   *          - 1 - permute cells.
+   *          - 2 - permute nodes.
+   *          - 3 - permute cells and nodes.
+   *
+   *  \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The
+   *          caller is to delete this field using decrRef() as it is no more needed. 
+   *  \throw If no field of \a this is lying on \a mesh.
+   *  \throw If no field values of the required parameters are available.
+   */
+  template<class T>
+  typename Traits<T>::FieldType *MEDFileTemplateFieldMultiTS<T>::getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol) const
+  {
+    const MEDFileAnyTypeField1TSWithoutSDA& myF1TS(contentNotNullBase()->getTimeStepEntry(iteration,order));
+    const typename MLFieldTraits<T>::F1TSWSDAType *myF1TSC(dynamic_cast<const typename MLFieldTraits<T>::F1TSWSDAType *>(&myF1TS));
+    if(!myF1TSC)
+      throw INTERP_KERNEL::Exception("MEDFileTemplateFieldMultiTS<T>::getFieldOnMeshAtLevel : mismatch of type of field !");
+    MCAuto<DataArray> arrOut;
+    MCAuto<MEDCouplingFieldDouble> ret(myF1TSC->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arrOut,*contentNotNullBase()));
+    MCAuto<typename Traits<T>::FieldType> ret2(MEDFileTemplateField1TS<T>::SetDataArrayInField(ret,arrOut));
+    return ret2.retn();
+  }
+
+  /*!
+   * This method has a close behaviour than MEDFileFieldMultiTS::getFieldAtLevel.
+   * This method is called 'old' because the user should give the mesh name he wants to use for it's field.
+   * This method is useful for MED2 file format when field on different mesh was autorized.
+   */
+  template<class T>
+  typename Traits<T>::FieldType *MEDFileTemplateFieldMultiTS<T>::getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol) const
+  {
+    const MEDFileAnyTypeField1TSWithoutSDA& myF1TS(contentNotNullBase()->getTimeStepEntry(iteration,order));
+    const typename MLFieldTraits<T>::F1TSWSDAType *myF1TSC(dynamic_cast<const typename MLFieldTraits<T>::F1TSWSDAType *>(&myF1TS));
+    if(!myF1TSC)
+      throw INTERP_KERNEL::Exception("MEDFileTemplateFieldMultiTS<T>::getFieldAtLevelOld : mismatch of type of field !");
+    MCAuto<DataArray> arrOut;
+    MCAuto<MEDCouplingFieldDouble> ret(myF1TSC->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arrOut,*contentNotNullBase()));
+    MCAuto<typename Traits<T>::FieldType> ret2(MEDFileTemplateField1TS<T>::SetDataArrayInField(ret,arrOut));
+    return ret2.retn();
+  }
+
+  /*!
+   * Returns values and a profile of the field of a given type, of a given time step,
+   * lying on a given support.
+   * For more info, see \ref AdvMEDLoaderAPIFieldRW
+   *  \param [in] type - a spatial discretization of the field.
+   *  \param [in] iteration - the iteration number of a required time step.
+   *  \param [in] order - the iteration order number of required time step.
+   *  \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities.
+   *  \param [in] mesh - the supporting mesh.
+   *  \param [out] pfl - a new instance of DataArrayInt holding ids of mesh entities the
+   *          field of interest lies on. If the field lies on all entities of the given
+   *          dimension, all ids in \a pfl are zero. The caller is to delete this array
+   *          using decrRef() as it is no more needed.  
+   *  \param [in] glob - the global data storing profiles and localization.
+   *  \return DataArrayDouble * - a new instance of DataArrayDouble holding values of the
+   *          field. The caller is to delete this array using decrRef() as it is no more needed.
+   *  \throw If there are no mesh entities of \a meshDimRelToMax dimension in \a mesh.
+   *  \throw If no field of \a this is lying on \a mesh.
+   *  \throw If no field values of the required parameters are available.
+   */
+  template<class T>
+  typename Traits<T>::ArrayType *MEDFileTemplateFieldMultiTS<T>::getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const
+  {
+    const MEDFileAnyTypeField1TSWithoutSDA& myF1TS(contentNotNullBase()->getTimeStepEntry(iteration,order));
+    const typename MLFieldTraits<T>::F1TSWSDAType *myF1TSC(dynamic_cast<const typename MLFieldTraits<T>::F1TSWSDAType *>(&myF1TS));
+    if(!myF1TSC)
+      throw INTERP_KERNEL::Exception("MEDFileTemplateFieldMultiTS<T>::getFieldWithProfile : mismatch of type of field !");
+    MCAuto<DataArray> ret(myF1TSC->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNullBase()));
+    return MEDFileTemplateField1TS<T>::ReturnSafelyTypedDataArray(ret);
+  }
+
+  /*!
+   * Adds a MEDCouplingFieldDouble to \a this as another time step. The underlying mesh of
+   * the given field is checked if its elements are sorted suitable for writing to MED file
+   * ("STB" stands for "Sort By Type"), if not, an exception is thrown. 
+   * For more info, see \ref AdvMEDLoaderAPIFieldRW
+   *  \param [in] field - the field to add to \a this.
+   *  \throw If the name of \a field is empty.
+   *  \throw If the data array of \a field is not set.
+   *  \throw If existing time steps have different name or number of components than \a field.
+   *  \throw If the underlying mesh of \a field has no name.
+   *  \throw If elements in the mesh are not in the order suitable for writing to the MED file.
+   */
+  template<class T>
+  void MEDFileTemplateFieldMultiTS<T>::appendFieldNoProfileSBT(const typename Traits<T>::FieldType *field)
+  {
+    const typename Traits<T>::ArrayType *arr(NULL);
+    if(field)
+      arr=field->getArray();
+    MCAuto<MEDCouplingFieldDouble> field2(MEDFileTemplateField1TS<T>::ToFieldTemplateWithTime(field));
+    contentNotNull()->appendFieldNoProfileSBT(field2,arr,*this);
+  }
+
+  /*!
+   * Adds a MEDCouplingFieldDouble to \a this as another time step.
+   * The mesh support of input parameter \a field is ignored here, it can be NULL.
+   * The support of field \a field is expected to be those computed with the input parameter \a mesh, \a meshDimRelToMax,
+   * and \a profile.
+   *
+   * This method will check that the field based on the computed support is coherent. If not an exception will be thrown.
+   * A new profile is added only if no equal profile is missing.
+   * For more info, see \ref AdvMEDLoaderAPIFieldRW
+   *  \param [in] field - the field to add to \a this. The mesh support of field is ignored.
+   *  \param [in] mesh - the supporting mesh of \a field.
+   *  \param [in] meshDimRelToMax - a relative dimension of mesh entities \a field lies on (useless if field spatial discretization is ON_NODES).
+   *  \param [in] profile - ids of mesh entities on which corresponding field values lie.
+   *  \throw If either \a field or \a mesh or \a profile has an empty name.
+   *  \throw If there are no mesh entities of \a meshDimRelToMax dimension in \a mesh.
+   *  \throw If the data array of \a field is not set.
+   *  \throw If the data array of \a this is already allocated but has different number of
+   *         components than \a field.
+   *  \throw If elements in \a mesh are not in the order suitable for writing to the MED file.
+   *  \sa setFieldNoProfileSBT()
+   */
+  template<class T>
+  void MEDFileTemplateFieldMultiTS<T>::appendFieldProfile(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile)
+  {
+    const typename Traits<T>::ArrayType *arr(NULL);
+    if(field)
+      arr=field->getArray();
+    MCAuto<MEDCouplingFieldDouble> field2(MEDFileTemplateField1TS<T>::ToFieldTemplateWithTime(field));
+    contentNotNull()->appendFieldProfile(field2,arr,mesh,meshDimRelToMax,profile,*this);
+  }
+
+  template<class T>
+  const typename MLFieldTraits<T>::FMTSWSDAType *MEDFileTemplateFieldMultiTS<T>::contentNotNull() const
+  {
+    const MEDFileAnyTypeFieldMultiTSWithoutSDA *pt(_content);
+    if(!pt)
+      throw INTERP_KERNEL::Exception("MEDFileTemplateFieldMultiTS<T>::contentNotNull : the content pointer is null !");
+    const typename MLFieldTraits<T>::FMTSWSDAType *ret=dynamic_cast<const typename MLFieldTraits<T>::FMTSWSDAType *>(pt);
+    if(!ret)
+      throw INTERP_KERNEL::Exception("MEDFileTemplateFieldMultiTS<T>::contentNotNull : the content pointer is not null but it is not of type double ! Reason is maybe that the read field has not the type FLOAT64 !");
+    return ret;
+  }
+
+  template<class T>
+  typename MLFieldTraits<T>::FMTSWSDAType *MEDFileTemplateFieldMultiTS<T>::contentNotNull()
+  {
+    MEDFileAnyTypeFieldMultiTSWithoutSDA *pt(_content);
+    if(!pt)
+      throw INTERP_KERNEL::Exception("MEDFileTemplateFieldMultiTS<T>::contentNotNull : the non const content pointer is null !");
+    typename MLFieldTraits<T>::FMTSWSDAType *ret(dynamic_cast<typename MLFieldTraits<T>::FMTSWSDAType *>(pt));
+    if(!ret)
+      throw INTERP_KERNEL::Exception("MEDFileTemplateFieldMultiTS<T>::contentNotNull : the non const content pointer is not null but it is not of type double ! Reason is maybe that the read field has not the type FLOAT64 !");
+    return ret;
+  }
+
+  /*!
+   * Returns a new MEDFileField1TS holding data of a given time step of \a this field.
+   *  \param [in] pos - a time step id.
+   *  \return MEDFileField1TS * - a new instance of MEDFileField1TS. The caller is to
+   *          delete this field using decrRef() as it is no more needed.
+   *  \throw If \a pos is not a valid time step id.
+   */
+  template<class T>
+  typename MLFieldTraits<T>::F1TSType *MEDFileTemplateFieldMultiTS<T>::getTimeStepAtPos(int pos) const
+  {
+    const MEDFileAnyTypeField1TSWithoutSDA *item(contentNotNullBase()->getTimeStepAtPos2(pos));
+    if(!item)
+      {
+        std::ostringstream oss; oss << "MEDFileFieldMultiTS::getTimeStepAtPos : field at pos #" << pos << " is null !";
+        throw INTERP_KERNEL::Exception(oss.str());
+      }
+    const typename MLFieldTraits<T>::F1TSWSDAType *itemC=dynamic_cast<const typename MLFieldTraits<T>::F1TSWSDAType *>(item);
+    if(itemC)
+      {
+        MCAuto<typename MLFieldTraits<T>::F1TSType> ret(MLFieldTraits<T>::F1TSType::New(*itemC,false));
+        ret->shallowCpyGlobs(*this);
+        return ret.retn();
+      }
+    std::ostringstream oss; oss << "MEDFileFieldMultiTS::getTimeStepAtPos : type of field at pos #" << pos << " is not " << MLFieldTraits<T>::F1TSWSDAType::TYPE_STR << " !";
+    throw INTERP_KERNEL::Exception(oss.str());
+  }
+
+  template<class T>
+  typename Traits<T>::ArrayType *MEDFileTemplateFieldMultiTS<T>::getUndergroundDataArray(int iteration, int order) const
+  {
+    DataArray *ret(contentNotNull()->getUndergroundDataArray(iteration,order));
+    if(!ret)
+      return NULL;
+    typename Traits<T>::ArrayType *ret2(dynamic_cast<typename Traits<T>::ArrayType *>(ret));
+    if(!ret2)
+      {
+        std::ostringstream oss; oss << "MEDFileTemplateFieldMultiTS<T>::getUndergroundDataArray : invalid type of data dectected ! Expecting " << MLFieldTraits<T>::F1TSWSDAType::TYPE_STR;
+        throw INTERP_KERNEL::Exception(oss.str());
+      }
+    return ret2;
+  }
+
+  template<class T>
+  typename Traits<T>::ArrayType *MEDFileTemplateFieldMultiTS<T>::getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+  {
+    DataArray *ret(contentNotNull()->getUndergroundDataArrayExt(iteration,order,entries));
+    if(!ret)
+      return NULL;
+    typename Traits<T>::ArrayType *ret2(dynamic_cast<typename Traits<T>::ArrayType *>(ret));
+    if(!ret2)
+      {
+        std::ostringstream oss; oss << "MEDFileTemplateFieldMultiTS<T>::getUndergroundDataArrayExt : invalid type of data dectected ! Expecting " << MLFieldTraits<T>::F1TSWSDAType::TYPE_STR;
+        throw INTERP_KERNEL::Exception(oss.str());
+      }
+    return ret2;
+  }
+  
+  template<class T>
+  typename MLFieldTraits<T>::FMTSType *MEDFileTemplateFieldMultiTS<T>::buildNewEmptyImpl() const
+  {
+    return MLFieldTraits<T>::FMTSType::New();
+  }
+  
+  template<class T>
+  void MEDFileTemplateFieldMultiTS<T>::checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const
+  {
+    if(!f1ts)
+      throw INTERP_KERNEL::Exception("MEDFileTemplateFieldMultiTS<T>::checkCoherencyOfType : input field1TS is NULL ! Impossible to check !");
+    const typename MLFieldTraits<T>::F1TSType *f1tsC=dynamic_cast<const typename MLFieldTraits<T>::F1TSType *>(f1ts);
+    if(!f1tsC)
+      {
+        std::ostringstream oss; oss << "MEDFileTemplateFieldMultiTS<T>::checkCoherencyOfType : the input field1TS is not a " << MLFieldTraits<T>::F1TSWSDAType::TYPE_STR << " type !";
+        throw INTERP_KERNEL::Exception(oss.str());
+      }
+  }
+
+  //////////////////////////
+
+  /*!
+   * This method performs a copy with datatype modification ( int32->float64 ) of \a this. The globals information are copied
+   * following the given input policy.
+   *
+   * \param [in] isDeepCpyGlobs - a boolean that indicates the behaviour concerning globals (profiles and localizations)
+   *                            By default (true) the globals are deeply copied.
+   * \return MEDFileFieldMultiTS * - a new object that is the result of the conversion of \a this to float64 field.
+   */
+  template<class T>
+  MEDFileFieldMultiTS *MEDFileNDTemplateFieldMultiTS<T>::convertToDouble(bool isDeepCpyGlobs) const
+  {
+    MCAuto<MEDFileFieldMultiTS> ret;
+    const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(this->_content);
+    if(content)
+      {
+        const typename MLFieldTraits<T>::FMTSWSDAType *contc=dynamic_cast<const typename MLFieldTraits<T>::FMTSWSDAType *>(content);
+        if(!contc)
+          throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::convertToInt : the content inside this is not INT32 ! This is incoherent !");
+        MCAuto<MEDFileFieldMultiTSWithoutSDA> newc(contc->convertToDouble());
+        ret=static_cast<MEDFileFieldMultiTS *>(MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent((MEDFileFieldMultiTSWithoutSDA *)newc));
+      }
+    else
+      ret=MEDFileFieldMultiTS::New();
+    if(isDeepCpyGlobs)
+      ret->deepCpyGlobs(*this);
+    else
+      ret->shallowCpyGlobs(*this);
+    return ret.retn();
+  }
 }
 
 #endif
index 3d59c0b9544d51bdee37dc4971d4b9ba9c913750..35babc642440272ab5955b70892eb36be5ea9dc4 100644 (file)
@@ -2357,6 +2357,7 @@ std::vector<const BigMemoryObject *> MEDFileUMesh::getDirectChildrenWithNull() c
   ret.push_back((const DataArrayDouble*)_coords);
   ret.push_back((const DataArrayInt *)_fam_coords);
   ret.push_back((const DataArrayInt *)_num_coords);
+  ret.push_back((const DataArrayInt *)_global_num_coords);
   ret.push_back((const DataArrayInt *)_rev_num_coords);
   ret.push_back((const DataArrayAsciiChar *)_name_coords);
   ret.push_back((const PartDefinition *)_part_coords);
@@ -2382,15 +2383,17 @@ MEDFileUMesh *MEDFileUMesh::deepCopy() const
 {
   MCAuto<MEDFileUMesh> ret(new MEDFileUMesh(*this));
   ret->deepCpyEquivalences(*this);
-  if((const DataArrayDouble*)_coords)
+  if(_coords.isNotNull())
     ret->_coords=_coords->deepCopy();
-  if((const DataArrayInt*)_fam_coords)
+  if(_fam_coords.isNotNull())
     ret->_fam_coords=_fam_coords->deepCopy();
-  if((const DataArrayInt*)_num_coords)
+  if(_num_coords.isNotNull())
     ret->_num_coords=_num_coords->deepCopy();
-  if((const DataArrayInt*)_rev_num_coords)
+  if(_global_num_coords.isNotNull())
+    ret->_global_num_coords=_global_num_coords->deepCopy();
+  if(_rev_num_coords.isNotNull())
     ret->_rev_num_coords=_rev_num_coords->deepCopy();
-  if((const DataArrayAsciiChar*)_name_coords)
+  if(_name_coords.isNotNull())
     ret->_name_coords=_name_coords->deepCopy();
   std::size_t i=0;
   for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++,i++)
@@ -2438,54 +2441,74 @@ bool MEDFileUMesh::isEqual(const MEDFileMesh *other, double eps, std::string& wh
           return false;
         }
     }
-  const DataArrayInt *famc1=_fam_coords;
-  const DataArrayInt *famc2=otherC->_fam_coords;
-  if((famc1==0 && famc2!=0) || (famc1!=0 && famc2==0))
-    {
-      what="Mismatch of families arr on nodes ! One is defined and not other !";
-      return false;
-    }
-  if(famc1)
-    {
-      bool ret=famc1->isEqual(*famc2);
-      if(!ret)
-        {
-          what="Families arr on node differ !";
-          return false;
-        }
-    }
-  const DataArrayInt *numc1=_num_coords;
-  const DataArrayInt *numc2=otherC->_num_coords;
-  if((numc1==0 && numc2!=0) || (numc1!=0 && numc2==0))
-    {
-      what="Mismatch of numbering arr on nodes ! One is defined and not other !";
-      return false;
-    }
-  if(numc1)
-    {
-      bool ret=numc1->isEqual(*numc2);
-      if(!ret)
-        {
-          what="Numbering arr on node differ !";
-          return false;
-        }
-    }
-  const DataArrayAsciiChar *namec1=_name_coords;
-  const DataArrayAsciiChar *namec2=otherC->_name_coords;
-  if((namec1==0 && namec2!=0) || (namec1!=0 && namec2==0))
-    {
-      what="Mismatch of naming arr on nodes ! One is defined and not other !";
-      return false;
-    }
-  if(namec1)
-    {
-      bool ret=namec1->isEqual(*namec2);
-      if(!ret)
-        {
-          what="Names arr on node differ !";
-          return false;
-        }
-    }
+  {
+    const DataArrayInt *famc1(_fam_coords),*famc2(otherC->_fam_coords);
+    if((famc1==0 && famc2!=0) || (famc1!=0 && famc2==0))
+      {
+        what="Mismatch of families arr on nodes ! One is defined and not other !";
+        return false;
+      }
+    if(famc1)
+      {
+        bool ret=famc1->isEqual(*famc2);
+        if(!ret)
+          {
+            what="Families arr on node differ !";
+            return false;
+          }
+      }
+  }
+  {
+    const DataArrayInt *numc1(_num_coords),*numc2(otherC->_num_coords);
+    if((numc1==0 && numc2!=0) || (numc1!=0 && numc2==0))
+      {
+        what="Mismatch of numbering arr on nodes ! One is defined and not other !";
+        return false;
+      }
+    if(numc1)
+      {
+        bool ret=numc1->isEqual(*numc2);
+        if(!ret)
+          {
+            what="Numbering arr on node differ !";
+            return false;
+          }
+      }
+  }
+  {
+    const DataArrayInt *gnumc1(_global_num_coords),*gnumc2(otherC->_global_num_coords);
+    if((gnumc1==0 && gnumc2!=0) || (gnumc1!=0 && gnumc2==0))
+      {
+        what="Mismatch of numbering arr on nodes ! One is defined and not other !";
+        return false;
+      }
+    if(gnumc1)
+      {
+        bool ret=gnumc1->isEqual(*gnumc2);
+        if(!ret)
+          {
+            what="Global numbering arr on node differ !";
+            return false;
+          }
+      }
+  }
+  {
+    const DataArrayAsciiChar *namec1(_name_coords),*namec2(otherC->_name_coords);
+    if((namec1==0 && namec2!=0) || (namec1!=0 && namec2==0))
+      {
+        what="Mismatch of naming arr on nodes ! One is defined and not other !";
+        return false;
+      }
+    if(namec1)
+      {
+        bool ret=namec1->isEqual(*namec2);
+        if(!ret)
+          {
+            what="Names arr on node differ !";
+            return false;
+          }
+      }
+  }
   if(_ms.size()!=otherC->_ms.size())
     {
       what="Number of levels differs !";
@@ -2534,15 +2557,15 @@ void MEDFileUMesh::checkConsistency() const
         throw INTERP_KERNEL::Exception("MEDFileUMesh::checkConsistency(): coords are null but some mesh parts are present!");
       if (!_fam_coords)
         throw INTERP_KERNEL::Exception("MEDFileUMesh::checkConsistency(): coords are null but not the internal node family array!");
-      if (!_num_coords || !_rev_num_coords)
+      if (_num_coords.isNotNull() || _rev_num_coords.isNotNull() || _global_num_coords.isNotNull())
         throw INTERP_KERNEL::Exception("MEDFileUMesh::checkConsistency(): coords are null but not the internal node numbering array!");
     }
   else
     {
       int nbCoo = _coords->getNumberOfTuples();
-      if (_fam_coords)
+      if (_fam_coords.isNotNull())
         _fam_coords->checkNbOfTuplesAndComp(nbCoo,1,"MEDFileUMesh::checkConsistency(): inconsistent internal node family array!");
-      if (_num_coords)
+      if (_num_coords.isNotNull())
         {
           _num_coords->checkNbOfTuplesAndComp(nbCoo,1,"MEDFileUMesh::checkConsistency(): inconsistent internal node numbering array!");
           int pos;
@@ -2550,6 +2573,10 @@ void MEDFileUMesh::checkConsistency() const
           if (!_rev_num_coords || _rev_num_coords->getNumberOfTuples() != (maxValue+1))
             throw INTERP_KERNEL::Exception("MEDFileUMesh::checkConsistency(): inconsistent internal revert node numbering array!");
         }
+      if (_global_num_coords.isNotNull())
+        {
+          _global_num_coords->checkNbOfTuplesAndComp(nbCoo,1,"MEDFileUMesh::checkConsistency(): inconsistent global node numbering array!");
+        }
       if ((_num_coords && !_rev_num_coords) || (!_num_coords && _rev_num_coords))
         throw INTERP_KERNEL::Exception("MEDFileUMesh::checkConsistency(): inconsistent internal numbering arrays (one is null)!");
       if (_num_coords && !_num_coords->hasUniqueValues())
@@ -2600,13 +2627,14 @@ void MEDFileUMesh::checkSMESHConsistency() const
  */
 void MEDFileUMesh::clearNodeAndCellNumbers()
 {
-  _num_coords = 0;
-  _rev_num_coords = 0;
-  for (std::vector< MCAuto<MEDFileUMeshSplitL1> >::iterator it=_ms.begin();
-      it != _ms.end(); it++)
+  _num_coords.nullify();
+  _rev_num_coords.nullify();
+  _global_num_coords.nullify();
+  for (std::vector< MCAuto<MEDFileUMeshSplitL1> >::iterator it=_ms.begin(); it != _ms.end(); it++)
     {
-      (*it)->_num = 0;
-      (*it)->_rev_num = 0;
+      (*it)->_num.nullify();
+      (*it)->_rev_num.nullify();
+      (*it)->_global_num.nullify();
     }
 }
 
@@ -2616,30 +2644,25 @@ void MEDFileUMesh::clearNodeAndCellNumbers()
 void MEDFileUMesh::clearNonDiscrAttributes() const
 {
   MEDFileMesh::clearNonDiscrAttributes();
-  const DataArrayDouble *coo1=_coords;
-  if(coo1)
-    (const_cast<DataArrayDouble *>(coo1))->setName("");//This parameter is not discriminant for comparison
-  const DataArrayInt *famc1=_fam_coords;
-  if(famc1)
-    (const_cast<DataArrayInt *>(famc1))->setName("");//This parameter is not discriminant for comparison
-  const DataArrayInt *numc1=_num_coords;
-  if(numc1)
-    (const_cast<DataArrayInt *>(numc1))->setName("");//This parameter is not discriminant for comparison
-  const DataArrayAsciiChar *namc1=_name_coords;
-  if(namc1)
-    (const_cast<DataArrayAsciiChar *>(namc1))->setName("");//This parameter is not discriminant for comparison
+  if(_coords.isNotNull())
+    _coords.iAmATrollConstCast()->setName("");//This parameter is not discriminant for comparison
+  if(_fam_coords.isNotNull())
+    _fam_coords.iAmATrollConstCast()->setName("");//This parameter is not discriminant for comparison
+  if(_num_coords.isNotNull())
+    _num_coords.iAmATrollConstCast()->setName("");//This parameter is not discriminant for comparison
+  if(_name_coords.isNotNull())
+    _name_coords.iAmATrollConstCast()->setName("");//This parameter is not discriminant for comparison
   for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
     {
-      const MEDFileUMeshSplitL1 *tmp=(*it);
-      if(tmp)
-        tmp->clearNonDiscrAttributes();
+      if((*it).isNotNull())
+        (*it)->clearNonDiscrAttributes();
     }
 }
 
 void MEDFileUMesh::setName(const std::string& name)
 {
   for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::iterator it=_ms.begin();it!=_ms.end();it++)
-    if((MEDFileUMeshSplitL1 *)(*it)!=0)
+    if((*it).isNotNull())
       (*it)->setName(name);
   MEDFileMesh::setName(name);
 }
@@ -2847,6 +2870,8 @@ void MEDFileUMesh::dispatchLoadedPart(med_idt fid, const MEDFileUMeshL2& loaderl
     _num_coords=loaderl2.getCoordsNum();
   if(!mrs || mrs->isNodeNameFieldReading())
     _name_coords=loaderl2.getCoordsName();
+  if(!mrs || mrs->isGlobalNodeNumFieldReading())
+    _global_num_coords=loaderl2.getCoordsGlobalNum();
   _part_coords=loaderl2.getPartDefOfCoo();
   computeRevNum();
 }
@@ -2880,7 +2905,7 @@ void MEDFileUMesh::writeMeshLL(med_idt fid) const
   if(_univ_wr_status)
     MEDFILESAFECALLERWR0(MEDmeshUniversalNameWr,(fid,maa));
   std::string meshName(MEDLoaderBase::buildStringFromFortran(maa,MED_NAME_SIZE));
-  MEDFileUMeshL2::WriteCoords(fid,meshName,_iteration,_order,_time,_coords,_fam_coords,_num_coords,_name_coords);
+  MEDFileUMeshL2::WriteCoords(fid,meshName,_iteration,_order,_time,_coords,_fam_coords,_num_coords,_name_coords,_global_num_coords);
   for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
     if((const MEDFileUMeshSplitL1 *)(*it)!=0)
       (*it)->write(fid,meshName,mdim);
@@ -2939,8 +2964,7 @@ std::vector<int> MEDFileUMesh::getFamArrNonEmptyLevelsExt() const
 std::vector<int> MEDFileUMesh::getNumArrNonEmptyLevelsExt() const
 {
   std::vector<int> ret;
-  const DataArrayInt *numCoo(_num_coords);
-  if(numCoo)
+  if(_num_coords.isNotNull())
     ret.push_back(1);
   int lev=0;
   for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++,lev--)
@@ -3230,6 +3254,13 @@ const DataArrayAsciiChar *MEDFileUMesh::getNameFieldAtLevel(int meshDimRelToMaxE
   return l1->getNameField();
 }
 
+MCAuto<DataArrayInt> MEDFileUMesh::getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const
+{
+  if(meshDimRelToMaxExt!=1)
+    throw INTERP_KERNEL::Exception("MEDFileUMesh::getGlobalNumFieldAtLevel : not implemented yet for structured mesh !");
+  return _global_num_coords;
+}
+
 /*!
  * This method returns for a specified relative level \a meshDimRelToMaxExt the part effectively read (if the instance is the result of the read of a file).
  *
@@ -3339,11 +3370,11 @@ const DataArrayInt *MEDFileUMesh::getRevNumberFieldAtLevel(int meshDimRelToMaxEx
 {
   if(meshDimRelToMaxExt==1)
     {
-      if(!((const DataArrayInt *)_num_coords))
+      if(_num_coords.isNull())
         throw INTERP_KERNEL::Exception("MEDFileUMesh::getRevNumberFieldAtLevel : no coordinates renum specified !");
       return _rev_num_coords;
     }
-  const MEDFileUMeshSplitL1 *l1=getMeshAtLevSafe(meshDimRelToMaxExt);
+  const MEDFileUMeshSplitL1 *l1(getMeshAtLevSafe(meshDimRelToMaxExt));
   return l1->getRevNumberField();
 }
 
@@ -3784,12 +3815,11 @@ void MEDFileUMesh::setCoords(DataArrayDouble *coords)
     return ;
   coords->checkAllocated();
   int nbOfTuples(coords->getNumberOfTuples());
-  _coords=coords;
-  coords->incrRef();
+  _coords.takeRef(coords);
   _fam_coords=DataArrayInt::New();
   _fam_coords->alloc(nbOfTuples,1);
   _fam_coords->fillWithZero();
-  _num_coords=0; _rev_num_coords=0; _name_coords=0;
+  _num_coords.nullify(); _rev_num_coords.nullify(); _name_coords.nullify(); _global_num_coords.nullify();
   for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::iterator it=_ms.begin();it!=_ms.end();it++)
     if((MEDFileUMeshSplitL1 *)(*it))
       (*it)->setCoords(coords);
@@ -4007,8 +4037,8 @@ void MEDFileUMesh::buildInnerBoundaryAlongM1Group(const std::string& grpNameM1,
       _fam_coords=newFam;
     }
 
-  _num_coords = 0;
-  _rev_num_coords = 0;
+  _num_coords.nullify(); _rev_num_coords.nullify(); _global_num_coords.nullify();
+  
   for (std::vector< MCAuto<MEDFileUMeshSplitL1> >::iterator it=_ms.begin();
       it != _ms.end(); it++)
     {
@@ -4148,12 +4178,14 @@ DataArrayInt *MEDFileUMesh::zipCoords()
   MCAuto<DataArrayAsciiChar> newNameCoords;
   if((const DataArrayInt *)_fam_coords)
     newFamCoords=_fam_coords->selectByTupleIdSafe(ret2->begin(),ret2->end());
-  MCAuto<DataArrayInt> newNumCoords;
-  if((const DataArrayInt *)_num_coords)
+  MCAuto<DataArrayInt> newNumCoords,newGlobalNumCoords;
+  if(_num_coords.isNotNull())
     newNumCoords=_num_coords->selectByTupleIdSafe(ret2->begin(),ret2->end());
-  if((const DataArrayAsciiChar *)_name_coords)
+  if(_global_num_coords.isNotNull())
+    newGlobalNumCoords=_global_num_coords->selectByTupleIdSafe(ret2->begin(),ret2->end());
+  if(_name_coords.isNotNull())
     newNameCoords=static_cast<DataArrayAsciiChar *>(_name_coords->selectByTupleIdSafe(ret2->begin(),ret2->end()));
-  _coords=newCoords; _fam_coords=newFamCoords; _num_coords=newNumCoords; _name_coords=newNameCoords; _rev_num_coords=0;
+  _coords=newCoords; _fam_coords=newFamCoords; _num_coords=newNumCoords; _global_num_coords=newGlobalNumCoords; _name_coords=newNameCoords; _rev_num_coords.nullify();
   for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::iterator it=_ms.begin();it!=_ms.end();it++)
     {
       if((MEDFileUMeshSplitL1*)*it)
@@ -5142,8 +5174,7 @@ void MEDFileUMesh::setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famAr
       if(!coo)
         throw INTERP_KERNEL::Exception("MEDFileUMesh::setFamilyFieldArr : the coordinates have not been set !");
       famArr->checkNbOfTuplesAndComp(coo->getNumberOfTuples(),1,"MEDFileUMesh::setFamilyFieldArr : Problem in size of node family arr ! ");
-      famArr->incrRef();
-      _fam_coords=famArr;
+      _fam_coords.takeRef(famArr);
       return ;
     }
   if(meshDimRelToMaxExt>1)
@@ -5169,16 +5200,14 @@ void MEDFileUMesh::setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumA
     {
       if(!renumArr)
         {
-          _num_coords=0;
-          _rev_num_coords=0;
+          _num_coords.nullify();
+          _rev_num_coords.nullify();
           return ;
         }
-      DataArrayDouble *coo(_coords);
-      if(!coo)
+      if(_coords.isNull())
         throw INTERP_KERNEL::Exception("MEDFileUMesh::setRenumFieldArr : the coordinates have not been set !");
-      renumArr->checkNbOfTuplesAndComp(coo->getNumberOfTuples(),1,"MEDFileUMesh::setRenumArr : Problem in size of node numbering arr ! ");
-      renumArr->incrRef();
-      _num_coords=renumArr;
+      renumArr->checkNbOfTuplesAndComp(_coords->getNumberOfTuples(),1,"MEDFileUMesh::setRenumArr : Problem in size of node numbering arr ! ");
+      _num_coords.takeRef(renumArr);
       computeRevNum();
       return ;
     }
@@ -5212,8 +5241,7 @@ void MEDFileUMesh::setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiCha
       if(!coo)
         throw INTERP_KERNEL::Exception("MEDFileUMesh::setNameFieldAtLevel : the coordinates have not been set !");
       nameArr->checkNbOfTuplesAndComp(coo->getNumberOfTuples(),MED_SNAME_SIZE,"MEDFileUMesh::setNameFieldAtLevel : Problem in size of node numbering arr ! ");
-      nameArr->incrRef();
-      _name_coords=nameArr;
+      _name_coords.takeRef(nameArr);
       return ;
     }
   if(meshDimRelToMaxExt>1)
@@ -5226,6 +5254,15 @@ void MEDFileUMesh::setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiCha
   return _ms[traducedRk]->setNameArr(nameArr);
 }
 
+void MEDFileUMesh::setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayInt *globalNumArr)
+{
+  if(meshDimRelToMaxExt!=1)
+    throw INTERP_KERNEL::Exception("MEDFileUMesh::setGlobalNumFieldAtLevel : Only implemented for meshDimRelToMaxExt==1 for the moment !");
+  if(globalNumArr)
+    globalNumArr->checkNbOfTuplesAndComp(_coords->getNumberOfTuples(),1,"MEDFileUMesh::setGlobalNumFieldAtLevel : Problem in size of node global numbering arr ! ");
+  _global_num_coords.takeRef(globalNumArr);
+}
+
 void MEDFileUMesh::synchronizeTinyInfoOnLeaves() const
 {
   for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
@@ -5272,7 +5309,7 @@ std::list< MCAuto<DataArrayInt> > MEDFileUMesh::getAllNonNullFamilyIds() const
 
 void MEDFileUMesh::computeRevNum() const
 {
-  if((const DataArrayInt *)_num_coords)
+  if(_num_coords.isNotNull())
     {
       int pos;
       int maxValue=_num_coords->getMaxValue(pos);
@@ -5754,6 +5791,11 @@ void MEDFileStructuredMesh::setNameFieldAtLevel(int meshDimRelToMaxExt, DataArra
     nameArr->incrRef();
 }
 
+void MEDFileStructuredMesh::setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayInt *globalNumArr)
+{
+  throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::setGlobalNumFieldAtLevel : not implemented yet !");
+}
+
 /*!
  * Adds a group of nodes to \a this mesh.
  *  \param [in] ids - a DataArrayInt providing ids and a name of the group to add.
@@ -5915,6 +5957,11 @@ const DataArrayAsciiChar *MEDFileStructuredMesh::getNameFieldAtLevel(int meshDim
   }
 }
 
+MCAuto<DataArrayInt> MEDFileStructuredMesh::getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const
+{
+  throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::getGlobalNumFieldAtLevel : not implemented yet for structured mesh !");
+}
+
 /*!
  * Returns relative dimensions of mesh entities (excluding nodes) present in \a this mesh.
  *  \return std::vector<int> - a sequence of the relative dimensions: [0].
index ba5c8fe401b5fd48b4c6aea5269b6c644a582ee4..cc3ac738b756724d4ac9a92b87012d2432fa6294 100644 (file)
@@ -172,6 +172,7 @@ namespace MEDCoupling
     MEDLOADER_EXPORT virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) = 0;
     MEDLOADER_EXPORT virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) = 0;
     MEDLOADER_EXPORT virtual void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr) = 0;
+    MEDLOADER_EXPORT virtual void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayInt *globalNumArr) = 0;
     MEDLOADER_EXPORT virtual void addNodeGroup(const DataArrayInt *ids) = 0;
     MEDLOADER_EXPORT virtual void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) = 0;
     MEDLOADER_EXPORT virtual const DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const = 0;
@@ -180,6 +181,7 @@ namespace MEDCoupling
     MEDLOADER_EXPORT virtual const DataArrayInt *getNumberFieldAtLevel(int meshDimRelToMaxExt) const = 0;
     MEDLOADER_EXPORT virtual const DataArrayInt *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const = 0;
     MEDLOADER_EXPORT virtual const DataArrayAsciiChar *getNameFieldAtLevel(int meshDimRelToMaxExt) const = 0;
+    MEDLOADER_EXPORT virtual MCAuto<DataArrayInt> getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const = 0;
     MEDLOADER_EXPORT virtual DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const = 0;
     MEDLOADER_EXPORT virtual DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
     MEDLOADER_EXPORT virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const;
@@ -289,6 +291,7 @@ namespace MEDCoupling
     MEDLOADER_EXPORT const DataArrayInt *getNumberFieldAtLevel(int meshDimRelToMaxExt) const;
     MEDLOADER_EXPORT const DataArrayInt *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const;
     MEDLOADER_EXPORT const DataArrayAsciiChar *getNameFieldAtLevel(int meshDimRelToMaxExt) const;
+    MEDLOADER_EXPORT MCAuto<DataArrayInt> getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const;
     MEDLOADER_EXPORT const PartDefinition *getPartDefAtLevel(int meshDimRelToMaxExt, INTERP_KERNEL::NormalizedCellType gt=INTERP_KERNEL::NORM_ERROR) const;
     MEDLOADER_EXPORT int getNumberOfNodes() const;
     MEDLOADER_EXPORT int getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const;
@@ -335,6 +338,7 @@ namespace MEDCoupling
     MEDLOADER_EXPORT void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr);
     MEDLOADER_EXPORT void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr);
     MEDLOADER_EXPORT void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr);
+    MEDLOADER_EXPORT void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayInt *globalNumArr);
     MEDLOADER_EXPORT void addNodeGroup(const DataArrayInt *ids);
     MEDLOADER_EXPORT void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids);
     MEDLOADER_EXPORT void removeMeshAtLevel(int meshDimRelToMax);
@@ -385,6 +389,7 @@ namespace MEDCoupling
     MCAuto<DataArrayDouble> _coords;
     MCAuto<DataArrayInt> _fam_coords;
     MCAuto<DataArrayInt> _num_coords;
+    MCAuto<DataArrayInt> _global_num_coords;
     MCAuto<DataArrayAsciiChar> _name_coords;
     mutable MCAuto<DataArrayInt> _rev_num_coords;
     MCAuto<PartDefinition> _part_coords;
@@ -408,11 +413,13 @@ namespace MEDCoupling
     MEDLOADER_EXPORT void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr);
     MEDLOADER_EXPORT void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr);
     MEDLOADER_EXPORT void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr);
+    MEDLOADER_EXPORT void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayInt *globalNumArr);
     MEDLOADER_EXPORT void addNodeGroup(const DataArrayInt *ids);
     MEDLOADER_EXPORT void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids);
     MEDLOADER_EXPORT const DataArrayInt *getNumberFieldAtLevel(int meshDimRelToMaxExt) const;
     MEDLOADER_EXPORT const DataArrayInt *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const;
     MEDLOADER_EXPORT const DataArrayAsciiChar *getNameFieldAtLevel(int meshDimRelToMaxExt) const;
+    MEDLOADER_EXPORT MCAuto<DataArrayInt> getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const;
     MEDLOADER_EXPORT std::vector<int> getNonEmptyLevels() const;
     MEDLOADER_EXPORT std::vector<int> getNonEmptyLevelsExt() const;
     MEDLOADER_EXPORT std::vector<int> getFamArrNonEmptyLevelsExt() const;
index 65d4e4c4cde45496570400039e6c177e310a1b7f..4d799a6137c7e779774d847686aab578ed19a861 100644 (file)
@@ -633,6 +633,12 @@ void MEDFileUMeshL2::loadCoords(med_idt fid, const std::vector<std::string>& inf
     }
   else
     _name_coords=0;
+  if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_GLOBAL_NUMBER,MED_NODAL,&changement,&transformation)>0)
+    {
+      _global_num_coords=DataArrayInt::New();
+      _global_num_coords->alloc(nCoords,1);
+      MEDFILESAFECALLERRD0(MEDmeshGlobalNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,_global_num_coords->getPointer()));
+    }
   for(int i=0;i<spaceDim;i++)
     _coords->setInfoOnComponent(i,infosOnComp[i]);
 }
@@ -716,15 +722,15 @@ void MEDFileUMeshL2::sortTypes()
   _per_type_mesh.resize(_per_type_mesh.size()-nbOfUselessLev);
 }
 
-void MEDFileUMeshL2::WriteCoords(med_idt fid, const std::string& mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayInt *famCoords, const DataArrayInt *numCoords, const DataArrayAsciiChar *nameCoords)
+void MEDFileUMeshL2::WriteCoords(med_idt fid, const std::string& mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayInt *famCoords, const DataArrayInt *numCoords, const DataArrayAsciiChar *nameCoords, const DataArrayInt *globalNumCoords)
 {
   if(!coords)
     return ;
-  MEDFILESAFECALLERWR0(MEDmeshNodeCoordinateWr,(fid,mname.c_str(),dt,it,time,MED_FULL_INTERLACE,coords->getNumberOfTuples(),coords->getConstPointer()));
+  MEDFILESAFECALLERWR0(MEDmeshNodeCoordinateWr,(fid,mname.c_str(),dt,it,time,MED_FULL_INTERLACE,coords->getNumberOfTuples(),coords->begin()));
   if(famCoords)
-    MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,famCoords->getNumberOfTuples(),famCoords->getConstPointer()));
+    MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,famCoords->getNumberOfTuples(),famCoords->begin()));
   if(numCoords)
-    MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,numCoords->getNumberOfTuples(),numCoords->getConstPointer()));
+    MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,numCoords->getNumberOfTuples(),numCoords->begin()));
   if(nameCoords)
     {
       if(nameCoords->getNumberOfComponents()!=MED_SNAME_SIZE)
@@ -733,8 +739,10 @@ void MEDFileUMeshL2::WriteCoords(med_idt fid, const std::string& mname, int dt,
           oss << " ! The array has " << nameCoords->getNumberOfComponents() << " components !";
           throw INTERP_KERNEL::Exception(oss.str().c_str());
         }
-      MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,nameCoords->getNumberOfTuples(),nameCoords->getConstPointer()));
+      MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,nameCoords->getNumberOfTuples(),nameCoords->begin()));
     }
+  if(globalNumCoords)
+    MEDFILESAFECALLERWR0(MEDmeshGlobalNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NONE,globalNumCoords->getNumberOfTuples(),globalNumCoords->begin()));
 }
 
 bool MEDFileUMeshL2::isFamDefinedOnLev(int levId) const
@@ -858,7 +866,7 @@ MEDFileUMeshPermCompute::operator MEDCouplingUMesh *() const
     {
       updateTime();
       _m=static_cast<MEDCouplingUMesh *>(_st->_m_by_types.getUmesh()->deepCopy());
-      _m->renumberCells(_st->_num->getConstPointer(),true);
+      _m->renumberCells(_st->_num->begin(),true);
       return _m.retn();
     }
   else
@@ -869,7 +877,7 @@ MEDFileUMeshPermCompute::operator MEDCouplingUMesh *() const
         {
           updateTime();
           _m=static_cast<MEDCouplingUMesh *>(_st->_m_by_types.getUmesh()->deepCopy());
-          _m->renumberCells(_st->_num->getConstPointer(),true);
+          _m->renumberCells(_st->_num->begin(),true);
           return _m.retn();
         }
     }
@@ -1124,7 +1132,7 @@ void MEDFileUMeshSplitL1::assignMesh(MEDCouplingUMesh *m, bool newOrOld)
           _num=da->invertArrayO2N2N2O(m->getNumberOfCells());
           _m.updateTime();
           computeRevNum();
-          _m_by_types.getUmesh()->renumberCells(da->getConstPointer(),false);
+          _m_by_types.getUmesh()->renumberCells(da->begin(),false);
         }
     }
   else
@@ -1196,9 +1204,9 @@ int MEDFileUMeshSplitL1::getSize() const
 MEDCouplingUMesh *MEDFileUMeshSplitL1::getFamilyPart(const int *idsBg, const int *idsEnd, bool renum) const
 {
   MCAuto<DataArrayInt> eltsToKeep=_fam->findIdsEqualList(idsBg,idsEnd);
-  MEDCouplingUMesh *m=(MEDCouplingUMesh *)_m_by_types.getUmesh()->buildPartOfMySelf(eltsToKeep->getConstPointer(),eltsToKeep->getConstPointer()+eltsToKeep->getNumberOfTuples(),true);
+  MEDCouplingUMesh *m=(MEDCouplingUMesh *)_m_by_types.getUmesh()->buildPartOfMySelf(eltsToKeep->begin(),eltsToKeep->end(),true);
   if(renum)
-    return renumIfNeeded(m,eltsToKeep->getConstPointer());
+    return renumIfNeeded(m,eltsToKeep->begin());
   return m;
 }
 
@@ -1413,11 +1421,11 @@ MEDCouplingUMesh *MEDFileUMeshSplitL1::Renumber2(const DataArrayInt *renum, MEDC
   if(renum==0)
     return m;
   if(cellIds==0)
-    m->renumberCells(renum->getConstPointer(),true);
+    m->renumberCells(renum->begin(),true);
   else
     {
       MCAuto<DataArrayInt> locnum=renum->selectByTupleId(cellIds,cellIds+m->getNumberOfCells());
-      m->renumberCells(locnum->getConstPointer(),true);
+      m->renumberCells(locnum->begin(),true);
     }
   return m;
 }
@@ -1441,7 +1449,7 @@ DataArrayInt *MEDFileUMeshSplitL1::Renumber(const DataArrayInt *renum, const Dat
       da->incrRef();
       return const_cast<DataArrayInt *>(da);
     }
-  return renum->selectByTupleId(da->getConstPointer(),da->getConstPointer()+da->getNumberOfTuples());
+  return renum->selectByTupleId(da->begin(),da->end());
 }
 
 DataArrayInt *MEDFileUMeshSplitL1::renumIfNeededArr(const DataArrayInt *da) const
index a7616123319fb382797898b5e390352ff3d60544..abdef8f67632f6a17409a8853d2bb13401c794a3 100644 (file)
@@ -133,8 +133,9 @@ namespace MEDCoupling
     MCAuto<DataArrayDouble> getCoords() const { return _coords; }
     MCAuto<DataArrayInt> getCoordsFamily() const { return _fam_coords; }
     MCAuto<DataArrayInt> getCoordsNum() const { return _num_coords; }
+    MCAuto<DataArrayInt> getCoordsGlobalNum() const { return _global_num_coords; }
     MCAuto<DataArrayAsciiChar> getCoordsName() const { return _name_coords; }
-    static void WriteCoords(med_idt fid, const std::string& mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayInt *famCoords, const DataArrayInt *numCoords, const DataArrayAsciiChar *nameCoords);
+    static void WriteCoords(med_idt fid, const std::string& mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayInt *famCoords, const DataArrayInt *numCoords, const DataArrayAsciiChar *nameCoords, const DataArrayInt *globalNumCoords);
   private:
     void sortTypes();
   private:
@@ -142,6 +143,7 @@ namespace MEDCoupling
     MCAuto<DataArrayDouble> _coords;
     MCAuto<DataArrayInt> _fam_coords;
     MCAuto<DataArrayInt> _num_coords;
+    MCAuto<DataArrayInt> _global_num_coords;
     MCAuto<DataArrayAsciiChar> _name_coords;
   };
 
@@ -318,6 +320,7 @@ namespace MEDCoupling
     MEDFileUMeshAggregateCompute _m_by_types;
     MCAuto<DataArrayInt> _fam;
     MCAuto<DataArrayInt> _num;
+    MCAuto<DataArrayInt> _global_num;
     MCAuto<DataArrayAsciiChar> _names;
     mutable MCAuto<DataArrayInt> _rev_num;
     MEDFileUMeshPermCompute _m;
index 3a48c27313891a32513c1b16847577d89333e416..ab0655ef09d271e6cb3d3938f6d60006fb42f59c 100644 (file)
@@ -70,6 +70,11 @@ bool MEDFileMeshReadSelector::isNodeNumFieldReading() const
   return _code & 0x00000020;
 }
 
+bool MEDFileMeshReadSelector::isGlobalNodeNumFieldReading() const
+{
+  return _code & 0x00000040;
+}
+
 void MEDFileMeshReadSelector::setCellFamilyFieldReading(bool b)
 {
   unsigned int code(_code & 0xFFFFFFFE);
@@ -124,6 +129,15 @@ void MEDFileMeshReadSelector::setNodeNumFieldReading(bool b)
   _code=code;
 }
 
+void MEDFileMeshReadSelector::setGlobalNodeNumFieldReading(bool b)
+{
+  unsigned int code(_code & 0xFFFFFFBF);
+  unsigned int b2=b?1:0;
+  b2<<=6;
+  code+=b2;
+  _code=code;
+}
+
 void MEDFileMeshReadSelector::reprAll(std::ostream& str) const
 {
   str << "MEDFileMeshReadSelector (code=" << _code << ") : \n";
@@ -132,7 +146,8 @@ void MEDFileMeshReadSelector::reprAll(std::ostream& str) const
   str << "Read name field on cells : " << ReprStatus(isCellNameFieldReading()) << std::endl;
   str << "Read name field on nodes : " << ReprStatus(isNodeNameFieldReading()) << std::endl;
   str << "Read number field on cells : " << ReprStatus(isCellNumFieldReading()) << std::endl;
-  str << "Read number field name on nodes : " << ReprStatus(isNodeNumFieldReading());
+  str << "Read number field name on nodes : " << ReprStatus(isNodeNumFieldReading()) << std::endl;
+  str << "Read global number field name on nodes : " << ReprStatus(isGlobalNodeNumFieldReading());
 }
 
 std::string MEDFileMeshReadSelector::ReprStatus(bool v)
index 8d05643edcbae92261dcf3d58e84c8395f75aeba..35c61144d1289e46dbaab9617cb748cc94f718b6 100644 (file)
@@ -41,12 +41,14 @@ namespace MEDCoupling
     bool isNodeNameFieldReading() const;
     bool isCellNumFieldReading() const;
     bool isNodeNumFieldReading() const;
+    bool isGlobalNodeNumFieldReading() const;
     void setCellFamilyFieldReading(bool b);
     void setNodeFamilyFieldReading(bool b);
     void setCellNameFieldReading(bool b);
     void setNodeNameFieldReading(bool b);
     void setCellNumFieldReading(bool b);
     void setNodeNumFieldReading(bool b);
+    void setGlobalNodeNumFieldReading(bool b);
     void reprAll(std::ostream& str) const;
   private:
     static std::string ReprStatus(bool v);
index 03f246ac5d33883508f4f9c900063e61feec13d3..c9af424fb8c31d5fa92ff198859f7fb441b87286 100644 (file)
@@ -35,20 +35,37 @@ namespace MEDCoupling
   class MEDFileField1TS;
   class MEDFileIntFieldMultiTS;
   class MEDFileIntField1TS;
+  class MEDFileFloatFieldMultiTS;
+  class MEDFileFloatField1TS;
   class MEDFileField1TSWithoutSDA;
   class MEDFileIntField1TSWithoutSDA;
+  class MEDFileFloatField1TSWithoutSDA;
+  class MEDFileFieldMultiTSWithoutSDA;
+  class MEDFileIntFieldMultiTSWithoutSDA;
+  class MEDFileFloatFieldMultiTSWithoutSDA;
   
   template<>
   struct MEDLOADER_EXPORT MLFieldTraits<double>
   {
+    typedef MEDFileFieldMultiTSWithoutSDA FMTSWSDAType;
     typedef MEDFileFieldMultiTS FMTSType;
     typedef MEDFileField1TS F1TSType;
     typedef MEDFileField1TSWithoutSDA F1TSWSDAType;
   };
+
+  template<>
+  struct MEDLOADER_EXPORT MLFieldTraits<float>
+  {
+    typedef MEDFileFloatFieldMultiTSWithoutSDA FMTSWSDAType;
+    typedef MEDFileFloatFieldMultiTS FMTSType;
+    typedef MEDFileFloatField1TS F1TSType;
+    typedef MEDFileFloatField1TSWithoutSDA F1TSWSDAType;
+  };
   
   template<>
   struct MEDLOADER_EXPORT MLFieldTraits<int>
   {
+    typedef MEDFileIntFieldMultiTSWithoutSDA FMTSWSDAType;
     typedef MEDFileIntFieldMultiTS FMTSType;
     typedef MEDFileIntField1TS F1TSType;
     typedef MEDFileIntField1TSWithoutSDA F1TSWSDAType;
index 23ed7c7a618b6258bbd23c3503913d8e33aeb2fc..28ebf091fcbeb94f800653fe3b009bd881295f81 100644 (file)
@@ -28,6 +28,7 @@
 #include "NormalizedUnstructuredMesh.hxx"
 #include "MEDCouplingRefCountObject.hxx"
 #include "SauvUtilities.hxx"
+#include "MCType.hxx"
 
 #include <vector>
 #include <set>
index 27599a78a4d40727c6c45add6c10c83340295d68..acdc3160cde5bb133e4898707b3788af2c668595 100644 (file)
@@ -28,6 +28,7 @@
 #include "NormalizedUnstructuredMesh.hxx"
 #include "SauvUtilities.hxx"
 #include "MCAuto.hxx"
+#include "MCType.hxx"
 
 #include <vector>
 #include <string>
index 9b8e8fd84b3b7f7785883339f971d547e972deb6..f2d45aef9079cafff8e794b21c1b77be762de501 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
@@ -74,7 +78,10 @@ INSTALL(FILES MEDLoader.i MEDLoaderTypemaps.i MEDLoaderCommon.i DESTINATION ${ME
 
 SALOME_INSTALL_SCRIPTS(${CMAKE_CURRENT_BINARY_DIR}/MEDLoader.py ${MEDCOUPLING_INSTALL_PYTHON})
 
-INSTALL(FILES MEDLoaderDataForTest.py MEDLoaderTest1.py MEDLoaderTest2.py MEDLoaderTest3.py MEDLoaderTest123.py MEDLoaderTest4.py SauvLoaderTest.py MEDLoaderExamplesTest.py MEDLoaderCouplingTrainingSession.py CaseIO.py CaseReader.py CaseWriter.py VTKReader.py MEDLoaderSplitter.py medutilities.py DESTINATION ${MEDCOUPLING_INSTALL_SCRIPT_SCRIPTS})
+INSTALL(FILES MEDLoaderSplitter.py DESTINATION ${MEDCOUPLING_INSTALL_PYTHON})
+
+INSTALL(FILES MEDLoaderDataForTest.py MEDLoaderTest1.py MEDLoaderTest2.py MEDLoaderTest3.py MEDLoaderTest123.py MEDLoaderTest4.py SauvLoaderTest.py MEDLoaderExamplesTest.py MEDLoaderCouplingTrainingSession.py CaseIO.py CaseReader.py CaseWriter.py VTKReader.py medutilities.py DESTINATION ${MEDCOUPLING_INSTALL_SCRIPT_SCRIPTS})
+
 INSTALL(FILES med2sauv PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ DESTINATION ${MEDCOUPLING_INSTALL_BINS} )
 INSTALL(FILES sauv2med PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ DESTINATION ${MEDCOUPLING_INSTALL_BINS} )
 INSTALL(FILES case2med PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ DESTINATION ${MEDCOUPLING_INSTALL_BINS} )
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..90c5e0f9f754954d955393c64e8169e45be01093 100644 (file)
@@ -57,9 +57,30 @@ def MEDCouplingFieldDoubleIdiv(self,*args):
 def MEDCouplingFieldDoubleIpow(self,*args):
     import _MEDLoader
     return _MEDLoader.MEDCouplingFieldDouble____ipow___(self, self, *args)
+def MEDCouplingFieldIntnew(cls,*args):
+    import _MEDLoader
+    return _MEDLoader.MEDCouplingFieldInt____new___(cls,args)
+def MEDCouplingFieldFloatnew(cls,*args):
+    import _MEDLoader
+    return _MEDLoader.MEDCouplingFieldFloat____new___(cls,args)
 def MEDCouplingDataArrayBytenew(cls,*args):
     import _MEDLoader
     return _MEDLoader.DataArrayByte____new___(cls,args)
+def MEDCouplingDataArrayFloatnew(cls,*args):
+    import _MEDLoader
+    return _MEDLoader.DataArrayFloat____new___(cls,args)
+def MEDCouplingDataArrayFloatIadd(self,*args):
+    import _MEDLoader
+    return _MEDLoader.DataArrayFloat____iadd___(self, self, *args)
+def MEDCouplingDataArrayFloatIsub(self,*args):
+    import _MEDLoader
+    return _MEDLoader.DataArrayFloat____isub___(self, self, *args)
+def MEDCouplingDataArrayFloatImul(self,*args):
+    import _MEDLoader
+    return _MEDLoader.DataArrayFloat____imul___(self, self, *args)
+def MEDCouplingDataArrayFloatIdiv(self,*args):
+    import _MEDLoader
+    return _MEDLoader.DataArrayFloat____idiv___(self, self, *args)
 def MEDCouplingDataArrayIntnew(cls,*args):
     import _MEDLoader
     return _MEDLoader.DataArrayInt____new___(cls,args)
@@ -168,6 +189,12 @@ def MEDCouplingMEDFileIntField1TSnew(cls,*args):
 def MEDCouplingMEDFileIntFieldMultiTSnew(cls,*args):
     import _MEDLoader
     return _MEDLoader.MEDFileIntFieldMultiTS____new___(cls,args)
+def MEDCouplingMEDFileFloatField1TSnew(cls,*args):
+    import _MEDLoader
+    return _MEDLoader.MEDFileFloatField1TS____new___(cls,args)
+def MEDCouplingMEDFileFloatFieldMultiTSnew(cls,*args):
+    import _MEDLoader
+    return _MEDLoader.MEDFileFloatFieldMultiTS____new___(cls,args)
 def MEDCouplingMEDFileParametersnew(cls,*args):
     import _MEDLoader
     return _MEDLoader.MEDFileParameters____new___(cls,args)
@@ -175,6 +202,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
@@ -196,6 +229,10 @@ MEDFileIntField1TS.__new__=classmethod(MEDCouplingMEDFileIntField1TSnew)
 del MEDCouplingMEDFileIntField1TSnew
 MEDFileIntFieldMultiTS.__new__=classmethod(MEDCouplingMEDFileIntFieldMultiTSnew)
 del MEDCouplingMEDFileIntFieldMultiTSnew
+MEDFileFloatField1TS.__new__=classmethod(MEDCouplingMEDFileFloatField1TSnew)
+del MEDCouplingMEDFileFloatField1TSnew
+MEDFileFloatFieldMultiTS.__new__=classmethod(MEDCouplingMEDFileFloatFieldMultiTSnew)
+del MEDCouplingMEDFileFloatFieldMultiTSnew
 MEDFileParameters.__new__=classmethod(MEDCouplingMEDFileParametersnew)
 del MEDCouplingMEDFileParametersnew
 %}
index c205a3e7832ba82a0844c2538553f369afd22bce..11050bf8c674821d84702378b4e53722cb6af39e 100644 (file)
@@ -16,7 +16,7 @@
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-// Author : Anthony Geay (CEA/DEN)
+// Author : Anthony Geay (EDF R&D)
 
 %module MEDLoader
 
@@ -99,6 +99,7 @@ using namespace MEDCoupling;
 %newobject MEDCoupling::MEDFileMesh::getNodeGroupsArr;
 %newobject MEDCoupling::MEDFileMesh::getNodeFamilyArr;
 %newobject MEDCoupling::MEDFileMesh::getNodeFamiliesArr;
+%newobject MEDCoupling::MEDFileMesh::getGlobalNumFieldAtLevel;
 %newobject MEDCoupling::MEDFileMesh::getAllFamiliesIdsReferenced;
 %newobject MEDCoupling::MEDFileMesh::computeAllFamilyIdsInUse;
 %newobject MEDCoupling::MEDFileMesh::getEquivalences;
@@ -181,6 +182,7 @@ using namespace MEDCoupling;
 %newobject MEDCoupling::MEDFileFieldMultiTS::getFieldAtLevelOld;
 %newobject MEDCoupling::MEDFileFieldMultiTS::getUndergroundDataArray;
 %newobject MEDCoupling::MEDFileFieldMultiTS::convertToInt;
+
 %newobject MEDCoupling::MEDFileIntFieldMultiTS::New;
 %newobject MEDCoupling::MEDFileIntFieldMultiTS::field;
 %newobject MEDCoupling::MEDFileIntFieldMultiTS::LoadSpecificEntities;
@@ -191,6 +193,16 @@ using namespace MEDCoupling;
 %newobject MEDCoupling::MEDFileIntFieldMultiTS::getFieldOnMeshAtLevel;
 %newobject MEDCoupling::MEDFileIntFieldMultiTS::getFieldAtLevelOld;
 
+%newobject MEDCoupling::MEDFileFloatFieldMultiTS::New;
+%newobject MEDCoupling::MEDFileFloatFieldMultiTS::field;
+%newobject MEDCoupling::MEDFileFloatFieldMultiTS::LoadSpecificEntities;
+%newobject MEDCoupling::MEDFileFloatFieldMultiTS::getUndergroundDataArray;
+%newobject MEDCoupling::MEDFileFloatFieldMultiTS::convertToDouble;
+%newobject MEDCoupling::MEDFileFloatFieldMultiTS::getFieldAtLevel;
+%newobject MEDCoupling::MEDFileFloatFieldMultiTS::getFieldAtTopLevel;
+%newobject MEDCoupling::MEDFileFloatFieldMultiTS::getFieldOnMeshAtLevel;
+%newobject MEDCoupling::MEDFileFloatFieldMultiTS::getFieldAtLevelOld;
+
 %newobject MEDCoupling::MEDFileAnyTypeField1TS::New;
 %newobject MEDCoupling::MEDFileAnyTypeField1TS::NewAdv;
 %newobject MEDCoupling::MEDFileAnyTypeField1TS::shallowCpy;
@@ -214,6 +226,15 @@ using namespace MEDCoupling;
 %newobject MEDCoupling::MEDFileIntField1TS::getUndergroundDataArray;
 %newobject MEDCoupling::MEDFileIntField1TS::convertToDouble;
 
+%newobject MEDCoupling::MEDFileFloatField1TS::New;
+%newobject MEDCoupling::MEDFileFloatField1TS::field;
+%newobject MEDCoupling::MEDFileFloatField1TS::getFieldAtLevel;
+%newobject MEDCoupling::MEDFileFloatField1TS::getFieldAtTopLevel;
+%newobject MEDCoupling::MEDFileFloatField1TS::getFieldOnMeshAtLevel;
+%newobject MEDCoupling::MEDFileFloatField1TS::getFieldAtLevelOld;
+%newobject MEDCoupling::MEDFileFloatField1TS::getUndergroundDataArray;
+%newobject MEDCoupling::MEDFileFloatField1TS::convertToDouble;
+
 %newobject MEDCoupling::MEDFileData::New;
 %newobject MEDCoupling::MEDFileData::deepCopy;
 %newobject MEDCoupling::MEDFileData::getMeshes;
@@ -238,12 +259,17 @@ using namespace MEDCoupling;
 %newobject MEDCoupling::MEDFileJointCorrespondence::New;
 %newobject MEDCoupling::MEDFileJointCorrespondence::deepCopy;
 %newobject MEDCoupling::MEDFileJointCorrespondence::shallowCpy;
+%newobject MEDCoupling::MEDFileJointCorrespondence::getCorrespondence;
 %newobject MEDCoupling::MEDFileJointOneStep::New;
 %newobject MEDCoupling::MEDFileJointOneStep::deepCopy;
 %newobject MEDCoupling::MEDFileJointOneStep::shallowCpy;
+%newobject MEDCoupling::MEDFileJointOneStep::getCorrespondenceAtPos;
+%newobject MEDCoupling::MEDFileJointOneStep::__getitem__;
 %newobject MEDCoupling::MEDFileJoint::New;
 %newobject MEDCoupling::MEDFileJoint::deepCopy;
 %newobject MEDCoupling::MEDFileJoint::shallowCpy;
+%newobject MEDCoupling::MEDFileJoint::getStepAtPos;
+%newobject MEDCoupling::MEDFileJoint::__getitem__;
 %newobject MEDCoupling::MEDFileJoints::New;
 %newobject MEDCoupling::MEDFileJoints::deepCopy;
 %newobject MEDCoupling::MEDFileJoints::getJointAtPos;
@@ -279,9 +305,11 @@ using namespace MEDCoupling;
 %feature("unref") MEDFileAnyTypeField1TS "$this->decrRef();"
 %feature("unref") MEDFileField1TS "$this->decrRef();"
 %feature("unref") MEDFileIntField1TS "$this->decrRef();"
+%feature("unref") MEDFileFloatField1TS "$this->decrRef();"
 %feature("unref") MEDFileAnyTypeFieldMultiTS "$this->decrRef();"
 %feature("unref") MEDFileFieldMultiTS "$this->decrRef();"
 %feature("unref") MEDFileIntFieldMultiTS "$this->decrRef();"
+%feature("unref") MEDFileFloatFieldMultiTS "$this->decrRef();"
 %feature("unref") MEDFileMeshSupports "$this->decrRef();"
 %feature("unref") MEDFileStructureElements "$this->decrRef();"
 %feature("unref") MEDFileFields "$this->decrRef();"
@@ -628,12 +656,14 @@ namespace MEDCoupling
     bool isNodeNameFieldReading() const;
     bool isCellNumFieldReading() const;
     bool isNodeNumFieldReading() const;
+    bool isGlobalNodeNumFieldReading() const;
     void setCellFamilyFieldReading(bool b);
     void setNodeFamilyFieldReading(bool b);
     void setCellNameFieldReading(bool b);
     void setNodeNameFieldReading(bool b);
     void setCellNumFieldReading(bool b);
     void setNodeNumFieldReading(bool b);
+    void setGlobalNodeNumFieldReading(bool b);
     %extend
     {
       std::string __str__() const throw(INTERP_KERNEL::Exception)
@@ -672,7 +702,6 @@ namespace MEDCoupling
     void setRemoteGeometryType(INTERP_KERNEL::NormalizedCellType type);
     INTERP_KERNEL::NormalizedCellType getRemoteGeometryType() const;
     void setCorrespondence(DataArrayInt *corr) throw(INTERP_KERNEL::Exception);
-    const DataArrayInt *getCorrespondence() const throw(INTERP_KERNEL::Exception);
     void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName, int order, int iteration) const throw(INTERP_KERNEL::Exception);
     std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
     %extend
@@ -696,6 +725,14 @@ namespace MEDCoupling
       {
         return self->simpleRepr();
       }
+      
+      DataArrayInt *getCorrespondence() const throw(INTERP_KERNEL::Exception)
+      {
+        const DataArrayInt *ret(self->getCorrespondence());
+        if(ret)
+          ret->incrRef();
+        return const_cast<DataArrayInt *>(ret);
+      }
     }
   };
 
@@ -713,7 +750,6 @@ namespace MEDCoupling
     int getIteration() const;
     void pushCorrespondence(MEDFileJointCorrespondence* correspondence);
     int getNumberOfCorrespondences() const;
-    MEDFileJointCorrespondence *getCorrespondenceAtPos(int i) const;
     void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName) const throw(INTERP_KERNEL::Exception);
     std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
     %extend
@@ -732,6 +768,19 @@ namespace MEDCoupling
       {
         return self->simpleRepr();
       }
+      
+      MEDFileJointCorrespondence *getCorrespondenceAtPos(int i) const throw(INTERP_KERNEL::Exception)
+      {
+        MEDFileJointCorrespondence *ret(self->getCorrespondenceAtPos(i));
+        if(ret)
+          ret->incrRef();
+        return ret;
+      }
+
+      MEDFileJointCorrespondence *__getitem__(int i) const throw(INTERP_KERNEL::Exception)
+      {
+        return MEDCoupling_MEDFileJointOneStep_getCorrespondenceAtPos(self,i);
+      }
     }
   };
 
@@ -740,7 +789,7 @@ namespace MEDCoupling
   public:
     static MEDFileJoint *New() throw(INTERP_KERNEL::Exception);
     static MEDFileJoint *New(const std::string& fileName, const std::string& mName, int num) throw(INTERP_KERNEL::Exception);
-    static MEDFileJoint *New(const std::string& jointName, const std::string& locMeshName, const std::string& remoteMeshName, int remoteMeshNum ) throw(INTERP_KERNEL::Exception);
+    static MEDFileJoint *New(const std::string& jointName, const std::string& locMeshName, const std::string& remoteMeshName, int remoteMeshNum) throw(INTERP_KERNEL::Exception);
     MEDFileJoint *deepCopy() const;
     MEDFileJoint *shallowCpy() const;
     bool isEqual(const MEDFileJoint *other) const;
@@ -757,7 +806,6 @@ namespace MEDCoupling
     int getDomainNumber() const;
     void pushStep(MEDFileJointOneStep* step);
     int getNumberOfSteps() const;
-    MEDFileJointOneStep *getStepAtPos(int i) const;
     std::string simpleRepr() const;
     %extend
     {
@@ -771,10 +819,28 @@ namespace MEDCoupling
         return MEDFileJoint::New(fileName,mName,num);
       }
 
+      MEDFileJoint(const std::string& jointName, const std::string& locMeshName, const std::string& remoteMeshName, int remoteMeshNum) throw(INTERP_KERNEL::Exception)
+      {
+        return MEDFileJoint::New(jointName,locMeshName,remoteMeshName,remoteMeshNum);
+      }
+
       std::string __str__() const throw(INTERP_KERNEL::Exception)
       {
         return self->simpleRepr();
       }
+      
+      MEDFileJointOneStep *getStepAtPos(int i) const throw(INTERP_KERNEL::Exception)
+      {
+        MEDFileJointOneStep *ret(self->getStepAtPos(i));
+        if(ret)
+          ret->incrRef();
+        return ret;
+      }
+
+      MEDFileJointOneStep *__getitem__(int i) throw(INTERP_KERNEL::Exception)
+      {
+        return MEDCoupling_MEDFileJoint_getStepAtPos(self,i);
+      }
     }
   };
 
@@ -812,6 +878,7 @@ namespace MEDCoupling
 
       MEDFileJoint *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
       {
+        static const char msg[]="MEDFileJoints::__getitem__ : only integer or string with meshname supported !";
         if(PyInt_Check(obj))
           {
             MEDFileJoint *ret=self->getJointAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfJoints()));
@@ -819,15 +886,10 @@ namespace MEDCoupling
               ret->incrRef();
             return ret;
           }
-        else if(PyString_Check(obj))
-          {
-            MEDFileJoint *ret=self->getJointWithName(PyString_AsString(obj));
-            if(ret)
-              ret->incrRef();
-            return ret;
-          }
-        else
-          throw INTERP_KERNEL::Exception("MEDFileJoints::__getitem__ : only integer or string with meshname supported !");
+        MEDFileJoint *ret(self->getJointWithName(convertPyObjectToStr(obj,msg)));
+        if(ret)
+          ret->incrRef();
+        return ret;
       }
 
       int __len__() const throw(INTERP_KERNEL::Exception)
@@ -1106,6 +1168,7 @@ namespace MEDCoupling
     virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception);
     virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) throw(INTERP_KERNEL::Exception);
     virtual void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr) throw(INTERP_KERNEL::Exception);
+    virtual void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayInt *globalNumArr) throw(INTERP_KERNEL::Exception);
     virtual void addNodeGroup(const DataArrayInt *ids) throw(INTERP_KERNEL::Exception);
     virtual void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) throw(INTERP_KERNEL::Exception);
     virtual DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
@@ -1299,6 +1362,12 @@ namespace MEDCoupling
            if(ret) ret->incrRef();
            return ret;
          }
+
+         virtual DataArrayInt *getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
+         {
+           MCAuto<DataArrayInt> ret(self->getGlobalNumFieldAtLevel(meshDimRelToMaxExt));
+           return ret.retn();
+         }
        }
   };
 
@@ -1823,22 +1892,18 @@ namespace MEDCoupling
 
          MEDFileMesh *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
          {
-           if(PyInt_Check(obj))
+           static const char msg[]="MEDFileMeshes::__getitem__ : only integer or string with meshname supported !";
+             if(PyInt_Check(obj))
              {
                MEDFileMesh *ret=self->getMeshAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfMeshes()));
                if(ret)
                  ret->incrRef();
                return ret;
              }
-           else if(PyString_Check(obj))
-             {
-               MEDFileMesh *ret=self->getMeshWithName(PyString_AsString(obj));
-               if(ret)
-                 ret->incrRef();
-               return ret;
-             }
-           else
-             throw INTERP_KERNEL::Exception("MEDFileMeshes::__getitem__ : only integer or string with meshname supported !");
+           MEDFileMesh *ret(self->getMeshWithName(convertPyObjectToStr(obj,msg)));
+           if(ret)
+             ret->incrRef();
+           return ret;
          }
 
          MEDFileMeshes *__setitem__(int obj, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception)
@@ -2422,6 +2487,82 @@ namespace MEDCoupling
     }
   };
 
+  class MEDFileFloatField1TS : public MEDFileAnyTypeField1TS
+  {
+  public:
+    static MEDFileFloatField1TS *New();
+    static MEDFileFloatField1TS *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+    static MEDFileFloatField1TS *New(DataArrayByte *db) throw(INTERP_KERNEL::Exception);
+    static MEDFileFloatField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+    static MEDFileFloatField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+    MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
+    //
+    void setFieldNoProfileSBT(const MEDCouplingFieldFloat *field) throw(INTERP_KERNEL::Exception);
+    void setFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldFloat *field(const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldFloat *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldFloat *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldFloat *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+    %extend
+    {
+      MEDFileFloatField1TS() throw(INTERP_KERNEL::Exception)
+      {
+        return MEDFileFloatField1TS::New();
+      }
+
+      MEDFileFloatField1TS(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
+      {
+        return MEDFileFloatField1TS::New(fileName,loadAll);
+      }
+
+      MEDFileFloatField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
+      {
+        return MEDFileFloatField1TS::New(fileName,fieldName,loadAll);
+      }
+
+      MEDFileFloatField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception)
+      {
+        return MEDFileFloatField1TS::New(fileName,fieldName,iteration,order,loadAll);
+      }
+
+      MEDFileFloatField1TS(DataArrayByte *db) throw(INTERP_KERNEL::Exception)
+      {
+        return MEDFileFloatField1TS::New(db);
+      }
+
+      // serialization
+      static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
+      {
+        return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"MEDFileFloatField1TS");
+      }
+
+      std::string __str__() const throw(INTERP_KERNEL::Exception)
+      {
+        return self->simpleRepr();
+      }
+
+      PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
+      {
+         DataArrayInt *ret1=0;
+         DataArrayFloat *ret0=self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1);
+         PyObject *ret=PyTuple_New(2);
+         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayFloat, SWIG_POINTER_OWN | 0 ));
+         return ret;
+      }
+      
+      DataArrayFloat *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
+      {
+        DataArrayFloat *ret=self->getUndergroundDataArray();
+        if(ret)
+          ret->incrRef();
+        return ret;
+      }
+    }
+  };
+
   class MEDFileAnyTypeFieldMultiTSIterator
   {
   public:
@@ -2622,8 +2763,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
@@ -2641,7 +2781,7 @@ namespace MEDCoupling
         std::vector<int> pos2;
         DataArrayInt *pos3=0;
         DataArrayIntTuple *pos4=0;
-        convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
+        convertIntStarLikePyObjToCpp(li,sw,pos1,pos2,pos3,pos4);
         switch(sw)
           {
           case 1:
@@ -2688,8 +2828,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
@@ -2812,6 +2951,8 @@ namespace MEDCoupling
     }
   };
 
+  class MEDFileIntFieldMultiTS;
+  
   class MEDFileFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
   {
   public:
@@ -2825,11 +2966,11 @@ namespace MEDCoupling
     MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception);
     MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
     MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
-    MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
     //
     void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
     void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
-    MEDCoupling::MEDFileIntFieldMultiTS *convertToInt(bool isDeepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
+    MEDFileIntFieldMultiTS *convertToInt(bool isDeepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
     %extend
        {
          MEDFileFieldMultiTS()
@@ -3023,13 +3164,7 @@ namespace MEDCoupling
       static MEDFileIntFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
       {
         std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
-        std::size_t sz(tmp.size());
-        std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(sz);
-        for(std::size_t i=0;i<sz;i++)
-          {
-            entitiesCpp[i].first=(TypeOfField)tmp[i].first;
-            entitiesCpp[i].second=(INTERP_KERNEL::NormalizedCellType)tmp[i].second;
-          }
+        std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(convertVecPairIntToVecPairTOFCT(tmp));
         return MEDFileIntFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
       }
 
@@ -3057,6 +3192,83 @@ namespace MEDCoupling
       }
     }
   };
+
+  class MEDFileFloatFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
+  {
+  public:
+    static MEDFileFloatFieldMultiTS *New();
+    static MEDFileFloatFieldMultiTS *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+    static MEDFileFloatFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+    static MEDFileFloatFieldMultiTS *New(DataArrayByte *db) throw(INTERP_KERNEL::Exception);
+    //
+    void appendFieldNoProfileSBT(const MEDCouplingFieldFloat *field) throw(INTERP_KERNEL::Exception);
+    void appendFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
+    MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldDouble *field(int iteration, int order, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldFloat *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldFloat *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldFloat *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+    %extend
+    {
+      MEDFileFloatFieldMultiTS()
+      {
+        return MEDFileFloatFieldMultiTS::New();
+      }
+      
+      MEDFileFloatFieldMultiTS(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
+      {
+        return MEDFileFloatFieldMultiTS::New(fileName,loadAll);
+      }
+      
+      MEDFileFloatFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
+      {
+        return MEDFileFloatFieldMultiTS::New(fileName,fieldName,loadAll);
+      }
+
+      MEDFileFloatFieldMultiTS(DataArrayByte *db) throw(INTERP_KERNEL::Exception)
+      {
+        return MEDFileFloatFieldMultiTS::New(db);
+      }
+      
+      // serialization
+      static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
+      {
+        return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"MEDFileFloatFieldMultiTS");
+      }
+      
+      static MEDFileFloatFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
+      {
+        std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
+        std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(convertVecPairIntToVecPairTOFCT(tmp));
+        return MEDFileFloatFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
+      }
+
+      std::string __str__() const throw(INTERP_KERNEL::Exception)
+      {
+        return self->simpleRepr();
+      }
+
+      PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
+      {
+         DataArrayInt *ret1=0;
+         DataArrayFloat *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
+         PyObject *ret=PyTuple_New(2);
+         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayFloat, SWIG_POINTER_OWN | 0 ));
+         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+         return ret;
+      }
+
+      DataArrayFloat *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
+      {
+        DataArrayFloat *ret=self->getUndergroundDataArray(iteration,order);
+        if(ret)
+          ret->incrRef();
+        return ret;
+      }
+    }
+  };
   
   class MEDFileMeshSupports : public RefCountObject, public MEDFileWritableStandAlone
   {
@@ -3257,14 +3469,14 @@ namespace MEDCoupling
 
          int getPosOfField(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
          {
-           if(elt0 && PyInt_Check(elt0))
+           static const char msg[]="MEDFileFields::getPosOfField : invalid input params ! expected fields[int], fields[string_of_field_name] !";
+           if(!elt0)
+             throw INTERP_KERNEL::Exception(msg);
+           if(PyInt_Check(elt0))
              {//fmts[3]
                return PyInt_AS_LONG(elt0);
              }
-           else if(elt0 && PyString_Check(elt0))
-             return self->getPosFromFieldName(PyString_AsString(elt0));
-           else
-             throw INTERP_KERNEL::Exception("MEDFileFields::getPosOfField : invalid input params ! expected fields[int], fields[string_of_field_name] !");
+           return self->getPosFromFieldName(convertPyObjectToStr(elt0,msg));
          }
          
          std::vector<int> getPosOfFields(PyObject *elts) const throw(INTERP_KERNEL::Exception)
@@ -3300,8 +3512,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
@@ -3468,7 +3679,7 @@ namespace MEDCoupling
         std::vector<int> pos2;
         DataArrayInt *pos3=0;
         DataArrayIntTuple *pos4=0;
-        convertObjToPossibleCpp1(ids,sw,pos1,pos2,pos3,pos4);
+        convertIntStarLikePyObjToCpp(ids,sw,pos1,pos2,pos3,pos4);
         switch(sw)
           {
           case 1:
@@ -3650,6 +3861,7 @@ namespace MEDCoupling
 
       MEDFileParameterMultiTS *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
       {
+        static const char msg[]="MEDFileParameters::__getitem__ : only integer or string with meshname supported !";
         if(PyInt_Check(obj))
           {
             MEDFileParameterMultiTS *ret=self->getParamAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfParams()));
@@ -3657,15 +3869,10 @@ namespace MEDCoupling
               ret->incrRef();
             return ret;
           }
-        else if(PyString_Check(obj))
-          {
-            MEDFileParameterMultiTS *ret=self->getParamWithName(PyString_AsString(obj));
-            if(ret)
-              ret->incrRef();
-            return ret;
-          }
-        else
-          throw INTERP_KERNEL::Exception("MEDFileParameters::__getitem__ : only integer or string with meshname supported !");
+        MEDFileParameterMultiTS *ret(self->getParamWithName(convertPyObjectToStr(obj,msg)));
+        if(ret)
+          ret->incrRef();
+        return ret;
       }
 
       int __len__() const throw(INTERP_KERNEL::Exception)
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..45a35e9419598775a8667ff9dee7cb39cd55e126 100644 (file)
@@ -17,7 +17,7 @@
 #
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
-# Author : Anthony Geay (CEA/DEN)
+# Author : Anthony Geay (EDF R&D)
 
 from MEDLoader import *
 from math import pi,e,sqrt
@@ -242,12 +242,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 +256,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 +265,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 +437,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 +486,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 +536,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 +553,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..dafdcd09ab8e1a7f4694185f0b273be904a107dd 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=[f1ts.__class__() 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=[fmts.__class__() 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..4dce1b328aac0317ea9fa7ab97458e241e473a7a 100644 (file)
@@ -17,7 +17,7 @@
 #
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
-# Author : Anthony Geay (CEA/DEN)
+# Author : Anthony Geay (EDF R&D)
 
 from MEDLoader import *
 import unittest
@@ -26,6 +26,12 @@ from math import pi,e,sqrt
 from MEDLoaderDataForTest import MEDLoaderDataForTest
 from distutils.version import LooseVersion
 
+import sys
+if sys.version_info.major < 3:
+    import cPickle as pickle
+else:
+    import pickle
+
 class MEDLoaderTest3(unittest.TestCase):
     def testMEDMesh1(self):
         fileName="Pyfile18.med"
@@ -133,7 +139,7 @@ class MEDLoaderTest3(unittest.TestCase):
         g1_2=DataArrayInt.New()
         g1_2.setValues([1,3],2,1)
         g1_2.setName("G1")
-        g2_2=DataArrayInt.New()
+        g2_2=DataArrayInt.New()getCellsContainingPoint
         g2_2.setValues([1,2,3],3,1)
         g2_2.setName("G2")
         mm.setGroupsAtLevel(0,[g1_2,g2_2],False)
@@ -145,10 +151,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 +173,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 +308,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 +388,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 +819,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 +846,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 +893,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 +1179,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 +1197,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 +1216,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 +1233,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 +1650,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 +1691,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 +1815,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 +1905,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 +2072,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 +2149,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 +2280,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 +2310,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 +2319,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 +2551,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())
@@ -2624,7 +2630,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 +2641,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 +2700,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 +2734,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 +2749,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 +2812,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 +2831,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 +2858,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 +2877,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 +2897,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 +2926,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 +2946,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 +3048,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 +3084,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, 540 + 2 * strMulFac)))
         ff0.loadArrays() ##
         arr=DataArrayDouble(140) ; arr.iota() ; arr.rearrange(2)
         self.assertTrue(ff0.getUndergroundDataArray().isEqualWithoutConsideringStr(arr,1e-14))
@@ -3087,7 +3093,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, 600 + 6 * strMulFac)))
         ff0.loadArrays() ##
         arr=DataArrayDouble(100) ; arr.iota() ; arr.rearrange(2)
         self.assertTrue(ff0.getUndergroundDataArray().isEqualWithoutConsideringStr(arr,1e-14))
@@ -3105,7 +3111,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, 1400 + 2 * strMulFac)))
         ff0.unloadArrays()
         hmd=ff0.getHeapMemorySize()-heap_memory_ref
         self.assertEqual(hmd,-800) # -50*8*2
@@ -3114,14 +3120,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, 620 + 6 * 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 +3137,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, 9212 + (80 + 26 + 1) * strMulFac)))
         ff0.loadArrays()
         self.assertEqual(ff0.getHeapMemorySize()-heap_memory_ref,20*70*8*2)
         del ff0
         #
         ffs=MEDFileFields(fname,False)
         heap_memory_ref=ffs.getHeapMemorySize()
-        self.assertIn(heap_memory_ref,xrange(5335,9031+(80+50+24+len(ffs))*strMulFac))
+        self.assertIn(heap_memory_ref, list(range(5335, 10031 + (80 + 50 + len(ffs)) * strMulFac)))
         ffs.loadArrays()
         self.assertEqual(ffs.getHeapMemorySize()-heap_memory_ref,20*70*8*2+70*8*2+50*8*2)
         pass
@@ -3310,13 +3316,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 +3431,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 +3515,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 +3523,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 +3533,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 +3758,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 +3827,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 +3838,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 +3906,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 +3931,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 +3971,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 +4103,6 @@ class MEDLoaderTest3(unittest.TestCase):
 
     @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
     def testMEDFileUMeshPickeling1(self):
-        import cPickle
         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 +4164,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 +4187,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 +4213,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 +4231,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 +4261,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 +4282,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 +4335,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):
@@ -4673,6 +4678,9 @@ class MEDLoaderTest3(unittest.TestCase):
             def __del__(self):
                 import os,sys
                 sys.stderr=self.origPyVal
+                if sys.version_info.major >= 3:
+                    self.fdOfSinkFile.close()
+                    pass
                 #os.fsync(self.fdOfSinkFile)
                 os.fsync(2)
                 os.dup2(self.stdoutOld,2)
@@ -4691,7 +4699,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")
@@ -4726,7 +4734,7 @@ class MEDLoaderTest3(unittest.TestCase):
         mm=MEDFileCMesh(fname)
         self.assertTrue(mm.getUnivName()!="")
         pass
-
+    
     def testEmptyMesh(self):
       """ MEDLoader should be able to consistently write and read an empty mesh (coords array
       with 0 tuples """
@@ -4760,11 +4768,10 @@ 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)
+      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
 
@@ -5792,7 +5799,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 +5842,8 @@ 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)
+        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 +5852,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 +5879,16 @@ 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)
+        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,26 +5896,98 @@ 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
+
+    def testGlobalNumOnNodes1(self):
+        """Test global number on nodes here. Used by partitionners."""
+        fname="Pyfile112.med"
+        arr=DataArrayDouble(5) ; arr.iota()
+        m=MEDCouplingUMesh.Build1DMeshFromCoords(arr)
+        m.setName("mesh")
+        mm=MEDFileUMesh()
+        mm[0]=m
+        self.assertTrue(not mm.getGlobalNumFieldAtLevel(1))
+        d=DataArrayInt([7,8,9,2,0])
+        dRef=d.deepCopy()
+        mm.setGlobalNumFieldAtLevel(1,d)
+        mm.checkConsistency()
+        self.assertRaises(InterpKernelException,mm.setGlobalNumFieldAtLevel,1,d[::2])
+        mm.checkConsistency()
+        self.assertEqual(d.getHiddenCppPointer(),mm.getGlobalNumFieldAtLevel(1).getHiddenCppPointer())
+        self.assertTrue(mm.getGlobalNumFieldAtLevel(1).isEqual(dRef))
+        mm.write(fname,2)
+        mm2=MEDFileMesh.New(fname)
+        self.assertTrue(mm.isEqual(mm2,1e-12)[0])
+        self.assertTrue(mm2.getGlobalNumFieldAtLevel(1).isEqual(dRef))
+        mm2.getGlobalNumFieldAtLevel(1).setIJ(0,0,10)
+        self.assertTrue(not mm.isEqual(mm2,1e-12)[0])
+        mm2.getGlobalNumFieldAtLevel(1).setIJ(0,0,7)
+        self.assertTrue(mm.isEqual(mm2,1e-12)[0])
+        pass
+
+    def testPartialReadOfEntities1(self):
+        """Test for advanced API on read to speed up read phase for users with "huge" number of time steps (more than 10 000)."""
+        fname="Pyfile113.med"
+        arr=DataArrayDouble(5) ; arr.iota()
+        m=MEDCouplingUMesh.Build1DMeshFromCoords(arr)
+        m.setName("mesh")
+        mm=MEDFileUMesh()
+        mm[0]=m
+        #
+        fieldName="Field"
+        ts1=(5.,1,2)
+        f1=MEDCouplingFieldDouble(ON_NODES) ; f1.setMesh(m) ; f1.setName(fieldName)
+        f1.setArray(DataArrayDouble([0.,0.1,0.2,0.3,0.4]))
+        f1.setTime(*ts1)
+        f2=MEDCouplingFieldDouble(ON_CELLS) ; f2.setMesh(m) ; f2.setName(fieldName)
+        f2.setArray(DataArrayDouble([1.,1.1,1.2,1.3]))
+        f2.setTime(*ts1)
+        f1ts=MEDFileField1TS()
+        f1ts.setFieldNoProfileSBT(f1)
+        f1ts.setFieldNoProfileSBT(f2)
+        self.assertEqual(set(f1ts.getTypesOfFieldAvailable()),set([ON_NODES,ON_CELLS]))
+        f1ts_2=f1ts.deepCopy()
+        f1ts_2.getUndergroundDataArray()[:]+=2
+        f1ts_2.setTime(3,4,6.)
+        fmts=MEDFileFieldMultiTS()
+        fmts.pushBackTimeStep(f1ts)
+        fmts.pushBackTimeStep(f1ts_2)
+        #
+        mm.write(fname,2)
+        fmts.write(fname,0)
+        #
+        ent=MEDFileEntities.BuildFrom([(ON_NODES,NORM_ERROR)])
+        mm=MEDFileMesh.New(fname)
+        fs=MEDFileFields(fname,False,ent) # the important line is here - We specify to MEDFileFields to read only nodes part to speed up read phase (by avoiding to scan all entities time geo types)
+        fs.loadArrays()
+        self.assertEqual(len(fs),1)
+        fmts=fs[0]
+        self.assertEqual(len(fmts),2)
+        ff0=fmts[0] ; ff1=fmts[1]
+        self.assertEqual(ff0.getTypesOfFieldAvailable(),[ON_NODES]) # only NODES have been loaded
+        self.assertTrue(ff0.field(mm).isEqual(f1,1e-12,1e-12))
+        f3=f1.deepCopy() ; f3+=2. ; f3.setTime(6.,3,4)
+        self.assertTrue(ff1.field(mm).isEqual(f3,1e-12,1e-12))
+        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..f4991ea08b823a39d34b691ec7acf1b6a6f97cb7 100644 (file)
@@ -68,6 +68,8 @@ static PyObject *convertMEDFileField1TS(MEDCoupling::MEDFileAnyTypeField1TS *p,
     ret=SWIG_NewPointerObj((void*)p,SWIGTYPE_p_MEDCoupling__MEDFileField1TS,owner);
   if(dynamic_cast<MEDFileIntField1TS *>(p))
     ret=SWIG_NewPointerObj((void*)p,SWIGTYPE_p_MEDCoupling__MEDFileIntField1TS,owner);
+  if(dynamic_cast<MEDFileFloatField1TS *>(p))
+    ret=SWIG_NewPointerObj((void*)p,SWIGTYPE_p_MEDCoupling__MEDFileFloatField1TS,owner);
   if(!ret)
     throw INTERP_KERNEL::Exception("Not recognized type of MEDFileAnyTypeField1TS on downcast !");
   return ret;
@@ -85,6 +87,8 @@ static PyObject *convertMEDFileFieldMultiTS(MEDCoupling::MEDFileAnyTypeFieldMult
     ret=SWIG_NewPointerObj((void*)p,SWIGTYPE_p_MEDCoupling__MEDFileFieldMultiTS,owner);
   if(dynamic_cast<MEDFileIntFieldMultiTS *>(p))
     ret=SWIG_NewPointerObj((void*)p,SWIGTYPE_p_MEDCoupling__MEDFileIntFieldMultiTS,owner);
+  if(dynamic_cast<MEDFileFloatFieldMultiTS *>(p))
+    ret=SWIG_NewPointerObj((void*)p,SWIGTYPE_p_MEDCoupling__MEDFileFloatFieldMultiTS,owner);
   if(!ret)
     throw INTERP_KERNEL::Exception("Not recognized type of MEDFileAnyTypeFieldMultiTS on downcast !");
   return ret;
@@ -146,8 +150,23 @@ static std::vector<std::pair<int,int> > convertTimePairIdsFromPy(PyObject *pyLi)
   return ret;
 }
 
+static std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > convertVecPairIntToVecPairTOFCT(const std::vector<std::pair<int,int> >& tmp)
+{
+  std::size_t sz(tmp.size());
+  std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(sz);
+  for(std::size_t i=0;i<sz;i++)
+    {
+      entitiesCpp[i].first=(TypeOfField)tmp[i].first;
+      entitiesCpp[i].second=(INTERP_KERNEL::NormalizedCellType)tmp[i].second;
+    }
+  return entitiesCpp;
+}
+
 static void converPyListToVecString(PyObject *pyLi, std::vector<std::string>& v)
 {
+  static const char msg0[]="In list passed in argument some elements are NOT strings ! Expected a list containing only strings !";
+  static const char msg1[]="In tuple passed in argument some elements are NOT strings ! Expected a list containing only strings !";
+  static const char msg2[]="Unrecognized python argument : expected a list of string or tuple of string or string !";
   if(PyList_Check(pyLi))
     {
       int size=PyList_Size(pyLi);
@@ -155,11 +174,9 @@ 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))
-            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);
+          v[i]=convertPyObjectToStr(o,msg0);
         }
+      return ;
     }
   else if(PyTuple_Check(pyLi))
     {
@@ -168,21 +185,12 @@ 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))
-            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);
+          v[i]=convertPyObjectToStr(o,msg1);
         }
+      return ;
     }
-  else if(PyString_Check(pyLi))
-    {
-      v.resize(1);
-      v[0]=std::string((const char *)PyString_AsString(pyLi));
-    }
-  else
-    {
-      throw INTERP_KERNEL::Exception("Unrecognized python argument : expected a list of string or tuple of string or string !");
-    }
+  v.resize(1);
+  v[0]=convertPyObjectToStr(pyLi,msg2);
 }
 
 static PyObject *convertFieldDoubleVecToPy(const std::vector<MEDCoupling::MEDCouplingFieldDouble *>& li)
@@ -261,15 +269,9 @@ std::vector< std::pair<std::string, std::string > > convertVecPairStStFromPy(PyO
               if(size2!=2)
                 throw INTERP_KERNEL::Exception(msg);
               PyObject *o0=PyTuple_GetItem(o,0);
-              if(PyString_Check(o0))
-                p.first=std::string(PyString_AsString(o0));
-              else
-                throw INTERP_KERNEL::Exception(msg);
+              p.first=convertPyObjectToStr(o0,msg);
               PyObject *o1=PyTuple_GetItem(o,1);
-              if(PyString_Check(o1))
-                p.second=std::string(PyString_AsString(o1));
-              else
-                throw INTERP_KERNEL::Exception(msg);
+              p.second=convertPyObjectToStr(o1,msg);
               ret[i]=p;
             }
           else
@@ -305,21 +307,13 @@ std::vector< std::pair<std::vector<std::string>, std::string > > convertVecPairV
                   for(int j=0;j<size3;j++)
                     {
                       PyObject *o0j=PyList_GetItem(o0,j);
-                      if(PyString_Check(o0j))
-                        {
-                          p.first[j]=std::string(PyString_AsString(o0j));
-                        }
-                      else
-                        throw INTERP_KERNEL::Exception(msg);
+                      p.first[j]=convertPyObjectToStr(o0j,msg);
                     }
                 }
               else
                 throw INTERP_KERNEL::Exception(msg);
               PyObject *o1=PyTuple_GetItem(o,1);
-              if(PyString_Check(o1))
-                p.second=std::string(PyString_AsString(o1));
-              else
-                throw INTERP_KERNEL::Exception(msg);
+              p.second=convertPyObjectToStr(o1,msg);
               ret[i]=p;
             }
           else
@@ -373,16 +367,12 @@ int MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(const MEDFileAnyTypeFieldMultiTS
  */
 int MEDFileFieldsgetitemSingleTS__(const MEDFileFields *self, PyObject *obj) throw(INTERP_KERNEL::Exception)
 {
+  static const char msg[]="MEDFileFields::__getitem__ : only integer or string with fieldname supported !";
   if(PyInt_Check(obj))
     {
       return InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfFields());
     }
-  else if(PyString_Check(obj))
-    {
-      return self->getPosFromFieldName(PyString_AsString(obj));
-    }
-  else
-    throw INTERP_KERNEL::Exception("MEDFileFields::__getitem__ : only integer or string with fieldname supported !");
+  return self->getPosFromFieldName(convertPyObjectToStr(obj,msg));
 }
 
 void convertToMapIntDataArrayInt(PyObject *pyMap, std::map<int, MCAuto<DataArrayInt> >& cppMap)
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 0a4335f523e856f8b30810d02c8e1f5b857a60a5..cef92de34f0fd0334c8df7fbc1f82a3b54209c4d 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
@@ -58,7 +62,7 @@ ENDIF(WIN32)
 INSTALL(TARGETS ${SWIG_MODULE_MEDPartitioner_REAL_NAME} DESTINATION ${MEDCOUPLING_INSTALL_PYTHON})
 
 SET(PYFILES_TO_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/MEDPartitioner.py)
-SALOME_INSTALL_SCRIPTS("${PYFILES_TO_INSTALL}" ${MEDCOUPLING_INSTALL_SCRIPT_PYTHON})
+SALOME_INSTALL_SCRIPTS("${PYFILES_TO_INSTALL}" ${MEDCOUPLING_INSTALL_PYTHON})
 
 INSTALL(FILES MEDPartitioner.i MEDPartitionerCommon.i DESTINATION ${MEDCOUPLING_INSTALL_HEADERS})
 INSTALL(FILES MEDPartitionerTest.py DESTINATION ${MEDCOUPLING_INSTALL_SCRIPT_PYTHON})
index 3f73621dbd7d590fdbd9597b5e57ffcea70839aa..350ac7555c4898f2ff5e6693b41c46cdbfefba4e 100644 (file)
@@ -38,6 +38,8 @@ using namespace MEDPARTITIONER;
 
 %newobject MEDPARTITIONER::MEDPartitioner::New;
 %newobject MEDPARTITIONER::MEDPartitioner::Graph;
+%newobject MEDPARTITIONER::MEDPartitioner::Graph::getGraph;
+%newobject MEDPARTITIONER::MEDPartitioner::Graph::getPartition;
 %newobject MEDPARTITIONER::MEDPartitioner::getMEDFileData;
 %feature("unref") MEDCoupling::MEDFileData "$this->decrRef();"
 
@@ -49,10 +51,24 @@ namespace MEDPARTITIONER
 {
   class Graph
   {
+  public:
+    typedef enum {METIS,SCOTCH} splitter_type;
   public:
     virtual void partGraph(int ndomain, const std::string& options_string="", ParaDomainSelector *sel=0) throw(INTERP_KERNEL::Exception);
-    const MEDCoupling::MEDCouplingSkyLineArray *getGraph() const;
-    const MEDCoupling::MEDCouplingSkyLineArray *getPartition() const;
+    MEDCoupling::MEDCouplingSkyLineArray *getGraph() const
+    {
+      const MEDCoupling::MEDCouplingSkyLineArray *ret(self->getGraph());
+      if(ret)
+        ret->incrRef();
+      return const_cast<MEDCoupling::MEDCouplingSkyLineArray *>(ret);
+    }
+    const MEDCoupling::MEDCouplingSkyLineArray *getPartition() const
+    {
+      const MEDCoupling::MEDCouplingSkyLineArray *ret(self->getPartition());
+      if(ret)
+        ret->incrRef();
+      return const_cast<MEDCoupling::MEDCouplingSkyLineArray *>(ret);
+    }
     int nbVertices() const;
   };
 
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 63fbafdcf3af37865fb55c38e81dfd111d61ffc9..4e867ae6d277d38fbd557291b4b3edf4984f9ec7 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
@@ -56,9 +60,6 @@ SWIG_ADD_MODULE(ParaMEDMEM python ParaMEDMEM.i)
 SWIG_LINK_LIBRARIES(ParaMEDMEM ${PYTHON_LIBRARIES} paramedmem medloader)
 SWIG_CHECK_GENERATION(ParaMEDMEM)
 
-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 5db9d2ad31fb28e8100f799f9a508735de0eb1d3..2654193c8001fea753e350505b583df15e4e559b 100644 (file)
 
 #ifndef RENUMBERING_HXX_
 #define RENUMBERING_HXX_
+
 #include "RENUMBERDefines.hxx"
+#include "MCType.hxx"
+
 #include <vector>
 
 namespace MEDCoupling
index 28051051d52c24716103f918a05528c307b4e1e3..8bdb4a46b5d4e161863c518dda9fbd4a79ce9ba4 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 7839e527679b526a245475451f9b3bdd447c259f..82667ea270ac7bfea828e4116de28e4be6dbaba5 100644 (file)
@@ -62,6 +62,21 @@ def MEDCouplingDataArrayIntIpow(self,*args):
 def MEDCouplingDataArrayBytenew(cls,*args):
     import _MEDRenumber
     return _MEDRenumber.DataArrayByte____new___(cls,args)
+def MEDCouplingDataArrayFloatnew(cls,*args):
+    import _MEDRenumber
+    return _MEDRenumber.DataArrayFloat____new___(cls,args)
+def MEDCouplingDataArrayFloatIadd(self,*args):
+    import _MEDRenumber
+    return _MEDRenumber.DataArrayFloat____iadd___(self, self, *args)
+def MEDCouplingDataArrayFloatIsub(self,*args):
+    import _MEDRenumber
+    return _MEDRenumber.DataArrayFloat____isub___(self, self, *args)
+def MEDCouplingDataArrayFloatImul(self,*args):
+    import _MEDRenumber
+    return _MEDRenumber.DataArrayFloat____imul___(self, self, *args)
+def MEDCouplingDataArrayFloatIdiv(self,*args):
+    import _MEDRenumber
+    return _MEDRenumber.DataArrayFloat____idiv___(self, self, *args)
 def MEDCouplingDataArrayDoubleTupleIadd(self,*args):
     import _MEDRenumber
     return _MEDRenumber.DataArrayDoubleTuple____iadd___(self, self, *args)
index 6f8782e8ba3a9e60aa39e4e6069c61fc02923e92..5de2c28a0e7b61b4d8828457e3fdcdb9a4f925bb 100644 (file)
@@ -44,6 +44,8 @@ using namespace INTERP_KERNEL;
 %init %{ import_array(); %}
 #endif
 
+%init %{ initializeMe(); %}
+
 %feature("autodoc", "1");
 %feature("docstring");
 
@@ -56,6 +58,14 @@ using namespace INTERP_KERNEL;
 %include "MEDCouplingRefCountObject.i"
 %include "MEDCouplingMemArray.i"
 
+%{
+  void initializeMe()
+  {// AGY : here initialization of C++ traits in MEDCouplingDataArrayTypemaps.i for code factorization. Awful, I know, but no other solutions.
+    SWIGTITraits<double>::TI=SWIGTYPE_p_MEDCoupling__DataArrayDouble;
+    SWIGTITraits<float>::TI=SWIGTYPE_p_MEDCoupling__DataArrayFloat;
+  }
+%}
+
 class Renumbering
 {
 public:
@@ -102,6 +112,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'))