Chaste Commit::1fd4e48e3990e67db148bc1bc4cf6991a0049d0c
AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::ElementIterator Class Reference

#include <AbstractMeshReader.hpp>

+ Inheritance diagram for AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::ElementIterator:
+ Collaboration diagram for AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::ElementIterator:

Public Member Functions

 ElementIterator (unsigned index, AbstractMeshReader< ELEMENT_DIM, SPACE_DIM > *pReader)
 
 ElementIterator (const std::set< unsigned > &rIndices, AbstractMeshReader< ELEMENT_DIM, SPACE_DIM > *pReader)
 
unsigned GetIndex () const
 

Private Member Functions

void CacheData (unsigned index, bool firstRead=false)
 
void increment ()
 
bool equal (const ElementIterator &rOther) const
 
const ElementDatadereference () const
 

Private Attributes

unsigned mIndex
 
const std::set< unsigned > * mpIndices
 
std::set< unsigned >::const_iterator mIndicesIterator
 
AbstractMeshReader< ELEMENT_DIM, SPACE_DIM > * mpReader
 
ElementData mLastDataRead
 

Friends

class boost::iterator_core_access
 

Detailed Description

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
class AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::ElementIterator

An iterator class for element data.

Definition at line 236 of file AbstractMeshReader.hpp.

Constructor & Destructor Documentation

◆ ElementIterator() [1/2]

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::ElementIterator::ElementIterator ( unsigned  index,
AbstractMeshReader< ELEMENT_DIM, SPACE_DIM > *  pReader 
)
inline

Constructor for pointing to a specific item.

Note that, in the case of an ASCII mesh file, this will actually start wherever the file pointer currently is. The user is responsible for resetting the reader prior to creating an iterator.

Parameters
indexthe index of the item to point at
pReaderthe mesh reader to iterate over

Definition at line 250 of file AbstractMeshReader.hpp.

References AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::ElementIterator::CacheData(), and AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::ElementIterator::mIndex.

◆ ElementIterator() [2/2]

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::ElementIterator::ElementIterator ( const std::set< unsigned > &  rIndices,
AbstractMeshReader< ELEMENT_DIM, SPACE_DIM > *  pReader 
)

Constructor for iterating over a subset of the items in the mesh.

Parameters
rIndicesa set of item indices over which to iterate
pReaderthe mesh reader to iterate over

Definition at line 203 of file AbstractMeshReader.cpp.

Member Function Documentation

◆ CacheData()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::ElementIterator::CacheData ( unsigned  index,
bool  firstRead = false 
)
private

Read the pointed-at item data (if we're pointing at anything) and cache it within the iterator, for use in dereference.

Parameters
indexthe item to read
firstReadSet to true in the constructor. This ensures that the line 0 is always read

Definition at line 248 of file AbstractMeshReader.cpp.

References AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNumElements().

Referenced by AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::ElementIterator::ElementIterator().

◆ dereference()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
const ElementData & AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::ElementIterator::dereference ( ) const
inlineprivate

Dereference this iterator to get the data for the item pointed at.

Note that the returned reference is only valid for as long as this iterator is pointing at the item.

Returns
reference

Definition at line 309 of file AbstractMeshReader.hpp.

References AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNumElements(), AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::ElementIterator::mLastDataRead, and AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::ElementIterator::mpReader.

◆ equal()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::ElementIterator::equal ( const ElementIterator rOther) const
inlineprivate
Returns
true if two iterators point at the same item.
Parameters
rOtherthe other iterator

Definition at line 297 of file AbstractMeshReader.hpp.

References AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::ElementIterator::mIndex.

◆ GetIndex()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::ElementIterator::GetIndex ( ) const
inline
Returns
the index of the item pointed at.

Definition at line 271 of file AbstractMeshReader.hpp.

References AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::ElementIterator::mIndex.

◆ increment()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::ElementIterator::increment ( )
private

Friends And Related Symbol Documentation

◆ boost::iterator_core_access

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
friend class boost::iterator_core_access
friend

Definition at line 277 of file AbstractMeshReader.hpp.

Member Data Documentation

◆ mIndex

◆ mIndicesIterator

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::set<unsigned>::const_iterator AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::ElementIterator::mIndicesIterator
private

◆ mLastDataRead

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
ElementData AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::ElementIterator::mLastDataRead
private

Data for the last item read.

Definition at line 330 of file AbstractMeshReader.hpp.

Referenced by AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::ElementIterator::dereference().

◆ mpIndices

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
const std::set<unsigned>* AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::ElementIterator::mpIndices
private

The set which we're iterating over, if we are iterating over a subset of the items.

Definition at line 321 of file AbstractMeshReader.hpp.

Referenced by AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::ElementIterator::increment().

◆ mpReader

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
AbstractMeshReader<ELEMENT_DIM, SPACE_DIM>* AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::ElementIterator::mpReader
private

The mesh reader we're iterating over.

Definition at line 327 of file AbstractMeshReader.hpp.

Referenced by AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::ElementIterator::dereference().


The documentation for this class was generated from the following files: