// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// Module : SMESH
// $Header$
-using namespace std;
#include "SMESH_subMesh_i.hxx"
#include "SMESH_Gen_i.hxx"
#include "SMESH_Mesh_i.hxx"
#include <TopoDS.hxx>
#include <TopoDS_Iterator.hxx>
+using namespace std;
+
//=============================================================================
/*!
*
_gen_i = gen_i;
_mesh_i = mesh_i;
_localId = localId;
- thePOA->activate_object( this );
// ****
}
//=============================================================================
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() );
}
break;
}
+ default:
+ if ( aSubMeshDS )
+ theSubMeshList.push_back( aSubMeshDS );
}
return size < theSubMeshList.size();
}
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)
{
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();
}
}
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() );
}