X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FStdMeshers%2FStdMeshers_Import_1D.cxx;h=b95e12b90d93665507ffb41203feb0a088d4d7bc;hb=f0f28bd92d337864790e0a073859525f41bc6d46;hp=1fcd7d56005734a87b5bc40cc50601a08a198020;hpb=e182c4b35455fd7e29ce02717480529a557ea27a;p=modules%2Fsmesh.git diff --git a/src/StdMeshers/StdMeshers_Import_1D.cxx b/src/StdMeshers/StdMeshers_Import_1D.cxx index 1fcd7d560..b95e12b90 100644 --- a/src/StdMeshers/StdMeshers_Import_1D.cxx +++ b/src/StdMeshers/StdMeshers_Import_1D.cxx @@ -246,7 +246,8 @@ namespace // INTERNAL STUFF typedef map< SMESH_Mesh*, list< _ImportData > > TMesh2ImpData; TMesh2ImpData _tgtMesh2ImportData; - _Listener():SMESH_subMeshEventListener(/*isDeletable=*/false){} + _Listener():SMESH_subMeshEventListener(/*isDeletable=*/false, + "StdMeshers_Import_1D::_Listener") {} public: // return poiter to a static listener @@ -303,14 +304,16 @@ namespace // INTERNAL STUFF // set listener to hear events of the submesh computed by "Import" algo importSub->SetEventListener( get(), new _ListenerData(srcHyp), importSub ); - // set a listener to hear events of the source mesh + // set listeners to hear events of the source mesh SMESH_subMesh* smToNotify = importSub; - SMESH_subMesh* smToListen = srcMesh->GetSubMeshContaining(1); - SMESH_subMeshEventListenerData* data = new _ListenerData(srcHyp, LISTEN_SRC_MESH); - data->mySubMeshes.push_back( smToNotify ); - importSub->SetEventListener( get(), data, smToListen ); - - // remeber the submesh importSub and its sub-submeshes + vector smToListen = srcHyp->GetSourceSubMeshes( srcMesh ); + for ( size_t i = 0; i < smToListen.size(); ++i ) + { + SMESH_subMeshEventListenerData* data = new _ListenerData(srcHyp, LISTEN_SRC_MESH); + data->mySubMeshes.push_back( smToNotify ); + importSub->SetEventListener( get(), data, smToListen[i] ); + } + // remember the submesh importSub and its sub-submeshes _ImportData* iData = _Listener::getImportData( srcMesh, importSub->GetFather()); iData->trackHypParams( importSub, srcHyp ); iData->addComputed( importSub ); @@ -370,11 +373,11 @@ namespace // INTERNAL STUFF // clear the rest submeshes if ( !d->_computedSubM.empty() ) { - set< SMESH_subMesh*, _SubLess> subs; - subs.swap( d->_computedSubM ); // avoid recursion via events - while ( !subs.empty() ) + d->_computedSubM.clear(); + set< SMESH_subMesh*, _SubLess>::iterator sub = d->_subM.begin(); + for ( ; sub != d->_subM.end(); ++sub ) { - SMESH_subMesh* subM = *subs.begin(); subs.erase( subs.begin() ); + SMESH_subMesh* subM = *sub; _ListenerData* hypData = (_ListenerData*) subM->GetEventListenerData( get() ); if ( hypData ) d->removeGroups( sm, hypData->_srcHyp ); @@ -507,7 +510,7 @@ namespace // INTERNAL STUFF { // To get SMESH_subMesh corresponding to srcMeshDS we need to have a shape // for which SMESHDS_Mesh::IsGroupOfSubShapes() returns true. - // And this shape must be different from subshapes of the main shape. + // And this shape must be different from sub-shapes of the main shape. // So we create a compound containing // 1) some sub-shapes of SMESH_Mesh::PseudoShape() corresponding to // srcMeshDS->GetPersistentId()