Salome HOME
Addition of MEDFileUMesh.__getitem__ in python bindings to ease fetch of MEDCouplingU...
[tools/medcoupling.git] / src / MEDLoader / Swig / MEDLoaderCommon.i
index 594c74967af7a0a836cd1265980617241c12cd51..f9143b5a8d3efb8d93f9ffb5b45b6f32cd145578 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2015  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.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -93,8 +93,11 @@ using namespace ParaMEDMEM;
 %newobject ParaMEDMEM::MEDFileMesh::getNodeFamiliesArr;
 %newobject ParaMEDMEM::MEDFileMesh::getAllFamiliesIdsReferenced;
 %newobject ParaMEDMEM::MEDFileMesh::computeAllFamilyIdsInUse;
+%newobject ParaMEDMEM::MEDFileStructuredMesh::getImplicitFaceMesh;
 %newobject ParaMEDMEM::MEDFileUMesh::New;
+%newobject ParaMEDMEM::MEDFileUMesh::LoadPartOf;
 %newobject ParaMEDMEM::MEDFileUMesh::getCoords;
+%newobject ParaMEDMEM::MEDFileUMesh::getPartDefAtLevel;
 %newobject ParaMEDMEM::MEDFileUMesh::getGroup;
 %newobject ParaMEDMEM::MEDFileUMesh::getGroups;
 %newobject ParaMEDMEM::MEDFileUMesh::getFamily;
@@ -108,6 +111,8 @@ using namespace ParaMEDMEM;
 %newobject ParaMEDMEM::MEDFileUMesh::extractFamilyFieldOnGeoType;
 %newobject ParaMEDMEM::MEDFileUMesh::extractNumberFieldOnGeoType;
 %newobject ParaMEDMEM::MEDFileUMesh::zipCoords;
+%newobject ParaMEDMEM::MEDFileUMesh::buildExtrudedMesh;
+%newobject ParaMEDMEM::MEDFileUMesh::__getitem__;
 %newobject ParaMEDMEM::MEDFileCMesh::New;
 %newobject ParaMEDMEM::MEDFileCurveLinearMesh::New;
 %newobject ParaMEDMEM::MEDFileMeshMultiTS::New;
@@ -121,6 +126,7 @@ using namespace ParaMEDMEM;
 %newobject ParaMEDMEM::MEDFileMeshes::__iter__;
 
 %newobject ParaMEDMEM::MEDFileFields::New;
+%newobject ParaMEDMEM::MEDFileFields::LoadPartOf;
 %newobject ParaMEDMEM::MEDFileFields::deepCpy;
 %newobject ParaMEDMEM::MEDFileFields::shallowCpy;
 %newobject ParaMEDMEM::MEDFileFields::getFieldWithName;
@@ -492,6 +498,9 @@ namespace ParaMEDMEM
     void setTimeUnit(const std::string& unit);
     std::string getTimeUnit() const;
     virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
+    virtual bool hasImplicitPart() const throw(INTERP_KERNEL::Exception);
+    virtual int buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const throw(INTERP_KERNEL::Exception);
+    virtual void releaseImplicitPartIfAny() 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);
@@ -599,6 +608,13 @@ namespace ParaMEDMEM
            PyList_SetItem(res,1,PyString_FromString(what.c_str()));
            return res;
          }
