-// Copyright (C) 2007-2017 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2023 CEA, EDF
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
MEDFileMeshSupports::MEDFileMeshSupports(med_idt fid)
{
- int nbSM(MEDnSupportMesh(fid));
+ med_int nbSM(MEDnSupportMesh(fid));
_supports.resize(nbSM);
for(int i=0;i<nbSM;i++)
{
INTERP_KERNEL::AutoPtr<char> msn(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
INTERP_KERNEL::AutoPtr<char> description(MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE));
med_axis_type axType;
- int nAxis(MEDsupportMeshnAxis(fid,i+1));
+ med_int nAxis(MEDsupportMeshnAxis(fid,i+1));
INTERP_KERNEL::AutoPtr<char> axisName(new char[MED_SNAME_SIZE*nAxis+1]),axisUnit(new char[MED_SNAME_SIZE*nAxis+1]);
- int spaceDim(0),meshDim(0);
+ med_int spaceDim(0),meshDim(0);
MEDFILESAFECALLERRD0(MEDsupportMeshInfo,(fid,i+1,msn,&spaceDim,&meshDim,description,&axType,axisName,axisUnit));
std::string name(MEDLoaderBase::buildStringFromFortran(msn,MED_NAME_SIZE));
_supports[i]=MEDFileUMesh::New(fid,name);
(*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;
}
}
std::ostringstream oss;
- oss << "MEDFileMeshSupports::getSupMeshWithName : no such name \"" << name << "\". Possibilitities are :";
+ oss << "MEDFileMeshSupports::getSupMeshWithName : no such name \"" << name << "\". Possibilities are :";
std::copy(mns.begin(),mns.end(),std::ostream_iterator<std::string>(oss,","));
oss << " !";
throw INTERP_KERNEL::Exception(oss.str());
}
-int 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 !");