Salome HOME
Improve message in case of throw for end user.
[tools/medcoupling.git] / src / MEDLoader / MEDFileMeshLL.cxx
index 7e12d9406b535caffca5a5e828fc065c819ee3b2..5139d9ca94c7db096e7c03847c38df0739368d8f 100644 (file)
@@ -45,7 +45,7 @@ std::size_t MEDFileMeshL2::getHeapMemorySizeWithoutChildren() const
   return 0;
 }
 
-std::vector<const BigMemoryObject *> MEDFileMeshL2::getDirectChildren() const
+std::vector<const BigMemoryObject *> MEDFileMeshL2::getDirectChildrenWithNull() const
 {
   return std::vector<const BigMemoryObject *>();
 }
@@ -87,7 +87,7 @@ int MEDFileMeshL2::GetMeshIdFromName(med_idt fid, const std::string& mname, Para
       throw INTERP_KERNEL::Exception(oss.str().c_str());
     }
   switch(type_maillage)
-    {
+  {
     case MED_UNSTRUCTURED_MESH:
       meshType=UNSTRUCTURED;
       break;
@@ -96,7 +96,7 @@ int MEDFileMeshL2::GetMeshIdFromName(med_idt fid, const std::string& mname, Para
         med_grid_type gt;
         MEDmeshGridTypeRd(fid,mname.c_str(),&gt);
         switch(gt)
-          {
+        {
           case MED_CARTESIAN_GRID:
             meshType=CARTESIAN;
             break;
@@ -105,12 +105,12 @@ int MEDFileMeshL2::GetMeshIdFromName(med_idt fid, const std::string& mname, Para
             break;
           default:
             throw INTERP_KERNEL::Exception("MEDFileUMeshL2::getMeshIdFromName : unrecognized structured mesh type ! Supported are :\n - cartesian\n - curve linear\n");
-          }
+        }
         break;
       }
     default:
       throw INTERP_KERNEL::Exception("MEDFileUMeshL2::getMeshIdFromName : unrecognized mesh type !");
-    }
+  }
   med_int numdt,numit;
   med_float dtt;
   MEDmeshComputationStepInfo(fid,mname.c_str(),1,&numdt,&numit,&dtt);
@@ -153,11 +153,11 @@ std::vector<std::string> MEDFileMeshL2::getAxisInfoOnMesh(med_idt fid, int mId,
   INTERP_KERNEL::AutoPtr<char> axisunit=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
   INTERP_KERNEL::AutoPtr<char> univTmp=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE);
   if(MEDmeshInfo(fid,mId,nameTmp,&spaceDim,&Mdim,&type_maillage,_description.getPointer(),_dt_unit.getPointer(),
-                 &stype,&nstep,&axistype,axisname,axisunit)!=0)
+      &stype,&nstep,&axistype,axisname,axisunit)!=0)
     throw INTERP_KERNEL::Exception("A problem has been detected when trying to get info on mesh !");
   MEDmeshUniversalNameRd(fid,nameTmp,_univ_name.getPointer());
   switch(type_maillage)