+
+         void setGroupsAtLevel(int meshDimRelToMaxExt, PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
+         {
+           std::vector<const DataArrayInt *> grps;
+           convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",grps);
+           self->setGroupsAtLevel(meshDimRelToMaxExt,grps,renum);
+         }
          
          PyObject *areFamsEqual(const MEDFileMesh *other) const throw(INTERP_KERNEL::Exception)
          {
@@ -659,6 +675,14 @@ namespace ParaMEDMEM
              tmp->incrRef();
            return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
          }
+
+         PyObject *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
+         {
+           const DataArrayInt *tmp=self->getRevNumberFieldAtLevel(meshDimRelToMaxExt);
+           if(tmp)
+             tmp->incrRef();
+           return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
+         }
          
          PyObject *getNameFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
          {
@@ -722,6 +746,7 @@ namespace ParaMEDMEM
     static MEDFileUMesh *New();
     ~MEDFileUMesh();
     int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
+    int getRelativeLevOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const throw(INTERP_KERNEL::Exception);
     //
     std::vector<int> getGrpNonEmptyLevels(const std::string& grp) const throw(INTERP_KERNEL::Exception);
     std::vector<int> getGrpNonEmptyLevelsExt(const std::string& grp) const throw(INTERP_KERNEL::Exception);
@@ -733,17 +758,10 @@ namespace ParaMEDMEM
     std::vector<int> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const throw(INTERP_KERNEL::Exception);
     std::vector<std::string> getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
     MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
-    DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
     MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
-    DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
     MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
-    DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
     MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
-    DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
-    DataArrayInt *getNodeGroupArr(const std::string& grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
     DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
-    DataArrayInt *getNodeFamilyArr(const std::string& fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
-    DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
     MEDCouplingUMesh *getMeshAtLevel(int meshDimRelToMaxExt, bool renum=false) const throw(INTERP_KERNEL::Exception);
     MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
     MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
@@ -751,6 +769,7 @@ namespace ParaMEDMEM
     MEDCouplingUMesh *getLevelM3Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
     void forceComputationOfParts() const throw(INTERP_KERNEL::Exception);
     //
+    int getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
     void setFamilyNameAttachedOnId(int id, const std::string& newFamName) throw(INTERP_KERNEL::Exception);
     void setCoords(DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
     void eraseGroupsAtLevel(int meshDimRelToMaxExt) throw(INTERP_KERNEL::Exception);
@@ -763,6 +782,7 @@ namespace ParaMEDMEM
     DataArrayInt *zipCoords() throw(INTERP_KERNEL::Exception);
     DataArrayInt *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const throw(INTERP_KERNEL::Exception);
     DataArrayInt *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const throw(INTERP_KERNEL::Exception);
+    MEDFileUMesh *buildExtrudedMesh(const MEDCouplingUMesh *m1D, int policy) const throw(INTERP_KERNEL::Exception);
     %extend
        { 
          MEDFileUMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
@@ -779,20 +799,111 @@ namespace ParaMEDMEM
          {
            return MEDFileUMesh::New();
          }
-         
-         PyObject *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
+
+         // serialization
+         static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
          {
-           const DataArrayInt *tmp=self->getRevNumberFieldAtLevel(meshDimRelToMaxExt);
-           if(tmp)
-             tmp->incrRef();
-           return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
+           return NewMethWrapCallInitOnlyIfEmptyDictInInput(cls,args,"MEDFileUMesh");
          }
-         
-         void setGroupsAtLevel(int meshDimRelToMaxExt, PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
+
+         static MEDFileUMesh *LoadPartOf(const std::string& fileName, const std::string& mName, PyObject *types, const std::vector<int>& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
          {
-           std::vector<const DataArrayInt *> grps;
-           convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",grps);
-           self->setGroupsAtLevel(meshDimRelToMaxExt,grps,renum);
+           std::vector<int> typesCpp1;
+           convertPyToNewIntArr3(types,typesCpp1);
+           std::size_t sz(typesCpp1.size());
+           std::vector<INTERP_KERNEL::NormalizedCellType> typesCpp2(sz);
+           for(std::size_t ii=0;ii<sz;ii++)
+             typesCpp2[ii]=(INTERP_KERNEL::NormalizedCellType)typesCpp1[ii];
+           return MEDFileUMesh::LoadPartOf(fileName,mName,typesCpp2,slicPerTyp,dt,it,mrs);
+         }
+
+         PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
+         {// put an empty dict in input to say to __new__ to call __init__...
+           PyObject *ret(PyTuple_New(1));
+           PyObject *ret0(PyDict_New());
+           PyTuple_SetItem(ret,0,ret0);
+           return ret;
+         }
+
+         PyObject *__getstate__() throw(INTERP_KERNEL::Exception)
+         {
+           std::vector<double> a0;
+           std::vector<int> a1;
+           std::vector<std::string> a2;
+           std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > a3;
+           MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> a4;
+           self->serialize(a0,a1,a2,a3,a4);
+           PyObject *ret(PyTuple_New(5));
+           PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0));
+           PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1));
+           int sz(a2.size());
+           PyObject *ret2(PyList_New(sz));
+           for(int i=0;i<sz;i++)
+             PyList_SetItem(ret2,i,PyString_FromString(a2[i].c_str()));
+           PyTuple_SetItem(ret,2,ret2);
+           sz=a3.size();
+           PyObject *ret3(PyList_New(sz));
+           for(int i=0;i<sz;i++)
+             {
+               DataArrayInt *elt(a3[i]);
+               if(elt)
+                 elt->incrRef();
+               PyList_SetItem(ret3,i,SWIG_NewPointerObj(SWIG_as_voidptr(elt),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+             }
+           PyTuple_SetItem(ret,3,ret3);
+           DataArrayDouble *ret4(a4);
+           if(ret4)
+             ret4->incrRef();
+           PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(ret4),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
+           return ret;
+         }
+
+         void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
+         {
+           static const char MSG[]="MEDFileUMesh.__setstate__ : expected input is a tuple of size 4 !";
+           if(!PyTuple_Check(inp))
+             throw INTERP_KERNEL::Exception(MSG);
+           int sz(PyTuple_Size(inp));
+           if(sz!=5)
+             throw INTERP_KERNEL::Exception(MSG);
+           std::vector<double> a0;
+           std::vector<int> a1;
+           std::vector<std::string> a2;
+           std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > a3;
+           MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> a4;
+           //
+           PyObject *a0py(PyTuple_GetItem(inp,0)),*a1py(PyTuple_GetItem(inp,1)),*a2py(PyTuple_GetItem(inp,2));
+           int tmp(-1);
+           fillArrayWithPyListDbl3(a0py,tmp,a0);
+           convertPyToNewIntArr3(a1py,a1);
+           fillStringVector(a2py,a2);
+           //
+           PyObject *b0py(PyTuple_GetItem(inp,3)),*b1py(PyTuple_GetItem(inp,4));
+           void *argp(0);
+           int status(SWIG_ConvertPtr(b1py,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,0|0));
+           if(!SWIG_IsOK(status))
+             throw INTERP_KERNEL::Exception(MSG);
+           a4=reinterpret_cast<DataArrayDouble *>(argp);
+           if((DataArrayDouble *)a4)
+             a4->incrRef();
+           {
+             std::vector< DataArrayInt * > a3Tmp;
+             convertFromPyObjVectorOfObj<ParaMEDMEM::DataArrayInt *>(b0py,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",a3Tmp);
+             std::size_t sz(a3Tmp.size());
+             a3.resize(sz);
+             for(std::size_t i=0;i<sz;i++)
+               {
+                 a3[i]=a3Tmp[i];
+                 if(a3Tmp[i])
+                   a3Tmp[i]->incrRef();
+               }
+             self->unserialize(a0,a1,a2,a3,a4);
+           }
+         }
+
+         MEDCouplingUMesh *__getitem__(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
+         {
+           return self->getMeshAtLevel(meshDimRelToMaxExt,false);
          }
 
          void setMeshes(PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
@@ -824,6 +935,14 @@ namespace ParaMEDMEM
            return ret;
          }
 
+         PartDefinition *getPartDefAtLevel(int meshDimRelToMaxExt, INTERP_KERNEL::NormalizedCellType gt=INTERP_KERNEL::NORM_ERROR) const throw(INTERP_KERNEL::Exception)
+         {
+           const PartDefinition *ret(self->getPartDefAtLevel(meshDimRelToMaxExt,gt));
+           if(ret)
+             ret->incrRef();
+           return const_cast<PartDefinition *>(ret);
+         }
+
          PyObject *duplicateNodesOnM1Group(const std::string& grpNameM1) throw(INTERP_KERNEL::Exception)
          {
            DataArrayInt *ret0=0,*ret1=0,*ret2=0;
@@ -861,6 +980,17 @@ namespace ParaMEDMEM
 
   class MEDFileStructuredMesh : public MEDFileMesh
   {
+  public:
+    %extend
+    {
+      MEDCoupling1SGTUMesh *getImplicitFaceMesh() const throw(INTERP_KERNEL::Exception)
+      {
+        MEDCoupling1SGTUMesh *ret(self->getImplicitFaceMesh());
+        if(ret)
+          ret->incrRef();
+        return ret;
+      }
+    }
   };
 
   class MEDFileCMesh : public MEDFileStructuredMesh
@@ -1026,7 +1156,7 @@ namespace ParaMEDMEM
          {
            if(PyInt_Check(obj))
              {
-               MEDFileMesh *ret=self->getMeshAtPos((int)PyInt_AS_LONG(obj));
+               MEDFileMesh *ret=self->getMeshAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfMeshes()));
                if(ret)
                  ret->incrRef();
                return ret;
@@ -1226,6 +1356,7 @@ namespace ParaMEDMEM
     void loadArrays() throw(INTERP_KERNEL::Exception);
     void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception);
     void unloadArrays() throw(INTERP_KERNEL::Exception);
+    void unloadArraysWithoutDataLoss() 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);
@@ -1239,6 +1370,7 @@ namespace ParaMEDMEM
     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);
+    bool presenceOfMultiDiscPerGeoType() 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);
@@ -1355,6 +1487,16 @@ namespace ParaMEDMEM
           PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
         return retPy;
       }
+
+      PyObject *splitMultiDiscrPerGeoTypes() const throw(INTERP_KERNEL::Exception)
+      {
+        std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > ret=self->splitMultiDiscrPerGeoTypes();
+        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;
+      }
     }
   };
 
@@ -1633,6 +1775,7 @@ namespace ParaMEDMEM
     std::string getMeshName() const throw(INTERP_KERNEL::Exception);
     void setMeshName(const std::string& newMeshName) throw(INTERP_KERNEL::Exception);
     const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
+    bool presenceOfMultiDiscPerGeoType() 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);
@@ -1642,6 +1785,7 @@ namespace ParaMEDMEM
     void loadArrays() throw(INTERP_KERNEL::Exception);
     void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception);
     void unloadArrays() throw(INTERP_KERNEL::Exception);
