Salome HOME
Merge from V6_main (dev of Anthony GEAY) 11/06/2013
authorvsr <vsr@opencascade.com>
Tue, 11 Jun 2013 06:41:26 +0000 (06:41 +0000)
committervsr <vsr@opencascade.com>
Tue, 11 Jun 2013 06:41:26 +0000 (06:41 +0000)
72 files changed:
resources/CMakeLists.txt
resources/agitateur.med [new file with mode: 0644]
src/INTERP_KERNEL/BBTreeDst.txx [new file with mode: 0644]
src/INTERP_KERNEL/Bases/InterpKernelAutoPtr.hxx
src/INTERP_KERNEL/CellModel.cxx
src/INTERP_KERNEL/CellModel.hxx
src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx
src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.hxx
src/INTERP_KERNEL/Makefile.am
src/INTERP_KERNEL/VolSurfFormulae.hxx
src/INTERP_KERNEL/VolSurfUser.cxx
src/INTERP_KERNEL/VolSurfUser.hxx
src/INTERP_KERNEL/VolSurfUser.txx
src/MEDCalculator/CMakeLists.txt
src/MEDCoupling/CMakeLists.txt
src/MEDCoupling/MEDCouplingExtrudedMesh.cxx
src/MEDCoupling/MEDCouplingExtrudedMesh.hxx
src/MEDCoupling/MEDCouplingFieldDiscretization.cxx
src/MEDCoupling/MEDCouplingFieldDiscretization.hxx
src/MEDCoupling/MEDCouplingFieldDouble.cxx
src/MEDCoupling/MEDCouplingMemArray.cxx
src/MEDCoupling/MEDCouplingMemArray.hxx
src/MEDCoupling/MEDCouplingMemArray.txx
src/MEDCoupling/MEDCouplingMemArrayChar.cxx
src/MEDCoupling/MEDCouplingMesh.cxx
src/MEDCoupling/MEDCouplingMesh.hxx
src/MEDCoupling/MEDCouplingStructuredMesh.cxx
src/MEDCoupling/MEDCouplingStructuredMesh.hxx
src/MEDCoupling/MEDCouplingTimeDiscretization.cxx
src/MEDCoupling/MEDCouplingTimeDiscretization.hxx
src/MEDCoupling/MEDCouplingUMesh.cxx
src/MEDCoupling/MEDCouplingUMesh.hxx
src/MEDCoupling/MEDCouplingUMeshDesc.cxx
src/MEDCoupling/MEDCouplingUMeshDesc.hxx
src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx
src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx
src/MEDCoupling/Test/MEDCouplingBasicsTest3.cxx
src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx
src/MEDCoupling/Test/MEDCouplingExamplesTest.cxx
src/MEDCoupling_Swig/CMakeLists.txt
src/MEDCoupling_Swig/MEDCouplingBasicsTest.py
src/MEDCoupling_Swig/MEDCouplingCommon.i
src/MEDCoupling_Swig/MEDCouplingExamplesTest.py
src/MEDCoupling_Swig/MEDCouplingMemArray.i
src/MEDCoupling_Swig/MEDCouplingNumPyTest.py [new file with mode: 0644]
src/MEDCoupling_Swig/MEDCouplingNumpyTest.py [deleted file]
src/MEDCoupling_Swig/MEDCouplingTypemaps.i
src/MEDCoupling_Swig/Makefile.am
src/MEDLoader/CMakeLists.txt
src/MEDLoader/MEDFileData.cxx
src/MEDLoader/MEDFileField.cxx
src/MEDLoader/MEDFileField.hxx
src/MEDLoader/MEDFileMesh.cxx
src/MEDLoader/MEDFileMesh.hxx
src/MEDLoader/MEDFileUtilities.cxx
src/MEDLoader/MEDFileUtilities.hxx
src/MEDLoader/SauvWriter.cxx
src/MEDLoader/Swig/CMakeLists.txt
src/MEDLoader/Swig/CaseIO.py [new file with mode: 0644]
src/MEDLoader/Swig/CaseReader.py [new file with mode: 0644]
src/MEDLoader/Swig/CaseWriter.py [new file with mode: 0644]
src/MEDLoader/Swig/MEDLoaderCommon.i
src/MEDLoader/Swig/MEDLoaderCouplingTrainingSession.py [new file with mode: 0644]
src/MEDLoader/Swig/MEDLoaderDataForTest.py
src/MEDLoader/Swig/MEDLoaderSplitter.py [new file with mode: 0644]
src/MEDLoader/Swig/MEDLoaderTest3.py
src/MEDLoader/Swig/MEDLoaderTypemaps.i
src/MEDLoader/Swig/Makefile.am
src/MEDLoader/Swig/case2med [new file with mode: 0755]
src/MEDLoader/Swig/med2case [new file with mode: 0755]
src/MEDLoader/Test/SauvLoaderTest.cxx
src/RENUMBER/renumbering.cxx

index c654afba1adc83e7661a3dda75e59d0c81e7b735..df326a56f50892c11293cdacc9d6754e04bd861e 100644 (file)
@@ -206,6 +206,7 @@ SET(MED_RESOURCES_FILES
   allPillesTest.sauv
   BDC-714.sauv
   portico_3subs.sauv
+  agitateur.med
   )
 
 IF(MED_ENABLE_GUI)
diff --git a/resources/agitateur.med b/resources/agitateur.med
new file mode 100644 (file)
index 0000000..1052951
Binary files /dev/null and b/resources/agitateur.med differ
diff --git a/src/INTERP_KERNEL/BBTreeDst.txx b/src/INTERP_KERNEL/BBTreeDst.txx
new file mode 100644 (file)
index 0000000..b7c83ad
--- /dev/null
@@ -0,0 +1,217 @@
+// Copyright (C) 2007-2013  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.
+//
+// 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 (CEA/DEN)
+
+#ifndef __BBTREEDST_TXX__
+#define __BBTREEDST_TXX__
+
+#include <vector>
+#include <algorithm>
+
+#include <iostream>
+#include <limits>
+#include <cmath>
+
+template <int dim>
+class BBTreeDst
+{
+private:
+  BBTreeDst* _left;
+  BBTreeDst* _right;
+  int _level;
+  double _max_left;
+  double _min_right;
+  const double *_bb;
+  std::vector<int> _elems;
+  double  *_terminal;
+  int _nbelems;
+
+  static const int MIN_NB_ELEMS=15;
+  static const int MAX_LEVEL=20;
+public:
+  BBTreeDst(const double* bbs, int* elems, int level, int nbelems):
+    _left(0),_right(0),_level(level),_bb(bbs),_terminal(0),_nbelems(nbelems)
+  {
+    if((nbelems < MIN_NB_ELEMS || level> MAX_LEVEL))
+      _terminal=new double[2*dim];
+    _elems.resize(nbelems);
+    for (int i=0; i<nbelems; i++)
+      _elems[i]=elems?elems[i]:i;
+    if(_terminal)
+      {
+        fillBBoxTerminal(bbs);
+        return ;
+      }
+    double *nodes=new double[nbelems];
+    for (int i=0; i<nbelems; i++)
+      nodes[i]=bbs[_elems[i]*dim*2+(level%dim)*2];
+    std::nth_element<double*>(nodes, nodes+nbelems/2, nodes+nbelems);
+    double median = *(nodes+nbelems/2);
+    delete [] nodes;
+    std::vector<int> new_elems_left;
+    std::vector<int> new_elems_right;
+    new_elems_left.reserve(nbelems/2+1);
+    new_elems_right.reserve(nbelems/2+1);
+    double max_left = -std::numeric_limits<double>::max();
+    double min_right=  std::numeric_limits<double>::max();
+    for(int i=0; i<nbelems;i++)
+      {
+        int elem;
+        if (elems!=0)
+          elem= elems[i];
+        else
+          elem=i;
+        double max=bbs[elem*dim*2+(level%dim)*2+1];
+        double min = bbs[elem*dim*2+(level%dim)*2];
+      
+        if (min>median)
+          {
+            new_elems_right.push_back(elem);
+            if (min<min_right) min_right = min;
+          }
+        else
+          {
+            new_elems_left.push_back(elem);
+            if (max>max_left) max_left = max;
+          }
+      }
+    _max_left=max_left;
+    _min_right=min_right;
+    int *tmp;
+    tmp=0;
+    if(!new_elems_left.empty())
+      tmp=&(new_elems_left[0]);
+    _left=new BBTreeDst(bbs, tmp, level+1, (int)new_elems_left.size());
+    tmp=0;
+    if(!new_elems_right.empty())
+      tmp=&(new_elems_right[0]);
+    _right=new BBTreeDst(bbs, tmp, level+1, (int)new_elems_right.size());
+  }
+
+  ~BBTreeDst()
+  {
+    delete _left;
+    delete _right;
+    delete [] _terminal;
+  }
+
+  void getElemsWhoseMinDistanceToPtSmallerThan(const double *pt, double minOfMaxDstsSq, std::vector<int>& elems) const
+  {
+    if(_terminal)
+      {
+        for(int i=0; i<_nbelems; i++)
+          {
+            if(GetMinDistanceFromBBoxToPt(_bb+_elems[i]*2*dim,pt)<minOfMaxDstsSq)
+              elems.push_back(_elems[i]);
+          }
+      }
+    else
+      {
+        double minOfMaxDsts=sqrt(minOfMaxDstsSq);
+        if(_min_right-pt[_level%dim]>minOfMaxDsts)
+          { _left->getElemsWhoseMinDistanceToPtSmallerThan(pt,minOfMaxDstsSq,elems); return ; }
+        if(pt[_level%dim]-_max_left>minOfMaxDsts)
+          { _right->getElemsWhoseMinDistanceToPtSmallerThan(pt,minOfMaxDstsSq,elems); return ; }
+        _left->getElemsWhoseMinDistanceToPtSmallerThan(pt,minOfMaxDstsSq,elems);
+        _right->getElemsWhoseMinDistanceToPtSmallerThan(pt,minOfMaxDstsSq,elems);
+      }
+  }
+  
+  void getMinDistanceOfMax(const double *pt, double& minOfMaxDstsSq) const
+  {
+    if(_terminal)
+      {
+        if(GetMinDistanceFromBBoxToPt(_terminal,pt)>minOfMaxDstsSq)//min it is not a bug
+          return ;
+        for(int i=0; i<_nbelems; i++)
+          {
+            minOfMaxDstsSq=std::min(minOfMaxDstsSq,GetMaxDistanceFromBBoxToPt(_bb+_elems[i]*2*dim,pt));
+          }
+      }
+    else
+      {
+        double minOfMaxDsts=sqrt(minOfMaxDstsSq);
+        if(_min_right-pt[_level%dim]>minOfMaxDsts)
+          { _left->getMinDistanceOfMax(pt,minOfMaxDstsSq); return ; }
+        if(pt[_level%dim]-_max_left>minOfMaxDsts)
+          { _right->getMinDistanceOfMax(pt,minOfMaxDstsSq); return ; }
+        _left->getMinDistanceOfMax(pt,minOfMaxDstsSq);
+        _right->getMinDistanceOfMax(pt,minOfMaxDstsSq);
+      }
+  }
+
+  void fillBBoxTerminal(const double* bbs)
+  {
+    for(int j=0;j<dim;j++)
+      {
+        _terminal[2*j]=std::numeric_limits<double>::max();
+        _terminal[2*j+1]=-std::numeric_limits<double>::max();
+      }
+    for(int i=0;i<_nbelems;i++)
+      {
+        for(int j=0;j<dim;j++)
+          {
+            _terminal[2*j]=std::min(_terminal[2*j],bbs[2*dim*_elems[i]+2*j]);
+            _terminal[2*j+1]=std::max(_terminal[2*j+1],bbs[2*dim*_elems[i]+2*j+1]);
+          }
+      }
+  }
+
+  static double GetMaxDistanceFromBBoxToPt(const double *bbox, const double *pt)
+  {
+    if(bbox[0]<=bbox[1])
+      {
+        double zeRes=0.;
+        for (int idim=0; idim<dim; idim++)
+          {
+            double val1=pt[idim]-bbox[idim*2],val2=pt[idim]-bbox[idim*2+1];
+            double x=std::max(fabs(val1),fabs(val2));
+            zeRes+=x*x;
+          }
+        return zeRes;
+      }
+    else//min>max -> no cells in this
+      return std::numeric_limits<double>::max();
+    
+  }
+  
+  static double GetMinDistanceFromBBoxToPt(const double *bbox, const double *pt)
+  {
+    if(bbox[0]<=bbox[1])
+      {
+        double zeRes=0.;
+        for (int idim=0; idim<dim; idim++)
+          {
+            double val1=pt[idim]-bbox[idim*2],val2=pt[idim]-bbox[idim*2+1];
+            char pos=(( (0.<val1)-(val1<0.) )+( (0.<val2)-(val2<0.) ))/2;// sign(val) = (0.<val)-(val<0.)
+            if(pos!=0)
+              {
+                double x=pos==1?val2:val1;
+                zeRes+=x*x;
+              }
+          }
+        return zeRes;
+      }
+    else//min>max -> no cells in this
+      return std::numeric_limits<double>::max();
+  }
+};
+
+#endif
index a5533729391045ea7625eac6149d49dd88cb21e3..e49b4df14c60ffc6d7c99478e943cba6878ffda4 100644 (file)
@@ -41,6 +41,25 @@ namespace INTERP_KERNEL
   private:
     T *_ptr;
   };
+
+  template<class T>
+  class AutoCPtr
+  {
+  public:
+    AutoCPtr(T *ptr=0):_ptr(ptr) {  }
+    ~AutoCPtr() { destroyPtr(); }
+    AutoCPtr &operator=(T *ptr) { destroyPtr(); _ptr=ptr; return *this; }
+    T *operator->() { return _ptr ; }
+    const T *operator->() const { return _ptr; }
+    T& operator*() { return *_ptr; }
+    const T& operator*() const { return *_ptr; }
+    operator T *() { return _ptr; }
+    operator const T *() const { return _ptr; }
+  private:
+    void destroyPtr() { free(_ptr); }
+  private:
+    T *_ptr;
+  };
 }
 
 #endif
index ed283e18e142929f8d62bafeb44af9d11c020ec9..853e99e2493f53438a6b1dc2235ae85f2ed7105f 100644 (file)
@@ -397,7 +397,7 @@ namespace INTERP_KERNEL
         break;
       case NORM_POLYGON:
         {
-          _nb_of_pts=0; _nb_of_sons=0; _dim=2; _dyn=true; _extruded_type=NORM_POLYHED; _is_simplex=false;
+          _nb_of_pts=0; _nb_of_sons=0; _dim=2; _dyn=true; _extruded_type=NORM_POLYHED; _is_simplex=false; _quadratic_type=NORM_QPOLYG;
         }
         break;
       case NORM_POLYHED:
@@ -407,7 +407,7 @@ namespace INTERP_KERNEL
         break;
       case NORM_QPOLYG:
         {
-          _nb_of_pts=0; _nb_of_sons=0; _dim=2; _dyn=true; _is_simplex=false; _quadratic=true;
+          _nb_of_pts=0; _nb_of_sons=0; _dim=2; _dyn=true; _is_simplex=false; _quadratic=true; _linear_type=NORM_POLYGON;
         }
         break;
       case NORM_POLYL:
@@ -449,6 +449,36 @@ namespace INTERP_KERNEL
     else//polyhedron
       return (lgth-std::count(conn,conn+lgth,-1))/2;
   }
+  
+  NormalizedCellType CellModel::getCorrespondingPolyType() const
+  {
+    switch(getDimension())
+      {
+      case 0:
+        return NORM_POINT1;
+      case 1:
+        {
+          if(!isQuadratic())
+            return NORM_POLYL;
+          throw INTERP_KERNEL::Exception("CellModel::getPolyType : no poly type for quadratic 1D !");
+        }
+      case 2:
+        {
+          if(!isQuadratic())
+            return NORM_POLYGON;
+          else
+            return NORM_QPOLYG;
+        }
+      case 3:
+        {
+          if(!isQuadratic())
+            return NORM_POLYHED;
+          throw INTERP_KERNEL::Exception("CellModel::getPolyType : no poly type for quadratic 3D !");
+        }
+      default:
+        throw INTERP_KERNEL::Exception("CellModel::getPolyType : only dimension 0, 1, 2, 3 are supported !");
+      }
+  }
 
   /*!
    * Equivalent to getSonType except that this method deals with dynamic type.
index 662df54f86f8db482a2883fe161097803ed63821..d154a2d2030581d78c5ed50a896a61dbe962ff5c 100644 (file)
@@ -60,6 +60,7 @@ namespace INTERP_KERNEL
     INTERPKERNEL_EXPORT unsigned getNumberOfNodesConstituentTheSon(unsigned sonId) const { return _nb_of_sons_con[sonId]; }
     INTERPKERNEL_EXPORT unsigned getNumberOfNodesConstituentTheSon2(unsigned sonId, const int *nodalConn, int lgth) const;
     INTERPKERNEL_EXPORT NormalizedCellType getExtrudedType() const { return _extruded_type; }
+    INTERPKERNEL_EXPORT NormalizedCellType getCorrespondingPolyType() const;
     INTERPKERNEL_EXPORT NormalizedCellType getReverseExtrudedType() const { return _reverse_extruded_type; }
     INTERPKERNEL_EXPORT NormalizedCellType getLinearType() const { return _linear_type; }
     INTERPKERNEL_EXPORT NormalizedCellType getQuadraticType() const { return _quadratic_type; }
index c1c496925613cb66dc8952211f838e55ff64974c..41c4240c26a24c711d3f132033e90b56f6f2a74c 100644 (file)
@@ -542,6 +542,20 @@ void Edge::getNormalVector(double *vectOutput) const
   vectOutput[1]=-tmp;
 }
 
+Edge *Edge::BuildEdgeFrom3Points(const double *start, const double *middle, const double *end)
+{
+  Node *b(new Node(start[0],start[1])),*m(new Node(middle[0],middle[1])),*e(new Node(end[0],end[1]));
+  EdgeLin *e1(new EdgeLin(b,m)),*e2(new EdgeLin(m,e));
+  SegSegIntersector inters(*e1,*e2); bool colinearity=inters.areColinears(); delete e1; delete e2;
+  Edge *ret=0;
+  if(colinearity)
+    ret=new EdgeLin(b,e);
+  else
+    ret=new EdgeArcCircle(b,m,e);
+  b->decrRef(); m->decrRef(); e->decrRef();
+  return ret;
+}
+
 Edge *Edge::BuildEdgeFrom(Node *start, Node *end)
 {
   return new EdgeLin(start,end);
index b270cfa1df66d5438d5829e0067290ba44d17bed..d646efc3ce86572091efc7b1631af2c286d1151e 100644 (file)
@@ -225,6 +225,7 @@ namespace INTERP_KERNEL
     static Edge *BuildEdgeFrom(Node *start, Node *end);
     template<TypeOfMod4QuadEdge type>
     static Edge *BuildEdgeFrom(Node *start, Node *middle, Node *end);
+    static Edge *BuildEdgeFrom3Points(const double *start, const double *middle, const double *end);
     virtual void update(Node *m) = 0;
     //! returns area between this and axe Ox delimited along Ox by _start and _end.
     virtual double getAreaOfZone() const = 0;
index 5f2aeb813475c8968c637e7b23ba60c58da83f2b..149a7ee2e9cbab0b1631d6e0554deb996aaf4d8c 100644 (file)
@@ -29,6 +29,7 @@ lib_LTLIBRARIES = libinterpkernel.la
 salomeinclude_HEADERS =                \
 BBTree.txx                             \
 BBTreePts.txx                          \
+BBTreeDst.txx                           \
 BoundingBox.hxx                                \
 CellModel.hxx                          \
 ConvexIntersector.hxx                  \
index 6e68ad4d1528265a1e25572c92de025204eddd80..b588ec3511e4f367605fc78d38a6ff671f4c4433 100644 (file)
@@ -23,6 +23,8 @@
 
 #include "InterpolationUtils.hxx"
 #include "InterpKernelException.hxx"
+#include "InterpKernelGeo2DEdgeLin.hxx"
+#include "InterpKernelGeo2DEdgeArcCircle.hxx"
 #include "InterpKernelGeo2DQuadraticPolygon.hxx"
 
 #include <sstream>
@@ -52,6 +54,18 @@ namespace INTERP_KERNEL
         return sqrt(ret);
       }
   }
+  
+  inline double calculateLgthForSeg3(const double *begin, const double *end, const double *middle, int spaceDim)
+  {
+    if(spaceDim==2)
+      {
+        Edge *ed=Edge::BuildEdgeFrom3Points(begin,middle,end);
+        double ret=ed->getCurveLength(); ed->decrRef();
+        return ret;
+        }
+    else
+      return calculateLgthForSeg2(begin,end,spaceDim);
+  }
 
   // ===========================
   // Calculate Area for triangle
@@ -768,23 +782,54 @@ namespace INTERP_KERNEL
         bary[i]=temp/nbPts;
       }
   }
-  
-  template<class ConnType, NumberingPolicy numPol>
-  inline void computePolygonBarycenter2D(const ConnType *connec, int lgth, const double *coords, double *res)
+
+  inline void computePolygonBarycenter2DEngine(double **coords, int lgth, double *res)
   {
     double area=0.;
     res[0]=0.; res[1]=0.;
     for(int i=0;i<lgth;i++)
       {
-        double cp=coords[2*OTT<ConnType,numPol>::coo2C(connec[i])]*coords[2*OTT<ConnType,numPol>::coo2C(connec[(i+1)%lgth])+1]-
-          coords[2*OTT<ConnType,numPol>::coo2C(connec[i])+1]*coords[2*OTT<ConnType,numPol>::coo2C(connec[(i+1)%lgth])];
+        double cp=coords[i][0]*coords[(i+1)%lgth][1]-coords[i][1]*coords[(i+1)%lgth][0];
         area+=cp;
-        res[0]+=cp*(coords[2*OTT<ConnType,numPol>::coo2C(connec[i])]+coords[2*OTT<ConnType,numPol>::coo2C(connec[(i+1)%lgth])]);
-        res[1]+=cp*(coords[2*OTT<ConnType,numPol>::coo2C(connec[i])+1]+coords[2*OTT<ConnType,numPol>::coo2C(connec[(i+1)%lgth])+1]);
+        res[0]+=cp*(coords[i][0]+coords[(i+1)%lgth][0]);
+        res[1]+=cp*(coords[i][1]+coords[(i+1)%lgth][1]);
       }
     res[0]/=3.*area;
     res[1]/=3.*area;
   }
+
+  template<class ConnType, NumberingPolicy numPol>
+  inline void computePolygonBarycenter2D(const ConnType *connec, int lgth, const double *coords, double *res)
+  {
+    double **coords2=new double *[lgth];
+    for(int i=0;i<lgth;i++)
+      coords2[i]=const_cast<double *>(coords+2*OTT<ConnType,numPol>::coo2C(connec[i]));
+    computePolygonBarycenter2DEngine(coords2,lgth,res);
+    delete [] coords2;
+  }
+  
+  inline void computeQPolygonBarycenter2D(double **coords, int nbOfPtsInPolygs, int spaceDim, double *res)
+  {
+    if(nbOfPtsInPolygs%2==0)
+      {
+        if(spaceDim==2)
+          {
+            std::vector<Node *> nodes(nbOfPtsInPolygs);
+            for(int i=0;i<nbOfPtsInPolygs;i++)
+              nodes[i]=new Node(coords[i][0],coords[i][1]);
+            QuadraticPolygon *pol=QuadraticPolygon::BuildArcCirclePolygon(nodes);
+            pol->getBarycenter(res);
+            delete pol;
+          }
+        else
+          return computePolygonBarycenter2DEngine(coords,nbOfPtsInPolygs/2,res);
+      }
+    else
+      {
+        std::ostringstream oss; oss << "INTERP_KERNEL::computeQPolygonBarycenter2D : nb of points in quadratic polygon is " << nbOfPtsInPolygs << " should be even !";
+        throw INTERP_KERNEL::Exception(oss.str().c_str());
+      }
+  }
 }
 
 #endif
index 5097e47edc7bbd826602a09005be4a56d34fa2de..8165dd39600235f69030148c9d5171f24b402d9f 100644 (file)
 
 namespace INTERP_KERNEL
 {
-  double SquareDistanceFromPtToSegInSpaceDim2(const double *pt, const double *pt0Seg2, const double *pt1Seg2) throw(INTERP_KERNEL::Exception)
+  double SquareDistanceFromPtToSegInSpaceDim2(const double *pt, const double *pt0Seg2, const double *pt1Seg2, std::size_t &nbOfHint) throw(INTERP_KERNEL::Exception)
   {
     double dx=pt1Seg2[0]-pt0Seg2[0],dy=pt1Seg2[1]-pt0Seg2[1];
     double norm=sqrt(dx*dx+dy*dy);
     if(norm==0.)
-      return std::numeric_limits<double>::max();
+      return (pt[0]-pt0Seg2[0])*(pt[0]-pt0Seg2[0])+(pt[1]-pt0Seg2[1])*(pt[1]-pt0Seg2[1]);//return std::numeric_limits<double>::max();
     dx/=norm; dy/=norm;
     double dx2=pt[0]-pt0Seg2[0],dy2=pt[1]-pt0Seg2[1];
     double dotP=(dx2*dx+dy2*dy);
     if(dotP<0. || dotP>norm)
-      return std::numeric_limits<double>::max();
+      return dotP<0.?(pt[0]-pt0Seg2[0])*(pt[0]-pt0Seg2[0])+(pt[1]-pt0Seg2[1])*(pt[1]-pt0Seg2[1]):(pt[0]-pt1Seg2[0])*(pt[0]-pt1Seg2[0])+(pt[1]-pt1Seg2[1])*(pt[1]-pt1Seg2[1]);
+    nbOfHint++;
     double x=pt0Seg2[0]+dotP*dx,y=pt0Seg2[1]+dotP*dy;
     return (x-pt[0])*(x-pt[0])+(y-pt[1])*(y-pt[1]);
   }
@@ -55,18 +56,16 @@ namespace INTERP_KERNEL
     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();
-    int nbOfHint=0;
+    std::size_t nbOfHint=0;
     if(xy[0]>0. && xy[0]<xy1[0])
-      { ret=std::min(ret,sqrt(z*z+xy[1]*xy[1])); nbOfHint++; } //distance pt to edge [pt0Tri3,pt1Tri3]
-    double tmp=SquareDistanceFromPtToSegInSpaceDim2(xy,xy1,xy2); //distance pt to edge [pt1Tri3,pt2Tri3]
-    if(tmp!=std::numeric_limits<double>::max())
-      { ret=std::min(ret,sqrt(z*z+tmp)); nbOfHint++; }
-    tmp=SquareDistanceFromPtToSegInSpaceDim2(xy,xy2,xy0);//distance pt to edge [pt2Tri3,pt0Tri3]
-    if(tmp!=std::numeric_limits<double>::max())
-      { ret=std::min(ret,sqrt(z*z+tmp)); nbOfHint++; }
+      { 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,fabs(z));
-    return ret;
+      ret=std::min(ret,z*z);
+  return sqrt(ret);
   }
 
   double DistanceFromPtToPolygonInSpaceDim3(const double *pt, const int *connOfPolygonBg, const int *connOfPolygonEnd, const double *coords) throw(INTERP_KERNEL::Exception)
@@ -94,13 +93,12 @@ namespace INTERP_KERNEL
     std::size_t nbOfHint=0;
     for(std::size_t i=0;i<nbOfEdges;i++)
       {
-        double tmp=SquareDistanceFromPtToSegInSpaceDim2(xy,((double *)ptXY)+2*i,((double *)ptXY)+2*((i+1)%nbOfEdges));
-        if(tmp!=std::numeric_limits<double>::max())
-          { ret=std::min(ret,sqrt(z*z+tmp)); nbOfHint++; }
+        double tmp=SquareDistanceFromPtToSegInSpaceDim2(xy,((double *)ptXY)+2*i,((double *)ptXY)+2*((i+1)%nbOfEdges),nbOfHint);
+        ret=std::min(ret,z*z+tmp);
       }
     if(nbOfHint==nbOfEdges)
-      ret=std::min(ret,fabs(z));
-    return ret;
+      ret=std::min(ret,z*z);
+    return sqrt(ret);
   }
 
   /*!
index 18b0f2a2a8593a2dace3d8a067b342ca1d243a17..695d6a93c4734bc730c86dd3f5c452afda99ffd9 100644 (file)
@@ -38,7 +38,7 @@ namespace INTERP_KERNEL
   template<class ConnType, NumberingPolicy numPolConn>
   void computeBarycenter2(NormalizedCellType type, const ConnType *connec, int lgth, const double *coords, int spaceDim, double *res);
 
-  double SquareDistanceFromPtToSegInSpaceDim2(const double *pt, const double *pt0Seg2, const double *pt1Seg2) throw(INTERP_KERNEL::Exception);
+  double SquareDistanceFromPtToSegInSpaceDim2(const double *pt, const double *pt0Seg2, const double *pt1Seg2, std::size_t &nbOfHint) throw(INTERP_KERNEL::Exception);
 
   double DistanceFromPtToTriInSpaceDim3(const double *pt, const double *pt0Tri3, const double *pt1Tri3, const double *pt2Tri3) throw(INTERP_KERNEL::Exception);
 
index df90d7ffae1a1ef478ae51181800e74cb710f299..4833a91b3fc32f18c7cf23edd515176943b7cba8 100644 (file)
@@ -34,13 +34,19 @@ namespace INTERP_KERNEL
     switch(type)
       {
       case INTERP_KERNEL::NORM_SEG2 :
-      case INTERP_KERNEL::NORM_SEG3 :
       case INTERP_KERNEL::NORM_SEG4 :
         {
           int N1 = OTT<ConnType,numPol>::coo2C(connec[0]);
           int N2 = OTT<ConnType,numPol>::coo2C(connec[1]);
           return INTERP_KERNEL::calculateLgthForSeg2(coords+(SPACEDIM*N1),coords+(SPACEDIM*N2),SPACEDIM);
         }
+      case INTERP_KERNEL::NORM_SEG3 :
+        {
+          int beginNode = OTT<ConnType,numPol>::coo2C(connec[0]);
+          int endNode = OTT<ConnType,numPol>::coo2C(connec[1]);
+          int middleNode = OTT<ConnType,numPol>::coo2C(connec[2]);
+          return INTERP_KERNEL::calculateLgthForSeg3(coords+(SPACEDIM*beginNode),coords+(SPACEDIM*endNode),coords+(SPACEDIM*middleNode),SPACEDIM);
+        }
       case INTERP_KERNEL::NORM_TRI3 :
         {
           int N1 = OTT<ConnType,numPol>::coo2C(connec[0]);
@@ -115,6 +121,7 @@ namespace INTERP_KERNEL
           delete [] pts;
           return val;
         }
+        break;
       case INTERP_KERNEL::NORM_TETRA4 :
       case INTERP_KERNEL::NORM_TETRA10 :
         {
@@ -231,7 +238,6 @@ namespace INTERP_KERNEL
     switch(type)
       {
       case NORM_SEG2:
-      case NORM_SEG3:
       case NORM_SEG4:
         {
           std::copy(coords+SPACEDIM*OTT<ConnType,numPol>::coo2C(connec[0]),
@@ -240,8 +246,30 @@ namespace INTERP_KERNEL
           std::transform(res,res+SPACEDIM,res,std::bind2nd(std::multiplies<double>(),0.5));
           break;
         }
+      case NORM_SEG3:
+        {
+          if(SPACEDIM==2)
+            {
+              Edge *ed=Edge::BuildEdgeFrom3Points(coords+2*OTT<ConnType,numPol>::coo2C(connec[0]),coords+2*OTT<ConnType,numPol>::coo2C(connec[2]),coords+2*OTT<ConnType,numPol>::coo2C(connec[1]));
+              ed->getBarycenter(res);
+              ed->decrRef();
+            }
+          else if(SPACEDIM==1)
+            {
+              *res=(coords[OTT<ConnType,numPol>::coo2C(connec[0])]+coords[OTT<ConnType,numPol>::coo2C(connec[1])])/2.;
+            }
+          else if(SPACEDIM==3)
+            {
+              std::copy(coords+SPACEDIM*OTT<ConnType,numPol>::coo2C(connec[0]),
+                        coords+SPACEDIM*OTT<ConnType,numPol>::coo2C(connec[0]+1),res);
+              std::transform(res,res+SPACEDIM,coords+SPACEDIM*OTT<ConnType,numPol>::coo2C(connec[1]),res,std::plus<double>());
+              std::transform(res,res+SPACEDIM,res,std::bind2nd(std::multiplies<double>(),0.5));
+            }
+          else
+            throw INTERP_KERNEL::Exception("computeBarycenter for SEG3 only SPACEDIM 1,2 or 3 supported !");
+          break;
+        }
       case NORM_TRI3:
-      case NORM_TRI6:
       case NORM_TRI7:
         {
           std::copy(coords+SPACEDIM*OTT<ConnType,numPol>::coo2C(connec[0]),
@@ -251,6 +279,25 @@ namespace INTERP_KERNEL
           std::transform(res,res+SPACEDIM,res,std::bind2nd(std::multiplies<double>(),1./3.));
           break;
         }
+      case NORM_TRI6:
+        {
+          if(SPACEDIM==2)
+            {
+              double *pts[6];
+              pts[0] = const_cast<double *>(coords+SPACEDIM*OTT<ConnType,numPol>::coo2C(connec[0]));
+              pts[1] = const_cast<double *>(coords+SPACEDIM*OTT<ConnType,numPol>::coo2C(connec[1]));
+              pts[2] = const_cast<double *>(coords+SPACEDIM*OTT<ConnType,numPol>::coo2C(connec[2]));
+              pts[3] = const_cast<double *>(coords+SPACEDIM*OTT<ConnType,numPol>::coo2C(connec[3]));
+              pts[4] = const_cast<double *>(coords+SPACEDIM*OTT<ConnType,numPol>::coo2C(connec[4]));
+              pts[5] = const_cast<double *>(coords+SPACEDIM*OTT<ConnType,numPol>::coo2C(connec[5]));
+              computeQPolygonBarycenter2D(pts,6,2,res);
+            }
+          else if(SPACEDIM==3)
+            computePolygonBarycenter3D<ConnType,numPol>(connec,lgth/2,coords,res);
+          else
+            throw INTERP_KERNEL::Exception("Impossible spacedim linked to cell 2D Cell !");
+          break;
+        }
       case NORM_QUAD4:
       case NORM_POLYGON:
         {
@@ -265,13 +312,41 @@ namespace INTERP_KERNEL
       case NORM_QUAD8:
         {
           if(SPACEDIM==2)
-            computePolygonBarycenter2D<ConnType,numPol>(connec,lgth/2,coords,res);
+            {
+              double *pts[8];
+              pts[0] = const_cast<double *>(coords+SPACEDIM*OTT<ConnType,numPol>::coo2C(connec[0]));
+              pts[1] = const_cast<double *>(coords+SPACEDIM*OTT<ConnType,numPol>::coo2C(connec[1]));
+              pts[2] = const_cast<double *>(coords+SPACEDIM*OTT<ConnType,numPol>::coo2C(connec[2]));
+              pts[3] = const_cast<double *>(coords+SPACEDIM*OTT<ConnType,numPol>::coo2C(connec[3]));
+              pts[4] = const_cast<double *>(coords+SPACEDIM*OTT<ConnType,numPol>::coo2C(connec[4]));
+              pts[5] = const_cast<double *>(coords+SPACEDIM*OTT<ConnType,numPol>::coo2C(connec[5]));
+              pts[6] = const_cast<double *>(coords+SPACEDIM*OTT<ConnType,numPol>::coo2C(connec[6]));
+              pts[7] = const_cast<double *>(coords+SPACEDIM*OTT<ConnType,numPol>::coo2C(connec[7]));
+              computeQPolygonBarycenter2D(pts,8,2,res);
+            }
+          else if(SPACEDIM==3)
+            computePolygonBarycenter3D<ConnType,numPol>(connec,lgth/2,coords,res);
+          else
+            throw INTERP_KERNEL::Exception("Impossible spacedim linked to cell 2D Cell !");
+          break;
+        }
+      case INTERP_KERNEL::NORM_QPOLYG :
+        {
+          if(SPACEDIM==2)
+            {
+              double **pts=new double *[lgth];
+              for(int i=0;i<lgth;i++)
+                pts[i]=const_cast<double *>(coords+2*OTT<ConnType,numPol>::coo2C(connec[i]));
+              computeQPolygonBarycenter2D(pts,lgth,2,res);
+              delete [] pts;
+            }
           else if(SPACEDIM==3)
             computePolygonBarycenter3D<ConnType,numPol>(connec,lgth/2,coords,res);
           else
             throw INTERP_KERNEL::Exception("Impossible spacedim linked to cell 2D Cell !");
           break;
         }
+        break;
       case NORM_TETRA4:
         {
           res[0]=coords[3*OTT<ConnType,numPol>::coo2C(connec[0])]; 
index ba2eab26567c7ff66f9025e86cde774669ac40c9..0cb6372d12fc996c19e65d6566dbc78770d9c4aa 100644 (file)
 # Author : Anthony Geay (CEA/DEN)
 
 ADD_SUBDIRECTORY(Swig)
-ADD_SUBDIRECTORY(Test)
+
+IF(CPPUNIT_IS_OK)
+  ADD_SUBDIRECTORY(Test)
+ENDIF(CPPUNIT_IS_OK)
 
 INCLUDE_DIRECTORIES(
   ${MED3_INCLUDE_DIRS}
index cb74301caa0a9bc4c7ff7764f7b95b81719ba828..f25bc2bf923d89b417d235dfaa717b1d72ab6520 100644 (file)
@@ -18,7 +18,9 @@
 #
 # Author : Anthony Geay (CEA/DEN)
 
-ADD_SUBDIRECTORY(Test)
+IF(CPPUNIT_STATUS)
+  ADD_SUBDIRECTORY(Test)
+ENDIF(CPPUNIT_STATUS)
 
 INCLUDE_DIRECTORIES(
   ${CMAKE_CURRENT_BINARY_DIR}/../..
index 5677bbe7b3a68aaa6c421301d71585a1205e5119..2e2b03870ae2999acac04524caccfaf8198bb14f 100644 (file)
@@ -284,6 +284,20 @@ DataArrayInt *MEDCouplingExtrudedMesh::computeNbOfNodesPerCell() const throw(INT
   int *pt=ret3D->getPointer();
   for(int i=0;i<nbOfLevs;i++,pt+=nbOfCells2D)
      std::copy(ret2D->begin(),ret2D->end(),pt);
+  ret3D->applyLin(2,0,0);
+  return ret3D->renumberR(_mesh3D_ids->begin());
+}
+
+DataArrayInt *MEDCouplingExtrudedMesh::computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception)
+{
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret2D=_mesh2D->computeNbOfNodesPerCell();
+  int nbOfLevs=_mesh1D->getNumberOfCells();
+  int nbOfCells2D=_mesh2D->getNumberOfCells();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret3D=DataArrayInt::New(); ret3D->alloc(nbOfLevs*nbOfCells2D,1);
+  int *pt=ret3D->getPointer();
+  for(int i=0;i<nbOfLevs;i++,pt+=nbOfCells2D)
+     std::copy(ret2D->begin(),ret2D->end(),pt);
+  ret3D->applyLin(2,2,0);
   return ret3D->renumberR(_mesh3D_ids->begin());
 }
 
index d8d9e55b387c1304eecc742f741576424d0c17c3..06a5a871e65478a76656d2e52e6953870e94d2e1 100644 (file)
@@ -57,6 +57,7 @@ namespace ParaMEDMEM
     std::set<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const;
     DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
     DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
+    DataArrayInt *computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception);
     int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
     void getNodeIdsOfCell(int cellId, std::vector<int>& conn) const;
     void getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const throw(INTERP_KERNEL::Exception);
index 1c99da1c2b1224b733b40056103d396f41649f54..bb7587bc3e9d49ef6b075d2f7ad66b1264054af5 100644 (file)
@@ -497,7 +497,7 @@ DataArrayInt *MEDCouplingFieldDiscretizationP0::getOffsetArr(const MEDCouplingMe
   return ret;
 }
 
-void MEDCouplingFieldDiscretizationP0::renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArrayDouble *>& arrays,
+void MEDCouplingFieldDiscretizationP0::renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArray *>& arrays,
                                                              const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception)
 {
   if(!mesh)
@@ -505,13 +505,13 @@ void MEDCouplingFieldDiscretizationP0::renumberArraysForCell(const MEDCouplingMe
   const int *array=old2NewBg;
   if(check)
     array=DataArrayInt::CheckAndPreparePermutation(old2NewBg,old2NewBg+mesh->getNumberOfCells());
-  for(std::vector<DataArrayDouble *>::const_iterator it=arrays.begin();it!=arrays.end();it++)
+  for(std::vector<DataArray *>::const_iterator it=arrays.begin();it!=arrays.end();it++)
     {
       if(*it)
         (*it)->renumberInPlace(array);
     }
   if(check)
-    delete [] array;
+    free(const_cast<int *>(array));
 }
 
 DataArrayDouble *MEDCouplingFieldDiscretizationP0::getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const
@@ -543,10 +543,10 @@ void MEDCouplingFieldDiscretizationP0::checkCompatibilityWithNature(NatureOfFiel
 {
 }
 
-void MEDCouplingFieldDiscretizationP0::checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArrayDouble *da) const throw(INTERP_KERNEL::Exception)
+void MEDCouplingFieldDiscretizationP0::checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const throw(INTERP_KERNEL::Exception)
 {
-  if(!mesh)
-    throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::checkCoherencyBetween : NULL input mesh !");
+  if(!mesh || !da)
+    throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::checkCoherencyBetween : NULL input mesh or DataArray !");
   if(mesh->getNumberOfCells()!=da->getNumberOfTuples())
     {
       std::ostringstream message;
@@ -694,7 +694,7 @@ int MEDCouplingFieldDiscretizationOnNodes::getNumberOfMeshPlaces(const MEDCoupli
 /*!
  * Nothing to do here.
  */
-void MEDCouplingFieldDiscretizationOnNodes::renumberArraysForCell(const MEDCouplingMesh *, const std::vector<DataArrayDouble *>& arrays,
+void MEDCouplingFieldDiscretizationOnNodes::renumberArraysForCell(const MEDCouplingMesh *, const std::vector<DataArray *>& arrays,
                                                                   const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception)
 {
 }
@@ -732,10 +732,10 @@ void MEDCouplingFieldDiscretizationOnNodes::computeMeshRestrictionFromTupleIds(c
   trueTupleRestriction=ret2.retn();
 }
 
-void MEDCouplingFieldDiscretizationOnNodes::checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArrayDouble *da) const throw(INTERP_KERNEL::Exception)
+void MEDCouplingFieldDiscretizationOnNodes::checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const throw(INTERP_KERNEL::Exception)
 {
-  if(!mesh)
-    throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationNodes::checkCoherencyBetween : NULL input mesh !");
+  if(!mesh || !da)
+    throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationNodes::checkCoherencyBetween : NULL input mesh or DataArray !");
   if(mesh->getNumberOfNodes()!=da->getNumberOfTuples())
     {
       std::ostringstream message;
@@ -1005,12 +1005,12 @@ std::size_t MEDCouplingFieldDiscretizationPerCell::getHeapMemorySize() const
   return ret;
 }
 
-void MEDCouplingFieldDiscretizationPerCell::checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArrayDouble *da) const throw(INTERP_KERNEL::Exception)
+void MEDCouplingFieldDiscretizationPerCell::checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const throw(INTERP_KERNEL::Exception)
 {
   if(!_discr_per_cell)
     throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell has no discretization per cell !");
   if(!mesh)
-    throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell::checkCoherencyBetween : NULL input mesh !");
+    throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell::checkCoherencyBetween : NULL input mesh or DataArray !");
   int nbOfTuples=_discr_per_cell->getNumberOfTuples();
   if(nbOfTuples!=mesh->getNumberOfCells())
     throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell has a discretization per cell but it's not matching the underlying mesh !");
@@ -1067,7 +1067,7 @@ void MEDCouplingFieldDiscretizationPerCell::renumberCells(const int *old2NewBg,
   _discr_per_cell=dpc;
   //
   if(check)
-    delete [] const_cast<int *>(array);
+    free(const_cast<int *>(array));
 }
 
 void MEDCouplingFieldDiscretizationPerCell::buildDiscrPerCellIfNecessary(const MEDCouplingMesh *mesh)
@@ -1297,7 +1297,7 @@ DataArrayInt *MEDCouplingFieldDiscretizationGauss::getOffsetArr(const MEDCouplin
   return ret.retn();
 }
 
-void MEDCouplingFieldDiscretizationGauss::renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArrayDouble *>& arrays,
+void MEDCouplingFieldDiscretizationGauss::renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArray *>& arrays,
                                                                 const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception)
 {
   if(!mesh)
@@ -1321,12 +1321,12 @@ void MEDCouplingFieldDiscretizationGauss::renumberArraysForCell(const MEDCouplin
         array2[j]=array3[array[i]]+k;
     }
   delete [] array3;
-  for(std::vector<DataArrayDouble *>::const_iterator it=arrays.begin();it!=arrays.end();it++)
+  for(std::vector<DataArray *>::const_iterator it=arrays.begin();it!=arrays.end();it++)
     if(*it)
       (*it)->renumberInPlace(array2);
   delete [] array2;
   if(check)
-    delete [] const_cast<int*>(array);
+    free(const_cast<int*>(array));
 }
 
 DataArrayDouble *MEDCouplingFieldDiscretizationGauss::getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const
@@ -1460,10 +1460,10 @@ double MEDCouplingFieldDiscretizationGauss::getIJK(const MEDCouplingMesh *mesh,
   return da->getIJ(offset+nodeIdInCell,compoId);
 }
 
-void MEDCouplingFieldDiscretizationGauss::checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArrayDouble *da) const throw(INTERP_KERNEL::Exception)
+void MEDCouplingFieldDiscretizationGauss::checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const throw(INTERP_KERNEL::Exception)
 {
-  if(!mesh)
-    throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::checkCoherencyBetween : NULL input mesh !");
+  if(!mesh || !da)
+    throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::checkCoherencyBetween : NULL input mesh or DataArray !");
   MEDCouplingFieldDiscretizationPerCell::checkCoherencyBetween(mesh,da);
   for(std::vector<MEDCouplingGaussLocalization>::const_iterator iter=_loc.begin();iter!=_loc.end();iter++)
     (*iter).checkCoherency();
@@ -1969,7 +1969,7 @@ DataArrayInt *MEDCouplingFieldDiscretizationGaussNE::getOffsetArr(const MEDCoupl
   return ret;
 }
 
-void MEDCouplingFieldDiscretizationGaussNE::renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArrayDouble *>& arrays,
+void MEDCouplingFieldDiscretizationGaussNE::renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArray *>& arrays,
                                                                   const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception)
 {
   if(!mesh)
@@ -1997,12 +1997,12 @@ void MEDCouplingFieldDiscretizationGaussNE::renumberArraysForCell(const MEDCoupl
         array2[j]=array3[array[i]]+k;
     }
   delete [] array3;
-  for(std::vector<DataArrayDouble *>::const_iterator it=arrays.begin();it!=arrays.end();it++)
+  for(std::vector<DataArray *>::const_iterator it=arrays.begin();it!=arrays.end();it++)
     if(*it)
       (*it)->renumberInPlace(array2);
   delete [] array2;
   if(check)
-    delete [] const_cast<int *>(array);
+    free(const_cast<int *>(array));
 }
 
 DataArrayDouble *MEDCouplingFieldDiscretizationGaussNE::getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const
@@ -2209,7 +2209,7 @@ double MEDCouplingFieldDiscretizationGaussNE::getIJK(const MEDCouplingMesh *mesh
   return da->getIJ(offset+nodeIdInCell,compoId);
 }
 
-void MEDCouplingFieldDiscretizationGaussNE::checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArrayDouble *da) const throw(INTERP_KERNEL::Exception)
+void MEDCouplingFieldDiscretizationGaussNE::checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const throw(INTERP_KERNEL::Exception)
 {
   int nbOfTuples=getNumberOfTuples(mesh);
   if(nbOfTuples!=da->getNumberOfTuples())
index 22e40cea7db759a412bdb87d5bda5064921fea36..962f6fd8c07ce3110e1d6b8d8f34b4788e563b5d 100644 (file)
@@ -34,6 +34,7 @@
 
 namespace ParaMEDMEM
 {
+  class DataArray;
   class DataArrayInt;
   class MEDCouplingMesh;
   class DataArrayDouble;
@@ -69,10 +70,10 @@ namespace ParaMEDMEM
                                                     DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const throw(INTERP_KERNEL::Exception) = 0;
     virtual void checkCompatibilityWithNature(NatureOfField nat) const throw(INTERP_KERNEL::Exception) = 0;
     virtual void renumberCells(const int *old2NewBg, bool check=true) throw(INTERP_KERNEL::Exception);
-    virtual void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArrayDouble *>& arrays,
+    virtual void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArray *>& arrays,
                                        const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception) = 0;
     virtual double getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
-    virtual void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArrayDouble *da) const throw(INTERP_KERNEL::Exception) = 0;
+    virtual void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const throw(INTERP_KERNEL::Exception) = 0;
     virtual MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const = 0;
     virtual void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const = 0;
     virtual void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k, double *res) const = 0;
@@ -122,13 +123,13 @@ namespace ParaMEDMEM
     int getNumberOfTuples(const MEDCouplingMesh *mesh) const throw(INTERP_KERNEL::Exception);
     int getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const;
     DataArrayInt *getOffsetArr(const MEDCouplingMesh *mesh) const;
-    void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArrayDouble *>& arrays,
+    void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArray *>& arrays,
                                const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception);
     DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const;
     void checkCompatibilityWithNature(NatureOfField nat) const throw(INTERP_KERNEL::Exception);
     void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *tupleIdsBg, const int *tupleIdsEnd,
                                             DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const throw(INTERP_KERNEL::Exception);
-    void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArrayDouble *da) const throw(INTERP_KERNEL::Exception);
+    void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const throw(INTERP_KERNEL::Exception);
     MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const;
     void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const;
     void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k, double *res) const;
@@ -151,12 +152,12 @@ namespace ParaMEDMEM
     int getNumberOfTuples(const MEDCouplingMesh *mesh) const throw(INTERP_KERNEL::Exception);
     int getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const;
     DataArrayInt *getOffsetArr(const MEDCouplingMesh *mesh) const;
-    void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArrayDouble *>& arrays,
+    void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArray *>& arrays,
                                const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception);
     DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const;
     void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *tupleIdsBg, const int *tupleIdsEnd,
                                             DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const throw(INTERP_KERNEL::Exception);
-    void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArrayDouble *da) const throw(INTERP_KERNEL::Exception);
+    void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const throw(INTERP_KERNEL::Exception);
     MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const;
     MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const;
     DataArrayInt *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const int *startCellIds, const int *endCellIds) const;
@@ -205,7 +206,7 @@ namespace ParaMEDMEM
     ~MEDCouplingFieldDiscretizationPerCell();
     void updateTime() const;
     std::size_t getHeapMemorySize() const;
-    void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArrayDouble *da) const throw(INTERP_KERNEL::Exception);
+    void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const throw(INTERP_KERNEL::Exception);
     bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const;
     bool isEqualWithoutConsideringStr(const MEDCouplingFieldDiscretization *other, double eps) const;
     void renumberCells(const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception);
@@ -232,7 +233,7 @@ namespace ParaMEDMEM
     int getNumberOfTuples(const MEDCouplingMesh *mesh) const throw(INTERP_KERNEL::Exception);
     int getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const;
     DataArrayInt *getOffsetArr(const MEDCouplingMesh *mesh) const;
-    void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArrayDouble *>& arrays,
+    void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArray *>& arrays,
                                const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception);
     DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const;
     void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *tupleIdsBg, const int *tupleIdsEnd,
@@ -244,7 +245,7 @@ namespace ParaMEDMEM
     void getSerializationIntArray(DataArrayInt *& arr) const;
     void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *& arr);
     double getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
-    void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArrayDouble *da) const throw(INTERP_KERNEL::Exception);
+    void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const throw(INTERP_KERNEL::Exception);
     MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const;
     void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const;
     void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k, double *res) const;
@@ -299,7 +300,7 @@ namespace ParaMEDMEM
     int getNumberOfTuples(const MEDCouplingMesh *mesh) const throw(INTERP_KERNEL::Exception);
     int getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const;
     DataArrayInt *getOffsetArr(const MEDCouplingMesh *mesh) const;
-    void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArrayDouble *>& arrays,
+    void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArray *>& arrays,
                                const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception);
     DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const;
     void integral(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, bool isWAbs, double *res) const throw(INTERP_KERNEL::Exception);
@@ -307,7 +308,7 @@ namespace ParaMEDMEM
                                             DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const throw(INTERP_KERNEL::Exception);
     void checkCompatibilityWithNature(NatureOfField nat) const throw(INTERP_KERNEL::Exception);
     double getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
-    void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArrayDouble *da) const throw(INTERP_KERNEL::Exception);
+    void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const throw(INTERP_KERNEL::Exception);
     MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const;
     void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const;
     void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k, double *res) const;
index 4b4399ca0dc0deb5f35495a59865e85f9c051ad8..b3172174783bb44514ad80eae549a548fd778dd4 100644 (file)
@@ -539,7 +539,8 @@ void MEDCouplingFieldDouble::renumberCellsWithoutMesh(const int *old2NewBg, bool
   _type->renumberCells(old2NewBg,check);
   std::vector<DataArrayDouble *> arrays;
   _time_discr->getArrays(arrays);
-  _type->renumberArraysForCell(_mesh,arrays,old2NewBg,check);
+  std::vector<DataArray *> arrays2(arrays.size()); std::copy(arrays.begin(),arrays.end(),arrays2.begin());
+  _type->renumberArraysForCell(_mesh,arrays2,old2NewBg,check);
   //
   updateTime();
 }
index bdcda80b3e194777bb35a1d0bdcfd08b2bb23e75..7c06c77022a5ad0b07762dec2585957e3bc8f192 100644 (file)
@@ -399,6 +399,32 @@ void DataArray::setInfoOnComponent(int i, const char *info) throw(INTERP_KERNEL:
     }
 }
 
+/*!
+ * Sets information on all components. This method can change number of components
+ * at certain conditions; if the conditions are not respected, an exception is thrown.
+ * The number of components can be changed provided that \a this is not allocated.
+ *
+ * To know more on format of the component information see
+ * \ref MEDCouplingArrayBasicsCompoName "DataArrays infos".
+ *  \param [in] info - a vector of component infos.
+ *  \throw If \a this->getNumberOfComponents() != \a info.size() && \a this->isAllocated()
+ */
+void DataArray::setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception)
+{
+  if(getNumberOfComponents()!=(int)info.size())
+    {
+      if(!isAllocated())
+        _info_on_compo=info;
+      else
+        {
+          std::ostringstream oss; oss << "DataArray::setInfoAndChangeNbOfCompo : input is of size " << info.size() << " whereas number of components is equal to " << getNumberOfComponents() << "  and this is already allocated !";
+          throw INTERP_KERNEL::Exception(oss.str().c_str());
+        }
+    }
+  else
+    _info_on_compo=info;
+}
+
 void DataArray::checkNbOfTuples(int nbOfTuples, const char *msg) const throw(INTERP_KERNEL::Exception)
 {
   if(getNumberOfTuples()!=nbOfTuples)
@@ -488,6 +514,45 @@ void DataArray::CheckClosingParInRange(int ref, int value, const char *msg) thro
     }
 }
 
+/*!
+ * This method is useful to slice work among a pool of threads or processes. \a begin, \a end \a step is the input whole slice of work to perform, 
+ * typically it is a whole slice of tuples of DataArray or cells, nodes of a mesh...
+ *
+ * The input \a sliceId should be an id in [0, \a nbOfSlices) that specifies the slice of work.
+ *
+ * \param [in] start - the start of the input slice of the whole work to perform splitted into slices.
+ * \param [in] stop - the stop of the input slice of the whole work to perform splitted into slices.
+ * \param [in] step - the step (that can be <0) of the input slice of the whole work to perform splitted into slices.
+ * \param [in] sliceId - the slice id considered
+ * \param [in] nbOfSlices - the number of slices (typically the number of cores on which the work is expected to be sliced)
+ * \param [out] startSlice - the start of the slice considered
+ * \param [out] stopSlice - the stop of the slice consided
+ * 
+ * \throw If \a step == 0
+ * \throw If \a nbOfSlices not > 0
+ * \throw If \a sliceId not in [0,nbOfSlices)
+ */
+void DataArray::GetSlice(int start, int stop, int step, int sliceId, int nbOfSlices, int& startSlice, int& stopSlice) throw(INTERP_KERNEL::Exception)
+{
+  if(nbOfSlices<=0)
+    {
+      std::ostringstream oss; oss << "DataArray::GetSlice : nbOfSlices (" << nbOfSlices << ") must be > 0 !";
+      throw INTERP_KERNEL::Exception(oss.str().c_str());
+    }
+  if(sliceId<0 || sliceId>=nbOfSlices)
+    {
+      std::ostringstream oss; oss << "DataArray::GetSlice : sliceId (" << nbOfSlices << ") must be in [0 , nbOfSlices (" << nbOfSlices << ") ) !";
+      throw INTERP_KERNEL::Exception(oss.str().c_str());
+    }
+  int nbElems=GetNumberOfItemGivenBESRelative(start,stop,step,"DataArray::GetSlice");
+  int minNbOfElemsPerSlice=nbElems/nbOfSlices;
+  startSlice=start+minNbOfElemsPerSlice*step*sliceId;
+  if(sliceId<nbOfSlices-1)
+    stopSlice=start+minNbOfElemsPerSlice*step*(sliceId+1);
+  else
+    stopSlice=stop;
+}
+
 int DataArray::GetNumberOfItemGivenBES(int begin, int end, int step, const char *msg) throw(INTERP_KERNEL::Exception)
 {
   if(end<begin)
@@ -594,32 +659,6 @@ std::size_t DataArrayDouble::getHeapMemorySize() const
   return DataArray::getHeapMemorySize()+sz;
 }
 
-/*!
- * Sets information on all components. This method can change number of components
- * at certain conditions; if the conditions are not respected, an exception is thrown.
- * The number of components can be changed provided that \a this is not allocated.
- *
- * To know more on format of the component information see
- * \ref MEDCouplingArrayBasicsCompoName "DataArrays infos".
- *  \param [in] info - a vector of component infos.
- *  \throw If \a this->getNumberOfComponents() != \a info.size() && \a this->isAllocated()
- */
-void DataArrayDouble::setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception)
-{
-  if(getNumberOfComponents()!=(int)info.size())
-    {
-      if(!isAllocated())
-        _info_on_compo=info;
-      else
-        {
-          std::ostringstream oss; oss << "DataArrayDouble::setInfoAndChangeNbOfCompo : input is of size " << info.size() << " whereas number of components is equal to " << getNumberOfComponents() << "  and this is already allocated !";
-          throw INTERP_KERNEL::Exception(oss.str().c_str());
-        }
-    }
-  else
-    _info_on_compo=info;
-}
-
 /*!
  * Returns the only one value in \a this, if and only if number of elements
  * (nb of tuples * nb of components) is equal to 1, and that \a this is allocated.
@@ -1211,7 +1250,7 @@ DataArrayDouble *DataArrayDouble::fromNoInterlace() const throw(INTERP_KERNEL::E
     throw INTERP_KERNEL::Exception("DataArrayDouble::fromNoInterlace : Not defined array !");
   double *tab=_mem.fromNoInterlace(getNumberOfComponents());
   DataArrayDouble *ret=DataArrayDouble::New();
-  ret->useArray(tab,true,CPP_DEALLOC,getNumberOfTuples(),getNumberOfComponents());
+  ret->useArray(tab,true,C_DEALLOC,getNumberOfTuples(),getNumberOfComponents());
   return ret;
 }
 
@@ -1231,7 +1270,7 @@ DataArrayDouble *DataArrayDouble::toNoInterlace() const throw(INTERP_KERNEL::Exc
     throw INTERP_KERNEL::Exception("DataArrayDouble::toNoInterlace : Not defined array !");
   double *tab=_mem.toNoInterlace(getNumberOfComponents());
   DataArrayDouble *ret=DataArrayDouble::New();
-  ret->useArray(tab,true,CPP_DEALLOC,getNumberOfTuples(),getNumberOfComponents());
+  ret->useArray(tab,true,C_DEALLOC,getNumberOfTuples(),getNumberOfComponents());
   return ret;
 }
 
@@ -1482,7 +1521,7 @@ DataArrayDouble *DataArrayDouble::selectByTupleId2(int bg, int end2, int step) c
  *  \throw If \a end > \a this->getNumberOfTuples().
  *  \throw If \a this is not allocated.
  */
-DataArrayDouble *DataArrayDouble::selectByTupleRanges(const std::vector<std::pair<int,int> >& ranges) const throw(INTERP_KERNEL::Exception)
+DataArray *DataArrayDouble::selectByTupleRanges(const std::vector<std::pair<int,int> >& ranges) const throw(INTERP_KERNEL::Exception)
 {
   checkAllocated();
   int nbOfComp=getNumberOfComponents();
@@ -1669,7 +1708,7 @@ void DataArrayDouble::transpose() throw(INTERP_KERNEL::Exception)
  *
  *  \ref py_mcdataarraydouble_KeepSelectedComponents "Here is a Python example".
  */
-DataArrayDouble *DataArrayDouble::keepSelectedComponents(const std::vector<int>& compoIds) const throw(INTERP_KERNEL::Exception)
+DataArray *DataArrayDouble::keepSelectedComponents(const std::vector<int>& compoIds) const throw(INTERP_KERNEL::Exception)
 {
   checkAllocated();
   MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret(DataArrayDouble::New());
@@ -1713,7 +1752,7 @@ void DataArrayDouble::meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL
     throw INTERP_KERNEL::Exception("DataArrayDouble::meldWith : mismatch of number of tuples !");
   int nbOfComp1=getNumberOfComponents();
   int nbOfComp2=other->getNumberOfComponents();
-  double *newArr=new double[nbOfTuples*(nbOfComp1+nbOfComp2)];
+  double *newArr=(double *)malloc((nbOfTuples*(nbOfComp1+nbOfComp2))*sizeof(double));
   double *w=newArr;
   const double *inp1=getConstPointer();
   const double *inp2=other->getConstPointer();
@@ -1722,7 +1761,7 @@ void DataArrayDouble::meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL
       w=std::copy(inp1,inp1+nbOfComp1,w);
       w=std::copy(inp2,inp2+nbOfComp2,w);
     }
-  useArray(newArr,true,CPP_DEALLOC,nbOfTuples,nbOfComp1+nbOfComp2);
+  useArray(newArr,true,C_DEALLOC,nbOfTuples,nbOfComp1+nbOfComp2);
   std::vector<int> compIds(nbOfComp2);
   for(int i=0;i<nbOfComp2;i++)
     compIds[i]=nbOfComp1+i;
@@ -2508,10 +2547,13 @@ void DataArrayDouble::setPartOfValuesAdv(const DataArrayDouble *a, const DataArr
  *  \throw If any tuple index given by \a tuplesSelec is out of a valid range for 
  *         \a a array.
  */
-void DataArrayDouble::setContigPartOfSelectedValues(int tupleIdStart, const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception)
+void DataArrayDouble::setContigPartOfSelectedValues(int tupleIdStart, const DataArray *aBase, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception)
 {
-  if(!a || !tuplesSelec)
+  if(!aBase || !tuplesSelec)
     throw INTERP_KERNEL::Exception("DataArrayDouble::setContigPartOfSelectedValues : input DataArray is NULL !");
+  const DataArrayDouble *a=dynamic_cast<const DataArrayDouble *>(aBase);
+  if(!a)
+    throw INTERP_KERNEL::Exception("DataArrayDouble::setContigPartOfSelectedValues : input DataArray aBase is not a DataArrayDouble !");
   checkAllocated();
   a->checkAllocated();
   tuplesSelec->checkAllocated();
@@ -2567,10 +2609,13 @@ void DataArrayDouble::setContigPartOfSelectedValues(int tupleIdStart, const Data
  *            non-empty range of increasing indices or indices are out of a valid range
  *            for the array \a a.
  */
-void DataArrayDouble::setContigPartOfSelectedValues2(int tupleIdStart, const DataArrayDouble *a, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
+void DataArrayDouble::setContigPartOfSelectedValues2(int tupleIdStart, const DataArray *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
 {
+  if(!aBase)
+    throw INTERP_KERNEL::Exception("DataArrayDouble::setContigPartOfSelectedValues2 : input DataArray is NULL !");
+  const DataArrayDouble *a=dynamic_cast<const DataArrayDouble *>(aBase);
   if(!a)
-    throw INTERP_KERNEL::Exception("DataArrayDouble::setContigPartOfSelectedValues2 : input DataArrayDouble is NULL !");
+    throw INTERP_KERNEL::Exception("DataArrayDouble::setContigPartOfSelectedValues2 : input DataArray aBase is not a DataArrayDouble !");
   checkAllocated();
   a->checkAllocated();
   int nbOfComp=getNumberOfComponents();
@@ -2941,6 +2986,29 @@ double DataArrayDouble::getMinValue2(DataArrayInt*& tupleIds) const throw(INTERP
   return ret;
 }
 
+/*!
+ * This method returns the number of values in \a this that are equals ( within an absolute precision of \a eps ) to input parameter \a value.
+ * This method only works for single component array.
+ *
+ * \return a value in [ 0, \c this->getNumberOfTuples() )
+ *
+ * \throw If \a this is not allocated
+ *
+ */
+int DataArrayDouble::count(double value, double eps) const throw(INTERP_KERNEL::Exception)
+{
+  int ret=0;
+  checkAllocated();
+  if(getNumberOfComponents()!=1)
+    throw INTERP_KERNEL::Exception("DataArrayDouble::count : must be applied on DataArrayDouble with only one component, you can call 'rearrange' method before !");
+  const double *vals=begin();
+  int nbOfTuples=getNumberOfTuples();
+  for(int i=0;i<nbOfTuples;i++,vals++)
+    if(fabs(*vals-value)<=eps)
+      ret++;
+  return ret;
+}
+
 /*!
  * Returns the average value of \a this one-dimensional array.
  *  \return double - the average value over all values of \a this array.
@@ -3076,6 +3144,66 @@ double DataArrayDouble::accumulate(int compId) const throw(INTERP_KERNEL::Except
   return ret;
 }
 
+/*!
+ * This method accumulate using addition tuples in \a this using input index array [ \a bgOfIndex, \a endOfIndex ).
+ * The returned array will have same number of components than \a this and number of tuples equal to
+ * \c std::distance(bgOfIndex,endOfIndex) \b minus \b one.
+ *
+ * The input index array is expected to be ascendingly sorted in which the all referenced ids should be in [0, \c this->getNumberOfTuples).
+ * This method is quite useful for users that need to put a field on cells to field on nodes on the same mesh without a need of conservation.
+ *
+ * \param [in] bgOfIndex - begin (included) of the input index array.
+ * \param [in] endOfIndex - end (excluded) of the input index array.
+ * \return DataArrayDouble * - the new instance having the same number of components than \a this.
+ * 
+ * \throw If bgOfIndex or end is NULL.
+ * \throw If input index array is not ascendingly sorted.
+ * \throw If there is an id in [ \a bgOfIndex, \a endOfIndex ) not in [0, \c this->getNumberOfTuples).
+ * \throw If std::distance(bgOfIndex,endOfIndex)==0.
+ */
+DataArrayDouble *DataArrayDouble::accumulatePerChunck(const int *bgOfIndex, const int *endOfIndex) const throw(INTERP_KERNEL::Exception)
+{
+  if(!bgOfIndex || !endOfIndex)
+    throw INTERP_KERNEL::Exception("DataArrayDouble::accumulatePerChunck : input pointer NULL !");
+  checkAllocated();
+  int nbCompo=getNumberOfComponents();
+  int nbOfTuples=getNumberOfTuples();
+  int sz=(int)std::distance(bgOfIndex,endOfIndex);
+  if(sz<1)
+    throw INTERP_KERNEL::Exception("DataArrayDouble::accumulatePerChunck : invalid size of input index array !");
+  sz--;
+  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New(); ret->alloc(sz,nbCompo);
+  const int *w=bgOfIndex;
+  if(*w<0 || *w>=nbOfTuples)
+    throw INTERP_KERNEL::Exception("DataArrayDouble::accumulatePerChunck : The first element of the input index not in [0,nbOfTuples) !");
+  const double *srcPt=begin()+(*w)*nbCompo;
+  double *tmp=ret->getPointer();
+  for(int i=0;i<sz;i++,tmp+=nbCompo,w++)
+    {
+      std::fill(tmp,tmp+nbCompo,0.);
+      if(w[1]>=w[0])
+        {
+          for(int j=w[0];j<w[1];j++,srcPt+=nbCompo)
+            {
+              if(j>=0 && j<nbOfTuples)
+                std::transform(srcPt,srcPt+nbCompo,tmp,tmp,std::plus<double>());
+              else
+                {
+                  std::ostringstream oss; oss << "DataArrayDouble::accumulatePerChunck : At rank #" << i << " the input index array points to id " << j << " should be in [0," << nbOfTuples << ") !";
+                  throw INTERP_KERNEL::Exception(oss.str().c_str());
+                }
+            }
+        }
+      else
+        {
+          std::ostringstream oss; oss << "DataArrayDouble::accumulatePerChunck : At rank #" << i << " the input index array is not in ascendingly sorted.";
+          throw INTERP_KERNEL::Exception(oss.str().c_str());
+        }
+    }
+  ret->copyStringInfoFrom(*this);
+  return ret.retn();
+}
+
 /*!
  * 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 
@@ -3449,19 +3577,53 @@ DataArrayDouble *DataArrayDouble::magnitude() const throw(INTERP_KERNEL::Excepti
  *          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::maxPerTupleWithCompoId
  */
 DataArrayDouble *DataArrayDouble::maxPerTuple() const throw(INTERP_KERNEL::Exception)
 {
   checkAllocated();
   int nbOfComp=getNumberOfComponents();
-  DataArrayDouble *ret=DataArrayDouble::New();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
   int nbOfTuple=getNumberOfTuples();
   ret->alloc(nbOfTuple,1);
   const double *src=getConstPointer();
   double *dest=ret->getPointer();
   for(int i=0;i<nbOfTuple;i++,dest++,src+=nbOfComp)
     *dest=*std::max_element(src,src+nbOfComp);
-  return ret;
+  return ret.retn();
+}
+
+/*!
+ * Computes the maximal value within every tuple of \a this array and it returns the first component
+ * id for each tuple that corresponds to the maximal value within the tuple.
+ * 
+ *  \param [out] compoIdOfMaxPerTuple - the new new instance of DataArrayInt containing the
+ *          same number of tuples and only one component.
+ *  \return DataArrayDouble * - the new instance of DataArrayDouble containing the
+ *          same number of tuples as \a this array and one component.
+ *          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::maxPerTuple
+ */
+DataArrayDouble *DataArrayDouble::maxPerTupleWithCompoId(DataArrayInt* &compoIdOfMaxPerTuple) const throw(INTERP_KERNEL::Exception)
+{
+  checkAllocated();
+  int nbOfComp=getNumberOfComponents();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret0=DataArrayDouble::New();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret1=DataArrayInt::New();
+  int nbOfTuple=getNumberOfTuples();
+  ret0->alloc(nbOfTuple,1); ret1->alloc(nbOfTuple,1);
+  const double *src=getConstPointer();
+  double *dest=ret0->getPointer(); int *dest1=ret1->getPointer();
+  for(int i=0;i<nbOfTuple;i++,dest++,dest1++,src+=nbOfComp)
+    {
+      const double *loc=std::max_element(src,src+nbOfComp);
+      *dest=*loc;
+      *dest1=(int)std::distance(src,loc);
+    }
+  compoIdOfMaxPerTuple=ret1.retn();
+  return ret0.retn();
 }
 
 /*!
@@ -4030,8 +4192,8 @@ DataArrayDoubleIterator *DataArrayDouble::iterator() throw(INTERP_KERNEL::Except
 /*!
  * Returns a new DataArrayInt contating indices of tuples of \a this one-dimensional
  * array whose values are within a given range. Textual data is not copied.
- *  \param [in] vmin - a lowest acceptable value.
- *  \param [in] vmax - a greatest acceptable value.
+ *  \param [in] vmin - a lowest acceptable value (included).
+ *  \param [in] vmax - a greatest acceptable value (included).
  *  \return DataArrayInt * - the new instance of DataArrayInt.
  *          The caller is to delete this result array using decrRef() as it is no more
  *          needed.
@@ -5210,32 +5372,6 @@ std::size_t DataArrayInt::getHeapMemorySize() const
   return DataArray::getHeapMemorySize()+sz;
 }
 
-/*!
- * Sets information on all components. This method can change number of components
- * at certain conditions; if the conditions are not respected, an exception is thrown.
- * The number of components can be changed provided that \a this is not allocated.
- *
- * To know more on format of the component information see
- * \ref MEDCouplingArrayBasicsCompoName "DataArrays infos".
- *  \param [in] info - a vector of component infos.
- *  \throw If \a this->getNumberOfComponents() != \a info.size() && \a this->isAllocated()
- */
-void DataArrayInt::setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception)
-{
-  if(getNumberOfComponents()!=(int)info.size())
-    {
-      if(!isAllocated())
-        _info_on_compo=info;
-      else
-        {
-          std::ostringstream oss; oss << "DataArrayInt::setInfoAndChangeNbOfCompo : input is of size " << info.size() << " whereas number of components is equal to " << getNumberOfComponents() << "  and this is already allocated !";
-          throw INTERP_KERNEL::Exception(oss.str().c_str());
-        }
-    }
-  else
-    _info_on_compo=info;
-}
-
 /*!
  * Returns the only one value in \a this, if and only if number of elements
  * (nb of tuples * nb of components) is equal to 1, and that \a this is allocated.
@@ -6168,7 +6304,7 @@ DataArrayInt *DataArrayInt::fromNoInterlace() const throw(INTERP_KERNEL::Excepti
     throw INTERP_KERNEL::Exception("DataArrayInt::fromNoInterlace : Not defined array !");
   int *tab=_mem.fromNoInterlace(getNumberOfComponents());
   DataArrayInt *ret=DataArrayInt::New();
-  ret->useArray(tab,true,CPP_DEALLOC,getNumberOfTuples(),getNumberOfComponents());
+  ret->useArray(tab,true,C_DEALLOC,getNumberOfTuples(),getNumberOfComponents());
   return ret;
 }
 
@@ -6189,7 +6325,7 @@ DataArrayInt *DataArrayInt::toNoInterlace() const throw(INTERP_KERNEL::Exception
     throw INTERP_KERNEL::Exception("DataArrayInt::toNoInterlace : Not defined array !");
   int *tab=_mem.toNoInterlace(getNumberOfComponents());
   DataArrayInt *ret=DataArrayInt::New();
-  ret->useArray(tab,true,CPP_DEALLOC,getNumberOfTuples(),getNumberOfComponents());
+  ret->useArray(tab,true,C_DEALLOC,getNumberOfTuples(),getNumberOfComponents());
   return ret;
 }
 
@@ -6440,7 +6576,7 @@ DataArrayInt *DataArrayInt::selectByTupleId2(int bg, int end2, int step) const t
  *  \throw If \a end > \a this->getNumberOfTuples().
  *  \throw If \a this is not allocated.
  */
-DataArrayInt *DataArrayInt::selectByTupleRanges(const std::vector<std::pair<int,int> >& ranges) const throw(INTERP_KERNEL::Exception)
+DataArray *DataArrayInt::selectByTupleRanges(const std::vector<std::pair<int,int> >& ranges) const throw(INTERP_KERNEL::Exception)
 {
   checkAllocated();
   int nbOfComp=getNumberOfComponents();
@@ -6515,7 +6651,7 @@ DataArrayInt *DataArrayInt::checkAndPreparePermutation() const throw(INTERP_KERN
   const int *pt=getConstPointer();
   int *pt2=CheckAndPreparePermutation(pt,pt+nbTuples);
   DataArrayInt *ret=DataArrayInt::New();
-  ret->useArray(pt2,true,CPP_DEALLOC,nbTuples,1);
+  ret->useArray(pt2,true,C_DEALLOC,nbTuples,1);
   return ret;
 }
 
@@ -6918,7 +7054,7 @@ void DataArrayInt::reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception)
  *
  *  \ref py_mcdataarrayint_keepselectedcomponents "Here is a Python example".
  */
-DataArrayInt *DataArrayInt::keepSelectedComponents(const std::vector<int>& compoIds) const throw(INTERP_KERNEL::Exception)
+DataArray *DataArrayInt::keepSelectedComponents(const std::vector<int>& compoIds) const throw(INTERP_KERNEL::Exception)
 {
   checkAllocated();
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret(DataArrayInt::New());
@@ -6960,7 +7096,7 @@ void DataArrayInt::meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exce
     throw INTERP_KERNEL::Exception("DataArrayInt::meldWith : mismatch of number of tuples !");
   int nbOfComp1=getNumberOfComponents();
   int nbOfComp2=other->getNumberOfComponents();
-  int *newArr=new int[nbOfTuples*(nbOfComp1+nbOfComp2)];
+  int *newArr=(int *)malloc(nbOfTuples*(nbOfComp1+nbOfComp2)*sizeof(int));
   int *w=newArr;
   const int *inp1=getConstPointer();
   const int *inp2=other->getConstPointer();
@@ -6969,7 +7105,7 @@ void DataArrayInt::meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exce
       w=std::copy(inp1,inp1+nbOfComp1,w);
       w=std::copy(inp2,inp2+nbOfComp2,w);
     }
-  useArray(newArr,true,CPP_DEALLOC,nbOfTuples,nbOfComp1+nbOfComp2);
+  useArray(newArr,true,C_DEALLOC,nbOfTuples,nbOfComp1+nbOfComp2);
   std::vector<int> compIds(nbOfComp2);
   for(int i=0;i<nbOfComp2;i++)
     compIds[i]=nbOfComp1+i;
@@ -7521,8 +7657,13 @@ void DataArrayInt::setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt
  *  \throw If any tuple index given by \a tuplesSelec is out of a valid range for 
  *         \a a array.
  */
-void DataArrayInt::setContigPartOfSelectedValues(int tupleIdStart, const DataArrayInt*a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception)
+void DataArrayInt::setContigPartOfSelectedValues(int tupleIdStart, const DataArray *aBase, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception)
 {
+  if(!aBase || !tuplesSelec)
+    throw INTERP_KERNEL::Exception("DataArrayInt::setContigPartOfSelectedValues : input DataArray is NULL !");
+  const DataArrayInt *a=dynamic_cast<const DataArrayInt *>(aBase);
+  if(!a)
+    throw INTERP_KERNEL::Exception("DataArrayInt::setContigPartOfSelectedValues : input DataArray aBase is not a DataArrayInt !");
   checkAllocated();
   a->checkAllocated();
   tuplesSelec->checkAllocated();
@@ -7578,8 +7719,13 @@ void DataArrayInt::setContigPartOfSelectedValues(int tupleIdStart, const DataArr
  *            non-empty range of increasing indices or indices are out of a valid range
  *            for the array \a a.
  */
-void DataArrayInt::setContigPartOfSelectedValues2(int tupleIdStart, const DataArrayInt *a, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
+void DataArrayInt::setContigPartOfSelectedValues2(int tupleIdStart, const DataArray *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
 {
+  if(!aBase)
+    throw INTERP_KERNEL::Exception("DataArrayInt::setContigPartOfSelectedValues2 : input DataArray is NULL !");
+  const DataArrayInt *a=dynamic_cast<const DataArrayInt *>(aBase);
+  if(!a)
+    throw INTERP_KERNEL::Exception("DataArrayInt::setContigPartOfSelectedValues2 : input DataArray aBase is not a DataArrayInt !");
   checkAllocated();
   a->checkAllocated();
   int nbOfComp=getNumberOfComponents();
@@ -7893,6 +8039,29 @@ int DataArrayInt::locateValue(const std::vector<int>& vals) const throw(INTERP_K
   return -1;
 }
 
+/*!
+ * This method returns the number of values in \a this that are equals to input parameter \a value.
+ * This method only works for single component array.
+ *
+ * \return a value in [ 0, \c this->getNumberOfTuples() )
+ *
+ * \throw If \a this is not allocated
+ *
+ */
+int DataArrayInt::count(int value) const throw(INTERP_KERNEL::Exception)
+{
+  int ret=0;
+  checkAllocated();
+  if(getNumberOfComponents()!=1)
+    throw INTERP_KERNEL::Exception("DataArrayInt::count : must be applied on DataArrayInt with only one component, you can call 'rearrange' method before !");
+  const int *vals=begin();
+  int nbOfTuples=getNumberOfTuples();
+  for(int i=0;i<nbOfTuples;i++,vals++)
+    if(*vals==value)
+      ret++;
+  return ret;
+}
+
 /*!
  * This method is an extension of DataArrayInt::presenceOfValue method because this method works for DataArrayInt with
  * any number of components excepted 0 (an INTERP_KERNEL::Exception is thrown in this case).
@@ -7963,6 +8132,65 @@ int DataArrayInt::accumulate(int compId) const throw(INTERP_KERNEL::Exception)
   return ret;
 }
 
+/*!
+ * This method accumulate using addition tuples in \a this using input index array [ \a bgOfIndex, \a endOfIndex ).
+ * The returned array will have same number of components than \a this and number of tuples equal to
+ * \c std::distance(bgOfIndex,endOfIndex) \b minus \b one.
+ *
+ * The input index array is expected to be ascendingly sorted in which the all referenced ids should be in [0, \c this->getNumberOfTuples).
+ *
+ * \param [in] bgOfIndex - begin (included) of the input index array.
+ * \param [in] endOfIndex - end (excluded) of the input index array.
+ * \return DataArrayInt * - the new instance having the same number of components than \a this.
+ * 
+ * \throw If bgOfIndex or end is NULL.
+ * \throw If input index array is not ascendingly sorted.
+ * \throw If there is an id in [ \a bgOfIndex, \a endOfIndex ) not in [0, \c this->getNumberOfTuples).
+ * \throw If std::distance(bgOfIndex,endOfIndex)==0.
+ */
+DataArrayInt *DataArrayInt::accumulatePerChunck(const int *bgOfIndex, const int *endOfIndex) const throw(INTERP_KERNEL::Exception)
+{
+  if(!bgOfIndex || !endOfIndex)
+    throw INTERP_KERNEL::Exception("DataArrayInt::accumulatePerChunck : input pointer NULL !");
+  checkAllocated();
+  int nbCompo=getNumberOfComponents();
+  int nbOfTuples=getNumberOfTuples();
+  int sz=(int)std::distance(bgOfIndex,endOfIndex);
+  if(sz<1)
+    throw INTERP_KERNEL::Exception("DataArrayInt::accumulatePerChunck : invalid size of input index array !");
+  sz--;
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(sz,nbCompo);
+  const int *w=bgOfIndex;
+  if(*w<0 || *w>=nbOfTuples)
+    throw INTERP_KERNEL::Exception("DataArrayInt::accumulatePerChunck : The first element of the input index not in [0,nbOfTuples) !");
+  const int *srcPt=begin()+(*w)*nbCompo;
+  int *tmp=ret->getPointer();
+  for(int i=0;i<sz;i++,tmp+=nbCompo,w++)
+    {
+      std::fill(tmp,tmp+nbCompo,0.);
+      if(w[1]>=w[0])
+        {
+          for(int j=w[0];j<w[1];j++,srcPt+=nbCompo)
+            {
+              if(j>=0 && j<nbOfTuples)
+                std::transform(srcPt,srcPt+nbCompo,tmp,tmp,std::plus<int>());
+              else
+                {
+                  std::ostringstream oss; oss << "DataArrayInt::accumulatePerChunck : At rank #" << i << " the input index array points to id " << j << " should be in [0," << nbOfTuples << ") !";
+                  throw INTERP_KERNEL::Exception(oss.str().c_str());
+                }
+            }
+        }
+      else
+        {
+          std::ostringstream oss; oss << "DataArrayInt::accumulatePerChunck : At rank #" << i << " the input index array is not in ascendingly sorted.";
+          throw INTERP_KERNEL::Exception(oss.str().c_str());
+        }
+    }
+  ret->copyStringInfoFrom(*this);
+  return ret.retn();
+}
+
 /*!
  * Returns a new DataArrayInt by concatenating two given arrays, so that (1) the number
  * of tuples in the result array is <em> a1->getNumberOfTuples() + a2->getNumberOfTuples() -
@@ -8039,7 +8267,7 @@ DataArrayInt *DataArrayInt::Aggregate(const std::vector<const DataArrayInt *>& a
 /*!
  * Returns the maximal value and its location within \a this one-dimensional array.
  *  \param [out] tupleId - index of the tuple holding the maximal value.
- *  \return double - the maximal value among all values of \a this array.
+ *  \return int - the maximal value among all values of \a this array.
  *  \throw If \a this->getNumberOfComponents() != 1
  *  \throw If \a this->getNumberOfTuples() < 1
  */
@@ -8246,8 +8474,8 @@ void DataArrayInt::applyModulus(int val) throw(INTERP_KERNEL::Exception)
  * This method returns a newly allocated array storing stored ascendantly tuple ids in \b this so that
  * this[*id] in [\b vmin,\b vmax)
  * 
- * \param [in] vmin begin of range. This value is included in range.
- * \param [out] vmax end of range. This value is \b not included in range.
+ * \param [in] vmin begin of range. This value is included in range (included).
+ * \param [out] vmax end of range. This value is \b not included in range (excluded).
  * \return a newly allocated data array that the caller should deal with.
  */
 DataArrayInt *DataArrayInt::getIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception)
@@ -8518,14 +8746,13 @@ DataArrayInt *DataArrayInt::MakePartition(const std::vector<const DataArrayInt *
 
 /*!
  * Returns a new DataArrayInt which contains all elements of given one-dimensional
- * not negative arrays. The result array does not contain any duplicates and its values
+ * arrays. The result array does not contain any duplicates and its values
  * are sorted in ascending order.
  *  \param [in] arr - sequence of DataArrayInt's to unite.
  *  \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this
  *         array using decrRef() as it is no more needed.
  *  \throw If any \a arr[i] is not allocated.
  *  \throw If \a arr[i]->getNumberOfComponents() != 1.
- *  \throw If any value of \a arr[i] is negative.
  */
 DataArrayInt *DataArrayInt::BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception)
 {
@@ -8533,17 +8760,12 @@ DataArrayInt *DataArrayInt::BuildUnion(const std::vector<const DataArrayInt *>&
   for(std::vector<const DataArrayInt *>::const_iterator it4=arr.begin();it4!=arr.end();it4++)
     if(*it4)
       a.push_back(*it4);
-  int valm=std::numeric_limits<int>::max();
   for(std::vector<const DataArrayInt *>::const_iterator it=a.begin();it!=a.end();it++)
     {
       (*it)->checkAllocated();
       if((*it)->getNumberOfComponents()!=1)
         throw INTERP_KERNEL::Exception("DataArrayInt::BuildUnion : only single component allowed !");
-      int tmp1;
-      valm=std::min((*it)->getMinValue(tmp1),valm);
     }
-  if(valm<0)
-    throw INTERP_KERNEL::Exception("DataArrayInt::BuildUnion : a negative value has been detected !");
   //
   std::set<int> r;
   for(std::vector<const DataArrayInt *>::const_iterator it=a.begin();it!=a.end();it++)
@@ -8560,14 +8782,13 @@ DataArrayInt *DataArrayInt::BuildUnion(const std::vector<const DataArrayInt *>&
 
 /*!
  * Returns a new DataArrayInt which contains elements present in each of given one-dimensional
- * not negative arrays. The result array does not contain any duplicates and its values
+ * arrays. The result array does not contain any duplicates and its values
  * are sorted in ascending order.
  *  \param [in] arr - sequence of DataArrayInt's to intersect.
  *  \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this
  *         array using decrRef() as it is no more needed.
  *  \throw If any \a arr[i] is not allocated.
  *  \throw If \a arr[i]->getNumberOfComponents() != 1.
- *  \throw If any value of \a arr[i] < 0.
  */
 DataArrayInt *DataArrayInt::BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception)
 {
@@ -8575,17 +8796,12 @@ DataArrayInt *DataArrayInt::BuildIntersection(const std::vector<const DataArrayI
   for(std::vector<const DataArrayInt *>::const_iterator it4=arr.begin();it4!=arr.end();it4++)
     if(*it4)
       a.push_back(*it4);
-  int valm=std::numeric_limits<int>::max();
   for(std::vector<const DataArrayInt *>::const_iterator it=a.begin();it!=a.end();it++)
     {
       (*it)->checkAllocated();
       if((*it)->getNumberOfComponents()!=1)
         throw INTERP_KERNEL::Exception("DataArrayInt::BuildIntersection : only single component allowed !");
-      int tmp1;
-      valm=std::min((*it)->getMinValue(tmp1),valm);
     }
-  if(valm<0)
-    throw INTERP_KERNEL::Exception("DataArrayInt::BuildIntersection : a negative value has been detected !");
   //
   std::set<int> r;
   for(std::vector<const DataArrayInt *>::const_iterator it=a.begin();it!=a.end();it++)
@@ -8711,7 +8927,7 @@ DataArrayInt *DataArrayInt::buildSubstractionOptimized(const DataArrayInt *other
 
 /*!
  * Returns a new DataArrayInt which contains all elements of \a this and a given
- * one-dimensional not negative arrays. The result array does not contain any duplicates
+ * 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
@@ -8719,7 +8935,6 @@ DataArrayInt *DataArrayInt::buildSubstractionOptimized(const DataArrayInt *other
  *  \throw If \a this or \a other is not allocated.
  *  \throw If \a this->getNumberOfComponents() != 1.
  *  \throw If \a other->getNumberOfComponents() != 1.
- *  \throw If any value of \a this or \a other is negative.
  */
 DataArrayInt *DataArrayInt::buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception)
 {
@@ -8731,7 +8946,7 @@ DataArrayInt *DataArrayInt::buildUnion(const DataArrayInt *other) const throw(IN
 
 /*!
  * Returns a new DataArrayInt which contains elements present in both \a this and a given
- * one-dimensional not negative arrays. The result array does not contain any duplicates
+ * 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
@@ -8739,7 +8954,6 @@ DataArrayInt *DataArrayInt::buildUnion(const DataArrayInt *other) const throw(IN
  *  \throw If \a this or \a other is not allocated.
  *  \throw If \a this->getNumberOfComponents() != 1.
  *  \throw If \a other->getNumberOfComponents() != 1.
- *  \throw If any value of \a this or \a other is negative.
  */
 DataArrayInt *DataArrayInt::buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception)
 {
@@ -8864,14 +9078,14 @@ void DataArrayInt::computeOffsets2() throw(INTERP_KERNEL::Exception)
   if(getNumberOfComponents()!=1)
     throw INTERP_KERNEL::Exception("DataArrayInt::computeOffsets2 : only single component allowed !");
   int nbOfTuples=getNumberOfTuples();
-  int *ret=new int[nbOfTuples+1];
+  int *ret=(int *)malloc((nbOfTuples+1)*sizeof(int));
   if(nbOfTuples==0)
     return ;
   const int *work=getConstPointer();
   ret[0]=0;
   for(int i=0;i<nbOfTuples;i++)
     ret[i+1]=work[i]+ret[i];
-  useArray(ret,true,CPP_DEALLOC,nbOfTuples+1,1);
+  useArray(ret,true,C_DEALLOC,nbOfTuples+1,1);
   declareAsNew();
 }
 
@@ -10016,19 +10230,22 @@ void DataArrayInt::powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exce
 int *DataArrayInt::CheckAndPreparePermutation(const int *start, const int *end)
 {
   std::size_t sz=std::distance(start,end);
-  int *ret=new int[sz];
+  int *ret=(int *)malloc(sz*sizeof(int));
   int *work=new int[sz];
   std::copy(start,end,work);
   std::sort(work,work+sz);
   if(std::unique(work,work+sz)!=work+sz)
     {
       delete [] work;
-      delete [] ret;
+      free(ret);
       throw INTERP_KERNEL::Exception("Some elements are equals in the specified array !");
     }
+  std::map<int,int> m;
+  for(int *workPt=work;workPt!=work+sz;workPt++)
+    m[*workPt]=(int)std::distance(work,workPt);
   int *iter2=ret;
   for(const int *iter=start;iter!=end;iter++,iter2++)
-    *iter2=(int)std::distance(work,std::find(work,work+sz,*iter));
+    *iter2=m[*iter];
   delete [] work;
   return ret;
 }
index f42d1a32deb0640d883ea30e67f8cca1d14ea610..64727c30c33ef58c8ed92bf24d13cff21584df08 100644 (file)
@@ -91,6 +91,7 @@ namespace ParaMEDMEM
     Deallocator getDeallocator() const { return _dealloc; }
     void setSpecificDeallocator(Deallocator dealloc) { _dealloc=dealloc; }
     void setParameterForDeallocator(void *param) { _param_for_deallocator=param; }
+    void *getParameterForDeallocator() const { return _param_for_deallocator; }
     void destroy();
     ~MemArray() { destroy(); }
   public:
@@ -108,6 +109,8 @@ namespace ParaMEDMEM
     void *_param_for_deallocator;
   };
 
+  class DataArrayInt;
+
   class DataArray : public RefCountObject, public TimeLabel
   {
   public:
@@ -123,6 +126,7 @@ namespace ParaMEDMEM
     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) throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT std::vector<std::string> getVarsOnComponent() const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT std::vector<std::string> getUnitsOnComponent() const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
@@ -130,14 +134,24 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void setInfoOnComponent(int i, const char *info) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT int getNumberOfComponents() const { return (int)_info_on_compo.size(); }
+    MEDCOUPLING_EXPORT virtual bool isAllocated() const throw(INTERP_KERNEL::Exception) = 0;
+    MEDCOUPLING_EXPORT virtual void checkAllocated() const throw(INTERP_KERNEL::Exception) = 0;
     MEDCOUPLING_EXPORT virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception) = 0;
     MEDCOUPLING_EXPORT virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception) = 0;
     MEDCOUPLING_EXPORT virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception) = 0;
+    MEDCOUPLING_EXPORT virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception) = 0;
+    MEDCOUPLING_EXPORT virtual void renumberInPlace(const int *old2New) throw(INTERP_KERNEL::Exception) = 0;
+    MEDCOUPLING_EXPORT virtual void renumberInPlaceR(const int *new2Old) throw(INTERP_KERNEL::Exception) = 0;
+    MEDCOUPLING_EXPORT virtual void setContigPartOfSelectedValues(int tupleIdStart, const DataArray *aBase, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception) = 0;
+    MEDCOUPLING_EXPORT virtual void setContigPartOfSelectedValues2(int tupleIdStart, const DataArray *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception) = 0;
+    MEDCOUPLING_EXPORT virtual DataArray *selectByTupleRanges(const std::vector<std::pair<int,int> >& ranges) const throw(INTERP_KERNEL::Exception) = 0;
+    MEDCOUPLING_EXPORT virtual DataArray *keepSelectedComponents(const std::vector<int>& compoIds) const throw(INTERP_KERNEL::Exception) = 0;
     MEDCOUPLING_EXPORT void checkNbOfTuples(int nbOfTuples, const char *msg) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void checkNbOfComps(int nbOfCompo, const char *msg) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void checkNbOfTuplesAndComp(const DataArray& other, const char *msg) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const char *msg) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void checkNbOfElems(std::size_t nbOfElems, const char *msg) const throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT static void GetSlice(int start, int stop, int step, int sliceId, int nbOfSlices, int& startSlice, int& stopSlice) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT static int GetNumberOfItemGivenBES(int begin, int end, int step, const char *msg) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const char *msg) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
@@ -178,7 +192,6 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT int getNumberOfTuples() const throw(INTERP_KERNEL::Exception) { return _info_on_compo.empty()?0:_mem.getNbOfElem()/getNumberOfComponents(); }
     MEDCOUPLING_EXPORT std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception) { return _mem.getNbOfElem(); }
     MEDCOUPLING_EXPORT std::size_t getHeapMemorySize() const;
-    MEDCOUPLING_EXPORT void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT double doubleValue() const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT bool empty() const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT DataArrayDouble *deepCpy() const throw(INTERP_KERNEL::Exception);
@@ -225,12 +238,12 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleId(const int *new2OldBg, const int *new2OldEnd) const;
     MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleId2(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
-    MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleRanges(const std::vector<std::pair<int,int> >& ranges) const throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT DataArray *selectByTupleRanges(const std::vector<std::pair<int,int> >& ranges) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT DataArrayDouble *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void transpose() throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
-    MEDCOUPLING_EXPORT DataArrayDouble *keepSelectedComponents(const std::vector<int>& compoIds) const throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT DataArray *keepSelectedComponents(const std::vector<int>& compoIds) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void findCommonTuples(double prec, int limitTupleId, DataArrayInt *&comm, DataArrayInt *&commIndex) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT double minimalDistanceTo(const DataArrayDouble *other, int& thisTupleId, int& otherTupleId) const throw(INTERP_KERNEL::Exception);
@@ -247,8 +260,8 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT void setPartOfValues4(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void setPartOfValuesSimple4(double a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
-    MEDCOUPLING_EXPORT void setContigPartOfSelectedValues(int tupleIdStart, const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
-    MEDCOUPLING_EXPORT void setContigPartOfSelectedValues2(int tupleIdStart, const DataArrayDouble *a, int bg, int end2, int step) throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT void setContigPartOfSelectedValues(int tupleIdStart, const DataArray *aBase, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT void setContigPartOfSelectedValues2(int tupleIdStart, const DataArray *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void getTuple(int tupleId, double *res) const throw(INTERP_KERNEL::Exception) { std::copy(_mem.getConstPointerLoc(tupleId*_info_on_compo.size()),_mem.getConstPointerLoc((tupleId+1)*_info_on_compo.size()),res); }
     MEDCOUPLING_EXPORT double getIJ(int tupleId, int compoId) const { return _mem[tupleId*_info_on_compo.size()+compoId]; }
     MEDCOUPLING_EXPORT double back() const throw(INTERP_KERNEL::Exception);
@@ -277,11 +290,13 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT double getMaxValue2(DataArrayInt*& tupleIds) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT double getMinValue2(DataArrayInt*& tupleIds) const throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT double getAverageValue() const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT double norm2() const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT double normMax() const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void accumulate(double *res) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT DataArrayDouble *accumulatePerChunck(const int *bgOfIndex, const int *endOfIndex) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT double distanceToTuple(const double *tupleBg, const double *tupleEnd, int& tupleId) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
@@ -295,6 +310,7 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT DataArrayDouble *maxPerTupleWithCompoId(DataArrayInt* &compoIdOfMaxPerTuple) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
@@ -396,7 +412,6 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT int getNumberOfTuples() const throw(INTERP_KERNEL::Exception) { return _info_on_compo.empty()?0:_mem.getNbOfElem()/getNumberOfComponents(); }
     MEDCOUPLING_EXPORT std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception) { return _mem.getNbOfElem(); }
     MEDCOUPLING_EXPORT std::size_t getHeapMemorySize() const;
-    MEDCOUPLING_EXPORT void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT int intValue() const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT int getHashCode() const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT bool empty() const throw(INTERP_KERNEL::Exception);
@@ -454,7 +469,7 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT DataArrayInt *selectByTupleId(const int *new2OldBg, const int *new2OldEnd) const;
     MEDCOUPLING_EXPORT DataArrayInt *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT DataArrayInt *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
-    MEDCOUPLING_EXPORT DataArrayInt *selectByTupleRanges(const std::vector<std::pair<int,int> >& ranges) const throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT DataArray *selectByTupleRanges(const std::vector<std::pair<int,int> >& ranges) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void changeSurjectiveFormat(int targetNb, DataArrayInt *&arr, DataArrayInt *&arrI) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT static DataArrayInt *BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTuples, const int *arr, const int *arrIBg, const int *arrIEnd, int &newNbOfTuples) throw(INTERP_KERNEL::Exception);
@@ -465,7 +480,7 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void transpose() throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
-    MEDCOUPLING_EXPORT DataArrayInt *keepSelectedComponents(const std::vector<int>& compoIds) const throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT DataArray *keepSelectedComponents(const std::vector<int>& compoIds) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void setSelectedComponents(const DataArrayInt *a, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
@@ -477,8 +492,8 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT void setPartOfValues4(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void setPartOfValuesSimple4(int a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
-    MEDCOUPLING_EXPORT void setContigPartOfSelectedValues(int tupleIdStart, const DataArrayInt*a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
-    MEDCOUPLING_EXPORT void setContigPartOfSelectedValues2(int tupleIdStart, const DataArrayInt *a, int bg, int end2, int step) throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT void setContigPartOfSelectedValues(int tupleIdStart, const DataArray *aBase, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT void setContigPartOfSelectedValues2(int tupleIdStart, const DataArray *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception) { std::copy(_mem.getConstPointerLoc(tupleId*_info_on_compo.size()),_mem.getConstPointerLoc((tupleId+1)*_info_on_compo.size()),res); }
     MEDCOUPLING_EXPORT int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception) { return _mem[tupleId*_info_on_compo.size()+compoId]; }
     MEDCOUPLING_EXPORT int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
@@ -503,8 +518,10 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT int count(int value) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void accumulate(int *res) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT DataArrayInt *accumulatePerChunck(const int *bgOfIndex, const int *endOfIndex) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
@@ -613,12 +630,12 @@ namespace ParaMEDMEM
   {
   public:
     MEDCOUPLING_EXPORT virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception) = 0;
+    MEDCOUPLING_EXPORT virtual DataArrayChar *deepCpy() const = 0;
     MEDCOUPLING_EXPORT bool isAllocated() const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void checkAllocated() const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT int getNumberOfTuples() const throw(INTERP_KERNEL::Exception) { return _info_on_compo.empty()?0:_mem.getNbOfElem()/getNumberOfComponents(); }
     MEDCOUPLING_EXPORT std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception) { return _mem.getNbOfElem(); }
     MEDCOUPLING_EXPORT std::size_t getHeapMemorySize() const;
-    MEDCOUPLING_EXPORT void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT int getHashCode() const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT bool empty() const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void cpyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
@@ -651,7 +668,7 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT DataArrayChar *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
-    MEDCOUPLING_EXPORT DataArrayChar *keepSelectedComponents(const std::vector<int>& compoIds) const throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT DataArray *keepSelectedComponents(const std::vector<int>& compoIds) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void setPartOfValues1(const DataArrayChar *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void setPartOfValuesSimple1(char a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
@@ -662,6 +679,9 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT void setPartOfValues4(const DataArrayChar *a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void setPartOfValuesSimple4(char a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayChar *tuplesSelec) throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT void setContigPartOfSelectedValues(int tupleIdStart, const DataArray *aBase, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT void setContigPartOfSelectedValues2(int tupleIdStart, const DataArray *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT DataArray *selectByTupleRanges(const std::vector<std::pair<int,int> >& ranges) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT 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); }
     MEDCOUPLING_EXPORT char getIJ(int tupleId, int compoId) const { return _mem[tupleId*_info_on_compo.size()+compoId]; }
     MEDCOUPLING_EXPORT char getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
index 1cb03da77325a1365493f15d23a70d912084e765..39030643deffd907e9d8cd34c3ea5b0963671ad3 100644 (file)
@@ -27,6 +27,7 @@
 #include "InterpolationUtils.hxx"
 
 #include <sstream>
+#include <cstdlib>
 #include <algorithm>
 
 namespace ParaMEDMEM
@@ -51,9 +52,9 @@ namespace ParaMEDMEM
     if(!other._pointer.isNull())
       {
         _nb_of_elem_alloc=other._nb_of_elem;
-        T *pointer=new T[_nb_of_elem_alloc];
+        T *pointer=(T*)malloc(_nb_of_elem_alloc*sizeof(T));
         std::copy(other._pointer.getConstPointer(),other._pointer.getConstPointer()+other._nb_of_elem,pointer);
-        useArray(pointer,true,CPP_DEALLOC,other._nb_of_elem);
+        useArray(pointer,true,C_DEALLOC,other._nb_of_elem);
       }
   }
 
@@ -272,7 +273,7 @@ namespace ParaMEDMEM
       throw INTERP_KERNEL::Exception("MemArray<T>::fromNoInterlace : number of components must be > 0 !");
     const T *pt=_pointer.getConstPointer();
     std::size_t nbOfTuples=_nb_of_elem/nbOfComp;
-    T *ret=new T[_nb_of_elem];
+    T *ret=(T*)malloc(_nb_of_elem*sizeof(T));
     T *w=ret;
     for(std::size_t i=0;i<nbOfTuples;i++)
       for(int j=0;j<nbOfComp;j++,w++)
@@ -287,7 +288,7 @@ namespace ParaMEDMEM
       throw INTERP_KERNEL::Exception("MemArray<T>::toNoInterlace : number of components must be > 0 !");
     const T *pt=_pointer.getConstPointer();
     std::size_t nbOfTuples=_nb_of_elem/nbOfComp;
-    T *ret=new T[_nb_of_elem];
+    T *ret=(T*)malloc(_nb_of_elem*sizeof(T));
     T *w=ret;
     for(int i=0;i<nbOfComp;i++)
       for(std::size_t j=0;j<nbOfTuples;j++,w++)
@@ -340,9 +341,9 @@ namespace ParaMEDMEM
       throw INTERP_KERNEL::Exception("MemArray::alloc : request for negative length of data !");
     _nb_of_elem=nbOfElements;
     _nb_of_elem_alloc=nbOfElements;
-    _pointer.setInternal(new T[_nb_of_elem_alloc]);
+    _pointer.setInternal((T*)malloc(_nb_of_elem_alloc*sizeof(T)));
     _ownership=true;
-    _dealloc=CPPDeallocator;
+    _dealloc=CDeallocator;
   }
 
   /*!
@@ -361,7 +362,7 @@ namespace ParaMEDMEM
       throw INTERP_KERNEL::Exception("MemArray::reAlloc : request for negative length of data !");
     if(_nb_of_elem_alloc==newNbOfElements)
       return ;
-    T *pointer=new T[newNbOfElements];
+    T *pointer=(T*)malloc(newNbOfElements*sizeof(T));
     std::copy(_pointer.getConstPointer(),_pointer.getConstPointer()+std::min<std::size_t>(_nb_of_elem,newNbOfElements),pointer);
     if(_ownership)
       destroyPointer(const_cast<T *>(_pointer.getConstPointer()),_dealloc,_param_for_deallocator);//Do not use getPointer because in case of _external
@@ -369,7 +370,7 @@ namespace ParaMEDMEM
     _nb_of_elem=std::min<std::size_t>(_nb_of_elem,newNbOfElements);
     _nb_of_elem_alloc=newNbOfElements;
     _ownership=true;
-    _dealloc=CPPDeallocator;
+    _dealloc=CDeallocator;
     _param_for_deallocator=0;
   }
 
@@ -387,7 +388,7 @@ namespace ParaMEDMEM
       throw INTERP_KERNEL::Exception("MemArray::reAlloc : request for negative length of data !");
     if(_nb_of_elem==newNbOfElements)
       return ;
-    T *pointer=new T[newNbOfElements];
+    T *pointer=(T*)malloc(newNbOfElements*sizeof(T));
     std::copy(_pointer.getConstPointer(),_pointer.getConstPointer()+std::min<std::size_t>(_nb_of_elem,newNbOfElements),pointer);
     if(_ownership)
       destroyPointer(const_cast<T *>(_pointer.getConstPointer()),_dealloc,_param_for_deallocator);//Do not use getPointer because in case of _external
@@ -395,7 +396,7 @@ namespace ParaMEDMEM
     _nb_of_elem=newNbOfElements;
     _nb_of_elem_alloc=newNbOfElements;
     _ownership=true;
-    _dealloc=CPPDeallocator;
+    _dealloc=CDeallocator;
     _param_for_deallocator=0;
   }
 
index 2cb71a8bc3883542572cfef230259d1fed98dffa..ea09de283e413bda39ee52c1642c95dfb0450987 100644 (file)
@@ -56,32 +56,6 @@ std::size_t DataArrayChar::getHeapMemorySize() const
   return DataArray::getHeapMemorySize()+sz;
 }
 
-/*!
- * Sets information on all components. This method can change number of components
- * at certain conditions; if the conditions are not respected, an exception is thrown.
- * The number of components can be changed provided that \a this is not allocated.
- *
- * To know more on format of the component information see
- * \ref MEDCouplingArrayBasicsCompoName "DataArrays infos".
- *  \param [in] info - a vector of component infos.
- *  \throw If \a this->getNumberOfComponents() != \a info.size() && \a this->isAllocated()
- */
-void DataArrayChar::setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception)
-{
-  if(getNumberOfComponents()!=(int)info.size())
-    {
-      if(!isAllocated())
-        _info_on_compo=info;
-      else
-        {
-          std::ostringstream oss; oss << "DataArrayChar::setInfoAndChangeNbOfCompo : input is of size " << info.size() << " whereas number of components is equal to " << getNumberOfComponents() << "  and this is already allocated !";
-          throw INTERP_KERNEL::Exception(oss.str().c_str());
-        }
-    }
-  else
-    _info_on_compo=info;
-}
-
 /*!
  * Returns an integer value characterizing \a this array, which is useful for a quick
  * comparison of many instances of DataArrayInt.
@@ -728,7 +702,7 @@ DataArrayChar *DataArrayChar::changeNbOfComponents(int newNbOfComp, char dftValu
  *
  *  \ref py_mcdataarrayint_keepselectedcomponents "Here is a Python example".
  */
-DataArrayChar *DataArrayChar::keepSelectedComponents(const std::vector<int>& compoIds) const throw(INTERP_KERNEL::Exception)
+DataArray *DataArrayChar::keepSelectedComponents(const std::vector<int>& compoIds) const throw(INTERP_KERNEL::Exception)
 {
   checkAllocated();
   MEDCouplingAutoRefCountObjectPtr<DataArrayChar> ret(buildEmptySpecializedDAChar());
@@ -770,7 +744,7 @@ void DataArrayChar::meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Ex
     throw INTERP_KERNEL::Exception("DataArrayChar::meldWith : mismatch of number of tuples !");
   int nbOfComp1=getNumberOfComponents();
   int nbOfComp2=other->getNumberOfComponents();
-  char *newArr=new char[nbOfTuples*(nbOfComp1+nbOfComp2)];
+  char *newArr=(char *)malloc(nbOfTuples*(nbOfComp1+nbOfComp2)*sizeof(char));
   char *w=newArr;
   const char *inp1=getConstPointer();
   const char *inp2=other->getConstPointer();
@@ -779,7 +753,7 @@ void DataArrayChar::meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Ex
       w=std::copy(inp1,inp1+nbOfComp1,w);
       w=std::copy(inp2,inp2+nbOfComp2,w);
     }
-  useArray(newArr,true,CPP_DEALLOC,nbOfTuples,nbOfComp1+nbOfComp2);
+  useArray(newArr,true,C_DEALLOC,nbOfTuples,nbOfComp1+nbOfComp2);
   std::vector<int> compIds(nbOfComp2);
   for(int i=0;i<nbOfComp2;i++)
     compIds[i]=nbOfComp1+i;
@@ -1277,6 +1251,183 @@ void DataArrayChar::setPartOfValuesAdv(const DataArrayChar *a, const DataArrayCh
     }
 }
 
+/*!
+ * Copy some tuples from another DataArrayChar (\a a) into contiguous tuples
+ * of \a this array. Textual data is not copied. Both arrays must have equal number of
+ * components.
+ * The tuples to assign to are defined by index of the first tuple, and
+ * their number is defined by \a tuplesSelec->getNumberOfTuples().
+ * The tuples to copy are defined by values of a DataArrayChar.
+ * All components of selected tuples are copied.
+ *  \param [in] tupleIdStart - index of the first tuple of \a this array to assign
+ *              values to.
+ *  \param [in] a - the array to copy values from.
+ *  \param [in] tuplesSelec - the array specifying tuples of \a a to copy.
+ *  \throw If \a this is not allocated.
+ *  \throw If \a a is NULL.
+ *  \throw If \a a is not allocated.
+ *  \throw If \a tuplesSelec is NULL.
+ *  \throw If \a tuplesSelec is not allocated.
+ *  \throw If <em>this->getNumberOfComponents() != a->getNumberOfComponents()</em>.
+ *  \throw If \a tuplesSelec->getNumberOfComponents() != 1.
+ *  \throw If <em>tupleIdStart + tuplesSelec->getNumberOfTuples() > this->getNumberOfTuples().</em>
+ *  \throw If any tuple index given by \a tuplesSelec is out of a valid range for 
+ *         \a a array.
+ */
+void DataArrayChar::setContigPartOfSelectedValues(int tupleIdStart, const DataArray *aBase, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception)
+{
+  if(!aBase || !tuplesSelec)
+    throw INTERP_KERNEL::Exception("DataArrayChar::setContigPartOfSelectedValues : input DataArray is NULL !");
+  const DataArrayChar *a=dynamic_cast<const DataArrayChar *>(aBase);
+  if(!a)
+    throw INTERP_KERNEL::Exception("DataArrayChar::setContigPartOfSelectedValues : input DataArray aBase is not a DataArrayChar !");
+  checkAllocated();
+  a->checkAllocated();
+  tuplesSelec->checkAllocated();
+  int nbOfComp=getNumberOfComponents();
+  if(nbOfComp!=a->getNumberOfComponents())
+    throw INTERP_KERNEL::Exception("DataArrayChar::setContigPartOfSelectedValues : This and a do not have the same number of components !");
+  if(tuplesSelec->getNumberOfComponents()!=1)
+    throw INTERP_KERNEL::Exception("DataArrayChar::setContigPartOfSelectedValues : Expecting to have a tuple selector DataArrayChar instance with exactly 1 component !");
+  int thisNt=getNumberOfTuples();
+  int aNt=a->getNumberOfTuples();
+  int nbOfTupleToWrite=tuplesSelec->getNumberOfTuples();
+  char *valsToSet=getPointer()+tupleIdStart*nbOfComp;
+  if(tupleIdStart+nbOfTupleToWrite>thisNt)
+    throw INTERP_KERNEL::Exception("DataArrayChar::setContigPartOfSelectedValues : invalid number range of values to write !");
+  const char *valsSrc=a->getConstPointer();
+  for(const int *tuple=tuplesSelec->begin();tuple!=tuplesSelec->end();tuple++,valsToSet+=nbOfComp)
+    {
+      if(*tuple>=0 && *tuple<aNt)
+        {
+          std::copy(valsSrc+nbOfComp*(*tuple),valsSrc+nbOfComp*(*tuple+1),valsToSet);
+        }
+      else
+        {
+          std::ostringstream oss; oss << "DataArrayChar::setContigPartOfSelectedValues : Tuple #" << std::distance(tuplesSelec->begin(),tuple);
+          oss << " of 'tuplesSelec' request of tuple id #" << *tuple << " in 'a' ! It should be in [0," << aNt << ") !";
+          throw INTERP_KERNEL::Exception(oss.str().c_str());
+        }
+    }
+}
+
+/*!
+ * Copy some tuples from another DataArrayChar (\a a) into contiguous tuples
+ * of \a this array. Textual data is not copied. Both arrays must have equal number of
+ * components.
+ * The tuples to copy are defined by three values similar to parameters of
+ * the Python function \c range(\c start,\c stop,\c step).
+ * The tuples to assign to are defined by index of the first tuple, and
+ * their number is defined by number of tuples to copy.
+ * All components of selected tuples are copied.
+ *  \param [in] tupleIdStart - index of the first tuple of \a this array to assign
+ *              values to.
+ *  \param [in] a - the array to copy values from.
+ *  \param [in] bg - index of the first tuple to copy of the array \a a.
+ *  \param [in] end2 - index of the tuple of \a a before which the tuples to copy
+ *              are located.
+ *  \param [in] step - index increment to get index of the next tuple to copy.
+ *  \throw If \a this is not allocated.
+ *  \throw If \a a is NULL.
+ *  \throw If \a a is not allocated.
+ *  \throw If <em>this->getNumberOfComponents() != a->getNumberOfComponents()</em>.
+ *  \throw If <em>tupleIdStart + len(range(bg,end2,step)) > this->getNumberOfTuples().</em>
+ *  \throw If parameters specifying tuples to copy, do not give a
+ *            non-empty range of increasing indices or indices are out of a valid range
+ *            for the array \a a.
+ */
+void DataArrayChar::setContigPartOfSelectedValues2(int tupleIdStart, const DataArray *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
+{
+  if(!aBase)
+    throw INTERP_KERNEL::Exception("DataArrayChar::setContigPartOfSelectedValues2 : input DataArray is NULL !");
+  const DataArrayChar *a=dynamic_cast<const DataArrayChar *>(aBase);
+  if(!a)
+    throw INTERP_KERNEL::Exception("DataArrayChar::setContigPartOfSelectedValues2 : input DataArray aBase is not a DataArrayChar !");
+  checkAllocated();
+  a->checkAllocated();
+  int nbOfComp=getNumberOfComponents();
+  const char msg[]="DataArrayChar::setContigPartOfSelectedValues2";
+  int nbOfTupleToWrite=DataArray::GetNumberOfItemGivenBES(bg,end2,step,msg);
+  if(nbOfComp!=a->getNumberOfComponents())
+    throw INTERP_KERNEL::Exception("DataArrayChar::setContigPartOfSelectedValues2 : This and a do not have the same number of components !");
+  int thisNt=getNumberOfTuples();
+  int aNt=a->getNumberOfTuples();
+  char *valsToSet=getPointer()+tupleIdStart*nbOfComp;
+  if(tupleIdStart+nbOfTupleToWrite>thisNt)
+    throw INTERP_KERNEL::Exception("DataArrayChar::setContigPartOfSelectedValues2 : invalid number range of values to write !");
+  if(end2>aNt)
+    throw INTERP_KERNEL::Exception("DataArrayChar::setContigPartOfSelectedValues2 : invalid range of values to read !");
+  const char *valsSrc=a->getConstPointer()+bg*nbOfComp;
+  for(int i=0;i<nbOfTupleToWrite;i++,valsToSet+=nbOfComp,valsSrc+=step*nbOfComp)
+    {
+      std::copy(valsSrc,valsSrc+nbOfComp,valsToSet);
+    }
+}
+
+/*!
+ * Returns a shorten copy of \a this array. The new DataArrayChar contains ranges
+ * of tuples specified by \a ranges parameter.
+ * For more info on renumbering see \ref MEDCouplingArrayRenumbering.
+ *  \param [in] ranges - std::vector of std::pair's each of which defines a range
+ *              of tuples in [\c begin,\c end) format.
+ *  \return DataArrayChar * - the new instance of DataArrayChar that the caller
+ *          is to delete using decrRef() as it is no more needed.
+ *  \throw If \a end < \a begin.
+ *  \throw If \a end > \a this->getNumberOfTuples().
+ *  \throw If \a this is not allocated.
+ */
+DataArray *DataArrayChar::selectByTupleRanges(const std::vector<std::pair<int,int> >& ranges) const throw(INTERP_KERNEL::Exception)
+{
+  checkAllocated();
+  int nbOfComp=getNumberOfComponents();
+  int nbOfTuplesThis=getNumberOfTuples();
+  if(ranges.empty())
+    {
+      MEDCouplingAutoRefCountObjectPtr<DataArrayChar> ret=buildEmptySpecializedDAChar();
+      ret->alloc(0,nbOfComp);
+      ret->copyStringInfoFrom(*this);
+      return ret.retn();
+    }
+  int ref=ranges.front().first;
+  int nbOfTuples=0;
+  bool isIncreasing=true;
+  for(std::vector<std::pair<int,int> >::const_iterator it=ranges.begin();it!=ranges.end();it++)
+    {
+      if((*it).first<=(*it).second)
+        {
+          if((*it).first>=0 && (*it).second<=nbOfTuplesThis)
+            {
+              nbOfTuples+=(*it).second-(*it).first;
+              if(isIncreasing)
+                isIncreasing=ref<=(*it).first;
+              ref=(*it).second;
+            }
+          else
+            {
+              std::ostringstream oss; oss << "DataArrayChar::selectByTupleRanges : on range #" << std::distance(ranges.begin(),it);
+              oss << " (" << (*it).first << "," << (*it).second << ") is greater than number of tuples of this :" << nbOfTuples << " !";
+              throw INTERP_KERNEL::Exception(oss.str().c_str());
+            }
+        }
+      else
+        {
+          std::ostringstream oss; oss << "DataArrayChar::selectByTupleRanges : on range #" << std::distance(ranges.begin(),it);
+          oss << " (" << (*it).first << "," << (*it).second << ") end is before begin !";
+          throw INTERP_KERNEL::Exception(oss.str().c_str());
+        }
+    }
+  if(isIncreasing && nbOfTuplesThis==nbOfTuples)
+    return deepCpy();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayChar> ret=buildEmptySpecializedDAChar();
+  ret->alloc(nbOfTuples,nbOfComp);
+  ret->copyStringInfoFrom(*this);
+  const char *src=getConstPointer();
+  char *work=ret->getPointer();
+  for(std::vector<std::pair<int,int> >::const_iterator it=ranges.begin();it!=ranges.end();it++)
+    work=std::copy(src+(*it).first*nbOfComp,src+(*it).second*nbOfComp,work);
+  return ret.retn();
+}
+
 /*!
  * Returns a value located at specified tuple and component.
  * This method is equivalent to DataArrayChar::getIJ() except that validity of
index 48489218fdd5c05d9cb0d1e76937341278b72d7b..95d450a9ceb22fa4ec49e2743d15bf3899c5efb5 100644 (file)
@@ -113,22 +113,37 @@ bool MEDCouplingMesh::isEqual(const MEDCouplingMesh *other, double prec) const t
 }
 
 /*!
- * This method checks geo equivalence between two meshes : 'this' and 'other'.
- * If no exception is throw 'this' and 'other' are geometrically equivalent regarding 'levOfCheck' level.
- * This method is typically used to change the mesh of a field "safely" depending the 'levOfCheck' level considered.
- * So in case of success cell \c other[i] is equal to cell \c this[cellCor[i]]. If \a cellCor is null it means that for all i cell \c other[i] is equal to cell \c this[i].
+ * This method checks geo equivalence between two meshes : \a this and \a other.
+ * If no exception is thrown \a this and \a other are geometrically equivalent regarding \a levOfCheck level.
+ * This method is typically used to change the mesh of a field "safely" depending the \a levOfCheck level considered.
  * 
- * @param levOfCheck input that specifies the level of check specified. The possible values are listed below.
- * @param prec input that specifies precision for double float data used for comparison in meshes.
- * @param cellCor output array not always informed (depending 'levOfCheck' param) that gives the corresponding array for cells from 'other' to 'this'.
- * @param nodeCor output array not always informed (depending 'levOfCheck' param) that gives the corresponding array for nodes from 'other' to 'this'.
+ * In case of success cell \c other[i] is equal to the cell \c this[cellCor[i]].
+ * In case of success node \c other->getCoords()[i] is equal to the node \c this->getCoords()[nodeCor[i]].
+ *
+ * If \a cellCor is null (or Py_None) it means that for all #i cell in \a other is equal to cell # i in \a this.
+ *
+ * If \a nodeCor is null (or Py_None) it means that for all #i node in \a other is equal to node # i in \a this.
+ *
+ * So null (or Py_None) returned in \a cellCor and/or \a nodeCor means identity array. This is for optimization reason to avoid to build useless arrays
+ * for some \a levOfCheck (for example 0).
+ *
+ * **Warning a not null output does not mean that it is not identity !**
+ *
+ * \param [in] other - the mesh to be compared with \a this.
+ * \param [in] levOfCheck - input that specifies the level of check specified. The possible values are listed below.
+ * \param [in] prec - input that specifies precision for double float data used for comparison in meshes.
+ * \param [out] cellCor - output array not always informed (depending \a levOfCheck param) that gives the corresponding array for cells from \a other to \a this.
+ * \param [out] nodeCor - output array not always informed (depending \a levOfCheck param) that gives the corresponding array for nodes from \a other to \a this.
  *
  * Possible values for levOfCheck :
- *   - 0 for strict equality. This is the strongest level. 'cellCor' and 'nodeCor' params are never informed.
- *   - 10,11,12 for less strict equality. Two meshes are compared geometrically. In case of success 'cellCor' and 'nodeCor' are informed. Warning ! These equivalences are CPU/Mem costly. The 3 values correspond respectively to policy used for cell comparison (see MEDCouplingUMesh::zipConnectivityTraducer to have more details)
- *   - 20,21,22, for less strict equality. Two meshes are compared geometrically. The difference with the previous version is that nodes(coordinates) are expected to be the same between this and other. In case of success 'cellCor' is informed. Warning ! These equivalences are CPU/Mem costly. The 3 values correspond respectively to policy used for cell comparison (see MEDCouplingUMesh::zipConnectivityTraducer to have more details)
+ *   - 0 for strict equality. This is the strongest level. \a cellCor and \a nodeCor params are never informed.
+ *   - 10,11,12 (10+x) for less strict equality. Two meshes are compared geometrically. In case of success \a cellCor and \a nodeCor are informed. Warning ! These equivalences are CPU/Mem costly. The 3 values correspond respectively to policy used for cell comparison (see MEDCouplingUMesh::zipConnectivityTraducer to have more details)
+ *   - 20,21,22 (20+x), for less strict equality. Two meshes are compared geometrically. The difference with the previous version is that nodes(coordinates) are expected to be the same between this and other. In case of success \a cellCor is informed. Warning ! These equivalences are CPU/Mem costly. The 3 values correspond respectively to policy used for cell comparison (see MEDCouplingUMesh::zipConnectivityTraducer to have more details)
  *   - 1 for fast 'equality'. This is a lazy level. Just number of cells and number of nodes are considered here and 3 cells (begin,middle,end)
  *   - 2 for deep 'equality' as 0 option except that no control is done on all strings in mesh.
+ *
+ * So the most strict level of check is 0 (equality). The least strict is 12. If the level of check 12 throws, the 2 meshes \a this and \a other are not similar enough
+ * to be compared. An interpolation using MEDCouplingRemapper class should be then used.
  */
 void MEDCouplingMesh::checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec,
                                           DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const throw(INTERP_KERNEL::Exception)
@@ -207,7 +222,7 @@ DataArrayInt *MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds(const int *partB
 }
 
 /*!
- * This method checks fastly that 'this' and 'other' are equal. All common checks are done here.
+ * This method checks fastly that \a this and \a other are equal. All common checks are done here.
  */
 void MEDCouplingMesh::checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception)
 {
@@ -220,7 +235,7 @@ void MEDCouplingMesh::checkFastEquivalWith(const MEDCouplingMesh *other, double
 }
 
 /*!
- * This method is very poor and looks only if 'this' and 'other' are candidate for merge of fields lying repectively on them.
+ * This method is very poor and looks only if \a this and \a other are candidate for merge of fields lying repectively on them.
  */
 bool MEDCouplingMesh::areCompatibleForMerge(const MEDCouplingMesh *other) const
 {
@@ -254,7 +269,7 @@ MEDCouplingMesh *MEDCouplingMesh::buildPartRangeAndReduceNodes(int beginCellIds,
 }
 
 /*!
- * This method builds a field lying on 'this' with 'nbOfComp' components.
+ * This method builds a field lying on \a this with 'nbOfComp' components.
  * 'func' is a pointer that points to a function that takes 2 arrays in parameter and returns a boolean.
  * The first array is a in-param of size this->getSpaceDimension and the second an out param of size 'nbOfComp'.
  * The return field will have type specified by 't'. 't' is also used to determine where values of field will be
@@ -263,10 +278,11 @@ MEDCouplingMesh *MEDCouplingMesh::buildPartRangeAndReduceNodes(int beginCellIds,
  * The 'func' is a callback that takes as first parameter an input array of size 'this->getSpaceDimension()',
  * the second parameter is a pointer on a valid zone of size at least equal to 'nbOfComp' values. And too finish
  * the returned value is a boolean that is equal to False in case of invalid evaluation (log(0) for example...)
- * @param t type of field returned and specifies where the evaluation of func will be done.
- * @param nbOfComp number of components of returned field.
- * @param func pointer to a function that should return false if the evaluation failed. (division by 0. for example)
- * @return field with counter = 1.
+ * 
+ * \param t type of field returned and specifies where the evaluation of func will be done.
+ * \param nbOfComp number of components of returned field.
+ * \param func pointer to a function that should return false if the evaluation failed. (division by 0. for example)
+ * \return field with counter = 1.
  */
 MEDCouplingFieldDouble *MEDCouplingMesh::fillFromAnalytic(TypeOfField t, int nbOfComp, FunctionToEvaluate func) const
 {
@@ -290,7 +306,7 @@ void MEDCouplingMesh::copyTinyStringsFrom(const MEDCouplingMesh *other) throw(IN
 
 /*!
  * This method copies all attributes that are \b NOT arrays in this.
- * All tiny attributes not usefully for state of 'this' are ignored.
+ * All tiny attributes not usefully for state of \a this are ignored.
  */
 void MEDCouplingMesh::copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception)
 {
@@ -509,6 +525,54 @@ MEDCouplingMesh *MEDCouplingMesh::MergeMeshes(std::vector<const MEDCouplingMesh
   return MEDCouplingUMesh::MergeUMeshes(ms2);
 }
 
+/*!
+ * For example if \a type is INTERP_KERNEL::NORM_TRI3 , INTERP_KERNEL::NORM_POLYGON is returned.
+ * If \a type is INTERP_KERNEL::NORM_HEXA8 , INTERP_KERNEL::NORM_POLYHED is returned.
+ * 
+ * \param [in] type the geometric type for which the corresponding dynamic type, is asked.
+ * \return the corresponding dynamic type, able to store the input \a type.
+ * 
+ * \throw if type is equal to \c INTERP_KERNEL::NORM_ERROR or to an unexisting geometric type.
+ */
+INTERP_KERNEL::NormalizedCellType MEDCouplingMesh::GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
+{
+  const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
+  return cm.getCorrespondingPolyType();
+}
+
+/*!
+ * \param [in] type the geometric type for which the number of nodes consituting it, is asked.
+ * \return number of nodes consituting the input geometric type \a type.
+ * 
+ * \throw if type is dynamic as \c INTERP_KERNEL::NORM_POLYHED , \c INTERP_KERNEL::NORM_POLYGON , \c INTERP_KERNEL::NORM_QPOLYG
+ * \throw if type is equal to \c INTERP_KERNEL::NORM_ERROR or to an unexisting geometric type.
+ */
+int MEDCouplingMesh::GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
+{
+  const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
+  if(cm.isDynamic())
+    throw INTERP_KERNEL::Exception("MEDCouplingMesh::GetNumberOfNodesOfGeometricType : the input geometric type is dynamic ! Impossible to return a fixed number of nodes constituting it !");
+  return (int) cm.getNumberOfNodes();
+}
+
+/*!
+ * \param [in] type the geometric type for which the status static/dynamic is asked.
+ * \return true for static geometric type, false for dynamic geometric type.
+ * 
+ * \throw if type is equal to \c INTERP_KERNEL::NORM_ERROR or to an unexisting geometric type.
+ */
+bool MEDCouplingMesh::IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
+{
+  const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
+  return !cm.isDynamic();
+}
+
+bool MEDCouplingMesh::IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
+{
+  const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
+  return !cm.isQuadratic();
+}
+
 /*!
  * \param [in] type the geometric type for which the dimension is asked.
  * \return the dimension associated to the input geometric type \a type.
index ff714a769d703478798bbf0840e836e1c0c7955f..1bfd57f30289cb46dcb0acf33757cdc5018834ba 100644 (file)
@@ -87,6 +87,7 @@ namespace ParaMEDMEM
     virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const throw(INTERP_KERNEL::Exception) = 0;
     virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception) = 0;
     virtual DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception) = 0;
+    virtual DataArrayInt *computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception) = 0;
     virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const = 0;
     virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const = 0;
     virtual std::set<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const = 0;
@@ -124,6 +125,10 @@ namespace ParaMEDMEM
     virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const;
     static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception);
     static MEDCouplingMesh *MergeMeshes(std::vector<const MEDCouplingMesh *>& meshes) throw(INTERP_KERNEL::Exception);
+    static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
+    static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
+    static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
+    static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
     static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
     static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
     //serialisation-unserialization
index 77f8ca03e6ea40092c558ca01abb46322577a65c..407f956dcc6e4348ca5d3bb4e3e3506d3776c6c6 100644 (file)
@@ -109,6 +109,16 @@ DataArrayInt *MEDCouplingStructuredMesh::computeNbOfNodesPerCell() const throw(I
   return ret.retn();
 }
 
+DataArrayInt *MEDCouplingStructuredMesh::computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception)
+{
+  int nbCells=getNumberOfCells();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+  ret->alloc(nbCells,1);
+  const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(getTypeOfCell(0));
+  ret->fillWithValue((int)cm.getNumberOfSons());
+  return ret.retn();
+}
+
 void MEDCouplingStructuredMesh::getNodeIdsOfCell(int cellId, std::vector<int>& conn) const
 {
   int meshDim=getMeshDimension();
index 1e79a9f462eba809f7e6d07231c87b436f043e39..b04db7adde241d2aacdabbd3c070b680f9136709 100644 (file)
@@ -34,6 +34,7 @@ namespace ParaMEDMEM
     int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
     DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
     DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
+    DataArrayInt *computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception);
     static void GetPosFromId(int nodeId, int meshDim, const int *split, int *res);
     void getNodeIdsOfCell(int cellId, std::vector<int>& conn) const;
     std::size_t getHeapMemorySize() const;
index b75dbd2abbd21ddd2a15b9e42e38bf29d725e791..818f4eb711f8fe6abf07eb6e5dc0546354ebc3ed 100644 (file)
@@ -49,7 +49,7 @@ const char MEDCouplingTwoTimeSteps::EXCEPTION_MSG[]="No data on this time.";
 
 const char MEDCouplingLinearTime::REPR[]="Linear time between 2 time steps.";
 
-MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::New(TypeOfTimeDiscretization type)
+MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::New(TypeOfTimeDiscretization type) throw(INTERP_KERNEL::Exception)
 {
   switch(type)
     {
@@ -72,7 +72,7 @@ void MEDCouplingTimeDiscretization::copyTinyAttrFrom(const MEDCouplingTimeDiscre
   _time_unit=other._time_unit;
 }
 
-void MEDCouplingTimeDiscretization::copyTinyStringsFrom(const MEDCouplingTimeDiscretization& other)
+void MEDCouplingTimeDiscretization::copyTinyStringsFrom(const MEDCouplingTimeDiscretization& other) throw(INTERP_KERNEL::Exception)
 {
   _time_unit=other._time_unit;
   if(_array && other._array)
@@ -101,7 +101,7 @@ std::size_t MEDCouplingTimeDiscretization::getHeapMemorySize() const
   return ret;
 }
 
-bool MEDCouplingTimeDiscretization::areCompatible(const MEDCouplingTimeDiscretization *other) const
+bool MEDCouplingTimeDiscretization::areCompatible(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   if(std::fabs(_time_tolerance-other->_time_tolerance)>1.e-16)
     return false;
@@ -114,7 +114,7 @@ bool MEDCouplingTimeDiscretization::areCompatible(const MEDCouplingTimeDiscretiz
   return true;
 }
 
-bool MEDCouplingTimeDiscretization::areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const
+bool MEDCouplingTimeDiscretization::areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const throw(INTERP_KERNEL::Exception)
 {
   std::ostringstream oss; oss.precision(15);
   if(_time_unit!=other->_time_unit)
@@ -143,7 +143,7 @@ bool MEDCouplingTimeDiscretization::areStrictlyCompatible(const MEDCouplingTimeD
   return true;
 }
 
-bool MEDCouplingTimeDiscretization::areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const
+bool MEDCouplingTimeDiscretization::areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   if(std::fabs(_time_tolerance-other->_time_tolerance)>1.e-16)
     return false;
@@ -156,7 +156,7 @@ bool MEDCouplingTimeDiscretization::areCompatibleForMeld(const MEDCouplingTimeDi
   return true;
 }
 
-bool MEDCouplingTimeDiscretization::areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const
+bool MEDCouplingTimeDiscretization::areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   if(std::fabs(_time_tolerance-other->_time_tolerance)>1.e-16)
     return false;
@@ -172,7 +172,7 @@ bool MEDCouplingTimeDiscretization::areStrictlyCompatibleForMul(const MEDCouplin
   return true;
 }
 
-bool MEDCouplingTimeDiscretization::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const
+bool MEDCouplingTimeDiscretization::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   if(std::fabs(_time_tolerance-other->_time_tolerance)>1.e-16)
     return false;
@@ -187,7 +187,7 @@ bool MEDCouplingTimeDiscretization::areStrictlyCompatibleForDiv(const MEDCouplin
   return true;
 }
 
-bool MEDCouplingTimeDiscretization::isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const
+bool MEDCouplingTimeDiscretization::isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const throw(INTERP_KERNEL::Exception)
 {
   if(!areStrictlyCompatible(other,reason))
     return false;
@@ -196,13 +196,13 @@ bool MEDCouplingTimeDiscretization::isEqualIfNotWhy(const MEDCouplingTimeDiscret
   return _array->isEqualIfNotWhy(*other->_array,prec,reason);
 }
 
-bool MEDCouplingTimeDiscretization::isEqual(const MEDCouplingTimeDiscretization *other, double prec) const
+bool MEDCouplingTimeDiscretization::isEqual(const MEDCouplingTimeDiscretization *other, double prec) const throw(INTERP_KERNEL::Exception)
 {
   std::string reason;
   return isEqualIfNotWhy(other,prec,reason);
 }
 
-bool MEDCouplingTimeDiscretization::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const
+bool MEDCouplingTimeDiscretization::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const throw(INTERP_KERNEL::Exception)
 {
   std::string tmp;
   if(!areStrictlyCompatible(other,tmp))
@@ -212,7 +212,7 @@ bool MEDCouplingTimeDiscretization::isEqualWithoutConsideringStr(const MEDCoupli
   return _array->isEqualWithoutConsideringStr(*other->_array,prec);
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::buildNewTimeReprFromThis(TypeOfTimeDiscretization type, bool deepCpy) const
+MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::buildNewTimeReprFromThis(TypeOfTimeDiscretization type, bool deepCpy) const throw(INTERP_KERNEL::Exception)
 {
   MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(type);
   ret->setTimeUnit(getTimeUnit());
@@ -224,7 +224,7 @@ MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::buildNewTimeReprFr
   return ret;
 }
 
-void MEDCouplingTimeDiscretization::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
+void MEDCouplingTimeDiscretization::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception)
 {
   if(_array)
     {
@@ -238,7 +238,7 @@ void MEDCouplingTimeDiscretization::getTinySerializationIntInformation(std::vect
     }
 }
 
-void MEDCouplingTimeDiscretization::resizeForUnserialization(const std::vector<int>& tinyInfoI, std::vector<DataArrayDouble *>& arrays)
+void MEDCouplingTimeDiscretization::resizeForUnserialization(const std::vector<int>& tinyInfoI, std::vector<DataArrayDouble *>& arrays) throw(INTERP_KERNEL::Exception)
 {
   arrays.resize(1);
   if(_array!=0)
@@ -253,7 +253,7 @@ void MEDCouplingTimeDiscretization::resizeForUnserialization(const std::vector<i
   arrays[0]=arr;
 }
 
-void MEDCouplingTimeDiscretization::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
+void MEDCouplingTimeDiscretization::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS) throw(INTERP_KERNEL::Exception)
 {
   _time_tolerance=tinyInfoD[0];
   int nbOfCompo=_array->getNumberOfComponents();
@@ -261,12 +261,12 @@ void MEDCouplingTimeDiscretization::finishUnserialization(const std::vector<int>
     _array->setInfoOnComponent(i,tinyInfoS[i].c_str());
 }
 
-void MEDCouplingTimeDiscretization::getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const
+void MEDCouplingTimeDiscretization::getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const throw(INTERP_KERNEL::Exception)
 {
   tinyInfo.push_back(_time_tolerance);
 }
 
-void MEDCouplingTimeDiscretization::getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const
+void MEDCouplingTimeDiscretization::getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const throw(INTERP_KERNEL::Exception)
 {
   int nbOfCompo=_array->getNumberOfComponents();
   for(int i=0;i<nbOfCompo;i++)
@@ -291,7 +291,7 @@ MEDCouplingTimeDiscretization::~MEDCouplingTimeDiscretization()
     _array->decrRef();
 }
 
-void MEDCouplingTimeDiscretization::setArray(DataArrayDouble *array, TimeLabel *owner)
+void MEDCouplingTimeDiscretization::setArray(DataArrayDouble *array, TimeLabel *owner) throw(INTERP_KERNEL::Exception)
 {
   if(array!=_array)
     {
@@ -305,17 +305,17 @@ void MEDCouplingTimeDiscretization::setArray(DataArrayDouble *array, TimeLabel *
     }
 }
 
-const DataArrayDouble *MEDCouplingTimeDiscretization::getEndArray() const
+const DataArrayDouble *MEDCouplingTimeDiscretization::getEndArray() const throw(INTERP_KERNEL::Exception)
 {
   throw INTERP_KERNEL::Exception("getEndArray not available for this type of time discretization !");
 }
 
-DataArrayDouble *MEDCouplingTimeDiscretization::getEndArray()
+DataArrayDouble *MEDCouplingTimeDiscretization::getEndArray() throw(INTERP_KERNEL::Exception)
 {
   throw INTERP_KERNEL::Exception("getEndArray not available for this type of time discretization !");
 }
 
-void MEDCouplingTimeDiscretization::setEndArray(DataArrayDouble *array, TimeLabel *owner)
+void MEDCouplingTimeDiscretization::setEndArray(DataArrayDouble *array, TimeLabel *owner) throw(INTERP_KERNEL::Exception)
 {
   throw INTERP_KERNEL::Exception("setEndArray not available for this type of time discretization !");
 }
@@ -327,7 +327,7 @@ void MEDCouplingTimeDiscretization::setArrays(const std::vector<DataArrayDouble
   setArray(arrays.back(),owner);
 }
 
-void MEDCouplingTimeDiscretization::getArrays(std::vector<DataArrayDouble *>& arrays) const
+void MEDCouplingTimeDiscretization::getArrays(std::vector<DataArrayDouble *>& arrays) const throw(INTERP_KERNEL::Exception)
 {
   arrays.resize(1);
   arrays[0]=_array;
@@ -567,7 +567,7 @@ MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::keepSelectedCompon
   for(std::size_t j=0;j<arrays.size();j++)
     {
       if(arrays[j])
-        arrays2[j]=arrays[j]->keepSelectedComponents(compoIds);
+        arrays2[j]=static_cast<DataArrayDouble *>(arrays[j]->keepSelectedComponents(compoIds));
       else
         arrays2[j]=0;
     }
@@ -625,7 +625,7 @@ void MEDCouplingTimeDiscretization::sortPerTuple(bool asc) throw(INTERP_KERNEL::
     }
 }
 
-void MEDCouplingTimeDiscretization::setUniformValue(int nbOfTuple, int nbOfCompo, double value)
+void MEDCouplingTimeDiscretization::setUniformValue(int nbOfTuple, int nbOfCompo, double value) throw(INTERP_KERNEL::Exception)
 {
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
@@ -650,7 +650,7 @@ void MEDCouplingTimeDiscretization::setUniformValue(int nbOfTuple, int nbOfCompo
   setArrays(arrays3,0);
 }
 
-void MEDCouplingTimeDiscretization::setOrCreateUniformValueOnAllComponents(int nbOfTuple, double value)
+void MEDCouplingTimeDiscretization::setOrCreateUniformValueOnAllComponents(int nbOfTuple, double value) throw(INTERP_KERNEL::Exception)
 {
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
@@ -680,7 +680,7 @@ void MEDCouplingTimeDiscretization::setOrCreateUniformValueOnAllComponents(int n
     }
 }
 
-void MEDCouplingTimeDiscretization::applyLin(double a, double b, int compoId)
+void MEDCouplingTimeDiscretization::applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception)
 {
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
@@ -691,7 +691,7 @@ void MEDCouplingTimeDiscretization::applyLin(double a, double b, int compoId)
     }
 }
 
-void MEDCouplingTimeDiscretization::applyFunc(int nbOfComp, FunctionToEvaluate func)
+void MEDCouplingTimeDiscretization::applyFunc(int nbOfComp, FunctionToEvaluate func) throw(INTERP_KERNEL::Exception)
 {
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
@@ -709,7 +709,7 @@ void MEDCouplingTimeDiscretization::applyFunc(int nbOfComp, FunctionToEvaluate f
   setArrays(arrays3,0);
 }
 
-void MEDCouplingTimeDiscretization::applyFunc(int nbOfComp, const char *func)
+void MEDCouplingTimeDiscretization::applyFunc(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception)
 {
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
@@ -727,7 +727,7 @@ void MEDCouplingTimeDiscretization::applyFunc(int nbOfComp, const char *func)
   setArrays(arrays3,0);
 }
 
-void MEDCouplingTimeDiscretization::applyFunc2(int nbOfComp, const char *func)
+void MEDCouplingTimeDiscretization::applyFunc2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception)
 {
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
@@ -745,7 +745,7 @@ void MEDCouplingTimeDiscretization::applyFunc2(int nbOfComp, const char *func)
   setArrays(arrays3,0);
 }
 
-void MEDCouplingTimeDiscretization::applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func)
+void MEDCouplingTimeDiscretization::applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception)
 {
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
@@ -763,7 +763,7 @@ void MEDCouplingTimeDiscretization::applyFunc3(int nbOfComp, const std::vector<s
   setArrays(arrays3,0);
 }
 
-void MEDCouplingTimeDiscretization::applyFunc(const char *func)
+void MEDCouplingTimeDiscretization::applyFunc(const char *func) throw(INTERP_KERNEL::Exception)
 {
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
@@ -781,7 +781,7 @@ void MEDCouplingTimeDiscretization::applyFunc(const char *func)
   setArrays(arrays3,0);
 }
 
-void MEDCouplingTimeDiscretization::applyFuncFast32(const char *func)
+void MEDCouplingTimeDiscretization::applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception)
 {
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
@@ -792,7 +792,7 @@ void MEDCouplingTimeDiscretization::applyFuncFast32(const char *func)
     }
 }
 
-void MEDCouplingTimeDiscretization::applyFuncFast64(const char *func)
+void MEDCouplingTimeDiscretization::applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception)
 {
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
@@ -863,7 +863,7 @@ MEDCouplingNoTimeLabel::MEDCouplingNoTimeLabel(const MEDCouplingTimeDiscretizati
 {
 }
 
-std::string MEDCouplingNoTimeLabel::getStringRepr() const
+std::string MEDCouplingNoTimeLabel::getStringRepr() const throw(INTERP_KERNEL::Exception)
 {
   std::ostringstream stream;
   stream << REPR;
@@ -876,7 +876,7 @@ void MEDCouplingNoTimeLabel::synchronizeTimeWith(const MEDCouplingMesh *mesh) th
   throw INTERP_KERNEL::Exception("MEDCouplingNoTimeLabel::synchronizeTimeWith : impossible to synchronize time with a MEDCouplingMesh because the time discretization is incompatible with it !");
 }
 
-bool MEDCouplingNoTimeLabel::areCompatible(const MEDCouplingTimeDiscretization *other) const
+bool MEDCouplingNoTimeLabel::areCompatible(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   if(!MEDCouplingTimeDiscretization::areCompatible(other))
     return false;
@@ -884,7 +884,7 @@ bool MEDCouplingNoTimeLabel::areCompatible(const MEDCouplingTimeDiscretization *
   return otherC!=0;
 }
 
-bool MEDCouplingNoTimeLabel::areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const
+bool MEDCouplingNoTimeLabel::areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const throw(INTERP_KERNEL::Exception)
 {
   if(!MEDCouplingTimeDiscretization::areStrictlyCompatible(other,reason))
     return false;
@@ -895,7 +895,7 @@ bool MEDCouplingNoTimeLabel::areStrictlyCompatible(const MEDCouplingTimeDiscreti
   return ret;
 }
 
-bool MEDCouplingNoTimeLabel::areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const
+bool MEDCouplingNoTimeLabel::areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForMul(other))
     return false;
@@ -903,7 +903,7 @@ bool MEDCouplingNoTimeLabel::areStrictlyCompatibleForMul(const MEDCouplingTimeDi
   return otherC!=0;
 }
 
-bool MEDCouplingNoTimeLabel::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const
+bool MEDCouplingNoTimeLabel::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForDiv(other))
     return false;
@@ -911,7 +911,7 @@ bool MEDCouplingNoTimeLabel::areStrictlyCompatibleForDiv(const MEDCouplingTimeDi
   return otherC!=0;
 }
 
-bool MEDCouplingNoTimeLabel::areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const
+bool MEDCouplingNoTimeLabel::areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   if(!MEDCouplingTimeDiscretization::areCompatibleForMeld(other))
     return false;
@@ -919,7 +919,7 @@ bool MEDCouplingNoTimeLabel::areCompatibleForMeld(const MEDCouplingTimeDiscretiz
   return otherC!=0;
 }
 
-bool MEDCouplingNoTimeLabel::isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const
+bool MEDCouplingNoTimeLabel::isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
   if(!otherC)
@@ -930,7 +930,7 @@ bool MEDCouplingNoTimeLabel::isEqualIfNotWhy(const MEDCouplingTimeDiscretization
   return MEDCouplingTimeDiscretization::isEqualIfNotWhy(other,prec,reason);
 }
 
-bool MEDCouplingNoTimeLabel::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const
+bool MEDCouplingNoTimeLabel::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
   if(!otherC)
@@ -938,7 +938,7 @@ bool MEDCouplingNoTimeLabel::isEqualWithoutConsideringStr(const MEDCouplingTimeD
   return MEDCouplingTimeDiscretization::isEqualWithoutConsideringStr(other,prec);
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::aggregate(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::aggregate(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
   if(!otherC)
@@ -949,7 +949,7 @@ MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::aggregate(const MEDCoupli
   return ret;
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const
+MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const throw(INTERP_KERNEL::Exception)
 {
   std::vector<const DataArrayDouble *> a(other.size());
   int i=0;
@@ -966,7 +966,7 @@ MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::aggregate(const std::vect
   return ret;
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::meld(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::meld(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
   if(!otherC)
@@ -978,7 +978,7 @@ MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::meld(const MEDCouplingTim
   return ret;
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::dot(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::dot(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
   if(!otherC)
@@ -989,7 +989,7 @@ MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::dot(const MEDCouplingTime
   return ret;
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::crossProduct(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::crossProduct(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
   if(!otherC)
@@ -1000,7 +1000,7 @@ MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::crossProduct(const MEDCou
   return ret;
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::max(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::max(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
   if(!otherC)
@@ -1011,7 +1011,7 @@ MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::max(const MEDCouplingTime
   return ret;
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::min(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::min(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
   if(!otherC)
@@ -1022,7 +1022,7 @@ MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::min(const MEDCouplingTime
   return ret;
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::add(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::add(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
   if(!otherC)
@@ -1033,7 +1033,7 @@ MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::add(const MEDCouplingTime
   return ret;
 }
 
-void MEDCouplingNoTimeLabel::addEqual(const MEDCouplingTimeDiscretization *other)
+void MEDCouplingNoTimeLabel::addEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
   if(!otherC)
@@ -1043,7 +1043,7 @@ void MEDCouplingNoTimeLabel::addEqual(const MEDCouplingTimeDiscretization *other
   getArray()->addEqual(other->getArray());
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::substract(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::substract(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
   if(!otherC)
@@ -1056,7 +1056,7 @@ MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::substract(const MEDCoupli
   return ret;
 }
 
-void MEDCouplingNoTimeLabel::substractEqual(const MEDCouplingTimeDiscretization *other)
+void MEDCouplingNoTimeLabel::substractEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
   if(!otherC)
@@ -1066,7 +1066,7 @@ void MEDCouplingNoTimeLabel::substractEqual(const MEDCouplingTimeDiscretization
   getArray()->substractEqual(other->getArray());
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::multiply(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::multiply(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
   if(!otherC)
@@ -1077,7 +1077,7 @@ MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::multiply(const MEDCouplin
   return ret;
 }
 
-void MEDCouplingNoTimeLabel::multiplyEqual(const MEDCouplingTimeDiscretization *other)
+void MEDCouplingNoTimeLabel::multiplyEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
   if(!otherC)
@@ -1087,7 +1087,7 @@ void MEDCouplingNoTimeLabel::multiplyEqual(const MEDCouplingTimeDiscretization *
   getArray()->multiplyEqual(other->getArray());
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::divide(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::divide(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
   if(!otherC)
@@ -1098,7 +1098,7 @@ MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::divide(const MEDCouplingT
   return ret;
 }
 
-void MEDCouplingNoTimeLabel::divideEqual(const MEDCouplingTimeDiscretization *other)
+void MEDCouplingNoTimeLabel::divideEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
   if(!otherC)
@@ -1108,7 +1108,7 @@ void MEDCouplingNoTimeLabel::divideEqual(const MEDCouplingTimeDiscretization *ot
   getArray()->divideEqual(other->getArray());
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::pow(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::pow(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
   if(!otherC)
@@ -1119,7 +1119,7 @@ MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::pow(const MEDCouplingTime
   return ret;
 }
 
-void MEDCouplingNoTimeLabel::powEqual(const MEDCouplingTimeDiscretization *other)
+void MEDCouplingNoTimeLabel::powEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
   if(!otherC)
@@ -1129,7 +1129,7 @@ void MEDCouplingNoTimeLabel::powEqual(const MEDCouplingTimeDiscretization *other
   getArray()->powEqual(other->getArray());
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::performCpy(bool deepCpy) const
+MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception)
 {
   return new MEDCouplingNoTimeLabel(*this,deepCpy);
 }
@@ -1144,7 +1144,7 @@ std::vector< const DataArrayDouble *> MEDCouplingNoTimeLabel::getArraysForTime(d
   throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
 }
 
-void MEDCouplingNoTimeLabel::getValueForTime(double time, const std::vector<double>& vals, double *res) const
+void MEDCouplingNoTimeLabel::getValueForTime(double time, const std::vector<double>& vals, double *res) const throw(INTERP_KERNEL::Exception)
 {
   throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
 }
@@ -1222,7 +1222,7 @@ void MEDCouplingNoTimeLabel::getValueOnDiscTime(int eltId, int iteration, int or
 /*!
  * idem getTinySerializationIntInformation except that it is for multi field fetch
  */
-void MEDCouplingNoTimeLabel::getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const
+void MEDCouplingNoTimeLabel::getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception)
 {
   tinyInfo.clear();
 }
@@ -1230,7 +1230,7 @@ void MEDCouplingNoTimeLabel::getTinySerializationIntInformation2(std::vector<int
 /*!
  * idem getTinySerializationDbleInformation except that it is for multi field fetch
  */
-void MEDCouplingNoTimeLabel::getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const
+void MEDCouplingNoTimeLabel::getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const throw(INTERP_KERNEL::Exception)
 {
   tinyInfo.resize(1);
   tinyInfo[0]=_time_tolerance;
@@ -1239,7 +1239,7 @@ void MEDCouplingNoTimeLabel::getTinySerializationDbleInformation2(std::vector<do
 /*!
  * idem finishUnserialization except that it is for multi field fetch
  */
-void MEDCouplingNoTimeLabel::finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD)
+void MEDCouplingNoTimeLabel::finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD) throw(INTERP_KERNEL::Exception)
 {
   _time_tolerance=tinyInfoD[0];
 }
@@ -1253,7 +1253,7 @@ MEDCouplingWithTimeStep::MEDCouplingWithTimeStep():_time(0.),_iteration(-1),_ord
 {
 }
 
-std::string MEDCouplingWithTimeStep::getStringRepr() const
+std::string MEDCouplingWithTimeStep::getStringRepr() const throw(INTERP_KERNEL::Exception)
 {
   std::ostringstream stream;
   stream << REPR << " Time is defined by iteration=" << _iteration << " order=" << _order << " and time=" << _time << ".";
@@ -1272,20 +1272,20 @@ void MEDCouplingWithTimeStep::synchronizeTimeWith(const MEDCouplingMesh *mesh) t
   _time_unit=tUnit;
 }
 
-void MEDCouplingWithTimeStep::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
+void MEDCouplingWithTimeStep::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception)
 {
   MEDCouplingTimeDiscretization::getTinySerializationIntInformation(tinyInfo);
   tinyInfo.push_back(_iteration);
   tinyInfo.push_back(_order);
 }
 
-void MEDCouplingWithTimeStep::getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const
+void MEDCouplingWithTimeStep::getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const throw(INTERP_KERNEL::Exception)
 {
   MEDCouplingTimeDiscretization::getTinySerializationDbleInformation(tinyInfo);
   tinyInfo.push_back(_time);
 }
 
-void MEDCouplingWithTimeStep::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
+void MEDCouplingWithTimeStep::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS) throw(INTERP_KERNEL::Exception)
 {
   MEDCouplingTimeDiscretization::finishUnserialization(tinyInfoI,tinyInfoD,tinyInfoS);
   _time=tinyInfoD[1];
@@ -1296,7 +1296,7 @@ void MEDCouplingWithTimeStep::finishUnserialization(const std::vector<int>& tiny
 /*!
  * idem getTinySerializationIntInformation except that it is for multi field fetch
  */
-void MEDCouplingWithTimeStep::getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const
+void MEDCouplingWithTimeStep::getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception)
 {
   tinyInfo.resize(2);
   tinyInfo[0]=_iteration;
@@ -1306,7 +1306,7 @@ void MEDCouplingWithTimeStep::getTinySerializationIntInformation2(std::vector<in
 /*!
  * idem getTinySerializationDbleInformation except that it is for multi field fetch
  */
-void MEDCouplingWithTimeStep::getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const
+void MEDCouplingWithTimeStep::getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const throw(INTERP_KERNEL::Exception)
 {
   tinyInfo.resize(2);
   tinyInfo[0]=_time_tolerance;
@@ -1316,7 +1316,7 @@ void MEDCouplingWithTimeStep::getTinySerializationDbleInformation2(std::vector<d
 /*!
  * idem finishUnserialization except that it is for multi field fetch
  */
-void MEDCouplingWithTimeStep::finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD)
+void MEDCouplingWithTimeStep::finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD) throw(INTERP_KERNEL::Exception)
 {
   _iteration=tinyInfoI[0];
   _order=tinyInfoI[1];
@@ -1324,7 +1324,7 @@ void MEDCouplingWithTimeStep::finishUnserialization2(const std::vector<int>& tin
   _time=tinyInfoD[1];
 }
 
-bool MEDCouplingWithTimeStep::areCompatible(const MEDCouplingTimeDiscretization *other) const
+bool MEDCouplingWithTimeStep::areCompatible(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   if(!MEDCouplingTimeDiscretization::areCompatible(other))
     return false;
@@ -1332,7 +1332,7 @@ bool MEDCouplingWithTimeStep::areCompatible(const MEDCouplingTimeDiscretization
   return otherC!=0;
 }
 
-bool MEDCouplingWithTimeStep::areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const
+bool MEDCouplingWithTimeStep::areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const throw(INTERP_KERNEL::Exception)
 {
   if(!MEDCouplingTimeDiscretization::areStrictlyCompatible(other,reason))
     return false;
@@ -1343,7 +1343,7 @@ bool MEDCouplingWithTimeStep::areStrictlyCompatible(const MEDCouplingTimeDiscret
   return ret;
 }
 
-bool MEDCouplingWithTimeStep::areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const
+bool MEDCouplingWithTimeStep::areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForMul(other))
     return false;
@@ -1351,7 +1351,7 @@ bool MEDCouplingWithTimeStep::areStrictlyCompatibleForMul(const MEDCouplingTimeD
   return otherC!=0;
 }
 
-bool MEDCouplingWithTimeStep::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const
+bool MEDCouplingWithTimeStep::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForDiv(other))
     return false;
@@ -1359,7 +1359,7 @@ bool MEDCouplingWithTimeStep::areStrictlyCompatibleForDiv(const MEDCouplingTimeD
   return otherC!=0;
 }
 
-bool MEDCouplingWithTimeStep::areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const
+bool MEDCouplingWithTimeStep::areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   if(!MEDCouplingTimeDiscretization::areCompatibleForMeld(other))
     return false;
@@ -1367,7 +1367,7 @@ bool MEDCouplingWithTimeStep::areCompatibleForMeld(const MEDCouplingTimeDiscreti
   return otherC!=0;
 }
 
-bool MEDCouplingWithTimeStep::isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const
+bool MEDCouplingWithTimeStep::isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
   std::ostringstream oss; oss.precision(15);
@@ -1397,7 +1397,7 @@ bool MEDCouplingWithTimeStep::isEqualIfNotWhy(const MEDCouplingTimeDiscretizatio
   return MEDCouplingTimeDiscretization::isEqualIfNotWhy(other,prec,reason);
 }
 
-bool MEDCouplingWithTimeStep::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const
+bool MEDCouplingWithTimeStep::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
   if(!otherC)
@@ -1422,7 +1422,7 @@ void MEDCouplingWithTimeStep::copyTinyAttrFrom(const MEDCouplingTimeDiscretizati
   _order=otherC->_order;
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::aggregate(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::aggregate(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
   if(!otherC)
@@ -1433,7 +1433,7 @@ MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::aggregate(const MEDCoupl
   return ret;
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const
+MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const throw(INTERP_KERNEL::Exception)
 {
   std::vector<const DataArrayDouble *> a(other.size());
   int i=0;
@@ -1450,7 +1450,7 @@ MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::aggregate(const std::vec
   return ret;
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::meld(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::meld(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
   if(!otherC)
@@ -1461,7 +1461,7 @@ MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::meld(const MEDCouplingTi
   return ret;
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::dot(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::dot(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
   if(!otherC)
@@ -1472,7 +1472,7 @@ MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::dot(const MEDCouplingTim
   return ret;
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::crossProduct(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::crossProduct(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
   if(!otherC)
@@ -1483,7 +1483,7 @@ MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::crossProduct(const MEDCo
   return ret;
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::max(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::max(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
   if(!otherC)
@@ -1494,7 +1494,7 @@ MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::max(const MEDCouplingTim
   return ret;
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::min(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::min(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
   if(!otherC)
@@ -1505,7 +1505,7 @@ MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::min(const MEDCouplingTim
   return ret;
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::add(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::add(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
   if(!otherC)
@@ -1519,7 +1519,7 @@ MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::add(const MEDCouplingTim
   return ret;
 }
 
-void MEDCouplingWithTimeStep::addEqual(const MEDCouplingTimeDiscretization *other)
+void MEDCouplingWithTimeStep::addEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
   if(!otherC)
@@ -1529,7 +1529,7 @@ void MEDCouplingWithTimeStep::addEqual(const MEDCouplingTimeDiscretization *othe
   getArray()->addEqual(other->getArray());
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::substract(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::substract(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
   if(!otherC)
@@ -1543,7 +1543,7 @@ MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::substract(const MEDCoupl
   return ret;
 }
 
-void MEDCouplingWithTimeStep::substractEqual(const MEDCouplingTimeDiscretization *other)
+void MEDCouplingWithTimeStep::substractEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
   if(!otherC)
@@ -1553,7 +1553,7 @@ void MEDCouplingWithTimeStep::substractEqual(const MEDCouplingTimeDiscretization
   getArray()->substractEqual(other->getArray());
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::multiply(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::multiply(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
   if(!otherC)
@@ -1567,7 +1567,7 @@ MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::multiply(const MEDCoupli
   return ret;
 }
 
-void MEDCouplingWithTimeStep::multiplyEqual(const MEDCouplingTimeDiscretization *other)
+void MEDCouplingWithTimeStep::multiplyEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
   if(!otherC)
@@ -1577,7 +1577,7 @@ void MEDCouplingWithTimeStep::multiplyEqual(const MEDCouplingTimeDiscretization
   getArray()->multiplyEqual(other->getArray());
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::divide(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::divide(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
   if(!otherC)
@@ -1591,7 +1591,7 @@ MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::divide(const MEDCoupling
   return ret;
 }
 
-void MEDCouplingWithTimeStep::divideEqual(const MEDCouplingTimeDiscretization *other)
+void MEDCouplingWithTimeStep::divideEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
   if(!otherC)
@@ -1601,7 +1601,7 @@ void MEDCouplingWithTimeStep::divideEqual(const MEDCouplingTimeDiscretization *o
   getArray()->divideEqual(other->getArray());
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::pow(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::pow(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
   if(!otherC)
@@ -1615,7 +1615,7 @@ MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::pow(const MEDCouplingTim
   return ret;
 }
 
-void MEDCouplingWithTimeStep::powEqual(const MEDCouplingTimeDiscretization *other)
+void MEDCouplingWithTimeStep::powEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
   if(!otherC)
@@ -1625,7 +1625,7 @@ void MEDCouplingWithTimeStep::powEqual(const MEDCouplingTimeDiscretization *othe
   getArray()->powEqual(other->getArray());
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::performCpy(bool deepCpy) const
+MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception)
 {
   return new MEDCouplingWithTimeStep(*this,deepCpy);
 }
@@ -1657,7 +1657,7 @@ std::vector< const DataArrayDouble *> MEDCouplingWithTimeStep::getArraysForTime(
     throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
 }
 
-void MEDCouplingWithTimeStep::getValueForTime(double time, const std::vector<double>& vals, double *res) const
+void MEDCouplingWithTimeStep::getValueForTime(double time, const std::vector<double>& vals, double *res) const throw(INTERP_KERNEL::Exception)
 {
   std::copy(vals.begin(),vals.end(),res);
 }
@@ -1702,7 +1702,7 @@ void MEDCouplingConstOnTimeInterval::copyTinyAttrFrom(const MEDCouplingTimeDiscr
   _end_order=otherC->_end_order;
 }
 
-void MEDCouplingConstOnTimeInterval::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
+void MEDCouplingConstOnTimeInterval::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception)
 {
   MEDCouplingTimeDiscretization::getTinySerializationIntInformation(tinyInfo);
   tinyInfo.push_back(_start_iteration);
@@ -1711,14 +1711,14 @@ void MEDCouplingConstOnTimeInterval::getTinySerializationIntInformation(std::vec
   tinyInfo.push_back(_end_order);
 }
 
-void MEDCouplingConstOnTimeInterval::getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const
+void MEDCouplingConstOnTimeInterval::getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const throw(INTERP_KERNEL::Exception)
 {
   MEDCouplingTimeDiscretization::getTinySerializationDbleInformation(tinyInfo);
   tinyInfo.push_back(_start_time);
   tinyInfo.push_back(_end_time);
 }
 
-void MEDCouplingConstOnTimeInterval::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
+void MEDCouplingConstOnTimeInterval::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS) throw(INTERP_KERNEL::Exception)
 {
   MEDCouplingTimeDiscretization::finishUnserialization(tinyInfoI,tinyInfoD,tinyInfoS);
   _start_time=tinyInfoD[1];
@@ -1732,7 +1732,7 @@ void MEDCouplingConstOnTimeInterval::finishUnserialization(const std::vector<int
 /*!
  * idem getTinySerializationIntInformation except that it is for multi field fetch
  */
-void MEDCouplingConstOnTimeInterval::getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const
+void MEDCouplingConstOnTimeInterval::getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception)
 {
   tinyInfo.resize(4);
   tinyInfo[0]=_start_iteration;
@@ -1744,7 +1744,7 @@ void MEDCouplingConstOnTimeInterval::getTinySerializationIntInformation2(std::ve
 /*!
  * idem getTinySerializationDbleInformation except that it is for multi field fetch
  */
-void MEDCouplingConstOnTimeInterval::getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const
+void MEDCouplingConstOnTimeInterval::getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const throw(INTERP_KERNEL::Exception)
 {
   tinyInfo.resize(3);
   tinyInfo[0]=_time_tolerance;
@@ -1755,7 +1755,7 @@ void MEDCouplingConstOnTimeInterval::getTinySerializationDbleInformation2(std::v
 /*!
  * idem finishUnserialization except that it is for multi field fetch
  */
-void MEDCouplingConstOnTimeInterval::finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD)
+void MEDCouplingConstOnTimeInterval::finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD) throw(INTERP_KERNEL::Exception)
 {
   _start_iteration=tinyInfoI[0];
   _start_order=tinyInfoI[1];
@@ -1772,7 +1772,7 @@ MEDCouplingConstOnTimeInterval::MEDCouplingConstOnTimeInterval(const MEDCoupling
 {
 }
 
-std::string MEDCouplingConstOnTimeInterval::getStringRepr() const
+std::string MEDCouplingConstOnTimeInterval::getStringRepr() const throw(INTERP_KERNEL::Exception)
 {
   std::ostringstream stream;
   stream << REPR << " Time interval is defined by :\niteration_start=" << _start_iteration << " order_start=" << _start_order << " and time_start=" << _start_time << "\n";
@@ -1793,7 +1793,7 @@ void MEDCouplingConstOnTimeInterval::synchronizeTimeWith(const MEDCouplingMesh *
   _time_unit=tUnit;
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::performCpy(bool deepCpy) const
+MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception)
 {
   return new MEDCouplingConstOnTimeInterval(*this,deepCpy);
 }
@@ -1810,12 +1810,12 @@ std::vector< const DataArrayDouble *> MEDCouplingConstOnTimeInterval::getArraysF
     throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
 }
 
-void MEDCouplingConstOnTimeInterval::getValueForTime(double time, const std::vector<double>& vals, double *res) const
+void MEDCouplingConstOnTimeInterval::getValueForTime(double time, const std::vector<double>& vals, double *res) const throw(INTERP_KERNEL::Exception)
 {
   std::copy(vals.begin(),vals.end(),res);
 }
 
-bool MEDCouplingConstOnTimeInterval::areCompatible(const MEDCouplingTimeDiscretization *other) const
+bool MEDCouplingConstOnTimeInterval::areCompatible(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   if(!MEDCouplingTimeDiscretization::areCompatible(other))
     return false;
@@ -1823,7 +1823,7 @@ bool MEDCouplingConstOnTimeInterval::areCompatible(const MEDCouplingTimeDiscreti
   return otherC!=0;
 }
 
-bool MEDCouplingConstOnTimeInterval::areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const
+bool MEDCouplingConstOnTimeInterval::areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const throw(INTERP_KERNEL::Exception)
 {
   if(!MEDCouplingTimeDiscretization::areStrictlyCompatible(other,reason))
     return false;
@@ -1834,7 +1834,7 @@ bool MEDCouplingConstOnTimeInterval::areStrictlyCompatible(const MEDCouplingTime
   return ret;
 }
 
-bool MEDCouplingConstOnTimeInterval::areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const
+bool MEDCouplingConstOnTimeInterval::areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForMul(other))
     return false;
@@ -1842,7 +1842,7 @@ bool MEDCouplingConstOnTimeInterval::areStrictlyCompatibleForMul(const MEDCoupli
   return otherC!=0;
 }
 
-bool MEDCouplingConstOnTimeInterval::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const
+bool MEDCouplingConstOnTimeInterval::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForDiv(other))
     return false;
@@ -1850,7 +1850,7 @@ bool MEDCouplingConstOnTimeInterval::areStrictlyCompatibleForDiv(const MEDCoupli
   return otherC!=0;
 }
 
-bool MEDCouplingConstOnTimeInterval::areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const
+bool MEDCouplingConstOnTimeInterval::areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   if(!MEDCouplingTimeDiscretization::areCompatibleForMeld(other))
     return false;
@@ -1858,7 +1858,7 @@ bool MEDCouplingConstOnTimeInterval::areCompatibleForMeld(const MEDCouplingTimeD
   return otherC!=0;
 }
 
-bool MEDCouplingConstOnTimeInterval::isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const
+bool MEDCouplingConstOnTimeInterval::isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
   std::ostringstream oss; oss.precision(15);
@@ -1906,7 +1906,7 @@ bool MEDCouplingConstOnTimeInterval::isEqualIfNotWhy(const MEDCouplingTimeDiscre
   return MEDCouplingTimeDiscretization::isEqualIfNotWhy(other,prec,reason);
 }
 
-bool MEDCouplingConstOnTimeInterval::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const
+bool MEDCouplingConstOnTimeInterval::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
   if(!otherC)
@@ -1964,7 +1964,7 @@ void MEDCouplingConstOnTimeInterval::checkTimePresence(double time) const throw(
     }
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::aggregate(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::aggregate(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
   if(!otherC)
@@ -1975,7 +1975,7 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::aggregate(const M
   return ret;
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const
+MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const throw(INTERP_KERNEL::Exception)
 {
   std::vector<const DataArrayDouble *> a(other.size());
   int i=0;
@@ -1992,7 +1992,7 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::aggregate(const s
   return ret;
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::meld(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::meld(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
   if(!otherC)
@@ -2004,7 +2004,7 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::meld(const MEDCou
   return ret;
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::dot(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::dot(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
   if(!otherC)
@@ -2015,7 +2015,7 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::dot(const MEDCoup
   return ret;
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::crossProduct(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::crossProduct(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
   if(!otherC)
@@ -2026,7 +2026,7 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::crossProduct(cons
   return ret;
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::max(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::max(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
   if(!otherC)
@@ -2037,7 +2037,7 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::max(const MEDCoup
   return ret;
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::min(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::min(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
   if(!otherC)
@@ -2048,7 +2048,7 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::min(const MEDCoup
   return ret;
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::add(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::add(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
   if(!otherC)
@@ -2064,7 +2064,7 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::add(const MEDCoup
   return ret;
 }
 
-void MEDCouplingConstOnTimeInterval::addEqual(const MEDCouplingTimeDiscretization *other)
+void MEDCouplingConstOnTimeInterval::addEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
   if(!otherC)
@@ -2074,7 +2074,7 @@ void MEDCouplingConstOnTimeInterval::addEqual(const MEDCouplingTimeDiscretizatio
   getArray()->addEqual(other->getArray());
 }
  
-MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::substract(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::substract(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
   if(!otherC)
@@ -2090,7 +2090,7 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::substract(const M
   return ret;
 }
 
-void MEDCouplingConstOnTimeInterval::substractEqual(const MEDCouplingTimeDiscretization *other)
+void MEDCouplingConstOnTimeInterval::substractEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
   if(!otherC)
@@ -2100,7 +2100,7 @@ void MEDCouplingConstOnTimeInterval::substractEqual(const MEDCouplingTimeDiscret
   getArray()->substractEqual(other->getArray());
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::multiply(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::multiply(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
   if(!otherC)
@@ -2116,7 +2116,7 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::multiply(const ME
   return ret;
 }
 
-void MEDCouplingConstOnTimeInterval::multiplyEqual(const MEDCouplingTimeDiscretization *other)
+void MEDCouplingConstOnTimeInterval::multiplyEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
   if(!otherC)
@@ -2126,7 +2126,7 @@ void MEDCouplingConstOnTimeInterval::multiplyEqual(const MEDCouplingTimeDiscreti
   getArray()->multiplyEqual(other->getArray());
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::divide(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::divide(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
   if(!otherC)
@@ -2142,7 +2142,7 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::divide(const MEDC
   return ret;
 }
 
-void MEDCouplingConstOnTimeInterval::divideEqual(const MEDCouplingTimeDiscretization *other)
+void MEDCouplingConstOnTimeInterval::divideEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
   if(!otherC)
@@ -2152,7 +2152,7 @@ void MEDCouplingConstOnTimeInterval::divideEqual(const MEDCouplingTimeDiscretiza
   getArray()->divideEqual(other->getArray());
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::pow(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::pow(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
   if(!otherC)
@@ -2168,7 +2168,7 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::pow(const MEDCoup
   return ret;
 }
 
-void MEDCouplingConstOnTimeInterval::powEqual(const MEDCouplingTimeDiscretization *other)
+void MEDCouplingConstOnTimeInterval::powEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
   if(!otherC)
@@ -2230,7 +2230,7 @@ void MEDCouplingTwoTimeSteps::copyTinyAttrFrom(const MEDCouplingTimeDiscretizati
   _end_order=otherC->_end_order;
 }
 
-void MEDCouplingTwoTimeSteps::copyTinyStringsFrom(const MEDCouplingTimeDiscretization& other)
+void MEDCouplingTwoTimeSteps::copyTinyStringsFrom(const MEDCouplingTimeDiscretization& other) throw(INTERP_KERNEL::Exception)
 {
   MEDCouplingTimeDiscretization::copyTinyStringsFrom(other);
   const MEDCouplingTwoTimeSteps *otherC=dynamic_cast<const MEDCouplingTwoTimeSteps *>(&other);
@@ -2240,12 +2240,12 @@ void MEDCouplingTwoTimeSteps::copyTinyStringsFrom(const MEDCouplingTimeDiscretiz
     _end_array->copyStringInfoFrom(*otherC->_end_array);
 }
 
-const DataArrayDouble *MEDCouplingTwoTimeSteps::getEndArray() const
+const DataArrayDouble *MEDCouplingTwoTimeSteps::getEndArray() const throw(INTERP_KERNEL::Exception)
 {
   return _end_array;
 }
 
-DataArrayDouble *MEDCouplingTwoTimeSteps::getEndArray()
+DataArrayDouble *MEDCouplingTwoTimeSteps::getEndArray() throw(INTERP_KERNEL::Exception)
 {
   return _end_array;
 }
@@ -2261,7 +2261,7 @@ void MEDCouplingTwoTimeSteps::checkCoherency() const throw(INTERP_KERNEL::Except
     throw INTERP_KERNEL::Exception("The number of tuples mismatch between the start and the end arrays !");
 }
 
-bool MEDCouplingTwoTimeSteps::isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const
+bool MEDCouplingTwoTimeSteps::isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const throw(INTERP_KERNEL::Exception)
 {
   std::ostringstream oss;
   const MEDCouplingTwoTimeSteps *otherC=dynamic_cast<const MEDCouplingTwoTimeSteps *>(other);
@@ -2315,7 +2315,7 @@ bool MEDCouplingTwoTimeSteps::isEqualIfNotWhy(const MEDCouplingTimeDiscretizatio
   return MEDCouplingTimeDiscretization::isEqualIfNotWhy(other,prec,reason);
 }
 
-bool MEDCouplingTwoTimeSteps::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const
+bool MEDCouplingTwoTimeSteps::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingTwoTimeSteps *otherC=dynamic_cast<const MEDCouplingTwoTimeSteps *>(other);
   if(!otherC)
@@ -2364,14 +2364,14 @@ void MEDCouplingTwoTimeSteps::checkTimePresence(double time) const throw(INTERP_
     }
 }
 
-void MEDCouplingTwoTimeSteps::getArrays(std::vector<DataArrayDouble *>& arrays) const
+void MEDCouplingTwoTimeSteps::getArrays(std::vector<DataArrayDouble *>& arrays) const throw(INTERP_KERNEL::Exception)
 {
   arrays.resize(2);
   arrays[0]=_array;
   arrays[1]=_end_array;
 }
 
-void MEDCouplingTwoTimeSteps::setEndArray(DataArrayDouble *array, TimeLabel *owner)
+void MEDCouplingTwoTimeSteps::setEndArray(DataArrayDouble *array, TimeLabel *owner) throw(INTERP_KERNEL::Exception)
 {
   if(array!=_end_array)
     {
@@ -2385,7 +2385,7 @@ void MEDCouplingTwoTimeSteps::setEndArray(DataArrayDouble *array, TimeLabel *own
     }
 }
 
-void MEDCouplingTwoTimeSteps::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
+void MEDCouplingTwoTimeSteps::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception)
 {
   MEDCouplingTimeDiscretization::getTinySerializationIntInformation(tinyInfo);
   tinyInfo.push_back(_start_iteration);
@@ -2404,14 +2404,14 @@ void MEDCouplingTwoTimeSteps::getTinySerializationIntInformation(std::vector<int
     }
 }
 
-void MEDCouplingTwoTimeSteps::getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const
+void MEDCouplingTwoTimeSteps::getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const throw(INTERP_KERNEL::Exception)
 {
   MEDCouplingTimeDiscretization::getTinySerializationDbleInformation(tinyInfo);
   tinyInfo.push_back(_start_time);
   tinyInfo.push_back(_end_time);
 }
 
-void MEDCouplingTwoTimeSteps::getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const
+void MEDCouplingTwoTimeSteps::getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const throw(INTERP_KERNEL::Exception)
 {
   int nbOfCompo=_array->getNumberOfComponents();
   for(int i=0;i<nbOfCompo;i++)
@@ -2420,7 +2420,7 @@ void MEDCouplingTwoTimeSteps::getTinySerializationStrInformation(std::vector<std
     tinyInfo.push_back(_end_array->getInfoOnComponent(i));
 }
 
-void MEDCouplingTwoTimeSteps::resizeForUnserialization(const std::vector<int>& tinyInfoI, std::vector<DataArrayDouble *>& arrays)
+void MEDCouplingTwoTimeSteps::resizeForUnserialization(const std::vector<int>& tinyInfoI, std::vector<DataArrayDouble *>& arrays) throw(INTERP_KERNEL::Exception)
 {
   arrays.resize(2);
   if(_array!=0)
@@ -2445,7 +2445,7 @@ void MEDCouplingTwoTimeSteps::resizeForUnserialization(const std::vector<int>& t
   arrays[1]=arr;
 }
 
-void MEDCouplingTwoTimeSteps::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
+void MEDCouplingTwoTimeSteps::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS) throw(INTERP_KERNEL::Exception)
 {
   MEDCouplingTimeDiscretization::finishUnserialization(tinyInfoI,tinyInfoD,tinyInfoS);
   _start_time=tinyInfoD[1];
@@ -2459,7 +2459,7 @@ void MEDCouplingTwoTimeSteps::finishUnserialization(const std::vector<int>& tiny
 /*!
  * idem getTinySerializationIntInformation except that it is for multi field fetch
  */
-void MEDCouplingTwoTimeSteps::getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const
+void MEDCouplingTwoTimeSteps::getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception)
 {
   tinyInfo.resize(4);
   tinyInfo[0]=_start_iteration;
@@ -2471,7 +2471,7 @@ void MEDCouplingTwoTimeSteps::getTinySerializationIntInformation2(std::vector<in
 /*!
  * idem getTinySerializationDbleInformation except that it is for multi field fetch
  */
-void MEDCouplingTwoTimeSteps::getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const
+void MEDCouplingTwoTimeSteps::getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const throw(INTERP_KERNEL::Exception)
 {
   tinyInfo.resize(3);
   tinyInfo[0]=_time_tolerance;
@@ -2482,7 +2482,7 @@ void MEDCouplingTwoTimeSteps::getTinySerializationDbleInformation2(std::vector<d
 /*!
  * idem finishUnserialization except that it is for multi field fetch
  */
-void MEDCouplingTwoTimeSteps::finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD)
+void MEDCouplingTwoTimeSteps::finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD) throw(INTERP_KERNEL::Exception)
 {
   _start_iteration=tinyInfoI[0];
   _start_order=tinyInfoI[1];
@@ -2522,7 +2522,7 @@ MEDCouplingLinearTime::MEDCouplingLinearTime()
 {
 }
 
-std::string MEDCouplingLinearTime::getStringRepr() const
+std::string MEDCouplingLinearTime::getStringRepr() const throw(INTERP_KERNEL::Exception)
 {
   std::ostringstream stream;
   stream << REPR << " Time interval is defined by :\niteration_start=" << _start_iteration << " order_start=" << _start_order << " and time_start=" << _start_time << "\n";
@@ -2538,12 +2538,12 @@ void MEDCouplingLinearTime::checkCoherency() const throw(INTERP_KERNEL::Exceptio
     throw INTERP_KERNEL::Exception("Start time and end time are equals regarding time tolerance.");
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingLinearTime::performCpy(bool deepCpy) const
+MEDCouplingTimeDiscretization *MEDCouplingLinearTime::performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception)
 {
   return new MEDCouplingLinearTime(*this,deepCpy);
 }
 
-bool MEDCouplingLinearTime::areCompatible(const MEDCouplingTimeDiscretization *other) const
+bool MEDCouplingLinearTime::areCompatible(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   if(!MEDCouplingTimeDiscretization::areCompatible(other))
     return false;
@@ -2559,7 +2559,7 @@ bool MEDCouplingLinearTime::areCompatible(const MEDCouplingTimeDiscretization *o
   return true;
 }
 
-bool MEDCouplingLinearTime::areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const
+bool MEDCouplingLinearTime::areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const throw(INTERP_KERNEL::Exception)
 {
   if(!MEDCouplingTimeDiscretization::areStrictlyCompatible(other,reason))
     return false;
@@ -2570,7 +2570,7 @@ bool MEDCouplingLinearTime::areStrictlyCompatible(const MEDCouplingTimeDiscretiz
   return ret;
 }
 
-bool MEDCouplingLinearTime::areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const
+bool MEDCouplingLinearTime::areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForMul(other))
     return false;
@@ -2578,7 +2578,7 @@ bool MEDCouplingLinearTime::areStrictlyCompatibleForMul(const MEDCouplingTimeDis
   return otherC!=0;
 }
 
-bool MEDCouplingLinearTime::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const
+bool MEDCouplingLinearTime::areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   if(!MEDCouplingTimeDiscretization::areStrictlyCompatibleForDiv(other))
     return false;
@@ -2596,7 +2596,7 @@ bool MEDCouplingLinearTime::areStrictlyCompatibleForDiv(const MEDCouplingTimeDis
   return true;
 }
 
-bool MEDCouplingLinearTime::areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const
+bool MEDCouplingLinearTime::areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   if(!MEDCouplingTimeDiscretization::areCompatibleForMeld(other))
     return false;
@@ -2607,7 +2607,7 @@ bool MEDCouplingLinearTime::areCompatibleForMeld(const MEDCouplingTimeDiscretiza
 /*!
  * vals is expected to be of size 2*_array->getNumberOfTuples()==_array->getNumberOfTuples()+_end_array->getNumberOfTuples()
  */
-void MEDCouplingLinearTime::getValueForTime(double time, const std::vector<double>& vals, double *res) const
+void MEDCouplingLinearTime::getValueForTime(double time, const std::vector<double>& vals, double *res) const throw(INTERP_KERNEL::Exception)
 {
   double alpha=(_end_time-time)/(_end_time-_start_time);
   std::size_t nbComp=vals.size()/2;
@@ -2656,7 +2656,7 @@ void MEDCouplingLinearTime::getValueOnDiscTime(int eltId, int iteration, int ord
     throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingLinearTime::aggregate(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingLinearTime::aggregate(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
   if(!otherC)
@@ -2669,7 +2669,7 @@ MEDCouplingTimeDiscretization *MEDCouplingLinearTime::aggregate(const MEDCouplin
   return ret;
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingLinearTime::aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const
+MEDCouplingTimeDiscretization *MEDCouplingLinearTime::aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const throw(INTERP_KERNEL::Exception)
 {
   std::vector<const DataArrayDouble *> a(other.size());
   std::vector<const DataArrayDouble *> b(other.size());
@@ -2690,7 +2690,7 @@ MEDCouplingTimeDiscretization *MEDCouplingLinearTime::aggregate(const std::vecto
   return ret;
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingLinearTime::meld(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingLinearTime::meld(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
   if(!otherC)
@@ -2704,7 +2704,7 @@ MEDCouplingTimeDiscretization *MEDCouplingLinearTime::meld(const MEDCouplingTime
   return ret;
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingLinearTime::dot(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingLinearTime::dot(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
   if(!otherC)
@@ -2717,7 +2717,7 @@ MEDCouplingTimeDiscretization *MEDCouplingLinearTime::dot(const MEDCouplingTimeD
   return ret;
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingLinearTime::crossProduct(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingLinearTime::crossProduct(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
   if(!otherC)
@@ -2730,7 +2730,7 @@ MEDCouplingTimeDiscretization *MEDCouplingLinearTime::crossProduct(const MEDCoup
   return ret;
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingLinearTime::max(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingLinearTime::max(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
   if(!otherC)
@@ -2743,7 +2743,7 @@ MEDCouplingTimeDiscretization *MEDCouplingLinearTime::max(const MEDCouplingTimeD
   return ret;
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingLinearTime::min(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingLinearTime::min(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
   if(!otherC)
@@ -2756,7 +2756,7 @@ MEDCouplingTimeDiscretization *MEDCouplingLinearTime::min(const MEDCouplingTimeD
   return ret;
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingLinearTime::add(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingLinearTime::add(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
   if(!otherC)
@@ -2769,7 +2769,7 @@ MEDCouplingTimeDiscretization *MEDCouplingLinearTime::add(const MEDCouplingTimeD
   return ret;
 }
 
-void MEDCouplingLinearTime::addEqual(const MEDCouplingTimeDiscretization *other)
+void MEDCouplingLinearTime::addEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
   if(!otherC)
@@ -2782,7 +2782,7 @@ void MEDCouplingLinearTime::addEqual(const MEDCouplingTimeDiscretization *other)
   getEndArray()->addEqual(other->getEndArray());
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingLinearTime::substract(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingLinearTime::substract(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
   if(!otherC)
@@ -2795,7 +2795,7 @@ MEDCouplingTimeDiscretization *MEDCouplingLinearTime::substract(const MEDCouplin
   return ret;
 }
 
-void MEDCouplingLinearTime::substractEqual(const MEDCouplingTimeDiscretization *other)
+void MEDCouplingLinearTime::substractEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
   if(!otherC)
@@ -2808,7 +2808,7 @@ void MEDCouplingLinearTime::substractEqual(const MEDCouplingTimeDiscretization *
   getEndArray()->substractEqual(other->getEndArray());
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingLinearTime::multiply(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingLinearTime::multiply(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
   if(!otherC)
@@ -2821,7 +2821,7 @@ MEDCouplingTimeDiscretization *MEDCouplingLinearTime::multiply(const MEDCoupling
   return ret;
 }
 
-void MEDCouplingLinearTime::multiplyEqual(const MEDCouplingTimeDiscretization *other)
+void MEDCouplingLinearTime::multiplyEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
   if(!otherC)
@@ -2834,7 +2834,7 @@ void MEDCouplingLinearTime::multiplyEqual(const MEDCouplingTimeDiscretization *o
   getEndArray()->multiplyEqual(other->getEndArray());
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingLinearTime::divide(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingLinearTime::divide(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
   if(!otherC)
@@ -2847,7 +2847,7 @@ MEDCouplingTimeDiscretization *MEDCouplingLinearTime::divide(const MEDCouplingTi
   return ret;
 }
 
-void MEDCouplingLinearTime::divideEqual(const MEDCouplingTimeDiscretization *other)
+void MEDCouplingLinearTime::divideEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
   if(!otherC)
@@ -2860,7 +2860,7 @@ void MEDCouplingLinearTime::divideEqual(const MEDCouplingTimeDiscretization *oth
   getEndArray()->divideEqual(other->getEndArray());
 }
 
-MEDCouplingTimeDiscretization *MEDCouplingLinearTime::pow(const MEDCouplingTimeDiscretization *other) const
+MEDCouplingTimeDiscretization *MEDCouplingLinearTime::pow(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
   if(!otherC)
@@ -2873,7 +2873,7 @@ MEDCouplingTimeDiscretization *MEDCouplingLinearTime::pow(const MEDCouplingTimeD
   return ret;
 }
 
-void MEDCouplingLinearTime::powEqual(const MEDCouplingTimeDiscretization *other)
+void MEDCouplingLinearTime::powEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
   if(!otherC)
index b252ef5e1718e94b81ae3b2b6407ee2a1df3b71a..8cdbbe957e08eba584c4ebf5d3e4c94c71da2ed4 100644 (file)
@@ -42,64 +42,64 @@ namespace ParaMEDMEM
   public:
     void updateTime() const;
     virtual std::size_t getHeapMemorySize() const;
-    static MEDCouplingTimeDiscretization *New(TypeOfTimeDiscretization type);
+    static MEDCouplingTimeDiscretization *New(TypeOfTimeDiscretization type) throw(INTERP_KERNEL::Exception);
     void setTimeUnit(const char *unit) { _time_unit=unit; }
     const char *getTimeUnit() const { return _time_unit.c_str(); }
     virtual void copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other) throw(INTERP_KERNEL::Exception);
-    virtual void copyTinyStringsFrom(const MEDCouplingTimeDiscretization& other);
+    virtual void copyTinyStringsFrom(const MEDCouplingTimeDiscretization& other) throw(INTERP_KERNEL::Exception);
     virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
-    virtual bool areCompatible(const MEDCouplingTimeDiscretization *other) const;
-    virtual bool areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const;
-    virtual bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const;
-    virtual bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const;
-    virtual bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const;
-    virtual bool isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const;
-    virtual bool isEqual(const MEDCouplingTimeDiscretization *other, double prec) const;
-    virtual bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const;
-    virtual MEDCouplingTimeDiscretization *buildNewTimeReprFromThis(TypeOfTimeDiscretization type, bool deepCpy) const;
-    virtual std::string getStringRepr() const = 0;
-    virtual TypeOfTimeDiscretization getEnum() const = 0;
+    virtual bool areCompatible(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    virtual bool areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const throw(INTERP_KERNEL::Exception);
+    virtual bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    virtual bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    virtual bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    virtual bool isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const throw(INTERP_KERNEL::Exception);
+    virtual bool isEqual(const MEDCouplingTimeDiscretization *other, double prec) const throw(INTERP_KERNEL::Exception);
+    virtual bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const throw(INTERP_KERNEL::Exception);
+    virtual MEDCouplingTimeDiscretization *buildNewTimeReprFromThis(TypeOfTimeDiscretization type, bool deepCpy) const throw(INTERP_KERNEL::Exception);
+    virtual std::string getStringRepr() const throw(INTERP_KERNEL::Exception) = 0;
+    virtual TypeOfTimeDiscretization getEnum() const throw(INTERP_KERNEL::Exception) = 0;
     virtual void synchronizeTimeWith(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception) = 0;
-    virtual MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const = 0;
-    virtual MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const = 0;
-    virtual MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const = 0;
-    virtual MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const = 0;
-    virtual MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const = 0;
-    virtual MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const = 0;
-    virtual MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const = 0;
-    virtual MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const = 0;
-    virtual void addEqual(const MEDCouplingTimeDiscretization *other) = 0;
-    virtual MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const = 0;
-    virtual void substractEqual(const MEDCouplingTimeDiscretization *other) = 0;
-    virtual MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const = 0;
-    virtual void multiplyEqual(const MEDCouplingTimeDiscretization *other) = 0;
-    virtual MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const = 0;
-    virtual void divideEqual(const MEDCouplingTimeDiscretization *other) = 0;
-    virtual MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const = 0;
-    virtual void powEqual(const MEDCouplingTimeDiscretization *other) = 0;
-    virtual void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
-    virtual void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
-    virtual void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
-    virtual void resizeForUnserialization(const std::vector<int>& tinyInfoI, std::vector<DataArrayDouble *>& arrays);
-    virtual void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
-    virtual void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const = 0;
-    virtual void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const = 0;
-    virtual void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD) = 0;
-    virtual MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const = 0;
+    virtual MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception) = 0;
+    virtual MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const throw(INTERP_KERNEL::Exception) = 0;
+    virtual MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception) = 0;
+    virtual MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception) = 0;
+    virtual MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception) = 0;
+    virtual MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception) = 0;
+    virtual MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception) = 0;
+    virtual MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception) = 0;
+    virtual void addEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception) = 0;
+    virtual MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception) = 0;
+    virtual void substractEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception) = 0;
+    virtual MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception) = 0;
+    virtual void multiplyEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception) = 0;
+    virtual MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception) = 0;
+    virtual void divideEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception) = 0;
+    virtual MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception) = 0;
+    virtual void powEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception) = 0;
+    virtual void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
+    virtual void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const throw(INTERP_KERNEL::Exception);
+    virtual void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const throw(INTERP_KERNEL::Exception);
+    virtual void resizeForUnserialization(const std::vector<int>& tinyInfoI, std::vector<DataArrayDouble *>& arrays) throw(INTERP_KERNEL::Exception);
+    virtual void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS) throw(INTERP_KERNEL::Exception);
+    virtual void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception) = 0;
+    virtual void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const throw(INTERP_KERNEL::Exception) = 0;
+    virtual void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD) throw(INTERP_KERNEL::Exception) = 0;
+    virtual MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception) = 0;
     void setTimeTolerance(double val) { _time_tolerance=val; }
     double getTimeTolerance() const { return _time_tolerance; }
     virtual void checkNoTimePresence() const throw(INTERP_KERNEL::Exception) = 0;
     virtual void checkTimePresence(double time) const throw(INTERP_KERNEL::Exception) = 0;
-    virtual void setArray(DataArrayDouble *array, TimeLabel *owner);
-    virtual void setEndArray(DataArrayDouble *array, TimeLabel *owner);
+    virtual void setArray(DataArrayDouble *array, TimeLabel *owner) throw(INTERP_KERNEL::Exception);
+    virtual void setEndArray(DataArrayDouble *array, TimeLabel *owner) throw(INTERP_KERNEL::Exception);
     virtual void setArrays(const std::vector<DataArrayDouble *>& arrays, TimeLabel *owner) throw(INTERP_KERNEL::Exception);
-    DataArrayDouble *getArray() { return _array; }
-    const DataArrayDouble *getArray() const { return _array; }
-    virtual const DataArrayDouble *getEndArray() const;
-    virtual DataArrayDouble *getEndArray();
+    DataArrayDouble *getArray() throw(INTERP_KERNEL::Exception) { return _array; }
+    const DataArrayDouble *getArray() const throw(INTERP_KERNEL::Exception) { return _array; }
+    virtual const DataArrayDouble *getEndArray() const throw(INTERP_KERNEL::Exception);
+    virtual DataArrayDouble *getEndArray() throw(INTERP_KERNEL::Exception);
     virtual std::vector< const DataArrayDouble *> getArraysForTime(double time) const throw(INTERP_KERNEL::Exception) = 0;
-    virtual void getValueForTime(double time, const std::vector<double>& vals, double *res) const = 0; 
-    virtual void getArrays(std::vector<DataArrayDouble *>& arrays) const;
+    virtual void getValueForTime(double time, const std::vector<double>& vals, double *res) const throw(INTERP_KERNEL::Exception) = 0; 
+    virtual void getArrays(std::vector<DataArrayDouble *>& arrays) const throw(INTERP_KERNEL::Exception);
     virtual bool isBefore(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
     virtual bool isStrictlyBefore(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
     double getTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception) { return getStartTime(iteration,order); }
@@ -134,16 +134,16 @@ namespace ParaMEDMEM
     virtual void setSelectedComponents(const MEDCouplingTimeDiscretization *other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
     virtual void changeNbOfComponents(int newNbOfComp, double dftValue) throw(INTERP_KERNEL::Exception);
     virtual void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
-    virtual void setUniformValue(int nbOfTuple, int nbOfCompo, double value);
-    virtual void setOrCreateUniformValueOnAllComponents(int nbOfTuple, double value);
-    virtual void applyLin(double a, double b, int compoId);
-    virtual void applyFunc(int nbOfComp, FunctionToEvaluate func);
-    virtual void applyFunc(int nbOfComp, const char *func);
-    virtual void applyFunc2(int nbOfComp, const char *func);
-    virtual void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func);
-    virtual void applyFunc(const char *func);
-    virtual void applyFuncFast32(const char *func);
-    virtual void applyFuncFast64(const char *func);
+    virtual void setUniformValue(int nbOfTuple, int nbOfCompo, double value) throw(INTERP_KERNEL::Exception);
+    virtual void setOrCreateUniformValueOnAllComponents(int nbOfTuple, double value) throw(INTERP_KERNEL::Exception);
+    virtual void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
+    virtual void applyFunc(int nbOfComp, FunctionToEvaluate func) throw(INTERP_KERNEL::Exception);
+    virtual void applyFunc(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
+    virtual void applyFunc2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
+    virtual void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
+    virtual void applyFunc(const char *func) throw(INTERP_KERNEL::Exception);
+    virtual void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception);
+    virtual void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception);
     virtual void fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, FunctionToEvaluate func) throw(INTERP_KERNEL::Exception);
     virtual void fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
     virtual void fillFromAnalytic2(const DataArrayDouble *loc, int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
@@ -163,38 +163,38 @@ namespace ParaMEDMEM
   public:
     MEDCouplingNoTimeLabel();
     MEDCouplingNoTimeLabel(const MEDCouplingTimeDiscretization& other, bool deepCpy);
-    std::string getStringRepr() const;
-    TypeOfTimeDiscretization getEnum() const { return DISCRETIZATION; }
+    std::string getStringRepr() const throw(INTERP_KERNEL::Exception);
+    TypeOfTimeDiscretization getEnum() const throw(INTERP_KERNEL::Exception) { return DISCRETIZATION; }
     void synchronizeTimeWith(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
-    MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const;
-    MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const;
-    MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const;
-    MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const;
-    MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const;
-    MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const;
-    MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const;
-    MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const;
-    void addEqual(const MEDCouplingTimeDiscretization *other);
-    MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const;
-    void substractEqual(const MEDCouplingTimeDiscretization *other);
-    MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const;
-    void multiplyEqual(const MEDCouplingTimeDiscretization *other);
-    MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const;
-    void divideEqual(const MEDCouplingTimeDiscretization *other);
-    MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const;
-    void powEqual(const MEDCouplingTimeDiscretization *other);
-    bool isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const;
-    bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const;
-    bool areCompatible(const MEDCouplingTimeDiscretization *other) const;
-    bool areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const;
-    bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const;
-    bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const;
-    bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const;
-    MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const;
+    MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    void addEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    void substractEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    void multiplyEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    void divideEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    void powEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception);
+    bool isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const throw(INTERP_KERNEL::Exception);
+    bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const throw(INTERP_KERNEL::Exception);
+    bool areCompatible(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    bool areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const throw(INTERP_KERNEL::Exception);
+    bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
     void checkNoTimePresence() const throw(INTERP_KERNEL::Exception) { }
     void checkTimePresence(double time) const throw(INTERP_KERNEL::Exception);
     std::vector< const DataArrayDouble *> getArraysForTime(double time) const throw(INTERP_KERNEL::Exception);
-    void getValueForTime(double time, const std::vector<double>& vals, double *res) const;
+    void getValueForTime(double time, const std::vector<double>& vals, double *res) const throw(INTERP_KERNEL::Exception);
     bool isBefore(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
     bool isStrictlyBefore(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
     double getStartTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception);
@@ -209,9 +209,9 @@ namespace ParaMEDMEM
     void setEndTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception);
     void getValueOnTime(int eltId, double time, double *value) const throw(INTERP_KERNEL::Exception);
     void getValueOnDiscTime(int eltId, int iteration, int order, double *value) const throw(INTERP_KERNEL::Exception);
-    void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const;
-    void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const;
-    void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD);
+    void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
+    void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const throw(INTERP_KERNEL::Exception);
+    void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD) throw(INTERP_KERNEL::Exception);
   public:
     static const TypeOfTimeDiscretization DISCRETIZATION=NO_TIME;
     static const char REPR[];
@@ -225,41 +225,41 @@ namespace ParaMEDMEM
     MEDCouplingWithTimeStep(const MEDCouplingWithTimeStep& other, bool deepCpy);
   public:
     MEDCouplingWithTimeStep();
-    std::string getStringRepr() const;
+    std::string getStringRepr() const throw(INTERP_KERNEL::Exception);
     void copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other) throw(INTERP_KERNEL::Exception);
-    TypeOfTimeDiscretization getEnum() const { return DISCRETIZATION; }
+    TypeOfTimeDiscretization getEnum() const throw(INTERP_KERNEL::Exception) { return DISCRETIZATION; }
     void synchronizeTimeWith(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
-    MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const;
-    MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const;
-    MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const;
-    MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const;
-    MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const;
-    MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const;
-    MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const;
-    MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const;
-    void addEqual(const MEDCouplingTimeDiscretization *other);
-    MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const;
-    void substractEqual(const MEDCouplingTimeDiscretization *other);
-    MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const;
-    void multiplyEqual(const MEDCouplingTimeDiscretization *other);
-    MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const;
-    void divideEqual(const MEDCouplingTimeDiscretization *other);
-    MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const;
-    void powEqual(const MEDCouplingTimeDiscretization *other);
-    bool isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const;
-    bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const;
-    bool areCompatible(const MEDCouplingTimeDiscretization *other) const;
-    bool areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const;
-    bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const;
-    bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const;
-    bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const;
-    void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
-    void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
-    void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
-    void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const;
-    void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const;
-    void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD);
-    MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const;
+    MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    void addEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    void substractEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    void multiplyEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    void divideEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    void powEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception);
+    bool isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const throw(INTERP_KERNEL::Exception);
+    bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const throw(INTERP_KERNEL::Exception);
+    bool areCompatible(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    bool areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const throw(INTERP_KERNEL::Exception);
+    bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
+    void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const throw(INTERP_KERNEL::Exception);
+    void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS) throw(INTERP_KERNEL::Exception);
+    void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
+    void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const throw(INTERP_KERNEL::Exception);
+    void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD) throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
     void checkNoTimePresence() const throw(INTERP_KERNEL::Exception);
     void checkTimePresence(double time) const throw(INTERP_KERNEL::Exception);
     void setStartTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception) { _time=time; _iteration=iteration; _order=order; }
@@ -273,7 +273,7 @@ namespace ParaMEDMEM
     void setStartTimeValue(double time) throw(INTERP_KERNEL::Exception) { _time=time; }
     void setEndTimeValue(double time) throw(INTERP_KERNEL::Exception) { _time=time; }
     std::vector< const DataArrayDouble *> getArraysForTime(double time) const throw(INTERP_KERNEL::Exception);
-    void getValueForTime(double time, const std::vector<double>& vals, double *res) const;
+    void getValueForTime(double time, const std::vector<double>& vals, double *res) const throw(INTERP_KERNEL::Exception);
     void getValueOnTime(int eltId, double time, double *value) const throw(INTERP_KERNEL::Exception);
     void getValueOnDiscTime(int eltId, int iteration, int order, double *value) const throw(INTERP_KERNEL::Exception);
   public:
@@ -294,44 +294,44 @@ namespace ParaMEDMEM
   public:
     MEDCouplingConstOnTimeInterval();
     void copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other) throw(INTERP_KERNEL::Exception);
-    void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
-    void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
-    void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
-    void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const;
-    void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const;
-    void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD);
-    MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const;
-    bool areCompatible(const MEDCouplingTimeDiscretization *other) const;
-    bool areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const;
-    bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const;
-    bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const;
-    bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const;
-    bool isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const;
-    bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const;
+    void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
+    void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const throw(INTERP_KERNEL::Exception);
+    void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS) throw(INTERP_KERNEL::Exception);
+    void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
+    void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const throw(INTERP_KERNEL::Exception);
+    void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD) throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
+    bool areCompatible(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    bool areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const throw(INTERP_KERNEL::Exception);
+    bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    bool isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const throw(INTERP_KERNEL::Exception);
+    bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const throw(INTERP_KERNEL::Exception);
     std::vector< const DataArrayDouble *> getArraysForTime(double time) const throw(INTERP_KERNEL::Exception);
-    void getValueForTime(double time, const std::vector<double>& vals, double *res) const;
+    void getValueForTime(double time, const std::vector<double>& vals, double *res) const throw(INTERP_KERNEL::Exception);
     void getValueOnTime(int eltId, double time, double *value) const throw(INTERP_KERNEL::Exception);
     void getValueOnDiscTime(int eltId, int iteration, int order, double *value) const throw(INTERP_KERNEL::Exception);
-    TypeOfTimeDiscretization getEnum() const { return DISCRETIZATION; }
+    TypeOfTimeDiscretization getEnum() const throw(INTERP_KERNEL::Exception) { return DISCRETIZATION; }
     void synchronizeTimeWith(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
-    std::string getStringRepr() const;
-    MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const;
-    MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const;
-    MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const;
-    MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const;
-    MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const;
-    MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const;
-    MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const;
-    MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const;
-    void addEqual(const MEDCouplingTimeDiscretization *other);
-    MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const;
-    void substractEqual(const MEDCouplingTimeDiscretization *other);
-    MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const;
-    void multiplyEqual(const MEDCouplingTimeDiscretization *other);
-    MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const;
-    void divideEqual(const MEDCouplingTimeDiscretization *other);
-    MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const;
-    void powEqual(const MEDCouplingTimeDiscretization *other);
+    std::string getStringRepr() const throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    void addEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    void substractEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    void multiplyEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    void divideEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    void powEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception);
     void setStartTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception) { _start_time=time; _start_iteration=iteration; _start_order=order; }
     void setEndTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception) { _end_time=time; _end_iteration=iteration; _end_order=order; }
     double getStartTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception) { iteration=_start_iteration; order=_start_order; return _start_time; }
@@ -369,16 +369,16 @@ namespace ParaMEDMEM
     void synchronizeTimeWith(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
     std::size_t getHeapMemorySize() const;
     void copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other) throw(INTERP_KERNEL::Exception);
-    void copyTinyStringsFrom(const MEDCouplingTimeDiscretization& other);
-    const DataArrayDouble *getEndArray() const;
-    DataArrayDouble *getEndArray();
+    void copyTinyStringsFrom(const MEDCouplingTimeDiscretization& other) throw(INTERP_KERNEL::Exception);
+    const DataArrayDouble *getEndArray() const throw(INTERP_KERNEL::Exception);
+    DataArrayDouble *getEndArray() throw(INTERP_KERNEL::Exception);
     void checkCoherency() const throw(INTERP_KERNEL::Exception);
-    bool isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const;
-    bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const;
+    bool isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const throw(INTERP_KERNEL::Exception);
+    bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const throw(INTERP_KERNEL::Exception);
     void checkNoTimePresence() const throw(INTERP_KERNEL::Exception);
     void checkTimePresence(double time) const throw(INTERP_KERNEL::Exception);
-    void getArrays(std::vector<DataArrayDouble *>& arrays) const;
-    void setEndArray(DataArrayDouble *array, TimeLabel *owner);
+    void getArrays(std::vector<DataArrayDouble *>& arrays) const throw(INTERP_KERNEL::Exception);
+    void setEndArray(DataArrayDouble *array, TimeLabel *owner) throw(INTERP_KERNEL::Exception);
     void setStartTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception) { _start_time=time; _start_iteration=iteration; _start_order=order; }
     void setEndTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception) { _end_time=time; _end_iteration=iteration; _end_order=order; }
     double getStartTime(int& iteration, int& order) const throw(INTERP_KERNEL::Exception) { iteration=_start_iteration; order=_start_order; return _start_time; }
@@ -389,14 +389,14 @@ namespace ParaMEDMEM
     void setEndOrder(int order) throw(INTERP_KERNEL::Exception) { _end_order=order; }
     void setStartTimeValue(double time) throw(INTERP_KERNEL::Exception) { _start_time=time; }
     void setEndTimeValue(double time) throw(INTERP_KERNEL::Exception) { _end_time=time; }
-    void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
-    void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
-    void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
-    void resizeForUnserialization(const std::vector<int>& tinyInfoI, std::vector<DataArrayDouble *>& arrays);
-    void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
-    void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const;
-    void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const;
-    void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD);
+    void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
+    void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const throw(INTERP_KERNEL::Exception);
+    void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const throw(INTERP_KERNEL::Exception);
+    void resizeForUnserialization(const std::vector<int>& tinyInfoI, std::vector<DataArrayDouble *>& arrays) throw(INTERP_KERNEL::Exception);
+    void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS) throw(INTERP_KERNEL::Exception);
+    void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
+    void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const throw(INTERP_KERNEL::Exception);
+    void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD) throw(INTERP_KERNEL::Exception);
     std::vector< const DataArrayDouble *> getArraysForTime(double time) const throw(INTERP_KERNEL::Exception);
     void setArrays(const std::vector<DataArrayDouble *>& arrays, TimeLabel *owner) throw(INTERP_KERNEL::Exception);
   protected:
@@ -417,35 +417,35 @@ namespace ParaMEDMEM
     MEDCouplingLinearTime(const MEDCouplingLinearTime& other, bool deepCpy);
   public:
     MEDCouplingLinearTime();
-    std::string getStringRepr() const;
-    TypeOfTimeDiscretization getEnum() const { return DISCRETIZATION; }
+    std::string getStringRepr() const throw(INTERP_KERNEL::Exception);
+    TypeOfTimeDiscretization getEnum() const throw(INTERP_KERNEL::Exception) { return DISCRETIZATION; }
     void checkCoherency() const throw(INTERP_KERNEL::Exception);
-    MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const;
-    bool areCompatible(const MEDCouplingTimeDiscretization *other) const;
-    bool areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const;
-    bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const;
-    bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const;
-    bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const;
-    void getValueForTime(double time, const std::vector<double>& vals, double *res) const;
+    MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
+    bool areCompatible(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    bool areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const throw(INTERP_KERNEL::Exception);
+    bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    void getValueForTime(double time, const std::vector<double>& vals, double *res) const throw(INTERP_KERNEL::Exception);
     void getValueOnTime(int eltId, double time, double *value) const throw(INTERP_KERNEL::Exception);
     void getValueOnDiscTime(int eltId, int iteration, int order, double *value) const throw(INTERP_KERNEL::Exception);
-    MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const;
-    MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const;
-    MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const;
-    MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const;
-    MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const;
-    MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const;
-    MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const;
-    MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const;
-    void addEqual(const MEDCouplingTimeDiscretization *other);
-    MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const;
-    void substractEqual(const MEDCouplingTimeDiscretization *other);
-    MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const;
-    void multiplyEqual(const MEDCouplingTimeDiscretization *other);
-    MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const;
-    void divideEqual(const MEDCouplingTimeDiscretization *other);
-    MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const;
-    void powEqual(const MEDCouplingTimeDiscretization *other);
+    MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *aggregate(const std::vector<const MEDCouplingTimeDiscretization *>& other) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *meld(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *dot(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *crossProduct(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *max(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *min(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *add(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    void addEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *substract(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    void substractEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *multiply(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    void multiplyEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *divide(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    void divideEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception);
+    MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception);
+    void powEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception);
   public:
     static const TypeOfTimeDiscretization DISCRETIZATION=LINEAR_TIME;
     static const char REPR[];
index b155c5ee93948a4d3f8cdf378c895d90610bec2f..6772aafafcf5162e8f05a55618b3d2b72e35dc4e 100644 (file)
@@ -26,6 +26,7 @@
 #include "InterpolationUtils.hxx"
 #include "PointLocatorAlgos.txx"
 #include "BBTree.txx"
+#include "BBTreeDst.txx"
 #include "SplitterTetra.hxx"
 #include "DirectedBoundingBox.hxx"
 #include "InterpKernelMeshQuality.hxx"
@@ -627,8 +628,8 @@ void MEDCouplingUMesh::getReverseNodalConnectivity(DataArrayInt *revNodal, DataA
 {
   checkFullyDefined();
   int nbOfNodes=getNumberOfNodes();
-  int *revNodalIndxPtr=new int[nbOfNodes+1];
-  revNodalIndx->useArray(revNodalIndxPtr,true,CPP_DEALLOC,nbOfNodes+1,1);
+  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();
@@ -646,8 +647,8 @@ void MEDCouplingUMesh::getReverseNodalConnectivity(DataArrayInt *revNodal, DataA
           }
     }
   std::transform(revNodalIndxPtr+1,revNodalIndxPtr+nbOfNodes+1,revNodalIndxPtr,revNodalIndxPtr+1,std::plus<int>());
-  int *revNodalPtr=new int[nbOfEltsInRevNodal];
-  revNodal->useArray(revNodalPtr,true,CPP_DEALLOC,nbOfEltsInRevNodal,1);
+  int *revNodalPtr=(int *)malloc((nbOfEltsInRevNodal)*sizeof(int));
+  revNodal->useArray(revNodalPtr,true,C_DEALLOC,nbOfEltsInRevNodal,1);
   std::fill(revNodalPtr,revNodalPtr+nbOfEltsInRevNodal,-1);
   for(int eltId=0;eltId<nbOfCells;eltId++)
     {
@@ -1062,7 +1063,7 @@ void MEDCouplingUMesh::convertToPolyTypes(const int *cellIdsToConvertBg, const i
           if(*iter>=0 && *iter<nbOfCells)
             {
               const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)conn[connIndex[*iter]]);
-              if(!cm.isDynamic())
+              if(!cm.isQuadratic())
                 conn[connIndex[*iter]]=INTERP_KERNEL::NORM_POLYGON;
               else
                 conn[connIndex[*iter]]=INTERP_KERNEL::NORM_QPOLYG;
@@ -1457,8 +1458,8 @@ DataArrayInt *MEDCouplingUMesh::getNodeIdsInUse(int& nbrOfNodesInUse) const thro
 /*!
  * This method returns a newly allocated array containing this->getNumberOfCells() tuples and 1 component.
  * For each cell in \b this the number of nodes constituting cell is computed.
- * Excepted for poyhedrons, the result can be deduced by performing a deltaShiftIndex on the nodal connectivity index in \b this minus 1.
- * For polyhedrons, the face separation (-1) are excluded from the couting.
+ * For each polyhedron cell, the sum of the number of nodes of each face constituting polyhedron cell is returned.
+ * So for pohyhedrons some nodes can be counted several times in the returned result.
  * 
  * \return a newly allocated array
  */
@@ -1481,6 +1482,29 @@ DataArrayInt *MEDCouplingUMesh::computeNbOfNodesPerCell() const throw(INTERP_KER
   return ret.retn();
 }
 
+/*!
+ * This method returns a newly allocated array containing this->getNumberOfCells() tuples and 1 component.
+ * For each cell in \b this the number of faces constituting (entity of dimension this->getMeshDimension()-1) cell is computed.
+ * 
+ * \return a newly allocated array
+ */
+DataArrayInt *MEDCouplingUMesh::computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception)
+{
+  checkConnectivityFullyDefined();
+  int nbOfCells=getNumberOfCells();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+  ret->alloc(nbOfCells,1);
+  int *retPtr=ret->getPointer();
+  const int *conn=getNodalConnectivity()->getConstPointer();
+  const int *connI=getNodalConnectivityIndex()->getConstPointer();
+  for(int i=0;i<nbOfCells;i++,retPtr++,connI++)
+    {
+      const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)conn[*connI]);
+      *retPtr=cm.getNumberOfSons2(conn+connI[0]+1,connI[1]-connI[0]-1);
+    }
+  return ret.retn();
+}
+
 /*!
  * Removes unused nodes (the node coordinates array is shorten) and returns an array
  * mapping between new and old node ids in "Old to New" mode. -1 values in the returned
@@ -2810,6 +2834,9 @@ void MEDCouplingUMesh::renumberCells(const int *old2NewBg, bool check) throw(INT
   //
   const int *conn=_nodal_connec->getConstPointer();
   const int *connI=_nodal_connec_index->getConstPointer();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> o2n=DataArrayInt::New(); o2n->useArray(array,false,C_DEALLOC,nbCells,1);
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> n2o=o2n->invertArrayO2N2N2O(nbCells);
+  const int *n2oPtr=n2o->begin();
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConn=DataArrayInt::New();
   newConn->alloc(_nodal_connec->getNumberOfTuples(),_nodal_connec->getNumberOfComponents());
   newConn->copyStringInfoFrom(*_nodal_connec);
@@ -2823,7 +2850,7 @@ void MEDCouplingUMesh::renumberCells(const int *old2NewBg, bool check) throw(INT
   newCI[0]=loc;
   for(int i=0;i<nbCells;i++)
     {
-      std::size_t pos=std::distance(array,std::find(array,array+nbCells,i));
+      int pos=n2oPtr[i];
       int nbOfElts=connI[pos+1]-connI[pos];
       newC=std::copy(conn+connI[pos],conn+connI[pos+1],newC);
       loc+=nbOfElts;
@@ -2832,7 +2859,7 @@ void MEDCouplingUMesh::renumberCells(const int *old2NewBg, bool check) throw(INT
   //
   setConnectivity(newConn,newConnI);
   if(check)
-    delete [] const_cast<int *>(array);
+    free(const_cast<int *>(array));
 }
 
 /*!
@@ -3467,7 +3494,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoords(const int *begin
   ret->_mesh_dim=_mesh_dim;
   ret->setCoords(_coords);
   std::size_t nbOfElemsRet=std::distance(begin,end);
-  int *connIndexRet=new int[nbOfElemsRet+1];
+  int *connIndexRet=(int *)malloc((nbOfElemsRet+1)*sizeof(int));
   connIndexRet[0]=0;
   const int *conn=_nodal_connec->getConstPointer();
   const int *connIndex=_nodal_connec_index->getConstPointer();
@@ -3478,12 +3505,12 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoords(const int *begin
         connIndexRet[newNbring+1]=connIndexRet[newNbring]+connIndex[*work+1]-connIndex[*work];
       else
         {
-          delete [] connIndexRet;
+          free(connIndexRet);
           std::ostringstream oss; oss << "MEDCouplingUMesh::buildPartOfMySelfKeepCoords : On pos #" << std::distance(begin,work) << " input cell id =" << *work << " should be in [0," << ncell << ") !";
           throw INTERP_KERNEL::Exception(oss.str().c_str());
         }
     }
-  int *connRet=new int[connIndexRet[nbOfElemsRet]];
+  int *connRet=(int *)malloc(connIndexRet[nbOfElemsRet]*sizeof(int));
   int *connRetWork=connRet;
   std::set<INTERP_KERNEL::NormalizedCellType> types;
   for(const int *work=begin;work!=end;work++)
@@ -3492,9 +3519,9 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoords(const int *begin
       connRetWork=std::copy(conn+connIndex[*work],conn+connIndex[*work+1],connRetWork);
     }
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> connRetArr=DataArrayInt::New();
-  connRetArr->useArray(connRet,true,CPP_DEALLOC,connIndexRet[nbOfElemsRet],1);
+  connRetArr->useArray(connRet,true,C_DEALLOC,connIndexRet[nbOfElemsRet],1);
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> connIndexRetArr=DataArrayInt::New();
-  connIndexRetArr->useArray(connIndexRet,true,CPP_DEALLOC,(int)nbOfElemsRet+1,1);
+  connIndexRetArr->useArray(connIndexRet,true,C_DEALLOC,(int)nbOfElemsRet+1,1);
   ret->setConnectivity(connRetArr,connIndexRetArr,false);
   ret->_types=types;
   ret->copyTinyInfoFrom(this);
@@ -4095,14 +4122,14 @@ void MEDCouplingUMesh::project1D(const double *pt, const double *v, double eps,
 }
 
 /*!
- * This method computes the distance from a point \a pt to \a this and the first \a cellId and \a nodeId in \a this corresponding to the returned distance. 
+ * This method computes the distance from a point \a pt to \a this and the first \a cellId in \a this corresponding to the returned distance. 
  * \a this is expected to be a mesh so that its space dimension is equal to its
  * mesh dimension + 1. Furthermore only mesh dimension 1 and 2 are supported for the moment.
  * Distance from \a ptBg to \a ptEnd is expected to be equal to the space dimension. \a this is also expected to be fully defined (connectivity and coordinates).
- * 
- * This method firstly find the closer node in \a this to the requested point whose coordinates are defined by [ \a ptBg, \a ptEnd ). Then for this node found 
- * the cells sharing this node (if any) are considered to find if the distance to these cell are smaller than the result found previously. If no cells are linked
- * to the node that minimizes distance with the input point then -1 is returned in cellId.
+ * WARNING, if there is some orphan nodes in \a this (nodes not fetched by any cells in \a this ( see MEDCouplingUMesh::zipCoords ) ) these nodes will ** not ** been taken
+ * into account in this method. Only cells and nodes lying on them are considered in the algorithm (even if one of these orphan nodes is closer than returned distance).
+ * A user that needs to consider orphan nodes should invoke DataArrayDouble::minimalDistanceTo method on the coordinates array of \a this.
  *
  * So this method is more accurate (so, more costly) than simply searching for the closest point in \a this.
  * If only this information is enough for you simply call \c getCoords()->distanceToTuple on \a this.
@@ -4113,9 +4140,9 @@ void MEDCouplingUMesh::project1D(const double *pt, const double *v, double eps,
  * \return the positive value of the distance.
  * \throw if distance from \a ptBg to \a ptEnd is not equal to the space dimension. An exception is also thrown if mesh dimension of \a this is not equal to space
  * dimension - 1.
- * \sa DataArrayDouble::distanceToTuple
+ * \sa DataArrayDouble::distanceToTuple, MEDCouplingUMesh::distanceToPoints
  */
-double MEDCouplingUMesh::distanceToPoint(const double *ptBg, const double *ptEnd, int& cellId, int& nodeId) const throw(INTERP_KERNEL::Exception)
+double MEDCouplingUMesh::distanceToPoint(const double *ptBg, const double *ptEnd, int& cellId) const throw(INTERP_KERNEL::Exception)
 {
   int meshDim=getMeshDimension(),spaceDim=getSpaceDimension();
   if(meshDim!=spaceDim-1)
@@ -4125,53 +4152,117 @@ double MEDCouplingUMesh::distanceToPoint(const double *ptBg, const double *ptEnd
   checkFullyDefined();
   if((int)std::distance(ptBg,ptEnd)!=spaceDim)
     { std::ostringstream oss; oss << "MEDCouplingUMesh::distanceToPoint : input point has to have dimension equal to the space dimension of this (" << spaceDim << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); }
-  nodeId=-1;
-  double ret0=_coords->distanceToTuple(ptBg,ptEnd,nodeId);
-  if(nodeId==-1)
-    throw INTERP_KERNEL::Exception("MEDCouplingUMesh::distanceToPoint : something wrong with nodes in this !");
-  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellIds=getCellIdsLyingOnNodes(&nodeId,&nodeId+1,false);
-  switch(meshDim)
+  DataArrayInt *ret1=0;
+  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> pts=DataArrayDouble::New(); pts->useArray(ptBg,false,C_DEALLOC,1,spaceDim);
+  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret0=distanceToPoints(pts,ret1);
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret1Safe(ret1);
+  cellId=*ret1Safe->begin();
+  return *ret0->begin();
+}
+
+/*!
+ * This method computes the distance from each point of points serie \a pts (stored in a DataArrayDouble in which each tuple represents a point)
+ *  to \a this  and the first \a cellId in \a this corresponding to the returned distance. 
+ * WARNING, if there is some orphan nodes in \a this (nodes not fetched by any cells in \a this ( see MEDCouplingUMesh::zipCoords ) ) these nodes will ** not ** been taken
+ * into account in this method. Only cells and nodes lying on them are considered in the algorithm (even if one of these orphan nodes is closer than returned distance).
+ * A user that needs to consider orphan nodes should invoke DataArrayDouble::minimalDistanceTo method on the coordinates array of \a this.
+ * 
+ * \a this is expected to be a mesh so that its space dimension is equal to its
+ * mesh dimension + 1. Furthermore only mesh dimension 1 and 2 are supported for the moment.
+ * Number of components of \a pts is expected to be equal to the space dimension. \a this is also expected to be fully defined (connectivity and coordinates).
+ *
+ * So this method is more accurate (so, more costly) than simply searching for each point in \a pts the closest point in \a this.
+ * If only this information is enough for you simply call \c getCoords()->distanceToTuple on \a this.
+ *
+ * \param [in] pts the list of points in which each tuple represents a point
+ * \param [out] cellIds a newly allocated object that tells for each point in \a pts the first cell id in \a this that minimizes the distance.
+ * \return a newly allocated object to be dealed by the caller that tells for each point in \a pts the distance to \a this.
+ * \throw if number of components of \a pts is not equal to the space dimension.
+ * \throw if mesh dimension of \a this is not equal to space dimension - 1.
+ * \sa DataArrayDouble::distanceToTuple, MEDCouplingUMesh::distanceToPoint
+ */
+DataArrayDouble *MEDCouplingUMesh::distanceToPoints(const DataArrayDouble *pts, DataArrayInt *& cellIds) const throw(INTERP_KERNEL::Exception)
+{
+  if(!pts)
+    throw INTERP_KERNEL::Exception("MEDCouplingUMesh::distanceToPoints : input points pointer is NULL !");
+  pts->checkAllocated();
+  int meshDim=getMeshDimension(),spaceDim=getSpaceDimension();
+  if(meshDim!=spaceDim-1)
+    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)
     {
-    case 2:
+      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().c_str());
+    }
+  checkFullyDefined();
+  int nbCells=getNumberOfCells();
+  if(nbCells==0)
+    throw INTERP_KERNEL::Exception("MEDCouplingUMesh::distanceToPoints : no cells in this !");
+  int nbOfPts=pts->getNumberOfTuples();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret0=DataArrayDouble::New(); ret0->alloc(nbOfPts,1);
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret1=DataArrayInt::New(); ret1->alloc(nbOfPts,1);
+  const int *nc=_nodal_connec->begin(),*ncI=_nodal_connec_index->begin(); const double *coords=_coords->begin();
+  double *ret0Ptr=ret0->getPointer(); int *ret1Ptr=ret1->getPointer(); const double *ptsPtr=pts->begin();
+  std::vector<double> bbox;
+  getBoundingBoxForBBTree(bbox);
+  switch(spaceDim)
+    {
+    case 3:
       {
-        distanceToPoint3DSurfAlg(ptBg,cellIds,ret0,cellId);
-        return ret0;
+        BBTreeDst<3> myTree(&bbox[0],0,0,nbCells);
+        for(int i=0;i<nbOfPts;i++,ret0Ptr++,ret1Ptr++,ptsPtr+=3)
+          {
+            double x=std::numeric_limits<double>::max();
+            std::vector<int> elems;
+            myTree.getMinDistanceOfMax(ptsPtr,x);
+            myTree.getElemsWhoseMinDistanceToPtSmallerThan(ptsPtr,x,elems);
+            DistanceToPoint3DSurfAlg(ptsPtr,&elems[0],&elems[0]+elems.size(),coords,nc,ncI,*ret0Ptr,*ret1Ptr);
+          }
+        break;
       }
-    case 1:
+    case 2:
       {
-        distanceToPoint2DCurveAlg(ptBg,cellIds,ret0,cellId);
-        return ret0;
+        BBTreeDst<2> myTree(&bbox[0],0,0,nbCells);
+        for(int i=0;i<nbOfPts;i++,ret0Ptr++,ret1Ptr++,ptsPtr+=2)
+          {
+            double x=std::numeric_limits<double>::max();
+            std::vector<int> elems;
+            myTree.getMinDistanceOfMax(ptsPtr,x);
+            myTree.getElemsWhoseMinDistanceToPtSmallerThan(ptsPtr,x,elems);
+            DistanceToPoint2DCurveAlg(ptsPtr,&elems[0],&elems[0]+elems.size(),coords,nc,ncI,*ret0Ptr,*ret1Ptr);
+          }
+        break;
       }
     default:
-      throw INTERP_KERNEL::Exception("MEDCouplingUMesh::distanceToPoint : only mesh dimension 2 and 1 are implemented !");
+      throw INTERP_KERNEL::Exception("MEDCouplingUMesh::distanceToPoints : only spacedim 2 and 3 supported !");
     }
-  
-  return ret0;
+  cellIds=ret1.retn();
+  return ret0.retn();
 }
 
-
 /*!
  * \param [in] pt the start pointer (included) of the coordinates of the point
- * \param [in] cellIds
+ * \param [in] cellIdsBg the start pointer (included) of cellIds
+ * \param [in] cellIdsEnd the end pointer (excluded) of cellIds
+ * \param [in] nc nodal connectivity
+ * \param [in] ncI nodal connectivity index
  * \param [in,out] ret0 the min distance between \a this and the external input point
  * \param [out] cellId that corresponds to minimal distance. If the closer node is not linked to any cell in \a this -1 is returned.
- * \sa MEDCouplingUMesh::distanceToPoint
+ * \sa MEDCouplingUMesh::distanceToPoint, MEDCouplingUMesh::distanceToPoints
  */
-void MEDCouplingUMesh::distanceToPoint3DSurfAlg(const double *pt, const DataArrayInt *cellIds, double& ret0, int& cellId) const throw(INTERP_KERNEL::Exception)
+void MEDCouplingUMesh::DistanceToPoint3DSurfAlg(const double *pt, const int *cellIdsBg, const int *cellIdsEnd, const double *coords, const int *nc, const int *ncI, double& ret0, int& cellId) throw(INTERP_KERNEL::Exception)
 {
-  const double *coords=_coords->getConstPointer();
-  cellId=-1; 
-  if(cellIds->empty())
-    return;
-  const int *ptr=_nodal_connec->getConstPointer();
-  const int *ptrI=_nodal_connec_index->getConstPointer();
-  for(const int *zeCell=cellIds->begin();zeCell!=cellIds->end();zeCell++)
+  cellId=-1;
+  ret0=std::numeric_limits<double>::max();
+  for(const int *zeCell=cellIdsBg;zeCell!=cellIdsEnd;zeCell++)
     {
-      switch((INTERP_KERNEL::NormalizedCellType)ptr[ptrI[*zeCell]])
+      switch((INTERP_KERNEL::NormalizedCellType)nc[ncI[*zeCell]])
         {
         case INTERP_KERNEL::NORM_TRI3:
           {
-            double tmp=INTERP_KERNEL::DistanceFromPtToTriInSpaceDim3(pt,coords+3*ptr[ptrI[*zeCell]+1],coords+3*ptr[ptrI[*zeCell]+2],coords+3*ptr[ptrI[*zeCell]+3]);
+            double tmp=INTERP_KERNEL::DistanceFromPtToTriInSpaceDim3(pt,coords+3*nc[ncI[*zeCell]+1],coords+3*nc[ncI[*zeCell]+2],coords+3*nc[ncI[*zeCell]+3]);
             if(tmp<ret0)
               { ret0=tmp; cellId=*zeCell; }
             break;
@@ -4179,7 +4270,7 @@ void MEDCouplingUMesh::distanceToPoint3DSurfAlg(const double *pt, const DataArra
         case INTERP_KERNEL::NORM_QUAD4:
         case INTERP_KERNEL::NORM_POLYGON:
           {
-            double tmp=INTERP_KERNEL::DistanceFromPtToPolygonInSpaceDim3(pt,ptr+ptrI[*zeCell]+1,ptr+ptrI[*zeCell+1],coords);
+            double tmp=INTERP_KERNEL::DistanceFromPtToPolygonInSpaceDim3(pt,nc+ncI[*zeCell]+1,nc+ncI[*zeCell+1],coords);
             if(tmp<ret0)
               { ret0=tmp; cellId=*zeCell; }
             break;
@@ -4192,26 +4283,27 @@ void MEDCouplingUMesh::distanceToPoint3DSurfAlg(const double *pt, const DataArra
 
 /*!
  * \param [in] pt the start pointer (included) of the coordinates of the point
- * \param [in] cellIds
+ * \param [in] cellIdsBg the start pointer (included) of cellIds
+ * \param [in] cellIdsEnd the end pointer (excluded) of cellIds
+ * \param [in] nc nodal connectivity
+ * \param [in] ncI nodal connectivity index
  * \param [in,out] ret0 the min distance between \a this and the external input point
  * \param [out] cellId that corresponds to minimal distance. If the closer node is not linked to any cell in \a this -1 is returned.
- * \sa MEDCouplingUMesh::distanceToPoint
+ * \sa MEDCouplingUMesh::distanceToPoint, MEDCouplingUMesh::distanceToPoints
  */
-void MEDCouplingUMesh::distanceToPoint2DCurveAlg(const double *pt, const DataArrayInt *cellIds, double& ret0, int& cellId) const throw(INTERP_KERNEL::Exception)
+void MEDCouplingUMesh::DistanceToPoint2DCurveAlg(const double *pt, const int *cellIdsBg, const int *cellIdsEnd, const double *coords, const int *nc, const int *ncI, double& ret0, int& cellId) throw(INTERP_KERNEL::Exception)
 {
-  const double *coords=_coords->getConstPointer();
-  if(cellIds->empty())
-    { cellId=-1; return; }
-  const int *ptr=_nodal_connec->getConstPointer();
-  const int *ptrI=_nodal_connec_index->getConstPointer();
-  for(const int *zeCell=cellIds->begin();zeCell!=cellIds->end();zeCell++)
+  cellId=-1;
+  ret0=std::numeric_limits<double>::max();
+  for(const int *zeCell=cellIdsBg;zeCell!=cellIdsEnd;zeCell++)
     {
-       switch((INTERP_KERNEL::NormalizedCellType)ptr[ptrI[*zeCell]])
+       switch((INTERP_KERNEL::NormalizedCellType)nc[ncI[*zeCell]])
         {
         case INTERP_KERNEL::NORM_SEG2:
           {
-            double tmp=INTERP_KERNEL::SquareDistanceFromPtToSegInSpaceDim2(pt,coords+2*ptr[ptrI[*zeCell]+1],coords+2*ptr[ptrI[*zeCell]+2]);
-            if(tmp!=std::numeric_limits<double>::max()) tmp=sqrt(tmp);
+            std::size_t uselessEntry=0;
+            double tmp=INTERP_KERNEL::SquareDistanceFromPtToSegInSpaceDim2(pt,coords+2*nc[ncI[*zeCell]+1],coords+2*nc[ncI[*zeCell]+2],uselessEntry);
+            tmp=sqrt(tmp);
             if(tmp<ret0)
               { ret0=tmp; cellId=*zeCell; }
             break;
@@ -4968,6 +5060,7 @@ void MEDCouplingUMesh::convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exce
   checkFullyDefined();
   int nbOfCells=getNumberOfCells();
   int delta=0;
+  const int *iciptr=_nodal_connec_index->getConstPointer();
   for(int i=0;i<nbOfCells;i++)
     {
       INTERP_KERNEL::NormalizedCellType type=getTypeOfCell(i);
@@ -4976,17 +5069,19 @@ void MEDCouplingUMesh::convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exce
         {
           INTERP_KERNEL::NormalizedCellType typel=cm.getLinearType();
           const INTERP_KERNEL::CellModel& cml=INTERP_KERNEL::CellModel::GetCellModel(typel);
-          delta+=cm.getNumberOfNodes()-cml.getNumberOfNodes();
+          if(!cml.isDynamic())
+            delta+=cm.getNumberOfNodes()-cml.getNumberOfNodes();
+          else
+            delta+=(iciptr[i+1]-iciptr[i]-1)/2;
         }
     }
   if(delta==0)
     return ;
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConn=DataArrayInt::New();
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConnI=DataArrayInt::New();
+  const int *icptr=_nodal_connec->getConstPointer();
   newConn->alloc(getMeshLength()-delta,1);
   newConnI->alloc(nbOfCells+1,1);
-  const int *icptr=_nodal_connec->getConstPointer();
-  const int *iciptr=_nodal_connec_index->getConstPointer();
   int *ocptr=newConn->getPointer();
   int *ociptr=newConnI->getPointer();
   *ociptr=0;
@@ -5007,6 +5102,8 @@ void MEDCouplingUMesh::convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exce
           _types.insert(typel);
           const INTERP_KERNEL::CellModel& cml=INTERP_KERNEL::CellModel::GetCellModel(typel);
           int newNbOfNodes=cml.getNumberOfNodes();
+          if(cml.isDynamic())
+            newNbOfNodes=(iciptr[i+1]-iciptr[i]-1)/2;
           *ocptr++=(int)typel;
           ocptr=std::copy(icptr+iciptr[i]+1,icptr+iciptr[i]+newNbOfNodes+1,ocptr);
           ociptr[1]=ociptr[0]+newNbOfNodes+1;
@@ -6710,7 +6807,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::emulateMEDMEMBDC(const MEDCouplingUMesh *nM1
 DataArrayInt *MEDCouplingUMesh::sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception)
 {
   checkConnectivityFullyDefined();
-  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=getRenumArrForConsecutiveCellTypesSpec(MEDMEM_ORDER,MEDMEM_ORDER+N_MEDMEM_ORDER);
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=getRenumArrForMEDFileFrmt();
   renumberCells(ret->getConstPointer(),false);
   return ret.retn();
 }
@@ -6829,6 +6926,18 @@ DataArrayInt *MEDCouplingUMesh::getLevArrPerCellTypes(const INTERP_KERNEL::Norma
   return tmpa.retn();
 }
 
+/*!
+ * This method behaves exactly as MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec but the order is those defined in MED file spec.
+ *
+ * \return a new object containing the old to new correspondance.
+ *
+ * \sa MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec, MEDCouplingUMesh::sortCellsInMEDFileFrmt.
+ */
+DataArrayInt *MEDCouplingUMesh::getRenumArrForMEDFileFrmt() const throw(INTERP_KERNEL::Exception)
+{
+  return getRenumArrForConsecutiveCellTypesSpec(MEDMEM_ORDER,MEDMEM_ORDER+N_MEDMEM_ORDER);
+}
+
 /*!
  * This method is similar to method MEDCouplingUMesh::rearrange2ConsecutiveCellTypes except that the type order is specfied by [orderBg,orderEnd) (as MEDCouplingUMesh::checkConsecutiveCellTypesAndOrder method) and that this method is \b const and performs \b NO permutation in 'this'.
  * This method returns an array of size getNumberOfCells() that gives a renumber array old2New that can be used as input of MEDCouplingMesh::renumberCells.
@@ -7920,7 +8029,7 @@ void MEDCouplingUMesh::ComputeVecAndPtOfFace(double eps, const double *coords, c
   std::size_t nbPoints=std::distance(begin,end);
   if(nbPoints<3)
     throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ComputeVecAndPtOfFace : < of 3 points in face ! not able to find a plane on that face !");
-  double vec[3];
+  double vec[3]={0.,0.,0.};
   std::size_t j=0;
   bool refFound=false;
   for(;j<nbPoints-1 && !refFound;j++)
@@ -8705,7 +8814,7 @@ bool MEDCouplingUMesh::BuildConvexEnvelopOf2DCellJarvis(const double *coords, co
           int nextNode=-1;
           int prevNode=-1;
           double resRef;
-          double angleNext;
+          double angleNext=0.;
           while(nextNode!=startNode)
             {
               nextNode=-1;
index 75f0db4c01998b095b6c3ba284f98bcfb9b8fd2b..b7b08ac003f95322e4480f8c2420734fa53961b0 100644 (file)
@@ -111,6 +111,7 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT DataArrayInt *getNodeIdsInUse(int& nbrOfNodesInUse) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void computeNodeIdsAlg(std::vector<bool>& nodeIdsInUse) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT DataArrayInt *computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT DataArrayInt *zipCoordsTraducer() throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void findCommonCells(int compType, int startCellId, DataArrayInt *& commonCellsArr, DataArrayInt *& commonCellsIArr) const throw(INTERP_KERNEL::Exception);
@@ -161,7 +162,8 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT DataArrayInt *getCellIdsCrossingPlane(const double *origin, const double *vec, double eps) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT bool isContiguous1D() const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void project1D(const double *pt, const double *v, double eps, double *res) const;
-    MEDCOUPLING_EXPORT double distanceToPoint(const double *ptBg, const double *ptEnd, int& cellId, int& nodeId) const throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT double distanceToPoint(const double *ptBg, const double *ptEnd, int& cellId) const throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT DataArrayDouble *distanceToPoints(const DataArrayDouble *pts, DataArrayInt *& cellIds) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT int getCellContainingPoint(const double *pos, double eps) const;
     MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector<int>& elts) const;
     MEDCOUPLING_EXPORT void getCellsContainingPoints(const double *pos, int nbOfPoints, double eps, std::vector<int>& elts, std::vector<int>& eltsIndex) const;
@@ -200,6 +202,7 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT bool checkConsecutiveCellTypesForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT bool checkConsecutiveCellTypesAndOrder(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd) const;
     MEDCOUPLING_EXPORT DataArrayInt *getLevArrPerCellTypes(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd, DataArrayInt *&nbPerType) const throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT DataArrayInt *getRenumArrForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT DataArrayInt *rearrange2ConsecutiveCellTypes();
     MEDCOUPLING_EXPORT std::vector<MEDCouplingUMesh *> splitByType() const;
@@ -290,8 +293,8 @@ namespace ParaMEDMEM
     MEDCouplingUMesh *buildDescendingConnectivityGen(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx, DimM1DescNbrer nbrer) const throw(INTERP_KERNEL::Exception);
     DataArrayInt *buildUnionOf2DMesh() const throw(INTERP_KERNEL::Exception);
     DataArrayInt *buildUnionOf3DMesh() const throw(INTERP_KERNEL::Exception);
-    void distanceToPoint3DSurfAlg(const double *pt, const DataArrayInt *cellIds, double& ret0, int& cellId) const throw(INTERP_KERNEL::Exception);
-    void distanceToPoint2DCurveAlg(const double *pt, const DataArrayInt *cellIds, double& ret0, int& cellId) const throw(INTERP_KERNEL::Exception);
+    static void DistanceToPoint3DSurfAlg(const double *pt, const int *cellIdsBg, const int *cellIdsEnd, const double *coords, const int *nc, const int *ncI, double& ret0, int& cellId) throw(INTERP_KERNEL::Exception);
+    static void DistanceToPoint2DCurveAlg(const double *pt, const int *cellIdsBg, const int *cellIdsEnd, const double *coords, const int *nc, const int *ncI, double& ret0, int& cellId) throw(INTERP_KERNEL::Exception);
     static DataArrayInt *ComputeSpreadZoneGraduallyFromSeedAlg(std::vector<bool>& fetched, const int *seedBg, const int *seedEnd, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling, int& nbOfDepthPeelingPerformed) throw(INTERP_KERNEL::Exception);
     static void FillInCompact3DMode(int spaceDim, int nbOfNodesInCell, const int *conn, const double *coo, double *zipFrmt) throw(INTERP_KERNEL::Exception);
     static void AppendExtrudedCell(const int *connBg, const int *connEnd, int nbOfNodesPerLev, bool isQuad, std::vector<int>& ret);
index 4c6ef588fd1876005f8f0afd9fd9728b481ab351..df9d89271bbbbdc3a65283bdba602d9db3f75747 100644 (file)
@@ -168,6 +168,11 @@ DataArrayInt *MEDCouplingUMeshDesc::computeNbOfNodesPerCell() const throw(INTERP
   throw INTERP_KERNEL::Exception("MEDCouplingUMeshDesc::computeNbOfNodesPerCell : not implemented yet !");
 }
 
+DataArrayInt *MEDCouplingUMeshDesc::computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception)
+{
+  throw INTERP_KERNEL::Exception("MEDCouplingUMeshDesc::computeNbOfFacesPerCell : not implemented yet !");
+}
+
 int MEDCouplingUMeshDesc::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const
 {
   const int *desc_connec=_desc_connec->getConstPointer();
index c959bdc7b0094530c835940246d8f38e81660ba6..e6a25b09b1277b57c02a4364e2b990ed1dce81ca 100644 (file)
@@ -53,6 +53,7 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT std::set<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const;
     MEDCOUPLING_EXPORT DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT DataArrayInt *computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
     MEDCOUPLING_EXPORT void getNodeIdsOfCell(int cellId, std::vector<int>& conn) const;
     MEDCOUPLING_EXPORT std::string simpleRepr() const;
index 2832db0c02644c6edd4ef5aeebfea151cb5d96d9..5d2b0c0f99e2567e291b805fe7c4005f6ffb5b53 100644 (file)
@@ -139,7 +139,21 @@ void MEDCouplingBasicsTest1::testMesh()
   int tab4[4*nbOfCells]={ 
     1, 2, 8, 7, 2, 3, 9, 8, 3, 4, 10, 9, 4, 5, 11, 10, 5, 0, 6, 11, 
     0, 1, 7, 6, };
-  
+  CPPUNIT_ASSERT_EQUAL(MEDCouplingMesh::GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NORM_TRI3),3);
+  CPPUNIT_ASSERT(MEDCouplingMesh::IsStaticGeometricType(INTERP_KERNEL::NORM_TRI3));
+  CPPUNIT_ASSERT(MEDCouplingMesh::IsLinearGeometricType(INTERP_KERNEL::NORM_TRI3));
+  CPPUNIT_ASSERT_EQUAL(MEDCouplingMesh::GetDimensionOfGeometricType(INTERP_KERNEL::NORM_TRI3),2);
+  CPPUNIT_ASSERT_EQUAL(std::string(MEDCouplingMesh::GetReprOfGeometricType(INTERP_KERNEL::NORM_TRI3)),std::string("NORM_TRI3"));
+  CPPUNIT_ASSERT_THROW(MEDCouplingMesh::GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NORM_POLYGON),INTERP_KERNEL::Exception);
+  CPPUNIT_ASSERT(not MEDCouplingMesh::IsStaticGeometricType(INTERP_KERNEL::NORM_POLYGON));
+  CPPUNIT_ASSERT(MEDCouplingMesh::IsLinearGeometricType(INTERP_KERNEL::NORM_POLYGON));
+  CPPUNIT_ASSERT_EQUAL(MEDCouplingMesh::GetDimensionOfGeometricType(INTERP_KERNEL::NORM_POLYGON),2);
+  CPPUNIT_ASSERT_EQUAL(std::string(MEDCouplingMesh::GetReprOfGeometricType(INTERP_KERNEL::NORM_POLYGON)),std::string("NORM_POLYGON"));
+  CPPUNIT_ASSERT_EQUAL(MEDCouplingMesh::GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NORM_TRI6),6);
+  CPPUNIT_ASSERT(MEDCouplingMesh::IsStaticGeometricType(INTERP_KERNEL::NORM_TRI6));
+  CPPUNIT_ASSERT(!MEDCouplingMesh::IsLinearGeometricType(INTERP_KERNEL::NORM_TRI6));
+  CPPUNIT_ASSERT_EQUAL(MEDCouplingMesh::GetDimensionOfGeometricType(INTERP_KERNEL::NORM_TRI6),2);
+  CPPUNIT_ASSERT_EQUAL(std::string(MEDCouplingMesh::GetReprOfGeometricType(INTERP_KERNEL::NORM_TRI6)),std::string("NORM_TRI6"));
   MEDCouplingUMesh *mesh=MEDCouplingUMesh::New();
   mesh->setMeshDimension(2);
   mesh->allocateCells(8);
index 4be6abb37ba5d8c850c2f15b10ead57e0630e3ef..d1482a26835aba6e2244f2ef1df8cf2112cdae4c 100644 (file)
@@ -1816,6 +1816,18 @@ void MEDCouplingBasicsTest2::testMaxPerTuple1()
     CPPUNIT_ASSERT_DOUBLES_EQUAL(5.6,f2->getIJ(i,0),1e-13);
   f2->decrRef();
   //
+  DataArrayInt *d2I=0;
+  DataArrayDouble *d2=array->maxPerTupleWithCompoId(d2I);
+  CPPUNIT_ASSERT_EQUAL(1,d2->getNumberOfComponents());
+  CPPUNIT_ASSERT_EQUAL(5,d2->getNumberOfTuples());
+  const int expected2[5]={4,3,2,0,1};
+  for(int i=0;i<5;i++)
+    {
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(5.6,d2->getIJ(i,0),1e-13);
+      CPPUNIT_ASSERT_EQUAL(expected2[i],d2I->getIJ(i,0));
+    }
+  d2->decrRef(); d2I->decrRef();
+  //
   mesh1->decrRef();
   f1->decrRef();
 }
index cea76482a212be2b78903e375979b14bc41d111d..bda6db201259952b5e2bcc20cca7c7bfefa0f571 100644 (file)
@@ -669,7 +669,7 @@ void MEDCouplingBasicsTest3::testKeepSetSelectedComponent1()
   a1->setInfoOnComponent(3,"dddd");
   const int arr2[6]={1,2,1,2,0,0};
   std::vector<int> arr2V(arr2,arr2+6);
-  DataArrayDouble *a2=a1->keepSelectedComponents(arr2V);
+  DataArrayDouble *a2=static_cast<DataArrayDouble *>(a1->keepSelectedComponents(arr2V));
   CPPUNIT_ASSERT_EQUAL(6,a2->getNumberOfComponents());
   CPPUNIT_ASSERT_EQUAL(5,a2->getNumberOfTuples());
   CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(0))=="bbbb");
@@ -682,7 +682,7 @@ void MEDCouplingBasicsTest3::testKeepSetSelectedComponent1()
   for(int i=0;i<30;i++)
     CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],a2->getIJ(0,i),1e-14);
   DataArrayInt *a3=a1->convertToIntArr();
-  DataArrayInt *a4=a3->keepSelectedComponents(arr2V);
+  DataArrayInt *a4=static_cast<DataArrayInt *>(a3->keepSelectedComponents(arr2V));
   CPPUNIT_ASSERT_EQUAL(6,a4->getNumberOfComponents());
   CPPUNIT_ASSERT_EQUAL(5,a4->getNumberOfTuples());
   CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(0))=="bbbb");
@@ -696,7 +696,7 @@ void MEDCouplingBasicsTest3::testKeepSetSelectedComponent1()
   // setSelectedComponents
   const int arr3[2]={3,2};
   std::vector<int> arr3V(arr3,arr3+2);
-  DataArrayDouble *a5=a1->keepSelectedComponents(arr3V);
+  DataArrayDouble *a5=static_cast<DataArrayDouble *>(a1->keepSelectedComponents(arr3V));
   a5->setInfoOnComponent(0,"eeee");
   a5->setInfoOnComponent(1,"ffff");
   const int arr4[2]={1,2};
index 51d08c599259d1dabf3b226604f18d63c9055828..a4d9b168b764970ce6416ba73ea1017ccebae68b 100644 (file)
@@ -323,11 +323,11 @@ void MEDCouplingBasicsTest5::testDataArrayDoubleAdvSetting1()
   //
   std::vector<std::pair<int,int> > p(3);
   p[0].first=0; p[0].second=3; p[1].first=3; p[1].second=5; p[2].first=5; p[2].second=7;
-  tmp=da->selectByTupleRanges(p);
+  tmp=dynamic_cast<DataArrayDouble *>(da->selectByTupleRanges(p));
   CPPUNIT_ASSERT(tmp->isEqual(*da,1e-14));
   tmp->decrRef();
   p[0].first=0; p[0].second=2; p[1].first=3; p[1].second=4; p[2].first=5; p[2].second=7;
-  tmp=da->selectByTupleRanges(p);
+  tmp=dynamic_cast<DataArrayDouble *>(da->selectByTupleRanges(p));
   const double expected1[10]={1.,11.,2.,12.,4.,14.,6.,16.,7.,17.};
   CPPUNIT_ASSERT_EQUAL(5,tmp->getNumberOfTuples());
   CPPUNIT_ASSERT_EQUAL(2,tmp->getNumberOfComponents());
@@ -335,7 +335,7 @@ void MEDCouplingBasicsTest5::testDataArrayDoubleAdvSetting1()
     CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],tmp->getIJ(0,i),1e-14);
   tmp->decrRef();
   p[0].first=0; p[0].second=2; p[1].first=0; p[1].second=2; p[2].first=5; p[2].second=6;
-  tmp=da->selectByTupleRanges(p);
+  tmp=dynamic_cast<DataArrayDouble *>(da->selectByTupleRanges(p));
   const double expected2[10]={1.,11.,2.,12.,1.,11.,2.,12.,6.,16.};
   CPPUNIT_ASSERT_EQUAL(5,tmp->getNumberOfTuples());
   CPPUNIT_ASSERT_EQUAL(2,tmp->getNumberOfComponents());
@@ -417,11 +417,11 @@ void MEDCouplingBasicsTest5::testDataArrayIntAdvSetting1()
   //
   std::vector<std::pair<int,int> > p(3);
   p[0].first=0; p[0].second=3; p[1].first=3; p[1].second=5; p[2].first=5; p[2].second=7;
-  tmp=da->selectByTupleRanges(p);
+  tmp=dynamic_cast<DataArrayInt *>(da->selectByTupleRanges(p));
   CPPUNIT_ASSERT(tmp->isEqual(*da));
   tmp->decrRef();
   p[0].first=0; p[0].second=2; p[1].first=3; p[1].second=4; p[2].first=5; p[2].second=7;
-  tmp=da->selectByTupleRanges(p);
+  tmp=dynamic_cast<DataArrayInt *>(da->selectByTupleRanges(p));
   const int expected1[10]={1,11,2,12,4,14,6,16,7,17};
   CPPUNIT_ASSERT_EQUAL(5,tmp->getNumberOfTuples());
   CPPUNIT_ASSERT_EQUAL(2,tmp->getNumberOfComponents());
@@ -429,7 +429,7 @@ void MEDCouplingBasicsTest5::testDataArrayIntAdvSetting1()
     CPPUNIT_ASSERT_EQUAL(expected1[i],tmp->getIJ(0,i));
   tmp->decrRef();
   p[0].first=0; p[0].second=2; p[1].first=0; p[1].second=2; p[2].first=5; p[2].second=6;
-  tmp=da->selectByTupleRanges(p);
+  tmp=dynamic_cast<DataArrayInt *>(da->selectByTupleRanges(p));
   const int expected2[10]={1,11,2,12,1,11,2,12,6,16};
   CPPUNIT_ASSERT_EQUAL(5,tmp->getNumberOfTuples());
   CPPUNIT_ASSERT_EQUAL(2,tmp->getNumberOfComponents());
index 365d6dd58b3349800e3a53dbaf10cb16097088ab..be1e0bf730614d5460f3ea88d7eebcaa9d1decae 100644 (file)
@@ -104,7 +104,7 @@ void CppExample_MEDCouplingFieldDouble_MergeFields()
   MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field2 =
     field1->cloneWithMesh( true );
   double vec[1] = { 5. };
-  ((ParaMEDMEM::MEDCouplingMesh *)field2->getMesh())->translate(vec); // translate mesh2
+  (const_cast<ParaMEDMEM::MEDCouplingMesh *>(field2->getMesh()))->translate(vec); // translate mesh2
   field2->applyFunc("x + 5"); // "translate" field2
 
   // concatenate field1 and field2
@@ -596,7 +596,7 @@ void CppExample_MEDCouplingFieldDouble_renumberNodes()
   field->renumberNodes(renumber,false);
   const MEDCouplingMesh* mesh2 = field->getMesh(); // field now refers to another mesh
   values = field->getArray();
-  nodeCoords = ((MEDCouplingUMesh*)mesh2)->getCoords();
+  nodeCoords = (static_cast<const MEDCouplingUMesh*>(mesh2))->getCoords();
   CPPUNIT_ASSERT( values->isEqualWithoutConsideringStr( *nodeCoords, 1e-13 ));
   //! [CppSnippet_MEDCouplingFieldDouble_renumberNodes_3]
 }
index 4890ae86bff3bdbb6135c3698222bc980850b09e..9d7e5e3520f0628098edea4c82a1f193f2ba77d1 100644 (file)
@@ -82,11 +82,11 @@ SET(PYFILES_TO_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/MEDCoupling.py ${CMAKE_CURREN
 INSTALL_AND_COMPILE_PYTHON_FILE("${PYFILES_TO_INSTALL}" ${MED_salomescript_PYTHON})
 
 INSTALL(FILES MEDCoupling.i MEDCouplingCommon.i MEDCouplingMemArray.i MEDCouplingFinalize.i MEDCouplingRemapper.i MEDCouplingTypemaps.i DESTINATION ${MED_salomeinclude_HEADERS})
-INSTALL(FILES MEDCouplingBasicsTest.py MEDCouplingRemapperTest.py MEDCouplingDataForTest.py MEDCouplingNumpyTest.py DESTINATION ${MED_salomescript_PYTHON})
+INSTALL(FILES MEDCouplingBasicsTest.py MEDCouplingRemapperTest.py MEDCouplingDataForTest.py MEDCouplingNumPyTest.py DESTINATION ${MED_salomescript_PYTHON})
 
 ADD_TEST(MEDCouplingBasicsTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingBasicsTest.py)
 ADD_TEST(MEDCouplingExamplesTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingExamplesTest.py)
 ADD_TEST(MEDCouplingRemapperTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingRemapperTest.py)
 IF(NUMPY_STATUS)
-  ADD_TEST(MEDCouplingNumpyTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingNumpyTest.py)
+  ADD_TEST(MEDCouplingNumPyTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingNumPyTest.py)
 ENDIF(NUMPY_STATUS)
index b0523db87ecd7c3fb226f5da262b1fa2be5856da..6fe9040bc70e947fec8124455cefee7360be75e8 100644 (file)
@@ -21,7 +21,9 @@
 from MEDCoupling import *
 import unittest
 from math import pi,e,sqrt,cos,sin
+from datetime import datetime
 from MEDCouplingDataForTest import MEDCouplingDataForTest
+import rlcompleter,readline # this line has to be here, ot ensure a usability of MEDCoupling/MEDLoader. B4 removing it please notify to anthony.geay@cea.fr
 
 class MEDCouplingBasicsTest(unittest.TestCase):
     def testArray2(self):
@@ -89,6 +91,21 @@ class MEDCouplingBasicsTest(unittest.TestCase):
                  -0.305, 0.024155, 0.04183768725682622, -0.2863, 0.04831000000000001, -1.015761910347357e-17, -0.2863, 
                  0.09662000000000001, -1.832979297858306e-18, -0.2863, 0.120775, 0.04183768725682623, -0.2863, 0.09662000000000001,
                  0.08367537451365245, -0.2863, 0.04831000000000001, 0.08367537451365246, -0.2863 ]
+        self.assertEqual(MEDCouplingMesh.GetNumberOfNodesOfGeometricType(NORM_TRI3),3)
+        self.assertTrue(MEDCouplingMesh.IsStaticGeometricType(NORM_TRI3))
+        self.assertTrue(MEDCouplingMesh.IsLinearGeometricType(NORM_TRI3))
+        self.assertEqual(MEDCouplingMesh.GetDimensionOfGeometricType(NORM_TRI3),2)
+        self.assertEqual(MEDCouplingMesh.GetReprOfGeometricType(NORM_TRI3),"NORM_TRI3")
+        self.assertRaises(InterpKernelException,MEDCouplingMesh.GetNumberOfNodesOfGeometricType,NORM_POLYGON)
+        self.assertTrue(not MEDCouplingMesh.IsStaticGeometricType(NORM_POLYGON))
+        self.assertTrue(MEDCouplingMesh.IsLinearGeometricType(NORM_POLYGON))
+        self.assertEqual(MEDCouplingMesh.GetDimensionOfGeometricType(NORM_POLYGON),2)
+        self.assertEqual(MEDCouplingMesh.GetReprOfGeometricType(NORM_POLYGON),"NORM_POLYGON")
+        self.assertEqual(MEDCouplingMesh.GetNumberOfNodesOfGeometricType(NORM_TRI6),6)
+        self.assertTrue(MEDCouplingMesh.IsStaticGeometricType(NORM_TRI6))
+        self.assertTrue(not MEDCouplingMesh.IsLinearGeometricType(NORM_TRI6))
+        self.assertEqual(MEDCouplingMesh.GetDimensionOfGeometricType(NORM_TRI6),2)
+        self.assertEqual(MEDCouplingMesh.GetReprOfGeometricType(NORM_TRI6),"NORM_TRI6")
         mesh=MEDCouplingUMesh.New()
         mesh.setMeshDimension(2)
         mesh.allocateCells(8);
@@ -582,6 +599,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         self.assertTrue(not fieldOnNodes1.isEqual(fieldOnCells1,1e-12,1e-15));
         #
         fieldOnCells2=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME);
+        self.assertEqual(fieldOnCells2.getMesh(),None) # to check that convertMesh wrapping do not raise but return Py_None
         self.assertTrue(not fieldOnCells1.isEqual(fieldOnCells2,1e-12,1e-15));
         self.assertTrue(not fieldOnCells2.isEqual(fieldOnCells1,1e-12,1e-15));
         fieldOnCells1=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME);
@@ -3505,6 +3523,13 @@ class MEDCouplingBasicsTest(unittest.TestCase):
             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):
+            self.assertAlmostEqual(5.6,d2.getIJ(i,0),13);
+            pass
+        self.assertTrue(d2I.isEqual(DataArrayInt([4,3,2,0,1])))
         pass
 
     def testChangeNbOfComponents(self):
@@ -10890,11 +10915,11 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         m.setCoords(coords)
         m.allocateCells(0)
         m.insertNextCell(NORM_TRI3,[0,1,2])
-        a,b,c=m.distanceToPoint([-0.335,2.27,1.21])
-        self.assertEqual(0,b) ; self.assertEqual(0,c)
+        a,b=m.distanceToPoint([-0.335,2.27,1.21])
+        self.assertEqual(0,b)
         self.assertAlmostEqual(0.022360988100374124,a,14);
-        a,b,c=m.distanceToPoint(DataArrayDouble([-0.335,2.27,1.21],1,3))
-        self.assertEqual(0,b) ; self.assertEqual(0,c)
+        a,b=m.distanceToPoint(DataArrayDouble([-0.335,2.27,1.21],1,3))
+        self.assertEqual(0,b)
         self.assertAlmostEqual(0.022360988100374124,a,14);
         a,b=coords.distanceToTuple([-0.335,2.27,1.21])
         self.assertAlmostEqual(5.243302871282566,a,14)
@@ -10907,31 +10932,31 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         m.insertNextCell(NORM_QUAD4,[0,1,2,3])
         m.checkCoherency2()
         self.assertEqual([4,0,1,2,3],m.getNodalConnectivity().getValues())
-        a,b,c=m.distanceToPoint([5.,2.,0.1])
-        self.assertAlmostEqual(0.1,a,14) ; self.assertEqual(0,b) ; self.assertEqual(1,c)
-        a,b,c=m.distanceToPoint([5.,-2.,4.])
-        self.assertAlmostEqual(sqrt(2*2+4*4),a,14) ; self.assertEqual(0,b) ; self.assertEqual(1,c)
+        a,b=m.distanceToPoint([5.,2.,0.1])
+        self.assertAlmostEqual(0.1,a,14) ; self.assertEqual(0,b)
+        a,b=m.distanceToPoint([5.,-2.,4.])
+        self.assertAlmostEqual(sqrt(2*2+4*4),a,14) ; self.assertEqual(0,b)
         m.allocateCells(0)
         m.insertNextCell(NORM_POLYGON,[0,1,2,3])
         m.checkCoherency2()
         self.assertEqual([5,0,1,2,3],m.getNodalConnectivity().getValues())
-        a,b,c=m.distanceToPoint([11.,3.,4.])
-        self.assertAlmostEqual(sqrt(3*3+4*4),a,14) ; self.assertEqual(0,b) ; self.assertEqual(1,c)
-        a,b,c=m.distanceToPoint([4.,12.,5.])
-        self.assertAlmostEqual(sqrt(4*4+5*5),a,14) ; self.assertEqual(0,b) ; self.assertEqual(2,c)
+        a,b=m.distanceToPoint([11.,3.,4.])
+        self.assertAlmostEqual(sqrt(3*3+4*4),a,14) ; self.assertEqual(0,b)
+        a,b=m.distanceToPoint([4.,12.,5.])
+        self.assertAlmostEqual(sqrt(4*4+5*5),a,14) ; self.assertEqual(0,b)
         d=DataArrayDouble([-1.2,3.,2.],1,3)
         for elt in d:
-            a,b,c=m.distanceToPoint(d)
-            self.assertAlmostEqual(sqrt(1.2*1.2+2*2),a,14) ; self.assertEqual(0,b) ; self.assertEqual(0,c)
+            a,b=m.distanceToPoint(d)
+            self.assertAlmostEqual(sqrt(1.2*1.2+2*2),a,14) ; self.assertEqual(0,b)
             pass
         #
         m=MEDCouplingUMesh("toto",1)
         coords=DataArrayDouble([0.,0.,4.,0.,0.,4.],3,2) ; m.setCoords(coords)
         m.allocateCells(0) ; m.insertNextCell(NORM_SEG2,[0,1]) ; m.insertNextCell(NORM_SEG2,[1,2])
-        a,b,c=m.distanceToPoint([-0.1,4.1])
-        self.assertAlmostEqual(0.14142135623730925,a,14) ; self.assertEqual(-1,b) ; self.assertEqual(2,c)
-        a,b,c=m.distanceToPoint([0.,3.9])
-        self.assertAlmostEqual(0.07071067811865482,a,14) ; self.assertEqual(1,b) ; self.assertEqual(2,c)
+        a,b=m.distanceToPoint([-0.1,4.1])
+        self.assertAlmostEqual(0.14142135623730925,a,14)  # b==1 self.assertEqual(2,c)
+        a,b=m.distanceToPoint([0.,3.9])
+        self.assertAlmostEqual(0.07071067811865482,a,14) ; self.assertEqual(1,b) # self.assertEqual(2,c)
         pass
 
     def testSwig2NonRegressionPartitionBySpreadZone1(self):
@@ -12570,6 +12595,359 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         self.assertTrue( field.getArray().getValues() == coords2 )
         pass
 
+    def testSwig2UMeshDistanceToMesh2(self):
+        sz=5
+        m=MEDCouplingCMesh()
+        arr=DataArrayDouble(sz+1) ; arr.iota() ; arr/=sz
+        m.setCoords(arr,arr,arr)
+        m=m.buildUnstructured()
+        m1=m.computeSkin()
+        m1.zipCoords()
+        c=m1.getCoords()[:]
+        d=2*(c-[0.5,0.5,0.5])+[0.5,0.5,0.5]
+        time_deb = datetime.now()
+        #print "go.."
+        a,b=m1.distanceToPoints(d)
+        #print 'time spent in distanceToPoints %s ' %str(datetime.now() - time_deb)
+        time_deb = datetime.now()
+        a1=DataArrayDouble(len(d))
+        b1=DataArrayInt(len(d))
+        m1s=[m1[i] for i in xrange(m1.getNumberOfCells())]
+        for j,pt in enumerate(d):
+            eter=1e308
+            fter=-1
+            for i,miter in enumerate(m1s):
+                e,f=miter.distanceToPoint(pt)
+                self.assertEqual(0,f)
+                if e<eter:
+                    eter=e ; fter=i
+                    pass
+                pass
+            a1[j]=eter
+            b1[j]=fter
+            pass
+        #print 'time spent in naive distanceToPoints  %s ' %str(datetime.now() - time_deb)
+        self.assertTrue(a.isEqual(a1,1e-12))
+        self.assertTrue(b.isEqual(b1))
+        self.assertTrue(a.isEqual(DataArrayDouble([0.8660254037844386,0.714142842854285,0.7071067811865476,0.7071067811865476,0.714142842854285,0.8660254037844386,0.714142842854285,0.5196152422706632,0.5099019513592785,0.5099019513592785,0.5196152422706632,0.714142842854285,0.7071067811865475,0.5099019513592785,0.5,0.5,0.5099019513592785,0.7071067811865476,0.7071067811865475,0.5099019513592785,0.5,0.5,0.5099019513592785,0.7071067811865476,0.714142842854285,0.5196152422706632,0.5099019513592785,0.5099019513592785,0.5196152422706632,0.714142842854285,0.8660254037844386,0.714142842854285,0.7071067811865476,0.7071067811865476,0.714142842854285,0.8660254037844386,0.714142842854285,0.5196152422706632,0.5099019513592785,0.5099019513592785,0.5196152422706631,0.714142842854285,0.5196152422706631,0.5196152422706632,0.5099019513592784,0.5099019513592785,0.5099019513592784,0.5099019513592785,0.5196152422706631,0.5196152422706632,0.714142842854285,0.5196152422706632,0.5099019513592785,0.5099019513592785,0.5196152422706632,0.714142842854285,0.7071067811865475,0.5099019513592785,0.5,0.5,0.5099019513592784,0.7071067811865475,0.5099019513592784,0.5099019513592785,0.5,0.5,0.5,0.5,0.5099019513592785,0.5099019513592785,0.7071067811865476,0.5099019513592785,0.5,0.5,0.5099019513592785,0.7071067811865476,0.7071067811865475,0.5099019513592785,0.5,0.5,0.5099019513592784,0.7071067811865475,0.5099019513592784,0.5099019513592785,0.5,0.5,0.5,0.5,0.5099019513592785,0.5099019513592785,0.7071067811865476,0.5099019513592785,0.5,0.5,0.5099019513592785,0.7071067811865476,0.714142842854285,0.5196152422706632,0.5099019513592785,0.5099019513592785,0.5196152422706631,0.714142842854285,0.5196152422706631,0.5196152422706632,0.5099019513592784,0.5099019513592785,0.5099019513592784,0.5099019513592785,0.5196152422706631,0.5196152422706632,0.714142842854285,0.5196152422706632,0.5099019513592785,0.5099019513592785,0.5196152422706632,0.714142842854285,0.8660254037844386,0.714142842854285,0.7071067811865476,0.7071067811865476,0.714142842854285,0.8660254037844386,0.714142842854285,0.5196152422706632,0.5099019513592785,0.5099019513592785,0.5196152422706632,0.714142842854285,0.7071067811865475,0.5099019513592785,0.5,0.5,0.5099019513592785,0.7071067811865476,0.7071067811865475,0.5099019513592785,0.5,0.5,0.5099019513592785,0.7071067811865476,0.714142842854285,0.5196152422706632,0.5099019513592785,0.5099019513592785,0.5196152422706632,0.714142842854285,0.8660254037844386,0.714142842854285,0.7071067811865476,0.7071067811865476,0.714142842854285,0.8660254037844386]),1e-12))
+        self.assertTrue(b.isEqual(DataArrayInt([0,0,3,7,9,9,0,0,3,7,9,9,12,12,14,16,17,17,26,26,28,30,31,31,33,33,36,40,42,42,33,33,36,40,42,42,0,0,3,7,11,9,0,9,12,17,26,31,33,42,33,33,36,40,42,42,45,45,47,49,51,51,45,50,52,53,56,57,58,63,58,58,60,62,63,63,85,85,87,89,91,91,85,90,92,93,96,97,98,103,98,98,100,102,103,103,105,105,108,112,116,114,105,114,117,122,131,136,138,147,138,138,141,145,147,147,105,105,108,112,114,114,105,105,108,112,114,114,117,117,119,121,122,122,131,131,133,135,136,136,138,138,141,145,147,147,138,138,141,145,147,147])))
+        pass
+
+    def testSwig2NonRegressionBugDistance1(self):
+        pt=DataArrayDouble([(8.8452994616207476,3.1547005383792515,3.1547005383792515)])
+        coo=DataArrayDouble([(8,0,0),(8,0,8),(8,8,8),(8,8,0),(16,0,0),(16,0,8),(16,8,8),(16,8,0),(8,0,4),(8,4,8),(8,8,4),(8,4,0),(16,0,4),(16,4,8),(16,8,4),(16,4,0),(12,0,0),(12,0,8),(12,8,8),(12,8,0),(8,4,4),(16,4,4),(12,0,4),(12,4,8),(12,8,4),(12,4,0)])
+        conn=DataArrayInt([4,15,21,12,4,16,25,15,12,22,16,4,0,8,20,11,16,0,11,25,22,8,0,16,15,7,14,21,15,25,19,7,7,19,24,14,11,20,10,3,25,11,3,19,19,3,10,24,12,21,13,5,13,23,17,5,5,17,22,12,8,1,9,20,23,9,1,17,17,1,8,22,21,14,6,13,14,24,18,6 ,6,18,23,13,20,9,2,10,24,10,2,18,18,2,9,23])
+        m=MEDCouplingUMesh("mesh",2)
+        m.setCoords(coo)
+        m.allocateCells()
+        for i in xrange(24):
+            m.insertNextCell(NORM_QUAD4,conn[4*i:4*i+4])
+            pass
+        m.checkCoherency2()
+        m0=m[3] ; m0.zipCoords()
+        expectedDist=0.8452994616207476
+        a,b=m0.distanceToPoint(pt)
+        self.assertAlmostEqual(expectedDist,a,14)
+        self.assertEqual(0,b)
+        #
+        a,b=m.distanceToPoint(pt)
+        self.assertAlmostEqual(expectedDist,a,14)
+        self.assertEqual(3,b)
+        #
+        fd=MEDCouplingFieldDiscretization.New(ON_CELLS)
+        self.assertEqual(24,fd.getNumberOfTuples(m))
+        fd=MEDCouplingFieldDiscretization.New(ON_NODES)
+        self.assertEqual(26,fd.getNumberOfTuples(m))
+        pass
+
+    def testSwig2AreaBarySeg3Quad8Tri6QPolyg(self):
+        #QUAD8 representing a circle of center zeBary and radius zeRadius
+        zeBary=[5,6]
+        zeRadius=3
+        d=DataArrayDouble(8,2)
+        d[:,0]=zeRadius
+        d[:,1]=[87,-100,-170,110,5,-130,175,95] # angle in degree
+        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)
+        self.assertTrue(m.getBarycenterAndOwner().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()
+        # spaceDim=3 QUAD8 becomes QUAD4 ... for the moment
+        m.setCoords(m.getCoords().changeNbOfComponents(3,0.))
+        m2=m.deepCpy()
+        m2.convertQuadraticCellsToLinear()
+        self.assertAlmostEqual(float(m.getMeasureField(False).getArray()),float(m2.getMeasureField(False).getArray()),12)
+        self.assertTrue(m.getBarycenterAndOwner().isEqual(m2.getBarycenterAndOwner(),1e-13))
+        #TRI6 representing a circle of center zeBary and radius zeRadius
+        zeBary=[5,6]
+        zeRadius=3
+        d=DataArrayDouble(6,2)
+        d[:,0]=zeRadius
+        d[:,1]=[87,-100,110,5,175,95] # angle in degree
+        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)
+        self.assertTrue(m.getBarycenterAndOwner().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
+        m.setCoords(m.getCoords().changeNbOfComponents(3,0.))
+        m2=m.deepCpy()
+        m2.convertQuadraticCellsToLinear()
+        self.assertAlmostEqual(float(m.getMeasureField(False).getArray()),float(m2.getMeasureField(False).getArray()),12)
+        self.assertTrue(m.getBarycenterAndOwner().isEqual(m2.getBarycenterAndOwner(),1e-13))
+        # QPOLYG representing a circle of center zeBary and radius zeRadius
+        zeBary=[5,6]
+        zeRadius=3
+        d=DataArrayDouble(10,2)
+        d[:,0]=zeRadius
+        d[:,1]=[87,-80,-100,-170,110,5,-90,-130,175,95] # angle in degree
+        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)
+        self.assertTrue(m.getBarycenterAndOwner().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
+        m.setCoords(m.getCoords().changeNbOfComponents(3,0.))
+        m2=m.deepCpy()
+        m2.convertQuadraticCellsToLinear() ; m2.checkCoherency2()
+        self.assertTrue(m2.getAllGeoTypes()==[NORM_POLYGON] and m2.getNodalConnectivity().getValues()==[5,0,1,2,3,4])
+        self.assertAlmostEqual(float(m.getMeasureField(False).getArray()),float(m2.getMeasureField(False).getArray()),12)
+        self.assertTrue(m.getBarycenterAndOwner().isEqual(m2.getBarycenterAndOwner(),1e-13))
+        # TRI3
+        self.assertAlmostEqual(float(tri32D.getMeasureField(False).getArray()),(87+100)*pi/180*zeRadius,13)
+        exp=DataArrayDouble(1,2) ; exp[:,0]=3 ; exp[:,1]=(87-100)/2. ; exp[:,1]*=pi/180. ;  exp=exp.fromPolarToCart() ; exp+=DataArrayDouble([5,6],1,2)
+        self.assertTrue(tri32D.getBarycenterAndOwner().isEqual(exp,1e-12))
+        # spaceDim=3 TRI3 becomes TRI2 ... for the moment
+        tri32D.changeSpaceDimension(3)
+        tri2=tri32D.deepCpy() ; tri2.convertQuadraticCellsToLinear()
+        self.assertAlmostEqual(float(tri32D.getMeasureField(False).getArray()),float(tri2.getMeasureField(False).getArray()),13)
+        self.assertTrue(tri32D.getBarycenterAndOwner().isEqual(tri2.getBarycenterAndOwner(),1e-12))
+        tri32D.changeSpaceDimension(1)
+        self.assertAlmostEqual(float(tri32D.getMeasureField(False).getArray()),-0.67795240172962323,12)
+        pass
+
+    # this bug 5/6/2013 is swig specific
+    def testSwigNonRegressionBugRotate3D1(self):
+        m=MEDCouplingUMesh.New()
+        dataArray=DataArrayDouble.New(100,3)
+        dataArray[:]=0.
+        dataArray[0]=[0.,1,3]
+        m.setCoords(dataArray[0])
+        m1=m.deepCpy()
+        m.rotate([0.,0.,3.],[1.,0.,0.],0.5*pi)
+        self.assertTrue(m.getCoords().isEqual(DataArrayDouble([0.,0.,4.],1,3),1e-15))
+        #
+        d1=DataArrayDouble([0.,0.,3.],1,3) ; d2=DataArrayDouble([1.,0.,0.],1,3)
+        pts=[[0.,0.,3.],[(0.,0.,3.)],DataArrayDouble([0.,0.,3.],1,3),list(d1)[0]]
+        vec=[[1.,0.,0.],[(1.,0.,0.)],DataArrayDouble([1.,0.,0.],1,3),list(d2)[0]]
+        for p in pts:
+            for v in vec:
+                m2=m1.deepCpy()
+                m2.rotate(p,v,0.5*pi)
+                self.assertTrue(m2.getCoords().isEqual(DataArrayDouble([0.,0.,4.],1,3),1e-15))
+                pass
+        pass
+
+    def testSwig2DataArrayCount1(self):
+        d=DataArrayInt([])
+        self.assertEqual(0,d.getNumberOfTuples())
+        self.assertEqual(1,d.getNumberOfComponents())
+        self.assertEqual(0,d.count(0))
+        self.assertEqual(0,d.count(1))
+        self.assertEqual(0,d.count(-1))
+        d=DataArrayInt([2,1,-2,-3,2,0,0,7,2,-2,3,0])
+        self.assertEqual(12,d.getNumberOfTuples())
+        self.assertEqual(1,d.getNumberOfComponents())
+        self.assertEqual(3,d.count(0))
+        self.assertEqual(1,d.count(1))
+        self.assertEqual(0,d.count(-1))
+        self.assertEqual(2,d.count(-2))
+        self.assertEqual(3,d.count(2))
+        e=d.getDifferentValues()
+        f=DataArrayInt()
+        for it in e:
+            f.pushBackSilent(d.count(int(it)))
+            pass
+        self.assertEqual(12,f.accumulate()[0])
+        #
+        eps=1e-12
+        d=DataArrayDouble([])
+        self.assertEqual(0,d.getNumberOfTuples())
+        self.assertEqual(1,d.getNumberOfComponents())
+        self.assertEqual(0,d.count(0,eps))
+        self.assertEqual(0,d.count(1,eps))
+        self.assertEqual(0,d.count(-1,eps))
+        d=DataArrayDouble([2,1,-2,-3,2,0,eps/10,7,2+eps/10,-2,3,0])
+        self.assertEqual(12,d.getNumberOfTuples())
+        self.assertEqual(1,d.getNumberOfComponents())
+        self.assertEqual(3,d.count(0,eps))
+        self.assertEqual(1,d.count(1,eps))
+        self.assertEqual(0,d.count(-1,eps))
+        self.assertEqual(2,d.count(-2,eps))
+        self.assertEqual(3,d.count(2,eps))
+        self.assertEqual(3,d.count(2,eps))
+        self.assertEqual(2,d.count(2,eps/100))
+        e=d.getDifferentValues(eps)
+        f=DataArrayInt()
+        for it in e:
+            f.pushBackSilent(d.count(float(it),eps))
+            pass
+        self.assertEqual(12,f.accumulate()[0])
+        pass
+
+    def testSwig2DataArrayGetSlice1(self):
+        s=slice(2,18,1)
+        self.assertEqual(DataArray.GetNumberOfItemGivenBESRelative(s),16)
+        self.assertEqual(DataArray.GetNumberOfItemGivenBES(s),16)
+        self.assertEqual(DataArray.GetSlice(s,0,4),slice(2,6,1))
+        self.assertEqual(DataArray.GetSlice(s,1,4),slice(6,10,1))
+        self.assertEqual(DataArray.GetSlice(s,2,4),slice(10,14,1))
+        self.assertEqual(DataArray.GetSlice(s,3,4),slice(14,18,1))
+        #
+        s=slice(2,18,2)
+        self.assertEqual(DataArray.GetNumberOfItemGivenBESRelative(s),8)
+        self.assertEqual(DataArray.GetNumberOfItemGivenBES(s),8)
+        self.assertEqual(DataArray.GetSlice(s,0,4),slice(2,6,2))
+        self.assertEqual(DataArray.GetSlice(s,1,4),slice(6,10,2))
+        self.assertEqual(DataArray.GetSlice(s,2,4),slice(10,14,2))
+        self.assertEqual(DataArray.GetSlice(s,3,4),slice(14,18,2))
+        #
+        s=slice(1,18,1)
+        self.assertEqual(DataArray.GetSlice(s,0,4),slice(1,5,1))
+        self.assertEqual(DataArray.GetSlice(s,1,4),slice(5,9,1))
+        self.assertEqual(DataArray.GetSlice(s,2,4),slice(9,13,1))
+        self.assertEqual(DataArray.GetSlice(s,3,4),slice(13,18,1))# 18 not 17
+        #
+        s=slice(1,18,2)
+        self.assertEqual(DataArray.GetNumberOfItemGivenBESRelative(s),9)
+        self.assertEqual(DataArray.GetNumberOfItemGivenBES(s),9)
+        self.assertEqual(DataArray.GetSlice(s,0,4),slice(1,5,2))
+        self.assertEqual(DataArray.GetSlice(s,1,4),slice(5,9,2))
+        self.assertEqual(DataArray.GetSlice(s,2,4),slice(9,13,2))
+        self.assertEqual(DataArray.GetSlice(s,3,4),slice(13,18,2))# 18 not 17
+        #
+        s=slice(18,2,-1)
+        self.assertEqual(DataArray.GetSlice(s,0,4),slice(18,14,-1))
+        self.assertEqual(DataArray.GetSlice(s,1,4),slice(14,10,-1))
+        self.assertEqual(DataArray.GetSlice(s,2,4),slice(10,6,-1))
+        self.assertEqual(DataArray.GetSlice(s,3,4),slice(6,2,-1))
+        #
+        s=slice(18,2,-2)
+        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))
+        self.assertEqual(DataArray.GetSlice(s,3,4),slice(6,2,-2))
+        #
+        s=slice(18,1,-1)
+        self.assertEqual(DataArray.GetSlice(s,0,4),slice(18,14,-1))
+        self.assertEqual(DataArray.GetSlice(s,1,4),slice(14,10,-1))
+        self.assertEqual(DataArray.GetSlice(s,2,4),slice(10,6,-1))
+        self.assertEqual(DataArray.GetSlice(s,3,4),slice(6,1,-1))# 1 not 2
+        #
+        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(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))
+        self.assertEqual(DataArray.GetSlice(s,3,4),slice(6,1,-2))# 1 not 2
+        self.assertRaises(InterpKernelException,DataArray.GetSlice,slice(0,None,2),0,4)
+        #
+        d=DataArrayInt.Range(0,18,1)
+        s=slice(2,None,1)
+        self.assertEqual(d.getNumberOfItemGivenBES(s),16)
+        self.assertEqual(d.getNumberOfItemGivenBESRelative(s),16)
+        self.assertEqual(d.getSlice(s,0,4),slice(2,6,1))
+        self.assertEqual(d.getSlice(s,1,4),slice(6,10,1))
+        self.assertEqual(d.getSlice(s,2,4),slice(10,14,1))
+        self.assertEqual(d.getSlice(s,3,4),slice(14,18,1))
+        #
+        d=DataArrayInt.Range(0,18,1)
+        s=slice(2,-2,1)
+        self.assertEqual(d.getSlice(s,0,4),slice(2,5,1))
+        self.assertEqual(d.getSlice(s,1,4),slice(5,8,1))
+        self.assertEqual(d.getSlice(s,2,4),slice(8,11,1))
+        self.assertEqual(d.getSlice(s,3,4),slice(11,16,1))
+        #
+        d=DataArrayInt.Range(0,18,1)
+        s=slice(None,None,1)
+        self.assertEqual(d.getSlice(s,0,4),slice(0,4,1))
+        self.assertEqual(d.getSlice(s,1,4),slice(4,8,1))
+        self.assertEqual(d.getSlice(s,2,4),slice(8,12,1))
+        self.assertEqual(d.getSlice(s,3,4),slice(12,18,1))
+        #
+        d=DataArrayInt.Range(0,18,1)
+        s=slice(None,2,-2)
+        self.assertRaises(InterpKernelException,d.getNumberOfItemGivenBES,s)
+        self.assertEqual(d.getNumberOfItemGivenBESRelative(s),8)
+        self.assertEqual(d.getSlice(s,0,4),slice(17,13,-2))
+        self.assertEqual(d.getSlice(s,1,4),slice(13,9,-2))
+        self.assertEqual(d.getSlice(s,2,4),slice(9,5,-2))
+        self.assertEqual(d.getSlice(s,3,4),slice(5,2,-2))
+        pass
+
+    def testSwig2AccumulatePerChunk1(self):
+        arr=DataArrayDouble(11) ; arr.iota()
+        m=MEDCouplingCMesh() ; m.setCoords(arr,arr)
+        m=m.buildUnstructured()
+        m0=m[::2] ; ids0=m0.simplexize(0) ; m1=m[1::2]
+        m=MEDCouplingUMesh.MergeUMeshesOnSameCoords(m0,m1) ; m.setName("mesh")
+        m.checkConsecutiveCellTypesForMEDFileFrmt()
+        #
+        formula="7-sqrt((x-5.)*(x-5.)+(y-5.)*(y-5.))"
+        f=MEDCouplingFieldDouble(ON_CELLS,ONE_TIME) ; f.setMesh(m)
+        f.fillFromAnalytic(1,formula)
+        f.setName("Field1") ; f.setTime(1.1,1,-1)
+        f.checkCoherency()
+        #
+        arr=f.getArray()
+        arr2=DataArrayDouble(len(arr),2) ; arr2[:,0]=arr
+        arr2=DataArrayDouble(len(arr),2) ; arr2[:,0]=arr ; arr2[:,1]=2*arr
+        f.setArray(arr2)
+        f.checkCoherency()
+        # here the compact code to obviously put field on cell to nodes
+        rn,rni=f.getMesh().getReverseNodalConnectivity()
+        arr2=f.getArray()[rn]
+        arr4=arr2.accumulatePerChunck(rni)
+        nbOfCellsSharingNodes=rni.deltaShiftIndex()
+        arr4/=nbOfCellsSharingNodes.convertToDblArr()
+        #
+        maxNbCSN=nbOfCellsSharingNodes.getMaxValue()[0]
+        arr3=DataArrayDouble(f.getMesh().getNumberOfNodes(),f.getArray().getNumberOfComponents()) ; arr3[:]=0.
+        for i in xrange(1,maxNbCSN+1):
+            ids=nbOfCellsSharingNodes.getIdsEqual(i)
+            if len(ids)==0:
+                continue
+            for j in range(i):
+                rni2=rni[ids] ; rni2+=j
+                arr3[ids]+=arr2[rni2]
+                pass
+            arr3[ids]/=i
+            pass
+        fNode=MEDCouplingFieldDouble(ON_NODES,ONE_TIME) ; fNode.setMesh(m)
+        fNode.setName("Field1Node") ; fNode.setTime(1.1,1,-1)
+        fNode.setArray(arr3) ; fNode.checkCoherency()
+        self.assertTrue(arr3.isEqual(arr4,1e-12))
+        #
+        d=DataArrayInt.Range(0,20,1)
+        self.assertTrue(d.accumulatePerChunck([2,4,12]).isEqual(DataArrayInt([5,60])))
+        #
+        a=DataArrayDouble(12) ; a.iota() ; a.rearrange(3)
+        b=DataArrayDouble(12) ; b.iota(20) ; b.rearrange(3)
+        ids=DataArrayInt([])
+        self.assertEqual(len(a[ids]),0)
+        self.assertEqual(len(b[ids]),0)
+        a2=a.deepCpy() ;  a2[ids]+=b[ids] ; self.assertTrue(a2.isEqual(a,1e-15))
+        a2=a.deepCpy() ;  a2[ids]*=b[ids] ; self.assertTrue(a2.isEqual(a,1e-15))
+        a2=a.deepCpy() ;  a2[ids]/=b[ids] ; self.assertTrue(a2.isEqual(a,1e-15))
+        a2=a.deepCpy() ;  a2[ids]-=b[ids] ; self.assertTrue(a2.isEqual(a,1e-15))
+        pass
+
     def setUp(self):
         pass
     pass
index f4b237abacc584c8912bcd62fe273d432cd2cbe4..36b67bd078e8445c160b5a771e869c76d5b56d87 100644 (file)
@@ -77,6 +77,11 @@ using namespace INTERP_KERNEL;
   $result=convertMultiFields($1,$owner);
 }
 
+%typemap(out) ParaMEDMEM::DataArray*
+{
+  $result=convertDataArray($1,$owner);
+}
+
 %typemap(out) ParaMEDMEM::DataArrayChar*
 {
   $result=convertDataArrayChar($1,$owner);
@@ -89,6 +94,7 @@ using namespace INTERP_KERNEL;
 %feature("autodoc", "1");
 %feature("docstring");
 
+%newobject ParaMEDMEM::MEDCouplingFieldDiscretization::New;
 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::getOffsetArr;
 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::deepCpy;
 %newobject ParaMEDMEM::MEDCouplingFieldDiscretization::clone;
@@ -152,6 +158,7 @@ using namespace INTERP_KERNEL;
 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildNewTimeReprFromThis;
 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getValueOnMulti;
 %newobject ParaMEDMEM::MEDCouplingFieldTemplate::New;
+%newobject ParaMEDMEM::DataArray::selectByTupleRanges;
 %newobject ParaMEDMEM::DataArrayInt::New;
 %newobject ParaMEDMEM::DataArrayInt::__iter__;
 %newobject ParaMEDMEM::DataArrayInt::convertToDblArr;
@@ -159,11 +166,10 @@ using namespace INTERP_KERNEL;
 %newobject ParaMEDMEM::DataArrayInt::performCpy;
 %newobject ParaMEDMEM::DataArrayInt::substr;
 %newobject ParaMEDMEM::DataArrayInt::changeNbOfComponents;
-%newobject ParaMEDMEM::DataArrayInt::keepSelectedComponents;
+%newobject ParaMEDMEM::DataArrayInt::accumulatePerChunck;
 %newobject ParaMEDMEM::DataArrayInt::selectByTupleId;
 %newobject ParaMEDMEM::DataArrayInt::selectByTupleIdSafe;
 %newobject ParaMEDMEM::DataArrayInt::selectByTupleId2;
-%newobject ParaMEDMEM::DataArrayInt::selectByTupleRanges;
 %newobject ParaMEDMEM::DataArrayInt::checkAndPreparePermutation;
 %newobject ParaMEDMEM::DataArrayInt::transformWithIndArrR;
 %newobject ParaMEDMEM::DataArrayInt::renumber;
@@ -218,6 +224,7 @@ using namespace INTERP_KERNEL;
 %newobject ParaMEDMEM::DataArrayInt::__pow__;
 %newobject ParaMEDMEM::DataArrayInt::__rpow__;
 %newobject ParaMEDMEM::DataArrayIntTuple::buildDAInt;
+%newobject ParaMEDMEM::DataArrayChar::deepCpy;
 %newobject ParaMEDMEM::DataArrayChar::convertToIntArr;
 %newobject ParaMEDMEM::DataArrayChar::renumber;
 %newobject ParaMEDMEM::DataArrayChar::renumberR;
@@ -225,20 +232,17 @@ using namespace INTERP_KERNEL;
 %newobject ParaMEDMEM::DataArrayChar::selectByTupleIdSafe;
 %newobject ParaMEDMEM::DataArrayChar::selectByTupleId2;
 %newobject ParaMEDMEM::DataArrayChar::changeNbOfComponents;
-%newobject ParaMEDMEM::DataArrayChar::keepSelectedComponents;
 %newobject ParaMEDMEM::DataArrayChar::getIdsEqual;
 %newobject ParaMEDMEM::DataArrayChar::getIdsNotEqual;
 %newobject ParaMEDMEM::DataArrayChar::Aggregate;
 %newobject ParaMEDMEM::DataArrayChar::Meld;
 %newobject ParaMEDMEM::DataArrayByte::New;
 %newobject ParaMEDMEM::DataArrayByte::__iter__;
-%newobject ParaMEDMEM::DataArrayByte::deepCpy;
 %newobject ParaMEDMEM::DataArrayByte::performCpy;
 %newobject ParaMEDMEM::DataArrayByteTuple::buildDAByte;
 %newobject ParaMEDMEM::DataArrayChar::substr;
 %newobject ParaMEDMEM::DataArrayAsciiChar::New;
 %newobject ParaMEDMEM::DataArrayAsciiChar::__iter__;
-%newobject ParaMEDMEM::DataArrayAsciiChar::deepCpy;
 %newobject ParaMEDMEM::DataArrayAsciiChar::performCpy;
 %newobject ParaMEDMEM::DataArrayAsciiCharTuple::buildDAAsciiChar;
 %newobject ParaMEDMEM::DataArrayDouble::New;
@@ -257,12 +261,11 @@ using namespace INTERP_KERNEL;
 %newobject ParaMEDMEM::DataArrayDouble::Pow;
 %newobject ParaMEDMEM::DataArrayDouble::substr;
 %newobject ParaMEDMEM::DataArrayDouble::changeNbOfComponents;
-%newobject ParaMEDMEM::DataArrayDouble::keepSelectedComponents;
+%newobject ParaMEDMEM::DataArrayDouble::accumulatePerChunck;
 %newobject ParaMEDMEM::DataArrayDouble::getIdsInRange;
 %newobject ParaMEDMEM::DataArrayDouble::selectByTupleId;
 %newobject ParaMEDMEM::DataArrayDouble::selectByTupleIdSafe;
 %newobject ParaMEDMEM::DataArrayDouble::selectByTupleId2;
-%newobject ParaMEDMEM::DataArrayDouble::selectByTupleRanges;
 %newobject ParaMEDMEM::DataArrayDouble::negate;
 %newobject ParaMEDMEM::DataArrayDouble::applyFunc;
 %newobject ParaMEDMEM::DataArrayDouble::applyFunc2;
@@ -302,6 +305,7 @@ using namespace INTERP_KERNEL;
 %newobject ParaMEDMEM::MEDCouplingMesh::checkDeepEquivalOnSameNodesWith;
 %newobject ParaMEDMEM::MEDCouplingMesh::checkTypeConsistencyAndContig;
 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfNodesPerCell;
+%newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfFacesPerCell;
 %newobject ParaMEDMEM::MEDCouplingMesh::buildPartRange;
 %newobject ParaMEDMEM::MEDCouplingMesh::giveCellsWithType;
 %newobject ParaMEDMEM::MEDCouplingMesh::getCoordinatesAndOwner;
@@ -344,6 +348,7 @@ using namespace INTERP_KERNEL;
 %newobject ParaMEDMEM::MEDCouplingUMesh::buildNewNumberingFromCommNodesFrmt;
 %newobject ParaMEDMEM::MEDCouplingUMesh::rearrange2ConsecutiveCellTypes;
 %newobject ParaMEDMEM::MEDCouplingUMesh::sortCellsInMEDFileFrmt;
+%newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForMEDFileFrmt;
 %newobject ParaMEDMEM::MEDCouplingUMesh::convertCellArrayPerGeoType;
 %newobject ParaMEDMEM::MEDCouplingUMesh::computeFetchedNodeIds;
 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec;
@@ -389,6 +394,7 @@ using namespace INTERP_KERNEL;
 %feature("unref") MEDCouplingExtrudedMesh "$this->decrRef();"
 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
 %feature("unref") DataArrayInt "$this->decrRef();"
+%feature("unref") DataArrayChar "$this->decrRef();"
 %feature("unref") DataArrayAsciiChar "$this->decrRef();"
 %feature("unref") DataArrayByte "$this->decrRef();"
 %feature("unref") MEDCouplingField "$this->decrRef();"
@@ -488,7 +494,7 @@ namespace ParaMEDMEM
 
 %inline
 {
-  bool MEDCouplingHasNumpyBindings()
+  bool MEDCouplingHasNumPyBindings()
   {
 #ifdef WITH_NUMPY
     return true;
@@ -496,6 +502,15 @@ namespace ParaMEDMEM
     return false;
 #endif
   }
+
+  std::string MEDCouplingCompletionScript() throw(INTERP_KERNEL::Exception)
+  {
+    static const char script[]="import rlcompleter,readline\nreadline.parse_and_bind('tab:complete')";
+    std::ostringstream oss; oss << "MEDCouplingCompletionScript : error when trying to activate completion ! readline not present ?\nScript is :\n" << script;
+    if(PyRun_SimpleString(script)!=0)
+      throw INTERP_KERNEL::Exception(oss.str().c_str());
+    return std::string(script);
+  }
 }
 
 %include "MEDCouplingMemArray.i"
@@ -569,6 +584,7 @@ namespace ParaMEDMEM
     virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
     virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
     virtual DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
+    virtual DataArrayInt *computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception);
     virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception);
     virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
     virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
@@ -587,6 +603,10 @@ namespace ParaMEDMEM
     virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
     virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
     static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception);
+    static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
+    static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
+    static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
+    static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
     static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
     static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
     %extend
@@ -653,7 +673,7 @@ namespace ParaMEDMEM
            if (!SWIG_IsOK(res1))
              {
                int size;
-               INTERP_KERNEL::AutoPtr<double> tmp=convertPyToNewDblArr2(p,&size);
+               INTERP_KERNEL::AutoCPtr<double> tmp=convertPyToNewDblArr2(p,&size);
                int nbOfPoints=size/spaceDim;
                if(size%spaceDim!=0)
                  {
@@ -950,14 +970,14 @@ namespace ParaMEDMEM
          void rotate(PyObject *center, PyObject *vector, double alpha) throw(INTERP_KERNEL::Exception)
          {
            const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
-           double val;
-           DataArrayDouble *a;
-           DataArrayDoubleTuple *aa;
-           std::vector<double> bb;
+           double val,val2;
+           DataArrayDouble *a,*a2;
+           DataArrayDoubleTuple *aa,*aa2;
+           std::vector<double> bb,bb2;
            int sw;
            int spaceDim=self->getSpaceDimension();
            const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
-           const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,false);
+           const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,spaceDim,false);//vectorPtr can be null in case of space dim 2
            self->rotate(centerPtr,vectorPtr,alpha);
          }
 
@@ -1246,8 +1266,8 @@ namespace ParaMEDMEM
            static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
            {
              int sz;
-             INTERP_KERNEL::AutoPtr<double> c=convertPyToNewDblArr2(center,&sz);
-             INTERP_KERNEL::AutoPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
+             INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
+             INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
              ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,coo);
              for(int i=0;i<sz;i++)
                PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
@@ -1256,7 +1276,7 @@ namespace ParaMEDMEM
            static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
            {
              int sz;
-             INTERP_KERNEL::AutoPtr<double> c=convertPyToNewDblArr2(center,&sz);
+             INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
              int sw,nbNodes=0;
              double val0;  ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
              std::vector<double> val3;
@@ -1270,9 +1290,9 @@ namespace ParaMEDMEM
            static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
            {
              int sz,sz2;
-             INTERP_KERNEL::AutoPtr<double> c=convertPyToNewDblArr2(center,&sz);
-             INTERP_KERNEL::AutoPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
-             INTERP_KERNEL::AutoPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
+             INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
+             INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
+             INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
              ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,coo);
              for(int i=0;i<sz;i++)
                PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
@@ -1281,7 +1301,7 @@ namespace ParaMEDMEM
            static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
            {
              int sz,sz2;
-             INTERP_KERNEL::AutoPtr<double> c=convertPyToNewDblArr2(center,&sz);
+             INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
              int sw,nbNodes=0;
              double val0;  ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
              std::vector<double> val3;
@@ -1289,7 +1309,7 @@ namespace ParaMEDMEM
                                                             "Rotate3DAlg",3,true,nbNodes);
              if(sw!=2 && sw!=3)
                throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
-             INTERP_KERNEL::AutoPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
+             INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
              ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,const_cast<double *>(coo));
            }
          }
@@ -1413,6 +1433,7 @@ namespace ParaMEDMEM
     bool checkConsecutiveCellTypesForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
     DataArrayInt *rearrange2ConsecutiveCellTypes() throw(INTERP_KERNEL::Exception);
     DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception);
+    DataArrayInt *getRenumArrForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
     DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception);
     DataArrayInt *computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception);
     DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0) throw(INTERP_KERNEL::Exception);
@@ -1735,12 +1756,21 @@ namespace ParaMEDMEM
         int nbOfCompo=self->getSpaceDimension();
         const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
         //
-        int cellId=-1,nodeId=-1;
-        double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId,nodeId);
-        PyObject *ret=PyTuple_New(3);
+        int cellId=-1;
+        double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
+        PyObject *ret=PyTuple_New(2);
         PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
         PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
-        PyTuple_SetItem(ret,2,PyInt_FromLong(nodeId));
+        return ret;
+      }
+
+      PyObject *distanceToPoints(const DataArrayDouble *pts) const throw(INTERP_KERNEL::Exception)
+      {
+        DataArrayInt *ret1=0;
+        DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
+        PyObject *ret=PyTuple_New(2);
+        PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
+        PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
         return ret;
       }
 
@@ -3122,7 +3152,7 @@ namespace ParaMEDMEM
         if (!SWIG_IsOK(res1))
           {
             int size;
-            INTERP_KERNEL::AutoPtr<double> tmp=convertPyToNewDblArr2(li,&size);
+            INTERP_KERNEL::AutoCPtr<double> tmp=convertPyToNewDblArr2(li,&size);
             const MEDCouplingMesh *mesh=self->getMesh();
             if(!mesh)
               throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
@@ -3174,18 +3204,16 @@ namespace ParaMEDMEM
         return convertDblArrToPyList(res,sz);
       }
 
-      void setValues(PyObject *li) throw(INTERP_KERNEL::Exception)
+      void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
       {
         if(self->getArray()!=0)
+          ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
+        else
           {
-            int sz;
-            double *tmp=convertPyToNewDblArr2(li,&sz);
-            int nbTuples=self->getArray()->getNumberOfTuples();
-            int nbOfCompo=self->getArray()->getNumberOfComponents();
-            self->getArray()->useArray(tmp,true,CPP_DEALLOC,nbTuples,nbOfCompo);
+            MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
+            ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
+            self->setArray(arr);
           }
-        else
-          throw INTERP_KERNEL::Exception("setValuesCpy : field must contain an array behind");
       }
       
       PyObject *getTime() throw(INTERP_KERNEL::Exception)
@@ -3382,13 +3410,13 @@ namespace ParaMEDMEM
               case 1:
                 {
                   std::vector<int> v2(1,singleVal);
-                  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=ret0Arr->keepSelectedComponents(v2);
+                  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
                   ret0->setArray(aarr);
                   return ret0.retn();
                 }
               case 2:
                 {
-                  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=ret0Arr->keepSelectedComponents(multiVal);
+                  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(multiVal));
                   ret0->setArray(aarr);
                   return ret0.retn();
                 }
@@ -3398,7 +3426,7 @@ namespace ParaMEDMEM
                   std::vector<int> v2(nbOfComp);
                   for(int i=0;i<nbOfComp;i++)
                     v2[i]=slic.first+i*slic.second.second;
-                  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=ret0Arr->keepSelectedComponents(v2);
+                  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
                   ret0->setArray(aarr);
                   return ret0.retn();
                 }
index c4351bcc9a9f7d0eaabb0d392fe33f412db75f7c..cf346fa47c80d37b7e49fbeca6f1c0a2551e7887 100644 (file)
@@ -371,7 +371,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         #! [PySnippet_MEDCouplingFieldDouble_getValueOnMulti_1]
         #! [PySnippet_MEDCouplingFieldDouble_getValueOnMulti_2]
         bc = mesh.getBarycenterAndOwner() # field values are located at cell barycenters
-        valArray = field.getValueOnMulti( bc.getValues() )
+        valArray = field.getValueOnMulti( bc )
         self.assertTrue( valArray.isEqual( field.getArray(), 1e-13 ))
         #! [PySnippet_MEDCouplingFieldDouble_getValueOnMulti_2]
         return
@@ -387,8 +387,8 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         #! [PySnippet_MEDCouplingFieldDouble_getValueOn_2]
         bc = mesh.getBarycenterAndOwner() # field values are located at cell barycenters
         vals = [] # array to collect values returned by getValueOn()
-        for i in range( bc.getNumberOfTuples() ):
-            vals.extend( field.getValueOn( bc.getTuple( i )))
+        for i,tupl in enumerate( bc ):
+            vals.extend( field.getValueOn( tupl ) )
         self.assertTrue( vals == field.getArray().getValues() )
         #! [PySnippet_MEDCouplingFieldDouble_getValueOn_2]
         return
@@ -622,9 +622,9 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         #! [PySnippet_MEDCouplingUMesh_findAndCorrectBadOriented3DExtrudedCells_1]
         #! [PySnippet_MEDCouplingUMesh_findAndCorrectBadOriented3DExtrudedCells_2]
         fixedCells = mesh.findAndCorrectBadOriented3DExtrudedCells()
-        assert len( fixedCells.getValues() ) == 2 # 2 cells fixed
+        assert len( fixedCells ) == 2 # 2 cells fixed
         fixedCells = mesh.findAndCorrectBadOriented3DExtrudedCells()
-        assert len( fixedCells.getValues() ) == 0 # no bad cells
+        assert len( fixedCells ) == 0 # no bad cells
         #! [PySnippet_MEDCouplingUMesh_findAndCorrectBadOriented3DExtrudedCells_2]
         return
 
@@ -655,12 +655,12 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         #! [PySnippet_MEDCouplingUMesh_arePolyhedronsNotCorrectlyOriented_1]
         #! [PySnippet_MEDCouplingUMesh_arePolyhedronsNotCorrectlyOriented_2]
         badCells = mesh.arePolyhedronsNotCorrectlyOriented()
-        assert len( badCells.getValues() ) == 1 # one polyhedron is KO
+        assert len( badCells ) == 1 # one polyhedron is KO
         # fix invalid rolyherdons
         mesh.orientCorrectlyPolyhedrons()
         # re-check the orientation
         badCells = mesh.arePolyhedronsNotCorrectlyOriented()
-        assert len( badCells.getValues() ) == 0 # connectivity is OK
+        assert len( badCells ) == 0 # connectivity is OK
         #! [PySnippet_MEDCouplingUMesh_arePolyhedronsNotCorrectlyOriented_2]
         return
 
@@ -1405,9 +1405,9 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         #! [PySnippet_MEDCouplingPointSet_rotate_3]
         #! [PySnippet_MEDCouplingPointSet_rotate_4]
         mesh.changeSpaceDimension(2)
-        coords2 = mesh.getCoords().getValues()
+        coords2 = mesh.getCoords()
         for i,c in enumerate( coords ):
-            self.assertAlmostEqual( c, coords2[i], 13 )
+            self.assertAlmostEqual( c, coords2.getIJ(0,i), 13 )
         #! [PySnippet_MEDCouplingPointSet_rotate_4]
         return
 
@@ -2100,9 +2100,9 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         for i in xrange(8):#8 is not an error
             self.assertAlmostEqual(expected2[i],m2C.getCoords().getIJ(0,i),12)
             pass
-        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()))
+        self.assertEqual(expected3[:4],[int(i) for i in m2C.getNodalConnectivity()][4:])
+        self.assertEqual(expected3[4:8],[int(i) for i in m2C.getNodalConnectivity()][:4])
+        self.assertEqual(expected4[:3],[int(i) for i in m2C.getNodalConnectivityIndex()])
         #idem previous because nodes of cell#4 are not fully present in part3
         part3=[1,2]
         arrr=DataArrayInt.New()
@@ -2122,9 +2122,9 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         for i in xrange(8):#8 is not an error
             self.assertAlmostEqual(expected2[i],m2C.getCoords().getIJ(0,i),12)
             pass
-        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()))
+        self.assertEqual(expected3[:4],[int(i) for i in m2C.getNodalConnectivity()][4:8])
+        self.assertEqual(expected3[4:8],[int(i) for i in m2C.getNodalConnectivity()][:4])
+        self.assertEqual(expected4[:3],m2C.getNodalConnectivityIndex().getValues())
         part4=[1,2,4]
         f2=f1.buildSubPart(part4)
         self.assertEqual(6,f2.getNumberOfTuples())
@@ -2142,10 +2142,12 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         for i in xrange(12):
             self.assertAlmostEqual(expected2[i],m2C.getCoords().getIJ(0,i),12)
             pass
-        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()))
+        self.assertEqual(expected3[0:4],m2C.getNodalConnectivity().getValues()[4:8])
+        self.assertEqual(expected3[4:8],m2C.getNodalConnectivity().getValues()[0:4])
+        self.assertEqual(expected3[8:13],m2C.getNodalConnectivity().getValues()[8:13])
+        self.assertEqual(expected4,m2C.getNodalConnectivityIndex().getValues())
+        # previous line equivalent to
+        self.assertEqual(expected4,[int(i) for i in m2C.getNodalConnectivityIndex()])
         return
 
     def testExampleUMeshStdBuild1(self):
index 9b916b2986ee301ada6e0c34b883729a49d538a3..a687bf85061b95411328197477e131210d627532 100644 (file)
@@ -32,6 +32,7 @@ namespace ParaMEDMEM
     std::string cppRepr(const char *varName) const throw(INTERP_KERNEL::Exception);
     std::string getName() const;
     void setInfoOnComponents(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
+    void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
     std::vector<std::string> getVarsOnComponent() const throw(INTERP_KERNEL::Exception);
     std::vector<std::string> getUnitsOnComponent() const throw(INTERP_KERNEL::Exception);
     std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
@@ -39,6 +40,9 @@ namespace ParaMEDMEM
     std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
     void setInfoOnComponent(int i, const char *info) throw(INTERP_KERNEL::Exception);
     int getNumberOfComponents() const;
+    virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
+    virtual bool isAllocated() const throw(INTERP_KERNEL::Exception);
+    virtual void checkAllocated() const throw(INTERP_KERNEL::Exception);
     virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
     virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception);
     virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception);
@@ -77,6 +81,177 @@ namespace ParaMEDMEM
         convertPyToNewIntArr3(li,tmp);
         self->copyPartOfStringInfoFrom2(tmp,other);
       }
+
+      virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
+      {
+        void *da=0;
+        int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 |  0 );
+        if (!SWIG_IsOK(res1))
+          {
+            int size;
+            INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
+            if(size!=self->getNumberOfTuples())
+              {
+                throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
+              }
+            self->renumberInPlace(tmp);
+          }
+        else
+          {
+            DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
+            if(!da2)
+              throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
+            da2->checkAllocated();
+            int size=self->getNumberOfTuples();
+            if(size!=self->getNumberOfTuples())
+              {
+                throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
+              }
+            self->renumberInPlace(da2->getConstPointer());
+          }
+      }
+
+      virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
+      {
+        void *da=0;
+        int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 |  0 );
+        if (!SWIG_IsOK(res1))
+          {
+            int size;
+            INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
+            if(size!=self->getNumberOfTuples())
+              {
+                throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
+              }
+            self->renumberInPlaceR(tmp);
+          }
+        else
+          {
+            DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
+            if(!da2)
+              throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
+            da2->checkAllocated();
+            int size=self->getNumberOfTuples();
+            if(size!=self->getNumberOfTuples())
+              {
+                throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
+              }
+            self->renumberInPlaceR(da2->getConstPointer());
+          }
+      }
+
+      //tuplesSelec in PyObject * because DataArrayInt is not already existing !
+      virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
+      {
+        static const char msg[]="DataArray::setContigPartOfSelectedValues2 : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
+          DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 3rd parameter \"aBase\" should be of type DataArray");
+        DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
+        DataArrayInt *tuplesSelecPtr2=0;
+        if(tuplesSelecPtr)
+          {
+            tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
+            if(!tuplesSelecPtr2)
+              throw INTERP_KERNEL::Exception(msg);
+          }
+        self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
+      }
+      
+      virtual void setContigPartOfSelectedValues2(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
+      {
+        DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 2nd parameter \"aBase\" should be of type DataArray");
+        self->setContigPartOfSelectedValues2(tupleIdStart,a,bg,end2,step);
+      }
+
+      virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
+      {
+        std::vector<std::pair<int,int> > ranges;
+        convertPyToVectorPairInt(li,ranges);
+        return self->selectByTupleRanges(ranges);
+      }
+
+      virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
+      {
+        std::vector<int> tmp;
+        convertPyToNewIntArr3(li,tmp);
+        DataArray *ret=self->keepSelectedComponents(tmp);
+        return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
+      }
+
+      static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
+      {
+        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);
+        if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
+          throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : the input slice is invalid !");
+        if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
+          throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : the input slice contains some unknowns that can't be determined in static method ! Call DataArray::getSlice (non static) instead !");
+        int a,b;
+        DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
+        return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
+      }
+
+      PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
+      {
+        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);
+        if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0)
+          throw INTERP_KERNEL::Exception("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));
+      }
+
+      static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
+      {
+        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);
+        if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
+          throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
+        if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
+          throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : the input slice contains some unknowns that can't be determined in static method !");
+        return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
+      }
+
+      static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
+      {
+        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);
+        if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
+          throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
+        if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
+          throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice contains some unknowns that can't be determined in static method !");
+        return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
+      }
+
+      int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
+      {
+        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);
+        if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0)
+          throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
+        return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
+      }
+
+      int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
+      {
+        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);
+        if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0)
+          throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
+        return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
+      }
     }
   };
   
@@ -87,9 +262,6 @@ namespace ParaMEDMEM
   {
   public:
     static DataArrayDouble *New();
-    bool isAllocated() const throw(INTERP_KERNEL::Exception);
-    void checkAllocated() const throw(INTERP_KERNEL::Exception);
-    void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
     double doubleValue() const throw(INTERP_KERNEL::Exception);
     bool empty() const throw(INTERP_KERNEL::Exception);
     DataArrayDouble *deepCpy() const throw(INTERP_KERNEL::Exception);
@@ -100,7 +272,6 @@ namespace ParaMEDMEM
     void pushBackValsSilent(const double *valsBg, const double *valsEnd) throw(INTERP_KERNEL::Exception);
     double popBackSilent() throw(INTERP_KERNEL::Exception);
     void pack() const throw(INTERP_KERNEL::Exception);
-    void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
     void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
     void fillWithZero() throw(INTERP_KERNEL::Exception);
     void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
@@ -130,8 +301,6 @@ namespace ParaMEDMEM
     void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
     void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
     void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
-    void setContigPartOfSelectedValues(int tupleIdStart, const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
-    void setContigPartOfSelectedValues2(int tupleIdStart, const DataArrayDouble *a, int bg, int end2, int step) throw(INTERP_KERNEL::Exception);
     double getIJ(int tupleId, int compoId) const;
     double back() const throw(INTERP_KERNEL::Exception);
     double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
@@ -145,10 +314,10 @@ namespace ParaMEDMEM
     double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
     double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
     double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
+    int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
     double getAverageValue() const throw(INTERP_KERNEL::Exception);
     double norm2() const throw(INTERP_KERNEL::Exception);
     double normMax() const throw(INTERP_KERNEL::Exception);
-    void accumulate(double *res) const throw(INTERP_KERNEL::Exception);
     double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
     DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
     DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
@@ -207,7 +376,12 @@ namespace ParaMEDMEM
 
       static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
       {
-        const char *msg="ParaMEDMEM::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(5)\n-DataArrayDouble.New(5,2) !";
+        const char *msgBase="ParaMEDMEM::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)
@@ -230,7 +404,7 @@ namespace ParaMEDMEM
                             return ret.retn();
                           }
                         else
-                          throw INTERP_KERNEL::Exception(msg);
+                          throw INTERP_KERNEL::Exception(msg.c_str());
                       }
                     else
                       {//DataArrayDouble.New([1.,3.,4.],3)
@@ -242,7 +416,7 @@ namespace ParaMEDMEM
                       }
                   }
                 else
-                  throw INTERP_KERNEL::Exception(msg);
+                  throw INTERP_KERNEL::Exception(msg.c_str());
               }
             else
               {// DataArrayDouble.New([1.,3.,4.])
@@ -272,10 +446,10 @@ namespace ParaMEDMEM
                         return ret.retn();
                       }
                     else
-                      throw INTERP_KERNEL::Exception(msg);
+                      throw INTERP_KERNEL::Exception(msg.c_str());
                   }
                 else
-                  throw INTERP_KERNEL::Exception(msg);
+                  throw INTERP_KERNEL::Exception(msg.c_str());
               }
             else
               {//DataArrayDouble.New(5)
@@ -285,13 +459,13 @@ namespace ParaMEDMEM
               }
           }
 #ifdef WITH_NUMPY
-        else if(PyArray_Check(elt0))
+        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);
+          throw INTERP_KERNEL::Exception(msg.c_str());
       }
    
       DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
@@ -509,64 +683,6 @@ namespace ParaMEDMEM
           }
       }
 
-      void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
-      {
-        void *da=0;
-        int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 |  0 );
-        if (!SWIG_IsOK(res1))
-          {
-            int size;
-            INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
-            if(size!=self->getNumberOfTuples())
-              {
-                throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
-              }
-            self->renumberInPlace(tmp);
-          }
-        else
-          {
-            DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
-            if(!da2)
-              throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
-            da2->checkAllocated();
-            int size=self->getNumberOfTuples();
-            if(size!=self->getNumberOfTuples())
-              {
-                throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
-              }
-            self->renumberInPlace(da2->getConstPointer());
-          }
-      }
-
-      void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
-      {
-        void *da=0;
-        int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 |  0 );
-        if (!SWIG_IsOK(res1))
-          {
-            int size;
-            INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
-            if(size!=self->getNumberOfTuples())
-              {
-                throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
-              }
-            self->renumberInPlaceR(tmp);
-          }
-        else
-          {
-            DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
-            if(!da2)
-              throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
-            da2->checkAllocated();
-            int size=self->getNumberOfTuples();
-            if(size!=self->getNumberOfTuples())
-              {
-                throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
-              }
-            self->renumberInPlaceR(da2->getConstPointer());
-          }
-      }
-
       DataArrayDouble *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
       {
         void *da=0;
@@ -674,12 +790,13 @@ namespace ParaMEDMEM
         self->accumulate(tmp);
         return convertDblArrToPyList(tmp,sz);
       }
-   
-      DataArrayDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
+
+      DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
       {
-        std::vector<int> tmp;
-        convertPyToNewIntArr3(li,tmp);
-        return self->keepSelectedComponents(tmp);
+        int sw,sz,val;
+        std::vector<int> val2;
+        const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
+        return self->accumulatePerChunck(bg,bg+sz);
       }
 
       PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
@@ -738,13 +855,6 @@ namespace ParaMEDMEM
         return DataArrayDouble::Meld(tmp);
       }
 
-      DataArrayDouble *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
-      {
-        std::vector<std::pair<int,int> > ranges;
-        convertPyToVectorPairInt(li,ranges);
-        return self->selectByTupleRanges(ranges);
-      }
-
       PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
       {
         double val;
@@ -1849,6 +1959,16 @@ namespace ParaMEDMEM
         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
         return ret;
       }
+
+      PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
+      {
+        DataArrayInt *ret1=0;
+        DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
+        PyObject *ret=PyTuple_New(2);
+        PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
+        PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+        return ret;
+      }
     }
   };
 
@@ -2154,9 +2274,6 @@ namespace ParaMEDMEM
   {
   public:
     static DataArrayInt *New();
-    bool isAllocated() const throw(INTERP_KERNEL::Exception);
-    void checkAllocated() const throw(INTERP_KERNEL::Exception);
-    void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
     int intValue() const throw(INTERP_KERNEL::Exception);
     int getHashCode() const throw(INTERP_KERNEL::Exception);
     bool empty() const throw(INTERP_KERNEL::Exception);
@@ -2167,7 +2284,6 @@ namespace ParaMEDMEM
     void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
     int popBackSilent() throw(INTERP_KERNEL::Exception);
     void pack() const throw(INTERP_KERNEL::Exception);
-    void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
     void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
     bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
     bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
@@ -2204,8 +2320,6 @@ namespace ParaMEDMEM
     void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
     void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
     void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
-    void setContigPartOfSelectedValues(int tupleIdStart, const DataArrayInt*a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
-    void setContigPartOfSelectedValues2(int tupleIdStart, const DataArrayInt *a, int bg, int end2, int step) throw(INTERP_KERNEL::Exception);
     void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
     int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
     int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
@@ -2227,7 +2341,7 @@ namespace ParaMEDMEM
     bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
     bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
     bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
-    void accumulate(int *res) const throw(INTERP_KERNEL::Exception);
+    int count(int value) const throw(INTERP_KERNEL::Exception);
     int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
     int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
     int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
@@ -2289,7 +2403,12 @@ namespace ParaMEDMEM
 
       static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
       {
-        const char *msg="ParaMEDMEM::DataArrayInt::New : Available API are : \n-DataArrayInt.New()\n-DataArrayInt.New([1,3,4])\n-DataArrayInt.New([1,3,4],3)\n-DataArrayInt.New([1,3,4,5],2,2)\n-DataArrayInt.New([1,3,4,5,7,8],3,2)\n-DataArrayInt.New(5)\n-DataArrayInt.New(5,2) !";
+        const char *msgBase="ParaMEDMEM::DataArrayInt::New : Available API are : \n-DataArrayInt.New()\n-DataArrayInt.New([1,3,4])\n-DataArrayInt.New([1,3,4],3)\n-DataArrayInt.New([1,3,4,5],2,2)\n-DataArrayInt.New([1,3,4,5,7,8],3,2)\n-DataArrayInt.New([(1,3),(4,5),(7,8)])\n-DataArrayInt.New(5)\n-DataArrayInt.New(5,2)";
+        std::string msg(msgBase);
+#ifdef WITH_NUMPY
+        msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
+#endif
+        msg+=" !";
         if(PyList_Check(elt0) || PyTuple_Check(elt0))
           {
             if(nbOfTuples)
@@ -2312,7 +2431,7 @@ namespace ParaMEDMEM
                             return ret.retn();
                           }
                         else
-                          throw INTERP_KERNEL::Exception(msg);
+                          throw INTERP_KERNEL::Exception(msg.c_str());
                       }
                     else
                       {//DataArrayInt.New([1,3,4],3)
@@ -2324,7 +2443,7 @@ namespace ParaMEDMEM
                       }
                   }
                 else
-                  throw INTERP_KERNEL::Exception(msg);
+                  throw INTERP_KERNEL::Exception(msg.c_str());
               }
             else
               {// DataArrayInt.New([1,3,4])
@@ -2354,10 +2473,10 @@ namespace ParaMEDMEM
                         return ret.retn();
                       }
                     else
-                      throw INTERP_KERNEL::Exception(msg);
+                      throw INTERP_KERNEL::Exception(msg.c_str());
                   }
                 else
-                  throw INTERP_KERNEL::Exception(msg);
+                  throw INTERP_KERNEL::Exception(msg.c_str());
               }
             else
               {//DataArrayInt.New(5)
@@ -2367,13 +2486,13 @@ namespace ParaMEDMEM
               }
           }
 #ifdef WITH_NUMPY
-        else if(PyArray_Check(elt0))
+        else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
           {//DataArrayInt.New(numpyArray)
             return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT,&PyCallBackDataArrayInt_RefType,"INT32");
           }
 #endif
         else
-          throw INTERP_KERNEL::Exception(msg);
+          throw INTERP_KERNEL::Exception(msg.c_str());
       }
 
       DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
@@ -2415,6 +2534,14 @@ namespace ParaMEDMEM
         self->accumulate(tmp);
         return convertIntArrToPyList(tmp,sz);
       }
+
+      DataArrayInt *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);
+        return self->accumulatePerChunck(bg,bg+sz);
+      }
    
       static PyObject *BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
       {
@@ -2611,7 +2738,7 @@ namespace ParaMEDMEM
         return ret;
       }
 
-      DataArrayInt *transformWithIndArrR(PyObject *li) const
+      DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
       {
         void *da=0;
         int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 |  0 );
@@ -2628,64 +2755,6 @@ namespace ParaMEDMEM
           }
       }
 
-      void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
-      {
-        void *da=0;
-        int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 |  0 );
-        if (!SWIG_IsOK(res1))
-          {
-            int size;
-            INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
-            if(size!=self->getNumberOfTuples())
-              {
-                throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
-              }
-            self->renumberInPlace(tmp);
-          }
-        else
-          {
-            DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
-            if(!da2)
-              throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
-            da2->checkAllocated();
-            int size=self->getNumberOfTuples();
-            if(size!=self->getNumberOfTuples())
-              {
-                throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
-              }
-            self->renumberInPlace(da2->getConstPointer());
-          }
-      }
-
-      void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
-      {
-        void *da=0;
-        int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 |  0 );
-        if (!SWIG_IsOK(res1))
-          {
-            int size;
-            INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
-            if(size!=self->getNumberOfTuples())
-              {
-                throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
-              }
-            self->renumberInPlaceR(tmp);
-          }
-        else
-          {
-            DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
-            if(!da2)
-              throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
-            da2->checkAllocated();
-            int size=self->getNumberOfTuples();
-            if(size!=self->getNumberOfTuples())
-              {
-                throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
-              }
-            self->renumberInPlaceR(da2->getConstPointer());
-          }
-      }
-
       DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
       {
         void *da=0;
@@ -2813,13 +2882,6 @@ namespace ParaMEDMEM
           }
       }
 
-      DataArrayInt *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
-      {
-        std::vector<int> tmp;
-        convertPyToNewIntArr3(li,tmp);
-        return self->keepSelectedComponents(tmp);
-      }
-
       void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
       {
         std::vector<int> tmp;
@@ -2846,13 +2908,6 @@ namespace ParaMEDMEM
         return res;
       }
 
-      DataArrayInt *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
-      {
-        std::vector<std::pair<int,int> > ranges;
-        convertPyToVectorPairInt(li,ranges);
-        return self->selectByTupleRanges(ranges);
-      }
-
       static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
       {
         std::vector<const DataArrayInt *> tmp;
@@ -4483,9 +4538,7 @@ namespace ParaMEDMEM
   {
   public:
     virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception) = 0;
-    bool isAllocated() const throw(INTERP_KERNEL::Exception);
-    void checkAllocated() const throw(INTERP_KERNEL::Exception);
-    void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
+    virtual DataArrayChar *deepCpy() const throw(INTERP_KERNEL::Exception);
     int getHashCode() const throw(INTERP_KERNEL::Exception);
     bool empty() const throw(INTERP_KERNEL::Exception);
     void cpyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
@@ -4494,7 +4547,6 @@ namespace ParaMEDMEM
     void pushBackValsSilent(const char *valsBg, const char *valsEnd) throw(INTERP_KERNEL::Exception);
     char popBackSilent() throw(INTERP_KERNEL::Exception);
     void pack() const throw(INTERP_KERNEL::Exception);
-    void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
     void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
     bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
     bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
@@ -4505,8 +4557,6 @@ namespace ParaMEDMEM
     std::string reprZip() const throw(INTERP_KERNEL::Exception);
     void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
     DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
-    void renumberInPlace(const int *old2New) throw(INTERP_KERNEL::Exception);
-    void renumberInPlaceR(const int *new2Old) throw(INTERP_KERNEL::Exception);
     DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
     DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
     DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
@@ -4561,64 +4611,6 @@ namespace ParaMEDMEM
         return ret;
       }
       
-      void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
-      {
-        void *da=0;
-        int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 |  0 );
-        if (!SWIG_IsOK(res1))
-          {
-            int size;
-            INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
-            if(size!=self->getNumberOfTuples())
-              {
-                throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
-              }
-            self->renumberInPlace(tmp);
-          }
-        else
-          {
-            DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
-            if(!da2)
-              throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
-            da2->checkAllocated();
-            int size=self->getNumberOfTuples();
-            if(size!=self->getNumberOfTuples())
-              {
-                throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
-              }
-            self->renumberInPlace(da2->getConstPointer());
-          }
-      }
-      
-      void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
-      {
-        void *da=0;
-        int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 |  0 );
-        if (!SWIG_IsOK(res1))
-          {
-            int size;
-            INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
-            if(size!=self->getNumberOfTuples())
-              {
-                throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
-              }
-            self->renumberInPlaceR(tmp);
-          }
-        else
-          {
-            DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
-            if(!da2)
-           throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
-            da2->checkAllocated();
-            int size=self->getNumberOfTuples();
-            if(size!=self->getNumberOfTuples())
-              {
-                throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
-              }
-            self->renumberInPlaceR(da2->getConstPointer());
-          }
-      }
-      
       DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
       {
         void *da=0;
@@ -4726,13 +4718,6 @@ namespace ParaMEDMEM
           }
       }
       
-      DataArrayChar *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
-      {
-        std::vector<int> tmp;
-        convertPyToNewIntArr3(li,tmp);
-        return self->keepSelectedComponents(tmp);
-      }
-      
       static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
       {
         std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
@@ -4757,7 +4742,6 @@ namespace ParaMEDMEM
     static DataArrayByte *New();
     DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
     DataArrayByteIterator *iterator();
-    DataArrayByte *deepCpy() const;
     DataArrayByte *performCpy(bool deepCpy) const;
     char byteValue() const throw(INTERP_KERNEL::Exception);
     %extend
@@ -5060,7 +5044,6 @@ namespace ParaMEDMEM
     static DataArrayAsciiChar *New();
     DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
     DataArrayAsciiCharIterator *iterator();
-    DataArrayAsciiChar *deepCpy() const;
     DataArrayAsciiChar *performCpy(bool deepCpy) const;
     char asciiCharValue() const throw(INTERP_KERNEL::Exception);
     %extend
diff --git a/src/MEDCoupling_Swig/MEDCouplingNumPyTest.py b/src/MEDCoupling_Swig/MEDCouplingNumPyTest.py
new file mode 100644 (file)
index 0000000..3af053f
--- /dev/null
@@ -0,0 +1,663 @@
+#  -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2013  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.
+#
+# 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 *
+
+if MEDCouplingHasNumPyBindings():
+    from numpy import *
+    pass
+
+from sys import getrefcount
+
+import os,gc,weakref,unittest
+
+class MEDCouplingNumPyTest(unittest.TestCase):
+    
+    # @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test1(self):
+        sz=20
+        a=array(0,dtype=int32)
+        a.resize(sz)
+        a[:]=4
+        self.assertEqual(getrefcount(a),2)
+        a=a.cumsum(dtype=int32)
+        self.assertEqual(getrefcount(a),2)
+        d=DataArrayInt(a)
+        d[:]=2
+        #
+        e=DataArrayInt(sz) ; e.fillWithValue(2)
+        self.assertTrue(d.isEqual(e))
+        #
+        a[:]=4 ; e.fillWithValue(4)
+        self.assertTrue(d.isEqual(e))
+        pass
+    
+    # @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test2(self):
+        sz=20
+        a=array(0,dtype=int32)
+        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=DataArrayInt(b)
+        #
+        e=DataArrayInt(sz*2) ; e.fillWithValue(5)
+        self.assertTrue(d.isEqual(e))
+        pass
+    
+    # @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test3(self):
+        sz=10
+        a=array(0,dtype=int32)
+        a.resize(sz,2)
+        b=a.reshape(2*sz)
+        c=a.reshape(2,sz)
+        b[:]=6
+        b[7:17]=7
+        d=DataArrayInt(b)
+        self.assertTrue(d.isEqual(DataArrayInt([6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,6,6,6])))
+        #
+        a=zeros((10,2),dtype=int32)
+        b=a.T
+        c=b.view()
+        a.shape=20
+        a[3:]=10.
+        d=DataArrayInt(a)
+        self.assertTrue(d.isEqual(DataArrayInt([0,0,0,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10])))
+        pass
+    
+    # @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test4(self):
+        a=zeros(20,dtype=int32)
+        b = a[::-1]
+        self.assertRaises(InterpKernelException,DataArrayInt.New,b) # b is not contiguous in memory
+        pass
+    
+    # @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test5(self):
+        a=arange(20,dtype=int32)
+        self.assertEqual(weakref.getweakrefcount(a),0)
+        d=DataArrayInt(a)
+        self.assertEqual(weakref.getweakrefcount(a),1)
+        self.assertTrue(not a.flags["OWNDATA"])
+        self.assertTrue(d.isIdentity())
+        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))
+        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(DataArrayInt(a).isUniform(4))
+        pass
+    
+    # @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test6(self):
+        a=arange(20,dtype=int32)
+        d=DataArrayInt(a) # d owns data of a
+        e=DataArrayInt(a) # a not owned -> e only an access to chunk of a 
+        self.assertTrue(d.isIdentity())
+        self.assertTrue(e.isIdentity())
+        a[:]=6
+        self.assertTrue(d.isUniform(6))
+        self.assertTrue(e.isUniform(6))
+        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))
+        self.assertTrue(not e.isAllocated())
+        pass
+
+    # @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test7(self):
+        a=array(0,dtype=int32) ; a.resize(10,2)
+        b=a.reshape(20)
+        c=a.reshape(2,10)
+        d=DataArrayInt(b) # d owns data of a
+        e=DataArrayInt(b) # a not owned -> e only an access to chunk of a
+        f=DataArrayInt(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))
+        e[:]=6
+        self.assertTrue(e.isUniform(6))
+        self.assertTrue(f.isUniform(6))
+        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.isIdentity())
+        self.assertTrue(e.isIdentity())
+        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.isIdentity())
+        self.assertTrue(e.isIdentity())
+        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 test8(self):
+        a=arange(20,dtype=int32)
+        self.assertTrue(a.flags["OWNDATA"])
+        d=DataArrayInt(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(DataArrayInt([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20])))
+        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 test9(self):
+        sz=20
+        a=array(0,dtype=float64)
+        a.resize(sz)
+        a[:]=4
+        self.assertEqual(getrefcount(a),2)
+        a=a.cumsum(dtype=float64)
+        self.assertEqual(getrefcount(a),2)
+        d=DataArrayDouble(a)
+        d[:]=2
+        #
+        e=DataArrayDouble(sz) ; e.fillWithValue(2)
+        self.assertTrue(d.isEqual(e,1e-14))
+        #
+        a[:]=4 ; e.fillWithValue(4)
+        self.assertTrue(d.isEqual(e,1e-14))
+        pass
+    
+    # @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test10(self):
+        sz=20
+        a=array(0,dtype=float64)
+        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=DataArrayDouble(b)
+        #
+        e=DataArrayDouble(sz*2) ; e.fillWithValue(5)
+        self.assertTrue(d.isEqual(e,1e-14))
+        pass
+    
+    # @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test11(self):
+        sz=10
+        a=array(0,dtype=float64)
+        a.resize(sz,2)
+        b=a.reshape(2*sz)
+        c=a.reshape(2,sz)
+        b[:]=6
+        b[7:17]=7
+        d=DataArrayDouble(b)
+        self.assertTrue(d.isEqual(DataArrayDouble([6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,6,6,6]),1e-14))
+        #
+        a=zeros((10,2),dtype=float64)
+        b=a.T
+        c=b.view()
+        a.shape=20
+        a[3:]=10.
+        d=DataArrayDouble(a)
+        self.assertTrue(d.isEqual(DataArrayDouble([0,0,0,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10]),1e-14))
+        pass
+    
+    # @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test12(self):
+        a=zeros(20,dtype=float64)
+        b = a[::-1]
+        self.assertRaises(InterpKernelException,DataArrayDouble.New,b) # b is not contiguous in memory
+        pass
+    
+    # @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test13(self):
+        a=arange(20,dtype=float64)
+        self.assertEqual(weakref.getweakrefcount(a),0)
+        d=DataArrayDouble(a)
+        self.assertEqual(weakref.getweakrefcount(a),1)
+        self.assertTrue(not a.flags["OWNDATA"])
+        self.assertTrue(d.isEqual(DataArrayDouble([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]),1e-14))
+        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-14))
+        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(DataArrayDouble(a).isUniform(4,1e-14))
+        pass
+    
+    # @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test14(self):
+        a=arange(20,dtype=float64)
+        d=DataArrayDouble(a) # d owns data of a
+        e=DataArrayDouble(a) # a not owned -> e only an access to chunk of a 
+        self.assertTrue(d.isEqual(DataArrayDouble([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]),1e-14))
+        self.assertTrue(e.isEqual(DataArrayDouble([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]),1e-14))
+        a[:]=6
+        self.assertTrue(d.isUniform(6,1e-14))
+        self.assertTrue(e.isUniform(6,1e-14))
+        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-14))
+        self.assertTrue(not e.isAllocated())
+        pass
+
+    # @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test15(self):
+        a=array(0,dtype=float64) ; a.resize(10,2)
+        b=a.reshape(20)
+        c=a.reshape(2,10)
+        d=DataArrayDouble(b) # d owns data of a
+        e=DataArrayDouble(b) # a not owned -> e only an access to chunk of a
+        f=DataArrayDouble(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-14))
+        e[:]=6
+        self.assertTrue(e.isUniform(6,1e-14))
+        self.assertTrue(f.isUniform(6,1e-14))
+        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(DataArrayDouble([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]),1e-14))
+        self.assertTrue(e.isEqual(DataArrayDouble([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]),1e-14))
+        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(DataArrayDouble([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]),1e-14))
+        self.assertTrue(e.isEqual(DataArrayDouble([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]),1e-14))
+        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 test16(self):
+        a=arange(20,dtype=float64)
+        self.assertTrue(a.flags["OWNDATA"])
+        d=DataArrayDouble(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(DataArrayDouble([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]),1e-14))
+        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 test17(self):
+        d=DataArrayInt.Range(0,20,1)
+        a=d.toNumPyArray()
+        self.assertTrue(not a.flags["OWNDATA"])
+        a[-2:]=100
+        self.assertTrue(d.isEqual(DataArrayInt([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,100,100])))
+        self.assertEqual(a.tolist(),[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,100,100])
+        del a
+        ##@@ Ensure a pass of the garbage collector so that the de-allocator of d is called
+        import gc
+        gc.collect()
+        self.assertTrue(d.isEqual(DataArrayInt([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,100,100])))
+        #
+        d.rearrange(2)
+        a=d.toNumPyArray()
+        self.assertTrue(not a.flags["OWNDATA"])
+        a[-2:]=200
+        self.assertTrue(d.isEqual(DataArrayInt([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,200,200,200,200],10,2)))
+        self.assertEqual(a.tolist(),[[0,1],[2,3],[4,5],[6,7],[8,9],[10,11],[12,13],[14,15],[200,200],[200,200]])
+        del a
+        ##@@ Ensure a pass of the garbage collector so that the de-allocator of d is called
+        gc.collect()
+        self.assertTrue(d.isEqual(DataArrayInt([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,200,200,200,200],10,2)))
+        pass
+
+    # @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test18(self):
+        d=DataArrayInt.Range(0,20,1)
+        d=d.convertToDblArr()
+        a=d.toNumPyArray()
+        self.assertTrue(not a.flags["OWNDATA"])
+        a[-2:]=100
+        self.assertTrue(d.isEqual(DataArrayDouble([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,100,100]),1e-14))
+        self.assertEqual(a.tolist(),[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,100,100])
+        del a
+        ##@@ Ensure a pass of the garbage collector so that the de-allocator of d is called
+        import gc
+        gc.collect()
+        self.assertTrue(d.isEqual(DataArrayDouble([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,100,100]),1e-14))
+        #
+        d.rearrange(2)
+        a=d.toNumPyArray()
+        self.assertTrue(not a.flags["OWNDATA"])
+        a[-2:]=200
+        self.assertTrue(d.isEqual(DataArrayDouble([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,200,200,200,200],10,2),1e-14))
+        self.assertEqual(a.tolist(),[[0,1],[2,3],[4,5],[6,7],[8,9],[10,11],[12,13],[14,15],[200,200],[200,200]])
+        del a
+        ##@@ Ensure a pass of the garbage collector so that the de-allocator of d is called
+        gc.collect()
+        self.assertTrue(d.isEqual(DataArrayDouble([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,200,200,200,200],10,2),1e-14))
+        pass
+
+    # @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test19(self):
+        sz=20
+        a=array(0,dtype=int32)
+        a.resize(sz/2,2)
+        a[:]=4
+        self.assertEqual(getrefcount(a),2)
+        d=DataArrayInt(a)
+        self.assertEqual(10,d.getNumberOfTuples())
+        self.assertEqual(2,d.getNumberOfComponents())
+        self.assertEqual(sz,d.getNbOfElems())
+        self.assertTrue(d.isEqual(DataArrayInt([(4,4),(4,4),(4,4),(4,4),(4,4),(4,4),(4,4),(4,4),(4,4),(4,4)])))
+        a[:]=7
+        self.assertTrue(d.isEqual(DataArrayInt([(7,7),(7,7),(7,7),(7,7),(7,7),(7,7),(7,7),(7,7),(7,7),(7,7)])))
+        #
+        b=a.reshape((2,5,2))
+        self.assertRaises(InterpKernelException,DataArrayInt.New,b) # b has not dimension in [0,1] !
+        pass
+
+    # @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test20(self):
+        sz=20
+        a=array(0,dtype=float64)
+        a.resize(sz/2,2)
+        a[:]=4
+        self.assertEqual(getrefcount(a),2)
+        d=DataArrayDouble(a)
+        self.assertEqual(10,d.getNumberOfTuples())
+        self.assertEqual(2,d.getNumberOfComponents())
+        self.assertEqual(sz,d.getNbOfElems())
+        self.assertTrue(d.isEqual(DataArrayDouble([(4.,4.),(4.,4.),(4.,4.),(4.,4.),(4.,4.),(4.,4.),(4.,4.),(4.,4.),(4.,4.),(4.,4.)]),1e-14))
+        a[:]=7
+        self.assertTrue(d.isEqual(DataArrayDouble([(7.,7.),(7.,7.),(7.,7.),(7.,7.),(7.,7.),(7.,7.),(7.,7.),(7.,7.),(7.,7.),(7.,7.)]),1e-14))
+        #
+        b=a.reshape((2,5,2))
+        self.assertRaises(InterpKernelException,DataArrayDouble.New,b) # b has not dimension in [0,1] !
+        pass
+
+    # @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test21(self):
+        #tests that only DataArray*(npArray) contructor is available
+        a=array(0,dtype=int32)
+        a.resize(20)
+        DataArrayInt(a)
+        self.assertRaises(InterpKernelException,DataArrayInt.New,a,20)
+        self.assertRaises(InterpKernelException,DataArrayInt.New,a,20,1)
+        a=array(0,dtype=float64)
+        a.resize(20)
+        DataArrayDouble(a)
+        self.assertRaises(InterpKernelException,DataArrayDouble.New,a,20)
+        self.assertRaises(InterpKernelException,DataArrayDouble.New,a,20,1)
+        pass
+
+    # @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test22(self):
+        d=DataArrayDouble(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 test23(self):
+        d=DataArrayDouble(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 test24(self):
+        d=DataArrayDouble(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
+    
+    # @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test25(self):
+        a=arange(10,dtype=int32)
+        b=DataArrayInt(a)
+        c=DataArrayInt(a)
+        d=DataArrayInt(a)
+        self.assertTrue(b.isIdentity()) ; self.assertEqual(len(b),10)
+        self.assertTrue(c.isIdentity()) ; self.assertEqual(len(c),10)
+        self.assertTrue(d.isIdentity()) ; self.assertEqual(len(d),10)
+        c.pushBackSilent(10) # c and a,b are dissociated
+        self.assertTrue(b.isIdentity()) ; self.assertEqual(len(b),10)
+        self.assertTrue(c.isIdentity()) ; self.assertEqual(len(c),11)
+        self.assertTrue(d.isIdentity()) ; self.assertEqual(len(d),10)
+        del a
+        gc.collect()
+        self.assertTrue(b.isIdentity()) ; self.assertEqual(len(b),10)
+        self.assertTrue(c.isIdentity()) ; self.assertEqual(len(c),11)
+        self.assertTrue(not d.isAllocated())
+        del b
+        gc.collect()
+        self.assertTrue(c.isIdentity()) ; self.assertEqual(len(c),11)
+        #
+        a=arange(10,dtype=int32)
+        b=DataArrayInt(a)
+        c=DataArrayInt(a)
+        self.assertTrue(b.isIdentity()) ; self.assertEqual(len(b),10)
+        self.assertTrue(c.isIdentity()) ; self.assertEqual(len(c),10)
+        b.pushBackSilent(10) # c and a,b are dissociated
+        self.assertTrue(b.isIdentity()) ; self.assertEqual(len(b),11)
+        self.assertTrue(c.isIdentity()) ; self.assertEqual(len(c),10)
+        del a
+        gc.collect()
+        self.assertTrue(b.isIdentity()) ; self.assertEqual(len(b),11)
+        self.assertTrue(not c.isAllocated())
+        del b
+        gc.collect()
+        self.assertTrue(not c.isAllocated())
+        #
+        a=float64(arange(5,dtype=int32))
+        b=DataArrayDouble(a)
+        c=DataArrayDouble(a)
+        d=DataArrayDouble(a)
+        self.assertTrue(b.isEqual(DataArrayDouble([0.,1.,2.,3.,4.]),1e-12))
+        self.assertTrue(c.isEqual(DataArrayDouble([0.,1.,2.,3.,4.]),1e-12))
+        self.assertTrue(d.isEqual(DataArrayDouble([0.,1.,2.,3.,4.]),1e-12))
+        c.pushBackSilent(10.) # c and a,b are dissociated
+        self.assertTrue(b.isEqual(DataArrayDouble([0.,1.,2.,3.,4.]),1e-12))
+        self.assertTrue(c.isEqual(DataArrayDouble([0.,1.,2.,3.,4.,10.]),1e-12))
+        self.assertTrue(d.isEqual(DataArrayDouble([0.,1.,2.,3.,4.]),1e-12))
+        del a
+        gc.collect()
+        self.assertTrue(b.isEqual(DataArrayDouble([0.,1.,2.,3.,4.]),1e-12))
+        self.assertTrue(c.isEqual(DataArrayDouble([0.,1.,2.,3.,4.,10.]),1e-12))
+        self.assertTrue(not d.isAllocated())
+        del b
+        gc.collect()
+        self.assertTrue(c.isEqual(DataArrayDouble([0.,1.,2.,3.,4.,10.]),1e-12))
+        #
+        a=float64(arange(5,dtype=int32))
+        b=DataArrayDouble(a)
+        c=DataArrayDouble(a)
+        self.assertTrue(b.isEqual(DataArrayDouble([0.,1.,2.,3.,4.]),1e-12))
+        self.assertTrue(c.isEqual(DataArrayDouble([0.,1.,2.,3.,4.]),1e-12))
+        b.pushBackSilent(10.) # c and a,b are dissociated
+        self.assertTrue(b.isEqual(DataArrayDouble([0.,1.,2.,3.,4.,10.]),1e-12))
+        self.assertTrue(c.isEqual(DataArrayDouble([0.,1.,2.,3.,4.]),1e-12))
+        del a
+        gc.collect()
+        self.assertTrue(b.isEqual(DataArrayDouble([0.,1.,2.,3.,4.,10.]),1e-12))
+        self.assertTrue(not c.isAllocated())
+        del b
+        gc.collect()
+        self.assertTrue(not c.isAllocated())
+        pass
+
+    # @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test26(self):
+        d=DataArrayInt(15) ; d.iota()
+        d.rearrange(3)
+        a=d.toNumPyArray()
+        self.assertEqual(a.ndim,2)
+        self.assertEqual(a.size,15)
+        self.assertEqual(a.shape,(5,3))
+        self.assertEqual(a.strides,(12,4))
+        self.assertEqual(a.nbytes,60)
+        self.assertEqual(a.itemsize,4)
+        self.assertEqual(a.tolist(),[[0,1,2],[3,4,5],[6,7,8],[9,10,11],[12,13,14]])
+        #
+        d2=d.convertToDblArr()
+        a2=d2.toNumPyArray()
+        self.assertEqual(a2.ndim,2)
+        self.assertEqual(a2.size,15)
+        self.assertEqual(a2.shape,(5,3))
+        self.assertEqual(a2.strides,(24,8))
+        self.assertEqual(a2.nbytes,120)
+        self.assertEqual(a2.itemsize,8)
+        self.assertEqual(a2.tolist(),[[0.,1.,2.],[3.,4.,5.],[6.,7.,8.],[9.,10.,11.],[12.,13.,14.]])
+        pass
+
+    def setUp(self):
+        pass
+    pass
+
+#gc.set_debug(gc.DEBUG_LEAK)
+unittest.main()
diff --git a/src/MEDCoupling_Swig/MEDCouplingNumpyTest.py b/src/MEDCoupling_Swig/MEDCouplingNumpyTest.py
deleted file mode 100644 (file)
index b6f54f1..0000000
+++ /dev/null
@@ -1,356 +0,0 @@
-#  -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2013  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.
-#
-# 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 *
-
-if MEDCouplingHasNumpyBindings():
-    from numpy import *
-    pass
-
-from sys import getrefcount
-
-import os,gc,weakref,unittest
-
-class MEDCouplingNumpyTest(unittest.TestCase):
-    
-    @unittest.skipUnless(MEDCouplingHasNumpyBindings(),"requires numpy")
-    def test1(self):
-        sz=20
-        a=array(0,dtype=int32)
-        a.resize(sz)
-        a[:]=4
-        self.assertEqual(getrefcount(a),2)
-        a=a.cumsum(dtype=int32)
-        self.assertEqual(getrefcount(a),2)
-        d=DataArrayInt(a)
-        d[:]=2
-        #
-        e=DataArrayInt(sz) ; e.fillWithValue(2)
-        self.assertTrue(d.isEqual(e))
-        #
-        a[:]=4 ; e.fillWithValue(4)
-        self.assertTrue(d.isEqual(e))
-        pass
-    
-    @unittest.skipUnless(MEDCouplingHasNumpyBindings(),"requires numpy")
-    def test2(self):
-        sz=20
-        a=array(0,dtype=int32)
-        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=DataArrayInt(b)
-        #
-        e=DataArrayInt(sz*2) ; e.fillWithValue(5)
-        self.assertTrue(d.isEqual(e))
-        pass
-    
-    @unittest.skipUnless(MEDCouplingHasNumpyBindings(),"requires numpy")
-    def test3(self):
-        sz=10
-        a=array(0,dtype=int32)
-        a.resize(sz,2)
-        b=a.reshape(2*sz)
-        c=a.reshape(2,sz)
-        b[:]=6
-        b[7:17]=7
-        d=DataArrayInt(b)
-        self.assertTrue(d.isEqual(DataArrayInt([6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,6,6,6])))
-        #
-        a=zeros((10,2),dtype=int32)
-        b=a.T
-        c=b.view()
-        a.shape=20
-        a[3:]=10.
-        d=DataArrayInt(a)
-        self.assertTrue(d.isEqual(DataArrayInt([0,0,0,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10])))
-        pass
-    
-    @unittest.skipUnless(MEDCouplingHasNumpyBindings(),"requires numpy")
-    def test4(self):
-        a=zeros(20,dtype=int32)
-        b = a[::-1]
-        self.assertRaises(InterpKernelException,DataArrayInt.New,b) # b is not contiguous in memory
-        pass
-    
-    @unittest.skipUnless(MEDCouplingHasNumpyBindings(),"requires numpy")
-    def test5(self):
-        a=arange(20,dtype=int32)
-        self.assertEqual(weakref.getweakrefcount(a),0)
-        d=DataArrayInt(a)
-        self.assertEqual(weakref.getweakrefcount(a),1)
-        self.assertTrue(not a.flags["OWNDATA"])
-        self.assertTrue(d.isIdentity())
-        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))
-        del d # d is destroyed, a retrieves its ownership of its initial chunk of data
-        self.assertTrue(a.flags["OWNDATA"])
-        a[:]=4 # a can be used has usual
-        self.assertTrue(DataArrayInt(a).isUniform(4))
-        pass
-    
-    @unittest.skipUnless(MEDCouplingHasNumpyBindings(),"requires numpy")
-    def test6(self):
-        a=arange(20,dtype=int32)
-        d=DataArrayInt(a) # d owns data of a
-        e=DataArrayInt(a) # a not owned -> e only an access to chunk of a 
-        self.assertTrue(d.isIdentity())
-        self.assertTrue(e.isIdentity())
-        a[:]=6
-        self.assertTrue(d.isUniform(6))
-        self.assertTrue(e.isUniform(6))
-        del a # a destroyed -> d no change because owned and e array is has no more data set
-        self.assertTrue(d.isUniform(6))
-        self.assertTrue(not e.isAllocated())
-        pass
-
-    @unittest.skipUnless(MEDCouplingHasNumpyBindings(),"requires numpy")
-    def test7(self):
-        a=array(0,dtype=int32) ; a.resize(10,2)
-        b=a.reshape(20)
-        c=a.reshape(2,10)
-        d=DataArrayInt(b) # d owns data of a
-        e=DataArrayInt(b) # a not owned -> e only an access to chunk of a
-        f=DataArrayInt(b) # a not owned -> e only an access to chunk of a
-        del d # d removed -> a ownes again data
-        self.assertTrue(e.isUniform(0))
-        e[:]=6
-        self.assertTrue(e.isUniform(6))
-        self.assertTrue(f.isUniform(6))
-        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.
-        self.assertTrue(f.isIdentity())
-        self.assertTrue(e.isIdentity())
-        del a # a destroyed, but as c has its base set to a, a exists -> e and f not allocated
-        self.assertTrue(f.isIdentity())
-        self.assertTrue(e.isIdentity())
-        del c # c killed -> a killed -> e and d are put into not allocated state
-        self.assertTrue(not e.isAllocated())
-        self.assertTrue(not f.isAllocated())
-        pass
-
-    @unittest.skipUnless(MEDCouplingHasNumpyBindings(),"requires numpy")
-    def test8(self):
-        a=arange(20,dtype=int32)
-        self.assertTrue(a.flags["OWNDATA"])
-        d=DataArrayInt(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(DataArrayInt([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20])))
-        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 test9(self):
-        sz=20
-        a=array(0,dtype=float64)
-        a.resize(sz)
-        a[:]=4
-        self.assertEqual(getrefcount(a),2)
-        a=a.cumsum(dtype=float64)
-        self.assertEqual(getrefcount(a),2)
-        d=DataArrayDouble(a)
-        d[:]=2
-        #
-        e=DataArrayDouble(sz) ; e.fillWithValue(2)
-        self.assertTrue(d.isEqual(e,1e-14))
-        #
-        a[:]=4 ; e.fillWithValue(4)
-        self.assertTrue(d.isEqual(e,1e-14))
-        pass
-    
-    @unittest.skipUnless(MEDCouplingHasNumpyBindings(),"requires numpy")
-    def test10(self):
-        sz=20
-        a=array(0,dtype=float64)
-        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=DataArrayDouble(b)
-        #
-        e=DataArrayDouble(sz*2) ; e.fillWithValue(5)
-        self.assertTrue(d.isEqual(e,1e-14))
-        pass
-    
-    @unittest.skipUnless(MEDCouplingHasNumpyBindings(),"requires numpy")
-    def test11(self):
-        sz=10
-        a=array(0,dtype=float64)
-        a.resize(sz,2)
-        b=a.reshape(2*sz)
-        c=a.reshape(2,sz)
-        b[:]=6
-        b[7:17]=7
-        d=DataArrayDouble(b)
-        self.assertTrue(d.isEqual(DataArrayDouble([6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,6,6,6]),1e-14))
-        #
-        a=zeros((10,2),dtype=float64)
-        b=a.T
-        c=b.view()
-        a.shape=20
-        a[3:]=10.
-        d=DataArrayDouble(a)
-        self.assertTrue(d.isEqual(DataArrayDouble([0,0,0,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10]),1e-14))
-        pass
-    
-    @unittest.skipUnless(MEDCouplingHasNumpyBindings(),"requires numpy")
-    def test12(self):
-        a=zeros(20,dtype=float64)
-        b = a[::-1]
-        self.assertRaises(InterpKernelException,DataArrayDouble.New,b) # b is not contiguous in memory
-        pass
-    
-    @unittest.skipUnless(MEDCouplingHasNumpyBindings(),"requires numpy")
-    def test13(self):
-        a=arange(20,dtype=float64)
-        self.assertEqual(weakref.getweakrefcount(a),0)
-        d=DataArrayDouble(a)
-        self.assertEqual(weakref.getweakrefcount(a),1)
-        self.assertTrue(not a.flags["OWNDATA"])
-        self.assertTrue(d.isEqual(DataArrayDouble([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]),1e-14))
-        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-14))
-        del d # d is destroyed, a retrieves its ownership of its initial chunk of data
-        self.assertTrue(a.flags["OWNDATA"])
-        a[:]=4 # a can be used has usual
-        self.assertTrue(DataArrayDouble(a).isUniform(4,1e-14))
-        pass
-    
-    @unittest.skipUnless(MEDCouplingHasNumpyBindings(),"requires numpy")
-    def test14(self):
-        a=arange(20,dtype=float64)
-        d=DataArrayDouble(a) # d owns data of a
-        e=DataArrayDouble(a) # a not owned -> e only an access to chunk of a 
-        self.assertTrue(d.isEqual(DataArrayDouble([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]),1e-14))
-        self.assertTrue(e.isEqual(DataArrayDouble([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]),1e-14))
-        a[:]=6
-        self.assertTrue(d.isUniform(6,1e-14))
-        self.assertTrue(e.isUniform(6,1e-14))
-        del a # a destroyed -> d no change because owned and e array is has no more data set
-        self.assertTrue(d.isUniform(6,1e-14))
-        self.assertTrue(not e.isAllocated())
-        pass
-
-    @unittest.skipUnless(MEDCouplingHasNumpyBindings(),"requires numpy")
-    def test15(self):
-        a=array(0,dtype=float64) ; a.resize(10,2)
-        b=a.reshape(20)
-        c=a.reshape(2,10)
-        d=DataArrayDouble(b) # d owns data of a
-        e=DataArrayDouble(b) # a not owned -> e only an access to chunk of a
-        f=DataArrayDouble(b) # a not owned -> e only an access to chunk of a
-        del d # d removed -> a ownes again data
-        self.assertTrue(e.isUniform(0,1e-14))
-        e[:]=6
-        self.assertTrue(e.isUniform(6,1e-14))
-        self.assertTrue(f.isUniform(6,1e-14))
-        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.
-        self.assertTrue(f.isEqual(DataArrayDouble([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]),1e-14))
-        self.assertTrue(e.isEqual(DataArrayDouble([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]),1e-14))
-        del a # a destroyed, but as c has its base set to a, a exists -> e and f not allocated
-        self.assertTrue(f.isEqual(DataArrayDouble([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]),1e-14))
-        self.assertTrue(e.isEqual(DataArrayDouble([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]),1e-14))
-        del c # c killed -> a killed -> e and d are put into not allocated state
-        self.assertTrue(not e.isAllocated())
-        self.assertTrue(not f.isAllocated())
-        pass
-
-    @unittest.skipUnless(MEDCouplingHasNumpyBindings(),"requires numpy")
-    def test16(self):
-        a=arange(20,dtype=float64)
-        self.assertTrue(a.flags["OWNDATA"])
-        d=DataArrayDouble(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(DataArrayDouble([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]),1e-14))
-        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 test17(self):
-        d=DataArrayInt.Range(0,20,1)
-        d.rearrange(10)
-        self.assertRaises(InterpKernelException,d.toNumPyArray)# forbidden one or two components of d is accepted
-        d.rearrange(1)
-        a=d.toNumPyArray()
-        self.assertTrue(not a.flags["OWNDATA"])
-        a[-2:]=100
-        self.assertTrue(d.isEqual(DataArrayInt([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,100,100])))
-        self.assertEqual(a.tolist(),[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,100,100])
-        del a
-        self.assertTrue(d.isEqual(DataArrayInt([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,100,100])))
-        #
-        d.rearrange(2)
-        a=d.toNumPyArray()
-        self.assertTrue(not a.flags["OWNDATA"])
-        a[-2:]=200
-        self.assertTrue(d.isEqual(DataArrayInt([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,200,200,200,200],10,2)))
-        self.assertEqual(a.tolist(),[[0,1],[2,3],[4,5],[6,7],[8,9],[10,11],[12,13],[14,15],[200,200],[200,200]])
-        del a
-        self.assertTrue(d.isEqual(DataArrayInt([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,200,200,200,200],10,2)))
-        pass
-
-    @unittest.skipUnless(MEDCouplingHasNumpyBindings(),"requires numpy")
-    def test18(self):
-        d=DataArrayInt.Range(0,20,1)
-        d=d.convertToDblArr()
-        d.rearrange(10)
-        self.assertRaises(InterpKernelException,d.toNumPyArray)# forbidden one or two components of d is accepted
-        d.rearrange(1)
-        a=d.toNumPyArray()
-        self.assertTrue(not a.flags["OWNDATA"])
-        a[-2:]=100
-        self.assertTrue(d.isEqual(DataArrayDouble([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,100,100]),1e-14))
-        self.assertEqual(a.tolist(),[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,100,100])
-        del a
-        self.assertTrue(d.isEqual(DataArrayDouble([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,100,100]),1e-14))
-        #
-        d.rearrange(2)
-        a=d.toNumPyArray()
-        self.assertTrue(not a.flags["OWNDATA"])
-        a[-2:]=200
-        self.assertTrue(d.isEqual(DataArrayDouble([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,200,200,200,200],10,2),1e-14))
-        self.assertEqual(a.tolist(),[[0,1],[2,3],[4,5],[6,7],[8,9],[10,11],[12,13],[14,15],[200,200],[200,200]])
-        del a
-        self.assertTrue(d.isEqual(DataArrayDouble([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,200,200,200,200],10,2),1e-14))
-        pass
-
-    def setUp(self):
-        pass
-    pass
-
-#gc.set_debug(gc.DEBUG_LEAK)
-unittest.main()
index fe655d9aae65c5fe65e7f513239ed797a5590625..60c3c86af69ddb4b3a623b008cebaca292c909a6 100644 (file)
@@ -22,6 +22,9 @@
 #ifdef WITH_NUMPY
 #include <numpy/arrayobject.h>
 
+// 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;
@@ -40,6 +43,7 @@ void numarrdeal(void *pt, void *wron)
       typedef void (*MyDeallocator)(void *,void *);
       MyDeallocator deall=(MyDeallocator)wronc[1];
       deall(pt,NULL);
+      Py_XDECREF(weakRefOnOwner);
     }
   delete [] wronc;
 }
@@ -74,6 +78,8 @@ extern "C"
     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 *callbackmcdataarrayint_call(PyCallBackDataArrayInt *self, PyObject *args, PyObject *kw)
   {
     if(self->_pt_mc)
@@ -84,7 +90,9 @@ extern "C"
     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)
@@ -181,6 +189,8 @@ PyTypeObject PyCallBackDataArrayDouble_RefType = {
   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>
 void numarrdeal2(void *pt, void *obj)
 {
@@ -198,23 +208,33 @@ template<class MCData, class T>
 MCData *BuildNewInstance(PyObject *elt0, int npyObjectType, PyTypeObject *pytype, const char *msg)
 {
   int ndim=PyArray_NDIM(elt0);
-  if(ndim!=1)
-    throw INTERP_KERNEL::Exception("Input numpy array has not 1 dimension !");//to do 1 or 2.
+  if(ndim!=1 && ndim!=2)
+    throw INTERP_KERNEL::Exception("Input numpy array should have dimension equal to 1 or 2 !");
   if(PyArray_ObjectType(elt0,0)!=npyObjectType)
     {
-      std::ostringstream oss; oss << "Input numpy array has not of type " << msg << " !";
-      throw INTERP_KERNEL::Exception(oss.str().c_str());//to do 1 or 2.
+      std::ostringstream oss; oss << "Input numpy array has not of type " << msg << " at component #0 !";
+      throw INTERP_KERNEL::Exception(oss.str().c_str());
     }
-  npy_intp stride=PyArray_STRIDE(elt0,0);
+  if(ndim==2)
+    if(PyArray_ObjectType(elt0,1)!=npyObjectType)
+      {
+        std::ostringstream oss; oss << "Input numpy array has not of type " << msg << " at component #1 !";
+        throw INTERP_KERNEL::Exception(oss.str().c_str());
+      }
+  npy_intp sz0=PyArray_DIM(elt0,0);
+  npy_intp sz1=ndim==2?PyArray_DIM(elt0,1):1;
+  //
   int itemSize=PyArray_ITEMSIZE(elt0);
-  if(itemSize<stride)
-    throw INTERP_KERNEL::Exception("Input numpy array has item size < stride !");
-  if(stride!=sizeof(T))
+  if(itemSize!=sizeof(T))
     {
-      std::ostringstream oss; oss << "Input numpy array has not stride set to " << sizeof(T) << " !";
+      std::ostringstream oss; oss << "Input numpy array has not itemSize set to " << sizeof(T) << " !";
       throw INTERP_KERNEL::Exception(oss.str().c_str());
     }
-  npy_intp sz=PyArray_DIM(elt0,0);
+  if(itemSize*sz1!=PyArray_STRIDE(elt0,0))
+    throw INTERP_KERNEL::Exception("Input numpy array has stride that mismatches the item size ! Data are not packed in the right way for DataArrays !");
+  if(ndim==2)
+    if(itemSize!=PyArray_STRIDE(elt0,1))
+      throw INTERP_KERNEL::Exception("Input numpy array has stride that mismatches the item size ! Data are not packed in the right way for DataArrays for component #1 !");
   const char *data=PyArray_BYTES(elt0);
   typename ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr<MCData> ret=MCData::New();
   if(PyArray_ISBEHAVED(elt0))//aligned and writeable and in machine byte-order
@@ -244,7 +264,7 @@ MCData *BuildNewInstance(PyObject *elt0, int npyObjectType, PyTypeObject *pytype
         {
           PyCallBackDataArraySt<MCData> *cb=PyObject_GC_New(PyCallBackDataArraySt<MCData>,pytype);
           cb->_pt_mc=ret;
-          ret->useArray(reinterpret_cast<const T *>(data),true,ParaMEDMEM::C_DEALLOC,sz,1);
+          ret->useArray(reinterpret_cast<const T *>(data),true,ParaMEDMEM::C_DEALLOC,sz0,sz1);
           PyObject *ref=PyWeakref_NewRef(deepestObj,(PyObject *)cb);
           void **objs=new void *[2]; objs[0]=cb; objs[1]=ref;
           mma.setParameterForDeallocator(objs);
@@ -253,7 +273,7 @@ MCData *BuildNewInstance(PyObject *elt0, int npyObjectType, PyTypeObject *pytype
         }
       else
         {
-          ret->useArray(reinterpret_cast<const T *>(data),true,ParaMEDMEM::C_DEALLOC,sz,1);
+          ret->useArray(reinterpret_cast<const T *>(data),true,ParaMEDMEM::C_DEALLOC,sz0,sz1);
           PyObject *ref=PyWeakref_NewRef(reinterpret_cast<PyObject *>(eltOwning),NULL);
           void **objs=new void *[2]; objs[0]=ref; objs[1]=(void*) ParaMEDMEM::MemArray<T>::CDeallocator;
           mma.setParameterForDeallocator(objs);
@@ -261,10 +281,79 @@ MCData *BuildNewInstance(PyObject *elt0, int npyObjectType, PyTypeObject *pytype
         }
     }
   else if(PyArray_ISBEHAVED_RO(elt0))
-    ret->useArray(reinterpret_cast<const T *>(data),false,ParaMEDMEM::CPP_DEALLOC,sz,1);
+    ret->useArray(reinterpret_cast<const T *>(data),false,ParaMEDMEM::CPP_DEALLOC,sz0,sz1);
   return ret.retn();
 }
 
+
+int NumpyArrSetBaseObjectExt(PyArrayObject *arr, PyObject *obj)
+{
+    if (obj == NULL) {
+        PyErr_SetString(PyExc_ValueError,
+                "Cannot set the NumPy array 'base' "
+                "dependency to NULL after initialization");
+        return -1;
+    }
+    /*
+     * Allow the base to be set only once. Once the object which
+     * owns the data is set, it doesn't make sense to change it.
+     */
+    if (PyArray_BASE(arr) != NULL) {
+        Py_DECREF(obj);
+        PyErr_SetString(PyExc_ValueError,
+                "Cannot set the NumPy array 'base' "
+                "dependency more than once");
+        return -1;
+    }
+
+    /*
+     * Don't allow infinite chains of views, always set the base
+     * to the first owner of the data.  
+     * That is, either the first object which isn't an array, 
+     * or the first object which owns its own data.
+     */
+
+    while (PyArray_Check(obj) && (PyObject *)arr != obj) {
+        PyArrayObject *obj_arr = (PyArrayObject *)obj;
+        PyObject *tmp;
+
+        /* If this array owns its own data, stop collapsing */
+        if (PyArray_CHKFLAGS(obj_arr, NPY_OWNDATA)) {
+            break;
+        }   
+
+        tmp = PyArray_BASE(obj_arr);
+        /* If there's no base, stop collapsing */
+        if (tmp == NULL) {
+            break;
+        }
+        /* Stop the collapse new base when the would not be of the same 
+         * type (i.e. different subclass).
+         */
+        if (Py_TYPE(tmp) != Py_TYPE(arr)) {
+            break;
+        }
+
+
+        Py_INCREF(tmp);
+        Py_DECREF(obj);
+        obj = tmp;
+    }
+
+    /* Disallow circular references */
+    if ((PyObject *)arr == obj) {
+        Py_DECREF(obj);
+        PyErr_SetString(PyExc_ValueError,
+                "Cannot create a circular NumPy array 'base' dependency");
+        return -1;
+    }
+
+    arr->base = obj;
+
+    return 0;
+}
+
 template<class MCData, class T>
 PyObject *ToNumPyArray(MCData *self, int npyObjectType, const char *MCDataStr)
 {
@@ -275,32 +364,43 @@ PyObject *ToNumPyArray(MCData *self, int npyObjectType, const char *MCDataStr)
     }
   ParaMEDMEM::MemArray<T>& mem=self->accessToMemArray();
   int nbComp=self->getNumberOfComponents();
-  if(nbComp!=1 && nbComp!=2)
+  if(nbComp==0)
     {
-      std::ostringstream oss; oss << MCDataStr << "::toNumPyArray : number of components of this is " << nbComp << " ! Should 1 or 2 !"; 
+      std::ostringstream oss; oss << MCDataStr << "::toNumPyArray : number of components of this is 0 ! Should be > 0 !"; 
       throw INTERP_KERNEL::Exception(oss.str().c_str());
     }
-  std::size_t sz=self->getNbOfElems();
+  int nbDims=nbComp==1?1:2;
   npy_intp dim[2];
-  dim[0]=(npy_intp)self->getNumberOfTuples(); dim[1]=2;
+  dim[0]=(npy_intp)self->getNumberOfTuples(); dim[1]=nbComp;
   const T *bg=self->getConstPointer();
-  PyObject *ret=PyArray_SimpleNewFromData(nbComp,dim,npyObjectType,const_cast<T *>(bg));
+  PyObject *ret=PyArray_SimpleNewFromData(nbDims,dim,npyObjectType,const_cast<T *>(bg));
   if(mem.isDeallocatorCalled())
     {
-      if(mem.getDeallocator()!=ParaMEDMEM::MemArray<T>::CDeallocator)
-        {
-          int mask=NPY_OWNDATA; mask=~mask;
-          (reinterpret_cast<PyArrayObject *>(ret))->flags&=mask;
-          return ret;
-        }
-      else
-        {
+      if(mem.getDeallocator()!=numarrdeal)
+        {// case for the first call of toNumPyArray
           PyObject *ref=PyWeakref_NewRef(ret,NULL);
-          void **objs=new void *[2]; objs[0]=ref; objs[1]=(void*) ParaMEDMEM::MemArray<T>::CDeallocator;
+          void **objs=new void *[2]; objs[0]=ref; objs[1]=(void*) mem.getDeallocator();
           mem.setParameterForDeallocator(objs);
           mem.setSpecificDeallocator(numarrdeal);
           return ret;
         }
+      else
+        {// case for the second and other call of toNumPyArray
+          void **objs=(void **)mem.getParameterForDeallocator();
+          PyObject *weakRefOnOwner=(PyObject *)objs[0];
+          PyObject *obj=PyWeakref_GetObject(weakRefOnOwner);
+          if(obj!=Py_None)
+            {//the previous numArray exists let numpy deals the numpy array each other by declaring the still alive instance as base
+              Py_XINCREF(obj);
+              NumpyArrSetBaseObjectExt((PyArrayObject*)ret,obj);
+            }
+          else
+            {//the previous numArray no more exists -> declare the newly created numpy array as the first one.
+              Py_XDECREF(weakRefOnOwner);
+              PyObject *ref=PyWeakref_NewRef(ret,NULL);
+              objs[0]=ref;
+            }
+        }
     }
   return ret;
 }
@@ -310,6 +410,11 @@ PyObject *ToNumPyArray(MCData *self, int npyObjectType, const char *MCDataStr)
 static PyObject *convertMesh(ParaMEDMEM::MEDCouplingMesh *mesh, int owner) throw(INTERP_KERNEL::Exception)
 {
   PyObject *ret=0;
+  if(!mesh)
+    {
+      Py_XINCREF(Py_None);
+      return Py_None;
+    }
   if(dynamic_cast<ParaMEDMEM::MEDCouplingUMesh *>(mesh))
     ret=SWIG_NewPointerObj((void*)mesh,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,owner);
   if(dynamic_cast<ParaMEDMEM::MEDCouplingExtrudedMesh *>(mesh))
@@ -326,6 +431,11 @@ static PyObject *convertMesh(ParaMEDMEM::MEDCouplingMesh *mesh, int owner) throw
 static PyObject *convertFieldDiscretization(ParaMEDMEM::MEDCouplingFieldDiscretization *fd, int owner) throw(INTERP_KERNEL::Exception)
 {
   PyObject *ret=0;
+  if(!fd)
+    {
+      Py_XINCREF(Py_None);
+      return Py_None;
+    }
   if(dynamic_cast<ParaMEDMEM::MEDCouplingFieldDiscretizationP0 *>(fd))
     ret=SWIG_NewPointerObj(reinterpret_cast<void*>(fd),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDiscretizationP0,owner);
   if(dynamic_cast<ParaMEDMEM::MEDCouplingFieldDiscretizationP1 *>(fd))
@@ -344,6 +454,11 @@ static PyObject *convertFieldDiscretization(ParaMEDMEM::MEDCouplingFieldDiscreti
 static PyObject *convertDataArrayChar(ParaMEDMEM::DataArrayChar *dac, int owner) throw(INTERP_KERNEL::Exception)
 {
   PyObject *ret=0;
+  if(!dac)
+    {
+      Py_XINCREF(Py_None);
+      return Py_None;
+    }
   if(dynamic_cast<ParaMEDMEM::DataArrayByte *>(dac))
     ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_ParaMEDMEM__DataArrayByte,owner);
   if(dynamic_cast<ParaMEDMEM::DataArrayAsciiChar *>(dac))
@@ -353,9 +468,35 @@ static PyObject *convertDataArrayChar(ParaMEDMEM::DataArrayChar *dac, int owner)
   return ret;
 }
 
+static PyObject *convertDataArray(ParaMEDMEM::DataArray *dac, int owner) throw(INTERP_KERNEL::Exception)
+{
+  PyObject *ret=0;
+  if(!dac)
+    {
+      Py_XINCREF(Py_None);
+      return Py_None;
+    }
+  if(dynamic_cast<ParaMEDMEM::DataArrayDouble *>(dac))
+    ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,owner);
+  if(dynamic_cast<ParaMEDMEM::DataArrayInt *>(dac))
+    ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,owner);
+  if(dynamic_cast<ParaMEDMEM::DataArrayByte *>(dac))
+    ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_ParaMEDMEM__DataArrayByte,owner);
+  if(dynamic_cast<ParaMEDMEM::DataArrayAsciiChar *>(dac))
+    ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiChar,owner);
+  if(!ret)
+    throw INTERP_KERNEL::Exception("Not recognized type of DataArray on downcast !");
+  return ret;
+}
+
 static PyObject* convertMultiFields(ParaMEDMEM::MEDCouplingMultiFields *mfs, int owner) throw(INTERP_KERNEL::Exception)
 {
   PyObject *ret=0;
+  if(!mfs)
+    {
+      Py_XINCREF(Py_None);
+      return Py_None;
+    }
   if(dynamic_cast<ParaMEDMEM::MEDCouplingFieldOverTime *>(mfs))
     ret=SWIG_NewPointerObj((void*)mfs,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldOverTime,owner);
   else
@@ -814,7 +955,7 @@ static double *convertPyToNewDblArr2(PyObject *pyLi, int *size) throw(INTERP_KER
   if(PyList_Check(pyLi))
     {
       *size=PyList_Size(pyLi);
-      double *tmp=new double[*size];
+      double *tmp=(double *)malloc((*size)*sizeof(double));
       for(int i=0;i<*size;i++)
         {
           PyObject *o=PyList_GetItem(pyLi,i);
@@ -831,7 +972,7 @@ static double *convertPyToNewDblArr2(PyObject *pyLi, int *size) throw(INTERP_KER
             }
           else
             {
-              delete [] tmp;
+              free(tmp);
               throw INTERP_KERNEL::Exception("convertPyToNewDblArr2 : list must contain floats/integers only");
             }
         }
@@ -840,7 +981,7 @@ static double *convertPyToNewDblArr2(PyObject *pyLi, int *size) throw(INTERP_KER
   else if(PyTuple_Check(pyLi))
     {
       *size=PyTuple_Size(pyLi);
-      double *tmp=new double[*size];
+      double *tmp=(double *)malloc((*size)*sizeof(double));
       for(int i=0;i<*size;i++)
         {
           PyObject *o=PyTuple_GetItem(pyLi,i);
@@ -857,7 +998,7 @@ static double *convertPyToNewDblArr2(PyObject *pyLi, int *size) throw(INTERP_KER
             }
           else
             {
-              delete [] tmp;
+              free(tmp);
               throw INTERP_KERNEL::Exception("convertPyToNewDblArr2 : tuple must contain floats/integers only");
             }
         }
@@ -2360,3 +2501,28 @@ ParaMEDMEM::MEDCouplingFieldDouble *ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Im
       { throw INTERP_KERNEL::Exception(msg); }
     }
 }
+
+static ParaMEDMEM::DataArray *CheckAndRetrieveDataArrayInstance(PyObject *obj, const char *msg)
+{
+  void *aBasePtrVS=0;
+  int status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_ParaMEDMEM__DataArray,0|0);
+  if(!SWIG_IsOK(status))
+    {
+      status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,0|0);
+      if(!SWIG_IsOK(status))
+        {
+          status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
+          if(!SWIG_IsOK(status))
+            {
+              status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiChar,0|0);
+              if(!SWIG_IsOK(status))
+                {
+                  status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_ParaMEDMEM__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< ParaMEDMEM::DataArray * >(aBasePtrVS);
+}
index bc06eea2577dec60f9e99f252101eb58fea78a9c..32cb8eadab7bde0d057f5491abf0e8f1577eb8fb 100644 (file)
@@ -58,7 +58,7 @@ _MEDCouplingRemapper_la_LDFLAGS  = -module $(PYTHON_LIBS) \
 
 CLEANFILES = MEDCouplingWRAP.cxx MEDCoupling.py MEDCouplingRemapperWRAP.cxx MEDCouplingRemapper.py
 
-dist_salomescript_DATA= MEDCouplingBasicsTest.py MEDCouplingRemapperTest.py MEDCoupling.py MEDCouplingRemapper.py MEDCouplingDataForTest.py MEDCouplingNumpyTest.py libMEDCoupling_Swig.py
+dist_salomescript_DATA= MEDCouplingBasicsTest.py MEDCouplingRemapperTest.py MEDCoupling.py MEDCouplingRemapper.py MEDCouplingDataForTest.py MEDCouplingNumPyTest.py libMEDCoupling_Swig.py
 
 UNIT_TEST_PROG = MEDCouplingBasicsTest.py MEDCouplingRemapperTest.py
 
index 7c9eaa4eaee804ea3c429796969ba8d686adbc48..8666e2b552364dcbc2e888de60186157dad11939 100644 (file)
@@ -19,7 +19,9 @@
 # Author : Anthony Geay (CEA/DEN)
 
 ADD_SUBDIRECTORY(Swig)
-ADD_SUBDIRECTORY(Test)
+IF(CPPUNIT_STATUS)
+  ADD_SUBDIRECTORY(Test)
+ENDIF(CPPUNIT_STATUS)
 
 INCLUDE_DIRECTORIES(
   ${MED3_INCLUDE_DIRS}
index c6919ac40dd1db6e31a218369dfc8b90ad92716e..8dc033c545c066925b56aa53ac97e25ed8ac3e6b 100644 (file)
@@ -147,7 +147,7 @@ std::string MEDFileData::simpleRepr() const
       tmp3->simpleReprWithoutHeader(oss);
     }
   else
-    oss << "params set !!!\n";
+    oss << "No params set !!!\n";
   return oss.str();
 }
 
index cc9e3fe602fafb922f1683ed5fbdb286b722b74a..59095800406c2099a3abb9ddc245f635bc27f3f2 100644 (file)
@@ -39,6 +39,9 @@ extern med_geometry_type typmai3[32];
 
 using namespace ParaMEDMEM;
 
+const char MEDFileField1TSWithoutSDA::TYPE_STR[]="FLOAT64";
+const char MEDFileIntField1TSWithoutSDA::TYPE_STR[]="INT32";
+
 MEDFileFieldLoc *MEDFileFieldLoc::New(med_idt fid, const char *locName)
 {
   return new MEDFileFieldLoc(fid,locName);
@@ -196,16 +199,15 @@ std::string MEDFileFieldLoc::repr() const
   return oss.str();
 }
 
-void MEDFileFieldPerMeshPerTypePerDisc::assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldDouble *field, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
+void MEDFileFieldPerMeshPerTypePerDisc::assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldDouble *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception)
 {
   _type=field->getTypeOfField();
-  const DataArrayDouble *da=field->getArray();
   _start=start;
   switch(_type)
     {
     case ON_CELLS:
       {
-        getArray()->setContigPartOfSelectedValues2(_start,da,offset,offset+nbOfCells,1);
+        getArray()->setContigPartOfSelectedValues2(_start,arrr,offset,offset+nbOfCells,1);
         _end=_start+nbOfCells;
         _nval=nbOfCells;
         break;
@@ -214,7 +216,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldNoProfile(int& start, int off
       {
         MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr=field->getDiscretization()->getOffsetArr(field->getMesh());
         const int *arrPtr=arr->getConstPointer();
-        getArray()->setContigPartOfSelectedValues2(_start,da,arrPtr[offset],arrPtr[offset+nbOfCells],1);
+        getArray()->setContigPartOfSelectedValues2(_start,arrr,arrPtr[offset],arrPtr[offset+nbOfCells],1);
         _end=_start+(arrPtr[offset+nbOfCells]-arrPtr[offset]);
         _nval=nbOfCells;
         break;
@@ -235,7 +237,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldNoProfile(int& start, int off
         const int *da3Ptr=da3->getConstPointer();
         if(da3->getNumberOfTuples()!=nbOfCells)
           {//profile : for gauss even in NoProfile !!!
-            std::ostringstream oss; oss << "Pfl_" << getName() << "_" << INTERP_KERNEL::CellModel::GetCellModel(getGeoType()).getRepr() << "_" << _loc_id;
+            std::ostringstream oss; oss << "Pfl_" << nasc.getName() << "_" << INTERP_KERNEL::CellModel::GetCellModel(getGeoType()).getRepr() << "_" << _loc_id;
             _profile=oss.str();
             da3->setName(_profile.c_str());
             glob.appendProfile(da3);
@@ -250,9 +252,9 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldNoProfile(int& start, int off
             for(int j=0;j<nbi;j++)
               *da4Ptr++=ref+j;
           }
-        std::ostringstream oss2; oss2 << "Loc_" << getName() << "_" << INTERP_KERNEL::CellModel::GetCellModel(getGeoType()).getRepr() << "_" << _loc_id;
+        std::ostringstream oss2; oss2 << "Loc_" << nasc.getName() << "_" << INTERP_KERNEL::CellModel::GetCellModel(getGeoType()).getRepr() << "_" << _loc_id;
         _localization=oss2.str();
-        getArray()->setContigPartOfSelectedValues(_start,da,da4);
+        getArray()->setContigPartOfSelectedValues(_start,arrr,da4);
         _end=_start+_nval*nbi;
         glob.appendLoc(_localization.c_str(),getGeoType(),gsLoc.getRefCoords(),gsLoc.getGaussCoords(),gsLoc.getWeights());
         break;
@@ -272,7 +274,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(int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldDouble *field, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
+void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(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) throw(INTERP_KERNEL::Exception)
 {
   _profile.clear();
   _type=field->getTypeOfField();
@@ -290,21 +292,20 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(int& start, const Dat
           _profile=oss.str();
         }
     }
-  const DataArrayDouble *da=field->getArray();
   _start=start;
   switch(_type)
     {
     case ON_NODES:
       {
          _nval=idsInPfl->getNumberOfTuples();
-         getArray()->setContigPartOfSelectedValues2(_start,da,0,da->getNumberOfTuples(),1);
+         getArray()->setContigPartOfSelectedValues2(_start,arrr,0,arrr->getNumberOfTuples(),1);
          _end=_start+_nval;
          break;
       }
     case ON_CELLS:
       {
         _nval=idsInPfl->getNumberOfTuples();
-        getArray()->setContigPartOfSelectedValues(_start,da,idsInPfl);
+        getArray()->setContigPartOfSelectedValues(_start,arrr,idsInPfl);
         _end=_start+_nval;
         break;
       }
@@ -317,7 +318,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(int& start, const Dat
         MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp=idsInPfl->buildExplicitArrByRanges(arr3);
         int trueNval=tmp->getNumberOfTuples();
         _nval=idsInPfl->getNumberOfTuples();
-        getArray()->setContigPartOfSelectedValues(_start,da,tmp);
+        getArray()->setContigPartOfSelectedValues(_start,arrr,tmp);
         _end=_start+trueNval;
         break;
       }
@@ -346,7 +347,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(int& start, const Dat
             *tmpPtr++=j;
         //
         _nval=da4->getNumberOfTuples();
-        getArray()->setContigPartOfSelectedValues(_start,da,tmp);
+        getArray()->setContigPartOfSelectedValues(_start,arrr,tmp);
         _end=_start+trueNval;
         oss << "_loc_" << _loc_id;
         if(locIds)
@@ -365,7 +366,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(int& start, const Dat
                 _profile=oss.str();
               }
           }
-        std::ostringstream oss2; oss2 << "Loc_" << getName() << "_" << INTERP_KERNEL::CellModel::GetCellModel(getGeoType()).getRepr() << "_" << _loc_id;
+        std::ostringstream oss2; oss2 << "Loc_" << nasc.getName() << "_" << INTERP_KERNEL::CellModel::GetCellModel(getGeoType()).getRepr() << "_" << _loc_id;
         _localization=oss2.str();
         glob.appendLoc(_localization.c_str(),getGeoType(),gsLoc.getRefCoords(),gsLoc.getGaussCoords(),gsLoc.getWeights());
         break;
@@ -376,11 +377,11 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(int& start, const Dat
   start=_end;
 }
 
-void MEDFileFieldPerMeshPerTypePerDisc::assignNodeFieldNoProfile(int& start, const MEDCouplingFieldDouble *field, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
+void MEDFileFieldPerMeshPerTypePerDisc::assignNodeFieldNoProfile(int& start, const MEDCouplingFieldDouble *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
 {
   _start=start;
-  _nval=field->getArray()->getNumberOfTuples();
-  getArray()->setContigPartOfSelectedValues2(_start,field->getArray(),0,_nval,1);
+  _nval=arrr->getNumberOfTuples();
+  getArray()->setContigPartOfSelectedValues2(_start,arrr,0,_nval,1);
   _end=_start+_nval;
   start=_end;
 }
@@ -439,11 +440,11 @@ const MEDFileFieldPerMeshPerType *MEDFileFieldPerMeshPerTypePerDisc::getFather()
   return _father;
 }
 
-void MEDFileFieldPerMeshPerTypePerDisc::prepareLoading(med_idt fid, int profileIt, int& start) throw(INTERP_KERNEL::Exception)
+void MEDFileFieldPerMeshPerTypePerDisc::prepareLoading(med_idt fid, int profileIt, int& start, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception)
 {
   INTERP_KERNEL::AutoPtr<char> locname=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
   INTERP_KERNEL::AutoPtr<char> pflname=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
-  std::string fieldName=getName();
+  std::string fieldName=nasc.getName();
   std::string meshName=getMeshName();
   int iteration=getIteration();
   int order=getOrder();
@@ -471,9 +472,9 @@ void MEDFileFieldPerMeshPerTypePerDisc::prepareLoading(med_idt fid, int profileI
     }
 }
 
-void MEDFileFieldPerMeshPerTypePerDisc::finishLoading(med_idt fid, int profileIt, int ft) throw(INTERP_KERNEL::Exception)
+void MEDFileFieldPerMeshPerTypePerDisc::finishLoading(med_idt fid, int profileIt, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception)
 {
-  std::string fieldName=getName();
+  std::string fieldName=nasc.getName();
   std::string meshName=getMeshName();
   int iteration=getIteration();
   int order=getOrder();
@@ -481,27 +482,24 @@ void MEDFileFieldPerMeshPerTypePerDisc::finishLoading(med_idt fid, int profileIt
   INTERP_KERNEL::NormalizedCellType geoType=getGeoType();
   med_geometry_type mgeoti;
   med_entity_type menti=MEDFileFieldPerMeshPerType::ConvertIntoMEDFileType(type,geoType,mgeoti);
-  DataArrayDouble *arr=getArray();
-  double *startFeeding=arr->getPointer()+_start*arr->getNumberOfComponents();
-  switch(ft)
+  DataArray *arr=getArray();
+  DataArrayDouble *arrD=dynamic_cast<DataArrayDouble *>(arr);
+  if(arrD)
     {
-    case 0:
-      {
-        MEDfieldValueWithProfileRd(fid,fieldName.c_str(),iteration,order,menti,mgeoti,MED_COMPACT_PFLMODE,
-                                   _profile.c_str(),MED_FULL_INTERLACE,MED_ALL_CONSTITUENT,reinterpret_cast<unsigned char*>(startFeeding));
-        break;
-      }
-    case 1:
-      {
-        INTERP_KERNEL::AutoPtr<int> tmpp=new int[(_end-_start)*arr->getNumberOfComponents()];
-        MEDfieldValueWithProfileRd(fid,fieldName.c_str(),iteration,order,menti,mgeoti,MED_COMPACT_PFLMODE,
-                                   _profile.c_str(),MED_FULL_INTERLACE,MED_ALL_CONSTITUENT,reinterpret_cast<unsigned char*>((int *)tmpp));
-        std::copy((const int *)tmpp,(const int *)tmpp+(_end-_start)*arr->getNumberOfComponents(),startFeeding);
-        break;
-      }
-    default:
-      throw INTERP_KERNEL::Exception("Error on array reading ! Unrecognized type of field ! Should be in FLOAT64 or INT32 !");
+      double *startFeeding=arrD->getPointer()+_start*arrD->getNumberOfComponents();
+      MEDfieldValueWithProfileRd(fid,fieldName.c_str(),iteration,order,menti,mgeoti,MED_COMPACT_PFLMODE,
+                                 _profile.c_str(),MED_FULL_INTERLACE,MED_ALL_CONSTITUENT,reinterpret_cast<unsigned char*>(startFeeding));
+      return ;
+    }
+  DataArrayInt *arrI=dynamic_cast<DataArrayInt *>(arr);
+  if(arrI)
+    {
+      int *startFeeding=arrI->getPointer()+_start*arrI->getNumberOfComponents();
+      MEDfieldValueWithProfileRd(fid,fieldName.c_str(),iteration,order,menti,mgeoti,MED_COMPACT_PFLMODE,
+                                 _profile.c_str(),MED_FULL_INTERLACE,MED_ALL_CONSTITUENT,reinterpret_cast<unsigned char*>(startFeeding));
+      return ;
     }
+  throw INTERP_KERNEL::Exception("Error on array reading ! Unrecognized type of field ! Should be in FLOAT64 or INT32 !");
 }
 
 /*!
@@ -529,11 +527,6 @@ double MEDFileFieldPerMeshPerTypePerDisc::getTime() const
   return _father->getTime();
 }
 
-std::string MEDFileFieldPerMeshPerTypePerDisc::getName() const
-{
-  return _father->getName();
-}
-
 std::string MEDFileFieldPerMeshPerTypePerDisc::getMeshName() const
 {
   return _father->getMeshName();
@@ -583,17 +576,28 @@ int MEDFileFieldPerMeshPerTypePerDisc::getNumberOfTuples() const
   return _end-_start;
 }
 
-DataArrayDouble *MEDFileFieldPerMeshPerTypePerDisc::getArray()
+DataArray *MEDFileFieldPerMeshPerTypePerDisc::getArray()
 {
   return _father->getArray();
 }
 
-const DataArrayDouble *MEDFileFieldPerMeshPerTypePerDisc::getArray() const
+const DataArray *MEDFileFieldPerMeshPerTypePerDisc::getArray() const
 {
   const MEDFileFieldPerMeshPerType *fath=_father;
   return fath->getArray();
 }
 
+DataArrayDouble *MEDFileFieldPerMeshPerTypePerDisc::getArrayDouble()
+{
+  return _father->getArrayDouble();
+}
+
+const DataArrayDouble *MEDFileFieldPerMeshPerTypePerDisc::getArrayDouble() const
+{
+  const MEDFileFieldPerMeshPerType *fath=_father;
+  return fath->getArrayDouble();
+}
+
 const std::vector<std::string>& MEDFileFieldPerMeshPerTypePerDisc::getInfo() const
 {
   return _father->getInfo();
@@ -669,17 +673,27 @@ void MEDFileFieldPerMeshPerTypePerDisc::fillValues(int discId, int& startEntryId
   startEntryId++;
 }
 
-void MEDFileFieldPerMeshPerTypePerDisc::writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception)
+void MEDFileFieldPerMeshPerTypePerDisc::writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception)
 {
   TypeOfField type=getType();
   INTERP_KERNEL::NormalizedCellType geoType=getGeoType();
   med_geometry_type mgeoti;
   med_entity_type menti=MEDFileFieldPerMeshPerType::ConvertIntoMEDFileType(type,geoType,mgeoti);
-  const DataArrayDouble *arr=getArray();
-  const double *locToWrite=arr->getConstPointer()+_start*arr->getNumberOfComponents();
-  MEDfieldValueWithProfileWr(fid,getName().c_str(),getIteration(),getOrder(),getTime(),menti,mgeoti,
+  const DataArray *arr=getArray();
+  if(!arr)
+    throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::writeLL : no array set !");
+  const DataArrayDouble *arrD=dynamic_cast<const DataArrayDouble *>(arr);
+  const DataArrayInt *arrI=dynamic_cast<const DataArrayInt *>(arr);
+  const unsigned char *locToWrite=0;
+  if(arrD)
+    locToWrite=reinterpret_cast<const unsigned char *>(arrD->getConstPointer()+_start*arr->getNumberOfComponents());
+  else if(arrI)
+    locToWrite=reinterpret_cast<const unsigned char *>(arrI->getConstPointer()+_start*arr->getNumberOfComponents());
+  else
+    throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::writeLL : not recognized type of values ! Supported are FLOAT64 and INT32 !");
+  MEDfieldValueWithProfileWr(fid,nasc.getName().c_str(),getIteration(),getOrder(),getTime(),menti,mgeoti,
                              MED_COMPACT_PFLMODE,_profile.c_str(),_localization.c_str(),MED_FULL_INTERLACE,MED_ALL_CONSTITUENT,_nval,
-                             reinterpret_cast<const unsigned char*>(locToWrite));
+                             locToWrite);
 }
 
 void MEDFileFieldPerMeshPerTypePerDisc::getCoarseData(TypeOfField& type, std::pair<int,int>& dad, std::string& pfl, std::string& loc) const throw(INTERP_KERNEL::Exception)
@@ -931,9 +945,9 @@ MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::NewObjectO
   
 }
 
-MEDFileFieldPerMeshPerType *MEDFileFieldPerMeshPerType::NewOnRead(med_idt fid, MEDFileFieldPerMesh *fath, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType) throw(INTERP_KERNEL::Exception)
+MEDFileFieldPerMeshPerType *MEDFileFieldPerMeshPerType::NewOnRead(med_idt fid, MEDFileFieldPerMesh *fath, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception)
 {
-  return new MEDFileFieldPerMeshPerType(fid,fath,type,geoType);
+  return new MEDFileFieldPerMeshPerType(fid,fath,type,geoType,nasc);
 }
 
 MEDFileFieldPerMeshPerType *MEDFileFieldPerMeshPerType::New(MEDFileFieldPerMesh *fath, INTERP_KERNEL::NormalizedCellType geoType) throw(INTERP_KERNEL::Exception)
@@ -962,11 +976,11 @@ MEDFileFieldPerMeshPerType *MEDFileFieldPerMeshPerType::deepCpy(MEDFileFieldPerM
   return ret.retn();
 }
 
-void MEDFileFieldPerMeshPerType::assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldDouble *field, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
+void MEDFileFieldPerMeshPerType::assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception)
 {
   std::vector<int> pos=addNewEntryIfNecessary(field,offset,nbOfCells);
   for(std::vector<int>::const_iterator it=pos.begin();it!=pos.end();it++)
-    _field_pm_pt_pd[*it]->assignFieldNoProfile(start,offset,nbOfCells,field,glob);
+    _field_pm_pt_pd[*it]->assignFieldNoProfile(start,offset,nbOfCells,field,arr,glob,nasc);
 }
 
 /*!
@@ -978,27 +992,27 @@ void MEDFileFieldPerMeshPerType::assignFieldNoProfile(int& start, int offset, in
  * \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 MEDFileFieldPerMeshPerType::assignFieldProfile(int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldDouble *field, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
+void MEDFileFieldPerMeshPerType::assignFieldProfile(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) throw(INTERP_KERNEL::Exception)
 {
   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(start,multiTypePfl,idsInPfl,locIds,nbOfEltsInWholeMesh,field,mesh,glob);
+    _field_pm_pt_pd[*it]->assignFieldProfile(start,multiTypePfl,idsInPfl,locIds,nbOfEltsInWholeMesh,field,arr,mesh,glob,nasc);
 }
 
-void MEDFileFieldPerMeshPerType::assignNodeFieldNoProfile(int& start, const MEDCouplingFieldDouble *field, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
+void MEDFileFieldPerMeshPerType::assignNodeFieldNoProfile(int& start, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
 {
   _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,glob);
+  _field_pm_pt_pd[0]->assignNodeFieldNoProfile(start,field,arr,glob);
 }
 
-void MEDFileFieldPerMeshPerType::assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldDouble *field, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
+void MEDFileFieldPerMeshPerType::assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception)
 {
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> pfl2=pfl->deepCpy();
   //
   _field_pm_pt_pd.resize(1);
   _field_pm_pt_pd[0]=MEDFileFieldPerMeshPerTypePerDisc::New(this,ON_NODES,-3);
-  _field_pm_pt_pd[0]->assignFieldProfile(start,pfl,pfl2,pfl2,-1,field,0,glob);//mesh is not requested so 0 is send.
+  _field_pm_pt_pd[0]->assignFieldProfile(start,pfl,pfl2,pfl2,-1,field,arr,0,glob,nasc);//mesh is not requested so 0 is send.
 }
 
 std::vector<int> MEDFileFieldPerMeshPerType::addNewEntryIfNecessary(const MEDCouplingFieldDouble *field, int offset, int nbOfCells) throw(INTERP_KERNEL::Exception)
@@ -1190,11 +1204,6 @@ double MEDFileFieldPerMeshPerType::getTime() const
   return _father->getTime();
 }
 
-std::string MEDFileFieldPerMeshPerType::getName() const
-{
-  return _father->getName();
-}
-
 std::string MEDFileFieldPerMeshPerType::getMeshName() const
 {
   return _father->getMeshName();
@@ -1247,17 +1256,28 @@ int MEDFileFieldPerMeshPerType::getNumberOfComponents() const
   return _father->getNumberOfComponents();
 }
 
-DataArrayDouble *MEDFileFieldPerMeshPerType::getArray()
+DataArray *MEDFileFieldPerMeshPerType::getArray()
 {
   return _father->getArray();
 }
 
-const DataArrayDouble *MEDFileFieldPerMeshPerType::getArray() const
+const DataArray *MEDFileFieldPerMeshPerType::getArray() const
 {
   const MEDFileFieldPerMesh *fath=_father;
   return fath->getArray();
 }
 
+DataArrayDouble *MEDFileFieldPerMeshPerType::getArrayDouble()
+{
+  return _father->getArrayDouble();
+}
+
+const DataArrayDouble *MEDFileFieldPerMeshPerType::getArrayDouble() const
+{
+  const MEDFileFieldPerMesh *fath=_father;
+  return fath->getArrayDouble();
+}
+
 const std::vector<std::string>& MEDFileFieldPerMeshPerType::getInfo() const
 {
   return _father->getInfo();
@@ -1400,13 +1420,13 @@ MEDFileFieldPerMeshPerType::MEDFileFieldPerMeshPerType(MEDFileFieldPerMesh *fath
 {
 }
 
-MEDFileFieldPerMeshPerType::MEDFileFieldPerMeshPerType(med_idt fid, MEDFileFieldPerMesh *fath, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType) throw(INTERP_KERNEL::Exception):_father(fath),_geo_type(geoType)
+MEDFileFieldPerMeshPerType::MEDFileFieldPerMeshPerType(med_idt fid, MEDFileFieldPerMesh *fath, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception):_father(fath),_geo_type(geoType)
 {
   INTERP_KERNEL::AutoPtr<char> pflName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
   INTERP_KERNEL::AutoPtr<char> locName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
   med_geometry_type mgeoti;
   med_entity_type menti=ConvertIntoMEDFileType(type,geoType,mgeoti);
-  int nbProfiles=MEDfieldnProfile(fid,getName().c_str(),getIteration(),getOrder(),menti,mgeoti,pflName,locName);
+  int nbProfiles=MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),menti,mgeoti,pflName,locName);
   _field_pm_pt_pd.resize(nbProfiles);
   for(int i=0;i<nbProfiles;i++)
     {
@@ -1414,30 +1434,30 @@ MEDFileFieldPerMeshPerType::MEDFileFieldPerMeshPerType(med_idt fid, MEDFileField
     }
 }
 
-void MEDFileFieldPerMeshPerType::prepareLoading(med_idt fid, int &start) throw(INTERP_KERNEL::Exception)
+void MEDFileFieldPerMeshPerType::prepareLoading(med_idt fid, int &start, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception)
 {
   int pflId=0;
   for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,pflId++)
     {
-      (*it)->prepareLoading(fid,pflId+1,start);
+      (*it)->prepareLoading(fid,pflId+1,start,nasc);//tony
     }
 }
 
-void MEDFileFieldPerMeshPerType::finishLoading(med_idt fid, int ft) throw(INTERP_KERNEL::Exception)
+void MEDFileFieldPerMeshPerType::finishLoading(med_idt fid, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception)
 {
   int pflId=0;
   for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,pflId++)
     {
-      (*it)->finishLoading(fid,pflId+1,ft);
+      (*it)->finishLoading(fid,pflId+1,nasc);//tony
     }
 }
 
-void MEDFileFieldPerMeshPerType::writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception)
+void MEDFileFieldPerMeshPerType::writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception)
 {
   for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++)
     {
       (*it)->copyOptionsFrom(*this);
-      (*it)->writeLL(fid);
+      (*it)->writeLL(fid,nasc);
     }
 }
 
@@ -1463,12 +1483,12 @@ med_entity_type MEDFileFieldPerMeshPerType::ConvertIntoMEDFileType(TypeOfField i
   return MED_UNDEF_ENTITY_TYPE;
 }
 
-MEDFileFieldPerMesh *MEDFileFieldPerMesh::NewOnRead(med_idt fid, MEDFileField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder) throw(INTERP_KERNEL::Exception)
+MEDFileFieldPerMesh *MEDFileFieldPerMesh::NewOnRead(med_idt fid, MEDFileAnyTypeField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception)
 {
-  return new MEDFileFieldPerMesh(fid,fath,meshCsit,meshIteration,meshOrder);
+  return new MEDFileFieldPerMesh(fid,fath,meshCsit,meshIteration,meshOrder,nasc);
 }
 
-MEDFileFieldPerMesh *MEDFileFieldPerMesh::New(MEDFileField1TSWithoutSDA *fath, const MEDCouplingMesh *mesh)
+MEDFileFieldPerMesh *MEDFileFieldPerMesh::New(MEDFileAnyTypeField1TSWithoutSDA *fath, const MEDCouplingMesh *mesh)
 {
   return new MEDFileFieldPerMesh(fath,mesh);
 }
@@ -1482,7 +1502,7 @@ std::size_t MEDFileFieldPerMesh::getHeapMemorySize() const
   return ret;
 }
 
-MEDFileFieldPerMesh *MEDFileFieldPerMesh::deepCpy(MEDFileField1TSWithoutSDA *father) const throw(INTERP_KERNEL::Exception)
+MEDFileFieldPerMesh *MEDFileFieldPerMesh::deepCpy(MEDFileAnyTypeField1TSWithoutSDA *father) const throw(INTERP_KERNEL::Exception)
 {
   MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > ret=new MEDFileFieldPerMesh(*this);
   ret->_father=father;
@@ -1519,7 +1539,7 @@ void MEDFileFieldPerMesh::copyTinyInfoFrom(const MEDCouplingMesh *mesh) throw(IN
   mesh->getTime(_mesh_iteration,_mesh_order);
 }
 
-void MEDFileFieldPerMesh::assignFieldNoProfileNoRenum(int& start, const std::vector<int>& code, const MEDCouplingFieldDouble *field, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
+void MEDFileFieldPerMesh::assignFieldNoProfileNoRenum(int& start, const std::vector<int>& code, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception)
 {
   int nbOfTypes=code.size()/3;
   int offset=0;
@@ -1528,7 +1548,7 @@ void MEDFileFieldPerMesh::assignFieldNoProfileNoRenum(int& start, const std::vec
       INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)code[3*i];
       int nbOfCells=code[3*i+1];
       int pos=addNewEntryIfNecessary(type);
-      _field_pm_pt[pos]->assignFieldNoProfile(start,offset,nbOfCells,field,glob);
+      _field_pm_pt[pos]->assignFieldNoProfile(start,offset,nbOfCells,field,arr,glob,nasc);
       offset+=nbOfCells;
     }
 }
@@ -1542,7 +1562,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 MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
+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) throw(INTERP_KERNEL::Exception)
 {
   int nbOfTypes=code.size()/3;
   for(int i=0;i<nbOfTypes;i++)
@@ -1559,41 +1579,41 @@ void MEDFileFieldPerMesh::assignFieldProfile(int& start, const DataArrayInt *mul
           break;
       if(found==nbOfTupes2)
         throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::assignFieldProfile : internal problem ! Should never happen ! Please report bug to anthony.geay@cea.fr !");
-      _field_pm_pt[pos]->assignFieldProfile(start,multiTypePfl,idsInPflPerType[i],pfl,code2[3*found+1],field,mesh,glob);
+      _field_pm_pt[pos]->assignFieldProfile(start,multiTypePfl,idsInPflPerType[i],pfl,code2[3*found+1],field,arr,mesh,glob,nasc);
     }
 }
 
-void MEDFileFieldPerMesh::assignNodeFieldNoProfile(int& start, const MEDCouplingFieldDouble *field, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
+void MEDFileFieldPerMesh::assignNodeFieldNoProfile(int& start, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
 {
   int pos=addNewEntryIfNecessary(INTERP_KERNEL::NORM_ERROR);
-  _field_pm_pt[pos]->assignNodeFieldNoProfile(start,field,glob);
+  _field_pm_pt[pos]->assignNodeFieldNoProfile(start,field,arr,glob);
 }
 
-void MEDFileFieldPerMesh::assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldDouble *field, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
+void MEDFileFieldPerMesh::assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception)
 {
   int pos=addNewEntryIfNecessary(INTERP_KERNEL::NORM_ERROR);
-  _field_pm_pt[pos]->assignNodeFieldProfile(start,pfl,field,glob);
+  _field_pm_pt[pos]->assignNodeFieldProfile(start,pfl,field,arr,glob,nasc);
 }
 
-void MEDFileFieldPerMesh::prepareLoading(med_idt fid, int& start) throw(INTERP_KERNEL::Exception)
+void MEDFileFieldPerMesh::prepareLoading(med_idt fid, int& start, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception)
 {
   for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
-    (*it)->prepareLoading(fid,start);
+    (*it)->prepareLoading(fid,start,nasc);
 }
 
-void MEDFileFieldPerMesh::finishLoading(med_idt fid, int ft) throw(INTERP_KERNEL::Exception)
+void MEDFileFieldPerMesh::finishLoading(med_idt fid, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception)
 {
   for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
-    (*it)->finishLoading(fid,ft);
+    (*it)->finishLoading(fid,nasc);
 }
 
-void MEDFileFieldPerMesh::writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception)
+void MEDFileFieldPerMesh::writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception)
 {
   int nbOfTypes=_field_pm_pt.size();
   for(int i=0;i<nbOfTypes;i++)
     {
       _field_pm_pt[i]->copyOptionsFrom(*this);
-      _field_pm_pt[i]->writeLL(fid);
+      _field_pm_pt[i]->writeLL(fid,nasc);
     }
 }
 
@@ -1633,35 +1653,44 @@ int MEDFileFieldPerMesh::getIteration() const
   return _father->getIteration();
 }
 
-const std::string& MEDFileFieldPerMesh::getDtUnit() const
-{
-  return _father->getDtUnit();
-}
-
 int MEDFileFieldPerMesh::getOrder() const
 {
   return _father->getOrder();
 }
 
-std::string MEDFileFieldPerMesh::getName() const
+int MEDFileFieldPerMesh::getNumberOfComponents() const
 {
-  return _father->getName();
+  return _father->getNumberOfComponents();
 }
 
-int MEDFileFieldPerMesh::getNumberOfComponents() const
+DataArray *MEDFileFieldPerMesh::getArray()
 {
-  return _father->getNumberOfComponents();
+  if(!_father)
+    throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getArray : no father ! internal error !");
+  return _father->getOrCreateAndGetArray();
 }
 
-DataArrayDouble *MEDFileFieldPerMesh::getArray()
+const DataArray *MEDFileFieldPerMesh::getArray() const
 {
+  if(!_father)
+    throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getArray : no father ! internal error !");
   return _father->getOrCreateAndGetArray();
 }
 
-const DataArrayDouble *MEDFileFieldPerMesh::getArray() const
+DataArrayDouble *MEDFileFieldPerMesh::getArrayDouble()
+{
+  MEDFileField1TSWithoutSDA *fatherC=dynamic_cast<MEDFileField1TSWithoutSDA *>(_father);
+  if(!fatherC)
+    throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getArrayDouble : Expected to be called on double array !");
+  return fatherC->getOrCreateAndGetArrayDouble();
+}
+
+const DataArrayDouble *MEDFileFieldPerMesh::getArrayDouble() const
 {
-  const MEDFileField1TSWithoutSDA *fath=_father;
-  return fath->getOrCreateAndGetArray();
+  const MEDFileField1TSWithoutSDA *fatherC=dynamic_cast<const MEDFileField1TSWithoutSDA *>(_father);
+  if(!fatherC)
+    throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getArrayDouble : Expected to be called on double array !");
+  return fatherC->getOrCreateAndGetArrayDouble();
 }
 
 const std::vector<std::string>& MEDFileFieldPerMesh::getInfo() const
@@ -1829,7 +1858,8 @@ bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const char *meshName, cons
   std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > entries;
   std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> entriesKept;
   std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> otherEntries;
-  DataArrayDouble *arr=getUndergroundDataArrayExt(entries);
+  getUndergroundDataArrayExt(entries);
+  DataArrayDouble *arr=getArrayDouble();
   int sz=0;
   if(!arr)
     throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh : DataArrayDouble storing values of field is null !");
@@ -1945,7 +1975,7 @@ void MEDFileFieldPerMesh::changeLocsRefsNamesGen(const std::vector< std::pair<st
 /*!
  * \param [in] mesh is the whole mesh
  */
-MEDCouplingFieldDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, bool& isPfl) const throw(INTERP_KERNEL::Exception)
+MEDCouplingFieldDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, bool& isPfl, MEDCouplingAutoRefCountObjectPtr<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception)
 {
   if(_field_pm_pt.empty())
     throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getFieldOnMeshAtLevel : no types field set !");
@@ -1961,7 +1991,7 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevel(TypeOfField t
   SortArraysPerType(glob,type,geoTypes,dads,pfls,locs,code,notNullPflsPerGeoType);
   if(code.empty())
     {
-      std::ostringstream oss; oss << "MEDFileFieldPerMesh::getFieldOnMeshAtLevel : " << "The field \"" << getName() << "\" exists but not with such spatial discretization or such dimension specified !";
+      std::ostringstream oss; oss << "MEDFileFieldPerMesh::getFieldOnMeshAtLevel : " << "The field \"" << nasc.getName() << "\" exists but not with such spatial discretization or such dimension specified !";
       throw INTERP_KERNEL::Exception(oss.str().c_str());
     }
   //
@@ -1971,11 +2001,11 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevel(TypeOfField t
     {
       DataArrayInt *arr=mesh->checkTypeConsistencyAndContig(code,notNullPflsPerGeoType3);
       if(!arr)
-        return finishField(type,glob,dads,locs,mesh,isPfl);
+        return finishField(type,glob,dads,locs,mesh,isPfl,arrOut,nasc);
       else
         {
           MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr2(arr);
-          return finishField2(type,glob,dads,locs,geoTypes,mesh,arr,isPfl);
+          return finishField2(type,glob,dads,locs,geoTypes,mesh,arr,isPfl,arrOut,nasc);
         }
     }
   else
@@ -1991,14 +2021,14 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevel(TypeOfField t
               oss << " nodes in mesh !";
               throw INTERP_KERNEL::Exception(oss.str().c_str());
             }
-          return finishField(type,glob,dads,locs,mesh,isPfl);
+          return finishField(type,glob,dads,locs,mesh,isPfl,arrOut,nasc);
         }
       else
-        return finishFieldNode2(glob,dads,locs,mesh,notNullPflsPerGeoType3[0],isPfl);
+        return finishFieldNode2(glob,dads,locs,mesh,notNullPflsPerGeoType3[0],isPfl,arrOut,nasc);
     }
 }
 
-DataArrayDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob) const throw(INTERP_KERNEL::Exception)
+DataArray *MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception)
 {
   if(_field_pm_pt.empty())
     throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getFieldOnMeshAtLevel : no types field set !");
@@ -2014,7 +2044,7 @@ DataArrayDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl(TypeOfField t
   SortArraysPerType(glob,type,geoTypes,dads,pfls,locs,code,notNullPflsPerGeoType);
   if(code.empty())
     {
-      std::ostringstream oss; oss << "MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl : " << "The field \"" << getName() << "\" exists but not with such spatial discretization or such dimension specified !";
+      std::ostringstream oss; oss << "MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl : " << "The field \"" << nasc.getName() << "\" exists but not with such spatial discretization or such dimension specified !";
       throw INTERP_KERNEL::Exception(oss.str().c_str());
     }
   std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end());
@@ -2044,7 +2074,7 @@ DataArrayDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl(TypeOfField t
   return 0;
 }
 
-DataArrayDouble *MEDFileFieldPerMesh::getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception)
+void MEDFileFieldPerMesh::getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception)
 {
   int globalSz=0;
   int nbOfEntries=0;
@@ -2058,7 +2088,6 @@ DataArrayDouble *MEDFileFieldPerMesh::getUndergroundDataArrayExt(std::vector< st
     {
       (*it)->fillValues(nbOfEntries,entries);
     }
-  return _father->getUndergroundDataArray();
 }
 
 MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMesh::getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId) throw(INTERP_KERNEL::Exception)
@@ -2125,16 +2154,15 @@ int MEDFileFieldPerMesh::addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellTyp
  */
 MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField(TypeOfField type, const MEDFileFieldGlobsReal *glob,
                                                          const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs,
-                                                         const MEDCouplingMesh *mesh, bool& isPfl) const throw(INTERP_KERNEL::Exception)
+                                                         const MEDCouplingMesh *mesh, bool& isPfl, MEDCouplingAutoRefCountObjectPtr<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception)
 {
   isPfl=false;
   MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(type,ONE_TIME);
-  ret->setMesh(mesh); ret->setName(getName().c_str()); ret->setTime(getTime(),getIteration(),getOrder()); ret->setTimeUnit(getDtUnit().c_str());
-  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> da=getArray()->selectByTupleRanges(dads);
+  ret->setMesh(mesh); ret->setName(nasc.getName().c_str()); ret->setTime(getTime(),getIteration(),getOrder()); ret->setTimeUnit(nasc.getDtUnit().c_str());
+  MEDCouplingAutoRefCountObjectPtr<DataArray> da=getArray()->selectByTupleRanges(dads);
   const std::vector<std::string>& infos=getInfo();
   da->setInfoOnComponents(infos);
   da->setName("");
-  ret->setArray(da);
   if(type==ON_GAUSS_PT)
     {
       int offset=0;
@@ -2152,7 +2180,7 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField(TypeOfField type, const
           offset+=nbOfElems;
         }
     }
-  //
+  arrOut=da;
   return ret.retn();
 }
 
@@ -2166,17 +2194,17 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField(TypeOfField type, const
 MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField2(TypeOfField type, const MEDFileFieldGlobsReal *glob,
                                                           const std::vector<std::pair<int,int> >& dads, const std::vector<int>& locs,
                                                           const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes,
-                                                          const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl) const throw(INTERP_KERNEL::Exception)
+                                                          const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MEDCouplingAutoRefCountObjectPtr<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception)
 {
   if(da->isIdentity())
     {
       int nbOfTuples=da->getNumberOfTuples();
       if(nbOfTuples==mesh->getNumberOfCells())
-        return finishField(type,glob,dads,locs,mesh,isPfl);
+        return finishField(type,glob,dads,locs,mesh,isPfl,arrOut,nasc);
     }
   MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> m2=mesh->buildPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
   m2->setName(mesh->getName());
-  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=finishField(type,glob,dads,locs,m2,isPfl);
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=finishField(type,glob,dads,locs,m2,isPfl,arrOut,nasc);
   isPfl=true;
   return ret.retn();
 }
@@ -2186,13 +2214,13 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField2(TypeOfField type, cons
  */
 MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishFieldNode2(const MEDFileFieldGlobsReal *glob,
                                                               const std::vector<std::pair<int,int> >& dads, const std::vector<int>& locs,
-                                                              const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl) const throw(INTERP_KERNEL::Exception)
+                                                              const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MEDCouplingAutoRefCountObjectPtr<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception)
 {
   if(da->isIdentity())
     {
       int nbOfTuples=da->getNumberOfTuples();
       if(nbOfTuples==mesh->getNumberOfNodes())//No problem for NORM_ERROR because it is in context of node
-        return finishField(ON_NODES,glob,dads,locs,mesh,isPfl);
+        return finishField(ON_NODES,glob,dads,locs,mesh,isPfl,arrOut,nasc);
     }
   // Treatment of particular case where nodal field on pfl is requested with a meshDimRelToMax=1.
   const MEDCouplingUMesh *meshu=dynamic_cast<const MEDCouplingUMesh *>(mesh);
@@ -2200,7 +2228,7 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishFieldNode2(const MEDFileField
     {
       if(meshu->getNodalConnectivity()==0)
         {
-          MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=finishField(ON_CELLS,glob,dads,locs,mesh,isPfl);
+          MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=finishField(ON_CELLS,glob,dads,locs,mesh,isPfl,arrOut,nasc);
           int nb=da->getNbOfElems();
           const int *ptr=da->getConstPointer();
           MEDCouplingUMesh *meshuc=const_cast<MEDCouplingUMesh *>(meshu);
@@ -2209,12 +2237,14 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishFieldNode2(const MEDFileField
             meshuc->insertNextCell(INTERP_KERNEL::NORM_POINT1,1,ptr+i);
           meshuc->finishInsertingCells();
           ret->setMesh(meshuc);
-          ret->checkCoherency();
+          const MEDCouplingFieldDiscretization *disc=ret->getDiscretization();
+          if(!disc) throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::finishFieldNode2 : internal error, no discretization on field !");
+          disc->checkCoherencyBetween(meshuc,arrOut);
           return ret.retn();
         }
     }
   //
-  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=finishField(ON_NODES,glob,dads,locs,mesh,isPfl);
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=finishField(ON_NODES,glob,dads,locs,mesh,isPfl,arrOut,nasc);
   isPfl=true;
   DataArrayInt *arr2=0;
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellIds=mesh->getCellIdsFullyIncludedInNodeIds(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
@@ -2224,7 +2254,7 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishFieldNode2(const MEDFileField
   if(nnodes==(int)da->getNbOfElems())
     {
       MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da3=da->transformWithIndArrR(arr2->begin(),arr2->end());
-      ret->getArray()->renumberInPlace(da3->getConstPointer());
+      arrOut->renumberInPlace(da3->getConstPointer());
       mesh2->setName(mesh->getName());
       ret->setMesh(mesh2);
       return ret.retn();
@@ -2245,7 +2275,7 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishFieldNode2(const MEDFileField
 /*!
  * This method is the most light method of field retrieving.
  */
-DataArrayDouble *MEDFileFieldPerMesh::finishField4(const std::vector<std::pair<int,int> >& dads, const DataArrayInt *pflIn, int nbOfElems, DataArrayInt *&pflOut) const throw(INTERP_KERNEL::Exception)
+DataArray *MEDFileFieldPerMesh::finishField4(const std::vector<std::pair<int,int> >& dads, const DataArrayInt *pflIn, int nbOfElems, DataArrayInt *&pflOut) const throw(INTERP_KERNEL::Exception)
 {
   if(!pflIn)
     {
@@ -2259,7 +2289,7 @@ DataArrayDouble *MEDFileFieldPerMesh::finishField4(const std::vector<std::pair<i
       pflOut->incrRef();
     }
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> safePfl(pflOut);
-  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> da=getArray()->selectByTupleRanges(dads);
+  MEDCouplingAutoRefCountObjectPtr<DataArray> da=getArray()->selectByTupleRanges(dads);
   const std::vector<std::string>& infos=getInfo();
   int nbOfComp=infos.size();
   for(int i=0;i<nbOfComp;i++)
@@ -2268,36 +2298,36 @@ DataArrayDouble *MEDFileFieldPerMesh::finishField4(const std::vector<std::pair<i
   return da.retn();
 }
 
-MEDFileFieldPerMesh::MEDFileFieldPerMesh(med_idt fid, MEDFileField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder) throw(INTERP_KERNEL::Exception):_mesh_iteration(meshIteration),_mesh_order(meshOrder),
-                                                                                                                                                                       _mesh_csit(meshCsit),_father(fath)
+MEDFileFieldPerMesh::MEDFileFieldPerMesh(med_idt fid, MEDFileAnyTypeField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception):_mesh_iteration(meshIteration),_mesh_order(meshOrder),
+                                                                                                                                                                                                                 _mesh_csit(meshCsit),_father(fath)
 {
   INTERP_KERNEL::AutoPtr<char> meshName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
   INTERP_KERNEL::AutoPtr<char> pflName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
   INTERP_KERNEL::AutoPtr<char> locName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
   for(int i=0;i<MED_N_CELL_FIXED_GEO;i++)
     {
-      int nbProfile=MEDfield23nProfile(fid,getName().c_str(),getIteration(),getOrder(),MED_CELL,typmai[i],_mesh_csit,meshName,pflName,locName);
+      int nbProfile=MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_CELL,typmai[i],_mesh_csit,meshName,pflName,locName);
       if(nbProfile>0)
         {
-          _field_pm_pt.push_back(MEDFileFieldPerMeshPerType::NewOnRead(fid,this,ON_CELLS,typmai2[i]));
+          _field_pm_pt.push_back(MEDFileFieldPerMeshPerType::NewOnRead(fid,this,ON_CELLS,typmai2[i],nasc));
           _mesh_name=MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1);
         }
-      nbProfile=MEDfield23nProfile(fid,getName().c_str(),getIteration(),getOrder(),MED_NODE_ELEMENT,typmai[i],_mesh_csit,meshName,pflName,locName);
+      nbProfile=MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE_ELEMENT,typmai[i],_mesh_csit,meshName,pflName,locName);
       if(nbProfile>0)
         {
-          _field_pm_pt.push_back(MEDFileFieldPerMeshPerType::NewOnRead(fid,this,ON_GAUSS_NE,typmai2[i]));
+          _field_pm_pt.push_back(MEDFileFieldPerMeshPerType::NewOnRead(fid,this,ON_GAUSS_NE,typmai2[i],nasc));
           _mesh_name=MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1);
         }
     }
-  int nbProfile=MEDfield23nProfile(fid,getName().c_str(),getIteration(),getOrder(),MED_NODE,MED_NONE,_mesh_csit,meshName,pflName,locName);
+  int nbProfile=MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE,MED_NONE,_mesh_csit,meshName,pflName,locName);
   if(nbProfile>0)
     {
-      _field_pm_pt.push_back(MEDFileFieldPerMeshPerType::NewOnRead(fid,this,ON_NODES,INTERP_KERNEL::NORM_ERROR));
+      _field_pm_pt.push_back(MEDFileFieldPerMeshPerType::NewOnRead(fid,this,ON_NODES,INTERP_KERNEL::NORM_ERROR,nasc));
       _mesh_name=MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1);
     }
 }
 
-MEDFileFieldPerMesh::MEDFileFieldPerMesh(MEDFileField1TSWithoutSDA *fath, const MEDCouplingMesh *mesh):_father(fath)
+MEDFileFieldPerMesh::MEDFileFieldPerMesh(MEDFileAnyTypeField1TSWithoutSDA *fath, const MEDCouplingMesh *mesh):_father(fath)
 {
   copyTinyInfoFrom(mesh);
 }
@@ -2386,6 +2416,18 @@ void MEDFileFieldGlobs::appendGlobs(const MEDFileFieldGlobs& other, double eps)
     }
 }
 
+void MEDFileFieldGlobs::checkGlobsPflsPartCoherency(const std::vector<std::string>& pflsUsed) const throw(INTERP_KERNEL::Exception)
+{
+  for(std::vector<std::string>::const_iterator it=pflsUsed.begin();it!=pflsUsed.end();it++)
+    getProfile((*it).c_str());
+}
+
+void MEDFileFieldGlobs::checkGlobsLocsPartCoherency(const std::vector<std::string>& locsUsed) const throw(INTERP_KERNEL::Exception)
+{
+  for(std::vector<std::string>::const_iterator it=locsUsed.begin();it!=locsUsed.end();it++)
+    getLocalization((*it).c_str());
+}
+
 void MEDFileFieldGlobs::loadGlobals(med_idt fid, const MEDFileFieldGlobsReal& real) throw(INTERP_KERNEL::Exception)
 {
   std::vector<std::string> profiles=real.getPflsReallyUsed();
@@ -2452,6 +2494,62 @@ MEDFileFieldGlobs *MEDFileFieldGlobs::deepCpy() const throw(INTERP_KERNEL::Excep
   return ret.retn();
 }
 
+/*!
+ * \throw if a profile in \a pfls in not in \a this.
+ * \throw if a localization in \a locs in not in \a this.
+ * \sa MEDFileFieldGlobs::deepCpyPart
+ */
+MEDFileFieldGlobs *MEDFileFieldGlobs::shallowCpyPart(const std::vector<std::string>& pfls, const std::vector<std::string>& locs) const throw(INTERP_KERNEL::Exception)
+{
+  MEDCouplingAutoRefCountObjectPtr<MEDFileFieldGlobs> ret=MEDFileFieldGlobs::New();
+  for(std::vector<std::string>::const_iterator it1=pfls.begin();it1!=pfls.end();it1++)
+    {
+      DataArrayInt *pfl=const_cast<DataArrayInt *>(getProfile((*it1).c_str()));
+      if(!pfl)
+        throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::shallowCpyPart : internal error ! pfl null !");
+      pfl->incrRef();
+      MEDCouplingAutoRefCountObjectPtr<DataArrayInt> pfl2(pfl);
+      ret->_pfls.push_back(pfl2);
+    }
+  for(std::vector<std::string>::const_iterator it2=locs.begin();it2!=locs.end();it2++)
+    {
+      MEDFileFieldLoc *loc=const_cast<MEDFileFieldLoc *>(&getLocalization((*it2).c_str()));
+      if(!loc)
+        throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::shallowCpyPart : internal error ! loc null !");
+      loc->incrRef();
+      MEDCouplingAutoRefCountObjectPtr<MEDFileFieldLoc> loc2(loc);
+      ret->_locs.push_back(loc2);
+    }
+  ret->setFileName(getFileName());
+  return ret.retn();
+}
+
+/*!
+ * \throw if a profile in \a pfls in not in \a this.
+ * \throw if a localization in \a locs in not in \a this.
+ * \sa MEDFileFieldGlobs::shallowCpyPart
+ */
+MEDFileFieldGlobs *MEDFileFieldGlobs::deepCpyPart(const std::vector<std::string>& pfls, const std::vector<std::string>& locs) const throw(INTERP_KERNEL::Exception)
+{
+  MEDCouplingAutoRefCountObjectPtr<MEDFileFieldGlobs> ret=MEDFileFieldGlobs::New();
+  for(std::vector<std::string>::const_iterator it1=pfls.begin();it1!=pfls.end();it1++)
+    {
+      DataArrayInt *pfl=const_cast<DataArrayInt *>(getProfile((*it1).c_str()));
+      if(!pfl)
+        throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::deepCpyPart : internal error ! pfl null !");
+      ret->_pfls.push_back(pfl->deepCpy());
+    }
+  for(std::vector<std::string>::const_iterator it2=locs.begin();it2!=locs.end();it2++)
+    {
+      MEDFileFieldLoc *loc=const_cast<MEDFileFieldLoc *>(&getLocalization((*it2).c_str()));
+      if(!loc)
+        throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::deepCpyPart : internal error ! loc null !");
+      ret->_locs.push_back(loc->deepCpy());
+    }
+  ret->setFileName(getFileName());
+  return ret.retn();
+}
+
 MEDFileFieldGlobs::MEDFileFieldGlobs(const char *fname):_file_name(fname)
 {
 }
@@ -2588,6 +2686,9 @@ int MEDFileFieldGlobs::getLocalizationId(const char *loc) const throw(INTERP_KER
   return std::distance(_locs.begin(),it);
 }
 
+/*!
+ * The returned value is never null.
+ */
 const DataArrayInt *MEDFileFieldGlobs::getProfile(const char *pflName) const throw(INTERP_KERNEL::Exception)
 {
   std::string pflNameCpp(pflName);
@@ -2621,6 +2722,9 @@ MEDFileFieldLoc& MEDFileFieldGlobs::getLocalization(const char *locName) throw(I
   return getLocalizationFromId(getLocalizationId(locName));
 }
 
+/*!
+ * The returned value is never null.
+ */
 DataArrayInt *MEDFileFieldGlobs::getProfile(const char *pflName) throw(INTERP_KERNEL::Exception)
 {
   std::string pflNameCpp(pflName);
@@ -2830,16 +2934,23 @@ std::size_t MEDFileFieldGlobsReal::getHeapMemorySize() const
  * Returns a string describing profiles and Gauss points held in \a this.
  *  \return std::string - the description string.
  */
-void MEDFileFieldGlobsReal::simpleRepr(std::ostream& oss) const
+void MEDFileFieldGlobsReal::simpleReprGlobs(std::ostream& oss) const
 {
-  oss << "Globals information on fields :" << "\n*******************************\n\n";
   const MEDFileFieldGlobs *glob=_globals;
+  std::ostringstream oss2; oss2 << glob;
+  std::string stars(oss2.str().length(),'*');
+  oss << "Globals information on fields (at " << oss2.str() << "):" << "\n************************************" << stars  << "\n\n";
   if(glob)
     glob->simpleRepr(oss);
   else
     oss << "NO GLOBAL INFORMATION !\n";
 }
 
+void MEDFileFieldGlobsReal::resetContent()
+{
+  _globals=MEDFileFieldGlobs::New();
+}
+
 MEDFileFieldGlobsReal::~MEDFileFieldGlobsReal()
 {
 }
@@ -2853,6 +2964,30 @@ void MEDFileFieldGlobsReal::shallowCpyGlobs(const MEDFileFieldGlobsReal& other)
   _globals=other._globals;
 }
 
+/*!
+ * Copies references to ** only used ** by \a this, profiles and Gauss points from another MEDFileFieldGlobsReal.
+ *  \param [in] other - the other MEDFileFieldGlobsReal to copy data from.
+ */
+void MEDFileFieldGlobsReal::shallowCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception)
+{
+  const MEDFileFieldGlobs *otherg(other._globals);
+  if(!otherg)
+    return ;
+  _globals=otherg->shallowCpyPart(getPflsReallyUsed(),getLocsReallyUsed());
+}
+
+/*!
+ * Copies deeply to ** only used ** by \a this, profiles and Gauss points from another MEDFileFieldGlobsReal.
+ *  \param [in] other - the other MEDFileFieldGlobsReal to copy data from.
+ */
+void MEDFileFieldGlobsReal::deepCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception)
+{
+  const MEDFileFieldGlobs *otherg(other._globals);
+  if(!otherg)
+    return ;
+  _globals=otherg->deepCpyPart(getPflsReallyUsed(),getLocsReallyUsed());
+}
+
 void MEDFileFieldGlobsReal::deepCpyGlobs(const MEDFileFieldGlobsReal& other)
 {
   _globals=other._globals;
@@ -2870,32 +3005,56 @@ void MEDFileFieldGlobsReal::deepCpyGlobs(const MEDFileFieldGlobsReal& other)
  */
 void MEDFileFieldGlobsReal::appendGlobs(const MEDFileFieldGlobsReal& other, double eps) throw(INTERP_KERNEL::Exception)
 {
+  const MEDFileFieldGlobs *thisGlobals(_globals),*otherGlobals(other._globals);
+  if(thisGlobals==otherGlobals)
+    return ;
+  if(!thisGlobals)
+    {
+      _globals=other._globals;
+      return ;
+    }
   _globals->appendGlobs(*other._globals,eps);
 }
 
+void MEDFileFieldGlobsReal::checkGlobsCoherency() const throw(INTERP_KERNEL::Exception)
+{
+  checkGlobsPflsPartCoherency();
+  checkGlobsLocsPartCoherency();
+}
+
+void MEDFileFieldGlobsReal::checkGlobsPflsPartCoherency() const throw(INTERP_KERNEL::Exception)
+{
+  contentNotNull()->checkGlobsPflsPartCoherency(getPflsReallyUsed());
+}
+
+void MEDFileFieldGlobsReal::checkGlobsLocsPartCoherency() const throw(INTERP_KERNEL::Exception)
+{
+  contentNotNull()->checkGlobsLocsPartCoherency(getLocsReallyUsed());
+}
+
 void MEDFileFieldGlobsReal::loadProfileInFile(med_idt fid, int id, const char *pflName) throw(INTERP_KERNEL::Exception)
 {
-  _globals->loadProfileInFile(fid,id,pflName);
+  contentNotNull()->loadProfileInFile(fid,id,pflName);
 }
 
 void MEDFileFieldGlobsReal::loadProfileInFile(med_idt fid, int id)
 {
-  _globals->loadProfileInFile(fid,id);
+  contentNotNull()->loadProfileInFile(fid,id);
 }
 
 void MEDFileFieldGlobsReal::loadGlobals(med_idt fid) throw(INTERP_KERNEL::Exception)
 {
-  _globals->loadGlobals(fid,*this);
+  contentNotNull()->loadGlobals(fid,*this);
 }
 
 void MEDFileFieldGlobsReal::loadAllGlobals(med_idt fid) throw(INTERP_KERNEL::Exception)
 {
-  _globals->loadAllGlobals(fid);
+  contentNotNull()->loadAllGlobals(fid);
 }
 
 void MEDFileFieldGlobsReal::writeGlobals(med_idt fid, const MEDFileWritable& opt) const throw(INTERP_KERNEL::Exception)
 {
-  _globals->writeGlobals(fid,opt);
+  contentNotNull()->writeGlobals(fid,opt);
 }
 
 /*!
@@ -2905,7 +3064,7 @@ void MEDFileFieldGlobsReal::writeGlobals(med_idt fid, const MEDFileWritable& opt
  */
 std::vector<std::string> MEDFileFieldGlobsReal::getPfls() const
 {
-  return _globals->getPfls();
+  return contentNotNull()->getPfls();
 }
 
 /*!
@@ -2915,7 +3074,7 @@ std::vector<std::string> MEDFileFieldGlobsReal::getPfls() const
  */
 std::vector<std::string> MEDFileFieldGlobsReal::getLocs() const
 {
-  return _globals->getLocs();
+  return contentNotNull()->getLocs();
 }
 
 /*!
@@ -2925,7 +3084,7 @@ std::vector<std::string> MEDFileFieldGlobsReal::getLocs() const
  */
 bool MEDFileFieldGlobsReal::existsPfl(const char *pflName) const
 {
-  return _globals->existsPfl(pflName);
+  return contentNotNull()->existsPfl(pflName);
 }
 
 /*!
@@ -2935,17 +3094,17 @@ bool MEDFileFieldGlobsReal::existsPfl(const char *pflName) const
  */
 bool MEDFileFieldGlobsReal::existsLoc(const char *locName) const
 {
-  return _globals->existsLoc(locName);
+  return contentNotNull()->existsLoc(locName);
 }
 
 std::string MEDFileFieldGlobsReal::createNewNameOfPfl() const throw(INTERP_KERNEL::Exception)
 {
-  return _globals->createNewNameOfPfl();
+  return contentNotNull()->createNewNameOfPfl();
 }
 
 std::string MEDFileFieldGlobsReal::createNewNameOfLoc() const throw(INTERP_KERNEL::Exception)
 {
-  return _globals->createNewNameOfLoc();
+  return contentNotNull()->createNewNameOfLoc();
 }
 
 /*!
@@ -2954,7 +3113,7 @@ std::string MEDFileFieldGlobsReal::createNewNameOfLoc() const throw(INTERP_KERNE
  */
 void MEDFileFieldGlobsReal::setFileName(const char *fileName)
 {
-  _globals->setFileName(fileName);
+  contentNotNull()->setFileName(fileName);
 }
 
 /*!
@@ -2965,7 +3124,7 @@ void MEDFileFieldGlobsReal::setFileName(const char *fileName)
  */
 std::vector< std::vector<int> > MEDFileFieldGlobsReal::whichAreEqualProfiles() const
 {
-  return _globals->whichAreEqualProfiles();
+  return contentNotNull()->whichAreEqualProfiles();
 }
 
 /*!
@@ -2976,7 +3135,7 @@ std::vector< std::vector<int> > MEDFileFieldGlobsReal::whichAreEqualProfiles() c
  */
 std::vector< std::vector<int> > MEDFileFieldGlobsReal::whichAreEqualLocs(double eps) const
 {
-  return _globals->whichAreEqualLocs(eps);
+  return contentNotNull()->whichAreEqualLocs(eps);
 }
 
 /*!
@@ -2988,7 +3147,7 @@ std::vector< std::vector<int> > MEDFileFieldGlobsReal::whichAreEqualLocs(double
  */
 void MEDFileFieldGlobsReal::changePflsNamesInStruct(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
 {
-  _globals->changePflsNamesInStruct(mapOfModif);
+  contentNotNull()->changePflsNamesInStruct(mapOfModif);
 }
 
 /*!
@@ -3000,7 +3159,7 @@ void MEDFileFieldGlobsReal::changePflsNamesInStruct(const std::vector< std::pair
  */
 void MEDFileFieldGlobsReal::changeLocsNamesInStruct(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
 {
-  _globals->changeLocsNamesInStruct(mapOfModif);
+  contentNotNull()->changeLocsNamesInStruct(mapOfModif);
 }
 
 /*!
@@ -3135,7 +3294,7 @@ std::vector< std::pair<std::vector<std::string>, std::string > > MEDFileFieldGlo
  */
 int MEDFileFieldGlobsReal::getNbOfGaussPtPerCell(int locId) const throw(INTERP_KERNEL::Exception)
 {
-  return _globals->getNbOfGaussPtPerCell(locId);
+  return contentNotNull()->getNbOfGaussPtPerCell(locId);
 }
 
 /*!
@@ -3146,7 +3305,7 @@ int MEDFileFieldGlobsReal::getNbOfGaussPtPerCell(int locId) const throw(INTERP_K
  */
 int MEDFileFieldGlobsReal::getLocalizationId(const char *loc) const throw(INTERP_KERNEL::Exception)
 {
-  return _globals->getLocalizationId(loc);
+  return contentNotNull()->getLocalizationId(loc);
 }
 
 /*!
@@ -3155,12 +3314,12 @@ int MEDFileFieldGlobsReal::getLocalizationId(const char *loc) const throw(INTERP
  */
 const char *MEDFileFieldGlobsReal::getFileName() const
 {
-  return _globals->getFileName();
+  return contentNotNull()->getFileName();
 }
 
 std::string MEDFileFieldGlobsReal::getFileName2() const
 {
-  return _globals->getFileName2();
+  return contentNotNull()->getFileName2();
 }
 
 /*!
@@ -3171,7 +3330,7 @@ std::string MEDFileFieldGlobsReal::getFileName2() const
  */
 const MEDFileFieldLoc& MEDFileFieldGlobsReal::getLocalization(const char *locName) const throw(INTERP_KERNEL::Exception)
 {
-  return _globals->getLocalization(locName);
+  return contentNotNull()->getLocalization(locName);
 }
 
 /*!
@@ -3182,7 +3341,7 @@ const MEDFileFieldLoc& MEDFileFieldGlobsReal::getLocalization(const char *locNam
  */
 const MEDFileFieldLoc& MEDFileFieldGlobsReal::getLocalizationFromId(int locId) const throw(INTERP_KERNEL::Exception)
 {
-  return _globals->getLocalizationFromId(locId);
+  return contentNotNull()->getLocalizationFromId(locId);
 }
 
 /*!
@@ -3193,7 +3352,7 @@ const MEDFileFieldLoc& MEDFileFieldGlobsReal::getLocalizationFromId(int locId) c
  */
 const DataArrayInt *MEDFileFieldGlobsReal::getProfile(const char *pflName) const throw(INTERP_KERNEL::Exception)
 {
-  return _globals->getProfile(pflName);
+  return contentNotNull()->getProfile(pflName);
 }
 
 /*!
@@ -3204,7 +3363,7 @@ const DataArrayInt *MEDFileFieldGlobsReal::getProfile(const char *pflName) const
  */
 const DataArrayInt *MEDFileFieldGlobsReal::getProfileFromId(int pflId) const throw(INTERP_KERNEL::Exception)
 {
-  return _globals->getProfileFromId(pflId);
+  return contentNotNull()->getProfileFromId(pflId);
 }
 
 /*!
@@ -3216,7 +3375,7 @@ const DataArrayInt *MEDFileFieldGlobsReal::getProfileFromId(int pflId) const thr
  */
 MEDFileFieldLoc& MEDFileFieldGlobsReal::getLocalizationFromId(int locId) throw(INTERP_KERNEL::Exception)
 {
-  return _globals->getLocalizationFromId(locId);
+  return contentNotNull()->getLocalizationFromId(locId);
 }
 
 /*!
@@ -3228,7 +3387,7 @@ MEDFileFieldLoc& MEDFileFieldGlobsReal::getLocalizationFromId(int locId) throw(I
  */
 MEDFileFieldLoc& MEDFileFieldGlobsReal::getLocalization(const char *locName) throw(INTERP_KERNEL::Exception)
 {
-  return _globals->getLocalization(locName);
+  return contentNotNull()->getLocalization(locName);
 }
 
 /*!
@@ -3239,7 +3398,7 @@ MEDFileFieldLoc& MEDFileFieldGlobsReal::getLocalization(const char *locName) thr
  */
 DataArrayInt *MEDFileFieldGlobsReal::getProfile(const char *pflName) throw(INTERP_KERNEL::Exception)
 {
-  return _globals->getProfile(pflName);
+  return contentNotNull()->getProfile(pflName);
 }
 
 /*!
@@ -3250,7 +3409,7 @@ DataArrayInt *MEDFileFieldGlobsReal::getProfile(const char *pflName) throw(INTER
  */
 DataArrayInt *MEDFileFieldGlobsReal::getProfileFromId(int pflId) throw(INTERP_KERNEL::Exception)
 {
-  return _globals->getProfileFromId(pflId);
+  return contentNotNull()->getProfileFromId(pflId);
 }
 
 /*!
@@ -3259,7 +3418,7 @@ DataArrayInt *MEDFileFieldGlobsReal::getProfileFromId(int pflId) throw(INTERP_KE
  */
 void MEDFileFieldGlobsReal::killProfileIds(const std::vector<int>& pflIds) throw(INTERP_KERNEL::Exception)
 {
-  _globals->killProfileIds(pflIds);
+  contentNotNull()->killProfileIds(pflIds);
 }
 
 /*!
@@ -3268,7 +3427,7 @@ void MEDFileFieldGlobsReal::killProfileIds(const std::vector<int>& pflIds) throw
  */
 void MEDFileFieldGlobsReal::killLocalizationIds(const std::vector<int>& locIds) throw(INTERP_KERNEL::Exception)
 {
-  _globals->killLocalizationIds(locIds);
+  contentNotNull()->killLocalizationIds(locIds);
 }
 
 /*!
@@ -3280,7 +3439,7 @@ void MEDFileFieldGlobsReal::killLocalizationIds(const std::vector<int>& locIds)
  */
 void MEDFileFieldGlobsReal::appendProfile(DataArrayInt *pfl) throw(INTERP_KERNEL::Exception)
 {
-  _globals->appendProfile(pfl);
+  contentNotNull()->appendProfile(pfl);
 }
 
 /*!
@@ -3298,143 +3457,71 @@ void MEDFileFieldGlobsReal::appendProfile(DataArrayInt *pfl) throw(INTERP_KERNEL
  */
 void MEDFileFieldGlobsReal::appendLoc(const char *locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w) throw(INTERP_KERNEL::Exception)
 {
-  _globals->appendLoc(locName,geoType,refCoo,gsCoo,w);
+  contentNotNull()->appendLoc(locName,geoType,refCoo,gsCoo,w);
 }
 
-/*!
- * Returns the maximal dimension of supporting elements. Returns -2 if \a this is
- * empty. Returns -1 if this in on nodes.
- *  \return int - the dimension of \a this.
- */
-int MEDFileField1TSWithoutSDA::getDimension() const
+MEDFileFieldGlobs *MEDFileFieldGlobsReal::contentNotNull() throw(INTERP_KERNEL::Exception)
 {
-  int ret=-2;
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
-    (*it)->getDimension(ret);
-  return ret;
+  MEDFileFieldGlobs *g(_globals);
+  if(!g)
+    throw INTERP_KERNEL::Exception("MEDFileFieldGlobsReal::contentNotNull : no content in not const !");
+  return g;
 }
 
-/*!
- * Throws if a given value is not a valid (non-extended) relative dimension.
- *  \param [in] meshDimRelToMax - the relative dimension value.
- *  \throw If \a meshDimRelToMax > 0.
- */
-void MEDFileField1TSWithoutSDA::CheckMeshDimRel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception)
+const MEDFileFieldGlobs *MEDFileFieldGlobsReal::contentNotNull() const throw(INTERP_KERNEL::Exception)
 {
-  if(meshDimRelToMax>0)
-    throw INTERP_KERNEL::Exception("CheckMeshDimRel : This is a meshDimRel not a meshDimRelExt ! So value should be <=0 !");
+  const MEDFileFieldGlobs *g(_globals);
+  if(!g)
+    throw INTERP_KERNEL::Exception("MEDFileFieldGlobsReal::contentNotNull : no content in const !");
+  return g;
 }
 
-/*!
- * Checks if elements of a given mesh are in the order suitable for writing 
- * to the MED file. If this is not so, an exception is thrown. In a case of success, returns a
- * vector describing types of elements and their number.
- *  \param [in] mesh - the mesh to check.
- *  \return std::vector<int> - a vector holding for each element type (1) item of
- *          INTERP_KERNEL::NormalizedCellType, (2) number of elements, (3) -1. 
- *          These values are in full-interlace mode.
- *  \throw If elements in \a mesh are not in the order suitable for writing to the MED file.
- */
-std::vector<int> MEDFileField1TSWithoutSDA::CheckSBTMesh(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception)
-{
-  //
-  std::set<INTERP_KERNEL::NormalizedCellType> geoTypes=mesh->getAllGeoTypes();
-  int nbOfTypes=geoTypes.size();
-  std::vector<int> code(3*nbOfTypes);
-  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr1=DataArrayInt::New();
-  arr1->alloc(nbOfTypes,1);
-  int *arrPtr=arr1->getPointer();
-  std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator it=geoTypes.begin();
-  for(int i=0;i<nbOfTypes;i++,it++)
-    arrPtr[i]=std::distance(typmai2,std::find(typmai2,typmai2+MED_N_CELL_FIXED_GEO,*it));
-  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr2=arr1->checkAndPreparePermutation();
-  const int *arrPtr2=arr2->getConstPointer();
-  int i=0;
-  for(it=geoTypes.begin();it!=geoTypes.end();it++,i++)
-    {
-      int pos=arrPtr2[i];
-      int nbCells=mesh->getNumberOfCellsWithType(*it);
-      code[3*pos]=(int)(*it);
-      code[3*pos+1]=nbCells;
-      code[3*pos+2]=-1;//no profiles
-    }
-  std::vector<const DataArrayInt *> idsPerType;//no profiles
-  DataArrayInt *da=mesh->checkTypeConsistencyAndContig(code,idsPerType);
-  if(da)
-    {
-      da->decrRef();
-      throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::CheckSBTMesh : underlying mesh is not sorted by type as MED file expects !");
-    }
-  return code;
-}
+//= MEDFileFieldNameScope
 
-MEDFileField1TSWithoutSDA *MEDFileField1TSWithoutSDA::New(const char *fieldName, int csit, int fieldtype, int iteration, int order, const std::vector<std::string>& infos)
+MEDFileFieldNameScope::MEDFileFieldNameScope()
 {
-  return new MEDFileField1TSWithoutSDA(fieldName,csit,fieldtype,iteration,order,infos);
 }
 
-/*!
- * Copies tiny info and allocates \a this->_arr instance of DataArrayDouble to
- * append data of a given MEDCouplingFieldDouble. So that the size of \a this->_arr becomes
- * larger by the size of \a field. Returns an id of the first not filled
- * tuple of \a this->_arr.
- *  \param [in] field - the field to copy the info on components and the name from.
- *  \return int - the id of first not initialized tuple of \a this->_arr.
- *  \throw If the name of \a field is empty.
- *  \throw If the data array of \a field is not set.
- *  \throw If \a this->_arr is already allocated but has different number of components
- *         than \a field.
- */
-int MEDFileField1TSWithoutSDA::copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception)
+MEDFileFieldNameScope::MEDFileFieldNameScope(const char *fieldName):_name(fieldName)
 {
-  std::string name(field->getName());
-  getOrCreateAndGetArray()->setName(name.c_str());
-  if(name.empty())
-    throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::copyTinyInfoFrom : unsupported fields with no name in MED file !");
-  const DataArrayDouble *arr=field->getArray();
-  if(!arr)
-    throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::copyTinyInfoFrom : no array set !");
-  _dt=field->getTime(_iteration,_order);
-  int nbOfComponents=arr->getNumberOfComponents();
-  getOrCreateAndGetArray()->setInfoAndChangeNbOfCompo(arr->getInfoOnComponents());
-  if(!getOrCreateAndGetArray()->isAllocated())
-    {
-      _arr->alloc(arr->getNumberOfTuples(),arr->getNumberOfComponents());
-      return 0;
-    }
-  else
-    {
-      int oldNbOfTuples=getOrCreateAndGetArray()->getNumberOfTuples();
-      int newNbOfTuples=oldNbOfTuples+arr->getNumberOfTuples();
-      MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp=DataArrayDouble::New();
-      tmp->alloc(newNbOfTuples,nbOfComponents);
-      tmp->copyStringInfoFrom(*_arr);
-      std::copy(_arr->begin(),_arr->end(),tmp->getPointer());
-      _arr=tmp;
-      return oldNbOfTuples;
-    }
 }
 
 /*!
  * Returns the name of \a this field.
  *  \return std::string - a string containing the field name.
  */
-std::string MEDFileField1TSWithoutSDA::getName() const
+std::string MEDFileFieldNameScope::getName() const throw(INTERP_KERNEL::Exception)
 {
-  const DataArrayDouble *arr=getOrCreateAndGetArray();
-  return arr->getName();
+  return _name;
 }
 
 /*!
  * Sets name of \a this field
  *  \param [in] name - the new field name.
  */
-void MEDFileField1TSWithoutSDA::setName(const char *name)
+void MEDFileFieldNameScope::setName(const char *fieldName) throw(INTERP_KERNEL::Exception)
+{
+  _name=fieldName;
+}
+
+std::string MEDFileFieldNameScope::getDtUnit() const throw(INTERP_KERNEL::Exception)
+{
+  return _dt_unit;
+}
+
+void MEDFileFieldNameScope::setDtUnit(const char *dtUnit) throw(INTERP_KERNEL::Exception)
+{
+  _dt_unit=dtUnit;
+}
+
+void MEDFileFieldNameScope::copyNameScope(const MEDFileFieldNameScope& other)
 {
-  DataArrayDouble *arr=getOrCreateAndGetArray();
-  arr->setName(name);
+  _name=other._name;
+  _dt_unit=other._dt_unit;
 }
 
+//= MEDFileAnyTypeField1TSWithoutSDA
+
 /*!
  * Prints a string describing \a this field into a stream. This string is outputted 
  * by \c print Python command.
@@ -3443,15 +3530,18 @@ void MEDFileField1TSWithoutSDA::setName(const char *name)
  *  \param [in] f1tsId - the field index within a MED file. If \a f1tsId < 0, the tiny
  *          info id printed, else, not.
  */
-void MEDFileField1TSWithoutSDA::simpleRepr(int bkOffset, std::ostream& oss, int f1tsId) const
+void MEDFileAnyTypeField1TSWithoutSDA::simpleRepr(int bkOffset, std::ostream& oss, int f1tsId) const
 {
   std::string startOfLine(bkOffset,' ');
-  oss << startOfLine << "Field on One time Step ";
+  oss << startOfLine << "Field ";
+  if(bkOffset==0)
+    oss << "[Type=" << getTypeStr() << "] ";
+  oss << "on One time Step ";
   if(f1tsId>=0)
     oss << "(" << f1tsId << ") ";
   oss << "on iteration=" << _iteration << " order=" << _order << "." << std::endl;
   oss << startOfLine << "Time attached is : " << _dt << " [" << _dt_unit << "]." << std::endl;
-  const DataArrayDouble *arr=_arr;
+  const DataArray *arr=getUndergroundDataArray();
   if(arr)
     {
       const std::vector<std::string> &comps=arr->getInfoOnComponents();
@@ -3493,19 +3583,57 @@ void MEDFileField1TSWithoutSDA::simpleRepr(int bkOffset, std::ostream& oss, int
   oss << startOfLine << "----------------------" << std::endl;
 }
 
+std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > MEDFileAnyTypeField1TSWithoutSDA::splitComponents() const throw(INTERP_KERNEL::Exception)
+{
+  const DataArray *arr(getUndergroundDataArray());
+  if(!arr)
+    throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::splitComponents : no array defined !");
+  int nbOfCompo=arr->getNumberOfComponents();
+  std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > ret(nbOfCompo);
+  for(int i=0;i<nbOfCompo;i++)
+    {
+      ret[i]=deepCpy();
+      std::vector<int> v(1,i);
+      MEDCouplingAutoRefCountObjectPtr<DataArray> arr2=arr->keepSelectedComponents(v);
+      ret[i]->setArray(arr2);
+    }
+  return ret;
+}
+
+MEDFileAnyTypeField1TSWithoutSDA::MEDFileAnyTypeField1TSWithoutSDA(const char *fieldName, int csit, int iteration, int order):MEDFileFieldNameScope(fieldName),_iteration(iteration),_order(order),_csit(csit)
+{
+}
+
+MEDFileAnyTypeField1TSWithoutSDA::MEDFileAnyTypeField1TSWithoutSDA():_iteration(-1),_order(-1),_dt(0.),_csit(-1)
+{
+}
+
+/*!
+ * Returns the maximal dimension of supporting elements. Returns -2 if \a this is
+ * empty. Returns -1 if this in on nodes.
+ *  \return int - the dimension of \a this.
+ */
+int MEDFileAnyTypeField1TSWithoutSDA::getDimension() const
+{
+  int ret=-2;
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+    (*it)->getDimension(ret);
+  return ret;
+}
+
 /*!
  * Returns the mesh name.
  *  \return std::string - a string holding the mesh name.
  *  \throw If \c _field_per_mesh.empty()
  */
-std::string MEDFileField1TSWithoutSDA::getMeshName() const throw(INTERP_KERNEL::Exception)
+std::string MEDFileAnyTypeField1TSWithoutSDA::getMeshName() const throw(INTERP_KERNEL::Exception)
 {
   if(_field_per_mesh.empty())
     throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::getMeshName : No field set !");
   return _field_per_mesh[0]->getMeshName();
 }
 
-void MEDFileField1TSWithoutSDA::setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception)
+void MEDFileAnyTypeField1TSWithoutSDA::setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception)
 {
   std::string oldName(getMeshName());
   std::vector< std::pair<std::string,std::string> > v(1);
@@ -3513,7 +3641,7 @@ void MEDFileField1TSWithoutSDA::setMeshName(const char *newMeshName) throw(INTER
   changeMeshNames(v);
 }
 
-bool MEDFileField1TSWithoutSDA::changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab) throw(INTERP_KERNEL::Exception)
+bool MEDFileAnyTypeField1TSWithoutSDA::changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab) throw(INTERP_KERNEL::Exception)
 {
   bool ret=false;
   for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
@@ -3525,25 +3653,12 @@ bool MEDFileField1TSWithoutSDA::changeMeshNames(const std::vector< std::pair<std
   return ret;
 }
 
-bool MEDFileField1TSWithoutSDA::renumberEntitiesLyingOnMesh(const char *meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N,
-                                                            MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
-{
-  bool ret=false;
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
-    {
-      MEDFileFieldPerMesh *fpm(*it);
-      if(fpm)
-        ret=fpm->renumberEntitiesLyingOnMesh(meshName,oldCode,newCode,renumO2N,glob) || ret;
-    }
-  return ret;
-}
-
 /*!
  * Returns the number of iteration of the state of underlying mesh.
  *  \return int - the iteration number.
  *  \throw If \c _field_per_mesh.empty()
  */
-int MEDFileField1TSWithoutSDA::getMeshIteration() const throw(INTERP_KERNEL::Exception)
+int MEDFileAnyTypeField1TSWithoutSDA::getMeshIteration() const throw(INTERP_KERNEL::Exception)
 {
   if(_field_per_mesh.empty())
     throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::getMeshIteration : No field set !");
@@ -3555,22 +3670,13 @@ int MEDFileField1TSWithoutSDA::getMeshIteration() const throw(INTERP_KERNEL::Exc
  *  \return int - the order number.
  *  \throw If \c _field_per_mesh.empty()
  */
-int MEDFileField1TSWithoutSDA::getMeshOrder() const throw(INTERP_KERNEL::Exception)
+int MEDFileAnyTypeField1TSWithoutSDA::getMeshOrder() const throw(INTERP_KERNEL::Exception)
 {
   if(_field_per_mesh.empty())
     throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::getMeshOrder : No field set !");
   return _field_per_mesh[0]->getMeshOrder();
 }
 
-/*!
- * Returns number of components in \a this field
- *  \return int - the number of components.
- */
-int MEDFileField1TSWithoutSDA::getNumberOfComponents() const
-{
-  return getOrCreateAndGetArray()->getNumberOfComponents();
-}
-
 /*!
  * Checks if \a this field is tagged by a given iteration number and a given
  * iteration order number.
@@ -3579,7 +3685,7 @@ int MEDFileField1TSWithoutSDA::getNumberOfComponents() const
  *  \return bool - \c true if \a this->getIteration() == \a iteration && 
  *          \a this->getOrder() == \a order.
  */
-bool MEDFileField1TSWithoutSDA::isDealingTS(int iteration, int order) const
+bool MEDFileAnyTypeField1TSWithoutSDA::isDealingTS(int iteration, int order) const
 {
   return iteration==_iteration && order==_order;
 }
@@ -3590,7 +3696,7 @@ bool MEDFileField1TSWithoutSDA::isDealingTS(int iteration, int order) const
  *  \return std::pair<int,int> - a pair of the iteration number and the iteration
  *          order number.
  */
-std::pair<int,int> MEDFileField1TSWithoutSDA::getDtIt() const
+std::pair<int,int> MEDFileAnyTypeField1TSWithoutSDA::getDtIt() const
 {
   std::pair<int,int> p;
   fillIteration(p);
@@ -3603,7 +3709,7 @@ std::pair<int,int> MEDFileField1TSWithoutSDA::getDtIt() const
  *  \param [in,out] p - a pair returning the iteration number and the iteration
  *          order number.
  */
-void MEDFileField1TSWithoutSDA::fillIteration(std::pair<int,int>& p) const
+void MEDFileAnyTypeField1TSWithoutSDA::fillIteration(std::pair<int,int>& p) const
 {
   p.first=_iteration;
   p.second=_order;
@@ -3613,7 +3719,7 @@ void MEDFileField1TSWithoutSDA::fillIteration(std::pair<int,int>& p) const
  * Returns all types of spatial discretization of \a this field.
  *  \param [in,out] types - a sequence of types of \a this field.
  */
-void MEDFileField1TSWithoutSDA::fillTypesOfFieldAvailable(std::vector<TypeOfField>& types) const throw(INTERP_KERNEL::Exception)
+void MEDFileAnyTypeField1TSWithoutSDA::fillTypesOfFieldAvailable(std::vector<TypeOfField>& types) const throw(INTERP_KERNEL::Exception)
 {
   std::set<TypeOfField> types2;
   for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
@@ -3625,25 +3731,125 @@ void MEDFileField1TSWithoutSDA::fillTypesOfFieldAvailable(std::vector<TypeOfFiel
 }
 
 /*!
- * Returns info on components of \a this field.
- *  \return const std::vector<std::string>& - a sequence of strings each being an
- *          information on _i_-th component.
- */
-const std::vector<std::string>& MEDFileField1TSWithoutSDA::getInfo() const
-{
-  const DataArrayDouble *arr=getOrCreateAndGetArray();
-  return arr->getInfoOnComponents();
+ * Returns all types of spatial discretization of \a this field.
+ *  \return std::vector<TypeOfField> - a sequence of types of spatial discretization
+ *          of \a this field.
+ */
+std::vector<TypeOfField> MEDFileAnyTypeField1TSWithoutSDA::getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
+{
+  std::vector<TypeOfField> ret;
+  fillTypesOfFieldAvailable(ret);
+  return ret;
+}
+
+std::vector<std::string> MEDFileAnyTypeField1TSWithoutSDA::getPflsReallyUsed2() const
+{
+  std::vector<std::string> ret;
+  std::set<std::string> ret2;
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+    {
+      std::vector<std::string> tmp=(*it)->getPflsReallyUsed();
+      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);
+          }
+    }
+  return ret;
+}
+
+std::vector<std::string> MEDFileAnyTypeField1TSWithoutSDA::getLocsReallyUsed2() const
+{
+  std::vector<std::string> ret;
+  std::set<std::string> ret2;
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+    {
+      std::vector<std::string> tmp=(*it)->getLocsReallyUsed();
+      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);
+          }
+    }
+  return ret;
+}
+
+std::vector<std::string> MEDFileAnyTypeField1TSWithoutSDA::getPflsReallyUsedMulti2() const
+{
+  std::vector<std::string> ret;
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+    {
+      std::vector<std::string> tmp=(*it)->getPflsReallyUsedMulti();
+      ret.insert(ret.end(),tmp.begin(),tmp.end());
+    }
+  return ret;
+}
+
+std::vector<std::string> MEDFileAnyTypeField1TSWithoutSDA::getLocsReallyUsedMulti2() const
+{
+  std::vector<std::string> ret;
+  std::set<std::string> ret2;
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+    {
+      std::vector<std::string> tmp=(*it)->getLocsReallyUsedMulti();
+      ret.insert(ret.end(),tmp.begin(),tmp.end());
+    }
+  return ret;
+}
+
+void MEDFileAnyTypeField1TSWithoutSDA::changePflsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
+{
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+    (*it)->changePflsRefsNamesGen(mapOfModif);
+}
+
+void MEDFileAnyTypeField1TSWithoutSDA::changeLocsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
+{
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+    (*it)->changeLocsRefsNamesGen(mapOfModif);
 }
 
 /*!
- * Returns a mutable info on components of \a this field.
- *  \return std::vector<std::string>& - a sequence of strings each being an
- *          information on _i_-th component.
+ * Returns all attributes of parts of \a this field lying on a given mesh.
+ * Each part differs from other ones by a type of supporting mesh entity. The _i_-th
+ * item of every of returned sequences refers to the _i_-th part of \a this field.
+ * Thus all sequences returned by this method are of the same length equal to number
+ * of different types of supporting entities.<br>
+ * A field part can include sub-parts with several different spatial discretizations,
+ * \ref ParaMEDMEM::ON_CELLS "ON_CELLS" and \ref ParaMEDMEM::ON_GAUSS_PT "ON_GAUSS_PT"
+ * for example. Hence, some of the returned sequences contains nested sequences, and an item
+ * of a nested sequence corresponds to a type of spatial discretization.<br>
+ * This method allows for iteration over MEDFile DataStructure without any overhead.
+ *  \param [in] mname - a name of a mesh of interest. It can be \c NULL, which is valid
+ *          for the case with only one underlying mesh. (Actually, the number of meshes is
+ *          not checked if \a mname == \c NULL).
+ *  \param [in,out] types - a sequence of types of underlying mesh entities. A type per
+ *          a field part is returned. 
+ *  \param [in,out] typesF - a sequence of sequences of types of spatial discretizations.
+ *          This sequence is of the same length as \a types. 
+ *  \param [in,out] pfls - a sequence returning a profile name per each type of spatial
+ *          discretization. A profile name can be empty.
+ *          Length of this and of nested sequences is the same as that of \a typesF.
+ *  \param [in,out] locs - a sequence returning a localization name per each type of spatial
+ *          discretization. A localization name can be empty.
+ *          Length of this and of nested sequences is the same as that of \a typesF.
+ *  \return std::vector< std::vector< std::pair<int,int> > > - a sequence holding a range
+ *          of ids of tuples within the data array, per each type of spatial
+ *          discretization within one mesh entity type. 
+ *          Length of this and of nested sequences is the same as that of \a typesF.
+ *  \throw If no field is lying on \a mname.
  */
-std::vector<std::string>& MEDFileField1TSWithoutSDA::getInfo()
+std::vector< std::vector< std::pair<int,int> > > MEDFileAnyTypeField1TSWithoutSDA::getFieldSplitedByType(const char *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 throw(INTERP_KERNEL::Exception)
 {
-  DataArrayDouble *arr=getOrCreateAndGetArray();
-  return arr->getInfoOnComponents();
+  int meshId=0;
+  if(mname)
+    meshId=getMeshIdFromMeshName(mname);
+  else
+    if(_field_per_mesh.empty())
+      throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getFieldSplitedByType : This is empty !");
+  return _field_per_mesh[meshId]->getFieldSplitedByType(types,typesF,pfls,locs);
 }
 
 /*!
@@ -3687,7 +3893,7 @@ std::vector<std::string>& MEDFileField1TSWithoutSDA::getInfo()
  *  \return int - the maximal absolute dimension of elements \a this fields lies on.
  *  \throw If no field is lying on \a mname.
  */
-int MEDFileField1TSWithoutSDA::getNonEmptyLevels(const char *mname, std::vector<int>& levs) const throw(INTERP_KERNEL::Exception)
+int MEDFileAnyTypeField1TSWithoutSDA::getNonEmptyLevels(const char *mname, std::vector<int>& levs) const throw(INTERP_KERNEL::Exception)
 {
   levs.clear();
   int meshId=getMeshIdFromMeshName(mname);
@@ -3714,228 +3920,139 @@ int MEDFileField1TSWithoutSDA::getNonEmptyLevels(const char *mname, std::vector<
 }
 
 /*!
- * Returns all types of spatial discretization of \a this field.
- *  \return std::vector<TypeOfField> - a sequence of types of spatial discretization
- *          of \a this field.
+ * \param [in] mName specifies the underlying mesh name. This value can be pointer 0 for users that do not deal with fields on multi mesh.
+ * \param [in] typ is for the geometric cell type (or INTERP_KERNEL::NORM_ERROR for node field) entry to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set.
+ * \param [in] locId is the localization id to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set. It corresponds to the position of 
+ *             \c pfls[std::distance(types.begin(),std::find(types.begin(),typ)] vector in MEDFileField1TSWithoutSDA::getFieldSplitedByType. For non gausspoints field users, the value is 0.
  */
-std::vector<TypeOfField> MEDFileField1TSWithoutSDA::getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
+MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TSWithoutSDA::getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) throw(INTERP_KERNEL::Exception)
 {
-  std::vector<TypeOfField> ret;
-  fillTypesOfFieldAvailable(ret);
-  return ret;
+  int mid=getMeshIdFromMeshName(mName);
+  return _field_per_mesh[mid]->getLeafGivenTypeAndLocId(typ,locId);
 }
 
 /*!
- * Returns all attributes of parts of \a this field lying on a given mesh.
- * Each part differs from other ones by a type of supporting mesh entity. The _i_-th
- * item of every of returned sequences refers to the _i_-th part of \a this field.
- * Thus all sequences returned by this method are of the same length equal to number
- * of different types of supporting entities.<br>
- * A field part can include sub-parts with several different spatial discretizations,
- * \ref ParaMEDMEM::ON_CELLS "ON_CELLS" and \ref ParaMEDMEM::ON_GAUSS_PT "ON_GAUSS_PT"
- * for example. Hence, some of the returned sequences contains nested sequences, and an item
- * of a nested sequence corresponds to a type of spatial discretization.<br>
- * This method allows for iteration over MEDFile DataStructure without any overhead.
- *  \param [in] mname - a name of a mesh of interest. It can be \c NULL, which is valid
- *          for the case with only one underlying mesh. (Actually, the number of meshes is
- *          not checked if \a mname == \c NULL).
- *  \param [in,out] types - a sequence of types of underlying mesh entities. A type per
- *          a field part is returned. 
- *  \param [in,out] typesF - a sequence of sequences of types of spatial discretizations.
- *          This sequence is of the same length as \a types. 
- *  \param [in,out] pfls - a sequence returning a profile name per each type of spatial
- *          discretization. A profile name can be empty.
- *          Length of this and of nested sequences is the same as that of \a typesF.
- *  \param [in,out] locs - a sequence returning a localization name per each type of spatial
- *          discretization. A localization name can be empty.
- *          Length of this and of nested sequences is the same as that of \a typesF.
- *  \return std::vector< std::vector< std::pair<int,int> > > - a sequence holding a range
- *          of ids of tuples within the data array, per each type of spatial
- *          discretization within one mesh entity type. 
- *          Length of this and of nested sequences is the same as that of \a typesF.
- *  \throw If no field is lying on \a mname.
+ * \param [in] mName specifies the underlying mesh name. This value can be pointer 0 for users that do not deal with fields on multi mesh.
+ * \param [in] typ is for the geometric cell type (or INTERP_KERNEL::NORM_ERROR for node field) entry to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set.
+ * \param [in] locId is the localization id to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set. It corresponds to the position of 
+ *             \c pfls[std::distance(types.begin(),std::find(types.begin(),typ)] vector in MEDFileField1TSWithoutSDA::getFieldSplitedByType. For non gausspoints field users, the value is 0.
  */
-std::vector< std::vector< std::pair<int,int> > > MEDFileField1TSWithoutSDA::getFieldSplitedByType(const char *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 throw(INTERP_KERNEL::Exception)
+const MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TSWithoutSDA::getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const throw(INTERP_KERNEL::Exception)
 {
-  int meshId=0;
-  if(mname)
-    meshId=getMeshIdFromMeshName(mname);
-  else
-    if(_field_per_mesh.empty())
-      throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getFieldSplitedByType : This is empty !");
-  return _field_per_mesh[meshId]->getFieldSplitedByType(types,typesF,pfls,locs);
+  int mid=getMeshIdFromMeshName(mName);
+  return _field_per_mesh[mid]->getLeafGivenTypeAndLocId(typ,locId);
 }
 
 /*!
- * Returns all attributes and values of parts of \a this field lying on a given mesh.
- * Each part differs from other ones by a type of supporting mesh entity. The _i_-th
- * item of every of returned sequences refers to the _i_-th part of \a this field.
- * Thus all sequences returned by this method are of the same length equal to number
- * of different types of supporting entities.<br>
- * A field part can include sub-parts with several different spatial discretizations,
- * \ref ParaMEDMEM::ON_CELLS "ON_CELLS" and \ref ParaMEDMEM::ON_GAUSS_PT "ON_GAUSS_PT"
- * for example. Hence, some of the returned sequences contains nested sequences, and an item
- * of a nested sequence corresponds to a type of spatial discretization.<br>
- * This method allows for iteration over MEDFile DataStructure with a reduced overhead.
- * The overhead is due to selecting values into new instances of DataArrayDouble.
- *  \param [in] mname - a name of a mesh of interest. It can be \c NULL, which is valid
- *          for the case with only one underlying mesh. (Actually, the number of meshes is
- *          not checked if \a mname == \c NULL).
- *  \param [in,out] types - a sequence of types of underlying mesh entities. A type per
- *          a field part is returned. 
- *  \param [in,out] typesF - a sequence of sequences of types of spatial discretizations.
- *          A field part can include sub-parts with several different spatial discretizations,
- *          \ref ParaMEDMEM::ON_CELLS "ON_CELLS" and 
- *          \ref ParaMEDMEM::ON_GAUSS_PT "ON_GAUSS_PT" for example.
- *          This sequence is of the same length as \a types. 
- *  \param [in,out] pfls - a sequence returning a profile name per each type of spatial
- *          discretization. A profile name can be empty.
- *          Length of this and of nested sequences is the same as that of \a typesF.
- *  \param [in,out] locs - a sequence returning a localization name per each type of spatial
- *          discretization. A localization name can be empty.
- *          Length of this and of nested sequences is the same as that of \a typesF.
- *  \return std::vector< std::vector<DataArrayDouble *> > - a sequence holding arrays of values
- *          per each type of spatial discretization within one mesh entity type.
- *          The caller is to delete each DataArrayDouble using decrRef() as it is no more needed.
- *          Length of this and of nested sequences is the same as that of \a typesF.
- *  \throw If no field is lying on \a mname.
+ * \param [in] mName specifies the underlying mesh name. This value can be pointer 0 for users that do not deal with fields on multi mesh.
  */
-std::vector< std::vector<DataArrayDouble *> > MEDFileField1TSWithoutSDA::getFieldSplitedByType2(const char *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 throw(INTERP_KERNEL::Exception)
+int MEDFileAnyTypeField1TSWithoutSDA::getMeshIdFromMeshName(const char *mName) const throw(INTERP_KERNEL::Exception)
 {
-  int meshId=0;
-  if(mname)
-    meshId=getMeshIdFromMeshName(mname);
-  else
-    if(_field_per_mesh.empty())
-      throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getFieldSplitedByType : This is empty !");
-  std::vector< std::vector< std::pair<int,int> > > ret0=_field_per_mesh[meshId]->getFieldSplitedByType(types,typesF,pfls,locs);
-  int nbOfRet=ret0.size();
-  std::vector< std::vector<DataArrayDouble *> > ret(nbOfRet);
-  for(int i=0;i<nbOfRet;i++)
-    {
-      const std::vector< std::pair<int,int> >& p=ret0[i];
-      int nbOfRet1=p.size();
-      ret[i].resize(nbOfRet1);
-      for(int j=0;j<nbOfRet1;j++)
-        {
-          DataArrayDouble *tmp=_arr->selectByTupleId2(p[j].first,p[j].second,1);
-          ret[i][j]=tmp;
-        }
-    }
-  return ret;
+  if(_field_per_mesh.empty())
+    throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getMeshIdFromMeshName : No field set !");
+  if(mName==0)
+    return 0;
+  std::string mName2(mName);
+  int ret=0;
+  std::vector<std::string> msg;
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++,ret++)
+    if(mName2==(*it)->getMeshName())
+      return ret;
+    else
+      msg.push_back((*it)->getMeshName());
+  std::ostringstream oss; oss << "MEDFileField1TSWithoutSDA::getMeshIdFromMeshName : No such mesh \"" << mName2 << "\" as underlying mesh of field \"" << getName() << "\" !\n";
+  oss << "Possible meshes are : ";
+  for(std::vector<std::string>::const_iterator it2=msg.begin();it2!=msg.end();it2++)
+    oss << "\"" << (*it2) << "\" ";
+  throw INTERP_KERNEL::Exception(oss.str().c_str());
 }
 
-void MEDFileField1TSWithoutSDA::finishLoading(med_idt fid) throw(INTERP_KERNEL::Exception)
+int MEDFileAnyTypeField1TSWithoutSDA::addNewEntryIfNecessary(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception)
 {
-  med_int numdt,numit;
-  med_float dt;
-  med_int nmesh;
-  med_bool localMesh;
-  med_int meshnumdt,meshnumit;
-  INTERP_KERNEL::AutoPtr<char> meshName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
-  MEDfieldComputingStepInfo(fid,getName().c_str(),_csit,&numdt,&numit,&_dt);
-  MEDfield23ComputingStepMeshInfo(fid,getName().c_str(),_csit,&numdt,&numit,&dt,&nmesh,meshName,&localMesh,&meshnumdt,&meshnumit);
-  if(_iteration!=numdt || _order!=numit)
-    throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::finishLoading : unexpected exception internal error !");
-  _field_per_mesh.resize(nmesh);
-  for(int i=0;i<nmesh;i++)
-    _field_per_mesh[i]=MEDFileFieldPerMesh::NewOnRead(fid,this,i+1,meshnumdt,meshnumit);
-  int start=0;
-  for(int i=0;i<nmesh;i++)
+  if(!mesh)
+    throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::addNewEntryIfNecessary : input mesh is NULL !");
+  std::string tmp(mesh->getName());
+  if(tmp.empty())
+    throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::addNewEntryIfNecessary : empty mesh name ! unsupported by MED file !");
+  std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();
+  int i=0;
+  for(;it!=_field_per_mesh.end();it++,i++)
     {
-      _field_per_mesh[i]->prepareLoading(fid,start);
-    }
-  getOrCreateAndGetArray()->alloc(start,getNumberOfComponents());
-  for(int i=0;i<nmesh;i++)
-    {
-      _field_per_mesh[i]->finishLoading(fid,_field_type);
+      if((*it)->getMeshName()==tmp)
+        return i;
     }
+  int sz=_field_per_mesh.size();
+  _field_per_mesh.resize(sz+1);
+  _field_per_mesh[sz]=MEDFileFieldPerMesh::New(this,mesh);
+  return sz;
 }
 
-std::vector<std::string> MEDFileField1TSWithoutSDA::getPflsReallyUsed2() const
+bool MEDFileAnyTypeField1TSWithoutSDA::renumberEntitiesLyingOnMesh(const char *meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N,
+                                                            MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
 {
-  std::vector<std::string> ret;
-  std::set<std::string> ret2;
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+  bool ret=false;
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
     {
-      std::vector<std::string> tmp=(*it)->getPflsReallyUsed();
-      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);
-          }
+      MEDFileFieldPerMesh *fpm(*it);
+      if(fpm)
+        ret=fpm->renumberEntitiesLyingOnMesh(meshName,oldCode,newCode,renumO2N,glob) || ret;
     }
   return ret;
 }
 
-std::vector<std::string> MEDFileField1TSWithoutSDA::getLocsReallyUsed2() const
+void MEDFileAnyTypeField1TSWithoutSDA::writeLL(med_idt fid, const MEDFileWritable& opts, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception)
 {
-  std::vector<std::string> ret;
-  std::set<std::string> ret2;
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
-    {
-      std::vector<std::string> tmp=(*it)->getLocsReallyUsed();
-      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);
-          }
-    }
-  return ret;
+  if(_field_per_mesh.empty())
+    throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::writeLL : empty field !");
+  if(_field_per_mesh.size()>1)
+    throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::writeLL : In MED3.0 mode in writting mode only ONE underlying mesh supported !");
+  _field_per_mesh[0]->copyOptionsFrom(opts);
+  _field_per_mesh[0]->writeLL(fid,nasc);
 }
 
-std::vector<std::string> MEDFileField1TSWithoutSDA::getPflsReallyUsedMulti2() const
+void MEDFileAnyTypeField1TSWithoutSDA::finishLoading(med_idt fid, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception)
 {
-  std::vector<std::string> ret;
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+  med_int numdt,numit;
+  med_float dt;
+  med_int nmesh;
+  med_bool localMesh;
+  med_int meshnumdt,meshnumit;
+  INTERP_KERNEL::AutoPtr<char> meshName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+  MEDfieldComputingStepInfo(fid,nasc.getName().c_str(),_csit,&numdt,&numit,&_dt);
+  MEDfield23ComputingStepMeshInfo(fid,nasc.getName().c_str(),_csit,&numdt,&numit,&dt,&nmesh,meshName,&localMesh,&meshnumdt,&meshnumit);
+  if(_iteration!=numdt || _order!=numit)
+    throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::finishLoading : unexpected exception internal error !");
+  _field_per_mesh.resize(nmesh);
+  for(int i=0;i<nmesh;i++)
+    _field_per_mesh[i]=MEDFileFieldPerMesh::NewOnRead(fid,this,i+1,meshnumdt,meshnumit,nasc);//tony
+  int start=0;
+  for(int i=0;i<nmesh;i++)
     {
-      std::vector<std::string> tmp=(*it)->getPflsReallyUsedMulti();
-      ret.insert(ret.end(),tmp.begin(),tmp.end());
+      _field_per_mesh[i]->prepareLoading(fid,start,nasc);
     }
-  return ret;
-}
-
-std::vector<std::string> MEDFileField1TSWithoutSDA::getLocsReallyUsedMulti2() const
-{
-  std::vector<std::string> ret;
-  std::set<std::string> ret2;
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+  getOrCreateAndGetArray()->alloc(start,getNumberOfComponents());
+  for(int i=0;i<nmesh;i++)
     {
-      std::vector<std::string> tmp=(*it)->getLocsReallyUsedMulti();
-      ret.insert(ret.end(),tmp.begin(),tmp.end());
+      _field_per_mesh[i]->finishLoading(fid,nasc);
     }
-  return ret;
-}
-
-void MEDFileField1TSWithoutSDA::changePflsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
-{
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
-    (*it)->changePflsRefsNamesGen(mapOfModif);
-}
-
-void MEDFileField1TSWithoutSDA::changeLocsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
-{
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
-    (*it)->changeLocsRefsNamesGen(mapOfModif);
 }
 
-void MEDFileField1TSWithoutSDA::writeLL(med_idt fid, const MEDFileWritable& opts) const throw(INTERP_KERNEL::Exception)
+std::size_t MEDFileAnyTypeField1TSWithoutSDA::getHeapMemorySize() const
 {
-  if(_field_per_mesh.empty())
-    throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::writeLL : empty field !");
-  if(_field_per_mesh.size()>1)
-    throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::writeLL : In MED3.0 mode in writting mode only ONE underlying mesh supported !");
-  _field_per_mesh[0]->copyOptionsFrom(opts);
-  _field_per_mesh[0]->writeLL(fid);
+  std::size_t ret=_dt_unit.capacity()+_field_per_mesh.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh >);
+  if(getUndergroundDataArray())
+    ret+=getUndergroundDataArray()->getHeapMemorySize();
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+    ret+=(*it)->getHeapMemorySize();
+  return 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. 
- *  \param [in] field - the field to add to \a this.
+ *  \param [in] field - the field to add to \a this. The array of field \a field is ignored
+ *  \param [in] arr - the array of values.
  *  \param [in,out] glob - the global data where profiles and localization present in
  *          \a field, if any, are added.
  *  \throw If the name of \a field is empty.
@@ -3945,21 +4062,21 @@ void MEDFileField1TSWithoutSDA::writeLL(med_idt fid, const MEDFileWritable& opts
  *  \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 MEDFileField1TSWithoutSDA::setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
+void MEDFileAnyTypeField1TSWithoutSDA::setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception)
 {
   const MEDCouplingMesh *mesh=field->getMesh();
   //
   TypeOfField type=field->getTypeOfField();
   std::vector<DataArrayInt *> dummy;
-  int start=copyTinyInfoFrom(field);
+  int start=copyTinyInfoFrom(field,arr);
   int pos=addNewEntryIfNecessary(mesh);
   if(type!=ON_NODES)
     {
       std::vector<int> code=MEDFileField1TSWithoutSDA::CheckSBTMesh(mesh);
-      _field_per_mesh[pos]->assignFieldNoProfileNoRenum(start,code,field,glob);
+      _field_per_mesh[pos]->assignFieldNoProfileNoRenum(start,code,field,arr,glob,nasc);
     }
   else
-    _field_per_mesh[pos]->assignNodeFieldNoProfile(start,field,glob);
+    _field_per_mesh[pos]->assignNodeFieldNoProfile(start,field,arr,glob);
 }
 
 /*!
@@ -3970,7 +4087,8 @@ void MEDFileField1TSWithoutSDA::setFieldNoProfileSBT(const MEDCouplingFieldDoubl
  * is not prescribed; this method permutes field values to have them sorted by element
  * type as required for writing to MED file. A new profile is added only if no equal
  * profile is missing. 
- *  \param [in] field - the field to add to \a this.
+ *  \param [in] field - the field to add to \a this. The field double values 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.
  *  \param [in] profile - ids of mesh entities on which corresponding field values lie.
@@ -3984,10 +4102,10 @@ void MEDFileField1TSWithoutSDA::setFieldNoProfileSBT(const MEDCouplingFieldDoubl
  *  \throw If elements in \a mesh are not in the order suitable for writing to the MED file.
  *  \sa setFieldNoProfileSBT()
  */
-void MEDFileField1TSWithoutSDA::setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
+void MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception)
 {
   TypeOfField type=field->getTypeOfField();
-  int start=copyTinyInfoFrom(field);
+  int start=copyTinyInfoFrom(field,arrOfVals);
   std::vector<DataArrayInt *> idsInPflPerType;
   std::vector<DataArrayInt *> idsPerType;
   std::vector<int> code,code2;
@@ -4005,15 +4123,101 @@ void MEDFileField1TSWithoutSDA::setFieldProfile(const MEDCouplingFieldDouble *fi
         idsPerType2[i]=idsPerType[i];
       //
       int pos=addNewEntryIfNecessary(m);
-      _field_per_mesh[pos]->assignFieldProfile(start,profile,code,code2,idsInPflPerType,idsPerType,field,m,glob);
+      _field_per_mesh[pos]->assignFieldProfile(start,profile,code,code2,idsInPflPerType,idsPerType,field,arrOfVals,m,glob,nasc);
     }
   else
     {
       int pos=addNewEntryIfNecessary(m);
-      _field_per_mesh[pos]->assignNodeFieldProfile(start,profile,field,glob);
+      _field_per_mesh[pos]->assignNodeFieldProfile(start,profile,field,arrOfVals,glob,nasc);
+    }
+}
+
+/*!
+ * Copies tiny info and allocates \a this->_arr instance of DataArrayDouble to
+ * append data of a given MEDCouplingFieldDouble. So that the size of \a this->_arr becomes
+ * larger by the size of \a field. Returns an id of the first not filled
+ * tuple of \a this->_arr.
+ *  \param [in] field - the field to copy the info on components and the name from.
+ *  \return int - the id of first not initialized tuple of \a this->_arr.
+ *  \throw If the name of \a field is empty.
+ *  \throw If the data array of \a field is not set.
+ *  \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) throw(INTERP_KERNEL::Exception)
+{
+  if(!field)
+    throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::copyTinyInfoFrom : input field is NULL !");
+  std::string name(field->getName());
+  setName(name.c_str());
+  setDtUnit(field->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 !");
+  _dt=field->getTime(_iteration,_order);
+  int nbOfComponents=arr->getNumberOfComponents();
+  getOrCreateAndGetArray()->setInfoAndChangeNbOfCompo(arr->getInfoOnComponents());
+  if(!getOrCreateAndGetArray()->isAllocated())
+    {
+      getOrCreateAndGetArray()->alloc(arr->getNumberOfTuples(),arr->getNumberOfComponents());
+      return 0;
+    }
+  else
+    {
+      int oldNbOfTuples=getOrCreateAndGetArray()->getNumberOfTuples();
+      int newNbOfTuples=oldNbOfTuples+arr->getNumberOfTuples();
+      MEDCouplingAutoRefCountObjectPtr<DataArray> tmp=createNewEmptyDataArrayInstance();
+      tmp->alloc(newNbOfTuples,nbOfComponents);
+      tmp->copyStringInfoFrom(*getOrCreateAndGetArray());
+      DataArray *arrr=getOrCreateAndGetArray();      
+      tmp->setContigPartOfSelectedValues2(0,arrr,0,oldNbOfTuples,1);
+      setArray(tmp);
+      return oldNbOfTuples;
     }
 }
 
+/*!
+ * Returns number of components in \a this field
+ *  \return int - the number of components.
+ */
+int MEDFileAnyTypeField1TSWithoutSDA::getNumberOfComponents() const
+{
+  return getOrCreateAndGetArray()->getNumberOfComponents();
+}
+
+/*!
+ * Change info on components in \a this.
+ * \throw If size of \a infos is not equal to the number of components already in \a this.
+ */
+void MEDFileAnyTypeField1TSWithoutSDA::setInfo(const std::vector<std::string>& infos) throw(INTERP_KERNEL::Exception)
+{
+  DataArray *arr=getOrCreateAndGetArray();
+  arr->setInfoOnComponents(infos);//will throw an exception if number of components mimatches
+}
+
+/*!
+ * Returns info on components of \a this field.
+ *  \return const std::vector<std::string>& - a sequence of strings each being an
+ *          information on _i_-th component.
+ */
+const std::vector<std::string>& MEDFileAnyTypeField1TSWithoutSDA::getInfo() const
+{
+  const DataArray *arr=getOrCreateAndGetArray();
+  return arr->getInfoOnComponents();
+}
+
+/*!
+ * Returns a mutable info on components of \a this field.
+ *  \return std::vector<std::string>& - a sequence of strings each being an
+ *          information on _i_-th component.
+ */
+std::vector<std::string>& MEDFileAnyTypeField1TSWithoutSDA::getInfo()
+{
+  DataArray *arr=getOrCreateAndGetArray();
+  return arr->getInfoOnComponents();
+}
+
 /*!
  * Returns a new MEDCouplingFieldDouble of given type lying on a given support.
  *  \param [in] type - a spatial discretization of the new field.
@@ -4035,14 +4239,14 @@ void MEDFileField1TSWithoutSDA::setFieldProfile(const MEDCouplingFieldDouble *fi
  *  \throw If no field of \a this is lying on the mesh \a mName.
  *  \throw If no field values of the given \a type or given \a meshDimRelToMax are available.
  */
-MEDCouplingFieldDouble *MEDFileField1TSWithoutSDA::getFieldAtLevel(TypeOfField type, int meshDimRelToMax, const char *mName, int renumPol, const MEDFileFieldGlobsReal *glob) const throw(INTERP_KERNEL::Exception)
+MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldAtLevel(TypeOfField type, int meshDimRelToMax, const char *mName, int renumPol, const MEDFileFieldGlobsReal *glob, MEDCouplingAutoRefCountObjectPtr<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception)
 {
   MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm;
   if(mName==0)
     mm=MEDFileMesh::New(glob->getFileName(),getMeshName().c_str(),getMeshIteration(),getMeshOrder());
   else
     mm=MEDFileMesh::New(glob->getFileName(),mName,getMeshIteration(),getMeshOrder());
-  return MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,glob,mm);
+  return MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,glob,mm,arrOut,nasc);
 }
 
 /*!
@@ -4065,14 +4269,14 @@ MEDCouplingFieldDouble *MEDFileField1TSWithoutSDA::getFieldAtLevel(TypeOfField t
  *  \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.
  */
-MEDCouplingFieldDouble *MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
+MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDFileMesh *mesh, MEDCouplingAutoRefCountObjectPtr<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception)
 {
   MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> m=mesh->getGenMeshAtLevel(meshDimRelToMax,false);
   const DataArrayInt *d=mesh->getNumberFieldAtLevel(meshDimRelToMax);
   const DataArrayInt *e=mesh->getNumberFieldAtLevel(1);
   if(meshDimRelToMax==1)
     (static_cast<MEDCouplingUMesh *>((MEDCouplingMesh *)m))->setMeshDimension(0);
-  return MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel(type,renumPol,glob,m,d,e);
+  return MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(type,renumPol,glob,m,d,e,arrOut,nasc);
 }
 
 /*!
@@ -4095,7 +4299,7 @@ MEDCouplingFieldDouble *MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfF
  *  \throw If there are no mesh entities in the mesh.
  *  \throw If no field values of the given \a type are available.
  */
-MEDCouplingFieldDouble *MEDFileField1TSWithoutSDA::getFieldAtTopLevel(TypeOfField type, const char *mName, int renumPol, const MEDFileFieldGlobsReal *glob) const throw(INTERP_KERNEL::Exception)
+MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldAtTopLevel(TypeOfField type, const char *mName, int renumPol, const MEDFileFieldGlobsReal *glob, MEDCouplingAutoRefCountObjectPtr<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception)
 {
    MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm;
   if(mName==0)
@@ -4104,7 +4308,7 @@ MEDCouplingFieldDouble *MEDFileField1TSWithoutSDA::getFieldAtTopLevel(TypeOfFiel
     mm=MEDFileMesh::New(glob->getFileName(),mName,getMeshIteration(),getMeshOrder());
   int absDim=getDimension();
   int meshDimRelToMax=absDim-mm->getMeshDimension();
-  return MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,glob,mm);
+  return MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,glob,mm,arrOut,nasc);
 }
 
 /*!
@@ -4129,12 +4333,12 @@ MEDCouplingFieldDouble *MEDFileField1TSWithoutSDA::getFieldAtTopLevel(TypeOfFiel
  *  \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.
  */
-MEDCouplingFieldDouble *MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayInt *cellRenum, const DataArrayInt *nodeRenum) const throw(INTERP_KERNEL::Exception)
+MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayInt *cellRenum, const DataArrayInt *nodeRenum, MEDCouplingAutoRefCountObjectPtr<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception)
 {
   static const char msg1[]="MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel : request for a renumbered field following mesh numbering whereas it is a profile field !";
   int meshId=getMeshIdFromMeshName(mesh->getName());
   bool isPfl=false;
-  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=_field_per_mesh[meshId]->getFieldOnMeshAtLevel(type,glob,mesh,isPfl);
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=_field_per_mesh[meshId]->getFieldOnMeshAtLevel(type,glob,mesh,isPfl,arrOut,nasc);
   switch(renumPol)
     {
     case 0:
@@ -4156,7 +4360,12 @@ MEDCouplingFieldDouble *MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfF
                 oss << "\"" << getName() << "\" has partial renumbering (some geotype has no renumber) !";
                 throw INTERP_KERNEL::Exception(oss.str().c_str());
               }
-            ret->renumberCells(cellRenum->getConstPointer(),true);
+            MEDCouplingFieldDiscretization *disc=ret->getDiscretization();
+            if(!disc) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel : internal error, no discretization on field !");
+            std::vector<DataArray *> arrOut2(1,arrOut);
+            // 2 following lines replace ret->renumberCells(cellRenum->getConstPointer()) if not DataArrayDouble
+            disc->renumberArraysForCell(ret->getMesh(),arrOut2,cellRenum->getConstPointer(),true);
+            (const_cast<MEDCouplingMesh*>(ret->getMesh()))->renumberCells(cellRenum->getConstPointer(),true);
           }
         if(renumPol==1)
           return ret.retn();
@@ -4171,10 +4380,12 @@ MEDCouplingFieldDouble *MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfF
             if((int)nodeRenum->getNbOfElems()!=mesh->getNumberOfNodes())
               {
                 std::ostringstream oss; oss << "MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel : Request of simple renumbering but it seems that underlying mesh \"" << mesh->getName() << "\" of requested field ";
-                oss << "\"" << getName() << "\" not defined on all nodes !";
+                oss << "\"" << nasc.getName() << "\" not defined on all nodes !";
                 throw INTERP_KERNEL::Exception(oss.str().c_str());
               }
             MEDCouplingAutoRefCountObjectPtr<DataArrayInt> nodeRenumSafe=nodeRenum->checkAndPreparePermutation();
+            if(!dynamic_cast<DataArrayDouble *>((DataArray *)arrOut))
+              throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel : node renumbering not implemented for not double DataArrays !");
             ret->renumberNodes(nodeRenumSafe->getConstPointer());
           }
         return ret.retn();
@@ -4200,145 +4411,235 @@ MEDCouplingFieldDouble *MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfF
  *  \throw If no field of \a this is lying on \a mesh.
  *  \throw If no field values of the given \a type are available.
  */
-DataArrayDouble *MEDFileField1TSWithoutSDA::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob) const throw(INTERP_KERNEL::Exception)
+DataArray *MEDFileAnyTypeField1TSWithoutSDA::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception)
 {
   MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> m=mesh->getGenMeshAtLevel(meshDimRelToMax);
   int meshId=getMeshIdFromMeshName(mesh->getName());
-  return _field_per_mesh[meshId]->getFieldOnMeshAtLevelWithPfl(type,m,pfl,glob);
+  MEDCouplingAutoRefCountObjectPtr<DataArray> ret=_field_per_mesh[meshId]->getFieldOnMeshAtLevelWithPfl(type,m,pfl,glob,nasc);
+  ret->setName(nasc.getName().c_str());
+  return ret.retn();
 }
 
+//= MEDFileField1TSWithoutSDA
+
 /*!
- * 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
- * values. This method is quite unusable if there is more than a nodal field or a cell
- * field on single geometric cell type. 
- *  \return DataArrayDouble * - the pointer to the field values array.
+ * Throws if a given value is not a valid (non-extended) relative dimension.
+ *  \param [in] meshDimRelToMax - the relative dimension value.
+ *  \throw If \a meshDimRelToMax > 0.
  */
-DataArrayDouble *MEDFileField1TSWithoutSDA::getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
+void MEDFileField1TSWithoutSDA::CheckMeshDimRel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception)
 {
-  const DataArrayDouble *ret=_arr;
-  if(ret)
-    return const_cast<DataArrayDouble *>(ret);
-  else
-    return 0;
+  if(meshDimRelToMax>0)
+    throw INTERP_KERNEL::Exception("CheckMeshDimRel : This is a meshDimRel not a meshDimRelExt ! So value should be <=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 getUndergroundDataArray()
+ * Checks if elements of a given mesh are in the order suitable for writing 
+ * to the MED file. If this is not so, an exception is thrown. In a case of success, returns a
+ * vector describing types of elements and their number.
+ *  \param [in] mesh - the mesh to check.
+ *  \return std::vector<int> - a vector holding for each element type (1) item of
+ *          INTERP_KERNEL::NormalizedCellType, (2) number of elements, (3) -1. 
+ *          These values are in full-interlace mode.
+ *  \throw If elements in \a mesh are not in the order suitable for writing to the MED file.
  */
-DataArrayDouble *MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception)
-{
-  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 !");
-  return _field_per_mesh[0]->getUndergroundDataArrayExt(entries);
-}
-
-MEDFileField1TSWithoutSDA::MEDFileField1TSWithoutSDA(const char *fieldName, int csit, int fieldtype, int iteration, int order,
-                                                     const std::vector<std::string>& infos):_iteration(iteration),_order(order),_csit(csit),_field_type(fieldtype)
-{
-  DataArrayDouble *arr=getOrCreateAndGetArray();
-  arr->setName(fieldName);
-  arr->setInfoAndChangeNbOfCompo(infos);
-}
-
-MEDFileField1TSWithoutSDA::MEDFileField1TSWithoutSDA():_csit(-1),_field_type(-1)
-{
-}
-
-int MEDFileField1TSWithoutSDA::addNewEntryIfNecessary(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception)
+std::vector<int> MEDFileField1TSWithoutSDA::CheckSBTMesh(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception)
 {
-  std::string tmp(mesh->getName());
-  if(tmp.empty())
-    throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::addNewEntryIfNecessary : empty mesh name ! unsupported by MED file !");
-  std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();
+  if(!mesh)
+    throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::CheckSBTMesh : input mesh is NULL !");
+  std::set<INTERP_KERNEL::NormalizedCellType> geoTypes=mesh->getAllGeoTypes();
+  int nbOfTypes=geoTypes.size();
+  std::vector<int> code(3*nbOfTypes);
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr1=DataArrayInt::New();
+  arr1->alloc(nbOfTypes,1);
+  int *arrPtr=arr1->getPointer();
+  std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator it=geoTypes.begin();
+  for(int i=0;i<nbOfTypes;i++,it++)
+    arrPtr[i]=std::distance(typmai2,std::find(typmai2,typmai2+MED_N_CELL_FIXED_GEO,*it));
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr2=arr1->checkAndPreparePermutation();
+  const int *arrPtr2=arr2->getConstPointer();
   int i=0;
-  for(;it!=_field_per_mesh.end();it++,i++)
+  for(it=geoTypes.begin();it!=geoTypes.end();it++,i++)
     {
-      if((*it)->getMeshName()==tmp)
-        return i;
+      int pos=arrPtr2[i];
+      int nbCells=mesh->getNumberOfCellsWithType(*it);
+      code[3*pos]=(int)(*it);
+      code[3*pos+1]=nbCells;
+      code[3*pos+2]=-1;//no profiles
     }
-  int sz=_field_per_mesh.size();
-  _field_per_mesh.resize(sz+1);
-  _field_per_mesh[sz]=MEDFileFieldPerMesh::New(this,mesh);
-  return sz;
+  std::vector<const DataArrayInt *> idsPerType;//no profiles
+  DataArrayInt *da=mesh->checkTypeConsistencyAndContig(code,idsPerType);
+  if(da)
+    {
+      da->decrRef();
+      throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::CheckSBTMesh : underlying mesh is not sorted by type as MED file expects !");
+    }
+  return code;
 }
 
-/*!
- * \param [in] mName specifies the underlying mesh name. This value can be pointer 0 for users that do not deal with fields on multi mesh.
- */
-int MEDFileField1TSWithoutSDA::getMeshIdFromMeshName(const char *mName) const throw(INTERP_KERNEL::Exception)
+MEDFileField1TSWithoutSDA *MEDFileField1TSWithoutSDA::New(const char *fieldName, int csit, int iteration, int order, const std::vector<std::string>& infos)
 {
-  if(_field_per_mesh.empty())
-    throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getMeshIdFromMeshName : No field set !");
-  if(mName==0)
-    return 0;
-  std::string mName2(mName);
-  int ret=0;
-  std::vector<std::string> msg;
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++,ret++)
-    if(mName2==(*it)->getMeshName())
-      return ret;
-    else
-      msg.push_back((*it)->getMeshName());
-  std::ostringstream oss; oss << "MEDFileField1TSWithoutSDA::getMeshIdFromMeshName : No such mesh \"" << mName2 << "\" as underlying mesh of field \"" << getName() << "\" !\n";
-  oss << "Possible meshes are : ";
-  for(std::vector<std::string>::const_iterator it2=msg.begin();it2!=msg.end();it2++)
-    oss << "\"" << (*it2) << "\" ";
-  throw INTERP_KERNEL::Exception(oss.str().c_str());
+  return new MEDFileField1TSWithoutSDA(fieldName,csit,iteration,order,infos);
 }
 
 /*!
- * \param [in] mName specifies the underlying mesh name. This value can be pointer 0 for users that do not deal with fields on multi mesh.
- * \param [in] typ is for the geometric cell type (or INTERP_KERNEL::NORM_ERROR for node field) entry to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set.
- * \param [in] locId is the localization id to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set. It corresponds to the position of 
- *             \c pfls[std::distance(types.begin(),std::find(types.begin(),typ)] vector in MEDFileField1TSWithoutSDA::getFieldSplitedByType. For non gausspoints field users, the value is 0.
+ * Returns all attributes and values of parts of \a this field lying on a given mesh.
+ * Each part differs from other ones by a type of supporting mesh entity. The _i_-th
+ * item of every of returned sequences refers to the _i_-th part of \a this field.
+ * Thus all sequences returned by this method are of the same length equal to number
+ * of different types of supporting entities.<br>
+ * A field part can include sub-parts with several different spatial discretizations,
+ * \ref ParaMEDMEM::ON_CELLS "ON_CELLS" and \ref ParaMEDMEM::ON_GAUSS_PT "ON_GAUSS_PT"
+ * for example. Hence, some of the returned sequences contains nested sequences, and an item
+ * of a nested sequence corresponds to a type of spatial discretization.<br>
+ * This method allows for iteration over MEDFile DataStructure with a reduced overhead.
+ * The overhead is due to selecting values into new instances of DataArrayDouble.
+ *  \param [in] mname - a name of a mesh of interest. It can be \c NULL, which is valid
+ *          for the case with only one underlying mesh. (Actually, the number of meshes is
+ *          not checked if \a mname == \c NULL).
+ *  \param [in,out] types - a sequence of types of underlying mesh entities. A type per
+ *          a field part is returned. 
+ *  \param [in,out] typesF - a sequence of sequences of types of spatial discretizations.
+ *          A field part can include sub-parts with several different spatial discretizations,
+ *          \ref ParaMEDMEM::ON_CELLS "ON_CELLS" and 
+ *          \ref ParaMEDMEM::ON_GAUSS_PT "ON_GAUSS_PT" for example.
+ *          This sequence is of the same length as \a types. 
+ *  \param [in,out] pfls - a sequence returning a profile name per each type of spatial
+ *          discretization. A profile name can be empty.
+ *          Length of this and of nested sequences is the same as that of \a typesF.
+ *  \param [in,out] locs - a sequence returning a localization name per each type of spatial
+ *          discretization. A localization name can be empty.
+ *          Length of this and of nested sequences is the same as that of \a typesF.
+ *  \return std::vector< std::vector<DataArrayDouble *> > - a sequence holding arrays of values
+ *          per each type of spatial discretization within one mesh entity type.
+ *          The caller is to delete each DataArrayDouble using decrRef() as it is no more needed.
+ *          Length of this and of nested sequences is the same as that of \a typesF.
+ *  \throw If no field is lying on \a mname.
  */
-MEDFileFieldPerMeshPerTypePerDisc *MEDFileField1TSWithoutSDA::getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) throw(INTERP_KERNEL::Exception)
+std::vector< std::vector<DataArrayDouble *> > MEDFileField1TSWithoutSDA::getFieldSplitedByType2(const char *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 throw(INTERP_KERNEL::Exception)
 {
-  int mid=getMeshIdFromMeshName(mName);
-  return _field_per_mesh[mid]->getLeafGivenTypeAndLocId(typ,locId);
+  int meshId=0;
+  if(mname)
+    meshId=getMeshIdFromMeshName(mname);
+  else
+    if(_field_per_mesh.empty())
+      throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getFieldSplitedByType : This is empty !");
+  std::vector< std::vector< std::pair<int,int> > > ret0=_field_per_mesh[meshId]->getFieldSplitedByType(types,typesF,pfls,locs);
+  int nbOfRet=ret0.size();
+  std::vector< std::vector<DataArrayDouble *> > ret(nbOfRet);
+  for(int i=0;i<nbOfRet;i++)
+    {
+      const std::vector< std::pair<int,int> >& p=ret0[i];
+      int nbOfRet1=p.size();
+      ret[i].resize(nbOfRet1);
+      for(int j=0;j<nbOfRet1;j++)
+        {
+          DataArrayDouble *tmp=_arr->selectByTupleId2(p[j].first,p[j].second,1);
+          ret[i][j]=tmp;
+        }
+    }
+  return ret;
 }
 
 /*!
- * \param [in] mName specifies the underlying mesh name. This value can be pointer 0 for users that do not deal with fields on multi mesh.
- * \param [in] typ is for the geometric cell type (or INTERP_KERNEL::NORM_ERROR for node field) entry to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set.
- * \param [in] locId is the localization id to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set. It corresponds to the position of 
- *             \c pfls[std::distance(types.begin(),std::find(types.begin(),typ)] vector in MEDFileField1TSWithoutSDA::getFieldSplitedByType. For non gausspoints field users, the value is 0.
+ * 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
+ * values. This method is quite unusable if there is more than a nodal field or a cell
+ * field on single geometric cell type. 
+ *  \return DataArrayDouble * - the pointer to the field values array.
  */
-const MEDFileFieldPerMeshPerTypePerDisc *MEDFileField1TSWithoutSDA::getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const throw(INTERP_KERNEL::Exception)
+DataArrayDouble *MEDFileField1TSWithoutSDA::getUndergroundDataArrayDouble() const throw(INTERP_KERNEL::Exception)
 {
-  int mid=getMeshIdFromMeshName(mName);
-  return _field_per_mesh[mid]->getLeafGivenTypeAndLocId(typ,locId);
+  const DataArrayDouble *ret=_arr;
+  if(ret)
+    return const_cast<DataArrayDouble *>(ret);
+  else
+    return 0;
 }
 
-std::size_t MEDFileField1TSWithoutSDA::getHeapMemorySize() const
+const char *MEDFileField1TSWithoutSDA::getTypeStr() const throw(INTERP_KERNEL::Exception)
 {
-  std::size_t ret=_dt_unit.capacity()+_field_per_mesh.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh >);
-  if((const DataArrayDouble *)_arr)
-    ret+=_arr->getHeapMemorySize();
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
-    ret+=(*it)->getHeapMemorySize();
-  return ret;
+  return TYPE_STR;
+}
+
+/*!
+ * 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
+ * values. This method is quite unusable if there is more than a nodal field or a cell
+ * field on single geometric cell type. 
+ *  \return DataArrayDouble * - the pointer to the field values array.
+ */
+DataArray *MEDFileField1TSWithoutSDA::getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
+{
+  return getUndergroundDataArrayDouble();
+}
+
+/*!
+ * 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 throw(INTERP_KERNEL::Exception)
+{
+  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 getUndergroundDataArrayDouble();
+}
+
+/*!
+ * 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()
+ */
+DataArray *MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception)
+{
+  return getUndergroundDataArrayDoubleExt(entries);
+}
+
+MEDFileField1TSWithoutSDA::MEDFileField1TSWithoutSDA(const char *fieldName, int csit, int iteration, int order,
+                                                     const std::vector<std::string>& infos):MEDFileAnyTypeField1TSWithoutSDA(fieldName,csit,iteration,order)
+{
+  DataArrayDouble *arr=getOrCreateAndGetArrayDouble();
+  arr->setInfoAndChangeNbOfCompo(infos);
+}
+
+MEDFileField1TSWithoutSDA::MEDFileField1TSWithoutSDA():MEDFileAnyTypeField1TSWithoutSDA()
+{
+}
+
+MEDFileAnyTypeField1TSWithoutSDA *MEDFileField1TSWithoutSDA::shallowCpy() const throw(INTERP_KERNEL::Exception)
+{
+  return new MEDFileField1TSWithoutSDA(*this);
 }
 
-MEDFileField1TSWithoutSDA *MEDFileField1TSWithoutSDA::deepCpy() const throw(INTERP_KERNEL::Exception)
+MEDFileAnyTypeField1TSWithoutSDA *MEDFileField1TSWithoutSDA::deepCpy() const throw(INTERP_KERNEL::Exception)
 {
-  MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutSDA> ret=new MEDFileField1TSWithoutSDA(*this);
+  MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutSDA> ret=static_cast<MEDFileField1TSWithoutSDA *>(shallowCpy());
   if((const DataArrayDouble *)_arr)
     ret->_arr=_arr->deepCpy();
   std::size_t i=0;
@@ -4350,7 +4651,23 @@ MEDFileField1TSWithoutSDA *MEDFileField1TSWithoutSDA::deepCpy() const throw(INTE
   return ret.retn();
 }
 
-DataArrayDouble *MEDFileField1TSWithoutSDA::getOrCreateAndGetArray()
+void MEDFileField1TSWithoutSDA::setArray(DataArray *arr) throw(INTERP_KERNEL::Exception)
+{
+  if(!arr)
+    _arr=0;
+  DataArrayDouble *arrC=dynamic_cast<DataArrayDouble *>(arr);
+  if(!arrC)
+    throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::setArray : the input not null array is not of type DataArrayDouble !");
+  arrC->incrRef();
+  _arr=arrC;
+}
+
+DataArray *MEDFileField1TSWithoutSDA::createNewEmptyDataArrayInstance() const
+{
+  return DataArrayDouble::New();
+}
+
+DataArrayDouble *MEDFileField1TSWithoutSDA::getOrCreateAndGetArrayDouble()
 {
   DataArrayDouble *ret=_arr;
   if(ret)
@@ -4359,7 +4676,12 @@ DataArrayDouble *MEDFileField1TSWithoutSDA::getOrCreateAndGetArray()
   return _arr;
 }
 
-const DataArrayDouble *MEDFileField1TSWithoutSDA::getOrCreateAndGetArray() const
+DataArray *MEDFileField1TSWithoutSDA::getOrCreateAndGetArray()
+{
+  return getOrCreateAndGetArrayDouble();
+}
+
+const DataArrayDouble *MEDFileField1TSWithoutSDA::getOrCreateAndGetArrayDouble() const
 {
   const DataArrayDouble *ret=_arr;
   if(ret)
@@ -4369,168 +4691,223 @@ const DataArrayDouble *MEDFileField1TSWithoutSDA::getOrCreateAndGetArray() const
   return ret2;
 }
 
-/*!
- * 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 char *fileName) throw(INTERP_KERNEL::Exception)
+const DataArray *MEDFileField1TSWithoutSDA::getOrCreateAndGetArray() const
 {
-  return new MEDFileField1TS(fileName);
+  return getOrCreateAndGetArrayDouble();
 }
 
-/*!
- * 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 char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+//= MEDFileIntField1TSWithoutSDA
+
+MEDFileIntField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::New(const char *fieldName, int csit, int iteration, int order,
+                                                                const std::vector<std::string>& infos)
+{
+  return new MEDFileIntField1TSWithoutSDA(fieldName,csit,iteration,order,infos);
+}
+
+MEDFileIntField1TSWithoutSDA::MEDFileIntField1TSWithoutSDA():MEDFileAnyTypeField1TSWithoutSDA()
+{
+}
+
+MEDFileIntField1TSWithoutSDA::MEDFileIntField1TSWithoutSDA(const char *fieldName, int csit, int iteration, int order,
+                                                           const std::vector<std::string>& infos):MEDFileAnyTypeField1TSWithoutSDA(fieldName,csit,iteration,order)
+{
+  DataArrayInt *arr=getOrCreateAndGetArrayInt();
+  arr->setInfoAndChangeNbOfCompo(infos);
+}
+
+const char *MEDFileIntField1TSWithoutSDA::getTypeStr() const throw(INTERP_KERNEL::Exception)
 {
-  return new MEDFileField1TS(fileName,fieldName);
+  return TYPE_STR;
 }
 
 /*!
- * 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.
+ * Returns a pointer to the underground DataArrayInt instance. So the
+ * caller should not decrRef() it. This method allows for a direct access to the field
+ * values. This method is quite unusable if there is more than a nodal field or a cell
+ * field on single geometric cell type. 
+ *  \return DataArrayInt * - the pointer to the field values array.
  */
-MEDFileField1TS *MEDFileField1TS::New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
+DataArray *MEDFileIntField1TSWithoutSDA::getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
 {
-  return new MEDFileField1TS(fileName,fieldName,iteration,order);
+  return getUndergroundDataArrayInt();
 }
 
 /*!
- * Returns a new instance of MEDFileField1TS holding either deep or shallow copy
- * of a given MEDFileField1TSWithoutSDA.
- * \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 MEDFileFieldMultiTS. The caller
- *          is to delete this field using decrRef() as it is no more needed.
+ * Returns a pointer to the underground DataArrayInt instance. So the
+ * caller should not decrRef() it. This method allows for a direct access to the field
+ * values. This method is quite unusable if there is more than a nodal field or a cell
+ * field on single geometric cell type. 
+ *  \return DataArrayInt * - the pointer to the field values array.
  */
-MEDFileField1TS *MEDFileField1TS::New(const MEDFileField1TSWithoutSDA& other, bool shallowCopyOfContent)
+DataArrayInt *MEDFileIntField1TSWithoutSDA::getUndergroundDataArrayInt() const throw(INTERP_KERNEL::Exception)
 {
-  return new MEDFileField1TS(other,shallowCopyOfContent);
+  const DataArrayInt *ret=_arr;
+  if(ret)
+    return const_cast<DataArrayInt *>(ret);
+  else
+    return 0;
 }
 
 /*!
- * 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.
+ * Returns a pointer to the underground DataArrayInt instance and a
+ * sequence describing parameters of a support of each part of \a this field. The
+ * caller should not decrRef() the returned DataArrayInt. 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 DataArrayInt * - 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()
  */
-MEDFileField1TS *MEDFileField1TS::New()
+DataArray *MEDFileIntField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception)
 {
-  return new MEDFileField1TS;
+  return getUndergroundDataArrayIntExt(entries);
 }
 
 /*!
- * Returns a string describing \a this field. This string is outputted 
- * by \c print Python command.
+ * Returns a pointer to the underground DataArrayInt instance and a
+ * sequence describing parameters of a support of each part of \a this field. The
+ * caller should not decrRef() the returned DataArrayInt. 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 DataArrayInt * - 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()
  */
-std::string MEDFileField1TS::simpleRepr() const
+DataArrayInt *MEDFileIntField1TSWithoutSDA::getUndergroundDataArrayIntExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception)
 {
-  std::ostringstream oss;
-  _content->simpleRepr(0,oss,-1);
-  MEDFileFieldGlobsReal::simpleRepr(oss);
-  return oss.str();
+  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 getUndergroundDataArrayInt();
 }
 
-void MEDFileField1TS::writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception)
+MEDFileAnyTypeField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::shallowCpy() const throw(INTERP_KERNEL::Exception)
 {
-  int nbComp=getNumberOfComponents();
-  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++)
+  return new MEDFileIntField1TSWithoutSDA(*this);
+}
+
+MEDFileAnyTypeField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::deepCpy() const throw(INTERP_KERNEL::Exception)
+{
+  MEDCouplingAutoRefCountObjectPtr<MEDFileIntField1TSWithoutSDA> ret=static_cast<MEDFileIntField1TSWithoutSDA *>(shallowCpy());
+  if((const DataArrayInt *)_arr)
+    ret->_arr=_arr->deepCpy();
+  std::size_t i=0;
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++,i++)
     {
-      std::string info=getInfo()[i];
-      std::string c,u;
-      MEDLoaderBase::splitIntoNameAndUnit(info,c,u);
-      MEDLoaderBase::safeStrCpy2(c.c_str(),MED_SNAME_SIZE,comp+i*MED_SNAME_SIZE,_too_long_str);
-      MEDLoaderBase::safeStrCpy2(u.c_str(),MED_SNAME_SIZE,unit+i*MED_SNAME_SIZE,_too_long_str);
+      if((const MEDFileFieldPerMesh *)*it)
+        ret->_field_per_mesh[i]=(*it)->deepCpy((MEDFileIntField1TSWithoutSDA *)ret);
     }
-  if(getName().empty())
-    throw INTERP_KERNEL::Exception("MEDFileField1TS::write : MED file does not accept field with empty name !");
-  MEDfieldCr(fid,getName().c_str(),MED_FLOAT64,nbComp,comp,unit,getDtUnit().c_str(),getMeshName().c_str());
-  writeGlobals(fid,*this);
-  _content->writeLL(fid,*this);
+  return ret.retn();
 }
 
-/*!
- * Writes \a this field into a MED file specified by its name.
- *  \param [in] fileName - the MED file name.
- *  \param [in] mode - the writing mode. For more on \a mode, see \ref AdvMEDLoaderBasics.
- * - 2 - erase; an existing file is removed.
- * - 1 - append; same data should not be present in an existing file.
- * - 0 - overwrite; same data present in an existing file is overwritten.
- *  \throw If the field name is not set.
- *  \throw If no field data is set.
- *  \throw If \a mode == 1 and the same data is present in an existing file.
- */
-void MEDFileField1TS::write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception)
+void MEDFileIntField1TSWithoutSDA::setArray(DataArray *arr) throw(INTERP_KERNEL::Exception)
 {
-  med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,medmod);
-  writeLL(fid);
+  if(!arr)
+    _arr=0;
+  DataArrayInt *arrC=dynamic_cast<DataArrayInt *>(arr);
+  if(!arrC)
+    throw INTERP_KERNEL::Exception("MEDFileIntField1TSWithoutSDA::setArray : the input not null array is not of type DataArrayInt !");
+  _arr=arrC;
 }
 
-MEDFileField1TS::MEDFileField1TS(const char *fileName) throw(INTERP_KERNEL::Exception)
-try:MEDFileFieldGlobsReal(fileName)
+DataArray *MEDFileIntField1TSWithoutSDA::createNewEmptyDataArrayInstance() const
+{
+  return DataArrayInt::New();
+}
+
+DataArrayInt *MEDFileIntField1TSWithoutSDA::getOrCreateAndGetArrayInt()
+{
+  DataArrayInt *ret=_arr;
+  if(ret)
+    return ret;
+  _arr=DataArrayInt::New();
+  return _arr;
+}
+
+DataArray *MEDFileIntField1TSWithoutSDA::getOrCreateAndGetArray()
+{
+  return getOrCreateAndGetArrayInt();
+}
+
+const DataArrayInt *MEDFileIntField1TSWithoutSDA::getOrCreateAndGetArrayInt() const
+{
+  const DataArrayInt *ret=_arr;
+  if(ret)
+    return ret;
+  DataArrayInt *ret2=DataArrayInt::New();
+  const_cast<MEDFileIntField1TSWithoutSDA *>(this)->_arr=DataArrayInt::New();
+  return ret2;
+}
+
+const DataArray *MEDFileIntField1TSWithoutSDA::getOrCreateAndGetArray() const
+{
+  return getOrCreateAndGetArrayInt();
+}
+
+MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS()
+{
+}
+
+//= MEDFileAnyTypeField1TS
+
+MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_idt fid, const char *fileName) throw(INTERP_KERNEL::Exception)
 {
-  MEDFileUtilities::CheckFileForRead(fileName);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
   med_field_type typcha;
   //
-  int nbFields=MEDnField(fid);
-  if(nbFields<1)
+  std::vector<std::string> infos;
+  std::string dtunit,fieldName;
+  LocateField2(fid,fileName,0,true,fieldName,typcha,infos,dtunit);
+  MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> ret;
+  switch(typcha)
     {
-      std::ostringstream oss; oss << "MEDFileField1TS(fileName) : no field present in file \'" << fileName << "\' !";
-      throw INTERP_KERNEL::Exception(oss.str().c_str());
-    }
-  int ncomp=MEDfieldnComponent(fid,1);
-  INTERP_KERNEL::AutoPtr<char> comp=MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE);
-  INTERP_KERNEL::AutoPtr<char> unit=MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE);
-  INTERP_KERNEL::AutoPtr<char> dtunit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE);
-  INTERP_KERNEL::AutoPtr<char> nomcha=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
-  INTERP_KERNEL::AutoPtr<char> nomMaa=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
-  med_bool localMesh;
-  int nbOfStep;
-  MEDfieldInfo(fid,1,nomcha,nomMaa,&localMesh,&typcha,comp,unit,dtunit,&nbOfStep);
-  std::string fieldName(nomcha);
-  if(nbOfStep<1)
-    {
-      std::ostringstream oss; oss << "MEDFileField1TS(fileName) : file \'" << fileName << "\' contains field with name \'" << fieldName << "\' but there is no time steps on it !";
-      throw INTERP_KERNEL::Exception(oss.str().c_str());
+    case MED_FLOAT64:
+      {
+        ret=MEDFileField1TSWithoutSDA::New(fieldName.c_str(),-1,-1/*iteration*/,-1/*order*/,std::vector<std::string>());
+        break;
+      }
+    case MED_INT32:
+      {
+        ret=MEDFileIntField1TSWithoutSDA::New(fieldName.c_str(),-1,-1/*iteration*/,-1/*order*/,std::vector<std::string>());
+        break;
+      }
+    default:
+      {
+        std::ostringstream oss; oss << "MEDFileAnyTypeField1TS::BuildContentFrom(fileName) : file \'" << fileName << "\' 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().c_str());
+      }
     }
-  std::vector<std::string> infos(ncomp);
-  for(int j=0;j<ncomp;j++)
-    infos[j]=MEDLoaderBase::buildUnionUnit((char *)comp+j*MED_SNAME_SIZE,MED_SNAME_SIZE,(char *)unit+j*MED_SNAME_SIZE,MED_SNAME_SIZE);
-  _content=MEDFileField1TSWithoutSDA::New(fieldName.c_str(),-1,-1,-1/*iteration*/,-1/*order*/,std::vector<std::string>());
-  _content->getOrCreateAndGetArray()->setInfoAndChangeNbOfCompo(infos);
+  ret->setDtUnit(dtunit.c_str());
+  ret->getOrCreateAndGetArray()->setInfoAndChangeNbOfCompo(infos);
   //
   med_int numdt,numit;
   med_float dt;
   MEDfieldComputingStepInfo(fid,fieldName.c_str(),1,&numdt,&numit,&dt);
-  _content->setTime(numdt,numit,dt);
-  _content->_csit=1;
-  _content->_field_type=MEDFileUtilities::TraduceFieldType(typcha);
-  _content->finishLoading(fid);
-  //
+  ret->setTime(numdt,numit,dt);
+  ret->_csit=1;
+  ret->finishLoading(fid,*((const MEDFileAnyTypeField1TSWithoutSDA*)ret));
+  return ret.retn();
+}
+
+MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS(const char *fileName) throw(INTERP_KERNEL::Exception)
+try:MEDFileFieldGlobsReal(fileName)
+{
+  MEDFileUtilities::CheckFileForRead(fileName);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  _content=BuildContentFrom(fid,fileName);
   loadGlobals(fid);
 }
 catch(INTERP_KERNEL::Exception& e)
@@ -4538,13 +4915,35 @@ catch(INTERP_KERNEL::Exception& e)
     throw e;
   }
 
-MEDFileField1TS::MEDFileField1TS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
-try:MEDFileFieldGlobsReal(fileName),_content(MEDFileField1TSWithoutSDA::New(fieldName,-1,-1,-1/*iteration*/,-1/*order*/,std::vector<std::string>()))
+MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_idt fid, const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
 {
-  MEDFileUtilities::CheckFileForRead(fileName);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
   med_field_type typcha;
-  int nbSteps=locateField(fid,fileName,fieldName,typcha);
+  std::vector<std::string> infos;
+  std::string dtunit;
+  int iii=-1;
+  int nbSteps=LocateField(fid,fileName,fieldName,iii,typcha,infos,dtunit);
+  MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> ret;
+  switch(typcha)
+    {
+    case MED_FLOAT64:
+      {
+        ret=MEDFileField1TSWithoutSDA::New(fieldName,-1,-1/*iteration*/,-1/*order*/,std::vector<std::string>());
+        break;
+      }
+    case MED_INT32:
+      {
+        ret=MEDFileIntField1TSWithoutSDA::New(fieldName,-1,-1/*iteration*/,-1/*order*/,std::vector<std::string>());
+        break;
+      }
+    default:
+      {
+        std::ostringstream oss; oss << "MEDFileAnyTypeField1TS::BuildContentFrom(fileName,fieldName) : file \'" << fileName << "\' contains field with name \'" << fieldName << "\' but the type of field is not in [MED_FLOAT64, MED_INT32] !";
+        throw INTERP_KERNEL::Exception(oss.str().c_str());
+      }
+    }
+  ret->setDtUnit(dtunit.c_str());
+  ret->getOrCreateAndGetArray()->setInfoAndChangeNbOfCompo(infos);
+  //
   if(nbSteps<1)
     {
       std::ostringstream oss; oss << "MEDFileField1TS(fileName,fieldName) : file \'" << fileName << "\' contains field with name \'" << fieldName << "\' but there is no time steps on it !";
@@ -4554,11 +4953,18 @@ try:MEDFileFieldGlobsReal(fileName),_content(MEDFileField1TSWithoutSDA::New(fiel
   med_int numdt,numit;
   med_float dt;
   MEDfieldComputingStepInfo(fid,fieldName,1,&numdt,&numit,&dt);
-  _content->setTime(numdt,numit,dt);
-  _content->_csit=1;
-  _content->_field_type=MEDFileUtilities::TraduceFieldType(typcha);
-  _content->finishLoading(fid);
-  //
+  ret->setTime(numdt,numit,dt);
+  ret->_csit=1;
+  ret->finishLoading(fid,*((const MEDFileAnyTypeField1TSWithoutSDA*)ret));
+  return ret.retn();
+}
+
+MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+try:MEDFileFieldGlobsReal(fileName)
+{
+  MEDFileUtilities::CheckFileForRead(fileName);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  _content=BuildContentFrom(fid,fileName,fieldName);
   loadGlobals(fid);
 }
 catch(INTERP_KERNEL::Exception& e)
@@ -4566,13 +4972,86 @@ catch(INTERP_KERNEL::Exception& e)
     throw e;
   }
 
-MEDFileField1TS::MEDFileField1TS(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
-try:MEDFileFieldGlobsReal(fileName),_content(MEDFileField1TSWithoutSDA::New(fieldName,-1,-1,iteration,order,std::vector<std::string>()))
+MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::BuildNewInstanceFromContent(MEDFileAnyTypeField1TSWithoutSDA *c, const char *fileName) throw(INTERP_KERNEL::Exception)
+{
+  if(!c)
+    throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TS::BuildNewInstanceFromContent : empty content in input : unable to build a new instance !");
+  if(dynamic_cast<const MEDFileField1TSWithoutSDA *>(c))
+    {
+      MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ret=MEDFileField1TS::New();
+      ret->setFileName(fileName);
+      ret->_content=c; c->incrRef();
+      return ret.retn();
+    }
+  if(dynamic_cast<const MEDFileIntField1TSWithoutSDA *>(c))
+    {
+      MEDCouplingAutoRefCountObjectPtr<MEDFileIntField1TS> ret=MEDFileIntField1TS::New();
+      ret->setFileName(fileName);
+      ret->_content=c; c->incrRef();
+      return ret.retn();
+    }
+  throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TS::BuildNewInstanceFromContent : internal error ! a content of type different from FLOAT64 and INT32 has been built but not intercepted !");
+}
+
+MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(const char *fileName) throw(INTERP_KERNEL::Exception)
+{
+  MEDFileUtilities::CheckFileForRead(fileName);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> c=BuildContentFrom(fid,fileName);
+  MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TS> ret=BuildNewInstanceFromContent(c,fileName);
+  ret->loadGlobals(fid);
+  return ret.retn();
+}
+
+MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+{
+  MEDFileUtilities::CheckFileForRead(fileName);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> c=BuildContentFrom(fid,fileName,fieldName);
+  MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TS> ret=BuildNewInstanceFromContent(c,fileName);
+  ret->loadGlobals(fid);
+  return ret.retn();
+}
+
+MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
 {
   MEDFileUtilities::CheckFileForRead(fileName);
   MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> c=BuildContentFrom(fid,fileName,fieldName,iteration,order);
+  MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TS> ret=BuildNewInstanceFromContent(c,fileName);
+  ret->loadGlobals(fid);
+  return ret.retn();
+}
+
+MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_idt fid, const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
+{
   med_field_type typcha;
-  int nbOfStep2=locateField(fid,fileName,fieldName,typcha);
+  std::vector<std::string> infos;
+  std::string dtunit;
+  int iii=-1;
+  int nbOfStep2=LocateField(fid,fileName,fieldName,iii,typcha,infos,dtunit);
+  MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> ret;
+  switch(typcha)
+    {
+    case MED_FLOAT64:
+      {
+        ret=MEDFileField1TSWithoutSDA::New(fieldName,-1,iteration,order,std::vector<std::string>());
+        break;
+      }
+    case MED_INT32:
+      {
+        ret=MEDFileIntField1TSWithoutSDA::New(fieldName,-1,iteration,order,std::vector<std::string>());
+        break;
+      }
+    default:
+      {
+        std::ostringstream oss; oss << "MEDFileAnyTypeField1TS::BuildContentFrom(fileName,fieldName,iteration,order) : file \'" << fileName << "\' contains field with name \'" << fieldName << "\' but the type of field is not in [MED_FLOAT64, MED_INT32] !";
+        throw INTERP_KERNEL::Exception(oss.str().c_str());
+      }
+    }
+  ret->setDtUnit(dtunit.c_str());
+  ret->getOrCreateAndGetArray()->setInfoAndChangeNbOfCompo(infos);
+  //
   bool found=false;
   std::vector< std::pair<int,int> > dtits(nbOfStep2);
   for(int i=0;i<nbOfStep2 && !found;i++)
@@ -4583,8 +5062,7 @@ try:MEDFileFieldGlobsReal(fileName),_content(MEDFileField1TSWithoutSDA::New(fiel
       if(numdt==iteration && numit==order)
         {
           found=true;
-          _content->_csit=i+1;
-          _content->_field_type=MEDFileUtilities::TraduceFieldType(typcha);
+          ret->_csit=i+1;
         }
       else
         dtits[i]=std::pair<int,int>(numdt,numit);
@@ -4596,8 +5074,16 @@ try:MEDFileFieldGlobsReal(fileName),_content(MEDFileField1TSWithoutSDA::New(fiel
         oss << "(" << (*iter).first << "," << (*iter).second << "), ";
       throw INTERP_KERNEL::Exception(oss.str().c_str());
     }
-  _content->finishLoading(fid);
-  //
+  ret->finishLoading(fid,*((const MEDFileAnyTypeField1TSWithoutSDA*)ret));
+  return ret.retn();
+}
+
+MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
+try:MEDFileFieldGlobsReal(fileName)
+{
+  MEDFileUtilities::CheckFileForRead(fileName);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  _content=BuildContentFrom(fid,fileName,fieldName,iteration,order);
   loadGlobals(fid);
 }
 catch(INTERP_KERNEL::Exception& e)
@@ -4606,24 +5092,51 @@ catch(INTERP_KERNEL::Exception& 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
  */
-MEDFileField1TS::MEDFileField1TS(const MEDFileField1TSWithoutSDA& other, bool shallowCopyOfContent)
+MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS(const MEDFileAnyTypeField1TSWithoutSDA& other, bool shallowCopyOfContent)
 {
   if(!shallowCopyOfContent)
     {
-      const MEDFileField1TSWithoutSDA *otherPtr(&other);
+      const MEDFileAnyTypeField1TSWithoutSDA *otherPtr(&other);
       otherPtr->incrRef();
-      _content=const_cast<MEDFileField1TSWithoutSDA *>(otherPtr);
+      _content=const_cast<MEDFileAnyTypeField1TSWithoutSDA *>(otherPtr);
     }
   else
     {
-      _content=new MEDFileField1TSWithoutSDA(other);
+      _content=other.shallowCpy();
     }
 }
 
-MEDFileField1TS::MEDFileField1TS():_content(new MEDFileField1TSWithoutSDA)
+int MEDFileAnyTypeField1TS::LocateField2(med_idt fid, const char *fileName, int fieldIdCFormat, bool checkFieldId, std::string& fieldName, med_field_type& typcha, std::vector<std::string>& infos, std::string& dtunitOut) throw(INTERP_KERNEL::Exception)
 {
+  if(checkFieldId)
+    {
+      int nbFields=MEDnField(fid);
+      if(fieldIdCFormat>=nbFields)
+        {
+          std::ostringstream oss; oss << "MEDFileAnyTypeField1TS::LocateField2(fileName) : in file \'" << fileName << "\' number of fields is " << nbFields << " ! Trying to request for id " << fieldIdCFormat << " !";
+          throw INTERP_KERNEL::Exception(oss.str().c_str());
+        }
+    }
+  int ncomp=MEDfieldnComponent(fid,fieldIdCFormat+1);
+  INTERP_KERNEL::AutoPtr<char> comp=MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE);
+  INTERP_KERNEL::AutoPtr<char> unit=MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE);
+  INTERP_KERNEL::AutoPtr<char> dtunit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE);
+  INTERP_KERNEL::AutoPtr<char> nomcha=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+  INTERP_KERNEL::AutoPtr<char> nomMaa=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+  med_bool localMesh;
+  int nbOfStep;
+  MEDfieldInfo(fid,fieldIdCFormat+1,nomcha,nomMaa,&localMesh,&typcha,comp,unit,dtunit,&nbOfStep);
+  fieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE);
+  dtunitOut=MEDLoaderBase::buildStringFromFortran(dtunit,MED_LNAME_SIZE);
+  infos.clear(); infos.resize(ncomp);
+  for(int j=0;j<ncomp;j++)
+    infos[j]=MEDLoaderBase::buildUnionUnit((char *)comp+j*MED_SNAME_SIZE,MED_SNAME_SIZE,(char *)unit+j*MED_SNAME_SIZE,MED_SNAME_SIZE);
+  return nbOfStep;
 }
 
 /*!
@@ -4632,7 +5145,7 @@ MEDFileField1TS::MEDFileField1TS():_content(new MEDFileField1TSWithoutSDA)
  * \param [out]
  * \return in case of success the number of time steps available for the field with name \a fieldName.
  */
-int MEDFileField1TS::locateField(med_idt fid, const char *fileName, const char *fieldName, med_field_type& typcha) throw(INTERP_KERNEL::Exception)
+int MEDFileAnyTypeField1TS::LocateField(med_idt fid, const char *fileName, const char *fieldName, int& posCFormat, med_field_type& typcha, std::vector<std::string>& infos, std::string& dtunitOut) throw(INTERP_KERNEL::Exception)
 {
   int nbFields=MEDnField(fid);
   bool found=false;
@@ -4640,27 +5153,12 @@ int MEDFileField1TS::locateField(med_idt fid, const char *fileName, const char *
   int nbOfStep2=-1;
   for(int i=0;i<nbFields && !found;i++)
     {
-      int ncomp=MEDfieldnComponent(fid,i+1);
-      INTERP_KERNEL::AutoPtr<char> comp=MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE);
-      INTERP_KERNEL::AutoPtr<char> unit=MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE);
-      INTERP_KERNEL::AutoPtr<char> dtunit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE);
-      INTERP_KERNEL::AutoPtr<char> nomcha=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
-      INTERP_KERNEL::AutoPtr<char> nomMaa=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
-      med_bool localMesh;
-      int nbOfStep;
-      MEDfieldInfo(fid,i+1,nomcha,nomMaa,&localMesh,&typcha,comp,unit,dtunit,&nbOfStep);
-      std::string tmp(nomcha);
+      std::string tmp;
+      nbOfStep2=LocateField2(fid,fileName,i,false,tmp,typcha,infos,dtunitOut);
       fns[i]=tmp;
       found=(tmp==fieldName);
       if(found)
-        {
-          nbOfStep2=nbOfStep;
-          std::string mname=MEDLoaderBase::buildStringFromFortran(nomMaa,MED_NAME_SIZE);
-          std::vector<std::string> infos(ncomp);
-          for(int j=0;j<ncomp;j++)
-            infos[j]=MEDLoaderBase::buildUnionUnit((char *)comp+j*MED_SNAME_SIZE,MED_SNAME_SIZE,(char *)unit+j*MED_SNAME_SIZE,MED_SNAME_SIZE);
-          _content->getOrCreateAndGetArray()->setInfoAndChangeNbOfCompo(infos);
-        }
+        posCFormat=i;
     }
   if(!found)
     {
@@ -4673,1242 +5171,2987 @@ int MEDFileField1TS::locateField(med_idt fid, const char *fileName, const char *
 }
 
 /*!
- * This method returns all profiles whose name is non empty used.
- * \b WARNING If profile is used several times it will be reported \b only \b once.
- * To get non empty name profiles as time as they appear in \b this call MEDFileField1TS::getPflsReallyUsedMulti instead.
+ * This method as MEDFileField1TSW::setLocNameOnLeaf, is dedicated for advanced user that a want a very fine control on their data structure
+ * without overhead. This method can be called only regarding information returned by MEDFileField1TSWithoutSDA::getFieldSplitedByType or MEDFileField1TSWithoutSDA::getFieldSplitedByType2.
+ * This method changes the attribute (here it's profile name) of the leaf datastructure (MEDFileFieldPerMeshPerTypePerDisc instance).
+ * It is the responsability of the caller to invoke MEDFileFieldGlobs::appendProfile or MEDFileFieldGlobs::getProfile
+ * to keep a valid instance.
+ * If \b this do not have any leaf that correspond to the request of the input parameter (\b mName, \b typ, \b locId) an INTERP_KERNEL::Exception will be thrown.
+ * If \b newPflName profile name does not already exist the profile with old name will be renamed with name \b newPflName.
+ * If \b newPflName already exists and that \b forceRenameOnGlob is false (the default) an INTERP_KERNEL::Exception will be thrown to avoid big confusion. In this case the called should rename before the profile name with name \b newPflName.
+ *
+ * \param [in] mName specifies the underlying mesh name. This value can be pointer 0 for users that do not deal with fields on multi mesh.
+ * \param [in] typ is for the geometric cell type (or INTERP_KERNEL::NORM_ERROR for node field) entry to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set.
+ * \param [in] locId is the localization id to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set. It corresponds to the position of 
+ *             \c pfls[std::distance(types.begin(),std::find(types.begin(),typ)] vector in MEDFileField1TSWithoutSDA::getFieldSplitedByType. For non gausspoints field users, the value is 0.
+ * \param [in] newLocName is the new localization name.
+ * \param [in] forceRenameOnGlob specifies the behaviour in case of profile \b newPflName already exists. If true, the renaming is done without check. It can lead to major bug.
+ *             If false, an exception will be thrown to force user to change previously the name of the profile with name \b newPflName
  */
-std::vector<std::string> MEDFileField1TS::getPflsReallyUsed() const
+void MEDFileAnyTypeField1TS::setProfileNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob) throw(INTERP_KERNEL::Exception)
 {
-  return _content->getPflsReallyUsed2();
+  MEDFileFieldPerMeshPerTypePerDisc *disc=getLeafGivenMeshAndTypeAndLocId(mName,typ,locId);
+  std::string oldPflName=disc->getProfile();
+  std::vector<std::string> vv=getPflsReallyUsedMulti();
+  int nbOfOcc=std::count(vv.begin(),vv.end(),oldPflName);
+  if(forceRenameOnGlob || (!existsPfl(newPflName) && nbOfOcc==1))
+    {
+      disc->setProfile(newPflName);
+      DataArrayInt *pfl=getProfile(oldPflName.c_str());
+      pfl->setName(newPflName);
+    }
+  else
+    {
+      std::ostringstream oss; oss << "MEDFileField1TS::setProfileNameOnLeaf : Profile \"" << newPflName << "\" already exists or referenced more than one !";
+      throw INTERP_KERNEL::Exception(oss.str().c_str());
+    }
 }
 
 /*!
- * This method returns all localizations whose name is non empty used.
- * \b WARNING If localization is used several times it will be reported \b only \b once.
+ * This method as MEDFileField1TSW::setProfileNameOnLeaf, is dedicated for advanced user that a want a very fine control on their data structure
+ * without overhead. This method can be called only regarding information returned by MEDFileField1TSWithoutSDA::getFieldSplitedByType or MEDFileField1TSWithoutSDA::getFieldSplitedByType2.
+ * This method changes the attribute (here it's localization name) of the leaf datastructure (MEDFileFieldPerMeshPerTypePerDisc instance).
+ * It is the responsability of the caller to invoke MEDFileFieldGlobs::appendProfile or MEDFileFieldGlobs::getProfile
+ * to keep a valid instance.
+ * If \b this do not have any leaf that correspond to the request of the input parameter (\b mName, \b typ, \b locId) an INTERP_KERNEL::Exception will be thrown.
+ * This method is an extension of MEDFileField1TSWithoutSDA::setProfileNameOnLeafExt method because it performs a modification of global info.
+ * If \b newLocName profile name does not already exist the localization with old name will be renamed with name \b newLocName.
+ * If \b newLocName already exists an INTERP_KERNEL::Exception will be thrown to avoid big confusion. In this case the called should rename before the profile name with name \b newLocName.
+ *
+ * \param [in] mName specifies the underlying mesh name. This value can be pointer 0 for users that do not deal with fields on multi mesh.
+ * \param [in] typ is for the geometric cell type (or INTERP_KERNEL::NORM_ERROR for node field) entry to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set.
+ * \param [in] locId is the localization id to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set. It corresponds to the position of 
+ *             \c pfls[std::distance(types.begin(),std::find(types.begin(),typ)] vector in MEDFileField1TSWithoutSDA::getFieldSplitedByType. For non gausspoints field users, the value is 0.
+ * \param [in] newLocName is the new localization name.
+ * \param [in] forceRenameOnGlob specifies the behaviour in case of profile \b newLocName already exists. If true, the renaming is done without check. It can lead to major bug.
+ *             If false, an exception will be thrown to force user to change previously the name of the profile with name \b newLocName
  */
-std::vector<std::string> MEDFileField1TS::getLocsReallyUsed() const
+void MEDFileAnyTypeField1TS::setLocNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob) throw(INTERP_KERNEL::Exception)
 {
-  return _content->getLocsReallyUsed2();
+  MEDFileFieldPerMeshPerTypePerDisc *disc=getLeafGivenMeshAndTypeAndLocId(mName,typ,locId);
+  std::string oldLocName=disc->getLocalization();
+  std::vector<std::string> vv=getLocsReallyUsedMulti();
+  int nbOfOcc=std::count(vv.begin(),vv.end(),oldLocName);
+  if(forceRenameOnGlob || (!existsLoc(newLocName) && nbOfOcc==1))
+    {
+      disc->setLocalization(newLocName);
+      MEDFileFieldLoc& loc=getLocalization(oldLocName.c_str());
+      loc.setName(newLocName);
+    }
+  else
+    {
+      std::ostringstream oss; oss << "MEDFileField1TS::setLocNameOnLeaf : Localization \"" << newLocName << "\" already exists or referenced more than one !";
+      throw INTERP_KERNEL::Exception(oss.str().c_str());
+    }
 }
 
-/*!
- * This method returns all profiles whose name is non empty used.
- * \b WARNING contrary to MEDFileField1TS::getPflsReallyUsed, if profile is used several times it will be reported as time as it appears.
- */
-std::vector<std::string> MEDFileField1TS::getPflsReallyUsedMulti() const
+MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::contentNotNullBase() throw(INTERP_KERNEL::Exception)
 {
-  return _content->getPflsReallyUsedMulti2();
+  MEDFileAnyTypeField1TSWithoutSDA *ret=_content;
+  if(!ret)
+    throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TS : content is expected to be not null !");
+  return ret;
 }
 
-/*!
- * This method returns all localizations whose name is non empty used.
- * \b WARNING contrary to MEDFileField1TS::getLocsReallyUsed if localization is used several times it will be reported as time as it appears.
+const MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::contentNotNullBase() const throw(INTERP_KERNEL::Exception)
+{
+  const MEDFileAnyTypeField1TSWithoutSDA *ret=_content;
+  if(!ret)
+    throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TS : const content is expected to be not null !");
+  return ret;
+}
+
+/*!
+ * Writes \a this field into a MED file specified by its name.
+ *  \param [in] fileName - the MED file name.
+ *  \param [in] mode - the writing mode. For more on \a mode, see \ref AdvMEDLoaderBasics.
+ * - 2 - erase; an existing file is removed.
+ * - 1 - append; same data should not be present in an existing file.
+ * - 0 - overwrite; same data present in an existing file is overwritten.
+ *  \throw If the field name is not set.
+ *  \throw If no field data is set.
+ *  \throw If \a mode == 1 and the same data is present in an existing file.
  */
-std::vector<std::string> MEDFileField1TS::getLocsReallyUsedMulti() const
+void MEDFileAnyTypeField1TS::write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception)
 {
-  return _content->getLocsReallyUsedMulti2();
+  med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,medmod);
+  writeLL(fid);
 }
 
-void MEDFileField1TS::changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
+void MEDFileAnyTypeField1TS::writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception)
 {
-  _content->changePflsRefsNamesGen2(mapOfModif);
+  int nbComp=getNumberOfComponents();
+  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=getInfo()[i];
+      std::string c,u;
+      MEDLoaderBase::splitIntoNameAndUnit(info,c,u);
+      MEDLoaderBase::safeStrCpy2(c.c_str(),MED_SNAME_SIZE,comp+i*MED_SNAME_SIZE,_too_long_str);
+      MEDLoaderBase::safeStrCpy2(u.c_str(),MED_SNAME_SIZE,unit+i*MED_SNAME_SIZE,_too_long_str);
+    }
+  if(getName().empty())
+    throw INTERP_KERNEL::Exception("MEDFileField1TS::write : MED file does not accept field with empty name !");
+  MEDfieldCr(fid,getName().c_str(),getMEDFileFieldType(),nbComp,comp,unit,getDtUnit().c_str(),getMeshName().c_str());
+  writeGlobals(fid,*this);
+  contentNotNullBase()->writeLL(fid,*this,*contentNotNullBase());
 }
 
-void MEDFileField1TS::changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
+std::size_t MEDFileAnyTypeField1TS::getHeapMemorySize() const
 {
-  _content->changeLocsRefsNamesGen2(mapOfModif);
+  std::size_t ret=0;
+  if((const MEDFileAnyTypeField1TSWithoutSDA *)_content)
+    ret+=_content->getHeapMemorySize();
+  return ret+MEDFileFieldGlobsReal::getHeapMemorySize();
 }
 
 /*!
- * 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()
+ * Returns a string describing \a this field. This string is outputted 
+ * by \c print Python command.
  */
-MEDCouplingFieldDouble *MEDFileField1TS::getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol) const throw(INTERP_KERNEL::Exception)
+std::string MEDFileAnyTypeField1TS::simpleRepr() const
 {
-  if(getFileName2().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 !");
-  return _content->getFieldAtLevel(type,meshDimRelToMax,0,renumPol,this);
+  std::ostringstream oss;
+  contentNotNullBase()->simpleRepr(0,oss,-1);
+  simpleReprGlobs(oss);
+  return oss.str();
 }
+
 /*!
- * 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()
+ * This method returns all profiles whose name is non empty used.
+ * \b WARNING If profile is used several times it will be reported \b only \b once.
+ * To get non empty name profiles as time as they appear in \b this call MEDFileField1TS::getPflsReallyUsedMulti instead.
  */
-MEDCouplingFieldDouble *MEDFileField1TS::getFieldAtTopLevel(TypeOfField type, int renumPol) const throw(INTERP_KERNEL::Exception)
+std::vector<std::string> MEDFileAnyTypeField1TS::getPflsReallyUsed() const
 {
-  if(getFileName2().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 !");
-  return _content->getFieldAtTopLevel(type,0,renumPol,this);
+  return contentNotNullBase()->getPflsReallyUsed2();
 }
 
-
 /*!
- * 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() 
+ * This method returns all localizations whose name is non empty used.
+ * \b WARNING If localization is used several times it will be reported \b only \b once.
  */
-MEDCouplingFieldDouble *MEDFileField1TS::getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol) const throw(INTERP_KERNEL::Exception)
+std::vector<std::string> MEDFileAnyTypeField1TS::getLocsReallyUsed() const
 {
-  return _content->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0);
+  return contentNotNullBase()->getLocsReallyUsed2();
 }
 
 /*!
- * 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() 
+ * This method returns all profiles whose name is non empty used.
+ * \b WARNING contrary to MEDFileField1TS::getPflsReallyUsed, if profile is used several times it will be reported as time as it appears.
  */
-MEDCouplingFieldDouble *MEDFileField1TS::getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol) const throw(INTERP_KERNEL::Exception)
+std::vector<std::string> MEDFileAnyTypeField1TS::getPflsReallyUsedMulti() const
 {
-  return _content->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh);
+  return contentNotNullBase()->getPflsReallyUsedMulti2();
 }
 
 /*!
- * 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()
+ * This method returns all localizations whose name is non empty used.
+ * \b WARNING contrary to MEDFileField1TS::getLocsReallyUsed if localization is used several times it will be reported as time as it appears.
  */
-MEDCouplingFieldDouble *MEDFileField1TS::getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol) const throw(INTERP_KERNEL::Exception)
+std::vector<std::string> MEDFileAnyTypeField1TS::getLocsReallyUsedMulti() const
 {
-  if(getFileName2().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 !");
-  return _content->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this);
+  return contentNotNullBase()->getLocsReallyUsedMulti2();
 }
 
+void MEDFileAnyTypeField1TS::changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
+{
+  contentNotNullBase()->changePflsRefsNamesGen2(mapOfModif);
+}
 
-/*!
- * 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 throw(INTERP_KERNEL::Exception)
+void MEDFileAnyTypeField1TS::changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
 {
-  return _content->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this);
+  contentNotNullBase()->changeLocsRefsNamesGen2(mapOfModif);
 }
 
-/*!
- * 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) throw(INTERP_KERNEL::Exception)
+int MEDFileAnyTypeField1TS::getDimension() const
 {
-  setFileName("");
-  _content->setFieldNoProfileSBT(field,*this);
+  return contentNotNullBase()->getDimension();
 }
 
-/*!
- * Adds a MEDCouplingFieldDouble to \a this. Specified entities of a given dimension
- * of a given mesh are used as the support of the given field (a real support is not used). 
- * Elements of the given mesh must be sorted suitable for writing to MED file.
- * Order of underlying mesh entities of the given field specified by \a profile parameter
- * is not prescribed; this method permutes field values to have them sorted by element
- * type as required for writing to MED file. 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.
- *  \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 MEDFileField1TS::setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception)
+int MEDFileAnyTypeField1TS::getIteration() const
 {
-  setFileName("");
-  _content->setFieldProfile(field,mesh,meshDimRelToMax,profile,*this);
+  return contentNotNullBase()->getIteration();
 }
 
-/*!
- * This method as MEDFileField1TSW::setLocNameOnLeaf, is dedicated for advanced user that a want a very fine control on their data structure
- * without overhead. This method can be called only regarding information returned by MEDFileField1TSWithoutSDA::getFieldSplitedByType or MEDFileField1TSWithoutSDA::getFieldSplitedByType2.
- * This method changes the attribute (here it's profile name) of the leaf datastructure (MEDFileFieldPerMeshPerTypePerDisc instance).
- * It is the responsability of the caller to invoke MEDFileFieldGlobs::appendProfile or MEDFileFieldGlobs::getProfile
- * to keep a valid instance.
- * If \b this do not have any leaf that correspond to the request of the input parameter (\b mName, \b typ, \b locId) an INTERP_KERNEL::Exception will be thrown.
- * If \b newPflName profile name does not already exist the profile with old name will be renamed with name \b newPflName.
- * If \b newPflName already exists and that \b forceRenameOnGlob is false (the default) an INTERP_KERNEL::Exception will be thrown to avoid big confusion. In this case the called should rename before the profile name with name \b newPflName.
- *
- * \param [in] mName specifies the underlying mesh name. This value can be pointer 0 for users that do not deal with fields on multi mesh.
- * \param [in] typ is for the geometric cell type (or INTERP_KERNEL::NORM_ERROR for node field) entry to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set.
- * \param [in] locId is the localization id to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set. It corresponds to the position of 
- *             \c pfls[std::distance(types.begin(),std::find(types.begin(),typ)] vector in MEDFileField1TSWithoutSDA::getFieldSplitedByType. For non gausspoints field users, the value is 0.
- * \param [in] newLocName is the new localization name.
- * \param [in] forceRenameOnGlob specifies the behaviour in case of profile \b newPflName already exists. If true, the renaming is done without check. It can lead to major bug.
- *             If false, an exception will be thrown to force user to change previously the name of the profile with name \b newPflName
- */
-void MEDFileField1TS::setProfileNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob) throw(INTERP_KERNEL::Exception)
+int MEDFileAnyTypeField1TS::getOrder() const
 {
-  MEDFileFieldPerMeshPerTypePerDisc *disc=getLeafGivenMeshAndTypeAndLocId(mName,typ,locId);
-  std::string oldPflName=disc->getProfile();
-  std::vector<std::string> vv=getPflsReallyUsedMulti();
-  int nbOfOcc=std::count(vv.begin(),vv.end(),oldPflName);
-  if(forceRenameOnGlob || (!existsPfl(newPflName) && nbOfOcc==1))
-    {
-      disc->setProfile(newPflName);
-      DataArrayInt *pfl=getProfile(oldPflName.c_str());
-      pfl->setName(newPflName);
-    }
-  else
-    {
-      std::ostringstream oss; oss << "MEDFileField1TS::setProfileNameOnLeaf : Profile \"" << newPflName << "\" already exists or referenced more than one !";
-      throw INTERP_KERNEL::Exception(oss.str().c_str());
-    }
+  return contentNotNullBase()->getOrder();
 }
 
-/*!
- * This method as MEDFileField1TSW::setProfileNameOnLeaf, is dedicated for advanced user that a want a very fine control on their data structure
- * without overhead. This method can be called only regarding information returned by MEDFileField1TSWithoutSDA::getFieldSplitedByType or MEDFileField1TSWithoutSDA::getFieldSplitedByType2.
- * This method changes the attribute (here it's localization name) of the leaf datastructure (MEDFileFieldPerMeshPerTypePerDisc instance).
- * It is the responsability of the caller to invoke MEDFileFieldGlobs::appendProfile or MEDFileFieldGlobs::getProfile
- * to keep a valid instance.
- * If \b this do not have any leaf that correspond to the request of the input parameter (\b mName, \b typ, \b locId) an INTERP_KERNEL::Exception will be thrown.
- * This method is an extension of MEDFileField1TSWithoutSDA::setProfileNameOnLeafExt method because it performs a modification of global info.
- * If \b newLocName profile name does not already exist the localization with old name will be renamed with name \b newLocName.
- * If \b newLocName already exists an INTERP_KERNEL::Exception will be thrown to avoid big confusion. In this case the called should rename before the profile name with name \b newLocName.
- *
- * \param [in] mName specifies the underlying mesh name. This value can be pointer 0 for users that do not deal with fields on multi mesh.
- * \param [in] typ is for the geometric cell type (or INTERP_KERNEL::NORM_ERROR for node field) entry to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set.
- * \param [in] locId is the localization id to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set. It corresponds to the position of 
- *             \c pfls[std::distance(types.begin(),std::find(types.begin(),typ)] vector in MEDFileField1TSWithoutSDA::getFieldSplitedByType. For non gausspoints field users, the value is 0.
- * \param [in] newLocName is the new localization name.
- * \param [in] forceRenameOnGlob specifies the behaviour in case of profile \b newLocName already exists. If true, the renaming is done without check. It can lead to major bug.
- *             If false, an exception will be thrown to force user to change previously the name of the profile with name \b newLocName
- */
-void MEDFileField1TS::setLocNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob) throw(INTERP_KERNEL::Exception)
-{
-  MEDFileFieldPerMeshPerTypePerDisc *disc=getLeafGivenMeshAndTypeAndLocId(mName,typ,locId);
-  std::string oldLocName=disc->getLocalization();
-  std::vector<std::string> vv=getLocsReallyUsedMulti();
-  int nbOfOcc=std::count(vv.begin(),vv.end(),oldLocName);
-  if(forceRenameOnGlob || (!existsLoc(newLocName) && nbOfOcc==1))
-    {
-      disc->setLocalization(newLocName);
-      MEDFileFieldLoc& loc=getLocalization(oldLocName.c_str());
-      loc.setName(newLocName);
-    }
-  else
-    {
-      std::ostringstream oss; oss << "MEDFileField1TS::setLocNameOnLeaf : Localization \"" << newLocName << "\" already exists or referenced more than one !";
-      throw INTERP_KERNEL::Exception(oss.str().c_str());
-    }
-}
-
-std::size_t MEDFileField1TS::getHeapMemorySize() const
-{
-  std::size_t ret=0;
-  if((const MEDFileField1TSWithoutSDA *)_content)
-    ret+=_content->getHeapMemorySize();
-  return ret+MEDFileFieldGlobsReal::getHeapMemorySize();
-}
-
-MEDFileField1TS *MEDFileField1TS::deepCpy() const throw(INTERP_KERNEL::Exception)
-{
-  MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ret=new MEDFileField1TS(*this);
-  if((const MEDFileField1TSWithoutSDA *)_content)
-    ret->_content=_content->deepCpy();
-  ret->deepCpyGlobs(*this);
-  return ret.retn();
-}
-
-int MEDFileField1TS::copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception)
-{
-  return _content->copyTinyInfoFrom(field);
-}
-
-int MEDFileField1TS::getDimension() const
-{
-  return _content->getDimension();
-}
-
-int MEDFileField1TS::getIteration() const
+double MEDFileAnyTypeField1TS::getTime(int& iteration, int& order) const
 {
-  return _content->getIteration();
+  return contentNotNullBase()->getTime(iteration,order);
 }
 
-int MEDFileField1TS::getOrder() const
+void MEDFileAnyTypeField1TS::setTime(int iteration, int order, double val)
 {
-  return _content->getOrder();
+  contentNotNullBase()->setTime(iteration,order,val);
 }
 
-double MEDFileField1TS::getTime(int& iteration, int& order) const
+std::string MEDFileAnyTypeField1TS::getName() const
 {
-  return _content->getTime(iteration,order);
+  return contentNotNullBase()->getName();
 }
 
-void MEDFileField1TS::setTime(int iteration, int order, double val)
+void MEDFileAnyTypeField1TS::setName(const char *name)
 {
-  _content->setTime(iteration,order,val);
+  contentNotNullBase()->setName(name);
 }
 
-std::string MEDFileField1TS::getName() const
+void MEDFileAnyTypeField1TS::simpleRepr(int bkOffset, std::ostream& oss, int f1tsId) const
 {
-  return _content->getName();
+  contentNotNullBase()->simpleRepr(bkOffset,oss,f1tsId);
 }
 
-void MEDFileField1TS::setName(const char *name)
+std::string MEDFileAnyTypeField1TS::getDtUnit() const throw(INTERP_KERNEL::Exception)
 {
-  _content->setName(name);
+  return contentNotNullBase()->getDtUnit();
 }
 
-void MEDFileField1TS::simpleRepr(int bkOffset, std::ostream& oss, int f1tsId) const
+void MEDFileAnyTypeField1TS::setDtUnit(const char *dtUnit) throw(INTERP_KERNEL::Exception)
 {
-  _content->simpleRepr(bkOffset,oss,f1tsId);
+  contentNotNullBase()->setDtUnit(dtUnit);
 }
 
-const std::string& MEDFileField1TS::getDtUnit() const
+std::string MEDFileAnyTypeField1TS::getMeshName() const throw(INTERP_KERNEL::Exception)
 {
-  return _content->getDtUnit();
+  return contentNotNullBase()->getMeshName();
 }
 
-std::string MEDFileField1TS::getMeshName() const throw(INTERP_KERNEL::Exception)
+void MEDFileAnyTypeField1TS::setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception)
 {
-  return _content->getMeshName();
+  contentNotNullBase()->setMeshName(newMeshName);
 }
 
-void MEDFileField1TS::setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception)
+bool MEDFileAnyTypeField1TS::changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab) throw(INTERP_KERNEL::Exception)
 {
-  _content->setMeshName(newMeshName);
+  return contentNotNullBase()->changeMeshNames(modifTab);
 }
 
-bool MEDFileField1TS::changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab) throw(INTERP_KERNEL::Exception)
+int MEDFileAnyTypeField1TS::getMeshIteration() const throw(INTERP_KERNEL::Exception)
 {
-  return _content->changeMeshNames(modifTab);
+  return contentNotNullBase()->getMeshIteration();
 }
 
-int MEDFileField1TS::getMeshIteration() const throw(INTERP_KERNEL::Exception)
+int MEDFileAnyTypeField1TS::getMeshOrder() const throw(INTERP_KERNEL::Exception)
 {
-  return _content->getMeshIteration();
+  return contentNotNullBase()->getMeshOrder();
 }
 
-int MEDFileField1TS::getMeshOrder() const throw(INTERP_KERNEL::Exception)
+int MEDFileAnyTypeField1TS::getNumberOfComponents() const
 {
-  return _content->getMeshOrder();
+  return contentNotNullBase()->getNumberOfComponents();
 }
 
-int MEDFileField1TS::getNumberOfComponents() const
+bool MEDFileAnyTypeField1TS::isDealingTS(int iteration, int order) const
 {
-  return _content->getNumberOfComponents();
+  return contentNotNullBase()->isDealingTS(iteration,order);
 }
 
-bool MEDFileField1TS::isDealingTS(int iteration, int order) const
+std::pair<int,int> MEDFileAnyTypeField1TS::getDtIt() const
 {
-  return _content->isDealingTS(iteration,order);
+  return contentNotNullBase()->getDtIt();
 }
 
-std::pair<int,int> MEDFileField1TS::getDtIt() const
+void MEDFileAnyTypeField1TS::fillIteration(std::pair<int,int>& p) const
 {
-  return _content->getDtIt();
+  contentNotNullBase()->fillIteration(p);
 }
 
-void MEDFileField1TS::fillIteration(std::pair<int,int>& p) const
+void MEDFileAnyTypeField1TS::fillTypesOfFieldAvailable(std::vector<TypeOfField>& types) const throw(INTERP_KERNEL::Exception)
 {
-  _content->fillIteration(p);
-}
-void MEDFileField1TS::fillTypesOfFieldAvailable(std::vector<TypeOfField>& types) const throw(INTERP_KERNEL::Exception)
-{
-  _content->fillTypesOfFieldAvailable(types);
+  contentNotNullBase()->fillTypesOfFieldAvailable(types);
 }
 
-const std::vector<std::string>& MEDFileField1TS::getInfo() const
-{
-  return _content->getInfo();
-}
-std::vector<std::string>& MEDFileField1TS::getInfo()
+void MEDFileAnyTypeField1TS::setInfo(const std::vector<std::string>& infos) throw(INTERP_KERNEL::Exception)
 {
-  return _content->getInfo();
+  contentNotNullBase()->setInfo(infos);
 }
 
-DataArrayDouble *MEDFileField1TS::getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
+const std::vector<std::string>& MEDFileAnyTypeField1TS::getInfo() const
 {
-  return _content->getUndergroundDataArray();
+  return contentNotNullBase()->getInfo();
 }
-
-DataArrayDouble *MEDFileField1TS::getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception)
+std::vector<std::string>& MEDFileAnyTypeField1TS::getInfo()
 {
-  return _content->getUndergroundDataArrayExt(entries);
+  return contentNotNullBase()->getInfo();
 }
 
-MEDFileFieldPerMeshPerTypePerDisc *MEDFileField1TS::getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) throw(INTERP_KERNEL::Exception)
+MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TS::getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) throw(INTERP_KERNEL::Exception)
 {
-  return _content->getLeafGivenMeshAndTypeAndLocId(mName,typ,locId);
+  return contentNotNullBase()->getLeafGivenMeshAndTypeAndLocId(mName,typ,locId);
 }
 
-const MEDFileFieldPerMeshPerTypePerDisc *MEDFileField1TS::getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const throw(INTERP_KERNEL::Exception)
+const MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TS::getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const throw(INTERP_KERNEL::Exception)
 {
-  return _content->getLeafGivenMeshAndTypeAndLocId(mName,typ,locId);
+  return contentNotNullBase()->getLeafGivenMeshAndTypeAndLocId(mName,typ,locId);
 }
 
-int MEDFileField1TS::getNonEmptyLevels(const char *mname, std::vector<int>& levs) const throw(INTERP_KERNEL::Exception)
+int MEDFileAnyTypeField1TS::getNonEmptyLevels(const char *mname, std::vector<int>& levs) const throw(INTERP_KERNEL::Exception)
 {
-  return _content->getNonEmptyLevels(mname,levs);
+  return contentNotNullBase()->getNonEmptyLevels(mname,levs);
 }
 
-std::vector<TypeOfField> MEDFileField1TS::getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
+std::vector<TypeOfField> MEDFileAnyTypeField1TS::getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
 {
-  return _content->getTypesOfFieldAvailable();
+  return contentNotNullBase()->getTypesOfFieldAvailable();
 }
 
-std::vector< std::vector<std::pair<int,int> > > MEDFileField1TS::getFieldSplitedByType(const char *mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF,
+std::vector< std::vector<std::pair<int,int> > > MEDFileAnyTypeField1TS::getFieldSplitedByType(const char *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 throw(INTERP_KERNEL::Exception)
 {
-  return _content->getFieldSplitedByType(mname,types,typesF,pfls,locs);
-}
-std::vector< std::vector<DataArrayDouble *> > MEDFileField1TS::getFieldSplitedByType2(const char *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 throw(INTERP_KERNEL::Exception)
-{
-  return _content->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
-}
-
-MEDFileFieldMultiTSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::New(med_idt fid, const char *fieldName, int id, int ft, const std::vector<std::string>& infos, int nbOfStep) throw(INTERP_KERNEL::Exception)
-{
-  return new MEDFileFieldMultiTSWithoutSDA(fid,fieldName,id,ft,infos,nbOfStep);
-}
-
-MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA():_field_type(-1)
-{
-}
-
-MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA(const char *fieldName):_name(fieldName),_field_type(-1)
-{
+  return contentNotNullBase()->getFieldSplitedByType(mname,types,typesF,pfls,locs);
 }
 
 /*!
- * \param [in] fieldId field id in C mode
+ * This method returns as MEDFileAnyTypeField1TS 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 !
  */
-MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA(med_idt fid, int fieldId) throw(INTERP_KERNEL::Exception)
-try:_name("")
+std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > MEDFileAnyTypeField1TS::splitComponents() const throw(INTERP_KERNEL::Exception)
 {
-  med_field_type typcha;
-  //
-  int ncomp=MEDfieldnComponent(fid,fieldId+1);
-  INTERP_KERNEL::AutoPtr<char> comp=MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE);
-  INTERP_KERNEL::AutoPtr<char> unit=MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE);
-  INTERP_KERNEL::AutoPtr<char> dtunit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE);
-  INTERP_KERNEL::AutoPtr<char> nomcha=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
-  INTERP_KERNEL::AutoPtr<char> nomMaa=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
-  med_bool localMesh;
-  int nbOfStep;
-  MEDfieldInfo(fid,fieldId+1,nomcha,nomMaa,&localMesh,&typcha,comp,unit,dtunit,&nbOfStep);
-  _name=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE);
-  _field_type=MEDFileUtilities::TraduceFieldType(typcha);
-  _infos.resize(ncomp);
-  for(int j=0;j<ncomp;j++)
-    _infos[j]=MEDLoaderBase::buildUnionUnit((char *)comp+j*MED_SNAME_SIZE,MED_SNAME_SIZE,(char *)unit+j*MED_SNAME_SIZE,MED_SNAME_SIZE);
-  //
-  finishLoading(fid,nbOfStep);
+  const MEDFileAnyTypeField1TSWithoutSDA *content(_content);
+  if(!content)
+    throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TS::splitComponents : no content in this ! Unable to split components !");
+  std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > contentsSplit=content->splitComponents();
+  std::size_t sz(contentsSplit.size());
+  std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > ret(sz);
+  for(std::size_t i=0;i<sz;i++)
+    {
+      ret[i]=shallowCpy();
+      ret[i]->_content=contentsSplit[i];
+    }
+  return ret;
 }
-catch(INTERP_KERNEL::Exception& e)
-  {
-    throw e;
-  }
 
-MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA(med_idt fid, const char *fieldName, int id, int ft, const std::vector<std::string>& infos, int nbOfStep) throw(INTERP_KERNEL::Exception)
-try:_name(fieldName),_infos(infos),_field_type(ft)
-{
-  finishLoading(fid,nbOfStep);
-}
-catch(INTERP_KERNEL::Exception& e)
+MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::deepCpy() const throw(INTERP_KERNEL::Exception)
 {
-  throw e;
+  MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TS> ret=shallowCpy();
+  if((const MEDFileAnyTypeField1TSWithoutSDA *)_content)
+    ret->_content=_content->deepCpy();
+  ret->deepCpyGlobs(*this);
+  return ret.retn();
 }
 
-std::size_t MEDFileFieldMultiTSWithoutSDA::getHeapMemorySize() const
+int MEDFileAnyTypeField1TS::copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr) throw(INTERP_KERNEL::Exception)
 {
-  std::size_t ret=_name.capacity()+_infos.capacity()*sizeof(std::string)+_time_steps.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutSDA>);
-  for(std::vector<std::string>::const_iterator it=_infos.begin();it!=_infos.end();it++)
-    ret+=(*it).capacity();
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
-    if((const MEDFileField1TSWithoutSDA *)(*it))
-      ret+=(*it)->getHeapMemorySize();
-  return ret;
+  return contentNotNullBase()->copyTinyInfoFrom(field,arr);
 }
 
-MEDFileFieldMultiTSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::deepCpy() const throw(INTERP_KERNEL::Exception)
-{
-  MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTSWithoutSDA> ret=new MEDFileFieldMultiTSWithoutSDA(*this);
-  std::size_t i=0;
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++)
-    {
-      if((const MEDFileField1TSWithoutSDA *)*it)
-        ret->_time_steps[i]=(*it)->deepCpy();
-    }
-  return ret.retn();
-}
+//= MEDFileField1TS
 
-const std::vector<std::string>& MEDFileFieldMultiTSWithoutSDA::getInfo() const throw(INTERP_KERNEL::Exception)
+/*!
+ * 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 char *fileName) throw(INTERP_KERNEL::Exception)
 {
-  if(_time_steps.empty())
-    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::getInfos : not time steps !");
-  return _time_steps[0]->getInfo();
+  MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ret=new MEDFileField1TS(fileName);
+  ret->contentNotNull();
+  return ret.retn();
 }
 
 /*!
- * See doc at MEDFileField1TSWithoutSDA::getUndergroundDataArray
+ * 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.
  */
-DataArrayDouble *MEDFileFieldMultiTSWithoutSDA::getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
+MEDFileField1TS *MEDFileField1TS::New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
 {
-  return getTimeStepEntry(iteration,order).getUndergroundDataArray();
+  MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ret=new MEDFileField1TS(fileName,fieldName);
+  ret->contentNotNull();
+  return ret.retn();
 }
 
 /*!
- * See doc at MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt
+ * 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.
  */
-DataArrayDouble *MEDFileFieldMultiTSWithoutSDA::getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception)
+MEDFileField1TS *MEDFileField1TS::New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
 {
-  return getTimeStepEntry(iteration,order).getUndergroundDataArrayExt(entries);
+  MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ret=new MEDFileField1TS(fileName,fieldName,iteration,order);
+  ret->contentNotNull();
+  return ret.retn();
 }
 
-std::string MEDFileFieldMultiTSWithoutSDA::getMeshName() const throw(INTERP_KERNEL::Exception)
+/*!
+ * 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)
 {
-  if(_time_steps.empty())
-    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::getMeshName : not time steps !");
-  return _time_steps[0]->getMeshName();
+  MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ret=new MEDFileField1TS(other,shallowCopyOfContent);
+  ret->contentNotNull();
+  return ret.retn();
 }
 
-void MEDFileFieldMultiTSWithoutSDA::setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception)
+/*!
+ * 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()
 {
-  std::string oldName(getMeshName());
-  std::vector< std::pair<std::string,std::string> > v(1);
-  v[0].first=oldName; v[0].second=newMeshName;
-  changeMeshNames(v);
+  MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ret=new MEDFileField1TS;
+  ret->contentNotNull();
+  return ret.retn();
 }
 
-bool MEDFileFieldMultiTSWithoutSDA::changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab) throw(INTERP_KERNEL::Exception)
+const MEDFileField1TSWithoutSDA *MEDFileField1TS::contentNotNull() const throw(INTERP_KERNEL::Exception)
 {
-  bool ret=false;
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
-    {
-      MEDFileField1TSWithoutSDA *cur(*it);
-      if(cur)
-        ret=cur->changeMeshNames(modifTab) || ret;
-    }
+  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;
 }
 
-bool MEDFileFieldMultiTSWithoutSDA::renumberEntitiesLyingOnMesh(const char *meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N,
-                                                                MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
+MEDFileField1TSWithoutSDA *MEDFileField1TS::contentNotNull() throw(INTERP_KERNEL::Exception)
 {
-  bool ret=false;
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
-    {
-      MEDFileField1TSWithoutSDA *f1ts(*it);
-      if(f1ts)
-        ret=f1ts->renumberEntitiesLyingOnMesh(meshName,oldCode,newCode,renumO2N,glob) || ret;
-    }
+  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 MEDFileFieldMultiTSWithoutSDA::appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
+void MEDFileField1TS::SetDataArrayDoubleInField(MEDCouplingFieldDouble *f, MEDCouplingAutoRefCountObjectPtr<DataArray>& arr) throw(INTERP_KERNEL::Exception)
 {
-  if(_time_steps.empty())
-    {
-      MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutSDA> obj=new MEDFileField1TSWithoutSDA;
-      obj->setFieldNoProfileSBT(field,glob);
-      copyTinyInfoFrom(field);
-      _time_steps.push_back(obj);
-    }
-  else
-    {
-      checkCoherencyOfTinyInfo(field);
-      MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutSDA> obj=new MEDFileField1TSWithoutSDA;
-      obj->setFieldNoProfileSBT(field,glob);
-      _time_steps.push_back(obj);
-    }
+  if(!f)
+    throw INTERP_KERNEL::Exception("MEDFileField1TS::SetDataArrayDoubleInField : input field is NULL !");
+  if(!((DataArray*)arr))
+    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);
 }
 
-void MEDFileFieldMultiTSWithoutSDA::appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
+DataArrayDouble *MEDFileField1TS::ReturnSafelyDataArrayDouble(MEDCouplingAutoRefCountObjectPtr<DataArray>& arr) throw(INTERP_KERNEL::Exception)
 {
-  if(_time_steps.empty())
-    {
-      MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutSDA> obj=new MEDFileField1TSWithoutSDA;
-      obj->setFieldProfile(field,mesh,meshDimRelToMax,profile,glob);
-      copyTinyInfoFrom(field);
-      _time_steps.push_back(obj);
-    }
-  else
-    {
-      checkCoherencyOfTinyInfo(field);
-      MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutSDA> obj=new MEDFileField1TSWithoutSDA;
-      obj->setFieldProfile(field,mesh,meshDimRelToMax,profile,glob);
-      _time_steps.push_back(obj);
-    }
+  if(!((DataArray*)arr))
+    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;
 }
 
-std::string MEDFileFieldMultiTSWithoutSDA::getDtUnit() const throw(INTERP_KERNEL::Exception)
+MEDFileField1TS::MEDFileField1TS(const char *fileName) throw(INTERP_KERNEL::Exception)
+try:MEDFileAnyTypeField1TS(fileName)
 {
-  if(_time_steps.empty())
-    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::getMeshName : not time steps !");
-  return _time_steps[0]->getDtUnit();
 }
+catch(INTERP_KERNEL::Exception& e)
+  { throw e; }
 
-std::string MEDFileFieldMultiTSWithoutSDA::getName() const
+MEDFileField1TS::MEDFileField1TS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+try:MEDFileAnyTypeField1TS(fileName,fieldName)
 {
-  return _name;
 }
+catch(INTERP_KERNEL::Exception& e)
+  { throw e; }
 
-void MEDFileFieldMultiTSWithoutSDA::setName(const char *name)
+MEDFileField1TS::MEDFileField1TS(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
+try:MEDFileAnyTypeField1TS(fileName,fieldName,iteration,order)
 {
-  _name=name;
 }
+catch(INTERP_KERNEL::Exception& e)
+  { throw e; }
 
-void MEDFileFieldMultiTSWithoutSDA::simpleRepr(int bkOffset, std::ostream& oss, int fmtsId) const
+/*!
+ * 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
+ */
+MEDFileField1TS::MEDFileField1TS(const MEDFileField1TSWithoutSDA& other, bool shallowCopyOfContent)
+try:MEDFileAnyTypeField1TS(other,shallowCopyOfContent)
 {
-  std::string startLine(bkOffset,' ');
-  oss << startLine << "Field multi time steps";
-  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< MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutSDA>  >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++)
-    {
-      std::string chapter(17,'0'+i);
-      oss << startLine << chapter << std::endl;
-      const MEDFileField1TSWithoutSDA *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;
-    }
 }
+catch(INTERP_KERNEL::Exception& e)
+  { throw e; }
 
-std::vector< std::pair<int,int> > MEDFileFieldMultiTSWithoutSDA::getTimeSteps(std::vector<double>& ret1) const throw(INTERP_KERNEL::Exception)
+MEDFileField1TS::MEDFileField1TS()
 {
-  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 MEDFileField1TSWithoutSDA *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().c_str());
-        }
-    }
-  return ret;
+  _content=new MEDFileField1TSWithoutSDA;
 }
 
-void MEDFileFieldMultiTSWithoutSDA::finishLoading(med_idt fid, int nbPdt) throw(INTERP_KERNEL::Exception)
-{
-  _time_steps.resize(nbPdt);
-  for(int i=0;i<nbPdt;i++)
-    {
-      std::vector< std::pair<int,int> > ts;
-      med_int numdt=0,numo=0;
+/*!
+ * 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 throw(INTERP_KERNEL::Exception)
+{
+  if(getFileName2().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 !");
+  MEDCouplingAutoRefCountObjectPtr<DataArray> arrOut;
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,0,renumPol,this,arrOut,*contentNotNull());
+  MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
+  return ret.retn();
+}
+
+/*!
+ * 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 throw(INTERP_KERNEL::Exception)
+{
+  if(getFileName2().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 !");
+  MEDCouplingAutoRefCountObjectPtr<DataArray> arrOut;
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldAtTopLevel(type,0,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 throw(INTERP_KERNEL::Exception)
+{
+  MEDCouplingAutoRefCountObjectPtr<DataArray> arrOut;
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arrOut,*contentNotNull());
+  MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
+  return ret.retn();
+}
+
+/*!
+ * 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 throw(INTERP_KERNEL::Exception)
+{
+  MEDCouplingAutoRefCountObjectPtr<DataArray> arrOut;
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arrOut,*contentNotNull());
+  MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
+  return ret.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 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 char *mname, int meshDimRelToMax, int renumPol) const throw(INTERP_KERNEL::Exception)
+{
+  if(getFileName2().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 !");
+  MEDCouplingAutoRefCountObjectPtr<DataArray> arrOut;
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arrOut,*contentNotNull());
+  MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
+  return ret.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 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 throw(INTERP_KERNEL::Exception)
+{
+  MEDCouplingAutoRefCountObjectPtr<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) throw(INTERP_KERNEL::Exception)
+{
+  setFileName("");
+  contentNotNull()->setFieldNoProfileSBT(field,field->getArray(),*this,*contentNotNull());
+}
+
+/*!
+ * Adds a MEDCouplingFieldDouble to \a this. Specified entities of a given dimension
+ * of a given mesh are used as the support of the given field (a real support is not used). 
+ * Elements of the given mesh must be sorted suitable for writing to MED file.
+ * Order of underlying mesh entities of the given field specified by \a profile parameter
+ * is not prescribed; this method permutes field values to have them sorted by element
+ * type as required for writing to MED file. 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.
+ *  \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 MEDFileField1TS::setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception)
+{
+  setFileName("");
+  contentNotNull()->setFieldProfile(field,field->getArray(),mesh,meshDimRelToMax,profile,*this,*contentNotNull());
+}
+
+MEDFileAnyTypeField1TS *MEDFileField1TS::shallowCpy() const throw(INTERP_KERNEL::Exception)
+{
+  return new MEDFileField1TS(*this);
+}
+
+DataArrayDouble *MEDFileField1TS::getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
+{
+  return contentNotNull()->getUndergroundDataArrayDouble();
+}
+
+DataArrayDouble *MEDFileField1TS::getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception)
+{
+  return contentNotNull()->getUndergroundDataArrayDoubleExt(entries);
+}
+
+std::vector< std::vector<DataArrayDouble *> > MEDFileField1TS::getFieldSplitedByType2(const char *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 throw(INTERP_KERNEL::Exception)
+{
+  return contentNotNull()->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
+}
+
+//= MEDFileIntField1TS
+
+MEDFileIntField1TS *MEDFileIntField1TS::New()
+{
+  MEDCouplingAutoRefCountObjectPtr<MEDFileIntField1TS> ret=new MEDFileIntField1TS;
+  ret->contentNotNull();
+  return ret.retn();
+}
+
+MEDFileIntField1TS *MEDFileIntField1TS::New(const char *fileName) throw(INTERP_KERNEL::Exception)
+{
+  MEDCouplingAutoRefCountObjectPtr<MEDFileIntField1TS> ret=new MEDFileIntField1TS(fileName);
+  ret->contentNotNull();
+  return ret.retn();
+}
+
+MEDFileIntField1TS *MEDFileIntField1TS::New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+{
+  MEDCouplingAutoRefCountObjectPtr<MEDFileIntField1TS> ret=new MEDFileIntField1TS(fileName,fieldName);
+  ret->contentNotNull();
+  return ret.retn();
+}
+
+MEDFileIntField1TS *MEDFileIntField1TS::New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
+{
+  MEDCouplingAutoRefCountObjectPtr<MEDFileIntField1TS> ret=new MEDFileIntField1TS(fileName,fieldName,iteration,order);
+  ret->contentNotNull();
+  return ret.retn();
+}
+
+MEDFileIntField1TS *MEDFileIntField1TS::New(const MEDFileIntField1TSWithoutSDA& other, bool shallowCopyOfContent)
+{
+  MEDCouplingAutoRefCountObjectPtr<MEDFileIntField1TS> ret=new MEDFileIntField1TS(other,shallowCopyOfContent);
+  ret->contentNotNull();
+  return ret.retn();
+}
+
+MEDFileIntField1TS::MEDFileIntField1TS()
+{
+  _content=new MEDFileIntField1TSWithoutSDA;
+}
+
+MEDFileIntField1TS::MEDFileIntField1TS(const char *fileName) throw(INTERP_KERNEL::Exception)
+try:MEDFileAnyTypeField1TS(fileName)
+{
+}
+catch(INTERP_KERNEL::Exception& e)
+  { throw e; }
+
+MEDFileIntField1TS::MEDFileIntField1TS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+try:MEDFileAnyTypeField1TS(fileName,fieldName)
+{
+}
+catch(INTERP_KERNEL::Exception& e)
+  { throw e; }
+
+MEDFileIntField1TS::MEDFileIntField1TS(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
+try:MEDFileAnyTypeField1TS(fileName,fieldName,iteration,order)
+{
+}
+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)
+{
+}
+
+MEDFileAnyTypeField1TS *MEDFileIntField1TS::shallowCpy() const throw(INTERP_KERNEL::Exception)
+{
+  return new MEDFileIntField1TS(*this);
+}
+
+/*!
+ * 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. The field double values are ignored.
+ *  \param [in] arrOfVals - the values of the field \a field used.
+ *  \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 MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception)
+{
+  setFileName("");
+  contentNotNull()->setFieldNoProfileSBT(field,arrOfVals,*this,*contentNotNull());
+}
+
+/*!
+ * Adds a MEDCouplingFieldDouble to \a this. Specified entities of a given dimension
+ * of a given mesh are used as the support of the given field (a real support is not used). 
+ * Elements of the given mesh must be sorted suitable for writing to MED file.
+ * Order of underlying mesh entities of the given field specified by \a profile parameter
+ * is not prescribed; this method permutes field values to have them sorted by element
+ * type as required for writing to MED file. 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 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.
+ *  \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 MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception)
+{
+  setFileName("");
+  contentNotNull()->setFieldProfile(field,arrOfVals,mesh,meshDimRelToMax,profile,*this,*contentNotNull());
+}
+
+const MEDFileIntField1TSWithoutSDA *MEDFileIntField1TS::contentNotNull() const throw(INTERP_KERNEL::Exception)
+{
+  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 !");
+  return ret;
+}
+
+MEDCouplingFieldDouble *MEDFileIntField1TS::getFieldAtLevel(TypeOfField type, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol) const throw(INTERP_KERNEL::Exception)
+{
+  if(getFileName2().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 !");
+  MEDCouplingAutoRefCountObjectPtr<DataArray> arrOut2;
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,0,renumPol,this,arrOut2,*contentNotNull());
+  DataArrayInt *arrOutC=dynamic_cast<DataArrayInt *>((DataArray *)arrOut2);
+  if(!arrOutC)
+    throw INTERP_KERNEL::Exception("MEDFileIntField1TS::getFieldAtLevelOld : mismatch between dataArrays type and MEDFileIntField1TS ! Expected int32 !");
+  arrOut=arrOutC;
+  return ret.retn();
+}
+
+DataArrayInt *MEDFileIntField1TS::ReturnSafelyDataArrayInt(MEDCouplingAutoRefCountObjectPtr<DataArray>& arr) throw(INTERP_KERNEL::Exception)
+{
+  if(!((DataArray *)arr))
+    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;
+}
+
+/*!
+ * 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 [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 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 *MEDFileIntField1TS::getFieldAtTopLevel(TypeOfField type, DataArrayInt* &arrOut, int renumPol) const throw(INTERP_KERNEL::Exception)
+{
+  if(getFileName2().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 !");
+  MEDCouplingAutoRefCountObjectPtr<DataArray> arr;
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldAtTopLevel(type,0,renumPol,this,arr,*contentNotNull());
+  arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr);
+  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 [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 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 *MEDFileIntField1TS::getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayInt* &arrOut, int renumPol) const throw(INTERP_KERNEL::Exception)
+{
+  MEDCouplingAutoRefCountObjectPtr<DataArray> arr;
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arr,*contentNotNull());
+  arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr);
+  return ret.retn();
+}
+
+/*!
+ * 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 [out] arrOut - the DataArrayInt containing values of 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 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 *MEDFileIntField1TS::getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt* &arrOut, int renumPol) const throw(INTERP_KERNEL::Exception)
+{
+  MEDCouplingAutoRefCountObjectPtr<DataArray> arr;
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arr,*contentNotNull());
+  arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr);
+  return ret.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 [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 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 *MEDFileIntField1TS::getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol) const throw(INTERP_KERNEL::Exception)
+{
+  if(getFileName2().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 !");
+  MEDCouplingAutoRefCountObjectPtr<DataArray> arr;
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arr,*contentNotNull());
+  arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr);
+  return ret.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 throw(INTERP_KERNEL::Exception)
+{
+  MEDCouplingAutoRefCountObjectPtr<DataArray> arr=contentNotNull()->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNull());
+  return MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr);
+}
+
+MEDFileIntField1TSWithoutSDA *MEDFileIntField1TS::contentNotNull() throw(INTERP_KERNEL::Exception)
+{
+  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;
+}
+
+DataArrayInt *MEDFileIntField1TS::getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
+{
+  return contentNotNull()->getUndergroundDataArrayInt();
+}
+
+//= MEDFileAnyTypeFieldMultiTSWithoutSDA
+
+MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA()
+{
+}
+
+MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA(const char *fieldName):MEDFileFieldNameScope(fieldName)
+{
+}
+
+/*!
+ * \param [in] fieldId field id in C mode
+ */
+MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, int fieldId) throw(INTERP_KERNEL::Exception)
+{
+  med_field_type typcha;
+  std::string dtunitOut;
+  int nbOfStep=MEDFileAnyTypeField1TS::LocateField2(fid,"",fieldId,false,_name,typcha,_infos,dtunitOut);
+  setDtUnit(dtunitOut.c_str());
+  finishLoading(fid,nbOfStep,typcha);
+}
+
+MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit) throw(INTERP_KERNEL::Exception)
+try:MEDFileFieldNameScope(fieldName),_infos(infos)
+{
+  setDtUnit(dtunit.c_str());
+  finishLoading(fid,nbOfStep,fieldTyp);
+}
+catch(INTERP_KERNEL::Exception& e)
+{
+  throw e;
+}
+
+std::size_t MEDFileAnyTypeFieldMultiTSWithoutSDA::getHeapMemorySize() const
+{
+  std::size_t ret=_name.capacity()+_infos.capacity()*sizeof(std::string)+_time_steps.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutSDA>);
+  for(std::vector<std::string>::const_iterator it=_infos.begin();it!=_infos.end();it++)
+    ret+=(*it).capacity();
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+    if((const MEDFileAnyTypeField1TSWithoutSDA *)(*it))
+      ret+=(*it)->getHeapMemorySize();
+  return ret;
+}
+
+/*!
+ * 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 throw(INTERP_KERNEL::Exception)
+{
+  MEDCouplingAutoRefCountObjectPtr<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];
+          MEDCouplingAutoRefCountObjectPtr<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().c_str());
+        }
+    }
+  if(ret->getNumberOfTS()>0)
+    ret->synchronizeNameScope();
+  ret->copyNameScope(*this);
+  return ret.retn();
+}
+
+/*!
+ * 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 throw(INTERP_KERNEL::Exception)
+{
+  static const char msg[]="MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds2";
+  int nbOfEntriesToKeep=DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg);
+  MEDCouplingAutoRefCountObjectPtr<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];
+          MEDCouplingAutoRefCountObjectPtr<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().c_str());
+        }
+    }
+  if(ret->getNumberOfTS()>0)
+    ret->synchronizeNameScope();
+  ret->copyNameScope(*this);
+  return ret.retn();
+}
+
+MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::partOfThisLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const throw(INTERP_KERNEL::Exception)
+{
+  int id=0;
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ids=DataArrayInt::New(); ids->alloc(0,1);
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<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());
+}
+
+MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::partOfThisNotLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const throw(INTERP_KERNEL::Exception)
+{
+  int id=0;
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ids=DataArrayInt::New(); ids->alloc(0,1);
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<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());
+}
+
+const std::vector<std::string>& MEDFileAnyTypeFieldMultiTSWithoutSDA::getInfo() const throw(INTERP_KERNEL::Exception)
+{
+  return _infos;
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::setInfo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception)
+{
+  _infos=info;
+}
+
+int MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepPos(int iteration, int order) const throw(INTERP_KERNEL::Exception)
+{
+  int ret=0;
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<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().c_str());
+}
+
+const MEDFileAnyTypeField1TSWithoutSDA& MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepEntry(int iteration, int order) const throw(INTERP_KERNEL::Exception)
+{
+  return *_time_steps[getTimeStepPos(iteration,order)];
+}
+
+MEDFileAnyTypeField1TSWithoutSDA& MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepEntry(int iteration, int order) throw(INTERP_KERNEL::Exception)
+{
+  return *_time_steps[getTimeStepPos(iteration,order)];
+}
+
+std::string MEDFileAnyTypeFieldMultiTSWithoutSDA::getMeshName() const throw(INTERP_KERNEL::Exception)
+{
+  if(_time_steps.empty())
+    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::getMeshName : not time steps !");
+  return _time_steps[0]->getMeshName();
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception)
+{
+  std::string oldName(getMeshName());
+  std::vector< std::pair<std::string,std::string> > v(1);
+  v[0].first=oldName; v[0].second=newMeshName;
+  changeMeshNames(v);
+}
+
+bool MEDFileAnyTypeFieldMultiTSWithoutSDA::changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab) throw(INTERP_KERNEL::Exception)
+{
+  bool ret=false;
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+    {
+      MEDFileAnyTypeField1TSWithoutSDA *cur(*it);
+      if(cur)
+        ret=cur->changeMeshNames(modifTab) || ret;
+    }
+  return ret;
+}
+
+/*!
+ * See doc at MEDFileField1TSWithoutSDA::getUndergroundDataArray
+ */
+DataArray *MEDFileAnyTypeFieldMultiTSWithoutSDA::getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
+{
+  return getTimeStepEntry(iteration,order).getUndergroundDataArray();
+}
+
+/*!
+ * 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 throw(INTERP_KERNEL::Exception)
+{
+  return getTimeStepEntry(iteration,order).getUndergroundDataArrayExt(entries);
+}
+
+bool MEDFileAnyTypeFieldMultiTSWithoutSDA::renumberEntitiesLyingOnMesh(const char *meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N,
+                                                                MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
+{
+  bool ret=false;
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<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;
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::simpleRepr(int bkOffset, std::ostream& oss, int fmtsId) 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++)
+    {
+      oss << startLine << "  -  \"" << *it << "\"" << std::endl;
+    }
+  int i=0;
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<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;
+    }
+}
+
+std::vector< std::pair<int,int> > MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeSteps(std::vector<double>& ret1) const throw(INTERP_KERNEL::Exception)
+{
+  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().c_str());
+        }
+    }
+  return ret;
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::pushBackTimeStep(MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA>& tse) throw(INTERP_KERNEL::Exception)
+{
+  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().c_str());
+      setInfo(tse2->getInfo());
+    }
+  checkThatComponentsMatch(tse2->getInfo());
+  _time_steps.push_back(tse);
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::synchronizeNameScope() throw(INTERP_KERNEL::Exception)
+{
+  std::size_t nbOfCompo=_infos.size();
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<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().c_str());
+            }
+          cur->copyNameScope(*this);
+        }
+    }
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::finishLoading(med_idt fid, int nbPdt, med_field_type fieldTyp) throw(INTERP_KERNEL::Exception)
+{
+  _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_int meshIt=0,meshOrder=0;
       med_float dt=0.0;
       MEDfieldComputingStepMeshInfo(fid,_name.c_str(),i+1,&numdt,&numo,&dt,&meshIt,&meshOrder);
-      _time_steps[i]=MEDFileField1TSWithoutSDA::New(_name.c_str(),i+1,_field_type,numdt,numo,_infos);
-      _time_steps[i]->finishLoading(fid);
+      switch(fieldTyp)
+        {
+        case MED_FLOAT64:
+          {
+            _time_steps[i]=MEDFileField1TSWithoutSDA::New(_name.c_str(),i+1,numdt,numo,_infos);
+            break;
+          }
+        case MED_INT32:
+          {
+            _time_steps[i]=MEDFileIntField1TSWithoutSDA::New(_name.c_str(),i+1,numdt,numo,_infos);
+            break;
+          }
+        default:
+          throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::finishLoading : managed field type are : FLOAT64, INT32 !");
+        }
+      _time_steps[i]->finishLoading(fid,*this);
+    }
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::writeLL(med_idt fid, const MEDFileWritable& opts) const throw(INTERP_KERNEL::Exception)
+{
+  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 !");
+  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);
+}
+
+int MEDFileAnyTypeFieldMultiTSWithoutSDA::getNumberOfTS() const
+{
+  return _time_steps.size();
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseEmptyTS() throw(INTERP_KERNEL::Exception)
+{
+  std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA>  > newTS;
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<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) throw(INTERP_KERNEL::Exception)
+{
+  std::vector< MEDCouplingAutoRefCountObjectPtr<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().c_str());
+        }
+    }
+  for(int iii=0;iii<maxId;iii++)
+    if(idsToDel.find(iii)==idsToDel.end())
+      newTS.push_back(_time_steps[iii]);
+  _time_steps=newTS;
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseTimeStepIds2(int bg, int end, int step) throw(INTERP_KERNEL::Exception)
+{
+  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< MEDCouplingAutoRefCountObjectPtr<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 throw(INTERP_KERNEL::Exception)
+{
+  int ret=0;
+  std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::getPosOfTimeStep : No such time step (" << iteration << "," << order << ") !\nPossibilities are : "; 
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<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().c_str());
+}
+
+int MEDFileAnyTypeFieldMultiTSWithoutSDA::getPosGivenTime(double time, double eps) const throw(INTERP_KERNEL::Exception)
+{
+  int ret=0;
+  std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::getPosGivenTime : No such time step " << time << "! \nPossibilities are : ";
+  oss.precision(15);
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA>  >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++)
+    {
+      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 << ", ";
+        }
+    }
+  throw INTERP_KERNEL::Exception(oss.str().c_str());
+}
+
+std::vector< std::pair<int,int> > MEDFileAnyTypeFieldMultiTSWithoutSDA::getIterations() const
+{
+  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;
+}
+
+/*!
+ * 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 char *mname, std::vector<int>& levs) const throw(INTERP_KERNEL::Exception)
+{
+  return getTimeStepEntry(iteration,order).getNonEmptyLevels(mname,levs);
+}
+
+const MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepAtPos2(int pos) const throw(INTERP_KERNEL::Exception)
+{
+  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().c_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().c_str());
+    }
+  return item;
+}
+
+MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepAtPos2(int pos) throw(INTERP_KERNEL::Exception)
+{
+  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().c_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().c_str());
+    }
+  return item;
+}
+
+std::vector<std::string> MEDFileAnyTypeFieldMultiTSWithoutSDA::getPflsReallyUsed2() const
+{
+  std::vector<std::string> ret;
+  std::set<std::string> ret2;
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr< 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);
+          }
+    }
+  return ret;
+}
+
+std::vector<std::string> MEDFileAnyTypeFieldMultiTSWithoutSDA::getLocsReallyUsed2() const
+{
+  std::vector<std::string> ret;
+  std::set<std::string> ret2;
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr< 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);
+          }
+    }
+  return ret;
+}
+
+std::vector<std::string> MEDFileAnyTypeFieldMultiTSWithoutSDA::getPflsReallyUsedMulti2() const
+{
+  std::vector<std::string> ret;
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr< 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;
+}
+
+std::vector<std::string> MEDFileAnyTypeFieldMultiTSWithoutSDA::getLocsReallyUsedMulti2() const
+{
+  std::vector<std::string> ret;
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr< 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;
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::changePflsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
+{
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TSWithoutSDA > >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+    (*it)->changePflsRefsNamesGen2(mapOfModif);
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::changeLocsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
+{
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TSWithoutSDA > >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+    (*it)->changeLocsRefsNamesGen2(mapOfModif);
+}
+
+std::vector< std::vector<TypeOfField> > MEDFileAnyTypeFieldMultiTSWithoutSDA::getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
+{
+  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;
+}
+
+/*!
+ * 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 char *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 throw(INTERP_KERNEL::Exception)
+{
+  return getTimeStepEntry(iteration,order).getFieldSplitedByType(mname,types,typesF,pfls,locs);
+}
+
+MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::deepCpy() const throw(INTERP_KERNEL::Exception)
+{
+  MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret=shallowCpy();
+  std::size_t i=0;
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++)
+    {
+      if((const MEDFileAnyTypeField1TSWithoutSDA *)*it)
+        ret->_time_steps[i]=(*it)->deepCpy();
+    }
+  return ret.retn();
+}
+
+std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitComponents() const throw(INTERP_KERNEL::Exception)
+{
+  std::size_t sz(_infos.size()),sz2(_time_steps.size());
+  std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> > ret(sz);
+  std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr<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< MEDCouplingAutoRefCountObjectPtr<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().c_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;
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr) throw(INTERP_KERNEL::Exception)
+{
+  _name=field->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();
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::checkCoherencyOfTinyInfo(const MEDCouplingFieldDouble *field, const DataArray *arr) const throw(INTERP_KERNEL::Exception)
+{
+  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().c_str());
+    }
+  if(!arr)
+    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::checkCoherencyOfTinyInfo : no array set !");
+  checkThatComponentsMatch(arr->getInfoOnComponents());
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::checkThatComponentsMatch(const std::vector<std::string>& compos) const throw(INTERP_KERNEL::Exception)
+{
+  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().c_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().c_str());
+    }
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::checkThatNbOfCompoOfTSMatchThis() const throw(INTERP_KERNEL::Exception)
+{
+  std::size_t sz=_infos.size();
+  int j=0;
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,j++)
+    {
+      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().c_str());
+          }
+    }
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
+{
+  if(!field)
+    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldNoProfileSBT : input field is NULL !");
+  if(!_time_steps.empty())
+    checkCoherencyOfTinyInfo(field,arr);
+  MEDFileAnyTypeField1TSWithoutSDA *objC=createNew1TSWithoutSDAEmptyInstance();
+  MEDCouplingAutoRefCountObjectPtr<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) throw(INTERP_KERNEL::Exception)
+{
+  if(!field)
+    throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTSWithoutSDA::appendFieldNoProfileSBT : input field is NULL !");
+  if(!_time_steps.empty())
+    checkCoherencyOfTinyInfo(field,arr);
+  MEDFileField1TSWithoutSDA *objC=new MEDFileField1TSWithoutSDA;
+  MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> obj(objC);
+  objC->setFieldProfile(field,arr,mesh,meshDimRelToMax,profile,glob,*this);
+  copyTinyInfoFrom(field,arr);
+  _time_steps.push_back(obj);
+}
+
+//= MEDFileFieldMultiTSWithoutSDA
+
+MEDFileFieldMultiTSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::New(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit) throw(INTERP_KERNEL::Exception)
+{
+  return new MEDFileFieldMultiTSWithoutSDA(fid,fieldName,fieldTyp,infos,nbOfStep,dtunit);
+}
+
+MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA()
+{
+}
+
+MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA(const char *fieldName):MEDFileAnyTypeFieldMultiTSWithoutSDA(fieldName)
+{
+}
+
+/*!
+ * \param [in] fieldId field id in C mode
+ */
+MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA(med_idt fid, int fieldId) throw(INTERP_KERNEL::Exception)
+try:MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldId)
+{
+}
+catch(INTERP_KERNEL::Exception& e)
+  { throw e; }
+
+MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit) throw(INTERP_KERNEL::Exception)
+try:MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldName,fieldTyp,infos,nbOfStep,dtunit)
+{
+}
+catch(INTERP_KERNEL::Exception& e)
+{ throw e; }
+
+MEDFileAnyTypeField1TSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::createNew1TSWithoutSDAEmptyInstance() const throw(INTERP_KERNEL::Exception)
+{
+  return new MEDFileField1TSWithoutSDA;
+}
+
+void MEDFileFieldMultiTSWithoutSDA::checkCoherencyOfType(const MEDFileAnyTypeField1TSWithoutSDA *f1ts) const throw(INTERP_KERNEL::Exception)
+{
+  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 !");
+}
+
+const char *MEDFileFieldMultiTSWithoutSDA::getTypeStr() const throw(INTERP_KERNEL::Exception)
+{
+  return MEDFileField1TSWithoutSDA::TYPE_STR;
+}
+
+MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::shallowCpy() const throw(INTERP_KERNEL::Exception)
+{
+  return new MEDFileFieldMultiTSWithoutSDA(*this);
+}
+
+MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::createNew() const throw(INTERP_KERNEL::Exception)
+{
+  return new MEDFileFieldMultiTSWithoutSDA;
+}
+
+/*!
+ * 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 char *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 throw(INTERP_KERNEL::Exception)
+{
+  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);
+}
+
+MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS()
+{
+}
+
+MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
+try:MEDFileFieldGlobsReal(fileName)
+{
+  MEDFileUtilities::CheckFileForRead(fileName);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  _content=BuildContentFrom(fid,fileName);
+  loadGlobals(fid);
+}
+catch(INTERP_KERNEL::Exception& e)
+  {
+    throw e;
+  }
+
+MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFrom(med_idt fid, const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+{
+  med_field_type typcha;
+  std::vector<std::string> infos;
+  std::string dtunit;
+  int i=-1;
+  MEDFileAnyTypeField1TS::LocateField(fid,fileName,fieldName,i,typcha,infos,dtunit);
+  MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret;
+  switch(typcha)
+    {
+    case MED_FLOAT64:
+      {
+        ret=new MEDFileFieldMultiTSWithoutSDA(fid,i);
+        break;
+      }
+    case MED_INT32:
+      {
+        ret=new MEDFileIntFieldMultiTSWithoutSDA(fid,i);
+        break;
+      }
+    default:
+      {
+        std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::BuildContentFrom(fileName,fieldName) : file \'" << fileName << "\' contains field with name \'" << fieldName << "\' but the type of field is not in [MED_FLOAT64, MED_INT32] !";
+        throw INTERP_KERNEL::Exception(oss.str().c_str());
+      }
+    }
+  ret->setDtUnit(dtunit.c_str());
+  return ret.retn();
+}
+
+MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFrom(med_idt fid, const char *fileName) throw(INTERP_KERNEL::Exception)
+{
+  med_field_type typcha;
+  //
+  std::vector<std::string> infos;
+  std::string dtunit,fieldName;
+  MEDFileAnyTypeField1TS::LocateField2(fid,fileName,0,true,fieldName,typcha,infos,dtunit);
+  MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret;
+  switch(typcha)
+    {
+    case MED_FLOAT64:
+      {
+        ret=new MEDFileFieldMultiTSWithoutSDA(fid,0);
+        break;
+      }
+    case MED_INT32:
+      {
+        ret=new MEDFileIntFieldMultiTSWithoutSDA(fid,0);
+        break;
+      }
+    default:
+      {
+        std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::BuildContentFrom(fileName) : file \'" << fileName << "\' 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().c_str());
+      }
+    }
+  ret->setDtUnit(dtunit.c_str());
+  return ret.retn();
+}
+
+MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent(MEDFileAnyTypeFieldMultiTSWithoutSDA *c, const char *fileName) throw(INTERP_KERNEL::Exception)
+{
+  if(!c)
+    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent : empty content in input : unable to build a new instance !");
+  if(dynamic_cast<const MEDFileFieldMultiTSWithoutSDA *>(c))
+    {
+      MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTS> ret=MEDFileFieldMultiTS::New();
+      ret->setFileName(fileName);
+      ret->_content=c;  c->incrRef();
+      return ret.retn();
+    }
+  if(dynamic_cast<const MEDFileIntFieldMultiTSWithoutSDA *>(c))
+    {
+      MEDCouplingAutoRefCountObjectPtr<MEDFileIntFieldMultiTS> ret=MEDFileIntFieldMultiTS::New();
+      ret->setFileName(fileName);
+      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 !");
+}
+
+MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+try:MEDFileFieldGlobsReal(fileName)
+{
+  MEDFileUtilities::CheckFileForRead(fileName);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  _content=BuildContentFrom(fid,fileName,fieldName);
+  loadGlobals(fid);
+}
+catch(INTERP_KERNEL::Exception& e)
+  {
+    throw e;
+  }
+
+//= MEDFileIntFieldMultiTSWithoutSDA
+
+MEDFileIntFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTSWithoutSDA::New(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit) throw(INTERP_KERNEL::Exception)
+{
+  return new MEDFileIntFieldMultiTSWithoutSDA(fid,fieldName,fieldTyp,infos,nbOfStep,dtunit);
+}
+
+MEDFileIntFieldMultiTSWithoutSDA::MEDFileIntFieldMultiTSWithoutSDA()
+{
+}
+
+MEDFileIntFieldMultiTSWithoutSDA::MEDFileIntFieldMultiTSWithoutSDA(const char *fieldName):MEDFileAnyTypeFieldMultiTSWithoutSDA(fieldName)
+{
+}
+
+MEDFileIntFieldMultiTSWithoutSDA::MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit) throw(INTERP_KERNEL::Exception)
+try:MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldName,fieldTyp,infos,nbOfStep,dtunit)
+{
+}
+catch(INTERP_KERNEL::Exception& e)
+{ throw e; }
+
+/*!
+ * \param [in] fieldId field id in C mode
+ */
+MEDFileIntFieldMultiTSWithoutSDA::MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, int fieldId) throw(INTERP_KERNEL::Exception)
+try:MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldId)
+{
+}
+catch(INTERP_KERNEL::Exception& e)
+  { throw e; }
+
+MEDFileAnyTypeField1TSWithoutSDA *MEDFileIntFieldMultiTSWithoutSDA::createNew1TSWithoutSDAEmptyInstance() const throw(INTERP_KERNEL::Exception)
+{
+  return new MEDFileIntField1TSWithoutSDA;
+}
+
+void MEDFileIntFieldMultiTSWithoutSDA::checkCoherencyOfType(const MEDFileAnyTypeField1TSWithoutSDA *f1ts) const throw(INTERP_KERNEL::Exception)
+{
+  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 !");
+}
+
+const char *MEDFileIntFieldMultiTSWithoutSDA::getTypeStr() const throw(INTERP_KERNEL::Exception)
+{
+  return MEDFileIntField1TSWithoutSDA::TYPE_STR;
+}
+
+MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTSWithoutSDA::shallowCpy() const throw(INTERP_KERNEL::Exception)
+{
+  return new MEDFileIntFieldMultiTSWithoutSDA(*this);
+}
+
+MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTSWithoutSDA::createNew() const throw(INTERP_KERNEL::Exception)
+{
+  return new MEDFileIntFieldMultiTSWithoutSDA;
+}
+
+//= 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.
+ */
+MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(const char *fileName) throw(INTERP_KERNEL::Exception)
+{
+  MEDFileUtilities::CheckFileForRead(fileName);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> c=BuildContentFrom(fid,fileName);
+  MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTS> ret=BuildNewInstanceFromContent(c,fileName);
+  ret->loadGlobals(fid);
+  return ret.retn();
+}
+
+/*!
+ * 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 char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+{
+  MEDFileUtilities::CheckFileForRead(fileName);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> c=BuildContentFrom(fid,fileName,fieldName);
+  MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTS> ret=BuildNewInstanceFromContent(c,fileName);
+  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)
+    {
+      const MEDFileAnyTypeFieldMultiTSWithoutSDA *otherPtr(&other);
+      otherPtr->incrRef();
+      _content=const_cast<MEDFileAnyTypeFieldMultiTSWithoutSDA *>(otherPtr);
+    }
+  else
+    {
+      _content=other.shallowCpy();
     }
 }
 
-void MEDFileFieldMultiTSWithoutSDA::copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception)
+MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::contentNotNullBase() throw(INTERP_KERNEL::Exception)
 {
-  _name=field->getName();
-  if(_name.empty())
-    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::copyTinyInfoFrom : unsupported fields with no name in MED file !");
-  const DataArrayDouble *arr=field->getArray();
-  if(!arr)
-    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::copyTinyInfoFrom : no array set !");
-  _infos=arr->getInfoOnComponents();
+  MEDFileAnyTypeFieldMultiTSWithoutSDA *ret=_content;
+  if(!ret)
+    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS : content is expected to be not null !");
+  return ret;
+}
+
+const MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::contentNotNullBase() const throw(INTERP_KERNEL::Exception)
+{
+  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) throw(INTERP_KERNEL::Exception)
+{
+  contentNotNullBase()->changePflsRefsNamesGen2(mapOfModif);
+}
+
+void MEDFileAnyTypeFieldMultiTS::changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
+{
+  contentNotNullBase()->changeLocsRefsNamesGen2(mapOfModif);
+}
+
+int MEDFileAnyTypeFieldMultiTS::getNumberOfTS() const
+{
+  return contentNotNullBase()->getNumberOfTS();
+}
+
+void MEDFileAnyTypeFieldMultiTS::eraseEmptyTS() throw(INTERP_KERNEL::Exception)
+{
+  contentNotNullBase()->eraseEmptyTS();
+}
+
+void MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds(const int *startIds, const int *endIds) throw(INTERP_KERNEL::Exception)
+{
+  contentNotNullBase()->eraseTimeStepIds(startIds,endIds);
+}
+
+void MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds2(int bg, int end, int step) throw(INTERP_KERNEL::Exception)
+{
+  contentNotNullBase()->eraseTimeStepIds2(bg,end,step);
+}
+
+MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::buildSubPart(const int *startIds, const int *endIds) const throw(INTERP_KERNEL::Exception)
+{
+  MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> c=contentNotNullBase()->buildFromTimeStepIds(startIds,endIds);
+  MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTS> ret=shallowCpy();
+  ret->_content=c;
+  return ret.retn();
+}
+
+MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::buildSubPartSlice(int bg, int end, int step) const throw(INTERP_KERNEL::Exception)
+{
+  MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> c=contentNotNullBase()->buildFromTimeStepIds2(bg,end,step);
+  MEDCouplingAutoRefCountObjectPtr<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) throw(INTERP_KERNEL::Exception)
+{
+  for(std::vector<MEDFileAnyTypeField1TS *>::const_iterator it=f1ts.begin();it!=f1ts.end();it++)
+    pushBackTimeStep(*it);
+}
+
+void MEDFileAnyTypeFieldMultiTS::pushBackTimeStep(MEDFileAnyTypeField1TS *f1ts) throw(INTERP_KERNEL::Exception)
+{
+  if(!f1ts)
+    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::pushBackTimeStep : input pointer is NULL !");
+  checkCoherencyOfType(f1ts);
+  f1ts->incrRef();
+  MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TS> f1tsSafe(f1ts);
+  MEDFileAnyTypeField1TSWithoutSDA *c=f1ts->contentNotNullBase();
+  c->incrRef();
+  MEDCouplingAutoRefCountObjectPtr<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() throw(INTERP_KERNEL::Exception)
+{
+  contentNotNullBase()->synchronizeNameScope();
+}
+
+int MEDFileAnyTypeFieldMultiTS::getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception)
+{
+  return contentNotNullBase()->getPosOfTimeStep(iteration,order);
+}
+
+int MEDFileAnyTypeFieldMultiTS::getPosGivenTime(double time, double eps) const throw(INTERP_KERNEL::Exception)
+{
+  return contentNotNullBase()->getPosGivenTime(time,eps);
+}
+
+int MEDFileAnyTypeFieldMultiTS::getNonEmptyLevels(int iteration, int order, const char *mname, std::vector<int>& levs) const throw(INTERP_KERNEL::Exception)
+{
+  return contentNotNullBase()->getNonEmptyLevels(iteration,order,mname,levs);
+}
+
+std::vector< std::vector<TypeOfField> > MEDFileAnyTypeFieldMultiTS::getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
+{
+  return contentNotNullBase()->getTypesOfFieldAvailable();
+}
+
+std::vector< std::vector< std::pair<int,int> > > MEDFileAnyTypeFieldMultiTS::getFieldSplitedByType(int iteration, int order, const char *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 throw(INTERP_KERNEL::Exception)
+{
+  return contentNotNullBase()->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
+}
+
+std::string MEDFileAnyTypeFieldMultiTS::getName() const
+{
+  return contentNotNullBase()->getName();
+}
+
+void MEDFileAnyTypeFieldMultiTS::setName(const char *name)
+{
+  contentNotNullBase()->setName(name);
+}
+
+std::string MEDFileAnyTypeFieldMultiTS::getDtUnit() const throw(INTERP_KERNEL::Exception)
+{
+  return contentNotNullBase()->getDtUnit();
+}
+
+void MEDFileAnyTypeFieldMultiTS::setDtUnit(const char *dtUnit) throw(INTERP_KERNEL::Exception)
+{
+  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 throw(INTERP_KERNEL::Exception)
+{
+  return contentNotNullBase()->getTimeSteps(ret1);
+}
+
+std::string MEDFileAnyTypeFieldMultiTS::getMeshName() const throw(INTERP_KERNEL::Exception)
+{
+  return contentNotNullBase()->getMeshName();
+}
+
+void MEDFileAnyTypeFieldMultiTS::setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception)
+{
+  contentNotNullBase()->setMeshName(newMeshName);
+}
+
+bool MEDFileAnyTypeFieldMultiTS::changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab) throw(INTERP_KERNEL::Exception)
+{
+  return contentNotNullBase()->changeMeshNames(modifTab);
+}
+
+const std::vector<std::string>& MEDFileAnyTypeFieldMultiTS::getInfo() const throw(INTERP_KERNEL::Exception)
+{
+  return contentNotNullBase()->getInfo();
+}
+
+void MEDFileAnyTypeFieldMultiTS::setInfo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception)
+{
+  return contentNotNullBase()->setInfo(info);
+}
+
+int MEDFileAnyTypeFieldMultiTS::getNumberOfComponents() const throw(INTERP_KERNEL::Exception)
+{
+  const std::vector<std::string> ret=getInfo();
+  return (int)ret.size();
+}
+
+void MEDFileAnyTypeFieldMultiTS::writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception)
+{
+  writeGlobals(fid,*this);
+  contentNotNullBase()->writeLL(fid,*this);
+}
+
+/*!
+ * Writes \a this field into a MED file specified by its name.
+ *  \param [in] fileName - the MED file name.
+ *  \param [in] mode - the writing mode. For more on \a mode, see \ref AdvMEDLoaderBasics.
+ * - 2 - erase; an existing file is removed.
+ * - 1 - append; same data should not be present in an existing file.
+ * - 0 - overwrite; same data present in an existing file is overwritten.
+ *  \throw If the field name is not set.
+ *  \throw If no field data is set.
+ *  \throw If \a mode == 1 and the same data is present in an existing file.
+ */
+void MEDFileAnyTypeFieldMultiTS::write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception)
+{
+  med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,medmod);
+  writeLL(fid);
+}
+
+std::string MEDFileAnyTypeFieldMultiTS::simpleRepr() const
+{
+  std::ostringstream oss;
+  contentNotNullBase()->simpleRepr(0,oss,-1);
+  simpleReprGlobs(oss);
+  return oss.str();
+}
+
+std::size_t MEDFileAnyTypeFieldMultiTS::getHeapMemorySize() const
+{
+  std::size_t ret=0;
+  if((const MEDFileAnyTypeFieldMultiTSWithoutSDA*)_content)
+    ret+=_content->getHeapMemorySize();
+  return ret+MEDFileFieldGlobsReal::getHeapMemorySize();
+}
+
+/*!
+ * This method returns as MEDFileAnyTypeField1TS 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< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > MEDFileAnyTypeFieldMultiTS::splitComponents() const throw(INTERP_KERNEL::Exception)
+{
+  const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(_content);
+  if(!content)
+    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::splitComponents : no content in this ! Unable to split components !");
+  std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> > contentsSplit=content->splitComponents();
+  std::size_t sz(contentsSplit.size());
+  std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > ret(sz);
+  for(std::size_t i=0;i<sz;i++)
+    {
+      ret[i]=shallowCpy();
+      ret[i]->_content=contentsSplit[i];
+    }
+  return ret;
+}
+
+MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::deepCpy() const throw(INTERP_KERNEL::Exception)
+{
+  MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTS> ret=shallowCpy();
+  if((const MEDFileAnyTypeFieldMultiTSWithoutSDA *)_content)
+    ret->_content=_content->deepCpy();
+  ret->deepCpyGlobs(*this);
+  return ret.retn();
+}
+
+MEDCouplingAutoRefCountObjectPtr<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 throw(INTERP_KERNEL::Exception)
+{
+  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 throw(INTERP_KERNEL::Exception)
+{
+  int pos=getPosGivenTime(time,eps);
+  return getTimeStepAtPos(pos);
+}
+
+MEDFileAnyTypeFieldMultiTSIterator *MEDFileAnyTypeFieldMultiTS::iterator() throw(INTERP_KERNEL::Exception)
+{
+  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 char *fileName) throw(INTERP_KERNEL::Exception)
+{
+  MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTS> ret=new MEDFileFieldMultiTS(fileName);
+  ret->contentNotNull();//to check that content type matches with \a this type.
+  return ret.retn();
 }
 
-void MEDFileFieldMultiTSWithoutSDA::checkCoherencyOfTinyInfo(const MEDCouplingFieldDouble *field) const throw(INTERP_KERNEL::Exception)
+/*!
+ * 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 char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
 {
-  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().c_str());
-    }
-  const DataArrayDouble *arr=field->getArray();
-  if(!arr)
-    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::checkCoherencyOfTinyInfo : no array set !");
-  if(_infos!=arr->getInfoOnComponents())
-    {
-      std::ostringstream oss; oss << MSG << "components ! should be \"";
-      std::copy(_infos.begin(),_infos.end(),std::ostream_iterator<std::string>(oss,", "));
-      oss << " But compo in input fields are : ";
-      std::vector<std::string> tmp=arr->getInfoOnComponents();
-      std::copy(tmp.begin(),tmp.end(),std::ostream_iterator<std::string>(oss,", "));
-      oss << " !";
-      throw INTERP_KERNEL::Exception(oss.str().c_str());
-    }
+  MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTS> ret=new MEDFileFieldMultiTS(fileName,fieldName);
+  ret->contentNotNull();//to check that content type matches with \a this type.
+  return ret.retn();
 }
 
-void MEDFileFieldMultiTSWithoutSDA::writeLL(med_idt fid, const MEDFileWritable& opts) const throw(INTERP_KERNEL::Exception)
+/*!
+ * 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)
 {
-  if(_time_steps.empty())
-    throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::writeLL : no time steps set !");
-  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 !");
-  MEDfieldCr(fid,_name.c_str(),MED_FLOAT64,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);
+  return new MEDFileFieldMultiTS(other,shallowCopyOfContent);
 }
 
-int MEDFileFieldMultiTSWithoutSDA::getNumberOfTS() const
+MEDFileAnyTypeFieldMultiTS *MEDFileFieldMultiTS::shallowCpy() const throw(INTERP_KERNEL::Exception)
 {
-  return _time_steps.size();
+  return new MEDFileFieldMultiTS(*this);
 }
 
-void MEDFileFieldMultiTSWithoutSDA::eraseEmptyTS() throw(INTERP_KERNEL::Exception)
+void MEDFileFieldMultiTS::checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const throw(INTERP_KERNEL::Exception)
 {
-  std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutSDA>  > newTS;
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutSDA>  >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
-    {
-      const MEDFileField1TSWithoutSDA *tmp=(*it);
-      if(tmp)
-        newTS.push_back(*it);
-    }
-  _time_steps=newTS;
+  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 !");
 }
 
-void MEDFileFieldMultiTSWithoutSDA::eraseTimeStepIds(const int *startIds, const int *endIds) throw(INTERP_KERNEL::Exception)
+/*!
+ * 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.
+ */
+MEDFileAnyTypeField1TS *MEDFileFieldMultiTS::getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception)
 {
-  std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutSDA>  > newTS;
-  int maxId=(int)_time_steps.size();
-  int ii=0;
-  std::set<int> idsToDel;
-  for(const int *id=startIds;id!=endIds;id++,ii++)
+  const MEDFileAnyTypeField1TSWithoutSDA *item=contentNotNullBase()->getTimeStepAtPos2(pos);
+  if(!item)
     {
-      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().c_str());
-        }
+      std::ostringstream oss; oss << "MEDFileFieldMultiTS::getTimeStepAtPos : field at pos #" << pos << " is null !";
+      throw INTERP_KERNEL::Exception(oss.str().c_str());
     }
-  for(int iii=0;iii<maxId;iii++)
-    if(idsToDel.find(iii)==idsToDel.end())
-      newTS.push_back(_time_steps[iii]);
-  _time_steps=newTS;
-}
-
-int MEDFileFieldMultiTSWithoutSDA::getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception)
-{
-  int ret=0;
-  std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::getPosOfTimeStep : No such time step (" << iteration << "," << order << ") !\nPossibilities are : "; 
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutSDA>  >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++)
+  const MEDFileField1TSWithoutSDA *itemC=dynamic_cast<const MEDFileField1TSWithoutSDA *>(item);
+  if(itemC)
     {
-      const MEDFileField1TSWithoutSDA *tmp(*it);
-      if(tmp)
-        {
-          int it2,ord;
-          tmp->getTime(it2,ord);
-          if(it2==iteration && order==ord)
-            return ret;
-          else
-            oss << "(" << it2 << ","  << ord << "), ";
-        }
+      MEDCouplingAutoRefCountObjectPtr<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().c_str());
 }
 
-int MEDFileFieldMultiTSWithoutSDA::getPosGivenTime(double time, double eps) const throw(INTERP_KERNEL::Exception)
+/*!
+ * 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 throw(INTERP_KERNEL::Exception)
 {
-  int ret=0;
-  std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::getPosGivenTime : No such time step " << time << "! \nPossibilities are : ";
-  oss.precision(15);
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutSDA>  >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++)
-    {
-      const MEDFileField1TSWithoutSDA *tmp(*it);
-      if(tmp)
-        {
-          int it2,ord;
-          double ti=tmp->getTime(it2,ord);
-          if(fabs(time-ti)<eps)
-            return ret;
-          else
-            oss << ti << ", ";
-        }
-    }
-  throw INTERP_KERNEL::Exception(oss.str().c_str());
+  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 !");
+  MEDCouplingAutoRefCountObjectPtr<DataArray> arrOut;
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,0,renumPol,this,arrOut,*contentNotNullBase());
+  MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
+  return ret.retn();
 }
 
-std::vector< std::pair<int,int> > MEDFileFieldMultiTSWithoutSDA::getIterations() const
+/*!
+ * 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 throw(INTERP_KERNEL::Exception)
 {
-  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;
+  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 !");
+  MEDCouplingAutoRefCountObjectPtr<DataArray> arrOut;
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=myF1TSC->getFieldAtTopLevel(type,0,renumPol,this,arrOut,*contentNotNullBase());
+  MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
+  return ret.retn();
 }
 
 /*!
- * 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.
+ * 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.
  *
- * 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
+ *  \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 throw(INTERP_KERNEL::Exception)
+{
+  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 !");
+  MEDCouplingAutoRefCountObjectPtr<DataArray> arrOut;
+  MEDCouplingAutoRefCountObjectPtr<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.
  *
- * 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
+ *  \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 throw(INTERP_KERNEL::Exception)
+{
+  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 !");
+  MEDCouplingAutoRefCountObjectPtr<DataArray> arrOut;
+  MEDCouplingAutoRefCountObjectPtr<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 char *mname, int iteration, int order, int meshDimRelToMax, int renumPol) const throw(INTERP_KERNEL::Exception)
+{
+  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 !");
+  MEDCouplingAutoRefCountObjectPtr<DataArray> arrOut;
+  MEDCouplingAutoRefCountObjectPtr<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.
  */
-int MEDFileFieldMultiTSWithoutSDA::getNonEmptyLevels(int iteration, int order, const char *mname, std::vector<int>& levs) const throw(INTERP_KERNEL::Exception)
+DataArrayDouble *MEDFileFieldMultiTS::getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const throw(INTERP_KERNEL::Exception)
 {
-  return getTimeStepEntry(iteration,order).getNonEmptyLevels(mname,levs);
+  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 !");
+  MEDCouplingAutoRefCountObjectPtr<DataArray> ret=myF1TSC->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNullBase());
+  return MEDFileField1TS::ReturnSafelyDataArrayDouble(ret);
 }
 
-std::vector< std::vector<TypeOfField> > MEDFileFieldMultiTSWithoutSDA::getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
+const MEDFileFieldMultiTSWithoutSDA *MEDFileFieldMultiTS::contentNotNull() const throw(INTERP_KERNEL::Exception)
 {
-  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]);
+  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() throw(INTERP_KERNEL::Exception)
+{
+  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 !");
   return ret;
 }
 
 /*!
- * entry point for users that want to iterate into MEDFile DataStructure without any overhead.
+ * 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.
  */
-std::vector< std::vector< std::pair<int,int> > > MEDFileFieldMultiTSWithoutSDA::getFieldSplitedByType(int iteration, int order, const char *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 throw(INTERP_KERNEL::Exception)
+void MEDFileFieldMultiTS::appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception)
 {
-  return getTimeStepEntry(iteration,order).getFieldSplitedByType(mname,types,typesF,pfls,locs);
+  const DataArrayDouble *arr=0;
+  if(field)
+    arr=field->getArray();
+  contentNotNull()->appendFieldNoProfileSBT(field,arr,*this);
 }
 
 /*!
- * 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.
+ * Adds a MEDCouplingFieldDouble to \a this as another time step. Specified entities of
+ * a given dimension of a given mesh are used as the support of the given field.
+ * Elements of the given mesh must be sorted suitable for writing to MED file. 
+ * Order of underlying mesh entities of the given field specified by \a profile parameter
+ * is not prescribed; this method permutes field values to have them sorted by element
+ * type as required for writing to MED file.  
+ * 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.
+ *  \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 existing time steps have different name or number of components than \a field.
+ *  \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 elements in \a mesh are not in the order suitable for writing to the MED file.
  */
-std::vector< std::vector<DataArrayDouble *> > MEDFileFieldMultiTSWithoutSDA::getFieldSplitedByType2(int iteration, int order, const char *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 throw(INTERP_KERNEL::Exception)
+void MEDFileFieldMultiTS::appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception)
 {
-  return getTimeStepEntry(iteration,order).getFieldSplitedByType2(mname,types,typesF,pfls,locs);
+  const DataArrayDouble *arr=0;
+  if(field)
+    arr=field->getArray();
+  contentNotNull()->appendFieldProfile(field,arr,mesh,meshDimRelToMax,profile,*this);
 }
 
-const MEDFileField1TSWithoutSDA& MEDFileFieldMultiTSWithoutSDA::getTimeStepEntry(int iteration, int order) const throw(INTERP_KERNEL::Exception)
+MEDFileFieldMultiTS::MEDFileFieldMultiTS()
 {
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutSDA>  >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
-    if((*it)->isDealingTS(iteration,order))
-      return *(*it);
-  std::ostringstream oss; oss << "MEDFileFieldMultiTS::getTimeStepEntry : 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().c_str());
+  _content=new MEDFileFieldMultiTSWithoutSDA;
 }
 
-MEDFileField1TSWithoutSDA& MEDFileFieldMultiTSWithoutSDA::getTimeStepEntry(int iteration, int order) throw(INTERP_KERNEL::Exception)
+MEDFileFieldMultiTS::MEDFileFieldMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
+try:MEDFileAnyTypeFieldMultiTS(fileName)
 {
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutSDA>  >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
-    if((*it)->isDealingTS(iteration,order))
-      return *(*it);
-  std::ostringstream oss; oss << "MEDFileFieldMultiTS::getTimeStepEntry : 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().c_str());
 }
+catch(INTERP_KERNEL::Exception& e)
+  { throw e; }
 
-const MEDFileField1TSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::getTimeStepAtPos2(int pos) const throw(INTERP_KERNEL::Exception)
+MEDFileFieldMultiTS::MEDFileFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+try:MEDFileAnyTypeFieldMultiTS(fileName,fieldName)
 {
-  if(pos<0 || pos>=(int)_time_steps.size())
-    {
-      std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::getTimeStepAtPos2 : request for pos #" << pos << " whereas should be in [0," << _time_steps.size() << ") !";
-      throw INTERP_KERNEL::Exception(oss.str().c_str());
-    }
-  const MEDFileField1TSWithoutSDA *item=_time_steps[pos];
-  if(item==0)
-    {
-      std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::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().c_str());
-    }
-  return item;
 }
+catch(INTERP_KERNEL::Exception& e)
+  { throw e; }
 
-MEDFileField1TSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::getTimeStepAtPos2(int pos) throw(INTERP_KERNEL::Exception)
+MEDFileFieldMultiTS::MEDFileFieldMultiTS(const MEDFileFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent):MEDFileAnyTypeFieldMultiTS(other,shallowCopyOfContent)
 {
-  if(pos<0 || pos>=(int)_time_steps.size())
-    {
-      std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::getTimeStepAtPos2 : request for pos #" << pos << " whereas should be in [0," << _time_steps.size() << ") !";
-      throw INTERP_KERNEL::Exception(oss.str().c_str());
-    }
-  MEDFileField1TSWithoutSDA *item=_time_steps[pos];
-  if(item==0)
-    {
-      std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::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().c_str());
-    }
-  return item;
 }
 
-std::vector<std::string> MEDFileFieldMultiTSWithoutSDA::getPflsReallyUsed2() const
+std::vector< std::vector<DataArrayDouble *> > MEDFileFieldMultiTS::getFieldSplitedByType2(int iteration, int order, const char *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 throw(INTERP_KERNEL::Exception)
 {
-  std::vector<std::string> ret;
-  std::set<std::string> ret2;
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileField1TSWithoutSDA > >::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);
-          }
-    }
-  return ret;
+  return contentNotNull()->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
 }
 
-std::vector<std::string> MEDFileFieldMultiTSWithoutSDA::getLocsReallyUsed2() const
+DataArrayDouble *MEDFileFieldMultiTS::getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
 {
-  std::vector<std::string> ret;
-  std::set<std::string> ret2;
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileField1TSWithoutSDA > >::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);
-          }
-    }
-  return ret;
+  return static_cast<DataArrayDouble *>(contentNotNull()->getUndergroundDataArray(iteration,order));
 }
 
-std::vector<std::string> MEDFileFieldMultiTSWithoutSDA::getPflsReallyUsedMulti2() const
+DataArrayDouble *MEDFileFieldMultiTS::getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception)
 {
-  std::vector<std::string> ret;
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileField1TSWithoutSDA > >::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 static_cast<DataArrayDouble *>(contentNotNull()->getUndergroundDataArrayExt(iteration,order,entries));
 }
 
-std::vector<std::string> MEDFileFieldMultiTSWithoutSDA::getLocsReallyUsedMulti2() const
+//= MEDFileAnyTypeFieldMultiTSIterator
+
+MEDFileAnyTypeFieldMultiTSIterator::MEDFileAnyTypeFieldMultiTSIterator(MEDFileAnyTypeFieldMultiTS *fmts):_fmts(fmts),_iter_id(0),_nb_iter(0)
 {
-  std::vector<std::string> ret;
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+  if(fmts)
     {
-      std::vector<std::string> tmp=(*it)->getLocsReallyUsedMulti2();
-      ret.insert(ret.end(),tmp.begin(),tmp.end());
+      fmts->incrRef();
+      _nb_iter=fmts->getNumberOfTS();
     }
-  return ret;
 }
 
-void MEDFileFieldMultiTSWithoutSDA::changePflsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
+MEDFileAnyTypeFieldMultiTSIterator::~MEDFileAnyTypeFieldMultiTSIterator() 
 {
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileField1TSWithoutSDA > >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
-    (*it)->changePflsRefsNamesGen2(mapOfModif);
 }
 
-void MEDFileFieldMultiTSWithoutSDA::changeLocsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
+MEDFileAnyTypeField1TS *MEDFileAnyTypeFieldMultiTSIterator::nextt() throw(INTERP_KERNEL::Exception)
 {
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileField1TSWithoutSDA > >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
-    (*it)->changeLocsRefsNamesGen2(mapOfModif);
+  if(_iter_id<_nb_iter)
+    {
+      MEDFileAnyTypeFieldMultiTS *fmts(_fmts);
+      if(fmts)
+        return fmts->getTimeStepAtPos(_iter_id++);
+      else
+        return 0;
+    }
+  else
+    return 0;
 }
 
+//= MEDFileIntFieldMultiTS
+
 /*!
  * Returns a new empty instance of MEDFileFieldMultiTS.
- *  \return MEDFileFieldMultiTS * - a new instance of MEDFileFieldMultiTS. The caller
+ *  \return MEDFileIntFieldMultiTS * - a new instance of MEDFileIntFieldMultiTS. The caller
  *          is to delete this field using decrRef() as it is no more needed.
  */
-MEDFileFieldMultiTS *MEDFileFieldMultiTS::New()
+MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New()
 {
-  return new MEDFileFieldMultiTS;
+  return new MEDFileIntFieldMultiTS;
 }
 
 /*!
- * Returns a new instance of MEDFileFieldMultiTS holding data of the first field
+ * 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 MEDFileFieldMultiTS. The caller
+ *  \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.
  */
-MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(const char *fileName) throw(INTERP_KERNEL::Exception)
+MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New(const char *fileName) throw(INTERP_KERNEL::Exception)
 {
-  return new MEDFileFieldMultiTS(fileName);
+  MEDCouplingAutoRefCountObjectPtr<MEDFileIntFieldMultiTS> ret=new MEDFileIntFieldMultiTS(fileName);
+  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
+ * 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 MEDFileFieldMultiTS. The caller
+ *  \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.
  */
-MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
 {
-  return new MEDFileFieldMultiTS(fileName,fieldName);
+  MEDCouplingAutoRefCountObjectPtr<MEDFileIntFieldMultiTS> ret=new MEDFileIntFieldMultiTS(fileName,fieldName);
+  ret->contentNotNull();//to check that content type matches with \a this type.
+  return ret.retn();
 }
 
 /*!
- * Returns a new instance of MEDFileFieldMultiTS holding either deep or shallow copy
- * of a given MEDFileFieldMultiTSWithoutSDA.
- *  \param [in] other - a MEDFileFieldMultiTSWithoutSDA to copy.
+ * 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 MEDFileFieldMultiTS * - a new instance of MEDFileFieldMultiTS. The caller
+ *  \return MEDFileIntFieldMultiTS * - a new instance of MEDFileIntFieldMultiTS. 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);
-}
-
-std::size_t MEDFileFieldMultiTS::getHeapMemorySize() const
-{
-  std::size_t ret=0;
-  if((const MEDFileFieldMultiTSWithoutSDA*)_content)
-    ret+=_content->getHeapMemorySize();
-  return ret+MEDFileFieldGlobsReal::getHeapMemorySize();
-}
-
-MEDFileFieldMultiTS *MEDFileFieldMultiTS::deepCpy() const throw(INTERP_KERNEL::Exception)
-{
-  MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTS> ret=new MEDFileFieldMultiTS(*this);
-  if((const MEDFileFieldMultiTSWithoutSDA *)_content)
-    ret->_content=_content->deepCpy();
-  ret->deepCpyGlobs(*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 throw(INTERP_KERNEL::Exception)
-{
-  const MEDFileField1TSWithoutSDA *item=_content->getTimeStepAtPos2(pos);
-  MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ret=MEDFileField1TS::New(*item,false);
-  ret->shallowCpyGlobs(*this);
-  return ret.retn();
-}
-
-/*!
- * Returns a new MEDFileField1TS 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 * - 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.
- */
-MEDFileField1TS *MEDFileFieldMultiTS::getTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception)
-{
-  int pos=getPosOfTimeStep(iteration,order);
-  return getTimeStepAtPos(pos);
-}
-
-/*!
- * Returns a new MEDFileField1TS 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.
- */
-MEDFileField1TS *MEDFileFieldMultiTS::getTimeStepGivenTime(double time, double eps) const throw(INTERP_KERNEL::Exception)
-{
-  int pos=getPosGivenTime(time,eps);
-  return getTimeStepAtPos(pos);
-}
-
-MEDFileFieldMultiTSIterator *MEDFileFieldMultiTS::iterator() throw(INTERP_KERNEL::Exception)
-{
-  return new MEDFileFieldMultiTSIterator(this);
-}
-
-std::string MEDFileFieldMultiTS::simpleRepr() const
+MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New(const MEDFileIntFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent)
 {
-  std::ostringstream oss;
-  _content->simpleRepr(0,oss,-1);
-  MEDFileFieldGlobsReal::simpleRepr(oss);
-  return oss.str();
+  return new MEDFileIntFieldMultiTS(other,shallowCopyOfContent);
 }
 
-void MEDFileFieldMultiTS::writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception)
+MEDFileAnyTypeFieldMultiTS *MEDFileIntFieldMultiTS::shallowCpy() const throw(INTERP_KERNEL::Exception)
 {
-  writeGlobals(fid,*this);
-  _content->writeLL(fid,*this);
+  return new MEDFileIntFieldMultiTS(*this);
 }
 
-/*!
- * Writes \a this field into a MED file specified by its name.
- *  \param [in] fileName - the MED file name.
- *  \param [in] mode - the writing mode. For more on \a mode, see \ref AdvMEDLoaderBasics.
- * - 2 - erase; an existing file is removed.
- * - 1 - append; same data should not be present in an existing file.
- * - 0 - overwrite; same data present in an existing file is overwritten.
- *  \throw If the field name is not set.
- *  \throw If no field data is set.
- *  \throw If \a mode == 1 and the same data is present in an existing file.
- */
-void MEDFileFieldMultiTS::write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception)
+void MEDFileIntFieldMultiTS::checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const throw(INTERP_KERNEL::Exception)
 {
-  med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,medmod);
-  writeLL(fid);
+  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 !");
 }
 
 /*!
@@ -5919,6 +8162,7 @@ void MEDFileFieldMultiTS::write(const char *fileName, int mode) const throw(INTE
  *  \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 [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.
@@ -5933,10 +8177,16 @@ void MEDFileFieldMultiTS::write(const char *fileName, int mode) const throw(INTE
  *  \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 throw(INTERP_KERNEL::Exception)
+MEDCouplingFieldDouble *MEDFileIntFieldMultiTS::getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol) const throw(INTERP_KERNEL::Exception)
 {
-  const MEDFileField1TSWithoutSDA& myF1TS=_content->getTimeStepEntry(iteration,order);
-  return myF1TS.getFieldAtLevel(type,meshDimRelToMax,0,renumPol,this);
+  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 !");
+  MEDCouplingAutoRefCountObjectPtr<DataArray> arr;
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,0,renumPol,this,arr,*contentNotNullBase());
+  arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr);
+  return ret.retn();
 }
 
 /*!
@@ -5946,6 +8196,7 @@ MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldAtLevel(TypeOfField type, i
  *  \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 [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.
@@ -5959,10 +8210,16 @@ MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldAtLevel(TypeOfField type, i
  *  \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 throw(INTERP_KERNEL::Exception)
+MEDCouplingFieldDouble *MEDFileIntFieldMultiTS::getFieldAtTopLevel(TypeOfField type, int iteration, int order, DataArrayInt* &arrOut, int renumPol) const throw(INTERP_KERNEL::Exception)
 {
-  const MEDFileField1TSWithoutSDA& myF1TS=_content->getTimeStepEntry(iteration,order);
-  return myF1TS.getFieldAtTopLevel(type,0,renumPol,this);
+  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 !");
+  MEDCouplingAutoRefCountObjectPtr<DataArray> arr;
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=myF1TSC->getFieldAtTopLevel(type,0,renumPol,this,arr,*contentNotNullBase());
+  arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr);
+  return ret.retn();
 }
 
 /*!
@@ -5972,6 +8229,7 @@ MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldAtTopLevel(TypeOfField type
  *  \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 [out] arrOut - the DataArrayInt containing values of field.
  *  \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
@@ -5987,10 +8245,16 @@ MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldAtTopLevel(TypeOfField type
  *  \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 throw(INTERP_KERNEL::Exception)
+MEDCouplingFieldDouble *MEDFileIntFieldMultiTS::getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt* &arrOut, int renumPol) const throw(INTERP_KERNEL::Exception)
 {
-  const MEDFileField1TSWithoutSDA& myF1TS=_content->getTimeStepEntry(iteration,order);
-  return myF1TS.getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh);
+  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 !");
+  MEDCouplingAutoRefCountObjectPtr<DataArray> arr;
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=myF1TSC->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arr,*contentNotNullBase());
+  arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr);
+  return ret.retn();
 }
 
 /*!
@@ -6001,6 +8265,7 @@ MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldOnMeshAtLevel(TypeOfField t
  *  \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.
@@ -6013,21 +8278,33 @@ MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldOnMeshAtLevel(TypeOfField t
  *  \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 throw(INTERP_KERNEL::Exception)
+MEDCouplingFieldDouble *MEDFileIntFieldMultiTS::getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, DataArrayInt* &arrOut, int renumPol) const throw(INTERP_KERNEL::Exception)
 {
-  const MEDFileField1TSWithoutSDA& myF1TS=_content->getTimeStepEntry(iteration,order);
-  return myF1TS.getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0);
+  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 !");
+  MEDCouplingAutoRefCountObjectPtr<DataArray> arr;
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=myF1TSC->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arr,*contentNotNullBase());
+  arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr);
+  return ret.retn();
 }
 
 /*!
- * This method has a close behaviour than MEDFileFieldMultiTS::getFieldAtLevel.
+ * 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.
  */
-MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldAtLevelOld(TypeOfField type, const char *mname, int iteration, int order, int meshDimRelToMax, int renumPol) const throw(INTERP_KERNEL::Exception)
+MEDCouplingFieldDouble *MEDFileIntFieldMultiTS::getFieldAtLevelOld(TypeOfField type, int iteration, int order, const char *mname, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol) const throw(INTERP_KERNEL::Exception)
 {
-  const MEDFileField1TSWithoutSDA& myF1TS=_content->getTimeStepEntry(iteration,order);
-  return myF1TS.getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this);
+  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 !");
+  MEDCouplingAutoRefCountObjectPtr<DataArray> arr;
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arr,*contentNotNullBase());
+  arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr);
+  return ret.retn();
 }
 
 /*!
@@ -6044,16 +8321,46 @@ MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldAtLevelOld(TypeOfField type
  *          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
+ *  \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.
  */
-DataArrayDouble *MEDFileFieldMultiTS::getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const throw(INTERP_KERNEL::Exception)
+DataArrayInt *MEDFileIntFieldMultiTS::getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const throw(INTERP_KERNEL::Exception)
+{
+  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 !");
+  MEDCouplingAutoRefCountObjectPtr<DataArray> ret=myF1TSC->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNullBase());
+  return MEDFileIntField1TS::ReturnSafelyDataArrayInt(ret);
+}
+
+/*!
+ * 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.
+ */
+MEDFileAnyTypeField1TS *MEDFileIntFieldMultiTS::getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception)
 {
-  const MEDFileField1TSWithoutSDA& myF1TS=_content->getTimeStepEntry(iteration,order);
-  return myF1TS.getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this);
+  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().c_str());
+    }
+  const MEDFileIntField1TSWithoutSDA *itemC=dynamic_cast<const MEDFileIntField1TSWithoutSDA *>(item);
+  if(itemC)
+    {
+      MEDCouplingAutoRefCountObjectPtr<MEDFileIntField1TS> ret=MEDFileIntField1TS::New(*itemC,false);
+      ret->shallowCpyGlobs(*this);
+      return ret.retn();
+    }
+  std::ostringstream oss; oss << "MEDFileIntFieldMultiTS::getTimeStepAtPos : type of field at pos #" << pos << " is not INT32 !";
+  throw INTERP_KERNEL::Exception(oss.str().c_str());
 }
 
 /*!
@@ -6068,9 +8375,9 @@ DataArrayDouble *MEDFileFieldMultiTS::getFieldWithProfile(TypeOfField type, int
  *  \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 MEDFileFieldMultiTS::appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception)
+void MEDFileIntFieldMultiTS::appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception)
 {
-  _content->appendFieldNoProfileSBT(field,*this);
+  contentNotNull()->appendFieldNoProfileSBT(field,arrOfVals,*this);
 }
 
 /*!
@@ -6091,252 +8398,62 @@ void MEDFileFieldMultiTS::appendFieldNoProfileSBT(const MEDCouplingFieldDouble *
  *  \throw If the data array of \a field is not set.
  *  \throw If elements in \a mesh are not in the order suitable for writing to the MED file.
  */
-void MEDFileFieldMultiTS::appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception)
-{
-  _content->appendFieldProfile(field,mesh,meshDimRelToMax,profile,*this);
-}
-
-MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTSWithoutSDA> MEDFileFieldMultiTS::getContent()
-{
-  return _content;
-}
-
-MEDFileFieldMultiTS::MEDFileFieldMultiTS():_content(new MEDFileFieldMultiTSWithoutSDA)
-{
-}
-
-
-
-MEDFileFieldMultiTS::MEDFileFieldMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
-try:MEDFileFieldGlobsReal(fileName)
-{
-  MEDFileUtilities::CheckFileForRead(fileName);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
-  int nbFields=MEDnField(fid);
-  if(nbFields<1)
-    {
-      std::ostringstream oss; oss << "MEDFileFieldMultiTS(const char *fileName) constructor : no fields in file \"" << fileName << "\" !";
-      throw INTERP_KERNEL::Exception(oss.str().c_str());
-    }
-  _content=new MEDFileFieldMultiTSWithoutSDA(fid,0);
-  //
-  loadGlobals(fid);
-}
-catch(INTERP_KERNEL::Exception& e)
-  {
-    throw e;
-  }
-
-MEDFileFieldMultiTS::MEDFileFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
-try:MEDFileFieldGlobsReal(fileName)
-{
-  MEDFileUtilities::CheckFileForRead(fileName);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
-  int nbFields=MEDnField(fid);
-  med_field_type typcha;
-  bool found=false;
-  std::vector<std::string> fns(nbFields);
-  for(int i=0;i<nbFields && !found;i++)
-    {
-      int ncomp=MEDfieldnComponent(fid,i+1);
-      INTERP_KERNEL::AutoPtr<char> comp=MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE);
-      INTERP_KERNEL::AutoPtr<char> unit=MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE);
-      INTERP_KERNEL::AutoPtr<char> dtunit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE);
-      INTERP_KERNEL::AutoPtr<char> nomcha=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
-      INTERP_KERNEL::AutoPtr<char> nomMaa=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
-      med_bool localMesh;
-      int nbOfStep;
-      MEDfieldInfo(fid,i+1,nomcha,nomMaa,&localMesh,&typcha,comp,unit,dtunit,&nbOfStep);
-      std::string tmp(nomcha);
-      fns[i]=tmp;
-      found=(tmp==fieldName);
-      if(found)
-        _content=new MEDFileFieldMultiTSWithoutSDA(fid,i);
-    }
-  if(!found)
-    {
-      std::ostringstream oss; oss << "No such field '" << fieldName << "' in file '" << fileName << "' ! Available fields are : ";
-      std::copy(fns.begin(),fns.end(),std::ostream_iterator<std::string>(oss," "));
-      throw INTERP_KERNEL::Exception(oss.str().c_str());
-    }
-  //
-  loadGlobals(fid);
-}
-catch(INTERP_KERNEL::Exception& e)
-  {
-    throw e;
-  }
-
-MEDFileFieldMultiTS::MEDFileFieldMultiTS(const MEDFileFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent)
-{
-  if(!shallowCopyOfContent)
-    {
-      const MEDFileFieldMultiTSWithoutSDA *otherPtr(&other);
-      otherPtr->incrRef();
-      _content=const_cast<MEDFileFieldMultiTSWithoutSDA *>(otherPtr);
-    }
-  else
-    {
-      _content=new MEDFileFieldMultiTSWithoutSDA(other);
-    }
-}
-
-std::vector<std::string> MEDFileFieldMultiTS::getPflsReallyUsed() const
-{
-  return _content->getPflsReallyUsed2();
-}
-
-std::vector<std::string> MEDFileFieldMultiTS::getLocsReallyUsed() const
-{
-  return _content->getLocsReallyUsed2();
-}
-
-std::vector<std::string> MEDFileFieldMultiTS::getPflsReallyUsedMulti() const
-{
-  return _content->getPflsReallyUsedMulti2();
-}
-
-std::vector<std::string> MEDFileFieldMultiTS::getLocsReallyUsedMulti() const
-{
-  return _content->getLocsReallyUsedMulti2();
-}
-
-void MEDFileFieldMultiTS::changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
-{
-  _content->changePflsRefsNamesGen2(mapOfModif);
-}
-
-void MEDFileFieldMultiTS::changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
-{
-  _content->changeLocsRefsNamesGen2(mapOfModif);
-}
-
-int MEDFileFieldMultiTS::getNumberOfTS() const
-{
-  return _content->getNumberOfTS();
-}
-
-void MEDFileFieldMultiTS::eraseEmptyTS() throw(INTERP_KERNEL::Exception)
-{
-  _content->eraseEmptyTS();
-}
-
-void MEDFileFieldMultiTS::eraseTimeStepIds(const int *startIds, const int *endIds) throw(INTERP_KERNEL::Exception)
-{
-  _content->eraseTimeStepIds(startIds,endIds);
-}
-
-std::vector< std::pair<int,int> > MEDFileFieldMultiTS::getIterations() const
-{
-  return _content->getIterations();
-}
-
-int MEDFileFieldMultiTS::getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception)
-{
-  return _content->getPosOfTimeStep(iteration,order);
-}
-
-int MEDFileFieldMultiTS::getPosGivenTime(double time, double eps) const throw(INTERP_KERNEL::Exception)
-{
-  return _content->getPosGivenTime(time,eps);
-}
-
-int MEDFileFieldMultiTS::getNonEmptyLevels(int iteration, int order, const char *mname, std::vector<int>& levs) const throw(INTERP_KERNEL::Exception)
-{
-  return _content->getNonEmptyLevels(iteration,order,mname,levs);
-}
-
-std::vector< std::vector<TypeOfField> > MEDFileFieldMultiTS::getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
-{
-  return _content->getTypesOfFieldAvailable();
-}
-
-std::vector< std::vector< std::pair<int,int> > > MEDFileFieldMultiTS::getFieldSplitedByType(int iteration, int order, const char *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 throw(INTERP_KERNEL::Exception)
-{
-  return _content->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
-}
-
-std::vector< std::vector<DataArrayDouble *> > MEDFileFieldMultiTS::getFieldSplitedByType2(int iteration, int order, const char *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 throw(INTERP_KERNEL::Exception)
-{
-  return _content->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
-}
-
-std::string MEDFileFieldMultiTS::getName() const
+void MEDFileIntFieldMultiTS::appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception)
 {
-  return _content->getName();
+  contentNotNull()->appendFieldProfile(field,arrOfVals,mesh,meshDimRelToMax,profile,*this);
 }
 
-void MEDFileFieldMultiTS::setName(const char *name)
+const MEDFileIntFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTS::contentNotNull() const throw(INTERP_KERNEL::Exception)
 {
-  _content->setName(name);
-}
-
-void MEDFileFieldMultiTS::simpleRepr(int bkOffset, std::ostream& oss, int fmtsId) const
-{
-  _content->simpleRepr(bkOffset,oss,fmtsId);
-}
-
-std::vector< std::pair<int,int> > MEDFileFieldMultiTS::getTimeSteps(std::vector<double>& ret1) const throw(INTERP_KERNEL::Exception)
-{
-  return _content->getTimeSteps(ret1);
-}
-
-std::string MEDFileFieldMultiTS::getMeshName() const throw(INTERP_KERNEL::Exception)
-{
-  return _content->getMeshName();
-}
-
-void MEDFileFieldMultiTS::setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception)
-{
-  _content->setMeshName(newMeshName);
+  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;
 }
 
-bool MEDFileFieldMultiTS::changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab) throw(INTERP_KERNEL::Exception)
+ MEDFileIntFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTS::contentNotNull() throw(INTERP_KERNEL::Exception)
 {
-  return _content->changeMeshNames(modifTab);
+  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;
 }
 
-const std::vector<std::string>& MEDFileFieldMultiTS::getInfo() const throw(INTERP_KERNEL::Exception)
+MEDFileIntFieldMultiTS::MEDFileIntFieldMultiTS()
 {
-  return _content->getInfo();
+  _content=new MEDFileIntFieldMultiTSWithoutSDA;
 }
 
-DataArrayDouble *MEDFileFieldMultiTS::getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
+MEDFileIntFieldMultiTS::MEDFileIntFieldMultiTS(const MEDFileIntFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent):MEDFileAnyTypeFieldMultiTS(other,shallowCopyOfContent)
 {
-  return _content->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 throw(INTERP_KERNEL::Exception)
+MEDFileIntFieldMultiTS::MEDFileIntFieldMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
+try:MEDFileAnyTypeFieldMultiTS(fileName)
 {
-  return _content->getUndergroundDataArrayExt(iteration,order,entries);
 }
+catch(INTERP_KERNEL::Exception& e)
+  { throw e; }
 
-MEDFileFieldMultiTSIterator::MEDFileFieldMultiTSIterator(MEDFileFieldMultiTS *fmts):_fmts(fmts),_iter_id(0),_nb_iter(0)
+MEDFileIntFieldMultiTS::MEDFileIntFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+try:MEDFileAnyTypeFieldMultiTS(fileName,fieldName)
 {
-  if(fmts)
-    {
-      fmts->incrRef();
-      _nb_iter=fmts->getNumberOfTS();
-    }
 }
+catch(INTERP_KERNEL::Exception& e)
+  { throw e; }
 
-MEDFileFieldMultiTSIterator::~MEDFileFieldMultiTSIterator() 
+DataArrayInt *MEDFileIntFieldMultiTS::getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
 {
+  return static_cast<DataArrayInt *>(contentNotNull()->getUndergroundDataArray(iteration,order));
 }
 
-MEDFileField1TS *MEDFileFieldMultiTSIterator::nextt()
-{
-  if(_iter_id<_nb_iter)
-    {
-      MEDFileFieldMultiTS *fmts(_fmts);
-      if(fmts)
-        return fmts->getTimeStepAtPos(_iter_id++);
-      else
-        return 0;
-    }
-  else
-    return 0;
-}
+//= MEDFileFields
 
 MEDFileFields *MEDFileFields::New()
 {
@@ -6350,26 +8467,67 @@ MEDFileFields *MEDFileFields::New(const char *fileName) throw(INTERP_KERNEL::Exc
 
 std::size_t MEDFileFields::getHeapMemorySize() const
 {
-  std::size_t ret=_fields.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTSWithoutSDA>);
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
-    if((const MEDFileFieldMultiTSWithoutSDA *)*it)
+  std::size_t ret=_fields.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA>);
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
+    if((const MEDFileAnyTypeFieldMultiTSWithoutSDA *)*it)
       ret+=(*it)->getHeapMemorySize();
   return ret+MEDFileFieldGlobsReal::getHeapMemorySize();
 }
 
 MEDFileFields *MEDFileFields::deepCpy() const throw(INTERP_KERNEL::Exception)
 {
-  MEDCouplingAutoRefCountObjectPtr<MEDFileFields> ret=new MEDFileFields(*this);
+  MEDCouplingAutoRefCountObjectPtr<MEDFileFields> ret=shallowCpy();
   std::size_t i=0;
-  for( std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++)
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++)
     {
-      if((const MEDFileFieldMultiTSWithoutSDA*)*it)
+      if((const MEDFileAnyTypeFieldMultiTSWithoutSDA*)*it)
         ret->_fields[i]=(*it)->deepCpy();
     }
   ret->deepCpyGlobs(*this);
   return ret.retn();
 }
 
+MEDFileFields *MEDFileFields::shallowCpy() const throw(INTERP_KERNEL::Exception)
+{
+  return new MEDFileFields(*this);
+}
+
+/*!
+ * This method scans for all fields in \a this which time steps ids are common. Time step are discriminated by the pair of integer (iteration,order) whatever
+ * the double time value. If all returned time steps are \b exactly those for all fields in \a this output parameter \a areThereSomeForgottenTS will be set to false.
+ * If \a areThereSomeForgottenTS is set to true, only the sorted intersection of time steps present for all fields in \a this will be returned.
+ *
+ * \param [out] areThereSomeForgottenTS - indicates to the caller if there is some time steps in \a this that are not present for all fields in \a this.
+ * \return the sorted list of time steps (specified with a pair of integer iteration first and order second) present for all fields in \a this.
+ * 
+ * \sa MEDFileFields::partOfThisLyingOnSpecifiedTimeSteps, MEDFileFields::partOfThisNotLyingOnSpecifiedTimeSteps
+ */
+std::vector< std::pair<int,int> > MEDFileFields::getCommonIterations(bool& areThereSomeForgottenTS) const throw(INTERP_KERNEL::Exception)
+{
+  std::set< std::pair<int,int> > s;
+  bool firstShot=true;
+  areThereSomeForgottenTS=false;
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
+    {
+      if(!(const MEDFileAnyTypeFieldMultiTSWithoutSDA*)*it)
+        continue;
+      std::vector< std::pair<int,int> > v=(*it)->getIterations();
+      std::set< std::pair<int,int> > s1; std::copy(v.begin(),v.end(),std::inserter(s1,s1.end()));
+      if(firstShot)
+        { s=s1; firstShot=false; }
+      else
+        {
+          std::set< std::pair<int,int> > s2; std::set_intersection(s.begin(),s.end(),s1.begin(),s1.end(),std::inserter(s2,s2.end()));
+          if(s!=s2)
+            areThereSomeForgottenTS=true;
+          s=s2;
+        }
+    }
+  std::vector< std::pair<int,int> > ret;
+  std::copy(s.begin(),s.end(),std::back_insert_iterator< std::vector< std::pair<int,int> > >(ret));
+  return ret;
+}
+
 int MEDFileFields::getNumberOfFields() const
 {
   return _fields.size();
@@ -6379,9 +8537,9 @@ std::vector<std::string> MEDFileFields::getFieldsNames() const throw(INTERP_KERN
 {
   std::vector<std::string> ret(_fields.size());
   int i=0;
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++)
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++)
     {
-      const MEDFileFieldMultiTSWithoutSDA *f=(*it);
+      const MEDFileAnyTypeFieldMultiTSWithoutSDA *f=(*it);
       if(f)
         {
           ret[i]=f->getName();
@@ -6398,9 +8556,9 @@ std::vector<std::string> MEDFileFields::getFieldsNames() const throw(INTERP_KERN
 std::vector<std::string> MEDFileFields::getMeshesNames() const throw(INTERP_KERNEL::Exception)
 {
   std::vector<std::string> ret;
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
     {
-      const MEDFileFieldMultiTSWithoutSDA *cur(*it);
+      const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur(*it);
       if(cur)
         ret.push_back(cur->getMeshName());
     }
@@ -6421,9 +8579,9 @@ void MEDFileFields::simpleRepr(int bkOffset, std::ostream& oss) const
   std::string startLine(bkOffset,' ');
   oss << startLine << "There are " << nbOfFields << " fields in this :" << std::endl;
   int i=0;
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++)
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++)
     {
-      const MEDFileFieldMultiTSWithoutSDA *cur=(*it);
+      const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur=(*it);
       if(cur)
         {
           oss << startLine << "  - # "<< i << " has the following name : \"" << cur->getName() << "\"." << std::endl;
@@ -6434,9 +8592,9 @@ void MEDFileFields::simpleRepr(int bkOffset, std::ostream& oss) const
         }
     }
   i=0;
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++)
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++)
     {
-      const MEDFileFieldMultiTSWithoutSDA *cur=(*it);
+      const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur=(*it);
       std::string chapter(17,'0'+i);
       oss << startLine << chapter << std::endl;
       if(cur)
@@ -6449,7 +8607,7 @@ void MEDFileFields::simpleRepr(int bkOffset, std::ostream& oss) const
         }
       oss << startLine << chapter << std::endl;
     }
-  MEDFileFieldGlobsReal::simpleRepr(oss);
+  simpleReprGlobs(oss);
 }
 
 MEDFileFields::MEDFileFields()
@@ -6466,20 +8624,27 @@ try:MEDFileFieldGlobsReal(fileName)
     med_field_type typcha;
     for(int i=0;i<nbFields;i++)
       {
-        int ncomp=MEDfieldnComponent(fid,i+1);
-        INTERP_KERNEL::AutoPtr<char> comp=MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE);
-        INTERP_KERNEL::AutoPtr<char> unit=MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE);
-        INTERP_KERNEL::AutoPtr<char> dtunit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE);
-        INTERP_KERNEL::AutoPtr<char> nomcha=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
-        INTERP_KERNEL::AutoPtr<char> nomMaa=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
-        med_bool localMesh;
-        int nbOfStep;
-        MEDfieldInfo(fid,i+1,nomcha,nomMaa,&localMesh,&typcha,comp,unit,dtunit,&nbOfStep);
-        int ft=MEDFileUtilities::TraduceFieldType(typcha);
-        std::vector<std::string> infos(ncomp);
-        for(int j=0;j<ncomp;j++)
-          infos[j]=MEDLoaderBase::buildUnionUnit((char *)comp+j*MED_SNAME_SIZE,MED_SNAME_SIZE,(char *)unit+j*MED_SNAME_SIZE,MED_SNAME_SIZE);
-        _fields[i]=MEDFileFieldMultiTSWithoutSDA::New(fid,nomcha,i+1,ft,infos,nbOfStep);
+        std::vector<std::string> infos;
+        std::string fieldName,dtunit;
+        int nbOfStep=MEDFileAnyTypeField1TS::LocateField2(fid,fileName,i,false,fieldName,typcha,infos,dtunit);
+        switch(typcha)
+          {
+          case MED_FLOAT64:
+            {
+              _fields[i]=MEDFileFieldMultiTSWithoutSDA::New(fid,fieldName.c_str(),typcha,infos,nbOfStep,dtunit);
+              break;
+            }
+          case MED_INT32:
+            {
+              _fields[i]=MEDFileIntFieldMultiTSWithoutSDA::New(fid,fieldName.c_str(),typcha,infos,nbOfStep,dtunit);
+              break;
+            }
+          default:
+            {
+              std::ostringstream oss; oss << "constructor MEDFileFields(fileName) : file \'" << fileName << "\' at pos #" << i << " field has name \'" << fieldName << "\' but the type of field is not in [MED_FLOAT64, MED_INT32] !";
+              throw INTERP_KERNEL::Exception(oss.str().c_str());
+            }
+          }
       }
     loadAllGlobals(fid);
   }
@@ -6492,9 +8657,9 @@ void MEDFileFields::writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception)
 {
   int i=0;
   writeGlobals(fid,*this);
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++)
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++)
     {
-      const MEDFileFieldMultiTSWithoutSDA *elt=*it;
+      const MEDFileAnyTypeFieldMultiTSWithoutSDA *elt=*it;
       if(!elt)
         {
           std::ostringstream oss; oss << "MEDFileFields::write : at rank #" << i << "/" << _fields.size() << " field is empty !";
@@ -6515,7 +8680,7 @@ std::vector<std::string> MEDFileFields::getPflsReallyUsed() const
 {
   std::vector<std::string> ret;
   std::set<std::string> ret2;
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldMultiTSWithoutSDA > >::const_iterator it=_fields.begin();it!=_fields.end();it++)
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::const_iterator it=_fields.begin();it!=_fields.end();it++)
     {
       std::vector<std::string> tmp=(*it)->getPflsReallyUsed2();
       for(std::vector<std::string>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
@@ -6532,7 +8697,7 @@ std::vector<std::string> MEDFileFields::getLocsReallyUsed() const
 {
   std::vector<std::string> ret;
   std::set<std::string> ret2;
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldMultiTSWithoutSDA > >::const_iterator it=_fields.begin();it!=_fields.end();it++)
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::const_iterator it=_fields.begin();it!=_fields.end();it++)
     {
       std::vector<std::string> tmp=(*it)->getLocsReallyUsed2();
       for(std::vector<std::string>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
@@ -6548,7 +8713,7 @@ std::vector<std::string> MEDFileFields::getLocsReallyUsed() const
 std::vector<std::string> MEDFileFields::getPflsReallyUsedMulti() const
 {
   std::vector<std::string> ret;
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldMultiTSWithoutSDA > >::const_iterator it=_fields.begin();it!=_fields.end();it++)
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::const_iterator it=_fields.begin();it!=_fields.end();it++)
     {
       std::vector<std::string> tmp=(*it)->getPflsReallyUsedMulti2();
       ret.insert(ret.end(),tmp.begin(),tmp.end());
@@ -6559,7 +8724,7 @@ std::vector<std::string> MEDFileFields::getPflsReallyUsedMulti() const
 std::vector<std::string> MEDFileFields::getLocsReallyUsedMulti() const
 {
   std::vector<std::string> ret;
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldMultiTSWithoutSDA > >::const_iterator it=_fields.begin();it!=_fields.end();it++)
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::const_iterator it=_fields.begin();it!=_fields.end();it++)
     {
       std::vector<std::string> tmp=(*it)->getLocsReallyUsed2();
       ret.insert(ret.end(),tmp.begin(),tmp.end());
@@ -6569,13 +8734,13 @@ std::vector<std::string> MEDFileFields::getLocsReallyUsedMulti() const
 
 void MEDFileFields::changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
 {
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldMultiTSWithoutSDA > >::iterator it=_fields.begin();it!=_fields.end();it++)
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::iterator it=_fields.begin();it!=_fields.end();it++)
     (*it)->changePflsRefsNamesGen2(mapOfModif);
 }
 
 void MEDFileFields::changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
 {
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldMultiTSWithoutSDA > >::iterator it=_fields.begin();it!=_fields.end();it++)
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::iterator it=_fields.begin();it!=_fields.end();it++)
     (*it)->changeLocsRefsNamesGen2(mapOfModif);
 }
 
@@ -6584,7 +8749,13 @@ void MEDFileFields::resize(int newSize) throw(INTERP_KERNEL::Exception)
   _fields.resize(newSize);
 }
 
-void MEDFileFields::pushField(MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception)
+void MEDFileFields::pushFields(const std::vector<MEDFileAnyTypeFieldMultiTS *>& fields) throw(INTERP_KERNEL::Exception)
+{
+  for(std::vector<MEDFileAnyTypeFieldMultiTS *>::const_iterator it=fields.begin();it!=fields.end();it++)
+    pushField(*it);
+}
+
+void MEDFileFields::pushField(MEDFileAnyTypeFieldMultiTS *field) throw(INTERP_KERNEL::Exception)
 {
   if(!field)
     throw INTERP_KERNEL::Exception("MEDFileFields::pushMesh : invalid input pointer ! should be different from 0 !");
@@ -6592,7 +8763,7 @@ void MEDFileFields::pushField(MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::E
   appendGlobs(*field,1e-12);
 }
 
-void MEDFileFields::setFieldAtPos(int i, MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception)
+void MEDFileFields::setFieldAtPos(int i, MEDFileAnyTypeFieldMultiTS *field) throw(INTERP_KERNEL::Exception)
 {
   if(!field)
     throw INTERP_KERNEL::Exception("MEDFileFields::setFieldAtPos : invalid input pointer ! should be different from 0 !");
@@ -6604,20 +8775,58 @@ void MEDFileFields::setFieldAtPos(int i, MEDFileFieldMultiTS *field) throw(INTER
 
 void MEDFileFields::destroyFieldAtPos(int i) throw(INTERP_KERNEL::Exception)
 {
-  if(i<0 || i>=(int)_fields.size())
+  destroyFieldsAtPos(&i,&i+1);
+}
+
+void MEDFileFields::destroyFieldsAtPos(const int *startIds, const int *endIds) throw(INTERP_KERNEL::Exception)
+{
+  std::vector<bool> b(_fields.size(),true);
+  for(const int *i=startIds;i!=endIds;i++)
     {
-      std::ostringstream oss; oss << "MEDFileFields::destroyMeshAtPos : Invalid given id in input (" << i << ") should be in [0," << _fields.size() << ") !";
-      throw INTERP_KERNEL::Exception(oss.str().c_str());
+      if(*i<0 || *i>=(int)_fields.size())
+        {
+          std::ostringstream oss; oss << "MEDFileFields::destroyFieldsAtPos : Invalid given id in input (" << *i << ") should be in [0," << _fields.size() << ") !";
+          throw INTERP_KERNEL::Exception(oss.str().c_str());
+        }
+      b[*i]=false;
+    }
+  std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> > fields(std::count(b.begin(),b.end(),true));
+  std::size_t j=0;
+  for(std::size_t i=0;i<_fields.size();i++)
+    if(b[i])
+      fields[j++]=_fields[i];
+  _fields=fields;
+}
+
+void MEDFileFields::destroyFieldsAtPos2(int bg, int end, int step) throw(INTERP_KERNEL::Exception)
+{
+  static const char msg[]="MEDFileFields::destroyFieldsAtPos2";
+  int nbOfEntriesToKill=DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg);
+  std::vector<bool> b(_fields.size(),true);
+  int k=bg;
+  for(int i=0;i<nbOfEntriesToKill;i++,k+=step)
+    {
+      if(k<0 || k>=(int)_fields.size())
+        {
+          std::ostringstream oss; oss << "MEDFileFields::destroyFieldsAtPos2 : Invalid given id in input (" << k << ") should be in [0," << _fields.size() << ") !";
+          throw INTERP_KERNEL::Exception(oss.str().c_str());
+        }
+      b[k]=false;
     }
-  _fields.erase(_fields.begin()+i);
+  std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> > fields(std::count(b.begin(),b.end(),true));
+  std::size_t j=0;
+  for(std::size_t i=0;i<_fields.size();i++)
+    if(b[i])
+      fields[j++]=_fields[i];
+  _fields=fields;
 }
 
 bool MEDFileFields::changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab) throw(INTERP_KERNEL::Exception)
 {
   bool ret=false;
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTSWithoutSDA> >::iterator it=_fields.begin();it!=_fields.end();it++)
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::iterator it=_fields.begin();it!=_fields.end();it++)
     {
-      MEDFileFieldMultiTSWithoutSDA *cur(*it);
+      MEDFileAnyTypeFieldMultiTSWithoutSDA *cur(*it);
       if(cur)
         ret=cur->changeMeshNames(modifTab) || ret;
     }
@@ -6636,9 +8845,9 @@ bool MEDFileFields::changeMeshNames(const std::vector< std::pair<std::string,std
 bool MEDFileFields::renumberEntitiesLyingOnMesh(const char *meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N) throw(INTERP_KERNEL::Exception)
 {
   bool ret=false;
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTSWithoutSDA> >::iterator it=_fields.begin();it!=_fields.end();it++)
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::iterator it=_fields.begin();it!=_fields.end();it++)
     {
-      MEDFileFieldMultiTSWithoutSDA *fmts(*it);
+      MEDFileAnyTypeFieldMultiTSWithoutSDA *fmts(*it);
       if(fmts)
         {
           ret=fmts->renumberEntitiesLyingOnMesh(meshName,oldCode,newCode,renumO2N,*this) || ret;
@@ -6647,24 +8856,136 @@ bool MEDFileFields::renumberEntitiesLyingOnMesh(const char *meshName, const std:
   return ret;
 }
 
-MEDFileFieldMultiTS *MEDFileFields::getFieldAtPos(int i) const throw(INTERP_KERNEL::Exception)
+MEDFileAnyTypeFieldMultiTS *MEDFileFields::getFieldAtPos(int i) const throw(INTERP_KERNEL::Exception)
 {
   if(i<0 || i>=(int)_fields.size())
     {
       std::ostringstream oss; oss << "MEDFileFields::getFieldAtPos : Invalid given id in input (" << i << ") should be in [0," << _fields.size() << ") !";
       throw INTERP_KERNEL::Exception(oss.str().c_str());
     }
-  const MEDFileFieldMultiTSWithoutSDA *fmts=_fields[i];
-  MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTS> ret=MEDFileFieldMultiTS::New(*fmts,false);
+  const MEDFileAnyTypeFieldMultiTSWithoutSDA *fmts=_fields[i];
+  if(!fmts)
+    return 0;
+  MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTS> ret;
+  const MEDFileFieldMultiTSWithoutSDA *fmtsC=dynamic_cast<const MEDFileFieldMultiTSWithoutSDA *>(fmts);
+  const MEDFileIntFieldMultiTSWithoutSDA *fmtsC2=dynamic_cast<const MEDFileIntFieldMultiTSWithoutSDA *>(fmts);
+  if(fmtsC)
+    ret=MEDFileFieldMultiTS::New(*fmtsC,false);
+  else if(fmtsC2)
+    ret=MEDFileIntFieldMultiTS::New(*fmtsC2,false);
+  else
+    {
+      std::ostringstream oss; oss << "MEDFileFields::getFieldAtPos : At pos #" << i << " field is neither double (FLOAT64) nor integer (INT32) !";
+      throw INTERP_KERNEL::Exception(oss.str().c_str());
+    }
   ret->shallowCpyGlobs(*this);
   return ret.retn();
 }
 
-MEDFileFieldMultiTS *MEDFileFields::getFieldWithName(const char *fieldName) const throw(INTERP_KERNEL::Exception)
+/*!
+ * Return a shallow copy of \a this reduced to the fields ids defined in [ \a startIds , endIds ).
+ * This method is accessible in python using __getitem__ with a list in input.
+ * \return a new object that the caller should deal with.
+ */
+MEDFileFields *MEDFileFields::buildSubPart(const int *startIds, const int *endIds) const throw(INTERP_KERNEL::Exception)
+{
+  MEDCouplingAutoRefCountObjectPtr<MEDFileFields> ret=shallowCpy();
+  std::size_t sz=std::distance(startIds,endIds);
+  std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> > fields(sz);
+  int j=0;
+  for(const int *i=startIds;i!=endIds;i++,j++)
+    {
+      if(*i<0 || *i>=(int)_fields.size())
+        {
+          std::ostringstream oss; oss << "MEDFileFields::buildSubPart : Invalid given id in input (" << *i << ") should be in [0," << _fields.size() << ") !";
+          throw INTERP_KERNEL::Exception(oss.str().c_str());
+        }
+      fields[j]=_fields[*i];
+    }
+  ret->_fields=fields;
+  return ret.retn();
+}
+
+MEDFileAnyTypeFieldMultiTS *MEDFileFields::getFieldWithName(const char *fieldName) const throw(INTERP_KERNEL::Exception)
 {
   return getFieldAtPos(getPosFromFieldName(fieldName));
 }
 
+/*!
+ * This method returns a new object containing part of \a this fields lying on mesh name specified by the input parameter \a meshName.
+ * This method can be seen as a filter applied on \a this, that returns an object containing
+ * reduced the list of fields compared to those in \a this. The returned object is a new object but the object on which it lies are only
+ * shallow copied from \a this.
+ * 
+ * \param [in] meshName - the name of the mesh on w
+ * \return a new object that the caller should deal with.
+ */
+MEDFileFields *MEDFileFields::partOfThisLyingOnSpecifiedMeshName(const char *meshName) const throw(INTERP_KERNEL::Exception)
+{
+  MEDCouplingAutoRefCountObjectPtr<MEDFileFields> ret=MEDFileFields::New();
+  ret->shallowCpyOnlyUsedGlobs(*this);
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
+    {
+      const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur=(*it);
+      if(!cur)
+        continue;
+      if(cur->getMeshName()==meshName)
+        {
+          cur->incrRef();
+          MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> cur2(const_cast<MEDFileAnyTypeFieldMultiTSWithoutSDA *>(cur));
+          ret->_fields.push_back(cur2);
+        }
+    }
+  return ret.retn();
+}
+
+/*!
+ * This method returns a new object containing part of \a this fields lying ** exactly ** on the time steps specified by input parameter \a timeSteps.
+ * Input time steps are specified using a pair of integer (iteration, order).
+ * This method can be seen as a filter applied on \a this, that returns an object containing the same number of fields than those in \a this,
+ * but for each multitimestep only the time steps in \a timeSteps are kept.
+ * Typically the input parameter \a timeSteps comes from the call of MEDFileFields::getCommonIterations.
+ * 
+ * The returned object points to shallow copy of elements in \a this.
+ * 
+ * \param [in] timeSteps - the time steps given by a vector of pair of integers (iteration,order)
+ * \throw If there is a field in \a this that is \b not defined on a time step in the input \a timeSteps.
+ * \sa MEDFileFields::getCommonIterations, MEDFileFields::partOfThisNotLyingOnSpecifiedTimeSteps
+ */
+MEDFileFields *MEDFileFields::partOfThisLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const throw(INTERP_KERNEL::Exception)
+{
+  MEDCouplingAutoRefCountObjectPtr<MEDFileFields> ret=MEDFileFields::New();
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
+    {
+      const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur=(*it);
+      if(!cur)
+        continue;
+      MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> elt=cur->partOfThisLyingOnSpecifiedTimeSteps(timeSteps);
+      ret->_fields.push_back(elt);
+    }
+  ret->shallowCpyOnlyUsedGlobs(*this);
+  return ret.retn();
+}
+
+/*!
+ * \sa MEDFileFields::getCommonIterations, MEDFileFields::partOfThisLyingOnSpecifiedTimeSteps
+ */
+MEDFileFields *MEDFileFields::partOfThisNotLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const throw(INTERP_KERNEL::Exception)
+{
+  MEDCouplingAutoRefCountObjectPtr<MEDFileFields> ret=MEDFileFields::New();
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
+    {
+      const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur=(*it);
+      if(!cur)
+        continue;
+      MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> elt=cur->partOfThisNotLyingOnSpecifiedTimeSteps(timeSteps);
+      if(elt->getNumberOfTS()!=0)
+        ret->_fields.push_back(elt);
+    }
+  ret->shallowCpyOnlyUsedGlobs(*this);
+  return ret.retn();
+}
+
 MEDFileFieldsIterator *MEDFileFields::iterator() throw(INTERP_KERNEL::Exception)
 {
   return new MEDFileFieldsIterator(this);
@@ -6676,7 +8997,7 @@ int MEDFileFields::getPosFromFieldName(const char *fieldName) const throw(INTERP
   std::vector<std::string> poss;
   for(std::size_t i=0;i<_fields.size();i++)
     {
-      const MEDFileFieldMultiTSWithoutSDA *f=_fields[i];
+      const MEDFileAnyTypeFieldMultiTSWithoutSDA *f=_fields[i];
       if(f)
         {
           std::string fname(f->getName());
@@ -6705,7 +9026,7 @@ MEDFileFieldsIterator::~MEDFileFieldsIterator()
 {
 }
 
-MEDFileFieldMultiTS *MEDFileFieldsIterator::nextt()
+MEDFileAnyTypeFieldMultiTS *MEDFileFieldsIterator::nextt()
 {
   if(_iter_id<_nb_iter)
     {
index 38193c8080315c7759096ca9f9e2d7ce9c09b60e..fdf54072fdbb06643bd8b58b4ea5dfac3a798aef 100644 (file)
@@ -84,8 +84,10 @@ namespace ParaMEDMEM
   };
 
 /// @cond INTERNAL
+  class MEDFileAnyTypeField1TSWithoutSDA;
   class MEDFileFieldPerMeshPerType;
   class MEDFileField1TSWithoutSDA;
+  class MEDFileFieldNameScope;
   class MEDFileFieldGlobsReal;
   class MEDFileFieldPerMesh;
 
@@ -97,19 +99,18 @@ namespace ParaMEDMEM
     static MEDFileFieldPerMeshPerTypePerDisc *New(const MEDFileFieldPerMeshPerTypePerDisc& other);
     std::size_t getHeapMemorySize() const;
     MEDFileFieldPerMeshPerTypePerDisc *deepCpy(MEDFileFieldPerMeshPerType *father) const throw(INTERP_KERNEL::Exception);
-    void assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldDouble *field, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
-    void assignFieldProfile(int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldDouble *field, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
-    void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldDouble *field, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
+    void assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldDouble *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
+    void assignFieldProfile(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) throw(INTERP_KERNEL::Exception);
+    void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldDouble *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
     void getCoarseData(TypeOfField& type, std::pair<int,int>& dad, std::string& pfl, std::string& loc) const throw(INTERP_KERNEL::Exception);
-    void writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception);
+    void writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception);
     const MEDFileFieldPerMeshPerType *getFather() const;
-    void prepareLoading(med_idt fid, int profileIt, int& start) throw(INTERP_KERNEL::Exception);
-    void finishLoading(med_idt fid, int profileIt, int ft) throw(INTERP_KERNEL::Exception);
+    void prepareLoading(med_idt fid, int profileIt, int& start, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
+    void finishLoading(med_idt fid, int profileIt, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
     void setNewStart(int newValueOfStart) throw(INTERP_KERNEL::Exception);
     int getIteration() const;
     int getOrder() const;
     double getTime() const;
-    std::string getName() const;
     std::string getMeshName() const;
     TypeOfField getType() const;
     void simpleRepr(int bkOffset, std::ostream& oss, int id) const;
@@ -119,8 +120,10 @@ namespace ParaMEDMEM
     int getNumberOfComponents() const;
     int getNumberOfTuples() const;
     int getStart() const { return _start; }
-    DataArrayDouble *getArray();
-    const DataArrayDouble *getArray() const;
+    DataArray *getArray();
+    const DataArray *getArray() const;
+    const DataArrayDouble *getArrayDouble() const;
+    DataArrayDouble *getArrayDouble();
     const std::vector<std::string>& getInfo() const;
     std::string getProfile() const;
     void setProfile(const char *newPflName);
@@ -168,31 +171,32 @@ namespace ParaMEDMEM
   {
   public:
     static MEDFileFieldPerMeshPerType *New(MEDFileFieldPerMesh *fath, INTERP_KERNEL::NormalizedCellType geoType) throw(INTERP_KERNEL::Exception);
-    static MEDFileFieldPerMeshPerType *NewOnRead(med_idt fid, MEDFileFieldPerMesh *fath, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType) throw(INTERP_KERNEL::Exception);
+    static MEDFileFieldPerMeshPerType *NewOnRead(med_idt fid, MEDFileFieldPerMesh *fath, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
     std::size_t getHeapMemorySize() const;
     MEDFileFieldPerMeshPerType *deepCpy(MEDFileFieldPerMesh *father) const throw(INTERP_KERNEL::Exception);
-    void assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldDouble *field, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
-    void assignFieldProfile(int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldDouble *field, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
-    void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldDouble *field, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
-    void assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldDouble *field, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
+    void assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
+    void assignFieldProfile(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) throw(INTERP_KERNEL::Exception);
+    void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
+    void assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
     const MEDFileFieldPerMesh *getFather() const;
-    void prepareLoading(med_idt fid, int &start) throw(INTERP_KERNEL::Exception);
-    void finishLoading(med_idt fid, int ft) throw(INTERP_KERNEL::Exception);
-    void writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception);
+    void prepareLoading(med_idt fid, int &start, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
+    void finishLoading(med_idt fid, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
+    void writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception);
     void getDimension(int& dim) const;
     void fillTypesOfFieldAvailable(std::set<TypeOfField>& types) const throw(INTERP_KERNEL::Exception);
     void fillFieldSplitedByType(std::vector< std::pair<int,int> >& dads, std::vector<TypeOfField>& types, std::vector<std::string>& pfls, std::vector<std::string>& locs) const throw(INTERP_KERNEL::Exception);
     int getIteration() const;
     int getOrder() const;
     double getTime() const;
-    std::string getName() const;
     std::string getMeshName() const;
     void simpleRepr(int bkOffset, std::ostream& oss, int id) const;
     void getSizes(int& globalSz, int& nbOfEntries) const;
     INTERP_KERNEL::NormalizedCellType getGeoType() const;
     int getNumberOfComponents() const;
-    DataArrayDouble *getArray();
-    const DataArrayDouble *getArray() const;
+    DataArray *getArray();
+    const DataArray *getArray() const;
+    const DataArrayDouble *getArrayDouble() const;
+    DataArrayDouble *getArrayDouble();
     const std::vector<std::string>& getInfo() const;
     std::vector<std::string> getPflsReallyUsed() const;
     std::vector<std::string> getLocsReallyUsed() const;
@@ -211,7 +215,7 @@ namespace ParaMEDMEM
     std::vector<int> addNewEntryIfNecessaryGauss(const MEDCouplingFieldDouble *field, int offset, int nbOfCells) throw(INTERP_KERNEL::Exception);
     std::vector<int> addNewEntryIfNecessary(const MEDCouplingFieldDouble *field, const DataArrayInt *subCells) throw(INTERP_KERNEL::Exception);
     std::vector<int> addNewEntryIfNecessaryGauss(const MEDCouplingFieldDouble *field, const DataArrayInt *subCells) throw(INTERP_KERNEL::Exception);
-    MEDFileFieldPerMeshPerType(med_idt fid, MEDFileFieldPerMesh *fath, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType) throw(INTERP_KERNEL::Exception);
+    MEDFileFieldPerMeshPerType(med_idt fid, MEDFileFieldPerMesh *fath, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
     MEDFileFieldPerMeshPerType(MEDFileFieldPerMesh *fath, INTERP_KERNEL::NormalizedCellType geoType) throw(INTERP_KERNEL::Exception);
   private:
     MEDFileFieldPerMesh *_father;
@@ -222,19 +226,19 @@ namespace ParaMEDMEM
   class MEDFileFieldPerMesh : public RefCountObject, public MEDFileWritable
   {
   public:
-    static MEDFileFieldPerMesh *New(MEDFileField1TSWithoutSDA *fath, const MEDCouplingMesh *mesh);
-    static MEDFileFieldPerMesh *NewOnRead(med_idt fid, MEDFileField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder) throw(INTERP_KERNEL::Exception);
+    static MEDFileFieldPerMesh *New(MEDFileAnyTypeField1TSWithoutSDA *fath, const MEDCouplingMesh *mesh);
+    static MEDFileFieldPerMesh *NewOnRead(med_idt fid, MEDFileAnyTypeField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
     std::size_t getHeapMemorySize() const;
-    MEDFileFieldPerMesh *deepCpy(MEDFileField1TSWithoutSDA *_father) const throw(INTERP_KERNEL::Exception);
+    MEDFileFieldPerMesh *deepCpy(MEDFileAnyTypeField1TSWithoutSDA *father) const throw(INTERP_KERNEL::Exception);
     void simpleRepr(int bkOffset,std::ostream& oss, int id) const;
     void copyTinyInfoFrom(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
-    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 MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
-    void assignFieldNoProfileNoRenum(int& start, const std::vector<int>& code, const MEDCouplingFieldDouble *field, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
-    void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldDouble *field, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
-    void assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldDouble *field, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
-    void prepareLoading(med_idt fid, int &start) throw(INTERP_KERNEL::Exception);
-    void finishLoading(med_idt fid, int ft) throw(INTERP_KERNEL::Exception);
-    void writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception);
+    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) throw(INTERP_KERNEL::Exception);
+    void assignFieldNoProfileNoRenum(int& start, const std::vector<int>& code, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
+    void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
+    void assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
+    void prepareLoading(med_idt fid, int &start, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
+    void finishLoading(med_idt fid, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
+    void writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception);
     void fillTypesOfFieldAvailable(std::set<TypeOfField>& types) const throw(INTERP_KERNEL::Exception);
     std::vector< std::vector< std::pair<int,int> > > getFieldSplitedByType(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 throw(INTERP_KERNEL::Exception);
     void getDimension(int& dim) const;
@@ -243,12 +247,12 @@ namespace ParaMEDMEM
     int getOrder() const;
     int getMeshIteration() const { return _mesh_iteration; }
     int getMeshOrder() const { return _mesh_order; }
-    const std::string& getDtUnit() const;
-    std::string getName() const;
     std::string getMeshName() const { return _mesh_name; }
     int getNumberOfComponents() const;
-    DataArrayDouble *getArray();
-    const DataArrayDouble *getArray() const;
+    DataArray *getArray();
+    const DataArray *getArray() const;
+    DataArrayDouble *getArrayDouble();
+    const DataArrayDouble *getArrayDouble() const;
     const std::vector<std::string>& getInfo() const;
     std::vector<std::string> getPflsReallyUsed() const;
     std::vector<std::string> getLocsReallyUsed() const;
@@ -258,36 +262,36 @@ namespace ParaMEDMEM
     bool renumberEntitiesLyingOnMesh(const char *meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
     void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
     void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
-    MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, bool& isPfl) const throw(INTERP_KERNEL::Exception);
-    DataArrayDouble *getFieldOnMeshAtLevelWithPfl(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob) const throw(INTERP_KERNEL::Exception);
-    DataArrayDouble *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, bool& isPfl, MEDCouplingAutoRefCountObjectPtr<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception);
+    DataArray *getFieldOnMeshAtLevelWithPfl(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception);
+    void getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception);
     MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId) throw(INTERP_KERNEL::Exception);
     const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId) const throw(INTERP_KERNEL::Exception);
   private:
     int addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellType type);
     MEDCouplingFieldDouble *finishField(TypeOfField type, const MEDFileFieldGlobsReal *glob,
-                                        const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs, const MEDCouplingMesh *mesh, bool& isPfl) const throw(INTERP_KERNEL::Exception);
+                                        const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs, const MEDCouplingMesh *mesh, bool& isPfl, MEDCouplingAutoRefCountObjectPtr<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception);
     MEDCouplingFieldDouble *finishField2(TypeOfField type, const MEDFileFieldGlobsReal *glob,
                                          const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs,
                                          const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes,
-                                         const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl) const throw(INTERP_KERNEL::Exception);
+                                         const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MEDCouplingAutoRefCountObjectPtr<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception);
     MEDCouplingFieldDouble *finishFieldNode2(const MEDFileFieldGlobsReal *glob,
                                              const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs,
-                                             const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl) const throw(INTERP_KERNEL::Exception);
-    DataArrayDouble *finishField4(const std::vector< std::pair<int,int> >& dads, const DataArrayInt *pflIn, int nbOfElems, DataArrayInt *&pflOut) const throw(INTERP_KERNEL::Exception);
+                                             const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MEDCouplingAutoRefCountObjectPtr<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception);
+    DataArray *finishField4(const std::vector< std::pair<int,int> >& dads, const DataArrayInt *pflIn, int nbOfElems, DataArrayInt *&pflOut) const throw(INTERP_KERNEL::Exception);
     void assignNewLeaves(const std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerTypePerDisc > >& leaves) throw(INTERP_KERNEL::Exception);
     static void SortArraysPerType(const MEDFileFieldGlobsReal *glob, TypeOfField type, 
                                   const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes, const std::vector< std::pair<int,int> >& dads, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& locs,
                                   std::vector<int>& code, std::vector<DataArrayInt *>& notNullPfls);
     static int ComputeNbOfElems(const MEDFileFieldGlobsReal *glob, TypeOfField type, const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes, const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs) throw(INTERP_KERNEL::Exception);
-    MEDFileFieldPerMesh(med_idt fid, MEDFileField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder) throw(INTERP_KERNEL::Exception);
-    MEDFileFieldPerMesh(MEDFileField1TSWithoutSDA *fath, const MEDCouplingMesh *mesh);
+    MEDFileFieldPerMesh(med_idt fid, MEDFileAnyTypeField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
+    MEDFileFieldPerMesh(MEDFileAnyTypeField1TSWithoutSDA *fath, const MEDCouplingMesh *mesh);
   private:
     std::string _mesh_name;
     int _mesh_iteration;
     int _mesh_order;
     int _mesh_csit;
-    MEDFileField1TSWithoutSDA *_father;
+    MEDFileAnyTypeField1TSWithoutSDA *_father;
     std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > > _field_pm_pt;
   };
 
@@ -300,8 +304,12 @@ namespace ParaMEDMEM
     static MEDFileFieldGlobs *New();
     std::size_t getHeapMemorySize() const;
     MEDFileFieldGlobs *deepCpy() const throw(INTERP_KERNEL::Exception);
+    MEDFileFieldGlobs *shallowCpyPart(const std::vector<std::string>& pfls, const std::vector<std::string>& locs) const throw(INTERP_KERNEL::Exception);
+    MEDFileFieldGlobs *deepCpyPart(const std::vector<std::string>& pfls, const std::vector<std::string>& locs) const throw(INTERP_KERNEL::Exception);
     void simpleRepr(std::ostream& oss) const;
     void appendGlobs(const MEDFileFieldGlobs& other, double eps) throw(INTERP_KERNEL::Exception);
+    void checkGlobsPflsPartCoherency(const std::vector<std::string>& pflsUsed) const throw(INTERP_KERNEL::Exception);
+    void checkGlobsLocsPartCoherency(const std::vector<std::string>& locsUsed) const throw(INTERP_KERNEL::Exception);
     void loadProfileInFile(med_idt fid, int id, const char *pflName) throw(INTERP_KERNEL::Exception);
     void loadProfileInFile(med_idt fid, int id);
     void loadGlobals(med_idt fid, const MEDFileFieldGlobsReal& real) throw(INTERP_KERNEL::Exception);
@@ -355,10 +363,16 @@ namespace ParaMEDMEM
     MEDFileFieldGlobsReal(const char *fname);
     MEDFileFieldGlobsReal();
     std::size_t getHeapMemorySize() const;
-    void simpleRepr(std::ostream& oss) const;
+    void simpleReprGlobs(std::ostream& oss) const;
+    void resetContent();
     void shallowCpyGlobs(const MEDFileFieldGlobsReal& other);
     void deepCpyGlobs(const MEDFileFieldGlobsReal& other);
+    void shallowCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
+    void deepCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
     void appendGlobs(const MEDFileFieldGlobsReal& other, double eps) throw(INTERP_KERNEL::Exception);
+    void checkGlobsCoherency() const throw(INTERP_KERNEL::Exception);
+    void checkGlobsPflsPartCoherency() const throw(INTERP_KERNEL::Exception);
+    void checkGlobsLocsPartCoherency() const throw(INTERP_KERNEL::Exception);
     virtual std::vector<std::string> getPflsReallyUsed() const = 0;
     virtual std::vector<std::string> getLocsReallyUsed() const = 0;
     virtual std::vector<std::string> getPflsReallyUsedMulti() const = 0;
@@ -406,38 +420,51 @@ namespace ParaMEDMEM
     //
     void appendProfile(DataArrayInt *pfl) throw(INTERP_KERNEL::Exception);
     void appendLoc(const char *locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
+  protected:
+    MEDFileFieldGlobs *contentNotNull() throw(INTERP_KERNEL::Exception);
+    const MEDFileFieldGlobs *contentNotNull() const throw(INTERP_KERNEL::Exception);
   protected:
     MEDCouplingAutoRefCountObjectPtr< MEDFileFieldGlobs > _globals;
   };
 
+  class MEDLOADER_EXPORT MEDFileFieldNameScope
+  {
+  public:
+    MEDFileFieldNameScope();
+    MEDFileFieldNameScope(const char *fieldName);
+    std::string getName() const throw(INTERP_KERNEL::Exception);
+    void setName(const char *fieldName) throw(INTERP_KERNEL::Exception);
+    std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
+    void setDtUnit(const char *dtUnit) throw(INTERP_KERNEL::Exception);
+    void copyNameScope(const MEDFileFieldNameScope& other);
+  protected:
+    std::string _name;
+    std::string _dt_unit;
+  };
+
   /*!
    * SDA is for Shared Data Arrays such as profiles.
    */
-  class MEDLOADER_EXPORT MEDFileField1TSWithoutSDA : public RefCountObject
+  class MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA : public RefCountObject, public MEDFileFieldNameScope
   {
   public:
-    int copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
-    int getDimension() const;
+    MEDFileAnyTypeField1TSWithoutSDA();
+    MEDFileAnyTypeField1TSWithoutSDA(const char *fieldName, int csit, int iteration, int order);
     int getIteration() const { return _iteration; }
     int getOrder() const { return _order; }
     double getTime(int& iteration, int& order) const { iteration=_iteration; order=_order; return _dt; }
     void setTime(int iteration, int order, double val) { _dt=val; _iteration=iteration; _order=order; }
-    std::string getName() const;
-    void setName(const char *name);
-    void simpleRepr(int bkOffset, std::ostream& oss, int f1tsId) const;
-    const std::string& getDtUnit() const { return _dt_unit; }
+    int getDimension() const;
     std::string getMeshName() const throw(INTERP_KERNEL::Exception);
     void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
     bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab) throw(INTERP_KERNEL::Exception);
     int getMeshIteration() const throw(INTERP_KERNEL::Exception);
     int getMeshOrder() const throw(INTERP_KERNEL::Exception);
-    int getNumberOfComponents() const;
     bool isDealingTS(int iteration, int order) const;
     std::pair<int,int> getDtIt() const;
     void fillIteration(std::pair<int,int>& p) const;
     void fillTypesOfFieldAvailable(std::vector<TypeOfField>& types) const throw(INTERP_KERNEL::Exception);
-    const std::vector<std::string>& getInfo() const;
-    std::vector<std::string>& getInfo();
+    std::vector<TypeOfField> getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception);
     //
     std::vector<std::string> getPflsReallyUsed2() const;
     std::vector<std::string> getLocsReallyUsed2() const;
@@ -445,41 +472,47 @@ namespace ParaMEDMEM
     std::vector<std::string> getLocsReallyUsedMulti2() const;
     void changePflsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
     void changeLocsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
-    DataArrayDouble *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception);
-    DataArrayDouble *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception);
+    //
     int getNonEmptyLevels(const char *mname, std::vector<int>& levs) const throw(INTERP_KERNEL::Exception);
-    std::vector<TypeOfField> getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception);
     std::vector< std::vector<std::pair<int,int> > > getFieldSplitedByType(const char *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 throw(INTERP_KERNEL::Exception);
-     std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(const char *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 throw(INTERP_KERNEL::Exception);
-     MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) throw(INTERP_KERNEL::Exception);
+    //
+    MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) throw(INTERP_KERNEL::Exception);
      const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const throw(INTERP_KERNEL::Exception);
-    static void CheckMeshDimRel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception);
-    static std::vector<int> CheckSBTMesh(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
-    static MEDFileField1TSWithoutSDA *New(const char *fieldName, int csit, int fieldtype, int iteration, int order, const std::vector<std::string>& infos);
   public:
-    void finishLoading(med_idt fid) throw(INTERP_KERNEL::Exception);
-    virtual void writeLL(med_idt fid, const MEDFileWritable& opts) const throw(INTERP_KERNEL::Exception);
-    void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
-    void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
+    int getNumberOfComponents() const;
+    const std::vector<std::string>& getInfo() const;
+    std::vector<std::string>& getInfo();
+    void setInfo(const std::vector<std::string>& infos) throw(INTERP_KERNEL::Exception);
+    std::size_t getHeapMemorySize() const;
+    int copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr) throw(INTERP_KERNEL::Exception);
+    void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
+    void setFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
+    virtual void simpleRepr(int bkOffset, std::ostream& oss, int f1tsId) const;
+    virtual MEDFileAnyTypeField1TSWithoutSDA *deepCpy() const throw(INTERP_KERNEL::Exception) = 0;
+    virtual MEDFileAnyTypeField1TSWithoutSDA *shallowCpy() const throw(INTERP_KERNEL::Exception) = 0;
+    virtual std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > splitComponents() const throw(INTERP_KERNEL::Exception);
+    virtual const char *getTypeStr() const throw(INTERP_KERNEL::Exception) = 0;
+    virtual DataArray *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception) = 0;
+    virtual DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception) = 0;
+    virtual void setArray(DataArray *arr) throw(INTERP_KERNEL::Exception) = 0;
+    virtual DataArray *createNewEmptyDataArrayInstance() const = 0;
+    virtual DataArray *getOrCreateAndGetArray() = 0;
+    virtual const DataArray *getOrCreateAndGetArray() const = 0;
+  public:
+    MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, const char *mName, int renumPol, const MEDFileFieldGlobsReal *glob, MEDCouplingAutoRefCountObjectPtr<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDFileMesh *mesh, MEDCouplingAutoRefCountObjectPtr<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, const char *mName, int renumPol, const MEDFileFieldGlobsReal *glob, MEDCouplingAutoRefCountObjectPtr<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayInt *cellRenum, const DataArrayInt *nodeRenum, MEDCouplingAutoRefCountObjectPtr<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception);
+    DataArray *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception);
+  public:
     bool renumberEntitiesLyingOnMesh(const char *meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
-    MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, const char *mName, int renumPol, const MEDFileFieldGlobsReal *glob) const throw(INTERP_KERNEL::Exception);
-    MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception);
-    MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, const char *mName, int renumPol, const MEDFileFieldGlobsReal *glob) const throw(INTERP_KERNEL::Exception);
-    MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayInt *cellRenum, const DataArrayInt *nodeRenum) const throw(INTERP_KERNEL::Exception);
-    DataArrayDouble *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob) const throw(INTERP_KERNEL::Exception);
+  public:
+    virtual void finishLoading(med_idt fid, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception);
+    void writeLL(med_idt fid, const MEDFileWritable& opts, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception);
   protected:
-    int addNewEntryIfNecessary(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
     int getMeshIdFromMeshName(const char *mName) const throw(INTERP_KERNEL::Exception);
-  public:
-    MEDFileField1TSWithoutSDA();
-    MEDFileField1TSWithoutSDA(const char *fieldName, int csit, int fieldtype, int iteration, int order, const std::vector<std::string>& infos);
-    MEDFileField1TSWithoutSDA *deepCpy() const throw(INTERP_KERNEL::Exception);
-    std::size_t getHeapMemorySize() const;
-    DataArrayDouble *getOrCreateAndGetArray();
-    const DataArrayDouble *getOrCreateAndGetArray() const;
+    int addNewEntryIfNecessary(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
   protected:
-    std::string _dt_unit;
-    MEDCouplingAutoRefCountObjectPtr< DataArrayDouble > _arr;
     std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > > _field_per_mesh;
     int _iteration;
     int _order;
@@ -487,37 +520,90 @@ namespace ParaMEDMEM
   public:
     //! only useable on reading
     mutable int _csit;
-    //! only useable on reading. 0 is for float, 1 for int32, 2 for int64
-    mutable int _field_type;
+  };
+  
+  /*!
+   * SDA is for Shared Data Arrays such as profiles.
+   */
+  class MEDLOADER_EXPORT MEDFileField1TSWithoutSDA : public MEDFileAnyTypeField1TSWithoutSDA
+  {
+  public:
+    const char *getTypeStr() const throw(INTERP_KERNEL::Exception);
+    DataArray *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception);
+    DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception);
+    DataArrayDouble *getUndergroundDataArrayDouble() const throw(INTERP_KERNEL::Exception);
+    DataArrayDouble *getUndergroundDataArrayDoubleExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception);
+    std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(const char *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 throw(INTERP_KERNEL::Exception);
+    static void CheckMeshDimRel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception);
+    static std::vector<int> CheckSBTMesh(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
+    static MEDFileField1TSWithoutSDA *New(const char *fieldName, int csit, int iteration, int order, const std::vector<std::string>& infos);
+  public:
+    MEDFileField1TSWithoutSDA();
+    MEDFileField1TSWithoutSDA(const char *fieldName, int csit, int iteration, int order, const std::vector<std::string>& infos);
+    MEDFileAnyTypeField1TSWithoutSDA *shallowCpy() const throw(INTERP_KERNEL::Exception);
+    MEDFileAnyTypeField1TSWithoutSDA *deepCpy() const throw(INTERP_KERNEL::Exception);
+    void setArray(DataArray *arr) throw(INTERP_KERNEL::Exception);
+    DataArray *createNewEmptyDataArrayInstance() const;
+    DataArray *getOrCreateAndGetArray();
+    const DataArray *getOrCreateAndGetArray() const;
+    DataArrayDouble *getOrCreateAndGetArrayDouble();
+    const DataArrayDouble *getOrCreateAndGetArrayDouble() const;
+  protected:
+    MEDCouplingAutoRefCountObjectPtr< DataArrayDouble > _arr;
+  public:
+    static const char TYPE_STR[];
   };
 
   /*!
-   * User class.
+   * SDA is for Shared Data Arrays such as profiles.
    */
-  class MEDLOADER_EXPORT MEDFileField1TS : public RefCountObject, public MEDFileWritable, public MEDFileFieldGlobsReal
+  class MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA : public MEDFileAnyTypeField1TSWithoutSDA
   {
   public:
-    static MEDFileField1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
-    static MEDFileField1TS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
-    static MEDFileField1TS *New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
-    static MEDFileField1TS *New(const MEDFileField1TSWithoutSDA& other, bool shallowCopyOfContent);
-    static MEDFileField1TS *New();
-    std::string simpleRepr() const;
-    void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
-    MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
-    MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception);
-    MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
-    MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
-    MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
-    DataArrayDouble *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const throw(INTERP_KERNEL::Exception);
-    //
-    void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
-    void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
-    // direct forwarding to MEDFileField1TSWithoutSDA instance _content
+    MEDFileIntField1TSWithoutSDA();
+    static MEDFileIntField1TSWithoutSDA *New(const char *fieldName, int csit, int iteration, int order, const std::vector<std::string>& infos);
+    MEDFileAnyTypeField1TSWithoutSDA *deepCpy() const throw(INTERP_KERNEL::Exception);
+    MEDFileAnyTypeField1TSWithoutSDA *shallowCpy() const throw(INTERP_KERNEL::Exception);
+    const char *getTypeStr() const throw(INTERP_KERNEL::Exception);
+    DataArray *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception);
+    DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception);
+    void setArray(DataArray *arr) throw(INTERP_KERNEL::Exception);
+    DataArray *createNewEmptyDataArrayInstance() const;
+    DataArray *getOrCreateAndGetArray();
+    const DataArray *getOrCreateAndGetArray() const;
+    DataArrayInt *getOrCreateAndGetArrayInt();
+    const DataArrayInt *getOrCreateAndGetArrayInt() const;
+    DataArrayInt *getUndergroundDataArrayInt() const throw(INTERP_KERNEL::Exception);
+    DataArrayInt *getUndergroundDataArrayIntExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception);
+  protected:
+    MEDFileIntField1TSWithoutSDA(const char *fieldName, int csit, int iteration, int order, const std::vector<std::string>& infos);
+  protected:
+    MEDCouplingAutoRefCountObjectPtr< DataArrayInt > _arr;
   public:
-    std::size_t getHeapMemorySize() const;
-    MEDFileField1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
-    int copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
+    static const char TYPE_STR[];
+  };
+
+  /*!
+   * User class.
+   */
+  class MEDLOADER_EXPORT MEDFileAnyTypeField1TS : public RefCountObject, public MEDFileWritable, public MEDFileFieldGlobsReal
+  {
+  protected:
+    MEDFileAnyTypeField1TS();
+    MEDFileAnyTypeField1TS(const char *fileName) throw(INTERP_KERNEL::Exception);
+    MEDFileAnyTypeField1TS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
+    MEDFileAnyTypeField1TS(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
+    MEDFileAnyTypeField1TS(const MEDFileAnyTypeField1TSWithoutSDA& other, bool shallowCopyOfContent);
+    static MEDFileAnyTypeField1TS *BuildNewInstanceFromContent(MEDFileAnyTypeField1TSWithoutSDA *c, const char *fileName) throw(INTERP_KERNEL::Exception);
+    static MEDFileAnyTypeField1TSWithoutSDA *BuildContentFrom(med_idt fid, const char *fileName) throw(INTERP_KERNEL::Exception);
+    static MEDFileAnyTypeField1TSWithoutSDA *BuildContentFrom(med_idt fid, const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
+    static MEDFileAnyTypeField1TSWithoutSDA *BuildContentFrom(med_idt fid, const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
+    void writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception);
+    // direct forwarding to MEDFileAnyTypeField1TSWithoutSDA instance _content
+  public:
+    static MEDFileAnyTypeField1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
+    static MEDFileAnyTypeField1TS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
+    static MEDFileAnyTypeField1TS *New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
     int getDimension() const;
     int getIteration() const;
     int getOrder() const;
@@ -525,8 +611,10 @@ namespace ParaMEDMEM
     void setTime(int iteration, int order, double val);
     std::string getName() const;
     void setName(const char *name);
+    std::string simpleRepr() const;
     void simpleRepr(int bkOffset, std::ostream& oss, int f1tsId) const;
-    const std::string& getDtUnit() const;
+    std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
+    void setDtUnit(const char *dtUnit) throw(INTERP_KERNEL::Exception);
     std::string getMeshName() const throw(INTERP_KERNEL::Exception);
     void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
     bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab) throw(INTERP_KERNEL::Exception);
@@ -537,76 +625,173 @@ namespace ParaMEDMEM
     std::pair<int,int> getDtIt() const;
     void fillIteration(std::pair<int,int>& p) const;
     void fillTypesOfFieldAvailable(std::vector<TypeOfField>& types) const throw(INTERP_KERNEL::Exception);
+    void setInfo(const std::vector<std::string>& infos) throw(INTERP_KERNEL::Exception);
     const std::vector<std::string>& getInfo() const;
     std::vector<std::string>& getInfo();
-    DataArrayDouble *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception);
-    DataArrayDouble *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception);
-    MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) throw(INTERP_KERNEL::Exception);
-    const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const throw(INTERP_KERNEL::Exception);
-    int getNonEmptyLevels(const char *mname, std::vector<int>& levs) const throw(INTERP_KERNEL::Exception);
     std::vector<TypeOfField> getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception);
     std::vector< std::vector<std::pair<int,int> > > getFieldSplitedByType(const char *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 throw(INTERP_KERNEL::Exception);
-    std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(const char *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 throw(INTERP_KERNEL::Exception);
+    MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) throw(INTERP_KERNEL::Exception);
+    const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const throw(INTERP_KERNEL::Exception);
+    int getNonEmptyLevels(const char *mname, std::vector<int>& levs) const throw(INTERP_KERNEL::Exception);
+  public:
+    void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
+    std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > splitComponents() const throw(INTERP_KERNEL::Exception);
+    MEDFileAnyTypeField1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
+    int copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr) throw(INTERP_KERNEL::Exception);
+    virtual MEDFileAnyTypeField1TS *shallowCpy() const throw(INTERP_KERNEL::Exception) = 0;
   public:
     //! underground method see MEDFileField1TSWithoutSDA::setProfileNameOnLeaf
     void setProfileNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
     //! underground method see MEDFileField1TSWithoutSDA::setLocNameOnLeaf
     void setLocNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
+    std::size_t getHeapMemorySize() const;
     std::vector<std::string> getPflsReallyUsed() const;
     std::vector<std::string> getLocsReallyUsed() const;
     std::vector<std::string> getPflsReallyUsedMulti() const;
     std::vector<std::string> getLocsReallyUsedMulti() const;
     void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
     void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
+  public:
+    static int LocateField2(med_idt fid, const char *fileName, int fieldIdCFormat, bool checkFieldId, std::string& fieldName, med_field_type& typcha, std::vector<std::string>& infos, std::string& dtunitOut) throw(INTERP_KERNEL::Exception);
+    static int LocateField(med_idt fid, const char *fileName, const char *fieldName, int& posCFormat, med_field_type& typcha, std::vector<std::string>& infos, std::string& dtunitOut) throw(INTERP_KERNEL::Exception);
+  public:
+    virtual med_field_type getMEDFileFieldType() const = 0;
+    MEDFileAnyTypeField1TSWithoutSDA *contentNotNullBase() throw(INTERP_KERNEL::Exception);
+    const MEDFileAnyTypeField1TSWithoutSDA *contentNotNullBase() const throw(INTERP_KERNEL::Exception);
+  protected:
+    MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> _content;
+  };
+
+  /*!
+   * User class.
+   */
+  class MEDLOADER_EXPORT MEDFileField1TS : public MEDFileAnyTypeField1TS
+  {
+  public:
+    static MEDFileField1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
+    static MEDFileField1TS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
+    static MEDFileField1TS *New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
+    static MEDFileField1TS *New(const MEDFileField1TSWithoutSDA& other, bool shallowCopyOfContent);
+    static MEDFileField1TS *New();
+    MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+    DataArrayDouble *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const throw(INTERP_KERNEL::Exception);
+    //
+    void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
+    void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
+    // direct forwarding to MEDFileField1TSWithoutSDA instance _content
+  public:
+    MEDFileAnyTypeField1TS *shallowCpy() const throw(INTERP_KERNEL::Exception);
+    DataArrayDouble *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception);
+    DataArrayDouble *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception);
+    
+    std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(const char *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 throw(INTERP_KERNEL::Exception);
+  public:
+    static void SetDataArrayDoubleInField(MEDCouplingFieldDouble *f, MEDCouplingAutoRefCountObjectPtr<DataArray>& arr) throw(INTERP_KERNEL::Exception);
+    static DataArrayDouble *ReturnSafelyDataArrayDouble(MEDCouplingAutoRefCountObjectPtr<DataArray>& arr) throw(INTERP_KERNEL::Exception);
+  private:
+    med_field_type getMEDFileFieldType() const { return MED_FLOAT64; }
+    const MEDFileField1TSWithoutSDA *contentNotNull() const throw(INTERP_KERNEL::Exception);
+    MEDFileField1TSWithoutSDA *contentNotNull() throw(INTERP_KERNEL::Exception);
   private:
-    void writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception);
     MEDFileField1TS(const char *fileName) throw(INTERP_KERNEL::Exception);
     MEDFileField1TS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
     MEDFileField1TS(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
     MEDFileField1TS(const MEDFileField1TSWithoutSDA& other, bool shallowCopyOfContent);
     MEDFileField1TS();
-    int locateField(med_idt fid, const char *fileName, const char *fieldName, med_field_type& typcha) throw(INTERP_KERNEL::Exception);
-  protected:
-    MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutSDA> _content;
+  };
+
+  class MEDLOADER_EXPORT MEDFileIntField1TS : public MEDFileAnyTypeField1TS
+  {
+  public:
+    static MEDFileIntField1TS *New();
+    static MEDFileIntField1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
+    static MEDFileIntField1TS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
+    static MEDFileIntField1TS *New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
+    static MEDFileIntField1TS *New(const MEDFileIntField1TSWithoutSDA& other, bool shallowCopyOfContent);
+    MEDFileAnyTypeField1TS *shallowCpy() const throw(INTERP_KERNEL::Exception);
+    //
+    MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, DataArrayInt* &arrOut, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt* &arrOut, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayInt* &arrOut, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+    DataArrayInt *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const throw(INTERP_KERNEL::Exception);
+    //
+    void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception);
+    void setFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
+    DataArrayInt *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception);
+  public:
+    static DataArrayInt *ReturnSafelyDataArrayInt(MEDCouplingAutoRefCountObjectPtr<DataArray>& arr) throw(INTERP_KERNEL::Exception);
+  private:
+    med_field_type getMEDFileFieldType() const { return MED_INT32; }
+    const MEDFileIntField1TSWithoutSDA *contentNotNull() const throw(INTERP_KERNEL::Exception);
+    MEDFileIntField1TSWithoutSDA *contentNotNull() throw(INTERP_KERNEL::Exception);
+  private:
+    MEDFileIntField1TS();
+    MEDFileIntField1TS(const char *fileName) throw(INTERP_KERNEL::Exception);
+    MEDFileIntField1TS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
+    MEDFileIntField1TS(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
+    MEDFileIntField1TS(const MEDFileIntField1TSWithoutSDA& other, bool shallowCopyOfContent);
   };
   
-  class MEDLOADER_EXPORT MEDFileFieldMultiTSWithoutSDA : public RefCountObject
+  class MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA : public RefCountObject, public MEDFileFieldNameScope
   {
+  protected:
+    MEDFileAnyTypeFieldMultiTSWithoutSDA();
+    MEDFileAnyTypeFieldMultiTSWithoutSDA(const char *fieldName);
+    MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, int fieldId) throw(INTERP_KERNEL::Exception);
+    MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit) throw(INTERP_KERNEL::Exception);
   public:
-    static MEDFileFieldMultiTSWithoutSDA *New(med_idt fid, const char *fieldName, int id, int ft, const std::vector<std::string>& infos, int nbOfStep) throw(INTERP_KERNEL::Exception);
-    MEDFileFieldMultiTSWithoutSDA(med_idt fid, int fieldId) throw(INTERP_KERNEL::Exception);
     std::size_t getHeapMemorySize() const;
-    MEDFileFieldMultiTSWithoutSDA *deepCpy() const throw(INTERP_KERNEL::Exception);
+    virtual MEDFileAnyTypeFieldMultiTSWithoutSDA *deepCpy() const throw(INTERP_KERNEL::Exception);
+    virtual std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> > splitComponents() const throw(INTERP_KERNEL::Exception);
+    virtual const char *getTypeStr() const throw(INTERP_KERNEL::Exception) = 0;
+    virtual MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const throw(INTERP_KERNEL::Exception) = 0;
+    virtual MEDFileAnyTypeFieldMultiTSWithoutSDA *createNew() const throw(INTERP_KERNEL::Exception) = 0;
+    virtual MEDFileAnyTypeField1TSWithoutSDA *createNew1TSWithoutSDAEmptyInstance() const throw(INTERP_KERNEL::Exception) = 0;
+    virtual void checkCoherencyOfType(const MEDFileAnyTypeField1TSWithoutSDA *f1ts) const throw(INTERP_KERNEL::Exception) = 0;
+    const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
+    void setInfo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
+    int getTimeStepPos(int iteration, int order) const throw(INTERP_KERNEL::Exception);
+    const MEDFileAnyTypeField1TSWithoutSDA& getTimeStepEntry(int iteration, int order) const throw(INTERP_KERNEL::Exception);
+    MEDFileAnyTypeField1TSWithoutSDA& getTimeStepEntry(int iteration, int order) throw(INTERP_KERNEL::Exception);
+    std::string getMeshName() const throw(INTERP_KERNEL::Exception);
+    void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
+    bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab) throw(INTERP_KERNEL::Exception);
     int getNumberOfTS() const;
     void eraseEmptyTS() throw(INTERP_KERNEL::Exception);
     void eraseTimeStepIds(const int *startIds, const int *endIds) throw(INTERP_KERNEL::Exception);
-    std::vector< std::pair<int,int> > getIterations() const;
+    void eraseTimeStepIds2(int bg, int end, int step) throw(INTERP_KERNEL::Exception);
+    MEDFileAnyTypeFieldMultiTSWithoutSDA *buildFromTimeStepIds(const int *startIds, const int *endIds) const throw(INTERP_KERNEL::Exception);
+    MEDFileAnyTypeFieldMultiTSWithoutSDA *buildFromTimeStepIds2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
+    MEDFileAnyTypeFieldMultiTSWithoutSDA *partOfThisLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const throw(INTERP_KERNEL::Exception);
+    MEDFileAnyTypeFieldMultiTSWithoutSDA *partOfThisNotLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const throw(INTERP_KERNEL::Exception);
     int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
     int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
+    std::vector< std::pair<int,int> > getIterations() const;
+    std::vector< std::pair<int,int> > getTimeSteps(std::vector<double>& ret1) const throw(INTERP_KERNEL::Exception);
+    void pushBackTimeStep(MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA>& tse) throw(INTERP_KERNEL::Exception);
+    void synchronizeNameScope() throw(INTERP_KERNEL::Exception);
+    void simpleRepr(int bkOffset, std::ostream& oss, int fmtsId) const;
     int getNonEmptyLevels(int iteration, int order, const char *mname, std::vector<int>& levs) const throw(INTERP_KERNEL::Exception);
-    std::vector< std::vector<TypeOfField> > getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception);
+    void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
+    void appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
     std::vector< std::vector< std::pair<int,int> > > getFieldSplitedByType(int iteration, int order, const char *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 throw(INTERP_KERNEL::Exception);
-    std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(int iteration, int order, const char *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 throw(INTERP_KERNEL::Exception);
-    virtual void writeLL(med_idt fid, const MEDFileWritable& opts) const throw(INTERP_KERNEL::Exception);
-    std::string getName() const;
-    void setName(const char *name);
-    void simpleRepr(int bkOffset, std::ostream& oss, int fmtsId) const;
-    std::vector< std::pair<int,int> > getTimeSteps(std::vector<double>& ret1) const throw(INTERP_KERNEL::Exception);
-    std::string getMeshName() const throw(INTERP_KERNEL::Exception);
-    void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
-    bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab) throw(INTERP_KERNEL::Exception);
-    const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
-    DataArrayDouble *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception);
-    DataArrayDouble *getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception);
+    std::vector< std::vector<TypeOfField> > getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception);
+    DataArray *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception);
+    DataArray *getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception);
     bool renumberEntitiesLyingOnMesh(const char *meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
-    void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
-    void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
+    void finishLoading(med_idt fid, int nbPdt, med_field_type fieldTyp) throw(INTERP_KERNEL::Exception);
+    void writeLL(med_idt fid, const MEDFileWritable& opts) const throw(INTERP_KERNEL::Exception);
   public:
-    const MEDFileField1TSWithoutSDA *getTimeStepAtPos2(int pos) const throw(INTERP_KERNEL::Exception);
-    MEDFileField1TSWithoutSDA *getTimeStepAtPos2(int pos) throw(INTERP_KERNEL::Exception);
-    const MEDFileField1TSWithoutSDA& getTimeStepEntry(int iteration, int order) const throw(INTERP_KERNEL::Exception);
+    const MEDFileAnyTypeField1TSWithoutSDA *getTimeStepAtPos2(int pos) const throw(INTERP_KERNEL::Exception);
+    MEDFileAnyTypeField1TSWithoutSDA *getTimeStepAtPos2(int pos) throw(INTERP_KERNEL::Exception);
     std::vector<std::string> getPflsReallyUsed2() const;
     std::vector<std::string> getLocsReallyUsed2() const;
     std::vector<std::string> getPflsReallyUsedMulti2() const;
@@ -614,76 +799,113 @@ namespace ParaMEDMEM
     void changePflsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
     void changeLocsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
   protected:
-    MEDFileField1TSWithoutSDA& getTimeStepEntry(int iteration, int order) throw(INTERP_KERNEL::Exception);
-    std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
+    virtual med_field_type getMEDFileFieldType() const = 0;
+    void copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr) throw(INTERP_KERNEL::Exception);
+    void checkCoherencyOfTinyInfo(const MEDCouplingFieldDouble *field, const DataArray *arr) const throw(INTERP_KERNEL::Exception);
+    void checkThatComponentsMatch(const std::vector<std::string>& compos) const throw(INTERP_KERNEL::Exception);
+    void checkThatNbOfCompoOfTSMatchThis() const throw(INTERP_KERNEL::Exception);
+  protected:
+    std::vector<std::string> _infos;
+    std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > _time_steps;
+  };
+
+  class MEDLOADER_EXPORT MEDFileFieldMultiTSWithoutSDA : public MEDFileAnyTypeFieldMultiTSWithoutSDA
+  {
+  public:
+    static MEDFileFieldMultiTSWithoutSDA *New(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit) throw(INTERP_KERNEL::Exception);
+    MEDFileFieldMultiTSWithoutSDA(med_idt fid, int fieldId) throw(INTERP_KERNEL::Exception);
+    const char *getTypeStr() const throw(INTERP_KERNEL::Exception);
+    MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const throw(INTERP_KERNEL::Exception);
+    MEDFileAnyTypeFieldMultiTSWithoutSDA *createNew() const throw(INTERP_KERNEL::Exception);
+    std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(int iteration, int order, const char *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 throw(INTERP_KERNEL::Exception);
+  protected:
     MEDFileFieldMultiTSWithoutSDA(const char *fieldName);
-    MEDFileFieldMultiTSWithoutSDA(med_idt fid, const char *fieldName, int id, int ft, const std::vector<std::string>& infos, int nbOfStep) throw(INTERP_KERNEL::Exception);
-    void finishLoading(med_idt fid, int nbPdt) throw(INTERP_KERNEL::Exception);
-    void copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
-    void checkCoherencyOfTinyInfo(const MEDCouplingFieldDouble *field) const throw(INTERP_KERNEL::Exception);
+    MEDFileFieldMultiTSWithoutSDA(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit) throw(INTERP_KERNEL::Exception);
+    med_field_type getMEDFileFieldType() const { return MED_FLOAT64; }
+    MEDFileAnyTypeField1TSWithoutSDA *createNew1TSWithoutSDAEmptyInstance() const throw(INTERP_KERNEL::Exception);
+    void checkCoherencyOfType(const MEDFileAnyTypeField1TSWithoutSDA *f1ts) const throw(INTERP_KERNEL::Exception);
   public:
     MEDFileFieldMultiTSWithoutSDA();
-  protected:
-    std::string _name;
-    std::vector<std::string> _infos;
-    //! only useable on reading. 0 is for float, 1 for int32, 2 for int64
-    mutable int _field_type;
-    std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutSDA> > _time_steps;
   };
 
-  class MEDFileFieldMultiTSIterator;
+  class MEDLOADER_EXPORT MEDFileIntFieldMultiTSWithoutSDA : public MEDFileAnyTypeFieldMultiTSWithoutSDA
+  {
+  public:
+    static MEDFileIntFieldMultiTSWithoutSDA *New(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit) throw(INTERP_KERNEL::Exception);
+    MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, int fieldId) throw(INTERP_KERNEL::Exception);
+    const char *getTypeStr() const throw(INTERP_KERNEL::Exception);
+    MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const throw(INTERP_KERNEL::Exception);
+    MEDFileAnyTypeFieldMultiTSWithoutSDA *createNew() const throw(INTERP_KERNEL::Exception);
+  protected:
+    MEDFileIntFieldMultiTSWithoutSDA(const char *fieldName);
+    MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit) throw(INTERP_KERNEL::Exception);
+    med_field_type getMEDFileFieldType() const { return MED_INT32; }
+    MEDFileAnyTypeField1TSWithoutSDA *createNew1TSWithoutSDAEmptyInstance() const throw(INTERP_KERNEL::Exception);
+    void checkCoherencyOfType(const MEDFileAnyTypeField1TSWithoutSDA *f1ts) const throw(INTERP_KERNEL::Exception);
+  public:
+    MEDFileIntFieldMultiTSWithoutSDA();
+  };
 
+  class MEDFileAnyTypeFieldMultiTSIterator;
+  
   /*!
    * User class.
    */
-  class MEDLOADER_EXPORT MEDFileFieldMultiTS : public RefCountObject, public MEDFileWritable, public MEDFileFieldGlobsReal
+  class MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS : public RefCountObject, public MEDFileWritable, public MEDFileFieldGlobsReal
   {
+  protected:
+    MEDFileAnyTypeFieldMultiTS();
+    MEDFileAnyTypeFieldMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception);
+    MEDFileAnyTypeFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
+    MEDFileAnyTypeFieldMultiTS(const MEDFileAnyTypeFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent);
+    static MEDFileAnyTypeFieldMultiTS *BuildNewInstanceFromContent(MEDFileAnyTypeFieldMultiTSWithoutSDA *c, const char *fileName) throw(INTERP_KERNEL::Exception);
+    static MEDFileAnyTypeFieldMultiTSWithoutSDA *BuildContentFrom(med_idt fid, const char *fileName) throw(INTERP_KERNEL::Exception);
+    static MEDFileAnyTypeFieldMultiTSWithoutSDA *BuildContentFrom(med_idt fid, const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
   public:
-    static MEDFileFieldMultiTS *New();
-    static MEDFileFieldMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
-    static MEDFileFieldMultiTS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
-    static MEDFileFieldMultiTS *New(const MEDFileFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent);
-    std::size_t getHeapMemorySize() const;
-    MEDFileFieldMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
-    //
-    MEDFileField1TS *getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception);
-    MEDFileField1TS *getTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
-    MEDFileField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
-    MEDFileFieldMultiTSIterator *iterator() throw(INTERP_KERNEL::Exception);
-    //
-    std::string simpleRepr() const;
+    static MEDFileAnyTypeFieldMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
+    static MEDFileAnyTypeFieldMultiTS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
     void writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception);
-    MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
-    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 char *mname, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
-    DataArrayDouble *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const throw(INTERP_KERNEL::Exception);
+    std::size_t getHeapMemorySize() const;
+    virtual MEDFileAnyTypeFieldMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
+    std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > splitComponents() const throw(INTERP_KERNEL::Exception);
+    virtual MEDFileAnyTypeFieldMultiTS *shallowCpy() const throw(INTERP_KERNEL::Exception) = 0;
+    virtual void checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const throw(INTERP_KERNEL::Exception) = 0;
     //
-    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);
+    virtual MEDFileAnyTypeField1TS *getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception) = 0;
+    MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
+    MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
   public:// direct forwarding to MEDFileField1TSWithoutSDA instance _content
+    std::string getName() const;
+    void setName(const char *name);
+    std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
+    void setDtUnit(const char *dtUnit) throw(INTERP_KERNEL::Exception);
+    std::string getMeshName() const throw(INTERP_KERNEL::Exception);
+    void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
+    std::string simpleRepr() const;
+    void simpleRepr(int bkOffset, std::ostream& oss, int fmtsId) const;
     int getNumberOfTS() const;
     void eraseEmptyTS() throw(INTERP_KERNEL::Exception);
     void eraseTimeStepIds(const int *startIds, const int *endIds) throw(INTERP_KERNEL::Exception);
+    void eraseTimeStepIds2(int bg, int end, int step) throw(INTERP_KERNEL::Exception);
+    MEDFileAnyTypeFieldMultiTS *buildSubPart(const int *startIds, const int *endIds) const throw(INTERP_KERNEL::Exception);
+    MEDFileAnyTypeFieldMultiTS *buildSubPartSlice(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
+    std::vector< std::pair<int,int> > getTimeSteps(std::vector<double>& ret1) const throw(INTERP_KERNEL::Exception);
     std::vector< std::pair<int,int> > getIterations() const;
+    void pushBackTimeSteps(const std::vector<MEDFileAnyTypeField1TS *>& f1ts) throw(INTERP_KERNEL::Exception);
+    void pushBackTimeStep(MEDFileAnyTypeField1TS *f1ts) throw(INTERP_KERNEL::Exception);
+    void synchronizeNameScope() throw(INTERP_KERNEL::Exception);
     int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
     int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
+    MEDFileAnyTypeFieldMultiTSIterator *iterator() throw(INTERP_KERNEL::Exception);
+    bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab) throw(INTERP_KERNEL::Exception);
+    const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
+    void setInfo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
+    int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
     int getNonEmptyLevels(int iteration, int order, const char *mname, std::vector<int>& levs) const throw(INTERP_KERNEL::Exception);
     std::vector< std::vector<TypeOfField> > getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception);
     std::vector< std::vector< std::pair<int,int> > > getFieldSplitedByType(int iteration, int order, const char *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 throw(INTERP_KERNEL::Exception);
-std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(int iteration, int order, const char *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 throw(INTERP_KERNEL::Exception);
-    std::string getName() const;
-    void setName(const char *name);
-    void simpleRepr(int bkOffset, std::ostream& oss, int fmtsId) const;
-    std::vector< std::pair<int,int> > getTimeSteps(std::vector<double>& ret1) const throw(INTERP_KERNEL::Exception);
-    std::string getMeshName() const throw(INTERP_KERNEL::Exception);
-    void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
-    bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab) throw(INTERP_KERNEL::Exception);
-    const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
-    DataArrayDouble *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception);
-    DataArrayDouble *getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> getContent();
   public:
     std::vector<std::string> getPflsReallyUsed() const;
     std::vector<std::string> getLocsReallyUsed() const;
@@ -691,25 +913,95 @@ std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(int iterati
     std::vector<std::string> getLocsReallyUsedMulti() const;
     void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
     void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
+  protected:
+    MEDFileAnyTypeFieldMultiTSWithoutSDA *contentNotNullBase() throw(INTERP_KERNEL::Exception);
+    const MEDFileAnyTypeFieldMultiTSWithoutSDA *contentNotNullBase() const throw(INTERP_KERNEL::Exception);
+  protected:
+    MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> _content;
+  };
+
+  /*!
+   * User class.
+   */
+  class MEDLOADER_EXPORT MEDFileFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
+  {
   public:
-    MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTSWithoutSDA> getContent();
+    static MEDFileFieldMultiTS *New();
+    static MEDFileFieldMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
+    static MEDFileFieldMultiTS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
+    static MEDFileFieldMultiTS *New(const MEDFileFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent);
+    MEDFileAnyTypeFieldMultiTS *shallowCpy() const throw(INTERP_KERNEL::Exception);
+    void checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const throw(INTERP_KERNEL::Exception);
+    //
+    MEDFileAnyTypeField1TS *getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception);
+    MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
+    MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
+    //
+    MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+    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 char *mname, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+    DataArrayDouble *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) 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);
+std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(int iteration, int order, const char *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 throw(INTERP_KERNEL::Exception);
+    DataArrayDouble *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception);
+    DataArrayDouble *getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception);
+  private:
+    const MEDFileFieldMultiTSWithoutSDA *contentNotNull() const throw(INTERP_KERNEL::Exception);
+    MEDFileFieldMultiTSWithoutSDA *contentNotNull() throw(INTERP_KERNEL::Exception);
   private:
     MEDFileFieldMultiTS();
     MEDFileFieldMultiTS(const MEDFileFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent);
     MEDFileFieldMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception);
     MEDFileFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
-  protected:
-    MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTSWithoutSDA> _content;
   };
 
-  class MEDCOUPLING_EXPORT MEDFileFieldMultiTSIterator
+  /*!
+   * User class.
+   */
+  class MEDLOADER_EXPORT MEDFileIntFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
   {
   public:
-    MEDFileFieldMultiTSIterator(MEDFileFieldMultiTS *fmts);
-    ~MEDFileFieldMultiTSIterator();
-    MEDFileField1TS *nextt();
+    static MEDFileIntFieldMultiTS *New();
+    static MEDFileIntFieldMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
+    static MEDFileIntFieldMultiTS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
+    static MEDFileIntFieldMultiTS *New(const MEDFileIntFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent);
+    MEDFileAnyTypeFieldMultiTS *shallowCpy() const throw(INTERP_KERNEL::Exception);
+    void checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const throw(INTERP_KERNEL::Exception);
+    MEDFileAnyTypeField1TS *getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception);
+    //
+    MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, DataArrayInt* &arrOut, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt* &arrOut, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, DataArrayInt* &arrOut, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const char *mname, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+    DataArrayInt *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const throw(INTERP_KERNEL::Exception);
+    //
+    void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception);
+    void appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
+    //
+    DataArrayInt *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception);
   private:
-    MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTS> _fmts;
+    const MEDFileIntFieldMultiTSWithoutSDA *contentNotNull() const throw(INTERP_KERNEL::Exception);
+    MEDFileIntFieldMultiTSWithoutSDA *contentNotNull() throw(INTERP_KERNEL::Exception);
+  private:
+    MEDFileIntFieldMultiTS();
+    MEDFileIntFieldMultiTS(const MEDFileIntFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent);
+    MEDFileIntFieldMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception);
+    MEDFileIntFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
+  };
+
+  class MEDCOUPLING_EXPORT MEDFileAnyTypeFieldMultiTSIterator
+  {
+  public:
+    MEDFileAnyTypeFieldMultiTSIterator(MEDFileAnyTypeFieldMultiTS *fmts);
+    ~MEDFileAnyTypeFieldMultiTSIterator();
+    MEDFileAnyTypeField1TS *nextt() throw(INTERP_KERNEL::Exception);
+  private:
+    MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTS> _fmts;
      int _iter_id;
      int _nb_iter;
   };
@@ -726,25 +1018,34 @@ std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(int iterati
     static MEDFileFields *New(const char *fileName) throw(INTERP_KERNEL::Exception);
     std::size_t getHeapMemorySize() const;
     MEDFileFields *deepCpy() const throw(INTERP_KERNEL::Exception);
+    MEDFileFields *shallowCpy() const throw(INTERP_KERNEL::Exception);
     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
     void writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception);
     int getNumberOfFields() const;
+    std::vector< std::pair<int,int> > getCommonIterations(bool& areThereSomeForgottenTS) const throw(INTERP_KERNEL::Exception);
     std::vector<std::string> getFieldsNames() const throw(INTERP_KERNEL::Exception);
     std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
     std::string simpleRepr() const;
     void simpleRepr(int bkOffset, std::ostream& oss) const;
     //
     void resize(int newSize) throw(INTERP_KERNEL::Exception);
-    void pushField(MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
-    void setFieldAtPos(int i, MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
-    MEDFileFieldMultiTS *getFieldAtPos(int i) const throw(INTERP_KERNEL::Exception);
-    MEDFileFieldMultiTS *getFieldWithName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
+    void pushField(MEDFileAnyTypeFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
+    void pushFields(const std::vector<MEDFileAnyTypeFieldMultiTS *>& fields) throw(INTERP_KERNEL::Exception);
+    void setFieldAtPos(int i, MEDFileAnyTypeFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
+    int getPosFromFieldName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
+    MEDFileAnyTypeFieldMultiTS *getFieldAtPos(int i) const throw(INTERP_KERNEL::Exception);
+    MEDFileAnyTypeFieldMultiTS *getFieldWithName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
+    MEDFileFields *buildSubPart(const int *startIds, const int *endIds) const throw(INTERP_KERNEL::Exception);
+    MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const char *meshName) const throw(INTERP_KERNEL::Exception);
+    MEDFileFields *partOfThisLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const throw(INTERP_KERNEL::Exception);
+    MEDFileFields *partOfThisNotLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const throw(INTERP_KERNEL::Exception);
     MEDFileFieldsIterator *iterator() throw(INTERP_KERNEL::Exception);
     void destroyFieldAtPos(int i) throw(INTERP_KERNEL::Exception);
+    void destroyFieldsAtPos(const int *startIds, const int *endIds) throw(INTERP_KERNEL::Exception);
+    void destroyFieldsAtPos2(int bg, int end, int step) throw(INTERP_KERNEL::Exception);
     bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab) throw(INTERP_KERNEL::Exception);
     bool renumberEntitiesLyingOnMesh(const char *meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N) throw(INTERP_KERNEL::Exception);
   public:
-    int getPosFromFieldName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
     std::vector<std::string> getPflsReallyUsed() const;
     std::vector<std::string> getLocsReallyUsed() const;
     std::vector<std::string> getPflsReallyUsedMulti() const;
@@ -755,7 +1056,7 @@ std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(int iterati
     MEDFileFields();
     MEDFileFields(const char *fileName) throw(INTERP_KERNEL::Exception);
   private:
-    std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTSWithoutSDA> > _fields;
+    std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> > _fields;
   };
 
   class MEDCOUPLING_EXPORT MEDFileFieldsIterator
@@ -763,7 +1064,7 @@ std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(int iterati
   public:
     MEDFileFieldsIterator(MEDFileFields *fs);
     ~MEDFileFieldsIterator();
-    MEDFileFieldMultiTS *nextt();
+    MEDFileAnyTypeFieldMultiTS *nextt();
   private:
     MEDCouplingAutoRefCountObjectPtr<MEDFileFields> _fs;
      int _iter_id;
index 9b0363e9e505eee9b97df4db122b050b559cea72..48dc0c5e35b1a88fb2b1e62e1052d77216c46fd7 100644 (file)
@@ -485,6 +485,27 @@ void MEDFileMesh::assignFamilyNameWithGroupName() throw(INTERP_KERNEL::Exception
   _groups=groups;
 }
 
+/*!
+ * Removes all groups lying on no family. If there is no empty groups, \a this is let untouched.
+ * 
+ * \return the removed groups.
+ */
+std::vector<std::string> MEDFileMesh::removeEmptyGroups() throw(INTERP_KERNEL::Exception)
+{
+  std::vector<std::string> ret;
+  std::map<std::string, std::vector<std::string> > newGrps;
+  for(std::map<std::string, std::vector<std::string> >::const_iterator it=_groups.begin();it!=_groups.end();it++)
+    {
+      if((*it).second.empty())
+        ret.push_back((*it).first);
+      else
+        newGrps[(*it).first]=(*it).second;
+    }
+  if(!ret.empty())
+    _groups=newGrps;
+  return ret;
+}
+
 /*!
  * Removes a group from \a this mesh.
  *  \param [in] name - the name of the group to remove.
@@ -530,6 +551,62 @@ void MEDFileMesh::removeFamily(const char *name) throw(INTERP_KERNEL::Exception)
     }
 }
 
+/*!
+ * Removes all groups in \a this that are orphan. A group is orphan if this group lies on
+ * a set of families, themselves orphan. A family is said orphan if its id appears nowhere in
+ * family field whatever its level. This method also suppresses the orphan families.
+ * 
+ * \return - The list of removed groups names. 
+ *
+ * \sa MEDFileMesh::removeOrphanFamilies.
+ */
+std::vector<std::string> MEDFileMesh::removeOrphanGroups() throw(INTERP_KERNEL::Exception)
+{
+  removeOrphanFamilies();
+  return removeEmptyGroups();
+}
+
+/*!
+ * Removes all families in \a this that are orphan. A family is said orphan if its id appears nowhere in
+ * family field whatever its level. Groups are updated in consequence, that is to say all groups lying on orphan family, will see their families list modified.
+ * 
+ * \return - The list of removed families names.
+ * \sa MEDFileMesh::removeOrphanGroups.
+ */
+std::vector<std::string> MEDFileMesh::removeOrphanFamilies() throw(INTERP_KERNEL::Exception)
+{
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> allFamIdsInUse=computeAllFamilyIdsInUse();
+  std::vector<std::string> ret;
+  if(!((DataArrayInt*)allFamIdsInUse))
+    {
+      ret=getFamiliesNames();
+      _families.clear(); _groups.clear();
+      return ret;
+    }
+  std::map<std::string,int> famMap;
+  std::map<std::string, std::vector<std::string> > grps(_groups);
+  for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+    {
+      if(allFamIdsInUse->presenceOfValue((*it).second))
+        famMap[(*it).first]=(*it).second;
+      else
+        {
+          ret.push_back((*it).first);
+          std::vector<std::string> grpsOnEraseFam=getGroupsOnFamily((*it).first.c_str());
+          for(std::vector<std::string>::const_iterator it2=grpsOnEraseFam.begin();it2!=grpsOnEraseFam.end();it2++)
+            {
+              std::map<std::string, std::vector<std::string> >::iterator it3=grps.find(*it2);//it3!=grps.empty() thanks to copy
+              std::vector<std::string>& famv=(*it3).second;
+              std::vector<std::string>::iterator it4=std::find(famv.begin(),famv.end(),(*it).first);//it4!=famv.end() thanks to copy
+              famv.erase(it4);
+            }
+        }
+    }
+  if(!ret.empty())
+    { _families=famMap; _groups=grps; }
+  return ret;
+}
+
 /*!
  * Renames a group in \a this mesh.
  *  \param [in] oldName - a current name of the group to rename.
@@ -549,8 +626,8 @@ void MEDFileMesh::changeGroupName(const char *oldName, const char *newName) thro
       throw INTERP_KERNEL::Exception(oss.str().c_str());
     }
   std::string nname(newName);
-  it=_groups.find(nname);
-  if(it!=_groups.end())
+  std::map<std::string, std::vector<std::string> >::iterator it2=_groups.find(nname);
+  if(it2!=_groups.end())
     {
       std::ostringstream oss; oss << "Such groupname \"" << newName << "\" already exists ! Kill it before !";
       throw INTERP_KERNEL::Exception(oss.str().c_str());
@@ -1065,6 +1142,23 @@ std::vector<int> MEDFileMesh::getFamiliesIds(const std::vector<std::string>& fam
   return ret;
 }
 
+/*!
+ * Returns a maximal abs(id) of families in \a this mesh.
+ *  \return int - the maximal norm of family id.
+ *  \throw If there are no families in \a this mesh.
+ */
+int MEDFileMesh::getMaxAbsFamilyId() const throw(INTERP_KERNEL::Exception)
+{
+  if(_families.empty())
+    throw INTERP_KERNEL::Exception("MEDFileMesh::getMaxFamilyId : no families set !");
+  int ret=-std::numeric_limits<int>::max();
+  for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+    {
+      ret=std::max(std::abs((*it).second),ret);
+    }
+  return ret;
+}
+
 /*!
  * Returns a maximal id of families in \a this mesh.
  *  \return int - the maximal family id.
@@ -1073,7 +1167,7 @@ std::vector<int> MEDFileMesh::getFamiliesIds(const std::vector<std::string>& fam
 int MEDFileMesh::getMaxFamilyId() const throw(INTERP_KERNEL::Exception)
 {
   if(_families.empty())
-    throw INTERP_KERNEL::Exception("MEDFileUMesh::getMaxFamilyId : no families set !");
+    throw INTERP_KERNEL::Exception("MEDFileMesh::getMaxFamilyId : no families set !");
   int ret=-std::numeric_limits<int>::max();
   for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
     {
@@ -1090,7 +1184,7 @@ int MEDFileMesh::getMaxFamilyId() const throw(INTERP_KERNEL::Exception)
 int MEDFileMesh::getMinFamilyId() const throw(INTERP_KERNEL::Exception)
 {
   if(_families.empty())
-    throw INTERP_KERNEL::Exception("MEDFileUMesh::getMinFamilyId : no families set !");
+    throw INTERP_KERNEL::Exception("MEDFileMesh::getMinFamilyId : no families set !");
   int ret=std::numeric_limits<int>::max();
   for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
     {
@@ -1099,6 +1193,20 @@ int MEDFileMesh::getMinFamilyId() const throw(INTERP_KERNEL::Exception)
   return ret;
 }
 
+/*!
+ * Returns a maximal id of families in \a this mesh. Not only named families are
+ * considered but all family fields as well.
+ *  \return int - the maximal family id.
+ */
+int MEDFileMesh::getTheMaxAbsFamilyId() const throw(INTERP_KERNEL::Exception)
+{
+  int m1=-std::numeric_limits<int>::max();
+  for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+    m1=std::max(std::abs((*it).second),m1);
+  int m2=getMaxAbsFamilyIdInArrays();
+  return std::max(m1,m2);
+}
+
 /*!
  * Returns a maximal id of families in \a this mesh. Not only named families are
  * considered but all family fields as well.
@@ -1113,6 +1221,11 @@ int MEDFileMesh::getTheMaxFamilyId() const throw(INTERP_KERNEL::Exception)
   return std::max(m1,m2);
 }
 
+/*!
+ * Returns a minimal id of families in \a this mesh. Not only named families are
+ * considered but all family fields as well.
+ *  \return int - the minimal family id.
+ */
 int MEDFileMesh::getTheMinFamilyId() const throw(INTERP_KERNEL::Exception)
 {
   int m1=std::numeric_limits<int>::max();
@@ -1122,6 +1235,11 @@ int MEDFileMesh::getTheMinFamilyId() const throw(INTERP_KERNEL::Exception)
   return std::min(m1,m2);
 }
 
+/*!
+ * This method only considers the maps. The contain of family array is ignored here.
+ * 
+ * \sa MEDFileMesh::computeAllFamilyIdsInUse
+ */
 DataArrayInt *MEDFileMesh::getAllFamiliesIdsReferenced() const throw(INTERP_KERNEL::Exception)
 {
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
@@ -1133,6 +1251,27 @@ DataArrayInt *MEDFileMesh::getAllFamiliesIdsReferenced() const throw(INTERP_KERN
   return ret.retn();
 }
 
+/*!
+ * This method does not consider map of family name, family id. Only family field array on different levels is considered.
+ * 
+ * \sa MEDFileMesh::getAllFamiliesIdsReferenced
+ */
+DataArrayInt *MEDFileMesh::computeAllFamilyIdsInUse() const throw(INTERP_KERNEL::Exception)
+{
+  std::vector<int> famLevs=getFamArrNonEmptyLevelsExt();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret;
+  for(std::vector<int>::const_iterator it=famLevs.begin();it!=famLevs.end();it++)
+    {
+      const DataArrayInt *arr=getFamilyFieldAtLevel(*it);//arr not null due to spec of getFamArrNonEmptyLevelsExt
+      MEDCouplingAutoRefCountObjectPtr<DataArrayInt> dv=arr->getDifferentValues();
+      if((DataArrayInt *) ret)
+        ret=dv->buildUnion(ret);
+      else
+        ret=dv;
+    }
+  return ret.retn();
+}
+
 /*!
  * true is returned if no modification has been needed. false if family
  * renumbering has been needed.       
@@ -1321,7 +1460,7 @@ void MEDFileMesh::normalizeFamIdsMEDFile() throw(INTERP_KERNEL::Exception)
   refId=-1;
   for(std::set<int>::const_reverse_iterator it2=levsS.rbegin();it2!=levsS.rend();it2++)
     {
-      const DataArrayInt *fam=getFamilyFieldAtLevel(1);
+      const DataArrayInt *fam=getFamilyFieldAtLevel(*it2);
       if(fam)
         {
           MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp=fam->getDifferentValues();
@@ -1565,8 +1704,8 @@ void MEDFileMesh::setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector<con
     }
   int offset=1;
   if(!_families.empty())
-    offset=getMaxFamilyId()+1;
-  TranslateFamilyIds(offset,fam,fidsOfGroups);
+    offset=getMaxAbsFamilyId()+1;
+  TranslateFamilyIds(meshDimRelToMaxExt==1?offset:-offset,fam,fidsOfGroups);
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ids=fam->getDifferentValues();
   appendFamilyEntries(ids,fidsOfGroups,grpsName2);
   setFamilyFieldArr(meshDimRelToMaxExt,fam);
@@ -1599,9 +1738,13 @@ void MEDFileMesh::appendFamilyEntries(const DataArrayInt *famIds, const std::vec
 
 void MEDFileMesh::TranslateFamilyIds(int offset, DataArrayInt *famArr, std::vector< std::vector<int> >& famIdsPerGrp)
 {
-  famArr->applyLin(1,offset,0);
+  famArr->applyLin(offset>0?1:-1,offset,0);
   for(std::vector< std::vector<int> >::iterator it1=famIdsPerGrp.begin();it1!=famIdsPerGrp.end();it1++)
-    std::transform((*it1).begin(),(*it1).end(),(*it1).begin(),std::bind2nd(std::plus<int>(),offset));
+    {
+      if(offset<0)
+        std::transform((*it1).begin(),(*it1).end(),(*it1).begin(),std::negate<int>());
+      std::transform((*it1).begin(),(*it1).end(),(*it1).begin(),std::bind2nd(std::plus<int>(),offset));
+    }
 }
 
 /*!
@@ -1795,6 +1938,11 @@ MEDFileMesh *MEDFileUMesh::shallowCpy() const throw(INTERP_KERNEL::Exception)
   return ret.retn();
 }
 
+MEDFileMesh *MEDFileUMesh::createNewEmpty() const throw(INTERP_KERNEL::Exception)
+{
+  return new MEDFileUMesh;
+}
+
 MEDFileMesh *MEDFileUMesh::deepCpy() const throw(INTERP_KERNEL::Exception)
 {
   MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> ret=new MEDFileUMesh(*this);
@@ -2067,6 +2215,57 @@ std::vector<int> MEDFileUMesh::getNonEmptyLevelsExt() const
   return ret0;
 }
 
+std::vector<int> MEDFileUMesh::getFamArrNonEmptyLevelsExt() const
+{
+  std::vector<int> ret;
+  const DataArrayInt *famCoo(_fam_coords);
+  if(famCoo)
+    ret.push_back(1);
+  int lev=0;
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++,lev--)
+    {
+      const MEDFileUMeshSplitL1 *cur(*it);
+      if(cur)
+        if(cur->getFamilyField())
+          ret.push_back(lev);
+    }
+  return ret;
+}
+
+std::vector<int> MEDFileUMesh::getNumArrNonEmptyLevelsExt() const
+{
+  std::vector<int> ret;
+  const DataArrayInt *numCoo(_num_coords);
+  if(numCoo)
+    ret.push_back(1);
+  int lev=0;
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++,lev--)
+    {
+      const MEDFileUMeshSplitL1 *cur(*it);
+      if(cur)
+        if(cur->getNumberField())
+          ret.push_back(lev);
+    }
+  return ret;
+}
+
+std::vector<int> MEDFileUMesh::getNameArrNonEmptyLevelsExt() const
+{
+  std::vector<int> ret;
+  const DataArrayAsciiChar *nameCoo(_name_coords);
+  if(nameCoo)
+    ret.push_back(1);
+  int lev=0;
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++,lev--)
+    {
+      const MEDFileUMeshSplitL1 *cur(*it);
+      if(cur)
+        if(cur->getNameField())
+          ret.push_back(lev);
+    }
+  return ret;
+}
+
 /*!
  * Returns all relative mesh levels (**excluding nodes**) where a given group is defined.
  * To include nodes, call getGrpNonEmptyLevelsExt() method.
@@ -2195,6 +2394,29 @@ std::vector<std::string> MEDFileUMesh::getGroupsOnSpecifiedLev(int meshDimRelToM
   return ret;
 }
 
+int MEDFileUMesh::getMaxAbsFamilyIdInArrays() const throw(INTERP_KERNEL::Exception)
+{
+  int ret=-std::numeric_limits<int>::max(),tmp=-1;
+  if((const DataArrayInt *)_fam_coords)
+    {
+      int val=_fam_coords->getMaxValue(tmp);
+      ret=std::max(ret,std::abs(val));
+    }
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
+    {
+      if((const MEDFileUMeshSplitL1 *)(*it))
+        {
+          const DataArrayInt *da=(*it)->getFamilyField();
+          if(da)
+            {
+              int val=da->getMaxValue(tmp);
+              ret=std::max(ret,std::abs(val));
+            }
+        }
+    }
+  return ret;
+}
+
 int MEDFileUMesh::getMaxFamilyIdInArrays() const throw(INTERP_KERNEL::Exception)
 {
   int ret=-std::numeric_limits<int>::max(),tmp=-1;
@@ -3027,9 +3249,19 @@ void MEDFileUMesh::addNodeGroup(const DataArrayInt *ids) throw(INTERP_KERNEL::Ex
   if(!((DataArrayInt *)_fam_coords))
     { _fam_coords=DataArrayInt::New(); _fam_coords->alloc(nbOfNodes,1); _fam_coords->fillWithZero(); }
   //
-  addGroupUnderground(ids,_fam_coords);
+  addGroupUnderground(true,ids,_fam_coords);
 }
 
+/*!
+ * Adds a group of nodes/cells/faces/edges to \a this mesh.
+ *  \param [in] ids - a DataArrayInt providing ids and a name of the group to add.
+ *          The ids should be sorted and different each other (MED file norm).
+ *  \throw If the node coordinates array is not set.
+ *  \throw If \a ids == \c NULL.
+ *  \throw If \a ids->getName() == "".
+ *  \throw If \a ids does not respect the MED file norm.
+ *  \throw If a group with name \a ids->getName() already exists.
+ */
 void MEDFileUMesh::addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) throw(INTERP_KERNEL::Exception)
 {
   std::vector<int> levs=getNonEmptyLevelsExt();
@@ -3042,14 +3274,14 @@ void MEDFileUMesh::addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) thr
     { addNodeGroup(ids); return ; }
   MEDFileUMeshSplitL1 *lev=getMeshAtLevSafe(meshDimRelToMaxExt);
   DataArrayInt *fam=lev->getOrCreateAndGetFamilyField();
-  addGroupUnderground(ids,fam);
+  addGroupUnderground(false,ids,fam);
 }
 
 /*!
  * \param [in] ids ids and group name of the new group to add. The ids should be sorted and different each other (MED file norm).
  * \parma [in,out] famArr family array on level of interest to be renumbered. The input pointer should be not \c NULL (no check of that will be performed)
  */
-void MEDFileUMesh::addGroupUnderground(const DataArrayInt *ids, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception)
+void MEDFileUMesh::addGroupUnderground(bool isNodeGroup, const DataArrayInt *ids, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception)
 {
   if(!ids)
     throw INTERP_KERNEL::Exception("MEDFileUMesh::addGroup : NULL pointer in input !");
@@ -3070,7 +3302,7 @@ void MEDFileUMesh::addGroupUnderground(const DataArrayInt *ids, DataArrayInt *fa
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> diffFamIds=famIds->getDifferentValues();
   std::vector<int> familyIds;
   std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > idsPerfamiliyIds;
-  int maxVal=getTheMaxFamilyId()+1;
+  int maxVal=getTheMaxAbsFamilyId()+1;
   std::map<std::string,int> families(_families);
   std::map<std::string, std::vector<std::string> > groups(_groups);
   std::vector<std::string> fams;
@@ -3090,7 +3322,8 @@ void MEDFileUMesh::addGroupUnderground(const DataArrayInt *ids, DataArrayInt *fa
             { familyIds.push_back(*famId); idsPerfamiliyIds.push_back(ret0); fams.push_back(FindOrCreateAndGiveFamilyWithId(families,*famId,created)); } // adding *famId in grp
           else
             {
-              familyIds.push_back(maxVal); idsPerfamiliyIds.push_back(ids2); std::string locFamName=FindOrCreateAndGiveFamilyWithId(families,maxVal,created);
+              familyIds.push_back(isNodeGroup?maxVal:-maxVal); idsPerfamiliyIds.push_back(ids2);
+              std::string locFamName=FindOrCreateAndGiveFamilyWithId(families,isNodeGroup?maxVal:-maxVal,created);
               fams.push_back(locFamName);
               if(existsFamily(*famId))
                 {
@@ -3102,12 +3335,12 @@ void MEDFileUMesh::addGroupUnderground(const DataArrayInt *ids, DataArrayInt *fa
         }
       else
         {
-          familyIds.push_back(maxVal); idsPerfamiliyIds.push_back(ret0); // modifying all other groups on *famId to lie on maxVal and on maxVal+1
-          familyIds.push_back(maxVal+1); idsPerfamiliyIds.push_back(ids2);//grp lie only on maxVal+1
-          std::string n2(FindOrCreateAndGiveFamilyWithId(families,maxVal+1,created)); fams.push_back(n2);
+          familyIds.push_back(isNodeGroup?maxVal:-maxVal); idsPerfamiliyIds.push_back(ret0); // modifying all other groups on *famId to lie on maxVal and on maxVal+1
+          familyIds.push_back(isNodeGroup?maxVal+1:-maxVal-1); idsPerfamiliyIds.push_back(ids2);//grp lie only on maxVal+1
+          std::string n2(FindOrCreateAndGiveFamilyWithId(families,isNodeGroup?maxVal+1:-maxVal-1,created)); fams.push_back(n2);
           if(existsFamily(*famId))
             {
-              std::string n1(FindOrCreateAndGiveFamilyWithId(families,maxVal,created)); std::vector<std::string> v(2); v[0]=n1; v[1]=n2;
+              std::string n1(FindOrCreateAndGiveFamilyWithId(families,isNodeGroup?maxVal:-maxVal,created)); std::vector<std::string> v(2); v[0]=n1; v[1]=n2;
               ChangeAllGroupsContainingFamily(groups,getFamilyNameGivenId(*famId).c_str(),v);
             }
           maxVal+=2;
@@ -3371,6 +3604,13 @@ void MEDFileUMesh::setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumA
   return _ms[traducedRk]->setRenumArr(renumArr);
 }
 
+/*!
+ * Sets the optional names of mesh entities of a given dimension.
+ *  \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities.
+ *  \param [in] nameArr - the array of the names.
+ *  \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh.
+ *  \throw If \a nameArr has an invalid size.
+ */
 void MEDFileUMesh::setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr) throw(INTERP_KERNEL::Exception)
 {
   if(meshDimRelToMaxExt==1)
@@ -3382,14 +3622,14 @@ void MEDFileUMesh::setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiCha
         }
       DataArrayDouble *coo(_coords);
       if(!coo)
-        throw INTERP_KERNEL::Exception("MEDFileUMesh::setRenumFieldArr : the coordinates have not been set !");
-      nameArr->checkNbOfTuplesAndComp(coo->getNumberOfTuples(),MED_SNAME_SIZE,"MEDFileUMesh::setRenumArr : Problem in size of node numbering arr ! ");
+        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;
       return ;
     }
   if(meshDimRelToMaxExt>1)
-    throw INTERP_KERNEL::Exception("MEDFileUMesh::setRenumArr : Dimension request is invalid (>1) !");
+    throw INTERP_KERNEL::Exception("MEDFileUMesh::setNameFieldAtLevel : Dimension request is invalid (>1) !");
   int traducedRk=-meshDimRelToMaxExt;
   if(traducedRk>=(int)_ms.size())
     throw INTERP_KERNEL::Exception("Invalid mesh dim relative to max given ! To low !");
@@ -3470,6 +3710,22 @@ std::size_t MEDFileStructuredMesh::getHeapMemorySize() const
   return ret;
 }
 
+int MEDFileStructuredMesh::getMaxAbsFamilyIdInArrays() const throw(INTERP_KERNEL::Exception)
+{
+  int ret=-std::numeric_limits<int>::max(),tmp=-1;
+  if((const DataArrayInt *)_fam_nodes)
+    {
+      int val=_fam_nodes->getMaxValue(tmp);
+      ret=std::max(ret,std::abs(val));
+    }
+  if((const DataArrayInt *)_fam_cells)
+    {
+      int val=_fam_cells->getMaxValue(tmp);
+      ret=std::max(ret,std::abs(val));
+    }
+  return ret;
+}
+
 int MEDFileStructuredMesh::getMaxFamilyIdInArrays() const throw(INTERP_KERNEL::Exception)
 {
   int ret=-std::numeric_limits<int>::max(),tmp=-1;
@@ -3744,6 +4000,13 @@ void MEDFileStructuredMesh::setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIn
     renumArr->incrRef();
 }
 
+/*!
+ * Sets the optional names of mesh entities of a given dimension.
+ *  \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities.
+ *  \param [in] nameArr - the array of the names.
+ *  \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh.
+ *  \throw If \a nameArr has an invalid size.
+ */
 void MEDFileStructuredMesh::setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr) throw(INTERP_KERNEL::Exception)
 {
   if(meshDimRelToMaxExt!=0 && meshDimRelToMaxExt!=1)
@@ -3871,6 +4134,46 @@ std::vector<int> MEDFileStructuredMesh::getNonEmptyLevelsExt() const
   return ret;
 }
 
+/*!
+ * Returns the set of extensive levels (nodes included) where not NULL family arr are defined.
+ */
+std::vector<int> MEDFileStructuredMesh::getFamArrNonEmptyLevelsExt() const
+{
+  std::vector<int> ret;
+  const DataArrayInt *famNodes(_fam_nodes),*famCells(_fam_cells);
+  if(famNodes)
+    ret.push_back(1);
+  if(famCells)
+    ret.push_back(0);
+  return ret;
+}
+
+/*!
+ * Returns the set of extensive levels (nodes included) where not NULL numbering arr are defined.
+ */
+std::vector<int> MEDFileStructuredMesh::getNumArrNonEmptyLevelsExt() const
+{
+  std::vector<int> ret;
+  const DataArrayInt *numNodes(_num_nodes),*numCells(_num_cells);
+  if(numNodes)
+    ret.push_back(1);
+  if(numCells)
+    ret.push_back(0);
+  return ret;
+}
+
+/*!
+ * Returns the set of extensive levels (nodes included) where not NULL naming arr are defined.
+ */
+std::vector<int> MEDFileStructuredMesh::getNameArrNonEmptyLevelsExt() const
+{
+  std::vector<int> ret;
+  const DataArrayAsciiChar *namesCells(_names_cells);
+  if(namesCells)
+    ret.push_back(0);
+  return ret;
+}
+
 /*!
  * no implementation here, it is not a bug, but intresically no polyhedra in \a this.
  */
@@ -4180,6 +4483,11 @@ MEDFileMesh *MEDFileCMesh::shallowCpy() const throw(INTERP_KERNEL::Exception)
   return ret.retn();
 }
 
+MEDFileMesh *MEDFileCMesh::createNewEmpty() const throw(INTERP_KERNEL::Exception)
+{
+  return new MEDFileCMesh;
+}
+
 MEDFileMesh *MEDFileCMesh::deepCpy() const throw(INTERP_KERNEL::Exception)
 {
   MEDCouplingAutoRefCountObjectPtr<MEDFileCMesh> ret=new MEDFileCMesh(*this);
@@ -4385,6 +4693,11 @@ MEDFileMesh *MEDFileCurveLinearMesh::shallowCpy() const throw(INTERP_KERNEL::Exc
   return ret.retn();
 }
 
+MEDFileMesh *MEDFileCurveLinearMesh::createNewEmpty() const throw(INTERP_KERNEL::Exception)
+{
+  return new MEDFileCurveLinearMesh;
+}
+
 MEDFileMesh *MEDFileCurveLinearMesh::deepCpy() const throw(INTERP_KERNEL::Exception)
 {
   MEDCouplingAutoRefCountObjectPtr<MEDFileCurveLinearMesh> ret=new MEDFileCurveLinearMesh(*this);
index cb120779929b8a7aad8207ab559c3699dadccfce..05b7143bc558d1bce206234d2c7f13baafe330d3 100644 (file)
@@ -36,6 +36,7 @@ namespace ParaMEDMEM
     static MEDFileMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
     static MEDFileMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
     std::size_t getHeapMemorySize() const;
+    virtual MEDFileMesh *createNewEmpty() const throw(INTERP_KERNEL::Exception) = 0;
     virtual MEDFileMesh *deepCpy() const throw(INTERP_KERNEL::Exception) = 0;
     virtual MEDFileMesh *shallowCpy() const throw(INTERP_KERNEL::Exception) = 0;
     virtual bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const;
@@ -61,6 +62,9 @@ namespace ParaMEDMEM
     virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception) = 0;
     virtual std::vector<int> getNonEmptyLevels() const = 0;
     virtual std::vector<int> getNonEmptyLevelsExt() const = 0;
+    virtual std::vector<int> getFamArrNonEmptyLevelsExt() const = 0;
+    virtual std::vector<int> getNumArrNonEmptyLevelsExt() const = 0;
+    virtual std::vector<int> getNameArrNonEmptyLevelsExt() const = 0;
     virtual void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
     virtual void write(med_idt fid) const throw(INTERP_KERNEL::Exception);
     virtual int getSizeAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception) = 0;
@@ -93,20 +97,27 @@ namespace ParaMEDMEM
     std::vector<std::string> getGroupsNames() const;
     std::vector<std::string> getFamiliesNames() const;
     void assignFamilyNameWithGroupName() throw(INTERP_KERNEL::Exception);
+    std::vector<std::string> removeEmptyGroups() throw(INTERP_KERNEL::Exception);
     void removeGroup(const char *name) throw(INTERP_KERNEL::Exception);
     void removeFamily(const char *name) throw(INTERP_KERNEL::Exception);
+    std::vector<std::string> removeOrphanGroups() throw(INTERP_KERNEL::Exception);
+    std::vector<std::string> removeOrphanFamilies() throw(INTERP_KERNEL::Exception);
     void changeGroupName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
     void changeFamilyName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
     void changeFamilyId(int oldId, int newId) throw(INTERP_KERNEL::Exception);
     void changeAllGroupsContainingFamily(const char *familyNameToChange, const std::vector<std::string>& newFamiliesNames) throw(INTERP_KERNEL::Exception);
     int getFamilyId(const char *name) const throw(INTERP_KERNEL::Exception);
+    int getMaxAbsFamilyId() const throw(INTERP_KERNEL::Exception);
     int getMaxFamilyId() const throw(INTERP_KERNEL::Exception);
     int getMinFamilyId() const throw(INTERP_KERNEL::Exception);
+    int getTheMaxAbsFamilyId() const throw(INTERP_KERNEL::Exception);
     int getTheMaxFamilyId() const throw(INTERP_KERNEL::Exception);
     int getTheMinFamilyId() const throw(INTERP_KERNEL::Exception);
+    virtual int getMaxAbsFamilyIdInArrays() const throw(INTERP_KERNEL::Exception) = 0;
     virtual int getMaxFamilyIdInArrays() const throw(INTERP_KERNEL::Exception) = 0;
     virtual int getMinFamilyIdInArrays() const throw(INTERP_KERNEL::Exception) = 0;
     DataArrayInt *getAllFamiliesIdsReferenced() const throw(INTERP_KERNEL::Exception);
+    DataArrayInt *computeAllFamilyIdsInUse() const throw(INTERP_KERNEL::Exception);
     std::vector<int> getFamiliesIds(const std::vector<std::string>& famNames) const throw(INTERP_KERNEL::Exception);
     std::string getFamilyNameGivenId(int id) const throw(INTERP_KERNEL::Exception);
     bool ensureDifferentFamIdsPerLevel() throw(INTERP_KERNEL::Exception);
@@ -175,12 +186,14 @@ namespace ParaMEDMEM
     static MEDFileUMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
     static MEDFileUMesh *New();
     std::size_t getHeapMemorySize() const;
+    MEDFileMesh *createNewEmpty() const throw(INTERP_KERNEL::Exception);
     MEDFileMesh *deepCpy() const throw(INTERP_KERNEL::Exception);
     MEDFileMesh *shallowCpy() const throw(INTERP_KERNEL::Exception);
     bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const;
     void clearNonDiscrAttributes() const;
     ~MEDFileUMesh();
     //
+    int getMaxAbsFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
     int getMaxFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
     int getMinFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
     int getMeshDimension() const throw(INTERP_KERNEL::Exception);
@@ -195,6 +208,9 @@ namespace ParaMEDMEM
     int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
     std::vector<int> getNonEmptyLevels() const;
     std::vector<int> getNonEmptyLevelsExt() const;
+    std::vector<int> getFamArrNonEmptyLevelsExt() const;
+    std::vector<int> getNumArrNonEmptyLevelsExt() const;
+    std::vector<int> getNameArrNonEmptyLevelsExt() const;
     std::vector<int> getGrpNonEmptyLevels(const char *grp) const throw(INTERP_KERNEL::Exception);
     std::vector<int> getGrpNonEmptyLevelsExt(const char *grp) const throw(INTERP_KERNEL::Exception);
     std::vector<int> getFamNonEmptyLevels(const char *fam) const throw(INTERP_KERNEL::Exception);
@@ -247,7 +263,7 @@ namespace ParaMEDMEM
     void synchronizeTinyInfoOnLeaves() const;
     void changeFamilyIdArr(int oldId, int newId) throw(INTERP_KERNEL::Exception);
     std::list< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > getAllNonNullFamilyIds() const;
-    void addGroupUnderground(const DataArrayInt *ids, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception);
+    void addGroupUnderground(bool isNodeGroup, const DataArrayInt *ids, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception);
   private:
     std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> > _ms;
     MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> _coords;
@@ -262,6 +278,7 @@ namespace ParaMEDMEM
     friend class MEDFileMesh;
   public:
     std::size_t getHeapMemorySize() const;
+    int getMaxAbsFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
     int getMaxFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
     int getMinFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
     bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const;
@@ -276,6 +293,9 @@ namespace ParaMEDMEM
     const DataArrayAsciiChar *getNameFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
     std::vector<int> getNonEmptyLevels() const;
     std::vector<int> getNonEmptyLevelsExt() const;
+    std::vector<int> getFamArrNonEmptyLevelsExt() const;
+    std::vector<int> getNumArrNonEmptyLevelsExt() const;
+    std::vector<int> getNameArrNonEmptyLevelsExt() const;
     MEDCouplingMesh *getGenMeshAtLevel(int meshDimRelToMax, bool renum=false) const throw(INTERP_KERNEL::Exception);
     int getSizeAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
     int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
@@ -307,6 +327,7 @@ namespace ParaMEDMEM
     static MEDFileCMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
     static MEDFileCMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
     std::size_t getHeapMemorySize() const;
+    MEDFileMesh *createNewEmpty() const throw(INTERP_KERNEL::Exception);
     MEDFileMesh *deepCpy() const throw(INTERP_KERNEL::Exception);
     MEDFileMesh *shallowCpy() const throw(INTERP_KERNEL::Exception);
     bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const;
@@ -335,6 +356,7 @@ namespace ParaMEDMEM
     static MEDFileCurveLinearMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
     static MEDFileCurveLinearMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
     std::size_t getHeapMemorySize() const;
+    MEDFileMesh *createNewEmpty() const throw(INTERP_KERNEL::Exception);
     MEDFileMesh *deepCpy() const throw(INTERP_KERNEL::Exception);
     MEDFileMesh *shallowCpy() const throw(INTERP_KERNEL::Exception);
     bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const;
index aa87b2bf162a33b7792bd28b0b3da5aab9923882..7d529b4135c8c612bac166888c7598a5cb302e41 100644 (file)
@@ -38,16 +38,19 @@ med_access_mode MEDFileUtilities::TraduceWriteMode(int medloaderwritemode) throw
     }
 }
 
-int MEDFileUtilities::TraduceFieldType(med_field_type ft) throw(INTERP_KERNEL::Exception)
+const char *MEDFileUtilities::GetReadableMEDFieldType(med_field_type ft) throw(INTERP_KERNEL::Exception)
 {
+  static const char medFloat64[]="MED_FLOAT64";
+  static const char medInt32[]="MED_INT32";
+  static const char medInt64[]="MED_INT64";
   switch(ft)
     {
     case MED_FLOAT64:
-      return 0;
+      return medFloat64;
     case MED_INT32:
-      return 1;
+      return medInt32;
     case MED_INT64:
-      return 2;
+      return medInt64;
     default:
       throw INTERP_KERNEL::Exception("Non supported field type ! Should be FLOAT64, INT32 or INT64 !");
     }
index e2465dbe68f0058a4ee6f5105ee42b17f6130174..6d2c05eb2c72c178158174df28adbcb4abfaaaa0 100644 (file)
@@ -29,7 +29,7 @@
 namespace MEDFileUtilities
 {
   med_access_mode TraduceWriteMode(int medloaderwritemode) throw(INTERP_KERNEL::Exception);
-  int TraduceFieldType(med_field_type ft) throw(INTERP_KERNEL::Exception);
+  const char *GetReadableMEDFieldType(med_field_type ft) throw(INTERP_KERNEL::Exception);
   void CheckMEDCode(int code, med_idt fid, const char *msg) throw(INTERP_KERNEL::Exception);
   void CheckFileForRead(const char *fileName) throw(INTERP_KERNEL::Exception);
 
index 88d17854d50b701112c1bf957f5d4de1b3df536e..13f44b92f7c405b79184e7a70a5da5e6ef80ecdc 100644 (file)
@@ -244,7 +244,10 @@ void SauvWriter::setMEDFileDS(const MEDFileData* medData,
   if ( fields )
     for ( int i = 0; i < fields->getNumberOfFields(); ++i )
       {
-        MEDFileFieldMultiTS * f = fields->getFieldAtPos(i);
+        MEDFileAnyTypeFieldMultiTS * fB = fields->getFieldAtPos(i);
+        MEDFileFieldMultiTS * f = dynamic_cast<MEDFileFieldMultiTS *>(fB);
+        if(!f)
+          continue;// fields on int32 not managed
         if ( f->getMeshName() == _fileMesh->getName() )
           {
             vector< vector<TypeOfField> > fTypes = f->getTypesOfFieldAvailable();
index 91ba8b348ba4f476b525c4363fbcfb25bfd81870..b6b8b08899240d71c4775e451b18cb723049d800 100644 (file)
@@ -66,11 +66,15 @@ INSTALL(FILES MEDLoader.i MEDLoaderTypemaps.i MEDLoaderCommon.i DESTINATION ${ME
 SET(PYFILES_TO_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/MEDLoader.py ${CMAKE_CURRENT_SOURCE_DIR}/libMEDLoader_Swig.py)
 INSTALL_AND_COMPILE_PYTHON_FILE("${PYFILES_TO_INSTALL}" ${MED_salomescript_PYTHON})
 
-INSTALL(FILES MEDLoaderDataForTest.py MEDLoaderTest.py MEDLoaderTest2.py MEDLoaderTest3.py medutilities.py DESTINATION ${MED_salomescript_PYTHON})
-INSTALL(FILES med2sauv sauv2med PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ DESTINATION ${MED_salomescript_PYTHON} )
+INSTALL(FILES MEDLoaderDataForTest.py MEDLoaderTest.py MEDLoaderTest2.py MEDLoaderTest3.py MEDLoaderCouplingTrainingSession.py CaseIO.py CaseReader.py CaseWriter.py MEDLoaderSplitter.py medutilities.py DESTINATION ${MED_salomescript_PYTHON})
+INSTALL(FILES med2sauv PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ DESTINATION ${MED_salomescript_PYTHON} )
+INSTALL(FILES sauv2med PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ DESTINATION ${MED_salomescript_PYTHON} )
+INSTALL(FILES case2med PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ DESTINATION ${MED_salomescript_PYTHON} )
+INSTALL(FILES med2case PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ DESTINATION ${MED_salomescript_PYTHON} )
 
 ADD_TEST(MEDLoaderTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDLoaderTest.py)
 ADD_TEST(MEDLoaderTest2 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDLoaderTest2.py)
 ADD_TEST(MEDLoaderTest3 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDLoaderTest3.py)
 ADD_TEST(MEDLoaderExamplesTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDLoaderExamplesTest.py)
 ADD_TEST(SauvLoaderTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/SauvLoaderTest.py)
+ADD_TEST(MEDLoaderCouplingTrainingSession ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDLoaderCouplingTrainingSession.py)
diff --git a/src/MEDLoader/Swig/CaseIO.py b/src/MEDLoader/Swig/CaseIO.py
new file mode 100644 (file)
index 0000000..d472c3e
--- /dev/null
@@ -0,0 +1,31 @@
+#  -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2013  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.
+#
+# 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 (CEA/DEN/DM2S/STMF/LGLS)
+
+from MEDLoader import *
+
+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())
+    pass
diff --git a/src/MEDLoader/Swig/CaseReader.py b/src/MEDLoader/Swig/CaseReader.py
new file mode 100644 (file)
index 0000000..87d2fbc
--- /dev/null
@@ -0,0 +1,268 @@
+#  -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2013  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.
+#
+# 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 (CEA/DEN/DM2S/STMF/LGLS)
+
+import numpy as np
+from MEDLoader import *
+from CaseIO import CaseIO
+import sys,re
+
+class CaseReader(CaseIO):
+    """ Converting a file in the Case format (Ensight) to the MED format.
+    A new file with the same base name and the .med extension is created.
+    """
+
+    @classmethod
+    def New(cls,fileName):
+        """ Static constructor. """
+        return CaseReader(fileName)
+        pass
+
+    def __init__(self,fileName):
+        """ Constructor """
+        self._fileName=fileName
+        self._dirName=os.path.dirname(self._fileName)
+        pass
+
+    def __traduceMesh(self,name,typ,coords,cells):
+        """ Convert a CASE mesh into a MEDCouplingUMesh. """
+        nbCoords=len(coords)
+        coo=np.array(coords,dtype="float64") ; coo=coo.reshape(nbCoords,3)
+        coo=DataArrayDouble(coo) ; coo=coo.fromNoInterlace()
+        ct=self.dictMCTyp2[typ]
+        m=MEDCouplingUMesh(name,MEDCouplingUMesh.GetDimensionOfGeometricType(ct))
+        m.setCoords(coo)
+        nbNodesPerCell=MEDCouplingMesh.GetNumberOfNodesOfGeometricType(ct)
+        cI=DataArrayInt(len(cells)+1) ; cI.iota() ; cI*=nbNodesPerCell+1
+        #
+        cells2=cells.reshape(len(cells),nbNodesPerCell)
+        c2=DataArrayInt(cells2)
+        c=DataArrayInt(len(cells),nbNodesPerCell+1) ; c[:,0]=ct ; c[:,1:]=c2-1 ; c.rearrange(1)
+        m.setConnectivity(c,cI,True)
+        m.checkCoherency2()
+        return m
+
+    def __traduceMeshForPolyhed(self,name,coords,arr0,arr1,arr2):
+        nbCoords=len(coords)
+        coo=np.array(coords,dtype="float64") ; coo=coo.reshape(nbCoords,3)
+        coo=DataArrayDouble(coo) ; coo=coo.fromNoInterlace()
+        m=MEDCouplingUMesh(name,3)
+        m.setCoords(coo)
+        #
+        arr2=arr2[:]-1
+        arr0mc0=DataArrayInt(arr0) ; arr0mc0.computeOffsets2()
+        arr0mc1=DataArrayInt(arr0).deepCpy()
+        arr0mc2=DataArrayInt(len(arr0),2) ; arr0mc2[:,0]=DataArrayInt(arr0)-1 ; arr0mc2[:,1]=1 ; arr0mc2.rearrange(1) ; arr0mc2.computeOffsets2()
+        arr0mc3=DataArrayInt.Range(0,2*len(arr0),2).buildExplicitArrByRanges(arr0mc2)
+        arr1mc0=DataArrayInt(arr1) ; arr1mc0.computeOffsets2()
+        arr1mc1=arr1mc0[arr0mc0] ; arr1mc1[1:]+=arr0mc0[1:] 
+        arr1mc2=DataArrayInt(arr1).deepCpy() ; arr1mc2+=1 ; arr1mc2.computeOffsets2()
+        arr2mc0=(arr1mc2[1:])[arr0mc3]
+        #
+        c=DataArrayInt(arr1.size+arr2.size)
+        c[arr1mc1[:-1]]=NORM_POLYHED
+        c[arr2mc0]=-1
+        a=arr2mc0.buildUnion(arr1mc1[:-1]).buildComplement(len(c))
+        c[a]=DataArrayInt(arr2)
+        #
+        m.setConnectivity(c,arr1mc1,True)
+        m.checkCoherency2()
+        return m
+
+    def __traduceMeshForPolygon(self,name,coords,arr0,arr1):
+        nbCoords=len(coords)
+        coo=np.array(coords,dtype="float64") ; coo=coo.reshape(nbCoords,3)
+        coo=DataArrayDouble(coo) ; coo=coo.fromNoInterlace()
+        m=MEDCouplingUMesh(name,2)
+        m.setCoords(coo)
+        #
+        arr0_0=DataArrayInt(arr0+1) ; arr0_0.computeOffsets2()
+        arr0_1=DataArrayInt(len(arr0),2) ; arr0_1[:,1]=DataArrayInt(arr0) ; arr0_1[:,0]=1 ; arr0_1.rearrange(1) ; arr0_1.computeOffsets2()
+        arr0_2=DataArrayInt.Range(1,2*len(arr0),2).buildExplicitArrByRanges(arr0_1)
+        c=DataArrayInt(len(arr0)+len(arr1)) ; c[:]=0 ; c[arr0_0[:-1]]=NORM_POLYGON
+        c[arr0_2]=DataArrayInt(arr1-1)
+        #
+        m.setConnectivity(c,arr0_0,True)
+        m.checkCoherency2()
+        return m
+
+    def __convertGeo2MED(self,geoFileName):
+        """ Convert all the geometry (all the meshes) contained in teh CASE file into MEDCouplingUMesh'es. """
+        fd=open(os.path.join(self._dirName,geoFileName),"r+b") ; fd.seek(0,2) ; end=fd.tell() ; fd.seek(0) ; fd.readline() ; fd.readline()
+        name=fd.readline().strip() ; fd.readline() ; fd.readline()
+        pos=fd.tell()
+        mcmeshes=[]
+        elt=fd.read(80) ; elt=elt.strip() ; pos+=80
+        while pos!=end:
+            if elt!="part":
+                raise Exception("Error on reading mesh #1 !")
+            fd.seek(fd.tell()+4)
+            meshName=fd.read(80).strip()
+            if fd.read(len("coordinates"))!="coordinates":
+                raise Exception("Error on reading mesh #2 !")
+            pos=fd.tell()
+            typeOfCoo=np.memmap(fd,dtype='byte',mode='r',offset=int(pos),shape=(1)).tolist()[0]
+            pos+=1+17*4
+            nbNodes=np.memmap(fd,dtype='int32',mode='r',offset=int(pos),shape=(1,)).tolist()[0]
+            pos+=4
+            coo=np.memmap(fd,dtype='float32',mode='r',offset=int(pos),shape=(nbNodes,3))
+            pos+=nbNodes*3*4 ; fd.seek(pos)#np.array(0,dtype='float%i'%(typeOfCoo)).nbytes
+            typ=fd.read(80).strip() ; pos=fd.tell()
+            mcmeshes2=[]
+            while pos!=end and typ!="part":
+                mctyp=self.dictMCTyp2[typ]
+                nbCellsOfType=np.memmap(fd,dtype='int32',mode='r',offset=int(pos),shape=(1,)).tolist()[0]
+                pos+=4
+                if mctyp!=NORM_POLYHED and mctyp!=NORM_POLYGON:
+                    nbNodesPerCell=MEDCouplingMesh.GetNumberOfNodesOfGeometricType(mctyp)
+                    cells=np.memmap(fd,dtype='int32',mode='r',offset=pos,shape=(nbCellsOfType,nbNodesPerCell))
+                    pos+=nbCellsOfType*nbNodesPerCell*4
+                    fd.seek(pos)
+                    mcmeshes2.append(self.__traduceMesh(meshName,typ,coo,cells))
+                elif mctyp==NORM_POLYHED:
+                    nbOfFacesPerCell=np.memmap(fd,dtype='int32',mode='r',offset=int(pos),shape=(nbCellsOfType,))
+                    pos+=nbCellsOfType*4
+                    szOfNbOfNodesPerFacePerCellArr=int(nbOfFacesPerCell.sum())
+                    arr1=np.memmap(fd,dtype='int32',mode='r',offset=int(pos),shape=(szOfNbOfNodesPerFacePerCellArr,))#arr1 -> nbOfNodesPerFacePerCellArr
+                    pos+=szOfNbOfNodesPerFacePerCellArr*4
+                    szOfNodesPerFacePerCellArr=arr1.sum()
+                    arr2=np.memmap(fd,dtype='int32',mode='r',offset=int(pos),shape=(szOfNodesPerFacePerCellArr,))#arr2 -> nodesPerFacePerCellArr
+                    pos+=szOfNodesPerFacePerCellArr*4 ; fd.seek(pos)
+                    mcmeshes2.append(self.__traduceMeshForPolyhed(meshName,coo,nbOfFacesPerCell,arr1,arr2))
+                    pass
+                else:
+                    nbOfNodesPerCell=np.memmap(fd,dtype='int32',mode='r',offset=int(pos),shape=(nbCellsOfType,))
+                    pos+=nbCellsOfType*4
+                    szOfNbOfNodesPerCellArr=int(nbOfNodesPerCell.sum())
+                    arr1=np.memmap(fd,dtype='int32',mode='r',offset=int(pos),shape=(szOfNbOfNodesPerCellArr,))
+                    pos+=szOfNbOfNodesPerCellArr*4  ; fd.seek(pos)
+                    mcmeshes2.append(self.__traduceMeshForPolygon(meshName,coo,nbOfNodesPerCell,arr1))
+                if pos!=end:
+                    elt=fd.read(80) ; elt=elt.strip() ; typ=elt[:] ; pos+=80
+                    pass
+                pass
+            coo=mcmeshes2[0].getCoords() ; name=mcmeshes2[0].getName()
+            for itmesh in mcmeshes2: itmesh.setCoords(coo)
+            m=MEDCouplingUMesh.MergeUMeshesOnSameCoords(mcmeshes2) ; m.setName(name)
+            mcmeshes.append(m)
+            pass
+        #
+        ms=MEDFileMeshes()
+        ms.resize(len(mcmeshes))
+        for i,m in enumerate(mcmeshes):
+            mlm=MEDFileUMesh()
+            mlm.setMeshAtLevel(0,m)
+            ms.setMeshAtPos(i,mlm)
+            pass
+        return mcmeshes,ms
+    
+    def __convertField(self,mlfields, mcmeshes, fileName, fieldName, discr, nbCompo, locId, it):
+        """ Convert the fields. """
+        stars=re.search("[\*]+",fileName).group()
+        st="%0"+str(len(stars))+"i"
+        trueFileName=fileName.replace(stars,st%(it))
+        fd=open(os.path.join(self._dirName,trueFileName),"r+b") ; fd.seek(0,2) ; end=fd.tell() ; fd.seek(0)
+        name=fd.readline().strip().split(" ")[0]
+        if name!=fieldName:
+            raise Exception("ConvertField : mismatch")
+        pos=fd.tell()
+        st=fd.read(80) ; st=st.strip() ; pos=fd.tell()
+        while pos!=end:
+            if st!="part":
+                raise Exception("ConvertField : mismatch #2")
+            fdisc=MEDCouplingFieldDiscretization.New(self.discSpatial2[discr])
+            meshId=np.memmap(fd,dtype='int32',mode='r',offset=int(pos),shape=(1)).tolist()[0]-1
+            nbOfValues=fdisc.getNumberOfTuples(mcmeshes[meshId])
+            vals2=DataArrayDouble(nbOfValues,nbCompo)
+            fd.seek(pos+4)
+            st=fd.read(80).strip() ; pos=fd.tell()
+            offset=0
+            while pos!=end and st!="part":
+                if st!="coordinates":
+                    nbOfValsOfTyp=mcmeshes[meshId].getNumberOfCellsWithType(self.dictMCTyp2[st])
+                else:
+                    nbOfValsOfTyp=nbOfValues
+                    pass
+                vals=np.memmap(fd,dtype='float32',mode='r',offset=int(pos),shape=(nbOfValsOfTyp,nbCompo))#np.memmap(fd,dtype='int32',mode='r',offset=159,shape=(1))
+                vals2[offset:offset+nbOfValsOfTyp]=DataArrayDouble(np.array(vals,dtype='float64')).fromNoInterlace()
+                pos+=nbOfValsOfTyp*nbCompo*4 ; fd.seek(pos)
+                st=fd.read(80) ; st=st.strip() ; pos=fd.tell()
+                offset+=nbOfValsOfTyp
+                pass
+            f=MEDCouplingFieldDouble(self.discSpatial2[discr],ONE_TIME) ; f.setName("%s_%s"%(fieldName,mcmeshes[meshId].getName()))
+            f.setMesh(mcmeshes[meshId]) ; f.setArray(vals2) ; f.setTime(float(it),it,-1)
+            f.checkCoherency()
+            mlfields[locId+meshId].appendFieldNoProfileSBT(f)
+            pass
+        pass
+    
+    def loadInMEDFileDS(self):
+        """ Load a CASE file into a MEDFileData object. """
+        f=file(self._fileName)
+        lines=f.readlines()
+        ind=lines.index("GEOMETRY\n")
+        if ind==-1:
+            raise Exception("Error with file %s"%(fname))
+        geoName=re.match("model:([\W]*)([\w\.]+)",lines[ind+1]).group(2)
+        m1,m2=self.__convertGeo2MED(geoName)
+        ind=lines.index("VARIABLE\n")
+        fieldsInfo=[]
+        for i in xrange(ind+1,lines.index("TIME\n")):
+            m=re.match("^([\w]+)[\s]+\per[\s]+([\w]+)[\s]*\:[\s]*([\w]+)[\s]+([\S]+)$",lines[i])
+            if m:
+                spatialDisc=m.groups()[1] ; fieldName=m.groups()[2] ; nbOfCompo=self.dictCompo2[m.groups()[0]] ; fieldFileName=m.groups()[3]
+                fieldsInfo.append((fieldName,spatialDisc,nbOfCompo,fieldFileName))
+                pass
+            pass
+        
+        expr=re.compile("number[\s]+of[\s]+steps[\s]*\:[\s]*([\d]+)")
+        nbOfTimeSteps=int(expr.search(filter(expr.search,lines)[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))
+        
+        expr=re.compile("filename[\s]+increment[\s]*\:[\s]*([\d]+)")
+        incrIt=int(expr.search(filter(expr.search,lines)[0]).group(1))
+        
+        curIt=startIt
+        mlfields=MEDFileFields()
+        mlfields.resize(len(fieldsInfo)*len(m1))
+        i=0
+        for field in fieldsInfo:
+            for m in m1:
+                mlfields.setFieldAtPos(i,MEDFileFieldMultiTS())
+                i+=1
+                pass
+            pass
+        for ts in xrange(nbOfTimeSteps):
+            i=0
+            for field in fieldsInfo:
+                self.__convertField(mlfields,m1,field[3],field[0],field[1],field[2],i,curIt)
+                i+=len(m1)
+                pass
+            curIt+=incrIt
+            pass
+        ret=MEDFileData()
+        ret.setMeshes(m2)
+        del mlfields[filter(lambda x: len(mlfields[x])==0,range(len(mlfields)))]
+        ret.setFields(mlfields)
+        return ret
+
+    pass
diff --git a/src/MEDLoader/Swig/CaseWriter.py b/src/MEDLoader/Swig/CaseWriter.py
new file mode 100644 (file)
index 0000000..d6ea392
--- /dev/null
@@ -0,0 +1,349 @@
+#  -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2013  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.
+#
+# 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 (CEA/DEN/DM2S/STMF/LGLS)
+
+import numpy as np
+from CaseIO import CaseIO
+from MEDLoader import *
+import sys,re,os,mmap
+
+### www-vis.lbl.gov/NERSC/Software/ensight/doc/OnlineHelp/UM-C11.pdf
+
+class CaseWriter(CaseIO):
+    """ Converting MED file format in memory to a the Case file format (Ensight).
+    A new file with the same base name and the .case extension is created with its depencies (.geo ...).
+    """
+    
+    header="""FORMAT
+type: ensight gold
+GEOMETRY
+model: %(geofilewithoutpath)s
+"""
+    header_varpart="""VARIABLE"""
+    header_timepart="""TIME
+time set:               1
+number of steps:        %(NbTimeSteps)i
+filename start number:  0
+filename increment:     1
+time values:
+%(TimeValues)s
+"""
+    
+    @classmethod
+    def New(cls):
+        """ Static constructor. """
+        return CaseWriter()
+        pass
+
+    def __init__(self):
+        """ Constructor """
+        self.__export_groups=False
+        pass
+
+    def setMEDFileDS(self,medData):
+        """ Input should be MEDFileData instance  """
+        self._med_data=medData
+        pass
+
+    def isExportingGroups(self):
+        """ return the status of exporting groups policy """
+        return self.__export_groups
+
+    def setExportingGroups(self,status):
+        assert(isinstance(status,bool))
+        self.__export_groups=status
+        pass
+        
+
+    def write(self,fileName):
+        """ Write into the specified fileName series the result """
+        self._file_name=fileName
+        self._base_name_without_dir=os.path.splitext(os.path.basename(self._file_name))[0]
+        self._l=self._file_name.split(os.path.sep) ; self._l[-1]=os.path.splitext(self._l[-1])[0]
+        self._base_name_with_dir=os.path.sep.join(self._l)
+        self._real_written_file_name=[]
+        self._dico={}
+        for mesh in self._med_data.getMeshes():
+            additionnalFileNamePart=""
+            if len(self._med_data.getMeshes())!=1:
+                additionnalFileNamePart="_%s"%(mesh.getName())
+                pass
+            self._dico["geofilewithoutpath"]="%s%s.geo"%(self._base_name_without_dir,additionnalFileNamePart)
+            h0=self.header%self._dico
+            self.__writeMeshesPart(mesh,"%s%s.geo"%(self._base_name_with_dir,additionnalFileNamePart))
+            #
+            h2=self.__writeFieldsPart(self._med_data.getFields().partOfThisLyingOnSpecifiedMeshName(mesh.getName()))
+            realWrittenCaseFileNameForCurMesh="%s%s.case"%(self._base_name_with_dir,additionnalFileNamePart)
+            fheader=open(realWrittenCaseFileNameForCurMesh,"w") ; fheader.write((h0+h2)%self._dico)
+            self._real_written_file_name.append(realWrittenCaseFileNameForCurMesh)
+            pass
+        return self._real_written_file_name
+    
+    def __writeMeshesPart(self,mdm,meshfn):
+        try:
+            os.remove(meshfn)
+        except:
+            pass
+        f=open(meshfn,"w+b")
+        sz=5*80
+        #
+        assert(isinstance(mdm,MEDFileUMesh))
+        ms2=[[mdm.getMeshAtLevel(lev) for lev in mdm.getNonEmptyLevels()[:1]]]
+        if self.__export_groups:
+            for grpnm in mdm.getGroupsNames():    
+                ms3=[]
+                for lev in mdm.getGrpNonEmptyLevels(grpnm)[:1]:
+                    m=mdm.getGroup(lev,grpnm) ; m.zipCoords()
+                    ms3.append(m)
+                    pass
+                ms2.append(ms3)
+                pass
+            pass
+        for ms in ms2:
+            nn=ms[0].getNumberOfNodes()
+            sz+=self.__computeSizeOfGeoFile(ms,nn)
+            pass
+        pass
+        a=np.memmap(f,dtype='byte',mode='w+',offset=0,shape=(sz,)) ; a.flush() # truncate to set the size of the file
+        mm=mmap.mmap(f.fileno(),offset=0,length=0)
+        mm.write(self.__str80("C Binary"))
+        mm.write(self.__str80("Exported from MEDCoupling/MEDLoader SALOME version %s"%(MEDCouplingVersionStr())))
+        mm.write(self.__str80("Conversion using CaseWriter class"))
+        mm.write(self.__str80("node id off"))
+        mm.write(self.__str80("element id off"))
+        for iii,ms in enumerate(ms2):
+            nn=ms[0].getNumberOfNodes()
+            mm.write(self.__str80("part"))
+            a=np.memmap(f,dtype='int32',mode='w+',offset=mm.tell(),shape=(1,))
+            a[0]=iii+1 ; a.flush() ; mm.seek(mm.tell()+4) # part number maybe to change ?
+            name=ms[0].getName()
+            if iii>0:
+                name="%s_%s"%(ms2[0][0].getName(),name)
+                pass
+            mm.write(self.__str80(name))
+            mm.write(self.__str80("coordinates"))
+            a=np.memmap(f,dtype='int32',mode='w+',offset=mm.tell(),shape=(1,))
+            a[0]=nn ; a.flush() # number of nodes
+            mm.seek(mm.tell()+4)
+            coo=ms[0].getCoords()
+            spaceDim=coo.getNumberOfComponents()
+            if spaceDim!=3:
+                coo=coo.changeNbOfComponents(3,0.)
+                pass
+            a=np.memmap(f,dtype='float32',mode='w+',offset=mm.tell(),shape=(3,nn))
+            c=coo.toNoInterlace() ; c.rearrange(1) ; cnp=c.toNumPyArray() ; cnp=cnp.reshape(3,nn)
+            a[:]=cnp ; a.flush() ; mm.seek(mm.tell()+3*nn*4)
+            for m in ms:
+                i=0
+                for typ2,nbelem,dummy in m.getDistributionOfTypes():
+                    typ=typ2
+                    if typ not in self.dictMCTyp:
+                        typ=MEDCouplingMesh.GetCorrespondingPolyType(typ)
+                        pass
+                    mp=m[i:i+nbelem]
+                    mm.write(self.__str80(self.dictMCTyp[typ]))
+                    a=np.memmap(f,dtype='int32',mode='w+',offset=mm.tell(),shape=(1,))
+                    a[0]=nbelem ; a.flush() ; mm.seek(mm.tell()+4)
+                    if typ!=NORM_POLYHED and typ!=NORM_POLYGON:
+                        nbNodesPerElem=MEDCouplingMesh.GetNumberOfNodesOfGeometricType(typ)
+                        c=mp.getNodalConnectivity() ; c.rearrange(nbNodesPerElem+1) ; c=c[:,1:] ; c.rearrange(1) ; c+=1
+                        a=np.memmap(f,dtype='int32',mode='w+',offset=mm.tell(),shape=(nbNodesPerElem*nbelem,))
+                        a[:]=c.toNumPyArray() ; a.flush() ; mm.seek(mm.tell()+nbNodesPerElem*nbelem*4)
+                        pass
+                    elif typ==NORM_POLYHED:
+                        mp.orientCorrectlyPolyhedrons()
+                        c=mp.computeNbOfFacesPerCell()
+                        a=np.memmap(f,dtype='int32',mode='w+',offset=mm.tell(),shape=(nbelem,))
+                        a[:]=c.toNumPyArray(); a.flush() ; mm.seek(mm.tell()+nbelem*4)
+                        c=mp.getNodalConnectivity()[:] ; c.pushBackSilent(-1) ; c[mp.getNodalConnectivityIndex()[:-1]]=-1 ; ids=c.getIdsEqual(-1) ; nbOfNodesPerFace=ids.deltaShiftIndex()-1
+                        a=np.memmap(f,dtype='int32',mode='w+',offset=mm.tell(),shape=(len(nbOfNodesPerFace),))
+                        a[:]=nbOfNodesPerFace.toNumPyArray() ; a.flush() ; mm.seek(mm.tell()+len(nbOfNodesPerFace)*4)
+                        ids2=ids.buildComplement(ids.back()+1)
+                        c2=mp.getNodalConnectivity()[ids2]+1
+                        a=np.memmap(f,dtype='int32',mode='w+',offset=mm.tell(),shape=(len(c2),))
+                        a[:]=c2.toNumPyArray() ; a.flush() ; mm.seek(mm.tell()+len(c2)*4)
+                        pass
+                    else:
+                        nbOfNodesPerCell=mp.getNodalConnectivityIndex().deltaShiftIndex()-1
+                        a=np.memmap(f,dtype='int32',mode='w+',offset=mm.tell(),shape=(len(nbOfNodesPerCell),))
+                        a[:]=nbOfNodesPerCell.toNumPyArray() ; a.flush() ; mm.seek(mm.tell()+len(nbOfNodesPerCell)*4)
+                        ids2=mp.getNodalConnectivityIndex().buildComplement(mp.getNodalConnectivityIndex().back()+1)
+                        c2=mp.getNodalConnectivity()[ids2]+1
+                        a=np.memmap(f,dtype='int32',mode='w+',offset=mm.tell(),shape=(len(c2),))
+                        a[:]=c2.toNumPyArray() ; a.flush() ; mm.seek(mm.tell()+len(c2)*4)
+                        pass
+                    i+=nbelem
+                    pass
+                pass
+            pass
+        pass
+    
+    def __writeFieldsPart(self,mdfs):
+        if not mdfs:
+            return ""
+        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))
+            pass
+        TimeValues=""
+        for it in its:
+            TimeValues+="%s\n"%(str(mdfs[0][it].getTime()[-1]))
+            pass
+        dictVars={}
+        for mdf in mdfs:
+            nbCompo=mdf.getNumberOfComponents()
+            if nbCompo not in self.dictCompo:
+                l=filter(lambda x:x-nbCompo>0,self.dictCompo.keys())
+                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()))
+                    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()))
+                nbCompo=l[0]
+                pass
+            if nbCompo in dictVars:
+                dictVars[nbCompo].append(mdf)
+                pass
+            else:
+                dictVars[nbCompo]=[mdf]
+                pass
+            pass
+        for mdf in mdfs:
+            nbCompo=mdf.getNumberOfComponents()
+            if nbCompo not in self.dictCompo:
+                l=filter(lambda x:x-nbCompo>0,self.dictCompo.keys())
+                if len(l)==0:
+                    continue;
+                nbCompo=l[0]
+                pass
+            for iii,it in enumerate(its):
+                ff=mdf[it]
+                isMultiDisc=len(ff.getTypesOfFieldAvailable())>1
+                for typ in ff.getTypesOfFieldAvailable():
+                    l=self._l[:] ; l[-1]="%s%s.%s"%(self._base_name_without_dir,str(iii).rjust(4,"0"),ff.getName())
+                    if isMultiDisc:
+                        l[-1]="%s_%s"(l[-1],MEDCouplingFieldDiscretization.New(typ).getStringRepr())
+                        pass
+                    fffn=l[-1]
+                    try:
+                        os.remove(os.path.sep.join(l))
+                    except:
+                        pass
+                    f=open(os.path.sep.join(l),"w+b")
+                    summ=0
+                    for geo,[(curTyp,(bg,end),pfl,loc)] in ff.getFieldSplitedByType():
+                        if typ==curTyp:
+                            summ+=4*nbCompo*(end-bg)+80
+                            pass
+                        pass
+                    a=np.memmap(f,dtype='byte',mode='w+',offset=0,shape=(2*80+4+summ,)) ; a.flush() # truncate to set the size of the file
+                    mm=mmap.mmap(f.fileno(),offset=0,length=0)
+                    k1=ff.getName()
+                    if isMultiDisc:
+                        k1="%s_%s"%(k1,MEDCouplingFieldDiscretization.New(typ).getStringRepr())
+                        pass
+                    mm.write(self.__str80(k1))
+                    mm.write(self.__str80("part"))
+                    a=np.memmap(f,dtype='int32',mode='w+',offset=mm.tell(),shape=(1,))
+                    a[0]=1 ; a.flush() ; mm.seek(mm.tell()+4) # part number maybe to change ?
+                    for geo,[(curTyp,(bg,end),pfl,loc)] in ff.getFieldSplitedByType():
+                        if pfl!="":
+                            raise Exception("Field \"%s\" contains profiles ! Profiles are not supported yet !"%(mdf.getName()))
+                        if typ==curTyp:
+                            arr=ff.getUndergroundDataArray()[bg:end].changeNbOfComponents(nbCompo,0.) ; arr=arr.toNoInterlace()
+                            if typ==ON_CELLS:
+                                mm.write(self.__str80(self.dictMCTyp[geo]))
+                                pass
+                            elif typ==ON_NODES:
+                                mm.write(self.__str80("coordinates"))
+                                pass
+                            else:
+                                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)
+                            a[:]=b
+                            a.flush() ; mm.seek(mm.tell()+nbCompo*(end-bg)*4)
+                            pass
+                        pass
+                    k="%s per %s"%(self.dictCompo[nbCompo],self.discSpatial[typ])
+                    if k in self._ze_top_dict:
+                        if k1 in self._ze_top_dict[k]:
+                            self._ze_top_dict[k][k1].append(fffn)
+                            pass
+                        else:
+                            self._ze_top_dict[k][k1]=[fffn]
+                            pass
+                    else:
+                        self._ze_top_dict[k]={k1:[fffn]}
+                        pass
+                    pass
+                pass
+            pass
+        headerPart=""
+        if len(self._ze_top_dict)!=0:
+            hvp=self.header_varpart[:]
+            for k in self._ze_top_dict:
+                for k1 in self._ze_top_dict[k]:
+                    hvp+="\n%s: %s %s"%(k,k1,re.sub("([\d]{4})",4*"*",self._ze_top_dict[k][k1][0]))
+                    pass
+                pass
+            hvp+="\n"
+            headerPart+=hvp
+            #
+            ddd={"NbTimeSteps":len(its),"TimeValues":TimeValues}
+            htp=self.header_timepart%ddd
+            headerPart+=htp
+            pass
+        return headerPart
+    
+    @classmethod
+    def __str80(cls,st):
+        if len(st)>79:
+            raise Exception("String \"%s\" is too long (>79) !"%(st))
+        return st.ljust(79)+"\n"
+    
+    def __computeSizeOfGeoFile(self,listOfMeshes,nn):
+        sz=0
+        for m in listOfMeshes:
+            distribTypes=m.getDistributionOfTypes()
+            sz+=80+4+2*80+4+nn*3*4
+            i=0
+            for typ2,nbelem,dummy in distribTypes:
+                typ=typ2
+                if typ not in self.dictMCTyp:
+                    typ=MEDCouplingMesh.GetCorrespondingPolyType()
+                    pass
+                if typ!=NORM_POLYHED and typ!=NORM_POLYGON:
+                    sz+=80+4+MEDCouplingMesh.GetNumberOfNodesOfGeometricType(typ)*nbelem*4
+                    pass
+                elif typ==NORM_POLYHED:
+                    mplh=m[i:i+nbelem] ; delta=len(mplh.getNodalConnectivity())+nbelem
+                    sz+=80+4+delta*4
+                    pass
+                else:
+                    mplh=m[i:i+nbelem] ; delta=len(mplh.getNodalConnectivity())
+                    sz+=80+4+delta*4
+                    pass
+                i+=nbelem
+                pass
+            pass
+        return sz
index ee908bcb12f0c9d2011a703a010c063a1884c089..b127e4c4bb7f095493f3328fa84e0a44a65db182 100644 (file)
@@ -52,6 +52,16 @@ using namespace ParaMEDMEM;
   $result=convertMEDFileParameter1TS($1,$owner);
 }
 
+%typemap(out) ParaMEDMEM::MEDFileAnyTypeFieldMultiTS*
+{
+  $result=convertMEDFileFieldMultiTS($1,$owner);
+}
+
+%typemap(out) ParaMEDMEM::MEDFileAnyTypeField1TS*
+{
+  $result=convertMEDFileField1TS($1,$owner);
+}
+
 %newobject MEDLoader::ReadUMeshFromFamilies;
 %newobject MEDLoader::ReadUMeshFromGroups;
 %newobject MEDLoader::ReadUMeshFromFile;
@@ -61,6 +71,7 @@ using namespace ParaMEDMEM;
 %newobject MEDLoader::ReadFieldGauss;
 %newobject MEDLoader::ReadFieldGaussNE;
 %newobject ParaMEDMEM::MEDFileMesh::New;
+%newobject ParaMEDMEM::MEDFileMesh::createNewEmpty;
 %newobject ParaMEDMEM::MEDFileMesh::deepCpy;
 %newobject ParaMEDMEM::MEDFileMesh::shallowCpy;
 %newobject ParaMEDMEM::MEDFileMesh::getGenMeshAtLevel;
@@ -73,6 +84,7 @@ using namespace ParaMEDMEM;
 %newobject ParaMEDMEM::MEDFileMesh::getNodeFamilyArr;
 %newobject ParaMEDMEM::MEDFileMesh::getNodeFamiliesArr;
 %newobject ParaMEDMEM::MEDFileMesh::getAllFamiliesIdsReferenced;
+%newobject ParaMEDMEM::MEDFileMesh::computeAllFamilyIdsInUse;
 %newobject ParaMEDMEM::MEDFileUMesh::New;
 %newobject ParaMEDMEM::MEDFileUMesh::getCoords;
 %newobject ParaMEDMEM::MEDFileUMesh::getGroup;
@@ -99,29 +111,41 @@ using namespace ParaMEDMEM;
 
 %newobject ParaMEDMEM::MEDFileFields::New;
 %newobject ParaMEDMEM::MEDFileFields::deepCpy;
+%newobject ParaMEDMEM::MEDFileFields::shallowCpy;
 %newobject ParaMEDMEM::MEDFileFields::getFieldWithName;
 %newobject ParaMEDMEM::MEDFileFields::getFieldAtPos;
-%newobject ParaMEDMEM::MEDFileFields::__getitem__;
+%newobject ParaMEDMEM::MEDFileFields::partOfThisLyingOnSpecifiedMeshName;
+%newobject ParaMEDMEM::MEDFileFields::partOfThisLyingOnSpecifiedTimeSteps;
+%newobject ParaMEDMEM::MEDFileFields::partOfThisNotLyingOnSpecifiedTimeSteps;
 %newobject ParaMEDMEM::MEDFileFields::__iter__;
+
+%newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::New;
+%newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::deepCpy;
+%newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::shallowCpy;
+%newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::getTimeStepAtPos;
+%newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::getTimeStep;
+%newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::getTimeStepGivenTime;
+%newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::__iter__;
 %newobject ParaMEDMEM::MEDFileFieldMultiTS::New;
-%newobject ParaMEDMEM::MEDFileFieldMultiTS::deepCpy;
-%newobject ParaMEDMEM::MEDFileFieldMultiTS::getTimeStepAtPos;
-%newobject ParaMEDMEM::MEDFileFieldMultiTS::getTimeStep;
-%newobject ParaMEDMEM::MEDFileFieldMultiTS::getTimeStepGivenTime;
-%newobject ParaMEDMEM::MEDFileFieldMultiTS::__getitem__;
-%newobject ParaMEDMEM::MEDFileFieldMultiTS::__iter__;
 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtLevel;
 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtTopLevel;
 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldOnMeshAtLevel;
 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtLevelOld;
 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getUndergroundDataArray;
+%newobject ParaMEDMEM::MEDFileIntFieldMultiTS::New;
+%newobject ParaMEDMEM::MEDFileIntFieldMultiTS::getUndergroundDataArray;
+
+%newobject ParaMEDMEM::MEDFileAnyTypeField1TS::New;
+%newobject ParaMEDMEM::MEDFileAnyTypeField1TS::shallowCpy;
+%newobject ParaMEDMEM::MEDFileAnyTypeField1TS::deepCpy;
 %newobject ParaMEDMEM::MEDFileField1TS::New;
-%newobject ParaMEDMEM::MEDFileField1TS::deepCpy;
 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtLevel;
 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtTopLevel;
 %newobject ParaMEDMEM::MEDFileField1TS::getFieldOnMeshAtLevel;
 %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtLevelOld;
 %newobject ParaMEDMEM::MEDFileField1TS::getUndergroundDataArray;
+%newobject ParaMEDMEM::MEDFileIntField1TS::New;
+%newobject ParaMEDMEM::MEDFileIntField1TS::getUndergroundDataArray;
 
 %newobject ParaMEDMEM::MEDFileData::New;
 %newobject ParaMEDMEM::MEDFileData::deepCpy;
@@ -151,8 +175,12 @@ using namespace ParaMEDMEM;
 %feature("unref") MEDFileMeshMultiTS "$this->decrRef();"
 %feature("unref") MEDFileMeshes "$this->decrRef();"
 %feature("unref") MEDFileFieldLoc "$this->decrRef();"
+%feature("unref") MEDFileAnyTypeField1TS "$this->decrRef();"
 %feature("unref") MEDFileField1TS "$this->decrRef();"
+%feature("unref") MEDFileIntField1TS "$this->decrRef();"
+%feature("unref") MEDFileAnyTypeFieldMultiTS "$this->decrRef();"
 %feature("unref") MEDFileFieldMultiTS "$this->decrRef();"
+%feature("unref") MEDFileIntFieldMultiTS "$this->decrRef();"
 %feature("unref") MEDFileFields "$this->decrRef();"
 %feature("unref") MEDFileParameter1TS "$this->decrRef();"
 %feature("unref") MEDFileParameterDouble1TSWTI "$this->decrRef();"
@@ -363,9 +391,10 @@ namespace ParaMEDMEM
   public:
     static MEDFileMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
     static MEDFileMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
+    virtual MEDFileMesh *createNewEmpty() const throw(INTERP_KERNEL::Exception);
     virtual MEDFileMesh *deepCpy() const throw(INTERP_KERNEL::Exception);
     virtual MEDFileMesh *shallowCpy() const throw(INTERP_KERNEL::Exception);
-    virtual void clearNonDiscrAttributes() const;
+    virtual void clearNonDiscrAttributes() const throw(INTERP_KERNEL::Exception);
     void setName(const char *name);
     const char *getName();
     const char *getUnivName() const;
@@ -383,23 +412,26 @@ namespace ParaMEDMEM
     void setTimeUnit(const char *unit);
     const char *getTimeUnit() const;
     virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
+    virtual std::vector<int> getFamArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
+    virtual std::vector<int> getNumArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
+    virtual std::vector<int> getNameArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
     std::vector<int> getNonEmptyLevels() const throw(INTERP_KERNEL::Exception);
     std::vector<int> getNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
     int getSizeAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
     //
-    bool existsGroup(const char *groupName) const;
-    bool existsFamily(int famId) const;
-    bool existsFamily(const char *familyName) const;
-    void setFamilyId(const char *familyName, int id);
+    bool existsGroup(const char *groupName) const throw(INTERP_KERNEL::Exception);
+    bool existsFamily(int famId) const throw(INTERP_KERNEL::Exception);
+    bool existsFamily(const char *familyName) const throw(INTERP_KERNEL::Exception);
+    void setFamilyId(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
     void setFamilyIdUnique(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
     void addFamily(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
     void addFamilyOnGrp(const char *grpName, const char *famName) throw(INTERP_KERNEL::Exception);
     virtual void createGroupOnAll(int meshDimRelToMaxExt, const char *groupName) throw(INTERP_KERNEL::Exception);
     virtual bool keepFamIdsOnlyOnLevs(const std::vector<int>& famIds, const std::vector<int>& levs) throw(INTERP_KERNEL::Exception);
-    void copyFamGrpMapsFrom(const MEDFileMesh& other);
-    const std::map<std::string,int>& getFamilyInfo() const;
-    const std::map<std::string, std::vector<std::string> >& getGroupInfo() const;
+    void copyFamGrpMapsFrom(const MEDFileMesh& other) throw(INTERP_KERNEL::Exception);
+    const std::map<std::string,int>& getFamilyInfo() const throw(INTERP_KERNEL::Exception);
+    const std::map<std::string, std::vector<std::string> >& getGroupInfo() const throw(INTERP_KERNEL::Exception);
     std::vector<std::string> getFamiliesOnGroup(const char *name) const throw(INTERP_KERNEL::Exception);
     std::vector<std::string> getFamiliesOnGroups(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
     std::vector<int> getFamiliesIdsOnGroup(const char *name) const throw(INTERP_KERNEL::Exception);
@@ -407,11 +439,14 @@ namespace ParaMEDMEM
     void setFamiliesIdsOnGroup(const char *name, const std::vector<int>& famIds) throw(INTERP_KERNEL::Exception);
     std::vector<std::string> getGroupsOnFamily(const char *name) const throw(INTERP_KERNEL::Exception);
     void setGroupsOnFamily(const char *famName, const std::vector<std::string>& grps) throw(INTERP_KERNEL::Exception);
-    std::vector<std::string> getGroupsNames() const;
-    std::vector<std::string> getFamiliesNames() const;
+    std::vector<std::string> getGroupsNames() const throw(INTERP_KERNEL::Exception);
+    std::vector<std::string> getFamiliesNames() const throw(INTERP_KERNEL::Exception);
     void assignFamilyNameWithGroupName() throw(INTERP_KERNEL::Exception);
+    std::vector<std::string> removeEmptyGroups() throw(INTERP_KERNEL::Exception);
     void removeGroup(const char *name) throw(INTERP_KERNEL::Exception);
     void removeFamily(const char *name) throw(INTERP_KERNEL::Exception);
+    std::vector<std::string> removeOrphanGroups() throw(INTERP_KERNEL::Exception);
+    std::vector<std::string> removeOrphanFamilies() throw(INTERP_KERNEL::Exception);
     void changeGroupName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
     void changeFamilyName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
     void changeFamilyId(int oldId, int newId) throw(INTERP_KERNEL::Exception);
@@ -419,13 +454,17 @@ namespace ParaMEDMEM
     void setFamilyInfo(const std::map<std::string,int>& info);
     void setGroupInfo(const std::map<std::string, std::vector<std::string> >&info);
     int getFamilyId(const char *name) const throw(INTERP_KERNEL::Exception);
+    int getMaxAbsFamilyId() const throw(INTERP_KERNEL::Exception);
     int getMaxFamilyId() const throw(INTERP_KERNEL::Exception);
     int getMinFamilyId() const throw(INTERP_KERNEL::Exception);
+    int getTheMaxAbsFamilyId() const throw(INTERP_KERNEL::Exception);
     int getTheMaxFamilyId() const throw(INTERP_KERNEL::Exception);
     int getTheMinFamilyId() const throw(INTERP_KERNEL::Exception);
+    virtual int getMaxAbsFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
     virtual int getMaxFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
     virtual int getMinFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
     DataArrayInt *getAllFamiliesIdsReferenced() const throw(INTERP_KERNEL::Exception);
+    DataArrayInt *computeAllFamilyIdsInUse() const throw(INTERP_KERNEL::Exception);
     std::vector<int> getFamiliesIds(const std::vector<std::string>& famNames) const throw(INTERP_KERNEL::Exception);
     std::string getFamilyNameGivenId(int id) const throw(INTERP_KERNEL::Exception);
     bool ensureDifferentFamIdsPerLevel() throw(INTERP_KERNEL::Exception);
@@ -873,6 +912,11 @@ namespace ParaMEDMEM
          {
            return self->iterator();
          }
+
+         int __len__() const throw(INTERP_KERNEL::Exception)
+         {
+           return self->getNumberOfMeshes();
+         }
          
          MEDFileMesh *getMeshAtPos(int i) const throw(INTERP_KERNEL::Exception)
            {
@@ -901,7 +945,7 @@ namespace ParaMEDMEM
     const std::vector<double>& getRefCoords() const;
     const std::vector<double>& getGaussCoords() const;
     const std::vector<double>& getGaussWeights() const;
-    bool isEqual(const MEDFileFieldLoc& other, double eps) const;
+    bool isEqual(const MEDFileFieldLoc& other, double eps) const throw(INTERP_KERNEL::Exception);
   %extend
     {
       std::string __str__() const throw(INTERP_KERNEL::Exception)
@@ -914,8 +958,15 @@ namespace ParaMEDMEM
   class MEDFileFieldGlobsReal
   {
   public:
+    void resetContent();
     void shallowCpyGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
     void deepCpyGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
+    void shallowCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
+    void deepCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
+    void appendGlobs(const MEDFileFieldGlobsReal& other, double eps) throw(INTERP_KERNEL::Exception);
+    void checkGlobsCoherency() const throw(INTERP_KERNEL::Exception);
+    void checkGlobsPflsPartCoherency() const throw(INTERP_KERNEL::Exception);
+    void checkGlobsLocsPartCoherency() const throw(INTERP_KERNEL::Exception);
     std::vector<std::string> getPfls() const throw(INTERP_KERNEL::Exception);
     std::vector<std::string> getLocs() const throw(INTERP_KERNEL::Exception);
     bool existsPfl(const char *pflName) const throw(INTERP_KERNEL::Exception);
@@ -1015,17 +1066,150 @@ namespace ParaMEDMEM
          std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
          self->changeLocsNamesInStruct(v);
        }
+
+       std::string simpleReprGlobs() const throw(INTERP_KERNEL::Exception)
+       {
+         std::ostringstream oss;
+         self->simpleReprGlobs(oss);
+         return oss.str();
+       }
      }
   };
 
-  class MEDFileField1TS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
+  class MEDFileAnyTypeField1TS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
+  {
+  public:
+    static MEDFileAnyTypeField1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
+    static MEDFileAnyTypeField1TS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
+    static MEDFileAnyTypeField1TS *New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
+    void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
+    int getDimension() const throw(INTERP_KERNEL::Exception);
+    int getIteration() const throw(INTERP_KERNEL::Exception);
+    int getOrder() const throw(INTERP_KERNEL::Exception);
+    std::string getName() throw(INTERP_KERNEL::Exception);
+    void setName(const char *name) throw(INTERP_KERNEL::Exception);
+    std::string getMeshName() throw(INTERP_KERNEL::Exception);
+    void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
+    int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
+    bool isDealingTS(int iteration, int order) const throw(INTERP_KERNEL::Exception);
+    void setInfo(const std::vector<std::string>& infos) throw(INTERP_KERNEL::Exception);
+    const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
+    void setTime(int iteration, int order, double val) throw(INTERP_KERNEL::Exception);
+    virtual MEDFileAnyTypeField1TS *shallowCpy() const throw(INTERP_KERNEL::Exception);
+    MEDFileAnyTypeField1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
+    std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
+    void setDtUnit(const char *dtUnit) throw(INTERP_KERNEL::Exception);
+    %extend
+    {
+      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_int(tmp1));
+        PyList_SetItem(res,1,SWIG_From_int(tmp2));
+        PyList_SetItem(res,2,SWIG_From_double(tmp0));
+        return res;
+      }
+
+      PyObject *getDtIt() const throw(INTERP_KERNEL::Exception)
+      {
+        std::pair<int,int> res=self->getDtIt();
+        PyObject *elt=PyTuple_New(2);
+        PyTuple_SetItem(elt,0,SWIG_From_int(res.first));
+        PyTuple_SetItem(elt,1,SWIG_From_int(res.second));
+        return elt;
+      }
+
+      void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
+      {
+        self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob);
+      }
+      
+      void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
+      {
+        self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob);
+      }
+
+      bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
+      {
+        std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
+        return self->changeMeshNames(modifTab);
+      }
+      
+      PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
+      {
+        std::vector<TypeOfField> ret=self->getTypesOfFieldAvailable();
+        PyObject *ret2=PyList_New(ret.size());
+        for(int i=0;i<(int)ret.size();i++)
+          PyList_SetItem(ret2,i,SWIG_From_int(ret[i]));
+        return ret2;
+      }
+
+      PyObject *getNonEmptyLevels(const char *mname=0) const throw(INTERP_KERNEL::Exception)
+      {
+        std::vector<int> ret1;
+        int ret0=self->getNonEmptyLevels(mname,ret1);
+        PyObject *elt=PyTuple_New(2);
+        PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
+        PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
+        return elt;
+      }
+
+      PyObject *getFieldSplitedByType(const char *mname=0) const throw(INTERP_KERNEL::Exception)
+      {
+        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;
+        std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
+        int sz=ret.size();
+        PyObject *ret2=PyList_New(sz);
+           for(int i=0;i<sz;i++)
+             {
+               const std::vector< std::pair<int,int> >& dadsI=ret[i];
+               const std::vector<TypeOfField>& typesFI=typesF[i];
+               const std::vector<std::string>& pflsI=pfls[i];
+               const std::vector<std::string>& locsI=locs[i];
+               PyObject *elt=PyTuple_New(2);
+               PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
+               int sz2=ret[i].size();
+               PyObject *elt2=PyList_New(sz2);
+               for(int j=0;j<sz2;j++)
+                 {
+                   PyObject *elt3=PyTuple_New(4);
+                   PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
+                   PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,SWIG_From_int(dadsI[j].first)); PyTuple_SetItem(elt4,1,SWIG_From_int(dadsI[j].second));
+                   PyTuple_SetItem(elt3,1,elt4);
+                   PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
+                   PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
+                   PyList_SetItem(elt2,j,elt3);
+                 }
+               PyTuple_SetItem(elt,1,elt2);
+               PyList_SetItem(ret2,i,elt);
+             }
+           return ret2;
+      }
+
+      PyObject *splitComponents() const throw(INTERP_KERNEL::Exception)
+      {
+        std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > ret=self->splitComponents();
+        std::size_t sz=ret.size();
+        PyObject *retPy=PyList_New(sz);
+        for(std::size_t i=0;i<sz;i++)
+          PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
+        return retPy;
+      }
+    }
+  };
+
+  class MEDFileField1TS : public MEDFileAnyTypeField1TS
   {
   public:
     static MEDFileField1TS *New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
     static MEDFileField1TS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
     static MEDFileField1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
     static MEDFileField1TS *New();
-    void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
     MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
     MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception);
     MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
@@ -1036,20 +1220,6 @@ namespace ParaMEDMEM
     void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
     void setProfileNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
     void setLocNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
-    void copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
-    MEDFileField1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
-    //
-    int getDimension() const throw(INTERP_KERNEL::Exception);
-    int getIteration() const throw(INTERP_KERNEL::Exception);
-    int getOrder() const throw(INTERP_KERNEL::Exception);
-    std::string getName() throw(INTERP_KERNEL::Exception);
-    void setName(const char *name) throw(INTERP_KERNEL::Exception);
-    std::string getMeshName() throw(INTERP_KERNEL::Exception);
-    void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
-    int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
-    bool isDealingTS(int iteration, int order) const throw(INTERP_KERNEL::Exception);
-    const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
-    void setTime(int iteration, int order, double val) throw(INTERP_KERNEL::Exception);
     %extend
        {
          MEDFileField1TS(const char *fileName) throw(INTERP_KERNEL::Exception)
@@ -1071,104 +1241,28 @@ namespace ParaMEDMEM
          {
            return MEDFileField1TS::New();
          }
-         
-         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;
-             DataArrayDouble *ret0=self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1);
-             PyObject *ret=PyTuple_New(2);
-             PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
-             PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
-             return ret;
-           }
-
-         void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
-           {
-             self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob);
-           }
-         
-         void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
-           {
-             self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob);
-           }
 
-         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_int(tmp1));
-           PyList_SetItem(res,1,SWIG_From_int(tmp2));
-           PyList_SetItem(res,2,SWIG_From_double(tmp0));
-           return res;
-         }
-         
-         PyObject *getDtIt() const throw(INTERP_KERNEL::Exception)
-         {
-           std::pair<int,int> res=self->getDtIt();
-           PyObject *elt=PyTuple_New(2);
-           PyTuple_SetItem(elt,0,SWIG_From_int(res.first));
-           PyTuple_SetItem(elt,1,SWIG_From_int(res.second));
-           return elt;
-         }
-         
-         PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
+         void copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception)
          {
-           std::vector<TypeOfField> ret=self->getTypesOfFieldAvailable();
-           PyObject *ret2=PyList_New(ret.size());
-           for(int i=0;i<(int)ret.size();i++)
-             PyList_SetItem(ret2,i,SWIG_From_int(ret[i]));
-           return ret2;
+           const DataArrayDouble *arr=0;
+           if(field)
+             arr=field->getArray();
+           self->copyTinyInfoFrom(field,arr);
          }
          
-         PyObject *getNonEmptyLevels(const char *mname=0) const throw(INTERP_KERNEL::Exception)
+         std::string __str__() const throw(INTERP_KERNEL::Exception)
          {
-           std::vector<int> ret1;
-           int ret0=self->getNonEmptyLevels(mname,ret1);
-           PyObject *elt=PyTuple_New(2);
-           PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
-           PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
-           return elt;
+           return self->simpleRepr();
          }
          
-         PyObject *getFieldSplitedByType(const char *mname=0) const throw(INTERP_KERNEL::Exception)
+         PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
          {
-           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;
-           std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
-           int sz=ret.size();
-           PyObject *ret2=PyList_New(sz);
-           for(int i=0;i<sz;i++)
-             {
-               const std::vector< std::pair<int,int> >& dadsI=ret[i];
-               const std::vector<TypeOfField>& typesFI=typesF[i];
-               const std::vector<std::string>& pflsI=pfls[i];
-               const std::vector<std::string>& locsI=locs[i];
-               PyObject *elt=PyTuple_New(2);
-               PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
-               int sz2=ret[i].size();
-               PyObject *elt2=PyList_New(sz2);
-               for(int j=0;j<sz2;j++)
-                 {
-                   PyObject *elt3=PyTuple_New(4);
-                   PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
-                   PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,SWIG_From_int(dadsI[j].first)); PyTuple_SetItem(elt4,1,SWIG_From_int(dadsI[j].second));
-                   PyTuple_SetItem(elt3,1,elt4);
-                   PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
-                   PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
-                   PyList_SetItem(elt2,j,elt3);
-                 }
-               PyTuple_SetItem(elt,1,elt2);
-               PyList_SetItem(ret2,i,elt);
-             }
-           return ret2;
+           DataArrayInt *ret1=0;
+           DataArrayDouble *ret0=self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1);
+           PyObject *ret=PyTuple_New(2);
+           PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
+           PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+           return ret;
          }
 
          PyObject *getFieldSplitedByType2(const char *mname=0) const throw(INTERP_KERNEL::Exception)
@@ -1239,25 +1333,126 @@ namespace ParaMEDMEM
            PyTuple_SetItem(ret,1,elt);
            return ret;
          }
-         
-         bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
-         {
-           std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
-           return self->changeMeshNames(modifTab);
-         }
        }
   };
 
-  class MEDFileFieldMultiTSIterator
+  class MEDFileIntField1TS : public MEDFileAnyTypeField1TS
+  {
+  public:
+    static MEDFileIntField1TS *New();
+    static MEDFileIntField1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
+    static MEDFileIntField1TS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
+    static MEDFileIntField1TS *New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
+    //
+    void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception);
+    void setFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
+    %extend
+    {
+      MEDFileIntField1TS() throw(INTERP_KERNEL::Exception)
+      {
+        return MEDFileIntField1TS::New();
+      }
+
+      MEDFileIntField1TS(const char *fileName) throw(INTERP_KERNEL::Exception)
+      {
+        return MEDFileIntField1TS::New(fileName);
+      }
+
+      MEDFileIntField1TS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+      {
+        return MEDFileIntField1TS::New(fileName,fieldName);
+      }
+
+      MEDFileIntField1TS(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
+      {
+        return MEDFileIntField1TS::New(fileName,fieldName,iteration,order);
+      }
+
+      std::string __str__() const throw(INTERP_KERNEL::Exception)
+      {
+        return self->simpleRepr();
+      }
+
+      PyObject *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
+      {
+        DataArrayInt *ret1=0;
+        MEDCouplingFieldDouble *ret0=self->getFieldAtLevel(type,meshDimRelToMax,ret1,renumPol);
+        PyObject *ret=PyTuple_New(2);
+        PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
+        PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+        return ret;
+      }
+
+      PyObject *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception)
+      {
+        DataArrayInt *ret1=0;
+        MEDCouplingFieldDouble *ret0=self->getFieldAtTopLevel(type,ret1,renumPol);
+        PyObject *ret=PyTuple_New(2);
+        PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
+        PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+        return ret;
+      }
+
+      PyObject *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
+      {
+        DataArrayInt *ret1=0;
+        MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,meshDimRelToMax,mesh,ret1,renumPol);
+        PyObject *ret=PyTuple_New(2);
+        PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
+        PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+        return ret;
+      }
+      
+      PyObject *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
+      {
+        DataArrayInt *ret1=0;
+        MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,mesh,ret1,renumPol);
+        PyObject *ret=PyTuple_New(2);
+        PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
+        PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+        return ret;
+      }
+      
+      PyObject *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
+      {
+        DataArrayInt *ret1=0;
+        MEDCouplingFieldDouble *ret0=self->getFieldAtLevelOld(type,mname,meshDimRelToMax,ret1,renumPol);
+        PyObject *ret=PyTuple_New(2);
+        PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
+        PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+        return ret;
+      }
+
+      PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
+      {
+         DataArrayInt *ret1=0;
+         DataArrayInt *ret0=self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1);
+         PyObject *ret=PyTuple_New(2);
+         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+         return ret;
+      }
+      
+      DataArrayInt *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
+      {
+        DataArrayInt *ret=self->getUndergroundDataArray();
+        if(ret)
+          ret->incrRef();
+        return ret;
+      }
+    }
+  };
+
+  class MEDFileAnyTypeFieldMultiTSIterator
   {
   public:
     %extend
     {
       PyObject *next() throw(INTERP_KERNEL::Exception)
       {
-        MEDFileField1TS *ret=self->nextt();
+        MEDFileAnyTypeField1TS *ret=self->nextt();
         if(ret)
-          return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDFileField1TS,SWIG_POINTER_OWN | 0);
+          return convertMEDFileField1TS(ret, SWIG_POINTER_OWN | 0 );
         else
           {
             PyErr_SetString(PyExc_StopIteration,"No more data.");
@@ -1267,43 +1462,317 @@ namespace ParaMEDMEM
     }
   };
 
-  class MEDFileFieldMultiTS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
+  class MEDFileAnyTypeFieldMultiTS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
   {
   public:
-    static MEDFileFieldMultiTS *New() throw(INTERP_KERNEL::Exception);
-    static MEDFileFieldMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
-    static MEDFileFieldMultiTS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
-    MEDFileFieldMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
-    //
-    MEDFileField1TS *getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception);
-    MEDFileField1TS *getTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
-    MEDFileField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
-    //
-    void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
-    MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
-    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 char *mname, int iteration, int order, 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);
-    //
-    int getNumberOfTS() const throw(INTERP_KERNEL::Exception);
-    void eraseEmptyTS() throw(INTERP_KERNEL::Exception);
-    int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
-    int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
+    static MEDFileAnyTypeFieldMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
+    static MEDFileAnyTypeFieldMultiTS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
+    MEDFileAnyTypeFieldMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
+    virtual MEDFileAnyTypeFieldMultiTS *shallowCpy() const throw(INTERP_KERNEL::Exception);
     std::string getName() const throw(INTERP_KERNEL::Exception);
     void setName(const char *name) throw(INTERP_KERNEL::Exception);
+    std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
+    void setDtUnit(const char *dtUnit) throw(INTERP_KERNEL::Exception);
     std::string getMeshName() const throw(INTERP_KERNEL::Exception);
     void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
     const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
+    int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
+    int getNumberOfTS() const throw(INTERP_KERNEL::Exception);
+    void eraseEmptyTS() throw(INTERP_KERNEL::Exception);
+    int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
+    int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
+    void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
+    //
+    virtual MEDFileAnyTypeField1TS *getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception);
+    MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
+    MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
+    void pushBackTimeStep(MEDFileAnyTypeField1TS *f1ts) throw(INTERP_KERNEL::Exception);
+    void synchronizeNameScope() throw(INTERP_KERNEL::Exception);
     %extend
-       {
-         MEDFileFieldMultiTS()
-         {
-           return MEDFileFieldMultiTS::New();
-         }
+    {
+      int __len__() const throw(INTERP_KERNEL::Exception)
+      {
+        return self->getNumberOfTS();
+      }
+
+      int getTimeId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
+      {
+        if(elt0 && PyInt_Check(elt0))
+          {//fmts[3]
+            int pos=PyInt_AS_LONG(elt0);
+            return pos;
+          }
+        else if(elt0 && PyTuple_Check(elt0))
+          {
+            if(PyTuple_Size(elt0)==2)
+              {
+                PyObject *o0=PyTuple_GetItem(elt0,0);
+                PyObject *o1=PyTuple_GetItem(elt0,1);
+                if(PyInt_Check(o0) && PyInt_Check(o1))
+                  {//fmts(1,-1)
+                    int iter=PyInt_AS_LONG(o0);
+                    int order=PyInt_AS_LONG(o1);
+                    return self->getPosOfTimeStep(iter,order);
+                  }
+                else
+                  throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input param ! input is a tuple of size 2 but two integers are expected in this tuple to request a time steps !");
+              }
+            else
+              throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input param ! input is a tuple of size != 2 ! two integers are expected in this tuple to request a time steps !");
+          }
+        else if(elt0 && PyFloat_Check(elt0))
+          {
+            double val=PyFloat_AS_DOUBLE(elt0);
+            return self->getPosGivenTime(val);
+          }
+        else
+          throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
+      }
+      
+      PyObject *getIterations() const throw(INTERP_KERNEL::Exception)
+      {
+        std::vector< std::pair<int,int> > res=self->getIterations();
+        PyObject *ret=PyList_New(res.size());
+        int rk=0;
+        for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
+          {
+            PyObject *elt=PyTuple_New(2);
+            PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
+            PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
+            PyList_SetItem(ret,rk,elt);
+          }
+        return ret;
+      }
+      
+      PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
+      {
+        std::vector<double> ret1;
+        std::vector< std::pair<int,int> > ret=self->getTimeSteps(ret1);
+        std::size_t sz=ret.size();
+        PyObject *ret2=PyList_New(sz);
+        for(std::size_t i=0;i<sz;i++)
+          {
+            PyObject *elt=PyTuple_New(3);
+            PyTuple_SetItem(elt,0,SWIG_From_int(ret[i].first));
+            PyTuple_SetItem(elt,1,SWIG_From_int(ret[i].second));
+            PyTuple_SetItem(elt,2,SWIG_From_double(ret1[i]));
+            PyList_SetItem(ret2,i,elt);
+          }
+        return ret2;
+      }
+      
+      PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
+      {
+        std::vector< std::vector<TypeOfField> > ret=self->getTypesOfFieldAvailable();
+        PyObject *ret2=PyList_New(ret.size());
+        for(int i=0;i<(int)ret.size();i++)
+          {
+            const std::vector<TypeOfField>& rett=ret[i];
+            PyObject *ret3=PyList_New(rett.size());
+            for(int j=0;j<(int)rett.size();j++)
+              PyList_SetItem(ret3,j,SWIG_From_int(rett[j]));
+            PyList_SetItem(ret2,i,ret3);
+          }
+        return ret2;
+      }
+      
+      PyObject *getNonEmptyLevels(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
+      {
+        std::vector<int> ret1;
+        int ret0=self->getNonEmptyLevels(iteration,order,mname,ret1);
+        PyObject *elt=PyTuple_New(2);
+        PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
+        PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
+        return elt;
+      }
+      
+      PyObject *getFieldSplitedByType(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
+      {
+        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;
+        std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
+        int sz=ret.size();
+        PyObject *ret2=PyList_New(sz);
+        for(int i=0;i<sz;i++)
+          {
+            const std::vector< std::pair<int,int> >& dadsI=ret[i];
+            const std::vector<TypeOfField>& typesFI=typesF[i];
+            const std::vector<std::string>& pflsI=pfls[i];
+            const std::vector<std::string>& locsI=locs[i];
+            PyObject *elt=PyTuple_New(2);
+            PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
+            int sz2=ret[i].size();
+            PyObject *elt2=PyList_New(sz2);
+            for(int j=0;j<sz2;j++)
+              {
+                PyObject *elt3=PyTuple_New(4);
+                PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
+                PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,SWIG_From_int(dadsI[j].first)); PyTuple_SetItem(elt4,1,SWIG_From_int(dadsI[j].second));
+                PyTuple_SetItem(elt3,1,elt4);
+                PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
+                PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
+                PyList_SetItem(elt2,j,elt3);
+              }
+            PyTuple_SetItem(elt,1,elt2);
+            PyList_SetItem(ret2,i,elt);
+          }
+        return ret2;
+      }
+
+      std::vector<int> getTimeIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
+      {
+        if(PyList_Check(elts))
+          {
+            int sz=PyList_Size(elts);
+            std::vector<int> ret(sz);
+            for(int i=0;i<sz;i++)
+              {
+                PyObject *elt=PyList_GetItem(elts,i);
+                ret[i]=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elt);
+              }
+            return ret;
+          }
+        else
+          {
+            std::vector<int> ret(1);
+            ret[0]=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elts);
+            return ret;
+          }
+      }
+      
+      void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
+      {
+        if(PySlice_Check(elts))
+          {
+            Py_ssize_t strt=2,stp=2,step=2;
+            PySliceObject *oC=reinterpret_cast<PySliceObject *>(elts);
+            if(PySlice_GetIndices(oC,self->getNumberOfTS(),&strt,&stp,&step)==0)
+              {
+                self->eraseTimeStepIds2(strt,stp,step);
+              }
+            else
+              throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS.__delitem__ : error in input slice !");
+          }
+        else
+          {
+            std::vector<int> idsToRemove=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeIds(self,elts);
+            if(!idsToRemove.empty())
+              self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
+          }
+      }
+      
+      void eraseTimeStepIds(PyObject *li) throw(INTERP_KERNEL::Exception)
+      {
+        int sw;
+        int pos1;
+        std::vector<int> pos2;
+        DataArrayInt *pos3=0;
+        DataArrayIntTuple *pos4=0;
+        convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
+        switch(sw)
+          {
+          case 1:
+            {
+              self->eraseTimeStepIds(&pos1,&pos1+1);
+              return;
+            }
+          case 2:
+            {
+              if(pos2.empty())
+                return;
+              self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
+              return ;
+            }
+          case 3:
+            {
+              self->eraseTimeStepIds(pos3->begin(),pos3->end());
+              return ;
+            }
+          default:
+            throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
+          }
+      }
+
+      MEDFileAnyTypeFieldMultiTSIterator *__iter__() throw(INTERP_KERNEL::Exception)
+      {
+        return self->iterator();
+      }
+
+      PyObject *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
+      {
+        if(elt0 && PyList_Check(elt0))
+          {
+            int sz=PyList_Size(elt0);
+            MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
+            int *pt=da->getPointer();
+            for(int i=0;i<sz;i++,pt++)
+              {
+                PyObject *elt1=PyList_GetItem(elt0,i);
+                *pt=MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt1);
+              }
+            return convertMEDFileFieldMultiTS(self->buildSubPart(da->begin(),da->end()),SWIG_POINTER_OWN | 0);
+          }
+        else if(elt0 && PySlice_Check(elt0))
+          {
+            Py_ssize_t strt=2,stp=2,step=2;
+            PySliceObject *oC=reinterpret_cast<PySliceObject *>(elt0);
+            if(PySlice_GetIndices(oC,self->getNumberOfTS(),&strt,&stp,&step)==0)
+              return convertMEDFileFieldMultiTS(self->buildSubPartSlice(strt,stp,step),SWIG_POINTER_OWN | 0);
+            else
+              throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS.__getitem__ : error in input slice !");
+          }
+        else
+          return convertMEDFileField1TS(self->getTimeStepAtPos(MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt0)),SWIG_POINTER_OWN | 0);
+      }
+
+      bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
+      {
+        std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
+        return self->changeMeshNames(modifTab);
+      }
+
+      PyObject *splitComponents() const throw(INTERP_KERNEL::Exception)
+      {
+        std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > ret=self->splitComponents();
+        std::size_t sz=ret.size();
+        PyObject *retPy=PyList_New(sz);
+        for(std::size_t i=0;i<sz;i++)
+          PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
+        return retPy;
+      }
+
+      void pushBackTimeSteps(PyObject *li) throw(INTERP_KERNEL::Exception)
+      {
+        std::vector<MEDFileAnyTypeField1TS *> tmp;
+        convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeField1TS *>(li,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeField1TS,"MEDFileAnyTypeField1TS",tmp);
+        self->pushBackTimeSteps(tmp);
+      }
+    }
+  };
+
+  class MEDFileFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
+  {
+  public:
+    static MEDFileFieldMultiTS *New() throw(INTERP_KERNEL::Exception);
+    static MEDFileFieldMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
+    static MEDFileFieldMultiTS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
+    //
+    MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+    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 char *mname, int iteration, int order, 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);
+    %extend
+       {
+         MEDFileFieldMultiTS()
+         {
+           return MEDFileFieldMultiTS::New();
+         }
 
          MEDFileFieldMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
          {
@@ -1320,152 +1789,16 @@ namespace ParaMEDMEM
            return self->simpleRepr();
          }
 
-         int __len__() const throw(INTERP_KERNEL::Exception)
-         {
-           return self->getNumberOfTS();
-         }
-
-         MEDFileField1TS *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
-         {
-           if(elt0 && PyInt_Check(elt0))
-             {//fmts[3]
-               int pos=PyInt_AS_LONG(elt0);
-               return self->getTimeStepAtPos(pos);
-             }
-           else if(elt0 && PyTuple_Check(elt0))
-             {
-               if(PyTuple_Size(elt0)==2)
-                 {
-                   PyObject *o0=PyTuple_GetItem(elt0,0);
-                   PyObject *o1=PyTuple_GetItem(elt0,1);
-                   if(PyInt_Check(o0) && PyInt_Check(o1))
-                     {//fmts(1,-1)
-                       int iter=PyInt_AS_LONG(o0);
-                       int order=PyInt_AS_LONG(o1);
-                       return self->getTimeStep(iter,order);
-                     }
-                   else
-                     throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::__getitem__ : invalid input param ! input is a tuple of size 2 but two integers are expected in this tuple to request a time steps !");
-                 }
-               else
-                 throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::__getitem__ : invalid input param ! input is a tuple of size != 2 ! two integers are expected in this tuple to request a time steps !");
-             }
-           else if(elt0 && PyFloat_Check(elt0))
-             {
-               double val=PyFloat_AS_DOUBLE(elt0);
-               return self->getTimeStepGivenTime(val);
-             }
-           else
-             throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
-         }
-
-         MEDFileFieldMultiTSIterator *__iter__() throw(INTERP_KERNEL::Exception)
-         {
-           return self->iterator();
-         }
-
          PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
-           {
-             DataArrayInt *ret1=0;
-             DataArrayDouble *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_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
-             PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
-             return ret;
-           }
-
-         PyObject *getIterations() const
          {
-           std::vector< std::pair<int,int> > res=self->getIterations();
-           PyObject *ret=PyList_New(res.size());
-           int rk=0;
-           for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
-             {
-               PyObject *elt=PyTuple_New(2);
-               PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
-               PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
-               PyList_SetItem(ret,rk,elt);
-             }
+           DataArrayInt *ret1=0;
+           DataArrayDouble *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_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
+           PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
            return ret;
          }
 
-         PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
-           {
-             std::vector<double> ret1;
-             std::vector< std::pair<int,int> > ret=self->getTimeSteps(ret1);
-             std::size_t sz=ret.size();
-             PyObject *ret2=PyList_New(sz);
-             for(std::size_t i=0;i<sz;i++)
-               {
-                 PyObject *elt=PyTuple_New(3);
-                 PyTuple_SetItem(elt,0,SWIG_From_int(ret[i].first));
-                 PyTuple_SetItem(elt,1,SWIG_From_int(ret[i].second));
-                 PyTuple_SetItem(elt,2,SWIG_From_double(ret1[i]));
-                 PyList_SetItem(ret2,i,elt);
-               }
-             return ret2;
-           }
-
-         PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
-         {
-           std::vector< std::vector<TypeOfField> > ret=self->getTypesOfFieldAvailable();
-           PyObject *ret2=PyList_New(ret.size());
-           for(int i=0;i<(int)ret.size();i++)
-             {
-               const std::vector<TypeOfField>& rett=ret[i];
-               PyObject *ret3=PyList_New(rett.size());
-               for(int j=0;j<(int)rett.size();j++)
-                 PyList_SetItem(ret3,j,SWIG_From_int(rett[j]));
-               PyList_SetItem(ret2,i,ret3);
-             }
-           return ret2;
-         }
-
-         PyObject *getNonEmptyLevels(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
-         {
-           std::vector<int> ret1;
-           int ret0=self->getNonEmptyLevels(iteration,order,mname,ret1);
-           PyObject *elt=PyTuple_New(2);
-           PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
-           PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
-           return elt;
-         }
-
-         PyObject *getFieldSplitedByType(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
-         {
-           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;
-           std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
-           int sz=ret.size();
-           PyObject *ret2=PyList_New(sz);
-           for(int i=0;i<sz;i++)
-             {
-               const std::vector< std::pair<int,int> >& dadsI=ret[i];
-               const std::vector<TypeOfField>& typesFI=typesF[i];
-               const std::vector<std::string>& pflsI=pfls[i];
-               const std::vector<std::string>& locsI=locs[i];
-               PyObject *elt=PyTuple_New(2);
-               PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
-               int sz2=ret[i].size();
-               PyObject *elt2=PyList_New(sz2);
-               for(int j=0;j<sz2;j++)
-                 {
-                   PyObject *elt3=PyTuple_New(4);
-                   PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
-                   PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,SWIG_From_int(dadsI[j].first)); PyTuple_SetItem(elt4,1,SWIG_From_int(dadsI[j].second));
-                   PyTuple_SetItem(elt3,1,elt4);
-                   PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
-                   PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
-                   PyList_SetItem(elt2,j,elt3);
-                 }
-               PyTuple_SetItem(elt,1,elt2);
-               PyList_SetItem(ret2,i,elt);
-             }
-           return ret2;
-         }
-
          PyObject *getFieldSplitedByType2(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
          {
            std::vector<INTERP_KERNEL::NormalizedCellType> types;
@@ -1506,6 +1839,7 @@ namespace ParaMEDMEM
              ret->incrRef();
            return ret;
          }
+         
          PyObject *getUndergroundDataArrayExt(int iteration, int order) const throw(INTERP_KERNEL::Exception)
          {
            std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
@@ -1532,106 +1866,6 @@ namespace ParaMEDMEM
            PyTuple_SetItem(ret,1,elt);
            return ret;
          }
-
-         int getTimeId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
-         {
-           if(elt0 && PyInt_Check(elt0))
-             {//fmts[3]
-               int pos=PyInt_AS_LONG(elt0);
-               return pos;
-             }
-           else if(elt0 && PyTuple_Check(elt0))
-             {
-               if(PyTuple_Size(elt0)==2)
-                 {
-                   PyObject *o0=PyTuple_GetItem(elt0,0);
-                   PyObject *o1=PyTuple_GetItem(elt0,1);
-                   if(PyInt_Check(o0) && PyInt_Check(o1))
-                     {//fmts(1,-1)
-                       int iter=PyInt_AS_LONG(o0);
-                       int order=PyInt_AS_LONG(o1);
-                       return self->getPosOfTimeStep(iter,order);
-                     }
-                   else
-                     throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::__getitem__ : invalid input param ! input is a tuple of size 2 but two integers are expected in this tuple to request a time steps !");
-                 }
-               else
-                 throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::__getitem__ : invalid input param ! input is a tuple of size != 2 ! two integers are expected in this tuple to request a time steps !");
-             }
-           else if(elt0 && PyFloat_Check(elt0))
-             {
-               double val=PyFloat_AS_DOUBLE(elt0);
-               return self->getPosGivenTime(val);
-             }
-           else
-             throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
-         }
-
-         std::vector<int> getTimeIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
-         {
-           if(PyList_Check(elts))
-             {
-               int sz=PyList_Size(elts);
-               std::vector<int> ret(sz);
-               for(int i=0;i<sz;i++)
-                 {
-                   PyObject *elt=PyList_GetItem(elts,i);
-                   ret[i]=ParaMEDMEM_MEDFileFieldMultiTS_getTimeId(self,elt);
-                 }
-               return ret;
-             }
-           else
-             {
-               std::vector<int> ret(1);
-               ret[0]=ParaMEDMEM_MEDFileFieldMultiTS_getTimeId(self,elts);
-               return ret;
-             }
-         }
-
-         void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
-         {
-           std::vector<int> idsToRemove=ParaMEDMEM_MEDFileFieldMultiTS_getTimeIds(self,elts);
-           if(!idsToRemove.empty())
-             self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
-         }
-
-         void eraseTimeStepIds(PyObject *li) throw(INTERP_KERNEL::Exception)
-         {
-           int sw;
-           int pos1;
-           std::vector<int> pos2;
-           DataArrayInt *pos3=0;
-           DataArrayIntTuple *pos4=0;
-           convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
-           switch(sw)
-             {
-             case 1:
-               {
-                 self->eraseTimeStepIds(&pos1,&pos1+1);
-                 return;
-               }
-             case 2:
-               {
-                 if(pos2.empty())
-                   return;
-                 self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
-                 return ;
-               }
-             case 3:
-               {
-                 self->eraseTimeStepIds(pos3->begin(),pos3->end());
-                 return ;
-               }
-             default:
-               throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
-             }
-         }
-
-         bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
-         {
-           std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
-           return self->changeMeshNames(modifTab);
-         }
        }
   };
 
@@ -1642,9 +1876,9 @@ namespace ParaMEDMEM
     {
       PyObject *next() throw(INTERP_KERNEL::Exception)
       {
-        MEDFileFieldMultiTS *ret=self->nextt();
+        MEDFileAnyTypeFieldMultiTS *ret=self->nextt();
         if(ret)
-          return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldMultiTS,SWIG_POINTER_OWN | 0);
+          return convertMEDFileFieldMultiTS(ret, SWIG_POINTER_OWN | 0 );
         else
           {
             PyErr_SetString(PyExc_StopIteration,"No more data.");
@@ -1654,22 +1888,126 @@ namespace ParaMEDMEM
     }
   };
 
+  class MEDFileIntFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
+  {
+  public:
+    static MEDFileIntFieldMultiTS *New();
+    static MEDFileIntFieldMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
+    static MEDFileIntFieldMultiTS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
+    //
+    void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception);
+    void appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
+    %extend
+    {
+      MEDFileIntFieldMultiTS()
+      {
+        return MEDFileIntFieldMultiTS::New();
+      }
+      
+      MEDFileIntFieldMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
+      {
+        return MEDFileIntFieldMultiTS::New(fileName);
+      }
+      
+      MEDFileIntFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+      {
+        return MEDFileIntFieldMultiTS::New(fileName,fieldName);
+      }
+
+      std::string __str__() const throw(INTERP_KERNEL::Exception)
+      {
+        return self->simpleRepr();
+      }
+
+      PyObject *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
+      {
+        DataArrayInt *ret1=0;
+        MEDCouplingFieldDouble *ret0=self->getFieldAtLevel(type,iteration,order,meshDimRelToMax,ret1,renumPol);
+        PyObject *ret=PyTuple_New(2);
+        PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
+        PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+        return ret;
+      }
+
+      PyObject *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception)
+      {
+        DataArrayInt *ret1=0;
+        MEDCouplingFieldDouble *ret0=self->getFieldAtTopLevel(type,iteration,order,ret1,renumPol);
+        PyObject *ret=PyTuple_New(2);
+        PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
+        PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+        return ret;
+      }
+
+      PyObject *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
+      {
+        DataArrayInt *ret1=0;
+        MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,iteration,order,meshDimRelToMax,mesh,ret1,renumPol);
+        PyObject *ret=PyTuple_New(2);
+        PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
+        PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+        return ret;
+      }
+      
+      PyObject *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
+      {
+        DataArrayInt *ret1=0;
+        MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,iteration,order,mesh,ret1,renumPol);
+        PyObject *ret=PyTuple_New(2);
+        PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
+        PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+        return ret;
+      }
+      
+      PyObject *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
+      {
+        DataArrayInt *ret1=0;
+        MEDCouplingFieldDouble *ret0=self->getFieldAtLevelOld(type,iteration,order,mname,meshDimRelToMax,ret1,renumPol);
+        PyObject *ret=PyTuple_New(2);
+        PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
+        PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+        return ret;
+      }
+
+      PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
+      {
+         DataArrayInt *ret1=0;
+         DataArrayInt *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_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+         return ret;
+      }
+
+      DataArrayInt *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
+      {
+        DataArrayInt *ret=self->getUndergroundDataArray(iteration,order);
+        if(ret)
+          ret->incrRef();
+        return ret;
+      }
+    }
+  };
+
   class MEDFileFields : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
   {
   public:
     static MEDFileFields *New() throw(INTERP_KERNEL::Exception);
     static MEDFileFields *New(const char *fileName) throw(INTERP_KERNEL::Exception);
     MEDFileFields *deepCpy() const throw(INTERP_KERNEL::Exception);
+    MEDFileFields *shallowCpy() const throw(INTERP_KERNEL::Exception);
     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
     int getNumberOfFields() const;
     std::vector<std::string> getFieldsNames() const throw(INTERP_KERNEL::Exception);
     std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
     //
     void resize(int newSize) throw(INTERP_KERNEL::Exception);
-    void pushField(MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
-    void setFieldAtPos(int i, MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
-    MEDFileFieldMultiTS *getFieldAtPos(int i) const throw(INTERP_KERNEL::Exception);
-    MEDFileFieldMultiTS *getFieldWithName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
+    void pushField(MEDFileAnyTypeFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
+    void setFieldAtPos(int i, MEDFileAnyTypeFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
+    int getPosFromFieldName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
+    MEDFileAnyTypeFieldMultiTS *getFieldAtPos(int i) const throw(INTERP_KERNEL::Exception);
+    MEDFileAnyTypeFieldMultiTS *getFieldWithName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
+    MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const char *meshName) const throw(INTERP_KERNEL::Exception);
     void destroyFieldAtPos(int i) throw(INTERP_KERNEL::Exception);
     %extend
        {
@@ -1687,19 +2025,55 @@ namespace ParaMEDMEM
          {
            return self->simpleRepr();
          }
-         
-         MEDFileFieldMultiTS *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
+
+         PyObject *getCommonIterations() const throw(INTERP_KERNEL::Exception)
          {
-           if(PyInt_Check(obj))
+           bool ret1;
+           std::vector< std::pair<int,int> > ret0=self->getCommonIterations(ret1);
+           PyObject *ret=PyTuple_New(2);
+           PyObject *ret_0=PyList_New(ret0.size());
+           int rk=0;
+           for(std::vector< std::pair<int,int> >::const_iterator iter=ret0.begin();iter!=ret0.end();iter++,rk++)
              {
-               return self->getFieldAtPos((int)PyInt_AS_LONG(obj));
+               PyObject *elt=PyTuple_New(2);
+               PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
+               PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
+               PyList_SetItem(ret_0,rk,elt);
              }
-           else if(PyString_Check(obj))
+           PyTuple_SetItem(ret,0,ret_0);
+           PyObject *ret_1=ret1?Py_True:Py_False; Py_XINCREF(ret_1);
+           PyTuple_SetItem(ret,1,ret_1);
+           return ret;
+         }
+
+         MEDFileFields *partOfThisLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const throw(INTERP_KERNEL::Exception)
+         {
+           std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
+           return self->partOfThisLyingOnSpecifiedTimeSteps(ts);
+         }
+
+         MEDFileFields *partOfThisNotLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const throw(INTERP_KERNEL::Exception)
+         {
+           std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
+           return self->partOfThisNotLyingOnSpecifiedTimeSteps(ts);
+         }
+         
+         PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
+         {
+           if(obj && PyList_Check(obj))
              {
-               return self->getFieldWithName(PyString_AsString(obj));
+               int sz=PyList_Size(obj);
+               MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
+               int *pt=da->getPointer();
+               for(int i=0;i<sz;i++,pt++)
+                 {
+                   PyObject *elt1=PyList_GetItem(obj,i);
+                   *pt=MEDFileFieldsgetitemSingleTS__(self,elt1);
+                 }
+               return SWIG_NewPointerObj(SWIG_as_voidptr(self->buildSubPart(da->begin(),da->end())),SWIGTYPE_p_ParaMEDMEM__MEDFileFields, SWIG_POINTER_OWN | 0 );
              }
            else
-             throw INTERP_KERNEL::Exception("MEDFileFields::__getitem__ : only integer or string with fieldname supported !");
+             return convertMEDFileFieldMultiTS(self->getFieldAtPos(MEDFileFieldsgetitemSingleTS__(self,obj)), SWIG_POINTER_OWN | 0 );
          }
 
          MEDFileFields *__setitem__(int obj, MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception)
@@ -1708,6 +2082,11 @@ namespace ParaMEDMEM
            return self;
          }
 
+         int __len__() const throw(INTERP_KERNEL::Exception)
+         {
+           return self->getNumberOfFields();
+         }
+
          MEDFileFieldsIterator *__iter__() throw(INTERP_KERNEL::Exception)
          {
            return self->iterator();
@@ -1718,6 +2097,65 @@ namespace ParaMEDMEM
            std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
            return self->changeMeshNames(modifTab);
          }
+
+         int getPosOfField(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
+         {
+           if(elt0 && 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] !");
+         }
+         
+         std::vector<int> getPosOfFields(PyObject *elts) const throw(INTERP_KERNEL::Exception)
+         {
+           if(PyList_Check(elts))
+             {
+               int sz=PyList_Size(elts);
+               std::vector<int> ret(sz);
+               for(int i=0;i<sz;i++)
+                 {
+                   PyObject *elt=PyList_GetItem(elts,i);
+                   ret[i]=ParaMEDMEM_MEDFileFields_getPosOfField(self,elt);
+                 }
+               return ret;
+             }
+           else
+             {
+               std::vector<int> ret(1);
+               ret[0]=ParaMEDMEM_MEDFileFields_getPosOfField(self,elts);
+               return ret;
+             }
+         }
+
+         void pushFields(PyObject *fields) throw(INTERP_KERNEL::Exception)
+         {
+           std::vector<MEDFileAnyTypeFieldMultiTS *> tmp;
+           convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeFieldMultiTS *>(fields,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",tmp);
+           self->pushFields(tmp);
+         }
+         
+         void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
+         {
+           if(elts && PySlice_Check(elts))
+             {
+               Py_ssize_t strt=2,stp=2,step=2;
+               PySliceObject *oC=reinterpret_cast<PySliceObject *>(elts);
+               if(PySlice_GetIndices(oC,self->getNumberOfFields(),&strt,&stp,&step)==0)
+                 self->destroyFieldsAtPos2(strt,stp,step);
+               else
+                 throw INTERP_KERNEL::Exception("MEDFileFields.__delitem__ : error in input slice !");
+             }
+           else
+             {
+               std::vector<int> idsToRemove=ParaMEDMEM_MEDFileFields_getPosOfFields(self,elts);
+               if(!idsToRemove.empty())
+                 self->destroyFieldsAtPos(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
+             }
+         }
        }
   };
 
@@ -1797,7 +2235,7 @@ namespace ParaMEDMEM
         return self->simpleRepr();
       }
 
-      PyObject *isEqual(const MEDFileParameter1TS *other, double eps) const
+      PyObject *isEqual(const MEDFileParameter1TS *other, double eps) const throw(INTERP_KERNEL::Exception)
       {
         std::string what;
         bool ret0=self->isEqual(other,eps,what);
@@ -1848,7 +2286,7 @@ namespace ParaMEDMEM
         return self->simpleRepr();
       }
       
-      PyObject *isEqual(const MEDFileParameterMultiTS *other, double eps) const
+      PyObject *isEqual(const MEDFileParameterMultiTS *other, double eps) const throw(INTERP_KERNEL::Exception)
       {
         std::string what;
         bool ret0=self->isEqual(other,eps,what);
@@ -2055,6 +2493,11 @@ namespace ParaMEDMEM
         else
           throw INTERP_KERNEL::Exception("MEDFileParameters::__getitem__ : only integer or string with meshname supported !");
       }
+
+      int __len__() const throw(INTERP_KERNEL::Exception)
+      {
+        return self->getNumberOfParams();
+      }
       
       MEDFileParameterMultiTS *getParamAtPos(int i) const throw(INTERP_KERNEL::Exception)
       {
@@ -2072,7 +2515,7 @@ namespace ParaMEDMEM
         return ret;
       }
       
-      PyObject *isEqual(const MEDFileParameters *other, double eps) const
+      PyObject *isEqual(const MEDFileParameters *other, double eps) const throw(INTERP_KERNEL::Exception)
       {
         std::string what;
         bool ret0=self->isEqual(other,eps,what);
diff --git a/src/MEDLoader/Swig/MEDLoaderCouplingTrainingSession.py b/src/MEDLoader/Swig/MEDLoaderCouplingTrainingSession.py
new file mode 100644 (file)
index 0000000..399e200
--- /dev/null
@@ -0,0 +1,592 @@
+#  -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2013  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.
+#
+# 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 (CEA/DEN/DM2S/STMF/LGLS)
+
+from MEDLoader import *
+from MEDCouplingRemapper import *
+import math
+
+d=DataArrayDouble.New(6,2)
+d[:,0]=3.
+d[:,1]=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)
+#
+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.)]]
+ds=len(translationToPerform)*[None]
+for pos,t in enumerate(translationToPerform):
+  ds[pos]=d[:]
+  ds[pos]+=t
+  pass
+#
+d2=DataArrayDouble.Aggregate(ds)
+oldNbOfTuples=d2.getNumberOfTuples()
+c,cI=d2.findCommonTuples(1e-12)
+tmp=c[cI[0]:cI[0+1]]
+print tmp
+a=cI.deltaShiftIndex()
+b=a-1
+myNewNbOfTuples=oldNbOfTuples-sum(b.getValues())
+o2n,newNbOfTuples=DataArrayInt.BuildOld2NewArrayFromSurjectiveFormat2(oldNbOfTuples,c,cI)
+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)
+#
+d3+=[3.3,4.4]
+# d3 contains coordinates
+m=MEDCouplingUMesh.New("My7hexagons",2)
+m.setCoords(d3)
+m.allocateCells(7)
+for i in xrange(7):
+  m.insertNextCell(NORM_POLYGON,o2n[6*i:6*(i+1)].getValues())
+  pass
+m.finishInsertingCells()
+m.checkCoherency()
+#
+m.writeVTK("My7hexagons.vtu")
+
+########
+
+coords=[0.,0.,0., 1.,1.,0., 1.,1.25,0., 1.,0.,0., 1.,1.5,0., 2.,0.,0., 2.,1.,0., 1.,2.,0., 0.,2.,0., 3.,1.,0.,
+        3.,2.,0., 0.,1.,0., 1.,3.,0., 2.,2.,0., 2.,3.,0.,
+        0.,0.,1., 1.,1.,1., 1.,1.25,1., 1.,0.,1., 1.,1.5,1., 2.,0.,1., 2.,1.,1., 1.,2.,1., 0.,2.,1., 3.,1.,1.,
+        3.,2.,1., 0.,1.,1., 1.,3.,1., 2.,2.,1., 2.,3.,1.,
+        0.,0.,2., 1.,1.,2., 1.,1.25,2., 1.,0.,2., 1.,1.5,2., 2.,0.,2., 2.,1.,2., 1.,2.,2., 0.,2.,2., 3.,1.,2.,
+        3.,2.,2., 0.,1.,2., 1.,3.,2., 2.,2.,2., 2.,3.,2.,
+        0.,0.,3., 1.,1.,3., 1.,1.25,3., 1.,0.,3., 1.,1.5,3., 2.,0.,3., 2.,1.,3., 1.,2.,3., 0.,2.,3., 3.,1.,3.,
+        3.,2.,3., 0.,1.,3., 1.,3.,3., 2.,2.,3., 2.,3.,3.]
+conn=[0,11,1,3,15,26,16,18,   1,2,4,7,13,6,-1,1,16,21,6,-1,6,21,28,13,-1,13,7,22,28,-1,7,4,19,22,-1,4,2,17,19,-1,2,1,16,17,-1,16,21,28,22,19,17,
+      1,6,5,3,16,21,20,18,   13,10,9,6,28,25,24,21, 11,8,7,4,2,1,-1,11,26,16,1,-1,1,16,17,2,-1,2,17,19,4,-1,4,19,22,7,-1,7,8,23,22,-1,8,11,26,23,-1,26,16,17,19,22,23,
+      7,12,14,13,22,27,29,28,  15,26,16,18,30,41,31,33, 16,17,19,22,28,21,-1,16,31,36,21,-1,21,36,43,28,-1,28,22,37,43,-1,22,19,34,37,-1,19,17,32,34,-1,17,16,31,32,-1,31,36,43,37,34,32,
+      16,21,20,18,31,36,35,33,   28,25,24,21,43,40,39,36, 26,23,22,19,17,16,-1,26,41,31,16,-1,16,31,32,17,-1,17,32,34,19,-1,19,34,37,22,-1,22,23,38,37,-1,23,26,41,38,-1,41,31,32,34,37,38,
+      22,27,29,28,37,42,44,43, 30,41,31,33,45,56,46,48,  31,32,34,37,43,36,-1,31,46,51,36,-1,36,51,58,43,-1,43,37,52,58,-1,37,34,49,52,-1,34,32,47,49,-1,32,31,46,47,-1,46,51,58,52,49,47,
+      31,36,35,33,46,51,50,48,  43,40,39,36,58,55,54,51, 41,38,37,34,32,31,-1,41,56,46,31,-1,31,46,47,32,-1,32,47,49,34,-1,34,49,52,37,-1,37,38,53,52,-1,38,41,56,53,-1,56,46,47,49,52,53,
+      37,42,44,43,52,57,59,58]
+mesh3D=MEDCouplingUMesh.New("mesh3D",3);
+mesh3D.allocateCells(18);
+mesh3D.insertNextCell(NORM_HEXA8,conn[0:8]); mesh3D.insertNextCell(NORM_POLYHED,conn[8:51]); mesh3D.insertNextCell(NORM_HEXA8,conn[51:59]); mesh3D.insertNextCell(NORM_HEXA8,conn[59:67]); mesh3D.insertNextCell(NORM_POLYHED,conn[67:110]); mesh3D.insertNextCell(NORM_HEXA8,conn[110:118]);
+mesh3D.insertNextCell(NORM_HEXA8,conn[118:126]); mesh3D.insertNextCell(NORM_POLYHED,conn[126:169]); mesh3D.insertNextCell(NORM_HEXA8,conn[169:177]); mesh3D.insertNextCell(NORM_HEXA8,conn[177:185]); mesh3D.insertNextCell(NORM_POLYHED,conn[185:228]); mesh3D.insertNextCell(NORM_HEXA8,conn[228:236]);
+mesh3D.insertNextCell(NORM_HEXA8,conn[236:244]); mesh3D.insertNextCell(NORM_POLYHED,conn[244:287]); mesh3D.insertNextCell(NORM_HEXA8,conn[287:295]); mesh3D.insertNextCell(NORM_HEXA8,conn[295:303]); mesh3D.insertNextCell(NORM_POLYHED,conn[303:346]); mesh3D.insertNextCell(NORM_HEXA8,conn[346:354]);
+mesh3D.finishInsertingCells();
+myCoords=DataArrayDouble.New(coords,60,3);
+myCoords.setInfoOnComponents(["X [m]","Y [m]","Z [m]"])
+mesh3D.setCoords(myCoords);
+mesh3D.orientCorrectlyPolyhedrons()
+mesh3D.sortCellsInMEDFileFrmt()
+mesh3D.checkCoherency()
+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)
+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.sort()
+#
+tmp,cellIdsSol1=mesh3D.buildSlice3D([0.,0.,(zLev[1]+zLev[2])/2],[0.,0.,1.],1e-12)
+bary=mesh3D.getBarycenterAndOwner()
+baryZ=bary[:,2]
+cellIdsSol2=baryZ.getIdsInRange(zLev[1],zLev[2])
+nodeIds=mesh3D.findNodesOnPlane([0.,0.,zLev[0]],[0.,0.,1.],1e-10)
+mesh2D=mesh3D.buildFacePartOfMySelfNode(nodeIds,True)
+extMesh=MEDCouplingExtrudedMesh.New(mesh3D,mesh2D,0)
+cellIdsSol3=extMesh.getMesh3DIds()[mesh2D.getNumberOfCells():2*mesh2D.getNumberOfCells()]
+for i in xrange(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.advancedRepr()
+#
+baryXY=bary[:,[0,1]]
+baryXY-=[250.,150.]
+magn=baryXY.magnitude()
+cellIds2Sol1=magn.getIdsInRange(0.,1e-12)
+#
+bary2=mesh2D.getBarycenterAndOwner()[:,[0,1]]
+bary2-=[250.,150.]
+magn=bary2.magnitude()
+ids=magn.getIdsInRange(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())]
+#
+mesh3DSlice2=mesh3D[cellIds2Sol1]
+mesh3DSlice2.zipCoords()
+#
+mesh3DSlice2bis=mesh3DSlice2.deepCpy()
+mesh3DSlice2bis.translate([0.,1000.,0.])
+mesh3DSlice2All=MEDCouplingUMesh.MergeUMeshes([mesh3DSlice2,mesh3DSlice2bis])
+mesh3DSlice2All.writeVTK("mesh3DSlice2All.vtu")
+#
+mesh3DSurf,desc,descIndx,revDesc,revDescIndx=mesh3D.buildDescendingConnectivity()
+numberOf3DCellSharing=revDescIndx.deltaShiftIndex()
+cellIds=numberOf3DCellSharing.getIdsNotEqual(1)
+mesh3DSurfInside=mesh3DSurf[cellIds]
+mesh3DSurfInside.writeVTK("mesh3DSurfInside.vtu")
+
+######
+
+xarr=DataArrayDouble.New(11,1)
+xarr.iota(0.)
+cmesh=MEDCouplingCMesh.New()
+cmesh.setCoords(xarr,xarr,xarr)
+mesh=cmesh.buildUnstructured()
+mesh.convertToPolyTypes(DataArrayInt.Range(0,mesh.getNumberOfCells(),2))
+#
+
+f=mesh.fillFromAnalytic(ON_CELLS,1,"(x-5.)*(x-5.)+(y-5.)*(y-5.)+(z-5.)*(z-5.)")
+f.setName("MyField")
+#
+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)
+#
+ids1=f.getArray().getIdsInRange(0.,5.)
+fPart1=f.buildSubPart(ids1)
+ids2=f.getArray().getIdsInRange(50.,1.e300)
+fPart2=f.buildSubPart(ids2)
+#Renumbering cells to follow MED file
+fPart1Cpy=fPart1.deepCpy()
+o2n=fPart1Cpy.getMesh().sortCellsInMEDFileFrmt()
+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
+#
+fPart12=MEDCouplingFieldDouble.MergeFields([fPart1,fPart2])
+# evaluation on points
+bary=fPart12.getMesh().getBarycenterAndOwner()
+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 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
+# Explosion of field
+fVec=mesh.fillFromAnalytic(ON_CELLS,3,"(x-5.)*IVec+(y-5.)*JVec+(z-5.)*KVec")
+fVecPart1=fVec.buildSubPart(ids1)
+fVecPart1.setName("fVecPart1")
+cells=fPart1.getMesh().getNumberOfCells()*[None]
+for icell,vec in enumerate(fVecPart1.getArray()):
+  m=fPart1.getMesh()[[icell]]
+  m.zipCoords()
+  m.translate(vec)
+  cells[icell]=m
+  pass
+meshFVecPart1Exploded=MEDCouplingUMesh.MergeUMeshes(cells)
+fPart1.setMesh(meshFVecPart1Exploded)
+
+####
+
+targetCoords=[-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 ];
+targetConn=[0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4];
+targetMesh=MEDCouplingUMesh.New("MyMesh",2);
+targetMesh.allocateCells(5);
+targetMesh.insertNextCell(NORM_TRI3,3,targetConn[4:7]);
+targetMesh.insertNextCell(NORM_TRI3,3,targetConn[7:10]);
+targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[0:4]);
+targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[10:14]);
+targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[14:18]);
+targetMesh.finishInsertingCells();
+myCoords=DataArrayDouble.New(targetCoords,9,2);
+myCoords.setInfoOnComponents(["X [km]","YY [mm]"])
+targetMesh.setCoords(myCoords);
+#
+MEDLoader.WriteUMesh("TargetMesh.med",targetMesh,True)
+#
+meshRead=MEDLoader.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)
+#
+f=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME)
+f.setTime(5.6,7,8)
+f.setArray(targetMesh.getBarycenterAndOwner())
+f.setMesh(targetMesh)
+f.setName("AFieldName")
+MEDLoader.WriteField("MyFirstField.med",f,True)
+#
+f2=MEDLoader.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)
+#
+MEDLoader.WriteUMesh("MySecondField.med",f.getMesh(),True)
+MEDLoader.WriteFieldUsingAlreadyWrittenMesh("MySecondField.med",f)
+#
+f2=f.clone(True)
+f2.getArray()[:]*=2.0
+f2.setTime(7.8,9,10)
+MEDLoader.WriteFieldUsingAlreadyWrittenMesh("MySecondField.med",f2)
+#
+f3=MEDLoader.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)
+f4=MEDLoader.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)
+
+#####
+
+targetCoords=[-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 ];
+targetConn=[0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4];
+targetMesh=MEDCouplingUMesh.New("MyMesh",2);
+targetMesh.allocateCells(5);
+targetMesh.insertNextCell(NORM_TRI3,3,targetConn[4:7]);
+targetMesh.insertNextCell(NORM_TRI3,3,targetConn[7:10]);
+targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[0:4]);
+targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[10:14]);
+targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[14:18]);
+targetMesh.finishInsertingCells();
+myCoords=DataArrayDouble.New(targetCoords,9,2);
+myCoords.setInfoOnComponents(["X [km]","YY [mm]"])
+targetMesh.setCoords(myCoords);
+#
+targetMeshConsti=targetMesh.buildDescendingConnectivity()[0]
+targetMesh1=targetMeshConsti[[3,4,7,8]]
+targetMesh1.setName(targetMesh.getName())
+#
+meshMEDFile=MEDFileUMesh.New()
+meshMEDFile.setMeshAtLevel(0,targetMesh)
+meshMEDFile.setMeshAtLevel(-1,targetMesh1)
+# Some groups on cells Level 0
+grp0_0=DataArrayInt.New([0,1,3]) ; grp0_0.setName("grp0_Lev0")
+grp1_0=DataArrayInt.New([1,2,3,4]) ; grp1_0.setName("grp1_Lev0")
+meshMEDFile.setGroupsAtLevel(0,[grp0_0,grp1_0])
+# Some groups on cells Level -1
+grp0_M1=DataArrayInt.New([0,1]) ; grp0_M1.setName("grp0_LevM1")
+grp1_M1=DataArrayInt.New([0,1,2]) ; grp1_M1.setName("grp1_LevM1")
+grp2_M1=DataArrayInt.New([1,2,3]) ; grp2_M1.setName("grp2_LevM1")
+meshMEDFile.setGroupsAtLevel(-1,[grp0_M1,grp1_M1,grp2_M1])
+#
+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 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)
+#
+# Fields
+#
+f=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME)
+f.setTime(5.6,7,8)
+f.setArray(targetMesh.getBarycenterAndOwner())
+f.setMesh(targetMesh)
+f.setName("AFieldName")
+#
+fMEDFile=MEDFileField1TS.New()
+fMEDFile.setFieldNoProfileSBT(f)
+#
+fMEDFile.write("TargetMesh2.med",0) # 0 is very important here because we want to append to TargetMesh2.med and not to scratch it
+#
+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)
+#
+# Writing and Reading fields on profile using MEDLoader advanced API
+#
+pfl=DataArrayInt.New([1,2,3]) ; pfl.setName("My1stPfl")
+fPart=f.buildSubPart(pfl)
+fPart.setName("fPart")
+#
+fMEDFile2=MEDFileField1TS.New()
+fMEDFile2.setFieldProfile(fPart,meshMEDFileRead,0,pfl)
+fMEDFile2.write("TargetMesh2.med",0) # 0 is very important here because we want to append to TargetMesh2.med and not to scratch it
+#
+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)
+
+#####
+
+m0=MEDCouplingCMesh()
+arr=DataArrayDouble(31,1) ; arr.iota(0.)
+m0.setCoords(arr,arr)
+m0=m0.buildUnstructured()
+m00=m0[::2] ; m00.simplexize(0) ; m01=m0[1::2]
+m0=MEDCouplingUMesh.MergeUMeshes([m00,m01])
+m0.getCoords()[:]*=1/15.
+m0.setName("mesh")
+#
+CellField=MEDCouplingFieldDouble(ON_CELLS,ONE_TIME) ; CellField.setTime(5.6,5,6) ; CellField.setMesh(m0)
+CellField.setName("CellField")
+CellField.fillFromAnalytic(1,"exp(-((x-1)*(x-1)+(y-1)*(y-1)))") ; CellField.getArray().setInfoOnComponent(0,"powercell [W]")
+NodeField=MEDCouplingFieldDouble(ON_NODES,ONE_TIME) ; NodeField.setTime(5.6,5,6) ; NodeField.setMesh(m0)
+NodeField.setName("NodeField")
+NodeField.fillFromAnalytic(1,"exp(-((x-1)*(x-1)+(y-1)*(y-1)))") ; NodeField.getArray().setInfoOnComponent(0,"powernode [W]")
+#
+proc0=m0.getCellsInBoundingBox([(0.,0.4),(0.,0.4)],1e-10)
+proc1=proc0.buildComplement(m0.getNumberOfCells())
+#
+NodeField0=NodeField[proc0] ; NodeField0.getMesh().setName(m0.getName()) ; CellField0=CellField[proc0] ; CellField0.setMesh(NodeField0.getMesh())
+NodeField1=NodeField[proc1] ; NodeField1.getMesh().setName(m0.getName()) ; CellField1=CellField[proc1] ; CellField1.setMesh(NodeField1.getMesh())
+#
+proc0_fname="proc0.med"
+MEDLoader.WriteField(proc0_fname,NodeField0,True)
+MEDLoader.WriteFieldUsingAlreadyWrittenMesh(proc0_fname,CellField0)
+proc1_fname="proc1.med"
+MEDLoader.WriteField(proc1_fname,NodeField1,True)
+MEDLoader.WriteFieldUsingAlreadyWrittenMesh(proc1_fname,CellField1)
+#
+CellField0_read=MEDLoader.ReadFieldCell("proc0.med","mesh",0,"CellField",5,6)
+CellField1_read=MEDLoader.ReadFieldCell("proc1.med","mesh",0,"CellField",5,6)
+CellField_read=MEDCouplingFieldDouble.MergeFields([CellField0_read,CellField1_read])
+CellFieldCpy=CellField.deepCpy()
+CellFieldCpy.substractInPlaceDM(CellField_read,10,1e-12)
+CellFieldCpy.getArray().abs()
+print CellFieldCpy.getArray().isUniform(0.,1e-12)
+#
+NodeField0_read=MEDLoader.ReadFieldNode("proc0.med","mesh",0,"NodeField",5,6)
+NodeField1_read=MEDLoader.ReadFieldNode("proc1.med","mesh",0,"NodeField",5,6)
+NodeField_read=MEDCouplingFieldDouble.MergeFields([NodeField0_read,NodeField1_read])
+NodeField_read.mergeNodes(1e-10)
+NodeFieldCpy=NodeField.deepCpy()
+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)
+#
+fileNames=["proc0.med","proc1.med"]
+msML=[MEDFileMesh.New(fname) for fname in fileNames]
+fsML=[MEDFileFields.New(fname) for fname in fileNames]
+mergeMLMesh=MEDFileUMesh()
+mergeMLFields=MEDFileFields()
+for lev in msML[0].getNonEmptyLevels():
+    o2nML=len(msML[0].getNonEmptyLevels())*[None]
+    cs=[mML.getCoords() for mML in msML]
+    mergeMLMesh.setCoords(DataArrayDouble.Aggregate(cs))
+    ms=[mML.getMeshAtLevel(lev) for mML in msML]
+    m=MEDCouplingUMesh.MergeUMeshes(ms) ; m.setCoords(mergeMLMesh.getCoords())
+    o2nML[lev]=m.sortCellsInMEDFileFrmt()
+    mergeMLMesh.setMeshAtLevel(lev,m)
+    pass
+#
+for fieldName in fsML[0].getFieldsNames():
+    fmts=[fML[fieldName] for fML in fsML]
+    mergeField=MEDFileFieldMultiTS()
+    for dt,it,tim in fmts[0].getTimeSteps():
+        fts=[fmt[dt,it] for fmt in fmts]
+        arrs=len(fts)*[None]
+        for typp in fts[0].getTypesOfFieldAvailable():
+            arr1s=[]
+            if typp==ON_CELLS:
+               for ft in fts:
+                   for geoTyp,smth in ft.getFieldSplitedByType():
+                       if geoTyp!=NORM_ERROR:
+                           smth1=filter(lambda x:x[0]==ON_CELLS,smth)
+                           arr2s=[ft.getUndergroundDataArray()[elt[1][0]:elt[1][1]] for elt in smth1]
+                           arr1s.append(DataArrayDouble.Aggregate(arr2s))
+                           pass
+                       pass
+                   pass
+               pass
+            else:
+                for ft in fts:
+                    smth=filter(lambda x:x[0]==NORM_ERROR,ft.getFieldSplitedByType())
+                    arr2=DataArrayDouble.Aggregate([ft.getUndergroundDataArray()[elt[1][0][1][0]:elt[1][0][1][1]] for elt in smth])
+                    arr1s.append(arr2)
+                    pass
+                pass
+            arr=DataArrayDouble.Aggregate(arr1s)
+            if typp==ON_CELLS:
+               arr.renumberInPlace(o2nML[lev])
+            mcf=MEDCouplingFieldDouble(typp,ONE_TIME) ; mcf.setName(fieldName) ; mcf.setTime(tim,dt,it) ; mcf.setArray(arr)
+            mcf.setMesh(mergeMLMesh.getMeshAtLevel(lev)) ; mcf.checkCoherency()
+            mergeField.appendFieldNoProfileSBT(mcf)
+            pass
+        pass
+    mergeMLFields.pushField(mergeField)
+    pass
+mergeMLMesh.write("merge.med",2)
+mergeMLFields.write("merge.med",0)
+
+#####
+
+arr=DataArrayDouble(11) ; arr.iota(0)
+trgMesh=MEDCouplingCMesh() ; trgMesh.setCoords(arr,arr) ; trgMesh=trgMesh.buildUnstructured()
+#
+arr=DataArrayDouble(21) ; arr.iota(0) ; arr*=0.5
+srcMesh=MEDCouplingCMesh() ; srcMesh.setCoords(arr,arr) ; srcMesh=srcMesh.buildUnstructured()
+#
+tmp=srcMesh[:20] ; tmp.simplexize(0)
+srcMesh=MEDCouplingUMesh.MergeUMeshes([tmp,srcMesh[20:]])
+#
+remap=MEDCouplingRemapper()
+remap.prepare(srcMesh,trgMesh,"P0P0")
+#
+myMatrix=remap.getCrudeMatrix()
+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)
+#
+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]")
+#
+#remap.transferField(srcField,1e300)
+srcField.setNature(ConservativeVolumic)
+trgFieldCV=remap.transferField(srcField,1e300)
+#
+print "ConservativeVolumic %lf == %lf"%(srcField.integral(True)[0],trgFieldCV.integral(True)[0]) ; assert abs(srcField.integral(True)[0]-trgFieldCV.integral(True)[0])<1e-6
+print "ConservativeVolumic %lf != %lf"%(srcField.getArray().accumulate()[0],trgFieldCV.getArray().accumulate()[0]) ; assert abs(srcField.getArray().accumulate()[0]-trgFieldCV.getArray().accumulate()[0])>1e-6
+#
+srcField.setNature(Integral)
+trgFieldI=remap.transferField(srcField,1e300)
+#
+print "IntegralGlobConstraint %lf != %lf"%(srcField.integral(True)[0],trgFieldI.integral(True)[0]) ; assert abs(srcField.integral(True)[0]-trgFieldI.integral(True)[0])>1e-6
+print "IntegralGlobConstraint %lf == %lf"%(srcField.getArray().accumulate()[0],trgFieldI.getArray().accumulate()[0]) ; assert abs(srcField.getArray().accumulate()[0]-trgFieldI.getArray().accumulate()[0])<1e-6
+
+######
+
+from numpy import *
+from math import acos
+
+med_root_dir=os.getenv("MED_ROOT_DIR")
+agitateur_file=os.path.join(os.getenv("MED_ROOT_DIR"),"share","salome","resources","med","agitateur.med")
+data=MEDFileData(agitateur_file)
+ts=data.getFields()[0].getTimeSteps()
+print ts
+#
+fMts=data.getFields()["DISTANCE_INTERFACE_ELEM_BODY_ELEM_DOM"]
+f1ts=fMts[(2,-1)]
+fMc=f1ts.getFieldAtLevel(ON_CELLS,0)
+arr=fMc.getArray()
+arr.getMinMaxPerComponent() # juste pour voir la plage de variation du champ par compo
+ids=arr.getIdsInRange(0.,1.)
+f2Mc=fMc[ids]
+#
+pressMts=data.getFields()["PRESSION_ELEM_DOM"]
+press1ts=pressMts[(2,-1)]
+pressMc=press1ts.getFieldAtLevel(ON_CELLS,0)
+pressOnAgitateurMc=pressMc[ids]
+#
+pressOnAgitateurMc.getMesh().zipCoords()
+#
+agitateurMesh3DMc=pressOnAgitateurMc.getMesh()
+m3DSurf,desc,descI,revDesc,revDescI=agitateurMesh3DMc.buildDescendingConnectivity()
+nbOf3DCellSharing=revDescI.deltaShiftIndex()
+ids2=nbOf3DCellSharing.getIdsEqual(1)
+agitateurSkinMc=m3DSurf[ids2]
+OffsetsOfTupleIdsInField=revDescI[ids2]
+tupleIdsInField=revDesc[OffsetsOfTupleIdsInField]
+pressOnSkinAgitateurMc=pressOnAgitateurMc[tupleIdsInField]
+pressOnSkinAgitateurMc.setMesh(agitateurSkinMc)
+#
+pressSkin=pressOnSkinAgitateurMc.getArray()
+pressSkin*=1e5
+areaSkin=agitateurSkinMc.getMeasureField(True).getArray()
+forceSkin=pressSkin*areaSkin
+normalSkin=agitateurSkinMc.buildOrthogonalField().getArray()
+forceVectSkin=forceSkin*normalSkin
+#
+singlePolyhedron=agitateurMesh3DMc.buildSpreadZonesWithPoly()
+singlePolyhedron.orientCorrectlyPolyhedrons()
+centerOfMass=singlePolyhedron.getBarycenterAndOwner()
+
+barySkin=agitateurSkinMc.getBarycenterAndOwner()
+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
+
+speedMts=data.getFields()["VITESSE_ELEM_DOM"]
+speed1ts=speedMts[(2,-1)]
+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
+
+x2=posSkin[:,0]*posSkin[:,0] ; x2=x2.accumulate()[0]
+y2=posSkin[:,1]*posSkin[:,1] ; y2=y2.accumulate()[0]
+xy=posSkin[:,0]*posSkin[:,1] ; xy=xy.accumulate()[0]
+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
+
+def computeAngle(locAgitateur1ts):
+    fMc=locAgitateur1ts.getFieldAtLevel(ON_CELLS,0)
+    arr=fMc.getArray()
+    ids=arr.getIdsInRange(0.,1.)
+    f2Mc=fMc[ids]
+    m3DSurf,desc,descI,revDesc,revDescI=f2Mc.getMesh().buildDescendingConnectivity()
+    nbOf3DCellSharing=revDescI.deltaShiftIndex()
+    ids2=nbOf3DCellSharing.getIdsEqual(1)
+    agitateurSkinMc=m3DSurf[ids2]
+    #
+    singlePolyhedron=agitateurMesh3DMc.buildSpreadZonesWithPoly()
+    singlePolyhedron.orientCorrectlyPolyhedrons()
+    centerOfMass=singlePolyhedron.getBarycenterAndOwner()
+    bary=agitateurSkinMc.getBarycenterAndOwner()
+    posSkin=bary-centerOfMass
+    x2=posSkin[:,0]*posSkin[:,0] ; x2=x2.accumulate()[0]
+    y2=posSkin[:,1]*posSkin[:,1] ; y2=y2.accumulate()[0]
+    xy=posSkin[:,0]*posSkin[:,1] ; xy=xy.accumulate()[0]
+    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]
+    return vect0
+
+vects=len(ts)*[None]
+for itts,locAgitateur1ts in zip(ts,data.getFields()["DISTANCE_INTERFACE_ELEM_BODY_ELEM_DOM"]):
+    angle=computeAngle(locAgitateur1ts)
+    vects[itts[0]]=angle
+    pass
+
+angle2=len(ts)*[0.]
+for pos in xrange(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]
+    crs/=norm1 ; crs/=norm2 ; crs=min(crs,1.)
+    angle2[pos]=acos(crs)#/(ts[pos][2]-ts[pos-1][2])
+    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)
+assert abs(power/omega-0.37)<1e-2
index e93ae3303dc7847428fc4842a79f8c54dbe71979..22e8cfc28b27994d7c0e7ca897a78ae02e6a4a8c 100644 (file)
@@ -561,6 +561,102 @@ class MEDLoaderDataForTest:
         f.setName("MyFieldOnGaussNE");
         f.checkCoherency();
         return f;
+
+    def buildACompleteMEDDataStructureWithFieldsOnCells_1(cls):
+        coo=DataArrayDouble([0,0,1,0,2,0,0,1,1,1,2,1,0,2,1,2,2,2],9,2)
+        m0=MEDCouplingUMesh("mesh",2)
+        m0.setCoords(coo)
+        m0.allocateCells()
+        m0.insertNextCell(NORM_TRI3,[1,4,2])
+        m0.insertNextCell(NORM_TRI3,[4,5,2])
+        m0.insertNextCell(NORM_QUAD4,[0,3,4,1])
+        m0.insertNextCell(NORM_QUAD4,[6,7,4,3])
+        m0.insertNextCell(NORM_QUAD4,[7,8,5,4])
+        m1=m0.computeSkin()
+        mm=MEDFileUMesh()
+        #2 levels
+        mm.setMeshAtLevel(0,m0) ; mm.setMeshAtLevel(-1,m1)
+        #some grps/families on the 2 levels
+        grp0=DataArrayInt([0,2,4]); grp0.setName("gr0_0_2_4")
+        grp1=DataArrayInt([1,2,3,4]); grp1.setName("gr0_1_2_3_4")
+        grp2=DataArrayInt([0,4]); grp2.setName("gr0_0_4")
+        mm.setGroupsAtLevel(0,[grp0,grp1,grp2])
+        grp3=DataArrayInt([0,1]); grp3.setName("grM1_SegOnTri3")
+        grp4=DataArrayInt([2,3,4,5,6,7]); grp4.setName("grM1_SegOnQuad4")
+        grp5=DataArrayInt([0,3]); grp5.setName("grM1_bottom")
+        mm.setGroupsAtLevel(-1,[grp3,grp4,grp5])
+        ms=MEDFileMeshes()
+        ms.pushMesh(mm)
+        # 3 fields
+        fs=MEDFileFields()
+        # 1st Field - fNoProfile - no profile on levels 0
+        f1Name="fNoProfile"
+        timeStepsF1=[(0,-1,0.01),(1,-1,0.02)]
+        f1=MEDFileFieldMultiTS()
+        for i,(it,order,tim) in enumerate(timeStepsF1):
+            f11Tmp=MEDCouplingFieldDouble(ON_CELLS,ONE_TIME)
+            f11Tmp.setTime(tim,it,order)
+            f11Tmp.setMesh(m0)
+            arr=DataArrayDouble(m0.getNumberOfCells(),1) ; arr.iota() ; arr+=1+i ; arr*=0.1
+            f11Tmp.setArray(arr)
+            f11Tmp.checkCoherency()
+            f11Tmp.setName(f1Name)
+            f1.appendFieldNoProfileSBT(f11Tmp)
+            pass
+        fs.pushField(f1)
+        # 2nd Field - fNoProfileMultiLevs - no profile on levels 0 and -1
+        f2Name="fNoProfileMultiLevs"
+        timeStepsF2=[(0,-1,0.),(1,-1,0.1),(2,-1,0.2)]
+        f2=MEDFileFieldMultiTS()
+        for i,(it,order,tim) in enumerate(timeStepsF2):
+            f21Tmp=MEDCouplingFieldDouble(ON_CELLS,ONE_TIME)
+            f21Tmp.setTime(tim,it,order)
+            f21Tmp.setMesh(m0)
+            arr=DataArrayDouble(m0.getNumberOfCells(),1) ; arr.iota() ; arr+=1+i
+            f21Tmp.setArray(arr)
+            f21Tmp.checkCoherency()
+            f21Tmp.setName(f2Name)
+            f2.appendFieldNoProfileSBT(f21Tmp)
+            f22Tmp=MEDCouplingFieldDouble(ON_CELLS,ONE_TIME)
+            f22Tmp.setTime(tim,it,order)
+            f22Tmp.setMesh(m1)
+            arr=DataArrayDouble(m1.getNumberOfCells(),1) ; arr.iota() ; arr+=100+1+i
+            f22Tmp.setArray(arr)
+            f22Tmp.checkCoherency()
+            f22Tmp.setName(f2Name)
+            f2[it,order].setFieldNoProfileSBT(f22Tmp)
+            pass
+        fs.pushField(f2)
+        # 3rd field - fProfileMultiLevs - The most complex one
+        f3Name="fProfileMultiLevs"
+        timeStepsF3=[(0,-1,0.),(1,-1,10.),(2,-1,20.),(3,-1,30.),]
+        f3=MEDFileFieldMultiTS()
+        for i,(it,order,tim) in enumerate(timeStepsF3):
+            pfl1=DataArrayInt([0,1,3,4]) ; pfl1.setName("pfl1")
+            m0Part=m0[pfl1]
+            f31Tmp=MEDCouplingFieldDouble(ON_CELLS,ONE_TIME)
+            f31Tmp.setTime(tim,it,order)
+            f31Tmp.setMesh(m0Part)
+            arr=DataArrayDouble(m0Part.getNumberOfCells(),1) ; arr.iota() ; arr+=1000+i+1
+            f31Tmp.setArray(arr)
+            f31Tmp.checkCoherency()
+            f31Tmp.setName(f3Name)
+            f3.appendFieldProfile(f31Tmp,mm,0,pfl1)
+            pfl2=DataArrayInt([0,3]) ; pfl2.setName("pfl2Bottom")
+            m1Part=m1[pfl2]
+            f32Tmp=MEDCouplingFieldDouble(ON_CELLS,ONE_TIME)
+            f32Tmp.setTime(tim,it,order)
+            f32Tmp.setMesh(m1Part)
+            arr=DataArrayDouble(m1Part.getNumberOfCells(),1) ; arr.iota() ; arr+=2000+1+i
+            f32Tmp.setArray(arr)
+            f32Tmp.checkCoherency()
+            f32Tmp.setName(f3Name)
+            f3[it,order].setFieldProfile(f32Tmp,mm,-1,pfl2)
+            pass
+        fs.pushField(f3)
+        #
+        data=MEDFileData() ; data.setMeshes(ms) ; data.setFields(fs)
+        return data
     
     build1DMesh_1=classmethod(build1DMesh_1)
     build2DCurveMesh_1=classmethod(build2DCurveMesh_1)
@@ -578,4 +674,5 @@ class MEDLoaderDataForTest:
     buildVecFieldOnGauss_2=classmethod(buildVecFieldOnGauss_2)
     buildVecFieldOnGauss_2_Simpler=classmethod(buildVecFieldOnGauss_2_Simpler)
     buildVecFieldOnGaussNE_1=classmethod(buildVecFieldOnGaussNE_1)
+    buildACompleteMEDDataStructureWithFieldsOnCells_1=classmethod(buildACompleteMEDDataStructureWithFieldsOnCells_1)
     pass
diff --git a/src/MEDLoader/Swig/MEDLoaderSplitter.py b/src/MEDLoader/Swig/MEDLoaderSplitter.py
new file mode 100644 (file)
index 0000000..b7388b6
--- /dev/null
@@ -0,0 +1,115 @@
+#  -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2013  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.
+#
+# 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 (CEA/DEN/DM2S/STMF/LGLS)
+
+from MEDLoader import *
+import os
+
+class MEDLoaderSplitter:
+    @classmethod
+    def New(cls,mfd,idsLst):
+        """ mfd is a MEDFileData instance containing only one mesh. idsLst is a list of DataArrayInt containing each the ids per processor """
+        return MEDLoaderSplitter(fileName)
+        pass
+
+    def __init__(self,mfd,idsLst):
+        """ mfd is a MEDFileData instance containing only one mesh. idsLst is a list of DataArrayInt containing each the ids per processor """
+        mfmsh=mfd.getMeshes()
+        mfflds=mfd.getFields()
+        if len(mfmsh)!=1:
+            raise InterpKernelException("Works only with one mesh !")
+        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))]
+        for a,b,c in zip(self._mfd_splitted,retf,retm):
+            a.setFields(b) ; a.setMeshes(c)
+            pass
+        pass
+
+    def getSplittedInstances(self):
+        return self._mfd_splitted
+    
+    @classmethod
+    def __splitMEDFileField1TSNode(cls,f,f1ts,ids):
+        fRet=f[ids]
+        f1ts.setFieldNoProfileSBT(fRet)
+        pass
+    
+    @classmethod
+    def __splitMEDFileField1TSCell(cls,f,f1ts,ids):
+        fRet=f[ids]
+        m=fRet.getMesh() ; m.zipCoords()
+        o2n=m.getRenumArrForMEDFileFrmt() ; fRet.renumberCells(o2n,False)
+        f1ts.setFieldNoProfileSBT(fRet)
+        pass
+    
+    def __splitMEDFileField1TS(self,mm,f1ts,idsLst):
+        ret=[MEDFileField1TS() for i in xrange(len(idsLst))]
+        dico={ON_CELLS:self.__splitMEDFileField1TSCell,
+              ON_NODES:self.__splitMEDFileField1TSNode,
+              ON_GAUSS_PT:self.__splitMEDFileField1TSCell,
+              ON_GAUSS_NE:self.__splitMEDFileField1TSCell}
+        for t in f1ts.getTypesOfFieldAvailable():
+            f=f1ts.getFieldOnMeshAtLevel(t,0,mm)
+            for i,f0 in enumerate(ret):
+                dico[t](f,f0,idsLst[i])
+                pass
+            pass
+        return ret
+    
+    def __splitFields(self,mm,mfflds,idsLst):
+        ret0=[MEDFileFields() for i in xrange(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())
+                continue
+            pass
+            ret1=[MEDFileFieldMultiTS() for i in xrange(len(idsLst))]
+            for f1ts in fmts:
+                for fmtsPart,f1tsPart in zip(ret1,self.__splitMEDFileField1TS(mm,f1ts,idsLst)):
+                    fmtsPart.pushBackTimeStep(f1tsPart)
+                    pass
+                pass
+            for fieldsPart,fmtsPart in zip(ret0,ret1):
+                fieldsPart.pushField(fmtsPart);
+                pass
+            pass
+        return ret0
+
+    def __splitMesh(self,mfm,idsLst):
+        ret0=[MEDFileMeshes() for i in xrange(len(idsLst))]
+        m=mfm.getMeshAtLevel(0)
+        for ret,ids in zip(ret0,idsLst):
+            mlPart=mfm.createNewEmpty()
+            mPart=m[ids] ; trad=mPart.zipCoordsTraducer()
+            trad=trad.invertArrayO2N2N2O(mPart.getNumberOfNodes())
+            mlPart.setMeshAtLevel(0,mPart)
+            if 0 in mfm.getFamArrNonEmptyLevelsExt():
+                mlPart.setFamilyFieldArr(0,mfm.getFamilyFieldAtLevel(0)[ids])
+                pass
+            if 1 in mfm.getFamArrNonEmptyLevelsExt():
+                mlPart.setFamilyFieldArr(1,mfm.getFamilyFieldAtLevel(1)[trad])
+                pass
+            mlPart.copyFamGrpMapsFrom(mfm)
+            ret.pushMesh(mlPart)
+            pass
+        return ret0
+    pass
index 7bd35431804b5d439e865f43bdf83379cd1559b1..9e0257a94e9085968bd4e9f82829c77d8933a295 100644 (file)
@@ -271,20 +271,20 @@ class MEDLoaderTest(unittest.TestCase):
         res=mm.isEqual(mm2,1e-12)
         self.assertTrue(res[0])
         l=list(mm2.getFamiliesOnGroup("G2")) ; l.sort()
-        self.assertEqual(['Family_10','Family_11','Family_3','Family_4','Family_7'],l)
+        self.assertEqual(['Family_-3','Family_-4','Family_-7','Family_10','Family_11'],l)
         mm2.keepFamIdsOnlyOnLevs([3],[-1])
         for lev in mm.getGrpNonEmptyLevelsExt("G2"):
             self.assertEqual(mm.getGroupArr(lev,"G2").getValues(),mm2.getGroupArr(lev,"G2").getValues())
             pass
         l=list(mm2.getFamiliesOnGroup("G2")) ; l.sort()
-        self.assertEqual(['Family_10','Family_11','Family_12','Family_3','Family_4','Family_7'],l)
+        self.assertEqual(['Family_-3','Family_-4','Family_-7','Family_10','Family_11'],l)
         #
-        self.assertEqual([7,7,6],mm2.getFamilyFieldAtLevel(-1).getValues())
-        mm2.getFamilyFieldAtLevel(-1).setIJ(1,0,8)
-        self.assertEqual([7,8,6],mm2.getFamilyFieldAtLevel(-1).getValues())
-        self.assertTrue(not mm2.existsFamily("Family_8"))
+        self.assertEqual([-7,-7,-6],mm2.getFamilyFieldAtLevel(-1).getValues())
+        mm2.getFamilyFieldAtLevel(-1).setIJ(1,0,-8)
+        self.assertEqual([-7,-8,-6],mm2.getFamilyFieldAtLevel(-1).getValues())
+        self.assertTrue(not mm2.existsFamily("Family_-8"))
         mm2.createGroupOnAll(-1,"GrpOnAllFace")
-        self.assertTrue(mm2.existsFamily("Family_8"))
+        self.assertTrue(mm2.existsFamily("Family_-8"))
         self.assertEqual(range(3),mm2.getGroupArr(-1,"GrpOnAllFace").getValues())
         pass
 
@@ -418,7 +418,7 @@ class MEDLoaderTest(unittest.TestCase):
     def testMEDField2(self):
         mm=MEDFileMesh.New("Pyfile19.med")
         mm.write("Pyfile19_bis.med",2)
-        ff=MEDFileFieldMultiTS.New("Pyfile19.med","VFieldOnNodes")
+        ff=MEDFileFieldMultiTS.New("Pyfile19.med")
         ff.write("Pyfile19_bis.med",0)
         self.assertEqual([('tyty','mm'),('uiop','MW')],MEDLoader.GetComponentsNamesOfField("Pyfile19_bis.med","VFieldOnNodes"))
         pass
@@ -993,9 +993,9 @@ class MEDLoaderTest(unittest.TestCase):
         g3=DataArrayInt.New() ; g3.setValues([1,2,3],3,1) ; g3.setName("g3")
         mm.setGroupsAtLevel(0,[g1,g2],False)
         self.assertEqual(('g1','g2'),mm.getGroupsNames())
-        self.assertEqual(('Family_2','Family_3'),mm.getFamiliesNames())
-        self.assertEqual(('Family_2',),mm.getFamiliesOnGroup('g1'))
-        self.assertEqual(('Family_3',),mm.getFamiliesOnGroup('g2'))
+        self.assertEqual(('Family_-2','Family_-3'),mm.getFamiliesNames())
+        self.assertEqual(('Family_-2',),mm.getFamiliesOnGroup('g1'))
+        self.assertEqual(('Family_-3',),mm.getFamiliesOnGroup('g2'))
         mm.assignFamilyNameWithGroupName()
         self.assertEqual(('g1','g2'),mm.getGroupsNames())
         self.assertEqual(('g1','g2'),mm.getFamiliesNames())
@@ -1006,16 +1006,16 @@ class MEDLoaderTest(unittest.TestCase):
         mm.setMeshAtLevel(0,m)
         mm.setGroupsAtLevel(0,[g1,g2,g3],False)
         self.assertEqual(('g1','g2','g3'),mm.getGroupsNames())
-        self.assertEqual(('Family_2', 'Family_4', 'Family_5'),mm.getFamiliesNames())
-        self.assertEqual(('Family_2', 'Family_4'),mm.getFamiliesOnGroup('g1'))
-        self.assertEqual(('Family_5',),mm.getFamiliesOnGroup('g2'))
-        self.assertEqual(('Family_4','Family_5',),mm.getFamiliesOnGroup('g3'))
+        self.assertEqual(('Family_-2', 'Family_-4', 'Family_-5'),mm.getFamiliesNames())
+        self.assertEqual(('Family_-2', 'Family_-4'),mm.getFamiliesOnGroup('g1'))
+        self.assertEqual(('Family_-5',),mm.getFamiliesOnGroup('g2'))
+        self.assertEqual(('Family_-4','Family_-5',),mm.getFamiliesOnGroup('g3'))
         mm.assignFamilyNameWithGroupName() # here it does nothing because no such group-family bijection found
         self.assertEqual(('g1','g2','g3'),mm.getGroupsNames())
-        self.assertEqual(('Family_2', 'Family_4', 'Family_5'),mm.getFamiliesNames())
-        self.assertEqual(('Family_2', 'Family_4'),mm.getFamiliesOnGroup('g1'))
-        self.assertEqual(('Family_5',),mm.getFamiliesOnGroup('g2'))
-        self.assertEqual(('Family_4','Family_5',),mm.getFamiliesOnGroup('g3'))
+        self.assertEqual(('Family_-2', 'Family_-4', 'Family_-5'),mm.getFamiliesNames())
+        self.assertEqual(('Family_-2', 'Family_-4'),mm.getFamiliesOnGroup('g1'))
+        self.assertEqual(('Family_-5',),mm.getFamiliesOnGroup('g2'))
+        self.assertEqual(('Family_-4','Family_-5',),mm.getFamiliesOnGroup('g3'))
         mm.changeFamilyId(5,6)
         g=mm.getGroupArr(0,"g3")
         self.assertTrue(g.isEqual(g3));
@@ -1921,18 +1921,18 @@ class MEDLoaderTest(unittest.TestCase):
         daTest=DataArrayInt([1,3,4,6,9,10,12]) ; daTest.setName("grp1")
         mm.addGroup(0,daTest)
         self.assertTrue(mm.getGroupArr(0,daTest.getName()).isEqual(daTest))
-        self.assertTrue(mm.getFamilyFieldAtLevel(0).isEqual(DataArrayInt([6,2,6,8,2,6,5,6,6,7,7,4,8])))
+        self.assertTrue(mm.getFamilyFieldAtLevel(0).isEqual(DataArrayInt([-6,2,-6,-8,2,-6,-5,-6,-6,-7,-7,-4,-8])))
         for lev,arr in [(1,da0),(-1,da1),(-2,da2)]:
             self.assertTrue(mm.getFamilyFieldAtLevel(lev).isEqual(arr))
             pass
-        self.assertEqual(mm.getFamiliesNames(),('Family_4','Family_5','Family_7','Family_8','MyFam','MyOther-1','MyOtherFam'))
+        self.assertEqual(mm.getFamiliesNames(),('Family_-4','Family_-5','Family_-7','Family_-8','MyFam','MyOther-1','MyOtherFam'))
         self.assertEqual(mm.getGroupsNames(),('grp0','grp1','grpA'))
         self.assertEqual(mm.getFamilyNameGivenId(3),'MyOtherFam')
         self.assertEqual(mm.getFamilyNameGivenId(2),'MyFam')
-        for famName,famId in [('Family_4',4),('Family_5',5),('Family_7',7),('Family_8',8)]:
+        for famName,famId in [('Family_-4',-4),('Family_-5',-5),('Family_-7',-7),('Family_-8',-8)]:
             self.assertEqual(mm.getFamilyNameGivenId(famId),famName)
             pass
-        self.assertEqual(mm.getFamiliesOnGroup("grp0"),('MyOtherFam','Family_8'))
+        self.assertEqual(mm.getFamiliesOnGroup("grp0"),('MyOtherFam','Family_-8'))
         da=DataArrayInt([3,12]) ; da.setName("grp0")
         self.assertTrue(mm.getGroupArr(0,"grp0").isEqual(da))
         da.setValues([1])
@@ -1940,18 +1940,18 @@ class MEDLoaderTest(unittest.TestCase):
         mm.write(fname,2)
         mm=MEDFileMesh.New(fname)
         self.assertTrue(mm.getGroupArr(0,daTest.getName()).isEqual(daTest))
-        self.assertTrue(mm.getFamilyFieldAtLevel(0).isEqual(DataArrayInt([6,2,6,8,2,6,5,6,6,7,7,4,8])))
+        self.assertTrue(mm.getFamilyFieldAtLevel(0).isEqual(DataArrayInt([-6,2,-6,-8,2,-6,-5,-6,-6,-7,-7,-4,-8])))
         for lev,arr in [(1,da0),(-1,da1),(-2,da2)]:
             self.assertTrue(mm.getFamilyFieldAtLevel(lev).isEqual(arr))
             pass
-        self.assertEqual(mm.getFamiliesNames(),('FAMILLE_ZERO','Family_4','Family_5','Family_7','Family_8','MyFam','MyOther-1','MyOtherFam'))
+        self.assertEqual(mm.getFamiliesNames(),('FAMILLE_ZERO','Family_-4','Family_-5','Family_-7','Family_-8','MyFam','MyOther-1','MyOtherFam'))
         self.assertEqual(mm.getGroupsNames(),('grp0','grp1','grpA'))
         self.assertEqual(mm.getFamilyNameGivenId(3),'MyOtherFam')
         self.assertEqual(mm.getFamilyNameGivenId(2),'MyFam')
-        for famName,famId in [('Family_4',4),('Family_5',5),('Family_7',7),('Family_8',8)]:
+        for famName,famId in [('Family_-4',-4),('Family_-5',-5),('Family_-7',-7),('Family_-8',-8)]:
             self.assertEqual(mm.getFamilyNameGivenId(famId),famName)
             pass
-        self.assertEqual(mm.getFamiliesOnGroup("grp0"),('Family_8','MyOtherFam'))
+        self.assertEqual(mm.getFamiliesOnGroup("grp0"),('Family_-8','MyOtherFam'))
         da=DataArrayInt([3,12]) ; da.setName("grp0")
         self.assertTrue(mm.getGroupArr(0,"grp0").isEqual(da))
         da.setValues([1])
@@ -2190,6 +2190,578 @@ class MEDLoaderTest(unittest.TestCase):
         splitOfM1[0].isEqual(DataArrayInt([0,1,2,3,6,8,10,11,12,13]))
         splitOfM1[1].isEqual(DataArrayInt([4,5,7,9,14,15]))
         pass
+
+    def testBugCorrection1(self):
+        fs=MEDFileFields()
+        fs.resize(3)
+        self.assertEqual(fs[0],None)
+        self.assertEqual(3,len(fs))
+        pass
+
+    def testCompareMEDFilesContainingOnlyFieldsOnCell1(self):
+        f1Name="Pyfile60.med"
+        f2Name="Pyfile61.med"
+        d1=MEDLoaderDataForTest.buildACompleteMEDDataStructureWithFieldsOnCells_1()
+        d1.write(f1Name,2)
+        d2=MEDLoaderDataForTest.buildACompleteMEDDataStructureWithFieldsOnCells_1()
+        d2.write(f2Name,2)
+        # reading and compare
+        d1=MEDFileData(f1Name) ; d2=MEDFileData(f2Name)
+        for mn in d1.getMeshes().getMeshesNames():
+            m1=d1.getMeshes()[mn]
+            m2=d2.getMeshes()[mn]
+            for lev in m1.getNonEmptyLevels():
+                grpsNames=m1.getGroupsOnSpecifiedLev(lev)
+                for grpName in grpsNames:
+                    self.assertTrue(m1.getGroupArr(lev,grpName).isEqual(m2.getGroupArr(lev,grpName))) # compare groups
+                    pass
+                pass
+            pass
+        for fieldn in d1.getFields().getFieldsNames():
+            f1=d1.getFields()[fieldn]
+            f2=d2.getFields()[fieldn]
+            for it,order,tim in f1.getTimeSteps():
+                f1t=f1[it,order]
+                f2t=f2[it,order]
+                if len(f1t.getPflsReallyUsed())!=0:
+                    # profile case
+                    for lev in f1t.getNonEmptyLevels()[1]:
+                        arr1,pfl1=f1t.getFieldWithProfile(ON_CELLS,lev,m1)
+                        arr2,pfl2=f2t.getFieldWithProfile(ON_CELLS,lev,m2)
+                        self.assertTrue(pfl1.isEqual(pfl2))
+                        self.assertTrue(arr1.isEqual(arr2,1e-10))
+                        pass
+                    pass
+                else:
+                    # no profile case
+                    for lev in f1t.getNonEmptyLevels()[1]:
+                        f1mc=f1t.getFieldOnMeshAtLevel(ON_CELLS,lev,m1)
+                        f2mc=f2t.getFieldOnMeshAtLevel(ON_CELLS,lev,m2)
+                        self.assertTrue(f1mc.isEqual(f2mc,1e-10,1e-10))
+                        pass
+                    pass
+                pass
+            pass
+        pass
+
+    def testNonRegBugNormalizeFamIdsMEDFile1(self):
+        m=MEDCouplingCMesh()
+        arr=DataArrayDouble([0.,1.,2.,3.,4.])
+        m.setCoords(arr,arr,arr)
+        m=m.buildUnstructured()
+        m2=m.buildDescendingConnectivity()[0]
+        m.setName("mesh")
+        g1=DataArrayInt([0,1,2,3]) ; g1.setName("g1")
+        g2=DataArrayInt([2,3,5,6]) ; g2.setName("g2")
+        g1Face=DataArrayInt([20,21,22,23]) ; g1Face.setName("g1Face")
+        g2Face=DataArrayInt([22,23,25,26]) ; g2Face.setName("g2Face")
+        g1Node=DataArrayInt([10,11,12,13]) ; g1Node.setName("g1Node")
+        g2Node=DataArrayInt([12,13,15,16]) ; g2Node.setName("g2Node")
+        mm=MEDFileUMesh()
+        mm.setMeshAtLevel(0,m)
+        mm.setGroupsAtLevel(0,[g1,g2])
+        s1=set(mm.getFamiliesOnGroup("g1")) ; s2=set(mm.getFamiliesOnGroup("g2"))
+        self.assertEqual(mm.getGrpNonEmptyLevelsExt("g1"),(0,))
+        self.assertEqual(mm.getGrpNonEmptyLevelsExt("g2"),(0,))
+        mm.normalizeFamIdsMEDFile()
+        self.assertEqual(mm.getGrpNonEmptyLevelsExt("g1"),(0,))
+        self.assertEqual(mm.getGrpNonEmptyLevelsExt("g2"),(0,))
+        self.assertTrue(mm.getGroupArr(0,"g1").isEqual(g1))
+        self.assertTrue(mm.getGroupArr(0,"g2").isEqual(g2))
+        self.assertEqual(s1,set(mm.getFamiliesOnGroup("g1")))
+        self.assertEqual(s2,set(mm.getFamiliesOnGroup("g2")))
+        for g in mm.getGroupsOnSpecifiedLev(0):
+            for f in mm.getFamiliesIdsOnGroup(g):
+                self.assertTrue(f<0)
+                pass
+            pass
+        #
+        mm=MEDFileUMesh()
+        mm.setMeshAtLevel(0,m)
+        mm.setMeshAtLevel(-1,m2)
+        mm.setGroupsAtLevel(0,[g1,g2])
+        mm.setGroupsAtLevel(-1,[g1Face,g2Face])
+        s1=set(mm.getFamiliesOnGroup("g1")) ; s2=set(mm.getFamiliesOnGroup("g2"))
+        s3=set(mm.getFamiliesOnGroup("g1Face")) ; s4=set(mm.getFamiliesOnGroup("g2Face"))
+        self.assertEqual(mm.getGrpNonEmptyLevelsExt("g1"),(0,))
+        self.assertEqual(mm.getGrpNonEmptyLevelsExt("g2"),(0,))
+        self.assertEqual(mm.getGrpNonEmptyLevelsExt("g1Face"),(-1,))
+        self.assertEqual(mm.getGrpNonEmptyLevelsExt("g2Face"),(-1,))
+        mm.normalizeFamIdsMEDFile()
+        self.assertEqual(mm.getGrpNonEmptyLevelsExt("g1"),(0,))
+        self.assertEqual(mm.getGrpNonEmptyLevelsExt("g2"),(0,))
+        self.assertEqual(mm.getGrpNonEmptyLevelsExt("g1Face"),(-1,))
+        self.assertEqual(mm.getGrpNonEmptyLevelsExt("g2Face"),(-1,))
+        self.assertTrue(mm.getGroupArr(0,"g1").isEqual(g1))
+        self.assertTrue(mm.getGroupArr(0,"g2").isEqual(g2))
+        self.assertTrue(mm.getGroupArr(-1,"g1Face").isEqual(g1Face))
+        self.assertTrue(mm.getGroupArr(-1,"g2Face").isEqual(g2Face))
+        self.assertEqual(s1,set(mm.getFamiliesOnGroup("g1")))
+        self.assertEqual(s2,set(mm.getFamiliesOnGroup("g2")))
+        self.assertEqual(s3,set(mm.getFamiliesOnGroup("g1Face")))
+        self.assertEqual(s4,set(mm.getFamiliesOnGroup("g2Face")))
+        for lev in [0,-1]:
+            for g in mm.getGroupsOnSpecifiedLev(lev):
+                for f in mm.getFamiliesIdsOnGroup(g):
+                    self.assertTrue(f<0)
+                    pass
+                pass
+            pass
+         #
+        mm=MEDFileUMesh()
+        mm.setMeshAtLevel(0,m)
+        mm.setMeshAtLevel(-1,m2)
+        mm.setGroupsAtLevel(0,[g1,g2])
+        mm.setGroupsAtLevel(-1,[g1Face,g2Face])
+        mm.setGroupsAtLevel(1,[g1Node,g2Node])
+        s1=set(mm.getFamiliesOnGroup("g1")) ; s2=set(mm.getFamiliesOnGroup("g2"))
+        s3=set(mm.getFamiliesOnGroup("g1Face")) ; s4=set(mm.getFamiliesOnGroup("g2Face"))
+        s5=set(mm.getFamiliesOnGroup("g1Node")) ; s6=set(mm.getFamiliesOnGroup("g2Node"))
+        self.assertEqual(mm.getGrpNonEmptyLevelsExt("g1"),(0,))
+        self.assertEqual(mm.getGrpNonEmptyLevelsExt("g2"),(0,))
+        self.assertEqual(mm.getGrpNonEmptyLevelsExt("g1Face"),(-1,))
+        self.assertEqual(mm.getGrpNonEmptyLevelsExt("g2Face"),(-1,))
+        self.assertEqual(mm.getGrpNonEmptyLevelsExt("g1Node"),(1,))
+        self.assertEqual(mm.getGrpNonEmptyLevelsExt("g2Node"),(1,))
+        mm.normalizeFamIdsMEDFile()
+        self.assertEqual(mm.getGrpNonEmptyLevelsExt("g1"),(0,))
+        self.assertEqual(mm.getGrpNonEmptyLevelsExt("g2"),(0,))
+        self.assertEqual(mm.getGrpNonEmptyLevelsExt("g1Face"),(-1,))
+        self.assertEqual(mm.getGrpNonEmptyLevelsExt("g2Face"),(-1,))
+        self.assertEqual(mm.getGrpNonEmptyLevelsExt("g1Node"),(1,))
+        self.assertEqual(mm.getGrpNonEmptyLevelsExt("g2Node"),(1,))
+        self.assertTrue(mm.getGroupArr(0,"g1").isEqual(g1))
+        self.assertTrue(mm.getGroupArr(0,"g2").isEqual(g2))
+        self.assertTrue(mm.getGroupArr(-1,"g1Face").isEqual(g1Face))
+        self.assertTrue(mm.getGroupArr(-1,"g2Face").isEqual(g2Face))
+        self.assertTrue(mm.getGroupArr(1,"g1Node").isEqual(g1Node))
+        self.assertTrue(mm.getGroupArr(1,"g2Node").isEqual(g2Node))
+        self.assertEqual(s1,set(mm.getFamiliesOnGroup("g1")))
+        self.assertEqual(s2,set(mm.getFamiliesOnGroup("g2")))
+        self.assertEqual(s3,set(mm.getFamiliesOnGroup("g1Face")))
+        self.assertEqual(s4,set(mm.getFamiliesOnGroup("g2Face")))
+        self.assertEqual(s5,set(mm.getFamiliesOnGroup("g1Node")))
+        self.assertEqual(s6,set(mm.getFamiliesOnGroup("g2Node")))
+        for lev in [0,-1]:
+            for g in mm.getGroupsOnSpecifiedLev(lev):
+                for f in mm.getFamiliesIdsOnGroup(g):
+                    self.assertTrue(f<0)
+                    pass
+                pass
+            pass
+        for g in mm.getGroupsOnSpecifiedLev(1):
+            for f in mm.getFamiliesIdsOnGroup(g):
+                self.assertTrue(f>0)
+                pass
+            pass
+        pass
+    
+    def testNonRegressionMantis22212ChangeGrpName(self):
+        fileName="Pyfile62.med"
+        m2,m1,m0,f2,f1,f0,p,n2,n1,n0,fns,fids,grpns,famIdsPerGrp=MEDLoaderDataForTest.buildMultiLevelMesh_1()
+        m=MEDFileUMesh.New()
+        m.setCoords(m2.getCoords())
+        m.setMeshAtLevel(0,m2)
+        m.setMeshAtLevel(-1,m1)
+        m.setMeshAtLevel(-2,m0)
+        m.setFamilyFieldArr(0,f2)
+        m.setFamilyFieldArr(-1,f1)
+        m.setFamilyFieldArr(-2,f0)
+        m.setFamilyFieldArr(1,p)
+        nbOfFams=len(fns)
+        for i in xrange(nbOfFams):
+            m.addFamily(fns[i],fids[i])
+            pass
+        nbOfGrps=len(grpns)
+        for i in xrange(nbOfGrps):
+            m.setFamiliesIdsOnGroup(grpns[i],famIdsPerGrp[i])
+            pass
+        m.setName(m2.getName())
+        m.setDescription(m2.getDescription())
+        m.write(fileName,2)
+        #
+        mm0=MEDFileMesh.New(fileName)
+        mm1=MEDFileMesh.New(fileName)
+        groupNamesIni=MEDLoader.GetMeshGroupsNames(fileName,"ma")
+        for name in groupNamesIni:
+            mm1.changeGroupName(name,name+'N')
+            pass
+        mm1.write(fileName,2)
+        del mm1
+        #
+        mm2=MEDFileMesh.New(fileName)
+        for name in groupNamesIni:
+            for lev in mm0.getGrpNonEmptyLevelsExt(name):
+                arr0=mm0.getGroupArr(lev,name)
+                arr2=mm2.getGroupArr(lev,name+'N')
+                arr0.setName(name+'N')
+                self.assertTrue(arr0.isEqual(arr2))
+                pass
+            pass
+        pass
+
+    def testInt32InMEDFileFieldStar1(self):
+        fname="Pyfile63.med"
+        f1=MEDLoaderDataForTest.buildVecFieldOnCells_1();
+        arr=f1.getArray().convertToIntArr()
+        f1.setArray(None)
+        m1=f1.getMesh()
+        mm1=MEDFileUMesh.New()
+        mm1.setCoords(m1.getCoords())
+        mm1.setMeshAtLevel(0,m1)
+        mm1.setName(m1.getName())
+        mm1.write(fname,2)
+        ff1=MEDFileIntField1TS()
+        ff1.setFieldNoProfileSBT(f1,arr)
+        a,b=ff1.getFieldOnMeshAtLevel(0,ON_CELLS,mm1)
+        self.assertEqual(b.getInfoOnComponents(),['power [MW/m^3]','density [g/cm^3]','temperature [K]'])
+        self.assertTrue(b.isEqual(arr))
+        self.assertTrue(a.isEqual(f1,1e-12,1e-12))
+        ff1.write(fname,0)
+        ff2=MEDFileAnyTypeField1TS.New(fname)
+        self.assertEqual(ff2.getName(),"VectorFieldOnCells")
+        self.assertEqual(ff2.getTime(),[0,1,2.0])
+        self.assertTrue(isinstance(ff2,MEDFileIntField1TS))
+        a,b=ff1.getFieldOnMeshAtLevel(0,ON_CELLS,mm1)
+        self.assertEqual(b.getInfoOnComponents(),['power [MW/m^3]','density [g/cm^3]','temperature [K]'])
+        self.assertTrue(b.isEqual(arr))
+        self.assertTrue(a.isEqual(f1,1e-12,1e-12))
+        ff2.setTime(1,2,3.)
+        c=ff2.getUndergroundDataArray() ; c*=2
+        ff2.write(fname,0) # 2 time steps in 
+        ffs1=MEDFileAnyTypeFieldMultiTS.New(fname,"VectorFieldOnCells")
+        self.assertEqual(ffs1.getTimeSteps(),[(0, 1, 2.0), (1, 2, 3.0)])
+        self.assertEqual(len(ffs1),2)
+        self.assertTrue(isinstance(ffs1,MEDFileIntFieldMultiTS))
+        a,b=ffs1[2.].getFieldOnMeshAtLevel(0,ON_CELLS,mm1)
+        self.assertTrue(b.isEqual(arr))
+        self.assertTrue(a.isEqual(f1,1e-12,1e-12))
+        a,b=ffs1[2.].getFieldOnMeshAtLevel(0,ON_CELLS,mm1)
+        self.assertTrue(b.isEqual(arr))
+        self.assertTrue(a.isEqual(f1,1e-12,1e-12))
+        it=ffs1.__iter__() ; it.next() ; ff2bis=it.next()
+        a,b=ff2bis.getFieldOnMeshAtLevel(0,ON_CELLS,mm1)
+        self.assertTrue(b.isEqual(2*arr))
+        f1.setTime(3.,1,2)
+        self.assertTrue(a.isEqual(f1,1e-12,1e-12))
+        bc=DataArrayInt(6,3) ; bc[:]=0 ; bc.setInfoOnComponents(['power [MW/m^3]','density [g/cm^3]','temperature [K]'])
+        for it in ffs1:
+            a,b=it.getFieldOnMeshAtLevel(0,ON_CELLS,mm1)
+            bc+=b
+            pass
+        self.assertTrue(bc.isEqual(3*arr))
+        nf1=MEDCouplingFieldDouble(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]
+        nf1.setName("VectorFieldOnNodes")
+        nff1=MEDFileIntField1TS.New()
+        nff1.setFieldNoProfileSBT(nf1,narr)
+        self.assertEqual(nff1.getInfo(),('aa [u1]','bbbvv [ppp]'))
+        self.assertEqual(nff1.getTime(),[10,-1,9.0])
+        nff1.write(fname,0)
+        #
+        nf2=MEDCouplingFieldDouble(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]
+        nf2.setName("VectorFieldOnNodesPfl") ; narr2.setName(nf2.getName())
+        nff2=MEDFileIntField1TS.New()
+        npfl=DataArrayInt([1,2,4,5,6,7,10,11]) ; npfl.setName("npfl")
+        nff2.setFieldProfile(nf2,narr2,mm1,0,npfl)
+        nff2.getFieldWithProfile(ON_NODES,0,mm1)
+        a,b=nff2.getFieldWithProfile(ON_NODES,0,mm1) ; b.setName(npfl.getName())
+        self.assertTrue(b.isEqual(npfl))
+        self.assertTrue(a.isEqual(narr2))
+        nff2.write(fname,0)
+        nff2bis=MEDFileIntField1TS(fname,"VectorFieldOnNodesPfl")
+        a,b=nff2bis.getFieldWithProfile(ON_NODES,0,mm1) ; b.setName(npfl.getName())
+        self.assertTrue(b.isEqual(npfl))
+        self.assertTrue(a.isEqual(narr2))
+        #
+        nf3=MEDCouplingFieldDouble(ON_NODES)
+        nf3.setName("VectorFieldOnNodesDouble")
+        nf3.setTime(29.,30,-21)
+        nf3.setMesh(f1.getMesh())
+        nf3.setArray(f1.getMesh().getCoords())
+        nff3=MEDFileField1TS.New()
+        nff3.setFieldNoProfileSBT(nf3)
+        nff3.write(fname,0)
+        fs=MEDFileFields(fname)
+        self.assertEqual(len(fs),4)
+        ffs=[it for it in fs]
+        self.assertTrue(isinstance(ffs[0],MEDFileIntFieldMultiTS))
+        self.assertTrue(isinstance(ffs[1],MEDFileIntFieldMultiTS))
+        self.assertTrue(isinstance(ffs[2],MEDFileFieldMultiTS))
+        self.assertTrue(isinstance(ffs[3],MEDFileIntFieldMultiTS))
+        #
+        self.assertTrue(fs["VectorFieldOnCells"][0].getUndergroundDataArray().isEqualWithoutConsideringStr(arr))
+        self.assertTrue(fs["VectorFieldOnCells"][1,2].getUndergroundDataArray().isEqualWithoutConsideringStr(2*arr))
+        self.assertTrue(fs["VectorFieldOnNodesPfl"][0].getUndergroundDataArray().isEqualWithoutConsideringStr(narr2))
+        self.assertTrue(fs["VectorFieldOnNodes"][9.].getUndergroundDataArray().isEqualWithoutConsideringStr(narr))
+        self.assertTrue(fs["VectorFieldOnNodesDouble"][29.].getUndergroundDataArray().isEqualWithoutConsideringStr(f1.getMesh().getCoords(),1e-12))
+        #
+        nf3_read=MEDFileFieldMultiTS(fname,"VectorFieldOnNodesDouble")
+        self.assertTrue(nf3_read[29.].getUndergroundDataArray().isEqualWithoutConsideringStr(f1.getMesh().getCoords(),1e-12))
+        self.assertRaises(InterpKernelException,MEDFileIntFieldMultiTS.New,fname,"VectorFieldOnNodesDouble")# exception because trying to read a double field with int instance
+        self.assertRaises(InterpKernelException,MEDFileFieldMultiTS.New,fname,"VectorFieldOnNodes")# exception because trying to read a int field with double instance
+        MEDFileField1TS.New(fname,"VectorFieldOnNodesDouble",30,-21)
+        self.assertRaises(InterpKernelException,MEDFileIntField1TS.New,fname,"VectorFieldOnNodesDouble",30,-21)# exception because trying to read a double field with int instance
+        MEDFileIntField1TS.New(fname,"VectorFieldOnNodes",10,-1)
+        self.assertRaises(InterpKernelException,MEDFileField1TS.New,fname,"VectorFieldOnNodes",10,-1)# exception because trying to read a double field with int instance
+        #
+        self.assertEqual(fs.getMeshesNames(),('3DSurfMesh_1','3DSurfMesh_1','3DSurfMesh_1','3DSurfMesh_1'))
+        self.assertTrue(fs.changeMeshNames([('3DSurfMesh_1','3DSurfMesh')]))
+        self.assertEqual(fs.getMeshesNames(),('3DSurfMesh','3DSurfMesh','3DSurfMesh','3DSurfMesh'))
+        self.assertTrue(not fs.changeMeshNames([('3DSurfMesh_1','3DSurfMesh')]))
+        pass
+
+    def testMEDFileFields1(self):
+        fname="Pyfile64.med"
+        f1=MEDCouplingFieldDouble(ON_NODES)
+        f1.setTime(0.001,0,-1) ; f1.setTimeUnit("us")
+        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]
+        f1.setArray(arr)
+        f1.setName("Field1")
+        ff1=MEDFileField1TS.New()
+        ff1.setFieldNoProfileSBT(f1)
+        self.assertEqual(ff1.getDtUnit(),"us")
+        ff1.write(fname,0)
+        f1.setTime(1.001,1,-1) ; ff1=MEDFileField1TS.New() ; ff1.setFieldNoProfileSBT(f1) ; ff1.write(fname,0)
+        f1.setTime(2.001,2,-1) ; ff1=MEDFileField1TS.New() ; ff1.setFieldNoProfileSBT(f1) ; ff1.write(fname,0)
+        #
+        self.assertEqual(MEDFileFields(fname).getCommonIterations(),([(0,-1),(1,-1),(2,-1)],False))
+        ff1s=MEDFileFieldMultiTS(fname,"Field1")
+        ff1s.setName("Field2")
+        ff1s.write(fname,0)
+        self.assertEqual(MEDFileFields(fname).getCommonIterations(),([(0,-1),(1,-1),(2,-1)],False))
+        f1.setTime(3.001,3,-1) ; ff1=MEDFileField1TS.New() ; ff1.setFieldNoProfileSBT(f1) ; ff1.write(fname,0)
+        self.assertEqual(MEDFileFields(fname).getCommonIterations(),([(0,-1),(1,-1),(2,-1)],True))
+        self.assertEqual(MEDFileFields(fname).partOfThisLyingOnSpecifiedTimeSteps([(1,-1)]).getCommonIterations(),([(1,-1)],False))
+        self.assertEqual(MEDFileFields(fname).partOfThisNotLyingOnSpecifiedTimeSteps([(1,-1)]).getCommonIterations(),([(0,-1),(2,-1)],True))
+        f1.setName("Field2") ; f1.setTime(3.001,3,-1) ; ff1=MEDFileField1TS.New() ; ff1.setFieldNoProfileSBT(f1) ; ff1.write(fname,0)
+        self.assertEqual(MEDFileFields(fname).getCommonIterations(),([(0,-1),(1,-1),(2,-1),(3,-1)],False))
+        self.assertEqual(MEDFileFields(fname)[1].getDtUnit(),"us")
+        pass
+
+    # Multi time steps and multi fields management without Globals (profiles, locs) aspects
+    def testMEDFileFields2(self):
+        fname="Pyfile65.med"
+        # to check that all is initialize 
+        MEDFileField1TS().__str__()
+        MEDFileFieldMultiTS().__str__()
+        # building a mesh containing 4 tri3 + 5 quad4
+        tri=MEDCouplingUMesh("tri",2)
+        tri.allocateCells() ; tri.insertNextCell(NORM_TRI3,[0,1,2])
+        tri.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,0.)]))
+        tris=[tri.deepCpy() for i in xrange(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.deepCpy() for i in xrange(5)]
+        for i,elt in enumerate(quads): elt.translate([5+i,0])
+        quads=MEDCouplingUMesh.MergeUMeshes(quads)
+        m=MEDCouplingUMesh.MergeUMeshes(tris,quads)
+        m.setName("mesh") ; m.getCoords().setInfoOnComponents(["XX [m]","YYY [km]"])
+        #
+        fmts0_0=MEDFileFieldMultiTS()
+        fmts0_1=MEDFileFieldMultiTS()
+        # time steps
+        for i in xrange(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)
+            f.setTime(float(i+1)+0.1,i+1,-i-1)
+            fmts0_0.appendFieldNoProfileSBT(f)
+            f1ts=MEDFileField1TS() ; f1ts.setFieldNoProfileSBT(f) ; fmts0_1.pushBackTimeStep(f1ts)
+            self.assertEqual(fmts0_1.getName(),name1)
+            self.assertEqual(fmts0_0.getInfo(),('aa [bb]','ccc [ddd]'))
+            self.assertEqual(fmts0_1.getInfo(),('aa [bb]','ccc [ddd]'))
+            if i>1:
+                # components names have been modified to generate errors
+                d.setInfoOnComponents(['aa [bb]','eee [dd]'])
+                self.assertRaises(InterpKernelException,fmts0_0.appendFieldNoProfileSBT,f)
+                self.assertRaises(InterpKernelException,f1ts.setInfo,['aa [bb]'])#throw because mismatch of number of components
+                f1ts.setInfo(['aa [bb]','eee [dd]'])
+                self.assertRaises(InterpKernelException,fmts0_1.pushBackTimeStep,f1ts)
+                pass
+            # add a mismatch of nb of compos
+            pass
+        fmts0_2=fmts0_0.deepCpy()
+        fmts0_3=fmts0_0.deepCpy()
+        fmts0_4=fmts0_0.deepCpy()
+        fmts0_5=fmts0_0.shallowCpy()
+        self.assertTrue(len(fmts0_0)==10 and len(fmts0_1)==10 and len(fmts0_2)==10 and len(fmts0_3)==10 and len(fmts0_4)==10 and len(fmts0_5)==10)
+        del fmts0_2[::2]
+        self.assertTrue(len(fmts0_2)==5 and fmts0_2.getIterations()==[(2,-2),(4,-4),(6,-6),(8,-8),(10,-10)])
+        del fmts0_3[[1.1,(6,-6),9]]
+        self.assertTrue(len(fmts0_3)==7 and fmts0_3.getIterations()==[(2,-2),(3,-3),(4,-4),(5,-5),(7,-7),(8,-8),(9,-9)])
+        fmts0_6=fmts0_4[[1.1,(6,-6),8]]
+        self.assertTrue(isinstance(fmts0_6,MEDFileFieldMultiTS))
+        self.assertTrue(len(fmts0_6)==3 and fmts0_6.getIterations()==[(1,-1),(6,-6),(9,-9)])
+        fmts0_7=fmts0_4[::-3]
+        self.assertTrue(isinstance(fmts0_7,MEDFileFieldMultiTS))
+        self.assertTrue(len(fmts0_7)==4 and fmts0_7.getIterations()==[(10,-10),(7,-7),(4,-4),(1,-1)])
+        #
+        fs0=MEDFileFields()
+        fs0.pushField(fmts0_0)
+        fmts0_2.setName("2ndField") ; fs0.pushField(fmts0_2)
+        fmts0_3.setName("3rdField") ; fs0.pushField(fmts0_3)
+        fmts0_4.setName("4thField") ; fs0.pushField(fmts0_4)
+        self.assertTrue(len(fs0)==4 and fs0.getFieldsNames()==('1stField','2ndField','3rdField','4thField'))
+        fs0.write(fname,2)
+        fs0=MEDFileFields(fname)
+        self.assertEqual(fs0.getCommonIterations(),([(2,-2),(4,-4),(8,-8)],True))
+        fs1=fs0.partOfThisLyingOnSpecifiedTimeSteps(fs0.getCommonIterations()[0])
+        self.assertTrue(fs1.getFieldsNames()==('1stField','2ndField','3rdField','4thField') and fs1.getCommonIterations()==([(2,-2),(4,-4),(8,-8)],False))
+        del fs1[["2ndField",3]]
+        self.assertTrue(fs1.getFieldsNames()==('1stField','3rdField') and fs1.getCommonIterations()==([(2,-2),(4,-4),(8,-8)],False))
+        fs2=fs0[[0,"4thField"]]
+        self.assertTrue(isinstance(fs2,MEDFileFields))
+        self.assertEqual(fs2.getFieldsNames(),('1stField','4thField'))
+        #
+        mm=MEDFileUMesh() ; mm.setMeshAtLevel(0,m) ; mm.write(fname,0)
+        pass
+
+    # Multi time steps and multi fields management with Globals (profiles, locs) aspects
+    def testMEDFileFields3(self):
+        fname="Pyfile66.med"
+        # building a mesh containing 4 tri3 + 5 quad4
+        tri=MEDCouplingUMesh("tri",2)
+        tri.allocateCells() ; tri.insertNextCell(NORM_TRI3,[0,1,2])
+        tri.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,0.)]))
+        tris=[tri.deepCpy() for i in xrange(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.deepCpy() for i in xrange(5)]
+        for i,elt in enumerate(quads): elt.translate([5+i,0])
+        quads=MEDCouplingUMesh.MergeUMeshes(quads)
+        m=MEDCouplingUMesh.MergeUMeshes(tris,quads)
+        m.setName("mesh") ; m.getCoords().setInfoOnComponents(["XX [m]","YYY [km]"])
+        #
+        mm=MEDFileUMesh() ; mm.setMeshAtLevel(0,m) ; mm.write(fname,2)
+        #
+        pfl=DataArrayInt([0,1,2,3,4,5,6]) ; pfl.setName("pfl")
+        pfl2=DataArrayInt([0,1,2,3,4,5,6,8]) ; pfl2.setName("pfl2")
+        fmts0_0=MEDFileFieldMultiTS()
+        fmts0_1=MEDFileFieldMultiTS()
+        # time steps
+        for i in xrange(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)
+            f.setTime(float(i+1)+0.1,i+1,-i-1)
+            fmts0_0.appendFieldProfile(f,mm,0,pfl)
+            f1ts=MEDFileField1TS() ; f1ts.setFieldProfile(f,mm,0,pfl) ; fmts0_1.pushBackTimeStep(f1ts)
+            self.assertEqual(fmts0_0.getInfo(),('aa [bb]','ccc [ddd]'))
+            self.assertEqual(fmts0_1.getInfo(),('aa [bb]','ccc [ddd]'))
+            pass
+        #
+        self.assertEqual(fmts0_0.getPfls(),10*('pfl_NORM_QUAD4',))
+        self.assertEqual(fmts0_1.getPfls(),('pfl_NORM_QUAD4',))
+        fmts0_0.zipPflsNames()
+        self.assertEqual(fmts0_0.getPfls(),('pfl_NORM_QUAD4',))
+        self.assertTrue(fmts0_1.getProfile("pfl_NORM_QUAD4").isEqual(fmts0_0.getProfile("pfl_NORM_QUAD4")))
+        fmts0_2=fmts0_0.deepCpy()
+        fmts0_3=fmts0_0.deepCpy()
+        fmts0_4=fmts0_0.deepCpy()
+        fs0=MEDFileFields()
+        fs0.pushField(fmts0_0)
+        fmts0_2.setName("2ndField") ; fs0.pushField(fmts0_2)
+        fmts0_3.setName("3rdField") ; fs0.pushField(fmts0_3)
+        fmts0_4.setName("4thField") ; fs0.pushField(fmts0_4)
+        self.assertEqual(fs0.getPfls(),('pfl_NORM_QUAD4',))
+        #
+        fmts0_5=MEDFileFieldMultiTS()
+        for i in xrange(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)
+            f.setTime(float(i+1)+0.1,i+1,-i-1)
+            f1ts=MEDFileField1TS() ; f1ts.setFieldProfile(f,mm,0,pfl2) ; fmts0_5.pushBackTimeStep(f1ts)
+            pass
+        fmts0_5.setName("5thField") ; fs0.pushField(fmts0_5)
+        self.assertEqual(fs0.getPfls(),('pfl_NORM_QUAD4','pfl2_NORM_QUAD4'))
+        fs0.checkGlobsCoherency()
+        fs0.write(fname,0)
+        pass
+    
+    def testSplitComponents1(self):
+        fname="Pyfile67.med"
+        # building a mesh containing 4 tri3 + 5 quad4
+        tri=MEDCouplingUMesh("tri",2)
+        tri.allocateCells() ; tri.insertNextCell(NORM_TRI3,[0,1,2])
+        tri.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,0.)]))
+        tris=[tri.deepCpy() for i in xrange(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.deepCpy() for i in xrange(5)]
+        for i,elt in enumerate(quads): elt.translate([5+i,0])
+        quads=MEDCouplingUMesh.MergeUMeshes(quads)
+        m=MEDCouplingUMesh.MergeUMeshes(tris,quads)
+        m.setName("mesh") ; m.getCoords().setInfoOnComponents(["XX [m]","YYY [km]"])
+        #
+        mm=MEDFileUMesh() ; mm.setMeshAtLevel(0,m) ; mm.write(fname,2)
+        #
+        pfl=DataArrayInt([0,1,2,3,4,5,6]) ; pfl.setName("pfl")
+        pfl2=DataArrayInt([0,1,2,3,4,5,6,8]) ; pfl2.setName("pfl2")
+        fs=MEDFileFields()
+        fmts0_1=MEDFileFieldMultiTS()
+        # time steps
+        infos1=['aa [bb]','ccc [ddd]',"ZZZZ [MW*s]"]
+        for i in xrange(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)
+            f.setTime(float(i+1)+0.1,i+1,-i-1)
+            f1ts=MEDFileField1TS() ; f1ts.setFieldProfile(f,mm,0,pfl) ; fmts0_1.pushBackTimeStep(f1ts)
+            self.assertEqual(fmts0_1.getInfo(),tuple(infos1))
+            pass
+        fs.pushField(fmts0_1)
+        self.assertEqual(1,len(fs))
+        l=fmts0_1.splitComponents()
+        self.assertEqual(3,len(l))
+        for elt in l: self.assertEqual(10,len(elt))
+        for elt in l: self.assertTrue(isinstance(elt,MEDFileFieldMultiTS))
+        for elt in l:
+            elt.setName("%s_%s"%(elt.getName(),DataArray.GetVarNameFromInfo(elt.getInfo()[0])))
+            pass
+        fs.pushFields(l)
+        self.assertEqual(4,len(fs))
+        for elt in fs: self.assertEqual(10,len(elt))
+        self.assertEqual(fs.getPfls(),('pfl_NORM_QUAD4',))
+        self.assertEqual(fs.getPflsReallyUsed(),('pfl_NORM_QUAD4',))
+        #
+        fs.write(fname,0) ; del fs
+        #
+        fs1=MEDFileFields(fname)
+        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 j,fieldName in enumerate(['1stField_aa','1stField_ccc','1stField_ZZZZ']):
+                f1ts=fs1[fieldName][i]
+                f=f1ts.getFieldOnMeshAtLevel(ON_CELLS,0,mm)
+                d=DataArrayDouble(21) ; d.iota(i*10) ; d.rearrange(3) ; d=d[:,j] ; d.setInfoOnComponent(0,infos1[j])
+                self.assertTrue(d.isEqual(f.getArray(),1e-13))
+                pass
+            f1ts=fs1["1stField"][i]
+            f=f1ts.getFieldOnMeshAtLevel(ON_CELLS,0,mm)
+            d=DataArrayDouble(21) ; d.iota(i*10) ; d.rearrange(3) ; d.setInfoOnComponents(infos1)
+            self.assertTrue(d.isEqual(f.getArray(),1e-13))
+            pass
+        pass
     pass
 
 unittest.main()
index 12eb0e3181554548195b7c23d7861231368abf26..ad068af7007e76bb90e54bceff8c06cb6bb206e3 100644 (file)
 static PyObject* convertMEDFileMesh(ParaMEDMEM::MEDFileMesh* mesh, int owner) throw(INTERP_KERNEL::Exception)
 {
   PyObject *ret=0;
+  if(!mesh)
+    {
+      Py_XINCREF(Py_None);
+      return Py_None;
+    }
   if(dynamic_cast<ParaMEDMEM::MEDFileUMesh *>(mesh))
     ret=SWIG_NewPointerObj((void*)mesh,SWIGTYPE_p_ParaMEDMEM__MEDFileUMesh,owner);
   if(dynamic_cast<ParaMEDMEM::MEDFileCMesh *>(mesh))
@@ -37,6 +42,11 @@ static PyObject* convertMEDFileMesh(ParaMEDMEM::MEDFileMesh* mesh, int owner) th
 static PyObject* convertMEDFileParameter1TS(ParaMEDMEM::MEDFileParameter1TS* p1ts, int owner) throw(INTERP_KERNEL::Exception)
 {
   PyObject *ret=0;
+  if(!p1ts)
+    {
+      Py_XINCREF(Py_None);
+      return Py_None;
+    }
   if(dynamic_cast<MEDFileParameterDouble1TS *>(p1ts))
     ret=SWIG_NewPointerObj((void*)p1ts,SWIGTYPE_p_ParaMEDMEM__MEDFileParameterDouble1TS,owner);
   if(dynamic_cast<MEDFileParameterDouble1TSWTI *>(p1ts))
@@ -46,6 +56,40 @@ static PyObject* convertMEDFileParameter1TS(ParaMEDMEM::MEDFileParameter1TS* p1t
   return ret;
 }
 
+static PyObject* convertMEDFileField1TS(ParaMEDMEM::MEDFileAnyTypeField1TS *p, int owner) throw(INTERP_KERNEL::Exception)
+{
+  PyObject *ret=0;
+  if(!p)
+    {
+      Py_XINCREF(Py_None);
+      return Py_None;
+    }
+  if(dynamic_cast<MEDFileField1TS *>(p))
+    ret=SWIG_NewPointerObj((void*)p,SWIGTYPE_p_ParaMEDMEM__MEDFileField1TS,owner);
+  if(dynamic_cast<MEDFileIntField1TS *>(p))
+    ret=SWIG_NewPointerObj((void*)p,SWIGTYPE_p_ParaMEDMEM__MEDFileIntField1TS,owner);
+  if(!ret)
+    throw INTERP_KERNEL::Exception("Not recognized type of MEDFileAnyTypeField1TS on downcast !");
+  return ret;
+}
+
+static PyObject* convertMEDFileFieldMultiTS(ParaMEDMEM::MEDFileAnyTypeFieldMultiTS *p, int owner) throw(INTERP_KERNEL::Exception)
+{
+  PyObject *ret=0;
+  if(!p)
+    {
+      Py_XINCREF(Py_None);
+      return Py_None;
+    }
+  if(dynamic_cast<MEDFileFieldMultiTS *>(p))
+    ret=SWIG_NewPointerObj((void*)p,SWIGTYPE_p_ParaMEDMEM__MEDFileFieldMultiTS,owner);
+  if(dynamic_cast<MEDFileIntFieldMultiTS *>(p))
+    ret=SWIG_NewPointerObj((void*)p,SWIGTYPE_p_ParaMEDMEM__MEDFileIntFieldMultiTS,owner);
+  if(!ret)
+    throw INTERP_KERNEL::Exception("Not recognized type of MEDFileAnyTypeFieldMultiTS on downcast !");
+  return ret;
+}
+
 static std::vector<std::pair<int,int> > convertTimePairIdsFromPy(PyObject *pyLi) throw(INTERP_KERNEL::Exception)
 {
   std::vector<std::pair<int,int> > ret;
@@ -171,7 +215,7 @@ std::vector< std::pair<std::string, std::string > > convertVecPairStStFromPy(PyO
                 throw INTERP_KERNEL::Exception(msg);
               PyObject *o0=PyTuple_GetItem(o,0);
               if(PyString_Check(o0))
-                p.second=std::string(PyString_AsString(o0));
+                p.first=std::string(PyString_AsString(o0));
               else
                 throw INTERP_KERNEL::Exception(msg);
               PyObject *o1=PyTuple_GetItem(o,1);
@@ -209,9 +253,9 @@ std::vector< std::pair<std::vector<std::string>, std::string > > convertVecPairV
               PyObject *o0=PyTuple_GetItem(o,0);
               if(PyList_Check(o0))
                 {
-                  int size2=PyList_Size(o0);
-                  p.first.resize(size2);
-                  for(int j=0;j<size2;j++)
+                  int size3=PyList_Size(o0);
+                  p.first.resize(size3);
+                  for(int j=0;j<size3;j++)
                     {
                       PyObject *o0j=PyList_GetItem(o0,j);
                       if(PyString_Check(o0j))
@@ -238,3 +282,58 @@ std::vector< std::pair<std::vector<std::string>, std::string > > convertVecPairV
     }
   throw INTERP_KERNEL::Exception(msg);
 }
+
+/*!
+ * Called by MEDFileAnyTypeFieldMultiTS::__getitem__ when \a elt0 is neither a list nor a slice.
+ * In this case a MEDFileAnyTypeField1TS object is returned.
+ */
+int MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(const MEDFileAnyTypeFieldMultiTS *self, PyObject *elt0) throw(INTERP_KERNEL::Exception)
+{
+  if(elt0 && PyInt_Check(elt0))
+    {//fmts[3]
+      return PyInt_AS_LONG(elt0);
+    }
+  else if(elt0 && PyTuple_Check(elt0))
+    {
+      if(PyTuple_Size(elt0)==2)
+        {
+          PyObject *o0=PyTuple_GetItem(elt0,0);
+          PyObject *o1=PyTuple_GetItem(elt0,1);
+          if(PyInt_Check(o0) && PyInt_Check(o1))
+            {//fmts(1,-1)
+              int iter=PyInt_AS_LONG(o0);
+              int order=PyInt_AS_LONG(o1);
+              return self->getPosOfTimeStep(iter,order);
+            }
+          else
+            throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input param ! input is a tuple of size 2 but two integers are expected in this tuple to request a time steps !");
+        }
+      else
+        throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input param ! input is a tuple of size != 2 ! two integers are expected in this tuple to request a time steps !");
+    }
+  else if(elt0 && PyFloat_Check(elt0))
+    {
+      double val=PyFloat_AS_DOUBLE(elt0);
+      return self->getPosGivenTime(val);
+    }
+  else
+    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int], or fmts[double] to request one time step ! To request a series of time steps invoke fmts[slice], fmts[list of int], fmts[list of double], or fmts[list of int,int] !");
+}
+
+/*!
+ * Called by MEDFileAnyTypeFieldMultiTS::__getitem__ when \a obj is neither a list nor a slice.
+ * In this case a MEDFileAnyTypeField1TS object is returned.
+ */
+int MEDFileFieldsgetitemSingleTS__(const MEDFileFields *self, PyObject *obj) throw(INTERP_KERNEL::Exception)
+{
+  if(PyInt_Check(obj))
+    {
+      return (int)PyInt_AS_LONG(obj);
+    }
+  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 !");
+}
index b0e14d7e651d842e7fbd586891ba2921db104fc2..9c6dc0c7e1350f49fa494de156aba371170b1cef 100644 (file)
@@ -53,9 +53,9 @@ _MEDLoader_la_LDFLAGS  = -module $(MED3_LIBS_C_ONLY) $(HDF5_LIBS) $(PYTHON_LIBS)
 
 CLEANFILES = MEDLoader_wrap.cxx MEDLoader.py
 
-dist_salomescript_SCRIPTS= med2sauv sauv2med
+dist_salomescript_SCRIPTS= med2sauv sauv2med case2med med2case
 
-dist_salomescript_DATA= MEDLoaderDataForTest.py MEDLoaderTest.py MEDLoaderTest2.py MEDLoaderTest3.py libMEDLoader_Swig.py medutilities.py
+dist_salomescript_DATA= MEDLoaderDataForTest.py MEDLoaderTest.py MEDLoaderTest2.py MEDLoaderTest3.py MEDLoaderCouplingTrainingSession.py CaseIO.py CaseReader.py CaseWriter.py MEDLoaderSplitter.py libMEDLoader_Swig.py medutilities.py
 nodist_salomescript_DATA = MEDLoader.py
 
 UNIT_TEST_PROG = MEDLoaderTest.py MEDLoaderTest2.py
diff --git a/src/MEDLoader/Swig/case2med b/src/MEDLoader/Swig/case2med
new file mode 100755 (executable)
index 0000000..b4281d7
--- /dev/null
@@ -0,0 +1,54 @@
+#!/usr/bin/python
+#  -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2013  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.
+#
+# 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 CaseReader import CaseReader
+from optparse import OptionParser
+import os
+
+parser = OptionParser()
+parser.set_usage("Convert a Case file to a MED file.\n   %prog [options] case_file")
+parser.add_option("-c", "--currentdir", action="store_true", dest="here", default=False,
+                  help="Are generated MED file generated in current directory. By default not, MED file is generated in directory containing the input file (default False)")
+(opts, args) = parser.parse_args()
+
+if len(args) != 1:
+    parser.print_usage()
+    exit(1)
+    pass
+    
+fname=args[0]  #"cas_test_simple.case"
+if opts.here:
+    fOut=os.path.splitext(os.path.basename(fname))[0]+".med"
+    pass
+else:
+    fOut=os.path.splitext(fname)[0]+".med"
+    pass
+###
+cr=CaseReader(fname)
+try:
+    medfd=cr.loadInMEDFileDS()
+except:
+    print "An error occured during the conversion!"
+    print "#######################################"
+    raise
+medfd.write(fOut,2)
+print "#########\nFile \"%s\" written !\n#########"%(fOut)
+    
diff --git a/src/MEDLoader/Swig/med2case b/src/MEDLoader/Swig/med2case
new file mode 100755 (executable)
index 0000000..7865dd6
--- /dev/null
@@ -0,0 +1,63 @@
+#!/usr/bin/python
+#  -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2013  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.
+#
+# 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 (CEA/DEN/DM2S/STMF/LGLS)
+
+from MEDLoader import MEDFileData,InterpKernelException
+from CaseWriter import CaseWriter
+from optparse import OptionParser
+import os
+
+parser = OptionParser()
+parser.set_usage("Convert a MED file to a Case file.\n   %prog [options] case_file")
+parser.add_option("-g", "--groups", action="store_true", dest="groups", default=False,
+                  help="Are groups in meshes stored in MEDFile exported in output case as subparts (default False)")
+parser.add_option("-c", "--currentdir", action="store_true", dest="here", default=False,
+                  help="Are generated case,geo files generated in current directory. By default not, files are generated in directory containing the input file  (default False)")
+(opts, args) = parser.parse_args()
+
+if len(args) != 1:
+    parser.print_usage()
+    exit(1)
+    pass
+    
+fname=os.path.abspath(args[0])  #"cas_test_simple.case"
+if opts.here:
+    fOut=os.path.splitext(os.path.basename(fname))[0]+".case"
+    pass
+else:
+    fOut=os.path.splitext(fname)[0]+".case"
+    pass
+###
+try:
+    cw=CaseWriter.New()
+    cw.setExportingGroups(opts.groups)
+    mfd=MEDFileData(fname)
+    cw.setMEDFileDS(mfd)
+    listOfWrittenFileNames=cw.write(fOut)
+except InterpKernelException as e:
+    print "An error occured during the conversion!"
+    print "#######################################"
+    raise e
+print "#########"
+for l in listOfWrittenFileNames:
+    print "File \"%s\" sucessfully written !"%(l)
+    pass
+print "#########"
index 084532db062f23152850b2891e3c98a56499f527..113633c734c9066b19a09792eea67f82e9b13703 100644 (file)
@@ -135,7 +135,7 @@ void SauvLoaderTest::testSauv2MedOnA3SubsField()
   CPPUNIT_ASSERT_DOUBLES_EQUAL(3, length1dField->accumulate(0), 1e-12);
   // check field
   MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTS> field =
-    d2->getFields()->getFieldWithName("CHAM1D");
+    dynamic_cast<MEDFileFieldMultiTS *>(d2->getFields()->getFieldWithName("CHAM1D"));
   std::cout << "Number of components in field: " << field->getInfo().size() << std::endl;
   CPPUNIT_ASSERT_EQUAL(6,(int)field->getInfo().size());
   std::vector< std::pair<int,int> > timesteps = field->getIterations();
@@ -161,7 +161,6 @@ void SauvLoaderTest::testSauv2MedOnA3SubsField()
 
   for (int i=0; i < field1d->getNumberOfTuples(); i++)
   {
-    bool ok = abs(values[i]-field1d->getIJ(i, 0)) < 1e-12;
     CPPUNIT_ASSERT_DOUBLES_EQUAL( values[i], field1d->getIJ(i, 0), 1e-12 );
   }
 }
@@ -220,7 +219,7 @@ void SauvLoaderTest::testMed2Sauv()
   MEDFileFields* pointeFields = pointeMed->getFields();
   for ( int i = 0; i < pointeFields->getNumberOfFields(); ++i )
     {
-      MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTS> ts = pointeFields->getFieldAtPos(i);
+      MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTS> ts = pointeFields->getFieldAtPos(i);
       if ( std::string("fieldnodeint") == ts->getName())
         {
           pointeFields->destroyFieldAtPos( i );
@@ -267,9 +266,9 @@ void SauvLoaderTest::testMed2Sauv()
   // check fields
   // fieldnodedouble
   MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTS> fieldnodedoubleTS1 =
-    pointeMed->getFields()->getFieldWithName("fieldnodedouble");
+    dynamic_cast<MEDFileFieldMultiTS *>(pointeMed->getFields()->getFieldWithName("fieldnodedouble"));
   MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTS> fieldnodedoubleTS2 =
-    d2->getFields()->getFieldWithName("fieldnodedouble");
+    dynamic_cast<MEDFileFieldMultiTS *>(d2->getFields()->getFieldWithName("fieldnodedouble"));
   CPPUNIT_ASSERT_EQUAL( fieldnodedoubleTS1->getInfo().size(), fieldnodedoubleTS2->getInfo().size());
   for ( size_t i = 0; i < fieldnodedoubleTS1->getInfo().size(); ++i )
     CPPUNIT_ASSERT_EQUAL( fieldnodedoubleTS1->getInfo()[i], fieldnodedoubleTS2->getInfo()[i]);
@@ -286,9 +285,9 @@ void SauvLoaderTest::testMed2Sauv()
     }
   // fieldcelldoublevector
   MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTS> fieldcelldoublevectorTS1 =
-    pointeMed->getFields()->getFieldWithName("fieldcelldoublevector");
+    dynamic_cast<MEDFileFieldMultiTS *>(pointeMed->getFields()->getFieldWithName("fieldcelldoublevector"));
   MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTS> fieldcelldoublevectorTS2 =
-    d2->getFields()->getFieldWithName("fieldcelldoublevector");
+    dynamic_cast<MEDFileFieldMultiTS *>(d2->getFields()->getFieldWithName("fieldcelldoublevector"));
   CPPUNIT_ASSERT_EQUAL( fieldcelldoublevectorTS1->getInfo().size(), fieldcelldoublevectorTS2->getInfo().size());
   for ( size_t i = 0; i < fieldcelldoublevectorTS1->getInfo().size(); ++i )
     CPPUNIT_ASSERT_EQUAL( fieldcelldoublevectorTS1->getInfo()[i], fieldcelldoublevectorTS2->getInfo()[i]);
@@ -307,7 +306,7 @@ void SauvLoaderTest::testMed2Sauv()
     }
   // "Field on 2 faces"
   MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTS> fieldOnFaces =
-    d2->getFields()->getFieldWithName(f1->getName());
+    dynamic_cast<MEDFileFieldMultiTS *>(d2->getFields()->getFieldWithName(f1->getName()));
   io1 = fieldOnFaces->getIterations();
   MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> fof =
     fieldOnFaces->getFieldOnMeshAtLevel(f1->getTypeOfField(),io1[0].first,io1[0].second,um1);
index c073f1febbd14f95e89bd49d130f05d7ec1d9b5b..ce86bde6e44e2c638b89ce2e8a4959c6ae8caeee 100644 (file)
@@ -105,12 +105,14 @@ int main(int argc, char** argv)
     {
       for(int i=0;i<fs->getNumberOfFields();i++)
         {
-          MEDFileFieldMultiTS *fmts=fs->getFieldAtPos(i);
+          MEDFileFieldMultiTS *fmts=dynamic_cast<MEDFileFieldMultiTS *>(fs->getFieldAtPos(i));
+         if(!fmts) continue;
           if(fmts->getMeshName()==meshname)
             {
               for(int j=0;j<fmts->getNumberOfTS();j++)
                 {
-                  MEDFileField1TS *f1ts=fmts->getTimeStepAtPos(j);
+                  MEDFileField1TS *f1ts=dynamic_cast<MEDFileField1TS*>(fmts->getTimeStepAtPos(j));
+                 if(!f1ts) continue;
                   DataArrayDouble *arr=f1ts->getUndergroundDataArray();
                   arr->renumberInPlace(&perm[0]);
                 }