X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH%2FSMESH_Mesh.cxx;h=eac04a4d1604fda010e7e467e0897f81f132a8b7;hp=094dd4fee537e9492d7cb87778e3eecfceef6bad;hb=5d0b75d9d1a9935ec419e820e6dde45a665dd978;hpb=1c1bbf6798782cb24bcab45d519817cff125ae5c diff --git a/src/SMESH/SMESH_Mesh.cxx b/src/SMESH/SMESH_Mesh.cxx index 094dd4fee..eac04a4d1 100644 --- a/src/SMESH/SMESH_Mesh.cxx +++ b/src/SMESH/SMESH_Mesh.cxx @@ -714,6 +714,7 @@ SMESH_Mesh::AddHypothesis(const TopoDS_Shape & aSubShape, } } HasModificationsToDiscard(); // to reset _isModified flag if a mesh becomes empty + GetMeshDS()->Modified(); if(MYDEBUG) subMesh->DumpAlgoState(true); if(MYDEBUG) SCRUTE(ret); @@ -784,6 +785,7 @@ SMESH_Mesh::RemoveHypothesis(const TopoDS_Shape & aSubShape, } HasModificationsToDiscard(); // to reset _isModified flag if mesh become empty + GetMeshDS()->Modified(); if(MYDEBUG) subMesh->DumpAlgoState(true); if(MYDEBUG) SCRUTE(ret); @@ -1242,24 +1244,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(); } @@ -1374,6 +1386,8 @@ bool SMESH_Mesh::HasDuplicatedGroupNamesMED() * - 2D if all mesh nodes lie on XOY coordinate plane, or * - 3D in the rest cases. * If \a theAutoDimension is \c false, the space dimension is always 3. + * \param [in] theAddODOnVertices - to create 0D elements on all vertices + * \param [in] theAllElemsToGroup - to make every element to belong to any group (PAL23413) * \return int - mesh index in the file */ //================================================================================ @@ -1384,7 +1398,8 @@ void SMESH_Mesh::ExportMED(const char * file, int theVersion, const SMESHDS_Mesh* meshPart, bool theAutoDimension, - bool theAddODOnVertices) + bool theAddODOnVertices, + bool theAllElemsToGroup) throw(SALOME_Exception) { SMESH_TRY; @@ -1407,6 +1422,8 @@ void SMESH_Mesh::ExportMED(const char * file, myWriter.AddGroupOfFaces(); myWriter.AddGroupOfVolumes(); } + if ( theAllElemsToGroup ) + myWriter.AddAllToGroup(); // Pass groups to writer. Provide unique group names. //set aGroupNames; // Corrected for Mantis issue 0020028 @@ -1462,7 +1479,9 @@ void SMESH_Mesh::ExportSAUV(const char *file, cmd += "from medutilities import my_remove ; my_remove(r'" + medfilename + "')"; cmd += "\""; system(cmd.c_str()); - ExportMED(medfilename.c_str(), theMeshName, theAutoGroups, 1); + ExportMED(medfilename.c_str(), theMeshName, theAutoGroups, /*theVersion=*/1, + /*meshPart=*/NULL, /*theAutoDimension=*/false, /*theAddODOnVertices=*/false, + /*theAllElemsToGroup=*/true ); // theAllElemsToGroup is for PAL0023413 #ifdef WIN32 cmd = "%PYTHONBIN% "; #else @@ -2358,7 +2377,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; @@ -2376,18 +2395,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 } //=============================================================================