+    void unloadArraysWithoutDataLoss() 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);
@@ -1808,12 +1952,8 @@ namespace ParaMEDMEM
           {
             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 !");
+            GetIndicesOfSlice(oC,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__delitem__ : error in input slice !");
+            self->eraseTimeStepIds2(strt,stp,step);
           }
         else
           {
@@ -1878,10 +2018,8 @@ namespace ParaMEDMEM
           {
             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 !");
+            GetIndicesOfSlice(oC,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__getitem__ : error in input slice !");
+            return convertMEDFileFieldMultiTS(self->buildSubPartSlice(strt,stp,step),SWIG_POINTER_OWN | 0);
           }
         else
           return convertMEDFileField1TS(self->getTimeStepAtPos(MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt0)),SWIG_POINTER_OWN | 0);
@@ -1913,6 +2051,16 @@ namespace ParaMEDMEM
         return retPy;
       }
 
+      PyObject *splitMultiDiscrPerGeoTypes() const throw(INTERP_KERNEL::Exception)
+      {
+        std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > ret=self->splitMultiDiscrPerGeoTypes();
+        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;
@@ -2221,11 +2369,13 @@ namespace ParaMEDMEM
   public:
     static MEDFileFields *New() throw(INTERP_KERNEL::Exception);
     static MEDFileFields *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+    static MEDFileFields *LoadPartOf(const std::string& fileName, bool loadAll=true, const MEDFileMeshes *ms=0) throw(INTERP_KERNEL::Exception);
     MEDFileFields *deepCpy() const throw(INTERP_KERNEL::Exception);
     MEDFileFields *shallowCpy() const throw(INTERP_KERNEL::Exception);
     void loadArrays() throw(INTERP_KERNEL::Exception);
     void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception);
     void unloadArrays() throw(INTERP_KERNEL::Exception);
+    void unloadArraysWithoutDataLoss() throw(INTERP_KERNEL::Exception);
     void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
     int getNumberOfFields() const;
     std::vector<std::string> getFieldsNames() const throw(INTERP_KERNEL::Exception);
@@ -2239,6 +2389,7 @@ namespace ParaMEDMEM
     MEDFileAnyTypeFieldMultiTS *getFieldWithName(const std::string& fieldName) const throw(INTERP_KERNEL::Exception);
     MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const std::string& meshName) const throw(INTERP_KERNEL::Exception);
     void destroyFieldAtPos(int i) throw(INTERP_KERNEL::Exception);
