Salome HOME
On the road of ParaMEDReader for fields.
authorAnthony Geay <anthony.geay@edf.fr>
Wed, 1 Oct 2014 11:58:22 +0000 (13:58 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Wed, 1 Oct 2014 11:58:22 +0000 (13:58 +0200)
src/MEDCoupling/MEDCouplingPartDefinition.cxx
src/MEDCoupling/MEDCouplingPartDefinition.hxx
src/MEDCoupling_Swig/MEDCouplingBasicsTest.py
src/MEDCoupling_Swig/MEDCouplingCommon.i
src/MEDLoader/MEDFileMesh.cxx
src/MEDLoader/MEDFileMesh.hxx
src/MEDLoader/MEDFileMeshElt.cxx
src/MEDLoader/MEDFileMeshElt.hxx
src/MEDLoader/MEDFileMeshLL.cxx
src/MEDLoader/MEDFileMeshLL.hxx
src/MEDLoader/Swig/MEDLoaderCommon.i

index 08c1d2282202d2ab65565f94dcb3bdbc35042f7c..4ff6ad4a0618b6252cb07135e72d02b695059dbf 100644 (file)
@@ -178,6 +178,13 @@ int SlicePartDefinition::getEffectiveStop() const
   return _start+nbElems*_step;
 }
 
+void SlicePartDefinition::getSlice(int& start, int& stop, int& step) const
+{
+  start=_start;
+  stop=_stop;
+  step=_step;
+}
+
 SlicePartDefinition::SlicePartDefinition(int start, int stop, int step):_start(start),_stop(stop),_step(step)
 {
 }
index a64ca77c1f6b855822b653f3ea96df84e3c41df8..d30868f0b6c93415c32afc8b9e232c76272c0e5a 100644 (file)
@@ -74,6 +74,7 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT std::string getRepr() const;
     //specific method
     MEDCOUPLING_EXPORT int getEffectiveStop() const;
+    MEDCOUPLING_EXPORT void getSlice(int& start, int& stop, int& step) const;
   private:
     SlicePartDefinition(int start, int stop, int step);
     MEDCOUPLING_EXPORT void updateTime() const;
index 6d3fa8e9fa54a687cea828a04054fd0dc3e21a61..e0334fbea7971a79fe7571746056984eb350bb1d 100644 (file)
@@ -15930,6 +15930,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         self.assertTrue(pd.toDAI().isEqual(DataArrayInt([5,8,11,14,17,20])))
         self.assertEqual(pd.getNumberOfElems(),6)
         self.assertEqual(pd.getEffectiveStop(),23)
+        self.assertEqual(pd.getSlice(),slice(5,23,3))
         pd=PartDefinition.New(5,22,1)
         self.assertTrue(isinstance(pd,SlicePartDefinition))
         self.assertTrue(pd.toDAI().isEqual(DataArrayInt([5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21])))
index c5820aef941988a1d9c58b1797f8ba9210626ae0..86dbd41ac15028fbea034af4175f2557bb235e5c 100644 (file)
@@ -5466,6 +5466,13 @@ namespace ParaMEDMEM
       {
         return SlicePartDefinition::New(start,stop,step);
       }