-    {
+  {
     case MED_UNSTRUCTURED_MESH:
       meshType=UNSTRUCTURED;
       break;
@@ -166,7 +166,7 @@ std::vector<std::string> MEDFileMeshL2::getAxisInfoOnMesh(med_idt fid, int mId,
         med_grid_type gt;
         MEDmeshGridTypeRd(fid,mName.c_str(),&gt);
         switch(gt)
-          {
+        {
           case MED_CARTESIAN_GRID:
             meshType=CARTESIAN;
             break;
@@ -175,12 +175,12 @@ std::vector<std::string> MEDFileMeshL2::getAxisInfoOnMesh(med_idt fid, int mId,
             break;
           default:
             throw INTERP_KERNEL::Exception("MEDFileUMeshL2::getAxisInfoOnMesh : unrecognized structured mesh type ! Supported are :\n - cartesian\n - curve linear\n");
-          }
+        }
         break;
       }
     default:
       throw INTERP_KERNEL::Exception("MEDFileUMeshL2::getMeshIdFromName : unrecognized mesh type !");
-    }
+  }
   //
   std::vector<std::string> infosOnComp(naxis);
   for(int i=0;i<naxis;i++)
@@ -243,43 +243,98 @@ MEDFileUMeshL2::MEDFileUMeshL2()
 {
 }
 
-void MEDFileUMeshL2::loadAll(med_idt fid, int mId, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs)
+std::vector<std::string> MEDFileUMeshL2::loadCommonPart(med_idt fid, int mId, const std::string& mName, int dt, int it, int& Mdim)
 {
+  Mdim=-3;
   _name.set(mName.c_str());
   int nstep;
-  int Mdim;
   ParaMEDMEM::MEDCouplingMeshType meshType;
-  std::vector<std::string> infosOnComp=getAxisInfoOnMesh(fid,mId,mName.c_str(),meshType,nstep,Mdim);
+  std::vector<std::string> ret(getAxisInfoOnMesh(fid,mId,mName.c_str(),meshType,nstep,Mdim));
+  if(nstep==0)
+    {
+      Mdim=-4;
+      return std::vector<std::string>();
+    }
   if(meshType!=UNSTRUCTURED)
     throw INTERP_KERNEL::Exception("Invalid mesh type ! You are expected an unstructured one whereas in file it is not an unstructured !");
   _time=CheckMeshTimeStep(fid,mName,nstep,dt,it);
   _iteration=dt;
   _order=it;
+  return ret;
+}
+
+void MEDFileUMeshL2::loadAll(med_idt fid, int mId, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs)
+{
+  int Mdim;
+  std::vector<std::string> infosOnComp(loadCommonPart(fid,mId,mName,dt,it,Mdim));
+  if(Mdim==-4)
+    return ;
   loadConnectivity(fid,Mdim,mName,dt,it,mrs);//to improve check (dt,it) coherency
   loadCoords(fid,mId,infosOnComp,mName,dt,it);
 }
 
+void MEDFileUMeshL2::loadPart(med_idt fid, int mId, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<int>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs)
+{
+  int Mdim;
+  std::vector<std::string> infosOnComp(loadCommonPart(fid,mId,mName,dt,it,Mdim));
+  if(Mdim==-4)
+    return ;
+  loadPartOfConnectivity(fid,Mdim,mName,types,slicPerTyp,dt,it,mrs);
+  med_bool changement,transformation;
+  int nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation));
+  std::vector<bool> fetchedNodeIds(nCoords,false);
+  for(std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshPerType> > >::const_iterator it0=_per_type_mesh.begin();it0!=_per_type_mesh.end();it0++)
+    for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshPerType> >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++)
+      (*it1)->getMesh()->computeNodeIdsAlg(fetchedNodeIds);
+  int nMin(std::distance(fetchedNodeIds.begin(),std::find(fetchedNodeIds.begin(),fetchedNodeIds.end(),true)));
+  int nMax(std::distance(fetchedNodeIds.rbegin(),std::find(fetchedNodeIds.rbegin(),fetchedNodeIds.rend(),true)));
+  nMax=nCoords-nMax;
+  for(std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshPerType> > >::const_iterator it0=_per_type_mesh.begin();it0!=_per_type_mesh.end();it0++)
+    for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshPerType> >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++)
+      (*it1)->getMesh()->renumberNodesWithOffsetInConn(-nMin);
+  loadPartCoords(fid,mId,infosOnComp,mName,dt,it,nMin,nMax);
+}
+
 void MEDFileUMeshL2::loadConnectivity(med_idt fid, int mdim, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs)
 {
   _per_type_mesh.resize(1);
   _per_type_mesh[0].clear();
   for(int j=0;j<MED_N_CELL_FIXED_GEO;j++)
     {
-      MEDFileUMeshPerType *tmp=MEDFileUMeshPerType::New(fid,mName.c_str(),dt,it,mdim,typmai[j],typmai2[j],mrs);
+      MEDFileUMeshPerType *tmp(MEDFileUMeshPerType::New(fid,mName.c_str(),dt,it,mdim,typmai[j],typmai2[j],mrs));
       if(tmp)
         _per_type_mesh[0].push_back(tmp);
     }
   sortTypes();
 }
 
