Salome HOME
Suppress useless swiged methods
[modules/med.git] / src / MEDLoader / MEDFileMeshLL.cxx
index ea4206e0da0807fdea7a9362dcb1a0235c1170da..d6094553a45d4e98a8c5b2d50c05c36def77d76c 100644 (file)
@@ -40,7 +40,17 @@ MEDFileMeshL2::MEDFileMeshL2():_name(MED_NAME_SIZE),_description(MED_COMMENT_SIZ
 {
 }
 
-int MEDFileMeshL2::GetMeshIdFromName(med_idt fid, const char *mname, ParaMEDMEM::MEDCouplingMeshType& meshType, int& dt, int& it, std::string& dtunit1) throw(INTERP_KERNEL::Exception)
+std::size_t MEDFileMeshL2::getHeapMemorySizeWithoutChildren() const
+{
+  return 0;
+}
+
+std::vector<const BigMemoryObject *> MEDFileMeshL2::getDirectChildren() const
+{
+  return std::vector<const BigMemoryObject *>();
+}
+
+int MEDFileMeshL2::GetMeshIdFromName(med_idt fid, const char *mname, ParaMEDMEM::MEDCouplingMeshType& meshType, int& dt, int& it, std::string& dtunit1)
 {
   med_mesh_type type_maillage;
   char maillage_description[MED_COMMENT_SIZE+1];
@@ -108,7 +118,7 @@ int MEDFileMeshL2::GetMeshIdFromName(med_idt fid, const char *mname, ParaMEDMEM:
   return ret;
 }
 
-double MEDFileMeshL2::CheckMeshTimeStep(med_idt fid, const char *mName, int nstep, int dt, int it) throw(INTERP_KERNEL::Exception)
+double MEDFileMeshL2::CheckMeshTimeStep(med_idt fid, const char *mName, int nstep, int dt, int it)
 {
   bool found=false;
   med_int numdt,numit;
@@ -131,7 +141,7 @@ double MEDFileMeshL2::CheckMeshTimeStep(med_idt fid, const char *mName, int nste
   return dtt;
 }
 
-std::vector<std::string> MEDFileMeshL2::getAxisInfoOnMesh(med_idt fid, int mId, const char *mName, ParaMEDMEM::MEDCouplingMeshType& meshType, int& nstep, int& Mdim) throw(INTERP_KERNEL::Exception)
+std::vector<std::string> MEDFileMeshL2::getAxisInfoOnMesh(med_idt fid, int mId, const char *mName, ParaMEDMEM::MEDCouplingMeshType& meshType, int& nstep, int& Mdim)
 {
   med_mesh_type type_maillage;
   med_int spaceDim;
@@ -262,7 +272,7 @@ void MEDFileUMeshL2::loadConnectivity(med_idt fid, int mdim, const char *mName,
   sortTypes();
 }
 
-void MEDFileUMeshL2::loadCoords(med_idt fid, int mId, const std::vector<std::string>& infosOnComp, const char *mName, int dt, int it) throw(INTERP_KERNEL::Exception)
+void MEDFileUMeshL2::loadCoords(med_idt fid, int mId, const std::vector<std::string>& infosOnComp, const char *mName, int dt, int it)
 {
   int spaceDim=infosOnComp.size();
   med_bool changement,transformation;
@@ -382,7 +392,7 @@ MEDFileCMeshL2::MEDFileCMeshL2()
 {
 }
 
-void MEDFileCMeshL2::loadAll(med_idt fid, int mId, const char *mName, int dt, int it) throw(INTERP_KERNEL::Exception)
+void MEDFileCMeshL2::loadAll(med_idt fid, int mId, const char *mName, int dt, int it)
 {
   _name.set(mName);
   int nstep;
@@ -413,7 +423,7 @@ void MEDFileCMeshL2::loadAll(med_idt fid, int mId, const char *mName, int dt, in
     }
 }
 
-med_data_type MEDFileCMeshL2::GetDataTypeCorrespondingToSpaceId(int id) throw(INTERP_KERNEL::Exception)
+med_data_type MEDFileCMeshL2::GetDataTypeCorrespondingToSpaceId(int id)
 {
   switch(id)
     {
@@ -432,7 +442,7 @@ MEDFileCLMeshL2::MEDFileCLMeshL2()
 {
 }
 
-void MEDFileCLMeshL2::loadAll(med_idt fid, int mId, const char *mName, int dt, int it) throw(INTERP_KERNEL::Exception)
+void MEDFileCLMeshL2::loadAll(med_idt fid, int mId, const char *mName, int dt, int it)
 {
   _name.set(mName);
   int nstep;
@@ -552,18 +562,23 @@ MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(MEDCouplingUMesh *m, bool newOrOld):_m(
   assignMesh(m,newOrOld);
 }
 
-std::size_t MEDFileUMeshSplitL1::getHeapMemorySize() const
+std::size_t MEDFileUMeshSplitL1::getHeapMemorySizeWithoutChildren() const
 {
-  std::size_t ret=0;
-  ret+=_m_by_types.getHeapMemorySize();
+  return 0;
+}
+
+std::vector<const BigMemoryObject *> MEDFileUMeshSplitL1::getDirectChildren() const
+{
+  std::vector<const BigMemoryObject *> ret;
+  ret.push_back(&_m_by_types);
   if((const DataArrayInt*)_fam)
-    ret+=_fam->getHeapMemorySize();
+    ret.push_back((const DataArrayInt*)_fam);
   if((const DataArrayInt*)_num)
-    ret+=_num->getHeapMemorySize();
+    ret.push_back((const DataArrayInt*)_num);
   if((const DataArrayInt*)_rev_num)
-    ret+=_rev_num->getHeapMemorySize();
+    ret.push_back((const DataArrayInt*)_rev_num);
   if((const DataArrayAsciiChar*)_names)
-    ret+=_names->getHeapMemorySize();
+    ret.push_back((const DataArrayAsciiChar*)_names);
   return ret;
 }
 
@@ -648,12 +663,12 @@ void MEDFileUMeshSplitL1::ClearNonDiscrAttributes(const MEDCouplingMesh *tmp)
   (const_cast<MEDCouplingMesh *>(tmp))->setTimeUnit("");
 }
 
-void MEDFileUMeshSplitL1::setCoords(DataArrayDouble *coords) throw(INTERP_KERNEL::Exception)
+void MEDFileUMeshSplitL1::setCoords(DataArrayDouble *coords)
 {
   _m_by_types.setCoords(coords);
 }
 
-void MEDFileUMeshSplitL1::assignMesh(MEDCouplingUMesh *m, bool newOrOld) throw(INTERP_KERNEL::Exception)
+void MEDFileUMeshSplitL1::assignMesh(MEDCouplingUMesh *m, bool newOrOld)
 {
   if(newOrOld)
     {
@@ -710,7 +725,7 @@ void MEDFileUMeshSplitL1::simpleRepr(std::ostream& oss) const
     }
 }
 
-int MEDFileUMeshSplitL1::getSize() const throw(INTERP_KERNEL::Exception)
+int MEDFileUMeshSplitL1::getSize() const
 {
   return _m_by_types.getSize();
 }
@@ -742,7 +757,7 @@ MEDCouplingUMesh *MEDFileUMeshSplitL1::getWholeMesh(bool renum) const
   return tmp.retn();
 }
 
-DataArrayInt *MEDFileUMeshSplitL1::getOrCreateAndGetFamilyField() throw(INTERP_KERNEL::Exception)
+DataArrayInt *MEDFileUMeshSplitL1::getOrCreateAndGetFamilyField()
 {
   if((DataArrayInt *)_fam)
     return _fam;
@@ -818,7 +833,7 @@ void MEDFileUMeshSplitL1::write(med_idt fid, const char *mName, int mdim) const
     }
 }
 
-void MEDFileUMeshSplitL1::renumberNodesInConn(const int *newNodeNumbersO2N) throw(INTERP_KERNEL::Exception)
+void MEDFileUMeshSplitL1::renumberNodesInConn(const int *newNodeNumbersO2N)
 {
   MEDCouplingUMesh *m(_m_by_types.getUmesh());
   if(!m)
@@ -826,7 +841,7 @@ void MEDFileUMeshSplitL1::renumberNodesInConn(const int *newNodeNumbersO2N) thro
   m->renumberNodesInConn(newNodeNumbersO2N);
 }
 
-void MEDFileUMeshSplitL1::changeFamilyIdArr(int oldId, int newId) throw(INTERP_KERNEL::Exception)
+void MEDFileUMeshSplitL1::changeFamilyIdArr(int oldId, int newId)
 {
   DataArrayInt *arr=_fam;
   if(arr)
@@ -976,20 +991,11 @@ MEDCouplingUMesh *MEDFileUMeshAggregateCompute::getUmesh() const
   return _m;
 }
 
-std::vector<MEDCoupling1GTUMesh *> MEDFileUMeshAggregateCompute::getParts() const
+std::vector<MEDCoupling1GTUMesh *> MEDFileUMeshAggregateCompute::getPartsWithoutComputation() const
 {
-  if(_mp_time>=_m_time)
-    {
-      std::vector<MEDCoupling1GTUMesh *> ret(_m_parts.size());
-      std::size_t i(0);
-      for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++,i++)
-        {
-          const MEDCoupling1GTUMesh *elt(*it);
-          ret[i]=const_cast<MEDCoupling1GTUMesh *>(elt);
-        }
-      return ret;
-    }
-  forceComputationOfPartsFromUMesh();
+  if(_mp_time<_m_time)
+    throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::getPartsWithoutComputation : the parts require a computation !");
+  //
   std::vector<MEDCoupling1GTUMesh *> ret(_m_parts.size());
   std::size_t i(0);
   for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++,i++)
@@ -1000,6 +1006,26 @@ std::vector<MEDCoupling1GTUMesh *> MEDFileUMeshAggregateCompute::getParts() cons
   return ret;
 }
 
+std::vector<MEDCoupling1GTUMesh *> MEDFileUMeshAggregateCompute::getParts() const
+{
+  if(_mp_time<_m_time)
+    forceComputationOfPartsFromUMesh();
+  return getPartsWithoutComputation();
+}
+
+MEDCoupling1GTUMesh *MEDFileUMeshAggregateCompute::getPartWithoutComputation(INTERP_KERNEL::NormalizedCellType gt) const
+{
+  std::vector<MEDCoupling1GTUMesh *> v(getPartsWithoutComputation());
+  std::size_t sz(v.size());
+  for(std::size_t i=0;i<sz;i++)
+    {
+      if(v[i])
+        if(v[i]->getCellModelEnum()==gt)
+          return v[i];
+    }
+  throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::getPartWithoutComputation : the geometric type is not existing !");
+}
+
 void MEDFileUMeshAggregateCompute::forceComputationOfPartsFromUMesh() const
 {
   const MEDCouplingUMesh *m(_m);
@@ -1046,33 +1072,24 @@ std::size_t MEDFileUMeshAggregateCompute::getTimeOfUMesh() const
   return m->getTimeOfThis();
 }
 
-/*!
- * Coordinates pointer is not counted because father instance already count it !
- */
-std::size_t MEDFileUMeshAggregateCompute::getHeapMemorySize() const
-{ 
-  std::size_t ret(0);
-  ret+=_m_parts.size()*sizeof(MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh>);
-  std::size_t sz(_m_parts.size());
-  for(std::size_t i=0;i<sz;i++)
+std::size_t MEDFileUMeshAggregateCompute::getHeapMemorySizeWithoutChildren() const
+{
+  std::size_t ret(_m_parts.size()*sizeof(MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh>));
+  return ret;
+}
+
+std::vector<const BigMemoryObject *> MEDFileUMeshAggregateCompute::getDirectChildren() const
+{
+  std::vector<const BigMemoryObject *> ret;
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++)
     {
-      const MEDCoupling1GTUMesh *pt(_m_parts[i]);
-      if(pt)
-        {
-          ret+=pt->getHeapMemorySize();
-          const DataArrayDouble *coo(pt->getCoords());
-          if(coo)
-            ret-=coo->getHeapMemorySize();
-        }
+      const MEDCoupling1GTUMesh *cur(*it);
+      if(cur)
+        ret.push_back(cur);
     }
   const MEDCouplingUMesh *m(_m);
   if(m)
-    {
-      ret+=m->getHeapMemorySize();
-      const DataArrayDouble *coo(m->getCoords());
-      if(coo)
-            ret-=coo->getHeapMemorySize();
-    }
+    ret.push_back(m);
   return ret;
 }
 
@@ -1133,8 +1150,8 @@ void MEDFileUMeshAggregateCompute::synchronizeTinyInfo(const MEDFileMesh& master
       const MEDCoupling1GTUMesh *tmp(*it);
       if(tmp)
         {
-          (const_cast<MEDCoupling1GTUMesh *>(tmp))->setName(master.getName());
-          (const_cast<MEDCoupling1GTUMesh *>(tmp))->setDescription(master.getDescription());
+          (const_cast<MEDCoupling1GTUMesh *>(tmp))->setName(master.getName().c_str());
+          (const_cast<MEDCoupling1GTUMesh *>(tmp))->setDescription(master.getDescription().c_str());
           (const_cast<MEDCoupling1GTUMesh *>(tmp))->setTime(master.getTimeValue(),master.getIteration(),master.getOrder());
           (const_cast<MEDCoupling1GTUMesh *>(tmp))->setTimeUnit(master.getTimeUnit());
         }
@@ -1142,8 +1159,8 @@ void MEDFileUMeshAggregateCompute::synchronizeTinyInfo(const MEDFileMesh& master
   const MEDCouplingUMesh *m(_m);
   if(m)
     {
-      (const_cast<MEDCouplingUMesh *>(m))->setName(master.getName());
-      (const_cast<MEDCouplingUMesh *>(m))->setDescription(master.getDescription());
+      (const_cast<MEDCouplingUMesh *>(m))->setName(master.getName().c_str());
+      (const_cast<MEDCouplingUMesh *>(m))->setDescription(master.getDescription().c_str());
       (const_cast<MEDCouplingUMesh *>(m))->setTime(master.getTimeValue(),master.getIteration(),master.getOrder());
       (const_cast<MEDCouplingUMesh *>(m))->setTimeUnit(master.getTimeUnit());
     }
@@ -1202,7 +1219,7 @@ std::vector<int> MEDFileUMeshAggregateCompute::getDistributionOfTypes() const
     }
 }
 
-int MEDFileUMeshAggregateCompute::getSize() const throw(INTERP_KERNEL::Exception)
+int MEDFileUMeshAggregateCompute::getSize() const
 {
   if(_mp_time<_m_time)
     {
@@ -1225,7 +1242,7 @@ int MEDFileUMeshAggregateCompute::getSize() const throw(INTERP_KERNEL::Exception
     }
 }
 
-void MEDFileUMeshAggregateCompute::setCoords(DataArrayDouble *coords) throw(INTERP_KERNEL::Exception)
+void MEDFileUMeshAggregateCompute::setCoords(DataArrayDouble *coords)
 {
   for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> >::iterator it=_m_parts.begin();it!=_m_parts.end();it++)
     {