From 36dc4072d06c0157157c91018789f4f801509740 Mon Sep 17 00:00:00 2001 From: bourcier Date: Thu, 11 Apr 2013 13:02:28 +0000 Subject: [PATCH] An exception was thrown when a family has no element. Now this case is managed. It happened on a mesh exported in SMESH with "Automatically create groups" checked and each element of a given dimension was already in a group. --- src/MEDLoader/SauvWriter.cxx | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/MEDLoader/SauvWriter.cxx b/src/MEDLoader/SauvWriter.cxx index 5fb31d2b6..e74496326 100644 --- a/src/MEDLoader/SauvWriter.cxx +++ b/src/MEDLoader/SauvWriter.cxx @@ -404,7 +404,7 @@ void SauvWriter::fillFamilySubMeshes() //================================================================================ /*! - * \brief fill sub-mehses of groups + * \brief fill sub-meshes of groups */ //================================================================================ @@ -418,22 +418,30 @@ void SauvWriter::fillGroupSubMeshes() const vector& famNames = g2ff->second; if ( famNames.empty() ) continue; std::vector famSubMeshes( famNames.size() ); + int k = 0; for ( size_t i = 0; i < famNames.size(); ++i ) { int famID = _fileMesh->getFamilyId( famNames[i].c_str() ); map< int, SubMesh* >::iterator i2f = _famIDs2Sub.find( famID ); - if ( i2f == _famIDs2Sub.end() ) - THROW_IK_EXCEPTION("SauvWriter::fillGroupSubMeshes(): unknown family ID: " << famID); - famSubMeshes[ i ] = i2f->second; + if ( i2f != _famIDs2Sub.end() ) + { + famSubMeshes[ k ] = i2f->second; + ++k; + } } + // if a family exists but has no element, no submesh has been found for this family + // => we have to resize famSubMeshes with the number of submeshes stored + if (k != famNames.size()) + famSubMeshes.resize(k); SubMesh* grpSubMesh = addSubMesh( groupName, famSubMeshes[0]->_dimRelExt ); grpSubMesh->_subs.swap( famSubMeshes ); } } + //================================================================================ /*! - * \brief fill sub-mehses of profiles + * \brief fill sub-meshes of profiles */ //================================================================================ -- 2.39.2