throw INTERP_KERNEL::Exception(oss.str());
}
-mcIdType MEDFileMeshSupports::getNumberOfNodesInConnOf(TypeOfField entity, const std::string& name) const
+mcIdType MEDFileMeshSupports::getNumberOfNodesInConnOf(TypeOfField entity, INTERP_KERNEL::NormalizedCellType gt, const std::string& name) const
{
const MEDFileUMesh *sup(getSupMeshWithName(name));
switch(entity)
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();
+ std::vector<INTERP_KERNEL::NormalizedCellType> gts(sup->getAllGeoTypes());
+ if(std::find(gts.begin(),gts.end(),gt) == gts.end())
+ throw INTERP_KERNEL::Exception("MEDFileMeshSupports::getNumberOfNodesInConnOf : specified geometric type not found !");
+ const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(gt));
+ return sup->getNumberOfCellsWithType(gt)*cm.getNumberOfNodes();
}
default:
throw INTERP_KERNEL::Exception("MEDFileMeshSupports::getNumberOfNodesInConnOf : not recognized entity type !");
MEDLOADER_EXPORT void writeLL(med_idt fid) const;
MEDLOADER_EXPORT std::vector<std::string> getSupMeshNames() const;
MEDLOADER_EXPORT const MEDFileUMesh *getSupMeshWithName(const std::string& name) const;
- MEDLOADER_EXPORT mcIdType getNumberOfNodesInConnOf(TypeOfField entity, const std::string& name) const;
+ MEDLOADER_EXPORT mcIdType getNumberOfNodesInConnOf(TypeOfField entity, INTERP_KERNEL::NormalizedCellType gt, const std::string& name) const;
private:
MEDFileMeshSupports(med_idt fid);
MEDFileMeshSupports();
return 1;
const MEDFileStructureElement *se(getSEWithName(seName));
std::string meshName(se->getMeshName());
- return _sup->getNumberOfNodesInConnOf(se->getEntity(),meshName);
+ return _sup->getNumberOfNodesInConnOf(se->getEntity(),se->getGeoType(),meshName);
}
const MEDFileStructureElement *MEDFileStructureElements::getSEWithName(const std::string& seName) const
MEDLOADER_EXPORT std::vector<std::string> getVarAtts() const;
MEDLOADER_EXPORT const MEDFileSEVarAtt *getVarAtt(const std::string& varName) const;
MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileStructureElement"); }
+ MEDLOADER_EXPORT INTERP_KERNEL::NormalizedCellType getGeoType() const { return _geo_type; }
public:
std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
std::size_t getHeapMemorySizeWithoutChildren() const;