From: ageay Date: Fri, 6 Dec 2013 16:21:04 +0000 (+0000) Subject: Additional methods for edition of groups and families. X-Git-Tag: V7_3_1b1~21 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0d94be655853a0da5b8934e3f64c8fb697238273;p=tools%2Fmedcoupling.git Additional methods for edition of groups and families. --- diff --git a/src/MEDLoader/MEDFileMesh.cxx b/src/MEDLoader/MEDFileMesh.cxx index 8a39139cd..945f8f3d0 100644 --- a/src/MEDLoader/MEDFileMesh.cxx +++ b/src/MEDLoader/MEDFileMesh.cxx @@ -274,6 +274,45 @@ void MEDFileMesh::copyFamGrpMapsFrom(const MEDFileMesh& other) _families=other._families; } + +/*! + * This method clear all the groups in the map. + * So this method does not operate at all on arrays. + * So this method can lead to orphan families. + * + * \sa MEDFileMesh::clearFamMap, MEDFileMesh::clearFamGrpMaps + */ +void MEDFileMesh::clearGrpMap() +{ + _groups.clear(); +} + +/*! + * This method clear all the families in the map. + * So this method does not operate at all on arrays. + * WARNING ! if there are some groups lying on cleared families, those groups will be impacted ! + * + * \sa MEDFileMesh::clearFamMap, MEDFileMesh::clearFamGrpMaps + */ +void MEDFileMesh::clearFamMap() +{ + _families.clear(); +} + +/*! + * This method clear all the families and groups in the map. + * So this method does not operate at all on arrays. + * As all groups and families entry will be removed after + * the call of MEDFileMesh::setFamilyFieldArr method with 0 or None (python) in the 2nd parameter can be useful to reduce the size of the object. + * + * \sa MEDFileMesh::clearFamMap, MEDFileMesh::clearFamMap + */ +void MEDFileMesh::clearFamGrpMaps() +{ + clearGrpMap(); + clearFamMap(); +} + /*! * Returns names of families constituting a group. * \param [in] name - the name of the group of interest. diff --git a/src/MEDLoader/MEDFileMesh.hxx b/src/MEDLoader/MEDFileMesh.hxx index e6f2d3b6f..5a6fa5812 100644 --- a/src/MEDLoader/MEDFileMesh.hxx +++ b/src/MEDLoader/MEDFileMesh.hxx @@ -92,6 +92,9 @@ namespace ParaMEDMEM MEDLOADER_EXPORT void setFamilyInfo(const std::map& info); MEDLOADER_EXPORT void setGroupInfo(const std::map >&info); MEDLOADER_EXPORT void copyFamGrpMapsFrom(const MEDFileMesh& other); + MEDLOADER_EXPORT void clearGrpMap(); + MEDLOADER_EXPORT void clearFamMap(); + MEDLOADER_EXPORT void clearFamGrpMaps(); MEDLOADER_EXPORT const std::map& getFamilyInfo() const { return _families; } MEDLOADER_EXPORT const std::map >& getGroupInfo() const { return _groups; } MEDLOADER_EXPORT std::vector getFamiliesOnGroup(const char *name) const; diff --git a/src/MEDLoader/Swig/MEDLoaderCommon.i b/src/MEDLoader/Swig/MEDLoaderCommon.i index cfac2c6e0..991bb2f1f 100644 --- a/src/MEDLoader/Swig/MEDLoaderCommon.i +++ b/src/MEDLoader/Swig/MEDLoaderCommon.i @@ -510,6 +510,9 @@ namespace ParaMEDMEM virtual void createGroupOnAll(int meshDimRelToMaxExt, const char *groupName) throw(INTERP_KERNEL::Exception); virtual bool keepFamIdsOnlyOnLevs(const std::vector& famIds, const std::vector& levs) throw(INTERP_KERNEL::Exception); void copyFamGrpMapsFrom(const MEDFileMesh& other) throw(INTERP_KERNEL::Exception); + void clearGrpMap() throw(INTERP_KERNEL::Exception); + void clearFamMap() throw(INTERP_KERNEL::Exception); + void clearFamGrpMaps() throw(INTERP_KERNEL::Exception); const std::map& getFamilyInfo() const throw(INTERP_KERNEL::Exception); const std::map >& getGroupInfo() const throw(INTERP_KERNEL::Exception); std::vector getFamiliesOnGroup(const char *name) const throw(INTERP_KERNEL::Exception);