X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH%2FSMESH_Mesh.cxx;h=ff127dece72588a29e297dde56a32e072bd7efb2;hp=bcd4b4185f147891c3efad49d93ef2f4057d0eb2;hb=b2eb2c3cef7c6fffbcc17e027be5e4d0357a935a;hpb=6b1de623316c78e9bc6e18b7e2a98883bd800ff1 diff --git a/src/SMESH/SMESH_Mesh.cxx b/src/SMESH/SMESH_Mesh.cxx index bcd4b4185..ff127dece 100644 --- a/src/SMESH/SMESH_Mesh.cxx +++ b/src/SMESH/SMESH_Mesh.cxx @@ -438,6 +438,7 @@ void SMESH_Mesh::Clear() sm->ComputeSubMeshStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE ); } } + GetMeshDS()->Modified(); _isModified = false; } @@ -1241,24 +1242,34 @@ void SMESH_Mesh::NotifySubMeshesHypothesisModification(const SMESH_Hypothesis* h } } if ( toNotify ) + { smToNotify.push_back( aSubMesh ); - - if ( !aSubMesh->IsEmpty() && - aSubMesh->GetSubShape().ShapeType() == TopAbs_EDGE && - !toNotify ) - allMeshedEdgesNotified = false; + if ( aSubMesh->GetAlgoState() == SMESH_subMesh::MISSING_HYP ) + allMeshedEdgesNotified = false; // update of algo state needed, not mesh clearing + } + else + { + if ( !aSubMesh->IsEmpty() && + aSubMesh->GetSubShape().ShapeType() == TopAbs_EDGE ) + allMeshedEdgesNotified = false; + } } + if ( smToNotify.empty() ) + return; // if all meshed EDGEs will be notified then the notification is equivalent - // to the whole mesh clearing - if ( allMeshedEdgesNotified ) + // to the whole mesh clearing, which is usually faster + if ( allMeshedEdgesNotified && NbNodes() > 0 ) + { Clear(); + } else - // notify in reverse order to avoid filling of the pool of IDs + { + // notify in reverse order to avoid filling the pool of IDs for ( int i = smToNotify.size()-1; i >= 0; --i ) smToNotify[i]->AlgoStateEngine(SMESH_subMesh::MODIF_HYP, const_cast< SMESH_Hypothesis*>( hyp )); - + } HasModificationsToDiscard(); // to reset _isModified flag if mesh becomes empty GetMeshDS()->Modified(); } @@ -2357,7 +2368,7 @@ bool SMESH_Mesh::SortByMeshOrder(std::vector& theListToSort) con vector::iterator onlyBIt = onlyOrderedList.begin(); vector::iterator onlyEIt = onlyOrderedList.end(); - // iterate on ordered submeshes and insert them in detected positions + // iterate on ordered sub-meshes and insert them in detected positions map< int, TPosInList >::iterator i_pos = sortedPos.begin(); for ( ; onlyBIt != onlyEIt; ++onlyBIt, ++i_pos ) *(i_pos->second) = *onlyBIt; @@ -2375,18 +2386,27 @@ bool SMESH_Mesh::IsOrderOK( const SMESH_subMesh* smBefore, const SMESH_subMesh* smAfter ) const { TListOfListOfInt::const_iterator listIdsIt = _mySubMeshOrder.begin(); - TListOfInt::const_iterator idBef, idAft; for( ; listIdsIt != _mySubMeshOrder.end(); listIdsIt++) { const TListOfInt& listOfId = *listIdsIt; - idBef = std::find( listOfId.begin(), listOfId.end(), smBefore->GetId() ); - if ( idBef != listOfId.end() ) - idAft = std::find( listOfId.begin(), listOfId.end(), smAfter->GetId() ); - if ( idAft != listOfId.end () ) - return ( std::distance( listOfId.begin(), idBef ) < - std::distance( listOfId.begin(), idAft ) ); + int iB = -1, iA = -1, i = 0; + for ( TListOfInt::const_iterator id = listOfId.begin(); id != listOfId.end(); ++id, ++i ) + { + if ( *id == smBefore->GetId() ) + { + iB = i; + if ( iA > -1 ) + return iB < iA; + } + else if ( *id == smAfter->GetId() ) + { + iA = i; + if ( iB > -1 ) + return iB < iA; + } + } } - return true; // no order imposed to given submeshes + return true; // no order imposed to given sub-meshes } //=============================================================================