-class _MyEdgeIterator : public SMDS_ElemIterator
-{
- vector< const SMDS_MeshElement* > myElems;
- int myIndex;
-public:
- _MyEdgeIterator(const SMDS_MeshFace* face):myIndex(0) {
- myElems.reserve( face->NbNodes() );
- for ( int i = 0; i < face->NbNodes(); ++i ) {
- const SMDS_MeshElement* edge =
- SMDS_Mesh::FindEdge( face->GetNode( i ), face->GetNodeWrap( i + 1 ));
- if ( edge )
- myElems.push_back( edge );
- }
- }
- /// Return true if and only if there are other object in this iterator
- virtual bool more() { return myIndex < myElems.size(); }
-
- /// Return the current object and step to the next one
- virtual const SMDS_MeshElement* next() { return myElems[ myIndex++ ]; }
-};
-
-SMDS_ElemIteratorPtr SMDS_PolygonalFaceOfNodes::elementsIterator
- (SMDSAbs_ElementType type) const
-{
- switch(type)
- {
- case SMDSAbs_Face:
- return SMDS_MeshElement::elementsIterator(SMDSAbs_Face);
- case SMDSAbs_Node:
- return SMDS_ElemIteratorPtr(new SMDS_PolygonalFaceOfNodes_MyIterator(myNodes));
- case SMDSAbs_Edge:
- return SMDS_ElemIteratorPtr(new _MyEdgeIterator( this ));
- break;
- default:
- return SMDS_ElemIteratorPtr
- (new SMDS_IteratorOfElements
- (this,type,SMDS_ElemIteratorPtr
- (new SMDS_PolygonalFaceOfNodes_MyIterator(myNodes))));
- }
- return SMDS_ElemIteratorPtr();
-}
-