PAL18920: 2 Meshes with the same hypothesis : one compute well but the other not !?!

fix GetSubMeshNodesId() for vertex submesh with several nodes
This commit is contained in:
eap 2008-02-11 15:14:11 +00:00
parent e2cfeef800
commit b88ec5abd8

View File

@ -1946,12 +1946,12 @@ SMESH::long_array* SMESH_Mesh_i::GetSubMeshNodesId(const CORBA::Long ShapeID, CO
SMESHDS_SubMesh* SDSM = SM->GetSubMeshDS(); SMESHDS_SubMesh* SDSM = SM->GetSubMeshDS();
if(!SDSM) return aResult._retn(); if(!SDSM) return aResult._retn();
map<int,const SMDS_MeshElement*> theElems; set<int> theElems;
if( !all || (SDSM->NbElements()==0 && SDSM->NbNodes()==1) ) { if( !all || (SDSM->NbElements()==0) ) { // internal nodes or vertex submesh
SMDS_NodeIteratorPtr nIt = SDSM->GetNodes(); SMDS_NodeIteratorPtr nIt = SDSM->GetNodes();
while ( nIt->more() ) { while ( nIt->more() ) {
const SMDS_MeshNode* elem = nIt->next(); const SMDS_MeshNode* elem = nIt->next();
theElems.insert( make_pair(elem->GetID(),elem) ); theElems.insert( elem->GetID() );
} }
} }
else { // all nodes of submesh elements else { // all nodes of submesh elements
@ -1961,16 +1961,16 @@ SMESH::long_array* SMESH_Mesh_i::GetSubMeshNodesId(const CORBA::Long ShapeID, CO
SMDS_ElemIteratorPtr nIt = anElem->nodesIterator(); SMDS_ElemIteratorPtr nIt = anElem->nodesIterator();
while ( nIt->more() ) { while ( nIt->more() ) {
const SMDS_MeshElement* elem = nIt->next(); const SMDS_MeshElement* elem = nIt->next();
theElems.insert( make_pair(elem->GetID(),elem) ); theElems.insert( elem->GetID() );
} }
} }
} }
aResult->length(theElems.size()); aResult->length(theElems.size());
map<int, const SMDS_MeshElement * >::iterator itElem; set<int>::iterator itElem;
int i = 0; int i = 0;
for ( itElem = theElems.begin(); itElem != theElems.end(); itElem++ ) for ( itElem = theElems.begin(); itElem != theElems.end(); itElem++ )
aResult[i++] = (*itElem).first; aResult[i++] = *itElem;
return aResult._retn(); return aResult._retn();
} }