Salome HOME
Join modifications from branch OCC_development_for_3_2_0a2
[modules/smesh.git] / src / SMESH_I / SMESH_subMesh_i.cxx
index f8ade30f58677fdf052cdec74ea70f8e3eb8b6a0..7772524b60a55bd534b24c2a0f336fbecd63fe4f 100644 (file)
@@ -128,9 +128,8 @@ bool getSubMeshes(::SMESH_subMesh*  theSubMesh,
     list<TopoDS_Shape>::iterator sh = shapeList.begin();
     for ( ; sh != shapeList.end(); ++sh ) {
       for ( TopoDS_Iterator it( *sh ); it.More(); it.Next() ) {
-        ::SMESH_subMesh* aSubMesh = aMesh->GetSubMeshContaining( it.Value() );
-        if ( aSubMesh )
-          getSubMeshes( aSubMesh, theSubMeshList );
+        if ( ::SMESH_subMesh* aSubMesh = aMesh->GetSubMeshContaining( it.Value() ))
+          getSubMeshes( aSubMesh, theSubMeshList ); // add found submesh or explore deeper
         else
           // no submesh for a compound inside compound
           shapeList.push_back( it.Value() );
@@ -147,6 +146,9 @@ bool getSubMeshes(::SMESH_subMesh*  theSubMesh,
     }
     break;
   }
+  default:
+    if ( aSubMeshDS )
+      theSubMeshList.push_back( aSubMeshDS );
   }
   return size < theSubMeshList.size();
 }
@@ -274,7 +276,7 @@ SMESH::long_array* SMESH_subMesh_i::GetElementsId()
     for ( int i = 0; sm != smList.end(); sm++ )
     {
       SMDS_ElemIteratorPtr anIt = (*sm)->GetElements();
-      for ( int n = aSubMeshDS->NbElements(); i < n && anIt->more(); i++ )
+      for ( ; i < nbElems && anIt->more(); i++ )
         aResult[i] = anIt->next()->GetID();
     }
   }