From: abn Date: Mon, 26 Oct 2020 13:27:41 +0000 (+0100) Subject: MEDFileCMesh: bug fix: getFamsNonEmptyLevels{Ext} was buggy X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e8d31bee9acf09437bdde654114b628de8242811;p=tools%2Fmedcoupling.git MEDFileCMesh: bug fix: getFamsNonEmptyLevels{Ext} was buggy --- diff --git a/src/MEDLoader/MEDFileMesh.cxx b/src/MEDLoader/MEDFileMesh.cxx index 10a17bc42..404e40cb5 100644 --- a/src/MEDLoader/MEDFileMesh.cxx +++ b/src/MEDLoader/MEDFileMesh.cxx @@ -6416,24 +6416,37 @@ MEDCouplingMesh *MEDFileStructuredMesh::getMeshAtLevel(int meshDimRelToMax, bool } } +/*! + * Returns all relative mesh levels (**excluding nodes**) where given families are defined. + * To include nodes, call getFamsNonEmptyLevelsExt() method. + * \param [in] fams - the name of the family of interest. + * \return std::vector - a sequence of the relative dimensions. + */ std::vector MEDFileStructuredMesh::getFamsNonEmptyLevels(const std::vector& fams) const { - std::vector ret; + std::vector lvls; + std::vector famIds(getFamiliesIds(fams)); const DataArrayIdType *famCells(_fam_cells),*famFaces(_fam_faces); - if(famCells && famCells->presenceOfValue(ret)) - ret.push_back(0); - if(famFaces && famFaces->presenceOfValue(ret)) - ret.push_back(-1); - return ret; + if(famCells && famCells->presenceOfValue(famIds)) + lvls.push_back(0); + if(famFaces && famFaces->presenceOfValue(famIds)) + lvls.push_back(-1); + return lvls; } +/*! + * Returns all relative mesh levels (including nodes) where given families are defined. + * \param [in] fams - the names of the families of interest. + * \return std::vector - a sequence of the relative dimensions. + */ std::vector MEDFileStructuredMesh::getFamsNonEmptyLevelsExt(const std::vector& fams) const { - std::vector ret(getFamsNonEmptyLevels(fams)); + std::vector lvls(getFamsNonEmptyLevels(fams)); + std::vector famIds(getFamiliesIds(fams)); const DataArrayIdType *famNodes(_fam_nodes); - if(famNodes && famNodes->presenceOfValue(ret)) - ret.push_back(1); - return ret; + if(famNodes && famNodes->presenceOfValue(famIds)) + lvls.push_back(1); + return lvls; } /*!