+void MEDFileUMeshL2::loadPartOfConnectivity(med_idt fid, int mdim, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<int>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs)
+{
+  std::size_t nbOfTypes(types.size());
+  if(slicPerTyp.size()!=3*nbOfTypes)
+    throw INTERP_KERNEL::Exception("MEDFileUMeshL2::loadPartOfConnectivity : The size of slicPerTyp array is expected to be equal to 3 times size of array types !");
+  std::set<INTERP_KERNEL::NormalizedCellType> types2(types.begin(),types.end());
+  if(types2.size()!=nbOfTypes)
+    throw INTERP_KERNEL::Exception("MEDFileUMeshL2::loadPartOfConnectivity : the geometric types in types array must appear once !");
+  _per_type_mesh.resize(1);
+  _per_type_mesh[0].clear();
+  for(std::size_t ii=0;ii<nbOfTypes;ii++)
+    {
+      int strt(slicPerTyp[3*ii+0]),stp(slicPerTyp[3*ii+1]),step(slicPerTyp[3*ii+2]);
+      MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshPerType> tmp(MEDFileUMeshPerType::NewPart(fid,mName.c_str(),dt,it,mdim,types[ii],strt,stp,step,mrs));
+      _per_type_mesh[0].push_back(tmp);
+    }
+  sortTypes();
+}
+
 void MEDFileUMeshL2::loadCoords(med_idt fid, int mId, const std::vector<std::string>& infosOnComp, const std::string& mName, int dt, int it)
 {
-  int spaceDim=infosOnComp.size();
+  int spaceDim((int)infosOnComp.size());
   med_bool changement,transformation;
-  int nCoords=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation);
+  int nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation));
   _coords=DataArrayDouble::New();
   _coords->alloc(nCoords,spaceDim);
-  double *coordsPtr=_coords->getPointer();
+  double *coordsPtr(_coords->getPointer());
   MEDmeshNodeCoordinateRd(fid,mName.c_str(),dt,it,MED_FULL_INTERLACE,coordsPtr);
   if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0)
     {
@@ -310,6 +365,52 @@ void MEDFileUMeshL2::loadCoords(med_idt fid, int mId, const std::vector<std::str
     _coords->setInfoOnComponent(i,infosOnComp[i]);
 }
 
+void MEDFileUMeshL2::loadPartCoords(med_idt fid, int mId, const std::vector<std::string>& infosOnComp, const std::string& mName, int dt, int it, int nMin, int nMax)
+{
+  med_bool changement,transformation;
+  int spaceDim((int)infosOnComp.size()),nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation));
+  _coords=DataArrayDouble::New();
+  int nbNodesToLoad(nMax-nMin);
+  _coords->alloc(nbNodesToLoad,spaceDim);
+  med_filter filter=MED_FILTER_INIT,filter2=MED_FILTER_INIT;
+  MEDfilterBlockOfEntityCr(fid,/*nentity*/nCoords,/*nvaluesperentity*/1,/*nconstituentpervalue*/spaceDim,
+                           MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE,
+                           /*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);
+  if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0)
+    {
+      _fam_coords=DataArrayInt::New();
+      _fam_coords->alloc(nbNodesToLoad,1);
+      MEDmeshEntityAttributeAdvancedRd(fid,mName.c_str(),MED_FAMILY_NUMBER,dt,it,MED_NODE,MED_NO_GEOTYPE,&filter2,_fam_coords->getPointer());
+    }
+  else
+    _fam_coords=0;
+  if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_NUMBER,MED_NODAL,&changement,&transformation)>0)
+    {
+      _num_coords=DataArrayInt::New();
+      _num_coords->alloc(nbNodesToLoad,1);
+      MEDmeshEntityAttributeAdvancedRd(fid,mName.c_str(),MED_NUMBER,dt,it,MED_NODE,MED_NO_GEOTYPE,&filter2,_num_coords->getPointer());
+    }
+  else
+    _num_coords=0;
+  if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_NAME,MED_NODAL,&changement,&transformation)>0)
+    {
+      _name_coords=DataArrayAsciiChar::New();
+      _name_coords->alloc(nbNodesToLoad+1,MED_SNAME_SIZE);//not a bug to avoid the memory corruption due to last \0 at the end
+      MEDmeshEntityAttributeAdvancedRd(fid,mName.c_str(),MED_NAME,dt,it,MED_NODE,MED_NO_GEOTYPE,&filter2,_name_coords->getPointer());
+      _name_coords->reAlloc(nbNodesToLoad);//not a bug to avoid the memory corruption due to last \0 at the end
+    }
+  else
+    _name_coords=0;
+  MEDfilterClose(&filter2);
+  _coords->setInfoOnComponents(infosOnComp);
+}
+
 void MEDFileUMeshL2::sortTypes()
 {
   std::set<int> mdims;
@@ -426,7 +527,7 @@ void MEDFileCMeshL2::loadAll(med_idt fid, int mId, const std::string& mName, int
 med_data_type MEDFileCMeshL2::GetDataTypeCorrespondingToSpaceId(int id)
 {
   switch(id)
-    {
+  {
     case 0:
       return MED_COORDINATE_AXIS1;
     case 1:
@@ -435,7 +536,7 @@ med_data_type MEDFileCMeshL2::GetDataTypeCorrespondingToSpaceId(int id)
       return MED_COORDINATE_AXIS3;
     default:
       throw INTERP_KERNEL::Exception("Invalid meshdim detected in Cartesian Grid !");
-    }
+  }
 }
 
 MEDFileCLMeshL2::MEDFileCLMeshL2()
@@ -510,6 +611,18 @@ void MEDFileUMeshPermCompute::updateTime() const
   _num_time=_st->_num->getTimeOfThis();
 }
 
+std::vector<const BigMemoryObject *> MEDFileUMeshPermCompute::getDirectChildrenWithNull() const
+{
+  std::vector<const BigMemoryObject *> ret;
+  ret.push_back((const MEDCouplingUMesh *)_m);
+  return ret;
+}
+
+std::size_t MEDFileUMeshPermCompute::getHeapMemorySizeWithoutChildren() const
+{
+  return sizeof(MEDFileUMeshPermCompute);
+}
+
 MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(const MEDFileUMeshSplitL1& other):RefCountObject(other),_m_by_types(other._m_by_types),_fam(other._fam),_num(other._num),_names(other._names),_rev_num(other._rev_num),_m(this)
 {
 }
@@ -522,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++)
@@ -591,18 +707,15 @@ std::size_t MEDFileUMeshSplitL1::getHeapMemorySizeWithoutChildren() const
   return 0;
 }
 
-std::vector<const BigMemoryObject *> MEDFileUMeshSplitL1::getDirectChildren() const
+std::vector<const BigMemoryObject *> MEDFileUMeshSplitL1::getDirectChildrenWithNull() const
 {
   std::vector<const BigMemoryObject *> ret;
   ret.push_back(&_m_by_types);
-  if((const DataArrayInt*)_fam)
-    ret.push_back((const DataArrayInt*)_fam);
-  if((const DataArrayInt*)_num)
-    ret.push_back((const DataArrayInt*)_num);
-  if((const DataArrayInt*)_rev_num)
-    ret.push_back((const DataArrayInt*)_rev_num);
-  if((const DataArrayAsciiChar*)_names)
-    ret.push_back((const DataArrayAsciiChar*)_names);
+  ret.push_back(&_m);
+  ret.push_back((const DataArrayInt*)_fam);
+  ret.push_back((const DataArrayInt*)_num);
+  ret.push_back((const DataArrayInt*)_rev_num);
+  ret.push_back((const DataArrayAsciiChar*)_names);
   return ret;
 }
 
@@ -851,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();
@@ -860,7 +978,7 @@ void MEDFileUMeshSplitL1::eraseFamilyField()
  * This method ignores _m and _m_by_types.
  */
 void MEDFileUMeshSplitL1::setGroupsFromScratch(const std::vector<const MEDCouplingUMesh *>& ms, std::map<std::string,int>& familyIds,
-                                               std::map<std::string, std::vector<std::string> >& groups) throw(INTERP_KERNEL::Exception)
+                                               std::map<std::string, std::vector<std::string> >& groups)
 {
   std::vector< DataArrayInt * > corr;
   _m=MEDCouplingUMesh::FuseUMeshesOnSameCoords(ms,0,corr);
@@ -900,10 +1018,7 @@ void MEDFileUMeshSplitL1::write(med_idt fid, const std::string& mName, int mdim)
 
 void MEDFileUMeshSplitL1::renumberNodesInConn(const int *newNodeNumbersO2N)
 {
-  MEDCouplingUMesh *m(_m_by_types.getUmesh());
-  if(!m)
-    return;
-  m->renumberNodesInConn(newNodeNumbersO2N);
+  _m_by_types.renumberNodesInConnWithoutComputation(newNodeNumbersO2N);
 }
 
 void MEDFileUMeshSplitL1::changeFamilyIdArr(int oldId, int newId)
@@ -1052,10 +1167,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;
@@ -1089,7 +1221,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 !");
@@ -1108,12 +1240,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++)
     {
@@ -1127,7 +1259,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++)
     {
@@ -1145,6 +1277,26 @@ void MEDFileUMeshAggregateCompute::getStartStopOfGeoTypeWithoutComputation(INTER
   throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::getStartStopOfGeoTypeWithoutComputation : the geometric type is not existing !");
 }
 
+void MEDFileUMeshAggregateCompute::renumberNodesInConnWithoutComputation(const int *newNodeNumbersO2N)
+{
+  if(_mp_time>_m_time)
+    {
+      for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> >::iterator it=_m_parts.begin();it!=_m_parts.end();it++)
+        {
+          MEDCoupling1GTUMesh *m(*it);
+          if(m)
+            m->renumberNodesInConn(newNodeNumbersO2N);
+        }
+    }
+  else
+    {
+      MEDCouplingUMesh *m(getUmesh());
+      if(!m)
+        return;
+      m->renumberNodesInConn(newNodeNumbersO2N);
+    }
+}
+
 void MEDFileUMeshAggregateCompute::forceComputationOfPartsFromUMesh() const
 {
   const MEDCouplingUMesh *m(_m);
@@ -1156,9 +1308,36 @@ 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 !");
+}
+
+/*!
+ * This method returns true if \a this is stored split by type false if stored in a merged unstructured mesh.
+ */
+bool MEDFileUMeshAggregateCompute::isStoredSplitByType() const
+{
+  return _mp_time>=_m_time;
+}
+
 std::size_t MEDFileUMeshAggregateCompute::getTimeOfThis() const
 {
   if(_mp_time>_m_time)
@@ -1197,18 +1376,12 @@ std::size_t MEDFileUMeshAggregateCompute::getHeapMemorySizeWithoutChildren() con
   return ret;
 }
 
-std::vector<const BigMemoryObject *> MEDFileUMeshAggregateCompute::getDirectChildren() const
+std::vector<const BigMemoryObject *> MEDFileUMeshAggregateCompute::getDirectChildrenWithNull() const
 {
   std::vector<const BigMemoryObject *> ret;
   for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++)
-    {
-      const MEDCoupling1GTUMesh *cur(*it);
-      if(cur)
-        ret.push_back(cur);
-    }
-  const MEDCouplingUMesh *m(_m);
-  if(m)
-    ret.push_back(m);
+    ret.push_back((const MEDCoupling1GTUMesh *)*it);
+  ret.push_back((const MEDCouplingUMesh *)_m);
   return ret;
 }
 
@@ -1291,7 +1464,6 @@ bool MEDFileUMeshAggregateCompute::empty() const
     return ((const MEDCouplingUMesh *)_m)==0;
   //else _mp_time>=_m_time)
   return _m_parts.empty();
-  
 }
 
 int MEDFileUMeshAggregateCompute::getMeshDimension() const