0021153: [CEA] non regression test fails

Improve removeFromContainers() by taking into account that now mesh
         element knows the sub-mesh it belongs to
This commit is contained in:
eap 2011-02-10 13:30:00 +00:00
parent a91bb00475
commit 7d73daf123

View File

@ -714,35 +714,23 @@ static void removeFromContainers (map<int,SMESHDS_SubMesh*>& theSubMeshes,
// Rm from sub-meshes // Rm from sub-meshes
// Element should belong to only one sub-mesh // Element should belong to only one sub-mesh
map<int,SMESHDS_SubMesh*>::iterator SubIt = theSubMeshes.begin(); if ( !theSubMeshes.empty() )
for ( ; SubIt != theSubMeshes.end(); SubIt++ )
{ {
int size = isNode ? (*SubIt).second->NbNodes() : (*SubIt).second->NbElements(); SMESHDS_Mesh* mesh = theSubMeshes.begin()->second->getParent();
if ( size == 0 ) continue;
list<const SMDS_MeshElement *>::iterator elIt = theElems.begin(); list<const SMDS_MeshElement *>::iterator elIt = theElems.begin();
while ( elIt != theElems.end() ) if ( isNode ) {
{ for ( ; elIt != theElems.end(); ++elIt )
bool removed = false; if ( SMESHDS_SubMesh* sm = mesh->MeshElements( (*elIt)->getshapeId() ))
if ( isNode ) sm->RemoveNode( static_cast<const SMDS_MeshNode*> (*elIt), deleted );
removed = (*SubIt).second->RemoveNode( static_cast<const SMDS_MeshNode*> (*elIt), deleted ); }
else else {
removed = (*SubIt).second->RemoveElement( *elIt, deleted ); for ( ; elIt != theElems.end(); ++elIt )
if ( SMESHDS_SubMesh* sm = mesh->MeshElements( (*elIt)->getshapeId() ))
if (removed) sm->RemoveElement( *elIt, deleted );
{
elIt = theElems.erase( elIt );
if ( theElems.empty() )
return; // all elements are found and removed
}
else
{
elIt++ ;
}
} }
} }
} }
//======================================================================= //=======================================================================
//function : RemoveNode //function : RemoveNode
//purpose : //purpose :