Version: 6.3.1
Public Member Functions | Private Member Functions | Private Attributes

SMDS_IteratorOfElements Class Reference

#include <SMDS_IteratorOfElements.hxx>

Inheritance diagram for SMDS_IteratorOfElements:
Inheritance graph
[legend]

Public Member Functions

 SMDS_IteratorOfElements (const SMDS_MeshElement *element, SMDSAbs_ElementType type, const SMDS_ElemIteratorPtr &it)
 Create an iterator which look for elements of type type which are linked to the element element.
bool more ()
 Return true if and only if there are other object in this iterator.
const SMDS_MeshElementnext ()
 Return the current object and step to the next one.
virtual void remove ()
 Delete the current element and step to the next one.

Private Member Functions

bool subMore ()
const SMDS_MeshElementsubNext ()

Private Attributes

SMDS_ElemIteratorPtr t2Iterator
SMDS_ElemIteratorPtr t1Iterator
SMDSAbs_ElementType myType
const SMDS_MeshElementmyProxyElement
const SMDS_MeshElementmyElement
bool myReverseIteration
std::set< const
SMDS_MeshElement * > 
alreadyReturnedElements
std::set< const
SMDS_MeshElement * >::iterator 
itAlreadyReturned

Detailed Description

Definition at line 32 of file SMDS_IteratorOfElements.hxx.


Constructor & Destructor Documentation

SMDS_IteratorOfElements::SMDS_IteratorOfElements ( const SMDS_MeshElement element,
SMDSAbs_ElementType  type,
const SMDS_ElemIteratorPtr it 
)

Create an iterator which look for elements of type type which are linked to the element element.

it is the iterator to get connectivity of element

Definition at line 57 of file SMDS_IteratorOfElements.cxx.

References alreadyReturnedElements, SMDS_MeshElement.GetType(), itAlreadyReturned, myElement, myReverseIteration, SMDSAbs_Edge, SMDSAbs_Face, SMDSAbs_Node, SMDSAbs_Volume, subMore(), and subNext().


Member Function Documentation

bool SMDS_IteratorOfElements::more ( ) [virtual]

Return true if and only if there are other object in this iterator.

Implements SMDS_Iterator< const SMDS_MeshElement * >.

Definition at line 77 of file SMDS_IteratorOfElements.cxx.

References alreadyReturnedElements, SMDS_MeshElement.elementsIterator(), SMDS_MeshElement.GetType(), itAlreadyReturned, myElement, myProxyElement, and myReverseIteration.

Referenced by next().

{
        if(myProxyElement==NULL)
        {
                while(itAlreadyReturned!=alreadyReturnedElements.end())
                {
                        myProxyElement=*itAlreadyReturned;
                        itAlreadyReturned++;    

                        if(myReverseIteration)
                        {
                                SMDS_ElemIteratorPtr it=
                                        myProxyElement->elementsIterator(myElement->GetType());
                                while(it->more())
                                {                               
                                        if(it->next()==myElement) return true;
                                }
                        }
                        else return true;
                }
                myProxyElement=NULL;
                return false;
        }
        else return true;
}
const SMDS_MeshElement * SMDS_IteratorOfElements::next ( ) [virtual]

Return the current object and step to the next one.

Implements SMDS_Iterator< const SMDS_MeshElement * >.

Definition at line 103 of file SMDS_IteratorOfElements.cxx.

References more(), and myProxyElement.

{
        more();
        const SMDS_MeshElement *e=myProxyElement;
        myProxyElement=NULL;
        return e;
}
virtual void SMDS_Iterator< const SMDS_MeshElement * >.remove ( ) [virtual, inherited]

Delete the current element and step to the next one.

Definition at line 44 of file SMDS_Iterator.hxx.

{}
bool SMDS_IteratorOfElements::subMore ( ) [private]

Definition at line 31 of file SMDS_IteratorOfElements.cxx.

References myType, t1Iterator, and t2Iterator.

Referenced by SMDS_IteratorOfElements().

{
        if((t2Iterator.get()==NULL)||(!t2Iterator->more()))
        {
                if(t1Iterator->more())
                {
                        t2Iterator=t1Iterator->next()->elementsIterator(myType);
                        return subMore();
                }
                else return false;
        }
        else return true;
}
const SMDS_MeshElement * SMDS_IteratorOfElements::subNext ( ) [private]

Definition at line 45 of file SMDS_IteratorOfElements.cxx.

References myType, t1Iterator, and t2Iterator.

Referenced by SMDS_IteratorOfElements().

{
        if((t2Iterator.get()==NULL)||(!t2Iterator->more()))
                if(t1Iterator->more())
                        t2Iterator=t1Iterator->next()->elementsIterator(myType);
        return t2Iterator->next();
}

Field Documentation

Definition at line 53 of file SMDS_IteratorOfElements.hxx.

Referenced by more(), and SMDS_IteratorOfElements().

std::set<const SMDS_MeshElement*>::iterator SMDS_IteratorOfElements.itAlreadyReturned [private]

Definition at line 54 of file SMDS_IteratorOfElements.hxx.

Referenced by more(), and SMDS_IteratorOfElements().

Definition at line 50 of file SMDS_IteratorOfElements.hxx.

Referenced by more(), and SMDS_IteratorOfElements().

Definition at line 49 of file SMDS_IteratorOfElements.hxx.

Referenced by more(), and next().

Definition at line 51 of file SMDS_IteratorOfElements.hxx.

Referenced by more(), and SMDS_IteratorOfElements().

Definition at line 48 of file SMDS_IteratorOfElements.hxx.

Referenced by subMore(), and subNext().

Definition at line 47 of file SMDS_IteratorOfElements.hxx.

Referenced by subMore(), and subNext().

Definition at line 46 of file SMDS_IteratorOfElements.hxx.

Referenced by subMore(), and subNext().

Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS