for ( ; sm != smList.end(); ++sm )
{
SMDS_ElemIteratorPtr eIt = (*sm)->GetElements();
- while ( eIt->more() ) {
- const SMDS_MeshElement* anElem = eIt->next();
- SMDS_ElemIteratorPtr nIt = anElem->nodesIterator();
+ if ( eIt->more() ) {
+ while ( eIt->more() ) {
+ const SMDS_MeshElement* anElem = eIt->next();
+ SMDS_ElemIteratorPtr nIt = anElem->nodesIterator();
+ while ( nIt->more() )
+ nodeIds.insert( nIt->next()->GetID() );
+ }
+ } else {
+ SMDS_NodeIteratorPtr nIt = (*sm)->GetNodes();
while ( nIt->more() )
nodeIds.insert( nIt->next()->GetID() );
- }
+ }
}
return nodeIds.size();
}
if ( all ) { // all nodes of submesh elements
SMDS_ElemIteratorPtr eIt = aSubMeshDS->GetElements();
- while ( eIt->more() ) {
- const SMDS_MeshElement* anElem = eIt->next();
- SMDS_ElemIteratorPtr nIt = anElem->nodesIterator();
+ if ( eIt->more() ) {
+ while ( eIt->more() ) {
+ const SMDS_MeshElement* anElem = eIt->next();
+ SMDS_ElemIteratorPtr nIt = anElem->nodesIterator();
+ while ( nIt->more() )
+ nodeIds.insert( nIt->next()->GetID() );
+ }
+ } else {
+ SMDS_NodeIteratorPtr nIt = aSubMeshDS->GetNodes();
while ( nIt->more() )
nodeIds.insert( nIt->next()->GetID() );
}
return nodeIds.size();
}
-
+
return aSubMeshDS->NbNodes();
}
*
*/
//=============================================================================
-
+
SMESH::long_array* SMESH_subMesh_i::GetElementsId()
throw (SALOME::SALOME_Exception)
{
if ( theElemType == SMESH::NODE )
{
SMDS_ElemIteratorPtr eIt = (*sm)->GetElements();
- while ( eIt->more() ) {
- const SMDS_MeshElement* anElem = eIt->next();
- SMDS_ElemIteratorPtr nIt = anElem->nodesIterator();
+ if ( eIt->more() ) {
+ while ( eIt->more() ) {
+ const SMDS_MeshElement* anElem = eIt->next();
+ SMDS_ElemIteratorPtr nIt = anElem->nodesIterator();
+ while ( nIt->more() )
+ nodeIds.insert( nIt->next()->GetID() );
+ }
+ } else {
+ SMDS_NodeIteratorPtr nIt = (*sm)->GetNodes();
while ( nIt->more() )
nodeIds.insert( nIt->next()->GetID() );
}
if ( theElemType == SMESH::NODE && aSubMeshDS )
{
SMDS_ElemIteratorPtr eIt = aSubMeshDS->GetElements();
- while ( eIt->more() ) {
- const SMDS_MeshElement* anElem = eIt->next();
- SMDS_ElemIteratorPtr nIt = anElem->nodesIterator();
+ if ( eIt->more() ) {
+ while ( eIt->more() ) {
+ const SMDS_MeshElement* anElem = eIt->next();
+ SMDS_ElemIteratorPtr nIt = anElem->nodesIterator();
+ while ( nIt->more() )
+ nodeIds.insert( nIt->next()->GetID() );
+ }
+ } else {
+ SMDS_NodeIteratorPtr nIt = aSubMeshDS->GetNodes();
while ( nIt->more() )
nodeIds.insert( nIt->next()->GetID() );
}