+
+      PyObject *getSlice() const throw(INTERP_KERNEL::Exception)
+      {
+        int a,b,c;
+        self->getSlice(a,b,c);
+        return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
+      }
       
       std::string __str__() const throw(INTERP_KERNEL::Exception)
       {
index aad1dfd60c5b3d7026f5661aa430eb3c9955b421..f07c99ce462ffef190cbeb2cc11b1382b6b3d0d0 100644 (file)
@@ -2032,6 +2032,7 @@ std::vector<const BigMemoryObject *> MEDFileUMesh::getDirectChildrenWithNull() c
   ret.push_back((const DataArrayInt *)_num_coords);
   ret.push_back((const DataArrayInt *)_rev_num_coords);
   ret.push_back((const DataArrayAsciiChar *)_name_coords);
+  ret.push_back((const PartDefinition *)_part_coords);
   for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
     ret.push_back((const MEDFileUMeshSplitL1*) *it);
   return ret;
@@ -2297,6 +2298,7 @@ void MEDFileUMesh::dispatchLoadedPart(med_idt fid, const MEDFileUMeshL2& loaderl
     _num_coords=loaderl2.getCoordsNum();
   if(!mrs || mrs->isNodeNameFieldReading())
     _name_coords=loaderl2.getCoordsName();
+  _part_coords=loaderl2.getPartDefOfCoo();
   computeRevNum();
 }
 
@@ -2755,6 +2757,21 @@ const DataArrayAsciiChar *MEDFileUMesh::getNameFieldAtLevel(int meshDimRelToMaxE
   return l1->getNameField();
 }
 
+/*!
+ * This method returns for a specified relative level \a meshDimRelToMaxExt the part effectively read (if the instance is the result of the read of a file).
+ *
+ * \param [in] meshDimRelToMaxExt - the extended relative level for which the part definition is requested.
+ * \param [in] gt - The input geometric type for which the part definition is requested.
+ * \return the part definition owned by \a this. So no need to deallocate the returned instance.
+ */
+const PartDefinition *MEDFileUMesh::getPartDefAtLevel(int meshDimRelToMaxExt, INTERP_KERNEL::NormalizedCellType gt) const
+{
+  if(meshDimRelToMaxExt==1)
+    return _part_coords;
+  const MEDFileUMeshSplitL1 *l1(getMeshAtLevSafe(meshDimRelToMaxExt));
+  return l1->getPartDef(gt);
+}
+
 int MEDFileUMesh::getNumberOfNodes() const
 {
   const DataArrayDouble *coo=_coords;
@@ -3164,6 +3181,18 @@ DataArrayInt *MEDFileUMesh::extractNumberFieldOnGeoType(INTERP_KERNEL::Normalize
   return sp->extractNumberFieldOnGeoType(gt);
 }
 
+/*!
+ * This method returns for specified geometric type \a gt the relative level to \a this.
+ * If the relative level is empty an exception will be thrown.
+ */
+int MEDFileUMesh::getRelativeLevOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const
+{
+  const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(gt);
+  int ret((int)cm.getDimension()-getMeshDimension());
+  getMeshAtLevSafe(ret);//To test that returned value corresponds to a valid level.
+  return ret;
+}
+
 const MEDFileUMeshSplitL1 *MEDFileUMesh::getMeshAtLevSafe(int meshDimRelToMaxExt) const
 {
   if(meshDimRelToMaxExt==1)
index a25401aea92ea82c52c5967d07010ca4991981bd..7a76c0fe6db103fd53b8b7eb33e3c4b254230482 100644 (file)
@@ -24,6 +24,7 @@
 #include "MEDLoaderDefines.hxx"
 #include "MEDFileMeshLL.hxx"
 #include "MEDFileUtilities.hxx"
+#include "MEDCouplingPartDefinition.hxx"
 #include "MEDFileMeshReadSelector.hxx"
 
 #include <map>
@@ -224,6 +225,7 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT const DataArrayInt *getNumberFieldAtLevel(int meshDimRelToMaxExt) const;
     MEDLOADER_EXPORT const DataArrayInt *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const;
     MEDLOADER_EXPORT const DataArrayAsciiChar *getNameFieldAtLevel(int meshDimRelToMaxExt) const;
+    MEDLOADER_EXPORT const PartDefinition *getPartDefAtLevel(int meshDimRelToMaxExt, INTERP_KERNEL::NormalizedCellType gt=INTERP_KERNEL::NORM_ERROR) const;
     MEDLOADER_EXPORT int getNumberOfNodes() const;
     MEDLOADER_EXPORT bool hasImplicitPart() const;
     MEDLOADER_EXPORT int buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const;
@@ -262,6 +264,7 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const;
     MEDLOADER_EXPORT DataArrayInt *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
     MEDLOADER_EXPORT DataArrayInt *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
+    MEDLOADER_EXPORT int getRelativeLevOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
     //
     MEDLOADER_EXPORT void setFamilyNameAttachedOnId(int id, const std::string& newFamName);
     MEDLOADER_EXPORT void setCoords(DataArrayDouble *coords);
@@ -306,6 +309,7 @@ namespace ParaMEDMEM
     MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _num_coords;
     MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> _name_coords;
     mutable MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _rev_num_coords;
+    MEDCouplingAutoRefCountObjectPtr<PartDefinition> _part_coords;
   };
 
   class MEDFileStructuredMesh : public MEDFileMesh
index ce16d0da1797ec81a53129dc1d7ec7287a78d397..d09fa1d4e7291dd5c492cefbdcdbf549695eac18 100644 (file)
@@ -124,6 +124,7 @@ void MEDFileUMeshPerType::loadPart(med_idt fid, const char *mName, int dt, int i
   med_bool changement,transformation;
   int curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
   const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(type));
+  _pd=PartDefinition::New(strt,end,step);
   if(!cm.isDynamic())
     {
       loadPartStaticType(fid,mName,dt,it,mdim,curNbOfElem,geoElt,type,entity,strt,end,step,mrs);
index ed795f1596222beead40cfe3afd71bb64a4f36bf..0a9098871890a71c0d6e3cd1b10c84b67277847b 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "MEDCouplingMemArray.hxx"
 #include "MEDCoupling1GTUMesh.hxx"
+#include "MEDCouplingPartDefinition.hxx"
 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
 
 #include "NormalizedUnstructuredMesh.hxx"
@@ -47,6 +48,7 @@ namespace ParaMEDMEM
     const DataArrayInt *getFam() const { return _fam; }
     const DataArrayInt *getNum() const { return _num; }
     const DataArrayAsciiChar *getNames() const { return _names; }
+    const PartDefinition *getPartDef() const { return _pd; }
     static void Write(med_idt fid, const std::string& mname, int mdim, const MEDCoupling1GTUMesh *m, const DataArrayInt *fam, const DataArrayInt *num, const DataArrayAsciiChar *names);
   private:
     MEDFileUMeshPerType();
@@ -69,6 +71,7 @@ namespace ParaMEDMEM
     MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _num;
     MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _fam;
     MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> _names;
+    MEDCouplingAutoRefCountObjectPtr<PartDefinition> _pd;
     med_entity_type _entity;
   };
 }
index a140e971b6198ec746dbc0b94300d2c82a716d8e..0591a6bd9adee1c57271feb0d21c2cdc339777d9 100644 (file)
@@ -378,6 +378,7 @@ void MEDFileUMeshL2::loadPartCoords(med_idt fid, int mId, const std::vector<std:
                            /*start*/nMin+1,/*stride*/1,/*count*/1,/*blocksize*/nbNodesToLoad,
                            /*lastblocksize=useless because count=1*/0,&filter);
   MEDmeshNodeCoordinateAdvancedRd(fid,mName.c_str(),dt,it,&filter,_coords->getPointer());
+  _part_coords=PartDefinition::New(nMin,nMax,1);
   MEDfilterClose(&filter);
   MEDfilterBlockOfEntityCr(fid,nCoords,1,1,MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,
                            MED_NO_PROFILE,nMin+1,1,1,nbNodesToLoad,0,&filter2);
@@ -634,15 +635,18 @@ MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(const MEDFileUMeshL2& l2, const std::st
   int sz=v.size();
   std::vector<const MEDCoupling1GTUMesh *> ms(sz);
   std::vector<const DataArrayInt *> fams(sz),nums(sz);
-  std::vector<const DataArrayChar *> names(sz); 
+  std::vector<const DataArrayChar *> names(sz);
+  std::vector<const PartDefinition *> pds(sz);
   for(int i=0;i<sz;i++)
     {
       MEDCoupling1GTUMesh *elt(v[i]->getMesh());
       MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp2=l2.getCoords();
       elt->setCoords(tmp2);
       ms[i]=elt;
+      pds[i]=v[i]->getPartDef();
     }
   _m_by_types.assignParts(ms);
+  _m_by_types.assignDefParts(pds);
   if(l2.isFamDefinedOnLev(id))
     {
       for(int i=0;i<sz;i++)
@@ -960,6 +964,11 @@ const DataArrayAsciiChar *MEDFileUMeshSplitL1::getNameField() const
   return _names;
 }
 
+const PartDefinition *MEDFileUMeshSplitL1::getPartDef(INTERP_KERNEL::NormalizedCellType gt) const
+{
+  return _m_by_types.getPartDefOfWithoutComputation(gt);
+}
+
 void MEDFileUMeshSplitL1::eraseFamilyField()
 {
   _fam->fillWithZero();
@@ -1161,10 +1170,27 @@ void MEDFileUMeshAggregateCompute::assignParts(const std::vector< const MEDCoupl
       ret[i]=const_cast<MEDCoupling1GTUMesh *>(elt); elt->incrRef();
     }
   _m_parts=ret;
+  _part_def.clear(); _part_def.resize(sz);
   _mp_time=std::max(_mp_time,_m_time)+1;
   _m=0;
 }
 
+void MEDFileUMeshAggregateCompute::assignDefParts(const std::vector<const PartDefinition *>& partDefs)
+{
+  if(_mp_time<_m_time)
+    throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::assignDefParts : the parts require a computation !");
+  std::size_t sz(partDefs.size());
+  if(_part_def.size()!=partDefs.size() || _part_def.size()!=_m_parts.size())
+    throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::assignDefParts : sizes of vectors of part definition mismatch !");
+  for(std::size_t i=0;i<sz;i++)
+    {
+      const PartDefinition *elt(partDefs[i]);
+      if(elt)
+        elt->incrRef();
+      _part_def[i]=const_cast<PartDefinition*>(elt);
+    }
+}
+
 void MEDFileUMeshAggregateCompute::assignUMesh(MEDCouplingUMesh *m)
 {
   _m=m;
@@ -1198,7 +1224,7 @@ std::vector<INTERP_KERNEL::NormalizedCellType> MEDFileUMeshAggregateCompute::get
     return _m->getAllGeoTypesSorted();
 }
 
-std::vector<MEDCoupling1GTUMesh *> MEDFileUMeshAggregateCompute::getPartsWithoutComputation() const
+std::vector<MEDCoupling1GTUMesh *> MEDFileUMeshAggregateCompute::retrievePartsWithoutComputation() const
 {
   if(_mp_time<_m_time)
     throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::getPartsWithoutComputation : the parts require a computation !");
@@ -1217,12 +1243,12 @@ std::vector<MEDCoupling1GTUMesh *> MEDFileUMeshAggregateCompute::getParts() cons
 {
   if(_mp_time<_m_time)
     forceComputationOfPartsFromUMesh();
-  return getPartsWithoutComputation();
+  return retrievePartsWithoutComputation();
 }
 
-MEDCoupling1GTUMesh *MEDFileUMeshAggregateCompute::getPartWithoutComputation(INTERP_KERNEL::NormalizedCellType gt) const
+MEDCoupling1GTUMesh *MEDFileUMeshAggregateCompute::retrievePartWithoutComputation(INTERP_KERNEL::NormalizedCellType gt) const
 {
-  std::vector<MEDCoupling1GTUMesh *> v(getPartsWithoutComputation());
+  std::vector<MEDCoupling1GTUMesh *> v(retrievePartsWithoutComputation());
   std::size_t sz(v.size());
   for(std::size_t i=0;i<sz;i++)
     {
@@ -1236,7 +1262,7 @@ MEDCoupling1GTUMesh *MEDFileUMeshAggregateCompute::getPartWithoutComputation(INT
 void MEDFileUMeshAggregateCompute::getStartStopOfGeoTypeWithoutComputation(INTERP_KERNEL::NormalizedCellType gt, int& start, int& stop) const
 {
   start=0; stop=0;
-  std::vector<MEDCoupling1GTUMesh *> v(getPartsWithoutComputation());
+  std::vector<MEDCoupling1GTUMesh *> v(retrievePartsWithoutComputation());
   std::size_t sz(v.size());
   for(std::size_t i=0;i<sz;i++)
     {
@@ -1265,9 +1291,28 @@ void MEDFileUMeshAggregateCompute::forceComputationOfPartsFromUMesh() const
   _m_parts.resize(sz);
   for(std::size_t i=0;i<sz;i++)
     _m_parts[i]=MEDCoupling1GTUMesh::New(ms[i]);
+  _part_def.clear();
+  _part_def.resize(_m_parts.size());
   _mp_time=std::max(_mp_time,_m_time);
 }
 
+const PartDefinition *MEDFileUMeshAggregateCompute::getPartDefOfWithoutComputation(INTERP_KERNEL::NormalizedCellType gt) const
+{
+  if(_mp_time<_m_time)
+    throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::getPartDefOfWithoutComputation : the parts require a computation !");
+  if(_m_parts.size()!=_part_def.size())
+    throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::getPartDefOfWithoutComputation : size of arrays are expected to be the same !");
+  std::size_t sz(_m_parts.size());
+  for(std::size_t i=0;i<sz;i++)
+    {
+      const MEDCoupling1GTUMesh *mesh(_m_parts[i]);
+      if(mesh)
+        if(mesh->getCellModelEnum()==gt)
+          return _part_def[i];
+    }
+  throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::getPartDefOfWithoutComputation : The input geo type is not existing in this !");
+}
+
 std::size_t MEDFileUMeshAggregateCompute::getTimeOfThis() const
 {
   if(_mp_time>_m_time)
index 8cdcc988f4f71817c2d045067d392c7d2de6e61f..4be19e047a2fbdd9156186f4bf950b80987217f9 100644 (file)
@@ -27,6 +27,7 @@
 #include "MEDCouplingUMesh.hxx"
 #include "MEDCouplingCMesh.hxx"
 #include "MEDCoupling1GTUMesh.hxx"
+#include "MEDCouplingPartDefinition.hxx"
 #include "MEDCouplingCurveLinearMesh.hxx"
 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
 
@@ -51,6 +52,7 @@ namespace ParaMEDMEM
     int getIteration() const { return _iteration; }
     int getOrder() const { return _order; }
     double getTime() const { return _time; }
+    MEDCouplingAutoRefCountObjectPtr<PartDefinition> getPartDefOfCoo() const { return _part_coords; }
     std::vector<std::string> getAxisInfoOnMesh(med_idt fid, int mId, const std::string& mName, ParaMEDMEM::MEDCouplingMeshType& meshType, int& nstep, int& Mdim);
     static int GetMeshIdFromName(med_idt fid, const std::string& mName, ParaMEDMEM::MEDCouplingMeshType& meshType, int& dt, int& it, std::string& dtunit1);
     static double CheckMeshTimeStep(med_idt fid, const std::string& mname, int nstep, int dt, int it);
@@ -64,6 +66,7 @@ namespace ParaMEDMEM
     int _iteration;
     int _order;
     double _time;
+    MEDCouplingAutoRefCountObjectPtr<PartDefinition> _part_coords;
   };
 
   class MEDFileUMeshL2 : public MEDFileMeshL2
@@ -149,12 +152,13 @@ namespace ParaMEDMEM
     MEDFileUMeshAggregateCompute();
     void setName(const std::string& name);
     void assignParts(const std::vector< const MEDCoupling1GTUMesh * >& mParts);
+    void assignDefParts(const std::vector<const PartDefinition *>& partDefs);
     void assignUMesh(MEDCouplingUMesh *m);
     MEDCouplingUMesh *getUmesh() const;
     std::vector<MEDCoupling1GTUMesh *> getParts() const;
     std::vector<INTERP_KERNEL::NormalizedCellType> getGeoTypes() const;
-    std::vector<MEDCoupling1GTUMesh *> getPartsWithoutComputation() const;
-    MEDCoupling1GTUMesh *getPartWithoutComputation(INTERP_KERNEL::NormalizedCellType gt) const;
+    std::vector<MEDCoupling1GTUMesh *> retrievePartsWithoutComputation() const;
+    MEDCoupling1GTUMesh *retrievePartWithoutComputation(INTERP_KERNEL::NormalizedCellType gt) const;
     void getStartStopOfGeoTypeWithoutComputation(INTERP_KERNEL::NormalizedCellType gt, int& start, int& stop) const;
     std::size_t getTimeOfThis() const;
     std::size_t getHeapMemorySizeWithoutChildren() const;
@@ -169,6 +173,7 @@ namespace ParaMEDMEM
     int getSize() const;
     void setCoords(DataArrayDouble *coords);
     void forceComputationOfPartsFromUMesh() const;
+    const PartDefinition *getPartDefOfWithoutComputation(INTERP_KERNEL::NormalizedCellType gt) const;
   private:
     std::size_t getTimeOfParts() const;
     std::size_t getTimeOfUMesh() const;
@@ -177,6 +182,7 @@ namespace ParaMEDMEM
     mutable std::size_t _mp_time;
     mutable std::size_t _m_time;
     mutable MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> _m;
+    mutable std::vector< MEDCouplingAutoRefCountObjectPtr<PartDefinition> > _part_def;
   };
 
   class MEDFileUMeshSplitL1 : public RefCountObject
@@ -208,8 +214,8 @@ namespace ParaMEDMEM
     DataArrayInt *getFamilyPartArr(const int *idsBg, const int *idsEnd, bool renum) const;
     MEDCouplingUMesh *getWholeMesh(bool renum) const;
     std::vector<INTERP_KERNEL::NormalizedCellType> getGeoTypes() const;
-    std::vector<MEDCoupling1GTUMesh *> getDirectUndergroundSingleGeoTypeMeshes() const { return _m_by_types.getPartsWithoutComputation(); }
-    MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const { return _m_by_types.getPartWithoutComputation(gt); }
+    std::vector<MEDCoupling1GTUMesh *> getDirectUndergroundSingleGeoTypeMeshes() const { return _m_by_types.retrievePartsWithoutComputation(); }
+    MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const { return _m_by_types.retrievePartWithoutComputation(gt); }
     DataArrayInt *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
     DataArrayInt *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
     std::vector<int> getDistributionOfTypes() const { return _m_by_types.getDistributionOfTypes(); }
@@ -218,6 +224,7 @@ namespace ParaMEDMEM
     const DataArrayInt *getNumberField() const;
     const DataArrayAsciiChar *getNameField() const;
     const DataArrayInt *getRevNumberField() const;
+    const PartDefinition *getPartDef(INTERP_KERNEL::NormalizedCellType gt) const;
     void eraseFamilyField();
     void setGroupsFromScratch(const std::vector<const MEDCouplingUMesh *>& ms, std::map<std::string,int>& familyIds,
                               std::map<std::string, std::vector<std::string> >& groups);
index 3efbfad259a6cc4c4f597338e81f23105b5688dd..0da87e7b39ca12bba4cf4bc5a36ce34112431e95 100644 (file)
@@ -97,6 +97,7 @@ using namespace ParaMEDMEM;
 %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;
@@ -727,6 +728,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);
@@ -840,6 +842,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;