X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDLoader%2FMEDFileMesh.cxx;h=48464da2d41f195ee724bab75ff7a02538b5782b;hb=532cd3db0bc67402017e3506afece3407d52a646;hp=7e610d1a8117bebc5c6b0851899f72caa7f499dc;hpb=0708f9066289310b3a411ff9369f334fa3468098;p=tools%2Fmedcoupling.git diff --git a/src/MEDLoader/MEDFileMesh.cxx b/src/MEDLoader/MEDFileMesh.cxx index 7e610d1a8..48464da2d 100644 --- a/src/MEDLoader/MEDFileMesh.cxx +++ b/src/MEDLoader/MEDFileMesh.cxx @@ -826,6 +826,8 @@ void MEDFileMesh::removeFamiliesReferedByNoGroups() * This method has no impact on groups. This method only works on families. This method firstly removes families not referred by any groups in \a this, then all unused entities * are put as belonging to family 0 ("FAMILLE_ZERO"). Finally, all orphanFamilies are killed. * This method raises an exception if "FAMILLE_ZERO" is already belonging to a group. + * + * This method also raises an exception if a family belonging to a group has also id 0 (which is not right in MED file format). You should never encounter this case using addGroup method. * * \sa MEDFileMesh::removeOrphanFamilies */ @@ -837,7 +839,17 @@ void MEDFileMesh::rearrangeFamilies() std::vector levels(getNonEmptyLevelsExt()); std::set idsRefed; for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) - idsRefed.insert((*it).second); + { + idsRefed.insert((*it).second); + if((*it).second==0) + { + if(!getGroupsOnFamily((*it).first).empty()) + { + std::ostringstream oss; oss << "MEDFileMesh::rearrangeFamilies : Not orphan family \"" << (*it).first << "\" has id 0 ! This method may alterate groups in this for such a case !"; + throw INTERP_KERNEL::Exception(oss.str()); + } + } + } for(std::vector::const_iterator it=levels.begin();it!=levels.end();it++) { const DataArrayInt *fams(0); @@ -1333,7 +1345,7 @@ void MEDFileMesh::addGroupUnderground(bool isNodeGroup, const DataArrayInt *ids, bool isFamPresent=false; for(std::list< MCAuto >::const_iterator itl=allFamIds.begin();itl!=allFamIds.end() && !isFamPresent;itl++) isFamPresent=(*itl)->presenceOfValue(*famId); - if(!isFamPresent) + if(!isFamPresent && *famId!=0) { familyIds.push_back(*famId); idsPerfamiliyIds.push_back(ret0); fams.push_back(FindOrCreateAndGiveFamilyWithId(families,*famId,created)); } // adding *famId in grp else {