From: eap Date: Mon, 12 Mar 2007 10:08:53 +0000 (+0000) Subject: PAL15188 (wrong groups after Concatenate with merge nodes and rename groups) X-Git-Tag: V3_2_6pre2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0811f12ddab92fe0e071a89873b92ed02c3630d4;p=modules%2Fsmesh.git PAL15188 (wrong groups after Concatenate with merge nodes and rename groups) in MergeEqualElements(), add kept elem in groups of removed one --- diff --git a/src/SMESH/SMESH_MeshEditor.cxx b/src/SMESH/SMESH_MeshEditor.cxx index 69c16c627..e9de338f0 100644 --- a/src/SMESH/SMESH_MeshEditor.cxx +++ b/src/SMESH/SMESH_MeshEditor.cxx @@ -5038,31 +5038,31 @@ void SMESH_MeshEditor::MergeNodes (TListOfListOfNodes & theGroupsOfNodes) } -// ================================================= +// ======================================================== // class : SortableElement -// purpose : auxilary -// ================================================= +// purpose : allow sorting elements basing on their nodes +// ======================================================== class SortableElement : public set { public: SortableElement( const SMDS_MeshElement* theElem ) { - myID = theElem->GetID(); + myElem = theElem; SMDS_ElemIteratorPtr nodeIt = theElem->nodesIterator(); while ( nodeIt->more() ) this->insert( nodeIt->next() ); } - const long GetID() const - { return myID; } + const SMDS_MeshElement* Get() const + { return myElem; } - void SetID(const long anID) const - { myID = anID; } + void Set(const SMDS_MeshElement* e) const + { myElem = e; } private: - mutable long myID; + mutable const SMDS_MeshElement* myElem; }; @@ -5104,14 +5104,18 @@ void SMESH_MeshEditor::MergeEqualElements() // check uniqueness pair< set::iterator, bool> pp = setOfNodeSet.insert(SE); if( !(pp.second) ) { - set::iterator itSE = pp.first; - SortableElement SEold = *itSE; - if( SEold.GetID() > SE.GetID() ) { - rmElemIds.push_back( SEold.GetID() ); - (*itSE).SetID(SE.GetID()); + set::iterator & itSE = pp.first; + const SortableElement & SEold = *itSE; + if( SEold.Get()->GetID() > elem->GetID() ) { + // keep elem, remove old + rmElemIds.push_back( SEold.Get()->GetID() ); + // add kept elem in groups of removed one (PAL15188) + AddToSameGroups( elem, SEold.Get(), GetMeshDS() ); + SEold.Set( elem ); } - else { - rmElemIds.push_back( SE.GetID() ); + else { // remove elem + rmElemIds.push_back( elem->GetID() ); + AddToSameGroups( SEold.Get(), elem, GetMeshDS() ); } } }