Salome HOME
Management of int64 fields into medcoupling.
[tools/medcoupling.git] / src / MEDLoader / MEDLoader.cxx
index 8b1ffc7c63e135d9d86c4c8430190cd36070d1ce..687d0bcbf35a6d6c4b3b25c6b29c96bf83af4a3b 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2019  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2020  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
@@ -30,7 +30,7 @@
 #include "MEDCouplingMemArray.hxx"
 #include "MEDCouplingFieldDouble.hxx"
 #include "MEDCouplingFieldFloat.hxx"
-#include "MEDCouplingFieldInt.hxx"
+#include "MEDCouplingFieldInt32.hxx"
 #include "MEDCouplingGaussLocalization.hxx"
 #include "MEDCouplingTraits.hxx"
 #include "MCAuto.hxx"
@@ -47,7 +47,7 @@
 #include <numeric>
 #include <iterator>
 #include <algorithm>
-
+#include <memory>
 
 med_geometry_type typmai[MED_N_CELL_FIXED_GEO] = { MED_POINT1,
   MED_SEG2,
@@ -101,7 +101,7 @@ INTERP_KERNEL::NormalizedCellType typmai2[MED_N_CELL_FIXED_GEO] = { INTERP_KERNE
   INTERP_KERNEL::NORM_QPOLYG,
   INTERP_KERNEL::NORM_POLYHED };
 
-med_geometry_type typmai3[34] = { MED_POINT1,//0
+med_geometry_type typmai3[INTERP_KERNEL::NORM_MAXTYPE] = { MED_POINT1,//0
   MED_SEG2,//1
   MED_SEG3,//2
   MED_TRIA3,//3
@@ -133,8 +133,7 @@ med_geometry_type typmai3[34] = { MED_POINT1,//0
   MED_NONE,//29
   MED_HEXA20,//30
   MED_POLYHEDRON,//31
-  MED_POLYGON2,//32
-  MED_NONE//33
+  MED_POLYGON2//32
 };
 
 double _EPS_FOR_NODE_COMP=1.e-12;
@@ -147,6 +146,20 @@ using namespace MEDCoupling;
 
 /// @cond INTERNAL
 
+INTERP_KERNEL::NormalizedCellType ConvertGeometryType(med_geometry_type geotype)
+{
+  INTERP_KERNEL::NormalizedCellType result=INTERP_KERNEL::NORM_ERROR;
+  for(int i=0; i<MED_N_CELL_FIXED_GEO; i++)
+    {
+      if (typmai[i]==geotype)
+        {
+          result=typmai2[i];
+          break;
+        }
+    }
+  return result;
+}
+
 /*!
  * This method returns a first quick overview of mesh with name \a meshName into the file \a fileName.
  * @param possibilities the relativeToMeshDim authorized to returned maxdim. This vector is systematically cleared at the begin of this method.
@@ -163,12 +176,12 @@ int MEDLoaderNS::readUMeshDimFromFile(const std::string& fileName, const std::st
   med_mesh_type type_maillage;
   med_int Sdim,Mdim;
   std::string trueMeshName;
-  med_int meshId=getIdFromMeshName(fid,meshName,trueMeshName);
+  int meshId=FromMedInt<int>(getIdFromMeshName(fid,meshName,trueMeshName));
   INTERP_KERNEL::AutoPtr<char> dt_unit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE);
   med_sorting_type sortingType;
   med_int nstep;
   med_axis_type axisType;
-  int naxis(MEDmeshnAxis(fid,meshId));
+  med_int naxis(MEDmeshnAxis(fid,meshId));
   INTERP_KERNEL::AutoPtr<char> axisname=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
   INTERP_KERNEL::AutoPtr<char> axisunit=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
   MEDFILESAFECALLERRD0(MEDmeshInfo,(fid,meshId,nommaa,&Sdim,&Mdim,&type_maillage,maillage_description,dt_unit,&sortingType,&nstep,&axisType,axisname,axisunit));
@@ -185,9 +198,9 @@ int MEDLoaderNS::readUMeshDimFromFile(const std::string& fileName, const std::st
     {
       med_geometry_type curMedType=typmai[i];
       med_bool changement,transformation;
-      int curNbOfElemM(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
-      int curNbOfElemF(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));//limitation
-      int curNbOfElem;
+      med_int curNbOfElemM(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
+      med_int curNbOfElemF(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));//limitation
+      med_int curNbOfElem;
       med_entity_type whichEntity;
       MEDLoaderNS::dispatchElems(curNbOfElemM,curNbOfElemF,curNbOfElem,whichEntity);
       if(curNbOfElem>0)
@@ -208,8 +221,8 @@ int MEDLoaderNS::readUMeshDimFromFile(const std::string& fileName, const std::st
   return ret;
 }
 
-med_int MEDLoaderNS::getIdFromMeshName(med_idt fid, const std::string& meshName, std::string& trueMeshName)
-    {
+int MEDLoaderNS::getIdFromMeshName(med_idt fid, const std::string& meshName, std::string& trueMeshName)
+{
   if(meshName.empty())
     {
       std::vector<std::string> meshes=getMeshNamesFid(fid);
@@ -231,8 +244,8 @@ med_int MEDLoaderNS::getIdFromMeshName(med_idt fid, const std::string& meshName,
       throw INTERP_KERNEL::Exception(os2.str().c_str());
     }
   trueMeshName=meshName;
-  return iter-meshes.begin()+1;
-    }
+  return (int)( iter-meshes.begin()+1 );
+}
 
 std::vector<std::string> MEDLoaderNS::getMeshNamesFid(med_idt fid)
 {
@@ -248,10 +261,10 @@ std::vector<std::string> MEDLoaderNS::getMeshNamesFid(med_idt fid)
   std::vector<std::string> ret(n);
   for(int i=0;i<n;i++)
     {
-      int naxis(MEDmeshnAxis(fid,i+1));
+      med_int naxis(MEDmeshnAxis(fid,i+1));
       INTERP_KERNEL::AutoPtr<char> axisname=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
       INTERP_KERNEL::AutoPtr<char> axisunit=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
-      int nstep;
+      med_int nstep;
       MEDFILESAFECALLERRD0(MEDmeshInfo,(fid,i+1,nommaa,&space_dim,&mesh_dim,&type_maillage,maillage_description,dtunit,&stype,&nstep,&axistype,axisname,axisunit));
       std::string cur=MEDLoaderBase::buildStringFromFortran(nommaa,sizeof(nommaa));
       ret[i]=cur;
@@ -262,7 +275,7 @@ std::vector<std::string> MEDLoaderNS::getMeshNamesFid(med_idt fid)
 /*!
  * This methods allows to merger all entities and to considerate only cell types.
  */
-void MEDLoaderNS::dispatchElems(int nbOfElemCell, int nbOfElemFace, int& nbOfElem, med_entity_type& whichEntity)
+void MEDLoaderNS::dispatchElems(med_int nbOfElemCell, med_int nbOfElemFace, med_int& nbOfElem, med_entity_type& whichEntity)
 {
   if(nbOfElemCell>=nbOfElemFace)
     {
@@ -340,9 +353,9 @@ void MEDCoupling::MEDFileVersion(int& major, int& minor, int& release)
   med_err ret(MEDlibraryNumVersion(&majj,&minn,&rell));
   if(ret!=0)
     throw INTERP_KERNEL::Exception("MEDFileVersion : fail to call MEDlibraryNumVersion ! It looks very bad !");
-  major=majj;
-  minor=minn;
-  release=rell;
+  major=FromMedInt<int>(majj);
+  minor=FromMedInt<int>(minn);
+  release=FromMedInt<int>(rell);
 }
 
 /*!
@@ -378,7 +391,7 @@ void MEDCoupling::SetTooLongStrPolicy(int val)
  * - the space dimension
  * - the number of nodes
  */
-std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > MEDCoupling::GetUMeshGlobalInfo(const std::string& fileName, const std::string& meshName, int &meshDim, int& spaceDim, int& numberOfNodes)
+std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > MEDCoupling::GetUMeshGlobalInfo(const std::string& fileName, const std::string& meshName, int &meshDim, int& spaceDim, mcIdType& numberOfNodes)
 {
   MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName));
   std::set<int> poss;
@@ -386,15 +399,17 @@ std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > M
   char maillage_description[MED_COMMENT_SIZE+1];
   med_mesh_type type_maillage;
   std::string trueMeshName;
-  med_int meshId=MEDLoaderNS::getIdFromMeshName(fid,meshName,trueMeshName);
+  int meshId=MEDLoaderNS::getIdFromMeshName(fid,meshName,trueMeshName);
   INTERP_KERNEL::AutoPtr<char> dt_unit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE);
   med_sorting_type sortingType;
-  med_int nstep;
+  med_int nstep, mDim, sDim;
   med_axis_type axisType;
-  int naxis(MEDmeshnAxis(fid,meshId));
+  med_int naxis(MEDmeshnAxis(fid,meshId));
   INTERP_KERNEL::AutoPtr<char> axisname=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
   INTERP_KERNEL::AutoPtr<char> axisunit=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
-  MEDFILESAFECALLERRD0(MEDmeshInfo,(fid,meshId,nommaa,&spaceDim,&meshDim,&type_maillage,maillage_description,dt_unit,&sortingType,&nstep,&axisType,axisname,axisunit));
+  MEDFILESAFECALLERRD0(MEDmeshInfo,(fid,meshId,nommaa,&sDim,&mDim,&type_maillage,maillage_description,dt_unit,&sortingType,&nstep,&axisType,axisname,axisunit));
+  meshDim=FromMedInt<int>(mDim);
+  spaceDim=FromMedInt<int>(sDim);
   if(type_maillage!=MED_UNSTRUCTURED_MESH)
     {
       std::ostringstream oss; oss << "GetUMeshGlobalInfo : Mesh \""<< meshName << "\" in file \"" << fileName;
@@ -414,7 +429,7 @@ std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > M
   for(int i=0;i<MED_N_CELL_FIXED_GEO;i++)
     {
       med_geometry_type curMedType=typmai[i];
-      int curNbOfElemM(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
+      med_int curNbOfElemM(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
       if(curNbOfElemM>0)
         {
           INTERP_KERNEL::NormalizedCellType typp=typmai2[i];
@@ -431,7 +446,7 @@ std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > M
     {
       ret[maxLev-dims[i]].push_back(geoTypes[i]);
     }
-  numberOfNodes=MEDmeshnEntity(fid,nommaa,numdt,numit,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation);
+  numberOfNodes=ToIdType(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation));
   return ret;
 }
 
@@ -481,6 +496,37 @@ std::vector< std::pair<std::string,std::string> > MEDCoupling::GetComponentsName
   throw INTERP_KERNEL::Exception(oss.str().c_str());
 }
 
+// see reference : https://en.cppreference.com/w/cpp/iterator/iterator
+class MEDVectorStringIterator : public std::iterator< std::input_iterator_tag, long, long, const std::string*, std::string >
+{
+  long _num = 0;
+  char *_data = nullptr;
+public:
+  explicit MEDVectorStringIterator(long num , char *data) : _num(num),_data(data) {}
+  MEDVectorStringIterator& operator++() { ++_num; return *this;}
+  bool operator==(const MEDVectorStringIterator& other) const {return _num == other._num;}
+  bool operator!=(const MEDVectorStringIterator& other) const {return !(*this == other);}
+  reference operator*() const {return MEDLoaderBase::buildStringFromFortran(_data+_num*MED_LNAME_SIZE,MED_LNAME_SIZE);}
+};
+
+void MEDCoupling::GetFamiliesGroupsInfo(const std::string& fileName, const std::string& meshName, std::map<std::string,mcIdType>& families, std::map<std::string,std::vector<std::string>>& groupsOnFam)
+{
+  MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName));
+  med_int nbFams(MEDnFamily(fid,meshName.c_str()));
+  char nomfam[MED_NAME_SIZE+1];
+  for(med_int i=0;i<nbFams;++i)
+    {
+      med_int nbGrps(MEDnFamilyGroup(fid,meshName.c_str(),i+1)),famId;
+      std::unique_ptr<char[]> gro{new char[MED_LNAME_SIZE*nbGrps+1]};
+      MEDFILESAFECALLERRD0(MEDfamilyInfo,(fid,meshName.c_str(),i+1,nomfam,&famId,gro.get()));
+      std::string fam(MEDLoaderBase::buildStringFromFortran(nomfam,MED_NAME_SIZE));
+      families[fam] = FromMedInt<mcIdType>(famId);
+      std::vector<std::string> v(nbGrps);
+      std::copy(MEDVectorStringIterator(0,gro.get()),MEDVectorStringIterator(nbGrps,gro.get()),v.begin());
+      groupsOnFam[fam] = v;
+    }
+}
+
 std::vector<std::string> MEDCoupling::GetMeshNamesOnField(const std::string& fileName, const std::string& fieldName)
 {
   std::vector<std::string> ret;
@@ -518,7 +564,7 @@ std::vector<std::string> MEDCoupling::GetMeshFamiliesNames(const std::string& fi
   med_int numfam;
   for(int i=0;i<nfam;i++)
     {
-      int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
+      med_int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
       med_int natt=MEDnFamily23Attribute(fid,meshName.c_str(),i+1);
       INTERP_KERNEL::AutoPtr<med_int> attide=new med_int[natt];
       INTERP_KERNEL::AutoPtr<med_int> attval=new med_int[natt];
@@ -541,7 +587,7 @@ std::vector<std::string> MEDCoupling::GetMeshFamiliesNamesOnGroup(const std::str
   med_int numfam;
   for(int i=0;i<nfam;i++)
     {
-      int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
+      med_int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
       med_int natt=MEDnFamily23Attribute(fid,meshName.c_str(),i+1);
       INTERP_KERNEL::AutoPtr<med_int> attide=new med_int[natt];
       INTERP_KERNEL::AutoPtr<med_int> attval=new med_int[natt];
@@ -569,7 +615,7 @@ std::vector<std::string> MEDCoupling::GetMeshGroupsNamesOnFamily(const std::stri
   bool found=false;
   for(int i=0;i<nfam && !found;i++)
     {
-      int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
+      med_int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
       med_int natt=MEDnFamily23Attribute(fid,meshName.c_str(),i+1);
       INTERP_KERNEL::AutoPtr<med_int> attide=new med_int[natt];
       INTERP_KERNEL::AutoPtr<med_int> attval=new med_int[natt];
@@ -604,7 +650,7 @@ std::vector<std::string> MEDCoupling::GetMeshGroupsNames(const std::string& file
   med_int numfam;
   for(int i=0;i<nfam;i++)
     {
-      int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
+      med_int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
       med_int natt=MEDnFamily23Attribute(fid,meshName.c_str(),i+1);
       INTERP_KERNEL::AutoPtr<med_int> attide=new med_int[natt];
       INTERP_KERNEL::AutoPtr<med_int> attval=new med_int[natt];
@@ -746,7 +792,7 @@ std::vector<std::string> MEDCoupling::GetCellFieldNamesOnMesh(const std::string&
       MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt));
       std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
       std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1);
-      int profilesize,nbi;
+      med_int profilesize,nbi;
       if(curMeshName==meshName)
         {
           bool found=false;
@@ -796,7 +842,7 @@ std::vector<std::string> MEDCoupling::GetNodeFieldNamesOnMesh(const std::string&
       std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1);
       if(nbPdt>0)
         {
-          int profilesize,nbi;
+          med_int profilesize,nbi;
           MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,nomcha,1,&numdt,&numo,&dt));
           med_int nbOfVal(MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_NODE,MED_NONE,1,MED_COMPACT_PFLMODE,
                                                     pflname,&profilesize,locname,&nbi));
@@ -946,7 +992,7 @@ std::vector< std::pair<int,int> > MEDCoupling::GetCellFieldIterations(const std:
             {
               for(int k=0;k<nbPdt;k++)
                 {
-                  int profilesize,nbi;
+                  med_int profilesize,nbi;
                   MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,nomcha,k+1,&numdt,&numo,&dt));
                   med_int nbOfVal(MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_CELL,typmai[j],1,MED_COMPACT_PFLMODE,
                                                             pflname,&profilesize,locname,&nbi));
@@ -1014,7 +1060,7 @@ std::vector< std::pair<int,int> > MEDCoupling::GetNodeFieldIterations(const std:
         {
           for(int k=0;k<nbPdt;k++)
             {
-              int profilesize,nbi;
+              med_int profilesize,nbi;
               MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,nomcha,k+1,&numdt,&numo,&dt));
               med_int nbOfVal(MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_NODE,MED_NONE,1,MED_COMPACT_PFLMODE,
                                                         pflname,&profilesize,locname,&nbi));
@@ -1217,11 +1263,11 @@ MCAuto<MEDCoupling::MEDCouplingField> MEDCoupling::ReadField(const std::string&
       }
   }
   {
-    MCAuto<MEDFileIntField1TS> f1(MEDCoupling::DynamicCast<MEDFileAnyTypeField1TS,MEDFileIntField1TS>(f));
+    MCAuto<MEDFileInt32Field1TS> f1(MEDCoupling::DynamicCast<MEDFileAnyTypeField1TS,MEDFileInt32Field1TS>(f));
     if(f1.isNotNull())
       {
-        MCAuto<MEDCoupling::MEDCouplingFieldInt> ret(f1->field(mesh));
-        return MEDCoupling::DynamicCast<MEDCouplingFieldInt,MEDCouplingField>(ret);
+        MCAuto<MEDCoupling::MEDCouplingFieldInt32> ret(f1->field(mesh));
+        return MEDCoupling::DynamicCast<MEDCouplingFieldInt32,MEDCouplingField>(ret);
       }
   }
   {
@@ -1270,7 +1316,7 @@ std::vector<MEDCoupling::MEDCouplingFieldDouble *> MEDCoupling::ReadFieldsOnSame
   if(!mmuPtr)
     throw INTERP_KERNEL::Exception("ReadFieldsOnSameMesh : only unstructured mesh is managed !");
   MCAuto<MEDCouplingUMesh> m=mmuPtr->getMeshAtLevel(meshDimRelToMax);
-  const DataArrayInt *o2n=mmuPtr->getNumberFieldAtLevel(meshDimRelToMax);
+  const DataArrayIdType *o2n=mmuPtr->getNumberFieldAtLevel(meshDimRelToMax);
   MCAuto<MEDCouplingUMesh> m2(m->clone(true));
   if(o2n)
     m2->renumberCells(o2n->begin(),true);
@@ -1325,7 +1371,7 @@ namespace MEDCoupling
     MCAuto<typename Traits<T>::FieldType> ret(ff->getFieldOnMeshAtLevel(type,m));
     if(muPtr.isNotNull())
       {
-        const DataArrayInt *num(muPtr->getNumberFieldAtLevel(meshDimRelToMax));
+        const DataArrayIdType *num(muPtr->getNumberFieldAtLevel(meshDimRelToMax));
         if(num)
           ret->renumberCells(num->begin());
       }
@@ -1344,10 +1390,10 @@ namespace MEDCoupling
         }
     }
     {
-      MCAuto<MEDFileIntField1TS> f1(MEDCoupling::DynamicCast<MEDFileAnyTypeField1TS,MEDFileIntField1TS>(f));
+      MCAuto<MEDFileInt32Field1TS> f1(MEDCoupling::DynamicCast<MEDFileAnyTypeField1TS,MEDFileInt32Field1TS>(f));
       if(f1.isNotNull())
         {
-          MCAuto<MEDCoupling::MEDCouplingFieldInt> ret(ReadFieldCellLikeT<int>(f1,type,fileName,meshName,meshDimRelToMax,fieldName,iteration,order));
+          MCAuto<MEDCoupling::MEDCouplingFieldInt32> ret(ReadFieldCellLikeT<int>(f1,type,fileName,meshName,meshDimRelToMax,fieldName,iteration,order));
           return ret.retn();
         }
     }
@@ -1373,27 +1419,27 @@ namespace MEDCoupling
       {
         if(muPtr.isNotNull())
           {
-            const DataArrayInt *num(muPtr->getNumberFieldAtLevel(meshDimRelToMax));
+            const DataArrayIdType *num(muPtr->getNumberFieldAtLevel(meshDimRelToMax));
             if(num)
               ret->renumberCells(num->begin());
           }
       }
     else
       {
-        DataArrayInt *pfl(nullptr),*arr2(nullptr);
+        DataArrayIdType *pfl(nullptr),*arr2(nullptr);
         MCAuto<typename Traits<T>::ArrayType> arr(ff->getFieldWithProfile(ON_NODES,meshDimRelToMax,mm,pfl));
-        MCAuto<DataArrayInt> pflSafe(pfl);
-        MCAuto<DataArrayInt> mp(m->getCellIdsFullyIncludedInNodeIds(pfl->begin(),pfl->end()));
+        MCAuto<DataArrayIdType> pflSafe(pfl);
+        MCAuto<DataArrayIdType> mp(m->getCellIdsFullyIncludedInNodeIds(pfl->begin(),pfl->end()));
         MCAuto<MEDCouplingUMesh> mzip(static_cast<MEDCouplingUMesh *>(m->buildPartAndReduceNodes(mp->begin(),mp->end(),arr2)));
-        MCAuto<DataArrayInt> arr2Safe(arr2);
-        MCAuto<DataArrayInt> arr3(arr2->invertArrayO2N2N2O(mzip->getNumberOfNodes()));
-        MCAuto<DataArrayInt> pflSorted(pflSafe->deepCopy()); pflSorted->sort(true);
+        MCAuto<DataArrayIdType> arr2Safe(arr2);
+        MCAuto<DataArrayIdType> arr3(arr2->invertArrayO2N2N2O(mzip->getNumberOfNodes()));
+        MCAuto<DataArrayIdType> pflSorted(pflSafe->deepCopy()); pflSorted->sort(true);
         if(!arr3->isEqualWithoutConsideringStr(*pflSorted))
           throw INTERP_KERNEL::Exception("ReadFieldNode : not implemented yet !");
         if(!arr3->isEqualWithoutConsideringStr(*pflSafe))
           {
-            MCAuto<DataArrayInt> o2n2(pflSafe->checkAndPreparePermutation());
-            MCAuto<DataArrayInt> n2o2(o2n2->invertArrayO2N2N2O(o2n2->getNumberOfTuples()));
+            MCAuto<DataArrayIdType> o2n2(pflSafe->checkAndPreparePermutation());
+            MCAuto<DataArrayIdType> n2o2(o2n2->invertArrayO2N2N2O(o2n2->getNumberOfTuples()));
             mzip->renumberNodes(n2o2->begin(),n2o2->getNumberOfTuples());
             arr->setName("");
             ret->setArray(arr);
@@ -1421,10 +1467,10 @@ MEDCoupling::MEDCouplingField *MEDCoupling::ReadFieldNode(const std::string& fil
       }
   }
   {
-    MCAuto<MEDFileIntField1TS> f1(MEDCoupling::DynamicCast<MEDFileAnyTypeField1TS,MEDFileIntField1TS>(f));
+    MCAuto<MEDFileInt32Field1TS> f1(MEDCoupling::DynamicCast<MEDFileAnyTypeField1TS,MEDFileInt32Field1TS>(f));
     if(f1.isNotNull())
       {
-        MCAuto<MEDCoupling::MEDCouplingFieldInt> ret(ReadFieldNodeT<int>(f1,fileName,meshName,meshDimRelToMax,fieldName,iteration,order));
+        MCAuto<MEDCoupling::MEDCouplingFieldInt32> ret(ReadFieldNodeT<int>(f1,fileName,meshName,meshDimRelToMax,fieldName,iteration,order));
         return ret.retn();
       }
   }
@@ -1557,8 +1603,8 @@ void MEDLoaderNS::writeFieldWithoutReadingAndMappingOfMeshInFile(const std::stri
     {
       MCAuto<MEDFileUMesh> mmu(MEDFileUMesh::New());
       AssignStaticWritePropertiesTo(*mmu);
-      MCAuto<DataArrayInt> o2n(um->getRenumArrForMEDFileFrmt());
-      MCAuto<DataArrayInt> n2o(o2n->invertArrayO2N2N2O(o2n->getNumberOfTuples()));
+      MCAuto<DataArrayIdType> o2n(um->getRenumArrForMEDFileFrmt());
+      MCAuto<DataArrayIdType> n2o(o2n->invertArrayO2N2N2O(o2n->getNumberOfTuples()));
       f2->renumberCells(o2n->begin(),false);
       mmu->setMeshAtLevel(0,const_cast<MEDCouplingUMesh *>(static_cast<const MEDCouplingUMesh *>(f2->getMesh())));
       mmu->setRenumFieldArr(0,n2o);
@@ -1630,7 +1676,7 @@ void WriteFieldT(const std::string& fileName, const typename MEDCoupling::Traits
           MEDCouplingUMesh *m(dynamic_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(f2->getMesh())));
           if(!m)
             throw INTERP_KERNEL::Exception("WriteField : only umesh in input field supported !");
-          MCAuto<DataArrayInt> o2n(m->getRenumArrForMEDFileFrmt());
+          MCAuto<DataArrayIdType> o2n(m->getRenumArrForMEDFileFrmt());
           f2->renumberCells(o2n->begin(),false);
           m=static_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(f2->getMesh()));
           MCAuto<MEDCouplingUMesh> mread(mmuPtr->getMeshAtLevel(m->getMeshDimension()-mm->getMeshDimension()));
@@ -1640,9 +1686,9 @@ void WriteFieldT(const std::string& fileName, const typename MEDCoupling::Traits
                 m->tryToShareSameCoordsPermute(*mread,_EPS_FOR_NODE_COMP);
               else
                 mread->setCoords(m->getCoords());
-              DataArrayInt *part(NULL);
+              DataArrayIdType *part(NULL);
               bool b(mread->areCellsIncludedIn(m,_COMP_FOR_CELL,part));
-              MCAuto<DataArrayInt> partSafe(part);
+              MCAuto<DataArrayIdType> partSafe(part);
               if(!b)
                 {
                   std::ostringstream oss; oss << "WriteField : The file \""<< fileName << "\" already contains a mesh named \""<< f->getMesh()->getName() << "\" and this mesh in the file is not compatible (a subpart) with the mesh you intend to write ! This is maybe due to a too strict policy ! Try with to lease it by calling SetCompPolicyForCell !";
@@ -1662,9 +1708,9 @@ void WriteFieldT(const std::string& fileName, const typename MEDCoupling::Traits
             }
           else
             {
-              DataArrayInt *part(NULL);
+              DataArrayIdType *part(NULL);
               bool b(mread->getCoords()->areIncludedInMe(m->getCoords(),_EPS_FOR_NODE_COMP,part));
-              MCAuto<DataArrayInt> partSafe(part);
+              MCAuto<DataArrayIdType> partSafe(part);
               if(!b)
                 {
                   std::ostringstream oss; oss << "WriteField : The file \""<< fileName << "\" already contains a mesh named \""<< f->getMesh()->getName() << "\" and this mesh in the file is not compatible (a subpart regarding nodes) with the mesh you intend to write ! This is maybe due to a too strict epsilon ! Try with to lease it by calling SetEpsilonForNodeComp !";
@@ -1698,7 +1744,7 @@ void MEDCoupling::WriteField(const std::string& fileName, const MEDCoupling::MED
       }
   }
   {
-    const MEDCoupling::MEDCouplingFieldInt *f1(dynamic_cast<const MEDCoupling::MEDCouplingFieldInt *>(f));
+    const MEDCoupling::MEDCouplingFieldInt32 *f1(dynamic_cast<const MEDCoupling::MEDCouplingFieldInt32 *>(f));
     if(f1)
       {
         WriteFieldT<int>(fileName,f1,writeFromScratch);
@@ -1738,7 +1784,7 @@ void WriteFieldUsingAlreadyWrittenMeshT(const std::string& fileName, const typen
   MEDCouplingUMesh *m(dynamic_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(f->getMesh())));
   if(m)
     {
-      MCAuto<DataArrayInt> o2n(m->getRenumArrForMEDFileFrmt());
+      MCAuto<DataArrayIdType> o2n(m->getRenumArrForMEDFileFrmt());
       MCAuto< typename MEDCoupling::Traits<T>::FieldType > f2(f->deepCopy());
       f2->renumberCells(o2n->begin(),false);
       f1ts->setFieldNoProfileSBT(f2);
@@ -1759,7 +1805,7 @@ void MEDCoupling::WriteFieldUsingAlreadyWrittenMesh(const std::string& fileName,
     return ;
   }
   {
-    const MEDCoupling::MEDCouplingFieldInt *f1(dynamic_cast<const MEDCoupling::MEDCouplingFieldInt *>(f));
+    const MEDCoupling::MEDCouplingFieldInt32 *f1(dynamic_cast<const MEDCoupling::MEDCouplingFieldInt32 *>(f));
     if(f1)
       WriteFieldUsingAlreadyWrittenMeshT<int>(fileName,f1);
     return ;