+//=======================================================================
+//function : GetNodes
+//purpose :
+//=======================================================================
+
+SMDS_NodeIteratorPtr SMESHDS_SubMesh::GetNodes() const
+{
+ if ( IsComplexSubmesh() )
+ return SMDS_NodeIteratorPtr( new MyNodeIterator( mySubMeshes ));
+
+ return SMDS_NodeIteratorPtr(new MySetIterator<const SMDS_MeshNode*,TElemSet>(myNodes));
+}
+
+//=======================================================================
+//function : Contains
+//purpose : check if elem or node is in
+//=======================================================================
+
+bool SMESHDS_SubMesh::Contains(const SMDS_MeshElement * ME) const
+{
+ // DO NOT TRY TO FIND A REMOVED ELEMENT !!
+ //if ( IsComplexSubmesh() || !ME )
+ if (!ME )
+ return false;
+
+ if ( IsComplexSubmesh() )
+ {
+ set<const SMESHDS_SubMesh*>::const_iterator aSubIt = mySubMeshes.begin();
+ for ( ; aSubIt != mySubMeshes.end(); aSubIt++ )
+ if ( (*aSubIt)->Contains( ME ))
+ return true;
+ return false;
+ }
+
+ if ( ME->GetType() == SMDSAbs_Node )
+ return ( myNodes.find( ME ) != myNodes.end() );
+
+ return ( myElements.find( ME ) != myElements.end() );
+}
+
+//=======================================================================
+//function : AddSubMesh
+//purpose :
+//=======================================================================
+
+void SMESHDS_SubMesh::AddSubMesh( const SMESHDS_SubMesh* theSubMesh )
+{
+ ASSERT( theSubMesh );
+ mySubMeshes.insert( theSubMesh );
+}
+
+//=======================================================================
+//function : RemoveSubMesh
+//purpose :
+//=======================================================================
+
+bool SMESHDS_SubMesh::RemoveSubMesh( const SMESHDS_SubMesh* theSubMesh )
+{
+ return mySubMeshes.erase( theSubMesh );
+}
+
+//=======================================================================
+//function : ContainsSubMesh
+//purpose :
+//=======================================================================
+
+bool SMESHDS_SubMesh::ContainsSubMesh( const SMESHDS_SubMesh* theSubMesh ) const
+{
+ return mySubMeshes.find( theSubMesh ) != mySubMeshes.end();
+}
+
+//=======================================================================
+//function : GetSubMeshIterator
+//purpose :
+//=======================================================================
+
+SMESHDS_SubMeshIteratorPtr SMESHDS_SubMesh::GetSubMeshIterator() const