From: eap Date: Fri, 18 Jul 2014 11:13:16 +0000 (+0400) Subject: 0052454: Sub-mesh priority is not taken into account X-Git-Tag: V7_5_0a1~48 X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=commitdiff_plain;h=0086dda865781dcfc8cb639a5855ceb90ecf8ca4 0052454: Sub-mesh priority is not taken into account --- diff --git a/src/SMESH/SMESH_Mesh.cxx b/src/SMESH/SMESH_Mesh.cxx index b3cf4dfda..6d4db5d83 100644 --- a/src/SMESH/SMESH_Mesh.cxx +++ b/src/SMESH/SMESH_Mesh.cxx @@ -2206,18 +2206,39 @@ bool SMESH_Mesh::SortByMeshOrder(list& theListToSort) const map< int, TPosInList > sortedPos; TPosInList smBeg = theListToSort.begin(), smEnd = theListToSort.end(); TListOfListOfInt::const_iterator listIdsIt = _mySubMeshOrder.begin(); - for( ; listIdsIt != _mySubMeshOrder.end(); listIdsIt++) { + for( ; listIdsIt != _mySubMeshOrder.end(); listIdsIt++) + { const TListOfInt& listOfId = *listIdsIt; + // convert sm ids to sm's + vector smVec; TListOfInt::const_iterator idIt = listOfId.begin(); for ( ; idIt != listOfId.end(); idIt++ ) { if ( SMESH_subMesh * sm = GetSubMeshContaining( *idIt )) { - TPosInList smPos = find( smBeg, smEnd, sm ); - if ( smPos != smEnd ) { - onlyOrderedList.push_back( sm ); - sortedPos[ distance( smBeg, smPos )] = smPos; + if ( sm->GetSubMeshDS() && sm->GetSubMeshDS()->IsComplexSubmesh() ) + { + SMESHDS_SubMeshIteratorPtr smdsIt = sm->GetSubMeshDS()->GetSubMeshIterator(); + while ( smdsIt->more() ) + { + const SMESHDS_SubMesh* smDS = smdsIt->next(); + if (( sm = GetSubMeshContaining( smDS->GetID() ))) + smVec.push_back( sm ); + } + } + else + { + smVec.push_back( sm ); } } } + // find smVec items in theListToSort + for ( size_t i = 0; i < smVec.size(); ++i ) + { + TPosInList smPos = find( smBeg, smEnd, smVec[i] ); + if ( smPos != smEnd ) { + onlyOrderedList.push_back( smVec[i] ); + sortedPos[ distance( smBeg, smPos )] = smPos; + } + } } if (onlyOrderedList.size() < 2) return res;