Salome HOME
Just do it
[tools/medcoupling.git] / src / MEDLoader / MEDFileMeshSupport.cxx
index 6958cb02a384cedd077bfbbf303425f14192b04a..d70600c85015766bddcd72256772aa71203f2db9 100644 (file)
@@ -90,6 +90,15 @@ void MEDFileMeshSupports::writeLL(med_idt fid) const
       (*it)->writeLL(fid);
 }
 
+std::vector<std::string> MEDFileMeshSupports::getSupMeshNames() const
+{
+  std::vector<std::string> ret;
+  for(std::vector< MCAuto<MEDFileUMesh> >::const_iterator it=_supports.begin();it!=_supports.end();it++)
+    if((*it).isNotNull())
+      ret.push_back((*it)->getName());
+  return ret;
+}
+
 const MEDFileUMesh *MEDFileMeshSupports::getSupMeshWithName(const std::string& name) const
 {
   std::vector<std::string> mns;
@@ -111,8 +120,22 @@ const MEDFileUMesh *MEDFileMeshSupports::getSupMeshWithName(const std::string& n
   throw INTERP_KERNEL::Exception(oss.str());
 }
 
-int MEDFileMeshSupports::getNumberOfNodesPerCellOf(const std::string& name) const
+int MEDFileMeshSupports::getNumberOfNodesInConnOf(TypeOfField entity, const std::string& name) const
 {
   const MEDFileUMesh *sup(getSupMeshWithName(name));
-  return sup->getNumberOfNodes();
+  switch(entity)
+    {
+    case ON_NODES:
+      return sup->getNumberOfNodes();
+    case ON_CELLS:
+      {
+        std::vector<INTERP_KERNEL::NormalizedCellType> gt(sup->getAllGeoTypes());
+        if(gt.size()!=1)
+          throw INTERP_KERNEL::Exception("MEDFileMeshSupports::getNumberOfNodesInConnOf : on cells only one geometric type allowed !");
+        const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(gt[0]));
+        return sup->getNumberOfCellsAtLevel(0)*cm.getNumberOfNodes();
+      }
+    default:
+      throw INTERP_KERNEL::Exception("MEDFileMeshSupports::getNumberOfNodesInConnOf : not recognized entity type !");
+    }
 }