+    bool removeFieldsWithoutAnyTimeStep() throw(INTERP_KERNEL::Exception);
     %extend
        {
          MEDFileFields()
@@ -2374,10 +2525,8 @@ namespace ParaMEDMEM
              {
                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 !");
+               GetIndicesOfSlice(oC,self->getNumberOfFields(),&strt,&stp,&step,"MEDFileFields.__delitem__ : error in input slice !");
+               self->destroyFieldsAtPos2(strt,stp,step);
              }
            else
              {
@@ -2494,6 +2643,7 @@ namespace ParaMEDMEM
     double getDoubleValue(int iteration, int order) 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);
+    int getNumberOfTS() const throw(INTERP_KERNEL::Exception);
     %extend
     {
       MEDFileParameterMultiTS()
@@ -2564,7 +2714,7 @@ namespace ParaMEDMEM
       {
         if(elt0 && PyInt_Check(elt0))
           {//fmts[3]
-            int pos=PyInt_AS_LONG(elt0);
+            int pos=InterpreteNegativeInt(PyInt_AS_LONG(elt0),self->getNumberOfTS());
             return pos;
           }
         else if(elt0 && PyTuple_Check(elt0))
@@ -2708,7 +2858,7 @@ namespace ParaMEDMEM
       {
         if(PyInt_Check(obj))
           {
-            MEDFileParameterMultiTS *ret=self->getParamAtPos((int)PyInt_AS_LONG(obj));
+            MEDFileParameterMultiTS *ret=self->getParamAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfParams()));
             if(ret)
               ret->incrRef();
             return ret;
@@ -2989,17 +3139,17 @@ namespace ParaMEDMEM
     {
       PyObject *buildVTUArrays() const throw(INTERP_KERNEL::Exception)
       {
-       bool isInternal;
+        bool isInternal;
         std::vector< DataArrayDouble * > objs(self->buildVTUArrays(isInternal));
         std::size_t sz(objs.size());
-       PyObject *ret(PyTuple_New(2));
+        PyObject *ret(PyTuple_New(2));
         PyObject *ret0=PyList_New(sz);
         for(std::size_t i=0;i<sz;i++)
           PyList_SetItem(ret0,i,SWIG_NewPointerObj(SWIG_as_voidptr(objs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
-       PyTuple_SetItem(ret,0,ret0);
-       PyObject *ret1Py(isInternal?Py_True:Py_False);
-       Py_XINCREF(ret1Py);
-       PyTuple_SetItem(ret,1,ret1Py);
+        PyTuple_SetItem(ret,0,ret0);
+        PyObject *ret1Py(isInternal?Py_True:Py_False);
+        Py_XINCREF(ret1Py);
+        PyTuple_SetItem(ret,1,ret1Py);
         return ret;
       }
     }
@@ -3016,7 +3166,7 @@ namespace ParaMEDMEM
       {
         DataArrayDouble *ret0(0);
         std::vector<int> ret1;
-       bool ret2;
+        bool ret2;
         self->buildVTUArrays(ret0,ret1,ret2);
         std::size_t sz(ret1.size());
         PyObject *ret=PyTuple_New(3);
@@ -3025,9 +3175,9 @@ namespace ParaMEDMEM
         for(std::size_t i=0;i<sz;i++)
           PyList_SetItem(ret1Py,i,SWIG_From_int(ret1[i]));
         PyTuple_SetItem(ret,1,ret1Py);
-       PyObject *ret2Py(ret2?Py_True:Py_False);
-       Py_XINCREF(ret2Py);
-       PyTuple_SetItem(ret,2,ret2Py);
+        PyObject *ret2Py(ret2?Py_True:Py_False);
+        Py_XINCREF(ret2Py);
+        PyTuple_SetItem(ret,2,ret2Py);
         return ret;
       }
     }