+SMESH_MeshPartDS::SMESH_MeshPartDS(const std::list< const SMDS_MeshElement* > & meshPart):
+ SMESHDS_Mesh( /*meshID=*/-1, /*isEmbeddedMode=*/true), _meshDS(0)
+{
+ TMeshInfo tmpInfo;
+ list< const SMDS_MeshElement* >::const_iterator partIt = meshPart.begin();
+ for ( ; partIt != meshPart.end(); ++partIt )
+ if ( const SMDS_MeshElement * e = *partIt )
+ if ( _elements[ e->GetType() ].insert( e ).second )
+ {
+ tmpInfo.Add( e );
+ SMDS_ElemIteratorPtr nIt = e->nodesIterator();
+ while ( nIt->more() )
+ {
+ const SMDS_MeshNode * n = (const SMDS_MeshNode*) nIt->next();
+ if ( _elements[ SMDSAbs_Node ].insert( n ).second )
+ tmpInfo.Add( n );
+ }
+ }
+ myInfo = tmpInfo;
+}
+// -------------------------------------------------------------------------------------
+SMDS_ElemIteratorPtr SMESH_MeshPartDS::elementGeomIterator(SMDSAbs_GeometryType geomType) const
+{
+ if ( _meshDS ) return _meshDS->elementGeomIterator( geomType );
+
+ typedef SMDS_SetIterator
+ <const SMDS_MeshElement*,
+ TIDSortedElemSet::const_iterator,
+ SMDS::SimpleAccessor<const SMDS_MeshElement*, TIDSortedElemSet::const_iterator>,
+ SMDS_MeshElement::GeomFilter
+ > TIter;
+
+ SMDSAbs_ElementType type = SMDS_MeshCell::toSmdsType( geomType );
+
+ return SMDS_ElemIteratorPtr( new TIter( _elements[type].begin(),
+ _elements[type].end(),
+ SMDS_MeshElement::GeomFilter( geomType )));
+}
+// -------------------------------------------------------------------------------------
+SMDS_ElemIteratorPtr SMESH_MeshPartDS::elementEntityIterator(SMDSAbs_EntityType entity) const
+{
+ if ( _meshDS ) return _meshDS->elementEntityIterator( entity );
+
+ typedef SMDS_SetIterator
+ <const SMDS_MeshElement*,
+ TIDSortedElemSet::const_iterator,
+ SMDS::SimpleAccessor<const SMDS_MeshElement*, TIDSortedElemSet::const_iterator>,
+ SMDS_MeshElement::EntityFilter
+ > TIter;
+
+ SMDSAbs_ElementType type = SMDS_MeshCell::toSmdsType( entity );
+
+ return SMDS_ElemIteratorPtr( new TIter( _elements[type].begin(),
+ _elements[type].end(),
+ SMDS_MeshElement::EntityFilter( entity )));
+}
+// -------------------------------------------------------------------------------------