Salome HOME
Correction of bug EDF10720.
[tools/medcoupling.git] / src / MEDLoader / Swig / MEDLoaderCommon.i
index c7adeea5ede9f4f448c18f3252753f6c1f4e3ea9..418765cd86909de708922ab17b671e21079e07c0 100644 (file)
@@ -145,6 +145,7 @@ using namespace ParaMEDMEM;
 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::getTimeStepGivenTime;
 %newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::__iter__;
 %newobject ParaMEDMEM::MEDFileFieldMultiTS::New;
+%newobject ParaMEDMEM::MEDFileFieldMultiTS::LoadSpecificEntities;
 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtLevel;
 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtTopLevel;
 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldOnMeshAtLevel;
@@ -152,6 +153,7 @@ using namespace ParaMEDMEM;
 %newobject ParaMEDMEM::MEDFileFieldMultiTS::getUndergroundDataArray;
 %newobject ParaMEDMEM::MEDFileFieldMultiTS::convertToInt;
 %newobject ParaMEDMEM::MEDFileIntFieldMultiTS::New;
+%newobject ParaMEDMEM::MEDFileIntFieldMultiTS::LoadSpecificEntities;
 %newobject ParaMEDMEM::MEDFileIntFieldMultiTS::getUndergroundDataArray;
 %newobject ParaMEDMEM::MEDFileIntFieldMultiTS::convertToDouble;
 
@@ -541,6 +543,9 @@ namespace ParaMEDMEM
     void removeFamily(const std::string& name) throw(INTERP_KERNEL::Exception);
     std::vector<std::string> removeOrphanGroups() throw(INTERP_KERNEL::Exception);
     std::vector<std::string> removeOrphanFamilies() throw(INTERP_KERNEL::Exception);
+    void removeFamiliesReferedByNoGroups() throw(INTERP_KERNEL::Exception);
+    void rearrangeFamilies() throw(INTERP_KERNEL::Exception);
+    void checkOrphanFamilyZero() const throw(INTERP_KERNEL::Exception);
     void changeGroupName(const std::string& oldName, const std::string& newName) throw(INTERP_KERNEL::Exception);
     void changeFamilyName(const std::string& oldName, const std::string& newName) throw(INTERP_KERNEL::Exception);
     void changeFamilyId(int oldId, int newId) throw(INTERP_KERNEL::Exception);
@@ -926,6 +931,11 @@ namespace ParaMEDMEM
            throw INTERP_KERNEL::Exception("MEDFileUMesh::__setitem__ : Not recognized input mesh !");
          }
 
+         void __delitem__(int meshDimRelToMax) throw(INTERP_KERNEL::Exception)
+         {
+           self->removeMeshAtLevel(meshDimRelToMax);
+         }
+
          void setMeshes(PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
          {
            std::vector<const MEDCouplingUMesh *> ms;
@@ -2083,9 +2093,18 @@ namespace ParaMEDMEM
 
       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);
+        void *argp(0);
+        int status(SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeFieldMultiTS,0|0));
+        if(SWIG_IsOK(status))
+          {
+            self->pushBackTimeSteps(reinterpret_cast<MEDFileAnyTypeFieldMultiTS *>(argp));
+          }
+        else
+          {
+            std::vector<MEDFileAnyTypeField1TS *> tmp;
+            convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeField1TS *>(li,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeField1TS,"MEDFileAnyTypeField1TS",tmp);
+            self->pushBackTimeSteps(tmp);
+          }
       }
 
       static PyObject *MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(PyObject *li) throw(INTERP_KERNEL::Exception)
@@ -2177,6 +2196,19 @@ namespace ParaMEDMEM
          {
            return MEDFileFieldMultiTS::New(fileName,fieldName,loadAll);
          }
+
+         static MEDFileFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
+         {
+           std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
+           std::size_t sz(tmp.size());
+           std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(sz);
+           for(std::size_t i=0;i<sz;i++)
+             {
+               entitiesCpp[i].first=(TypeOfField)tmp[i].first;
+               entitiesCpp[i].second=(INTERP_KERNEL::NormalizedCellType)tmp[i].second;
+             }
+           return MEDFileFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
+         }
          
          std::string __str__() const throw(INTERP_KERNEL::Exception)
          {
@@ -2309,6 +2341,19 @@ namespace ParaMEDMEM
         return MEDFileIntFieldMultiTS::New(fileName,fieldName,loadAll);
       }
 
+      static MEDFileIntFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
+      {
+        std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
+        std::size_t sz(tmp.size());
+        std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(sz);
+        for(std::size_t i=0;i<sz;i++)
+          {
+            entitiesCpp[i].first=(TypeOfField)tmp[i].first;
+            entitiesCpp[i].second=(INTERP_KERNEL::NormalizedCellType)tmp[i].second;
+          }
+        return MEDFileIntFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
+      }
+
       std::string __str__() const throw(INTERP_KERNEL::Exception)
       {
         return self->simpleRepr();