Advanced Multi-Physics (AMP)
On-Line Documentation
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
AMP::Mesh::MeshIterator Class Referencefinal

A class used to iterate over elements in a Mesh. More...

#include <MeshIterator.h>

Public Types

using difference_type = ptrdiff_t
 
using iterator_category = std::random_access_iterator_tag
 
using pointer = const AMP::Mesh::MeshElement *
 
using reference = const AMP::Mesh::MeshElement &
 
using Type = MeshIteratorBase::Type
 
using value_type = AMP::Mesh::MeshElement
 

Public Member Functions

MeshIterator begin () const
 Return an iterator to the beginning.
 
std::string className () const
 Return the class name.
 
bool empty () const
 Check if the iterator is empty.
 
MeshIteratorEnd end () const
 Return an iterator to the end (use tombstone class)
 
const MeshElementget () const
 Dereference the iterator.
 
uint64_t getID () const
 Return a unique hash id.
 
 MeshIterator ()
 Empty MeshIterator constructor.
 
 MeshIterator (const MeshIterator &)
 Copy constructor.
 
 MeshIterator (int64_t fid)
 
 MeshIterator (MeshIterator &&)
 Move constructor.
 
 MeshIterator (MeshIteratorBase *p)
 Constructor that takes ownership of the raw pointer.
 
 MeshIterator (std::unique_ptr< MeshIteratorBase > &&p)
 Default constructor.
 
bool operator!= (const MeshIterator &rhs) const
 Check if two iterators are not equal.
 
bool operator!= (const MeshIteratorBase &rhs) const
 Check if two iterators are not equal.
 
bool operator!= (MeshIteratorEnd rhs) const
 Check if two iterators are not equal.
 
const MeshElementoperator* () const
 Dereference the iterator.
 
MeshIterator operator+ (const MeshIterator &it) const
 Arithmetic operator+.
 
MeshIterator operator+ (int N) const
 Arithmetic operator+.
 
MeshIteratoroperator++ ()
 Pre-Increment.
 
MeshIterator operator++ (int)
 Post-Increment.
 
MeshIteratoroperator+= (const MeshIterator &it)
 Arithmetic operator+=.
 
MeshIteratoroperator+= (int N)
 Arithmetic operator+=.
 
MeshIterator operator- (const MeshIterator &it) const
 Arithmetic operator-.
 
MeshIterator operator- (int N) const
 Arithmetic operator-.
 
MeshIteratoroperator-- ()
 Pre-Decrement.
 
MeshIterator operator-- (int)
 Post-Decrement.
 
MeshIteratoroperator-= (const MeshIterator &it)
 Arithmetic operator-=.
 
MeshIteratoroperator-= (int N)
 Arithmetic operator-=.
 
const MeshElementoperator-> () const
 Dereference the iterator.
 
bool operator< (const MeshIterator &rhs) const
 Operator <.
 
bool operator<= (const MeshIterator &rhs) const
 Operator <=.
 
MeshIteratoroperator= (const MeshIterator &)
 Assignment operator.
 
MeshIteratoroperator= (MeshIterator &&)
 Move operator.
 
MeshIteratoroperator= (std::unique_ptr< MeshIteratorBase > &&)
 Assignment operator.
 
bool operator== (const MeshIterator &rhs) const
 Check if two iterators are equal.
 
bool operator== (const MeshIteratorBase &rhs) const
 Check if two iterators are equal.
 
bool operator== (MeshIteratorEnd rhs) const
 Check if two iterators are equal.
 
bool operator> (const MeshIterator &rhs) const
 Operator >
 
bool operator>= (const MeshIterator &rhs) const
 Operator >=.
 
size_t pos () const
 Return the current position (from the beginning) in the iterator.
 
MeshIteratorBaserawIterator ()
 Return the raw iterator (may be this)
 
const MeshIteratorBaserawIterator () const
 Return the raw iterator (may be this)
 
void registerChildObjects (AMP::IO::RestartManager *manager) const
 
MeshIteratorBaserelease ()
 Return a pointer to the underlying and release ownership.
 
void setPos (size_t i)
 Set the position in the iterator.
 
size_t size () const
 Return the number of elements in the iterator.
 
Type type () const
 Return the iterator type.
 
void writeRestart (int64_t fid) const
 
 ~MeshIterator ()
 Deconstructor.
 

Static Public Member Functions

template<class T , typename... Args>
static MeshIterator create (Args... args)
 Create a mesh iterator.
 

Protected Attributes

MeshIteratorBaseit = nullptr
 

Detailed Description

A class used to iterate over elements in a Mesh.

This class provides routines for iterating over a set of elements. It is inherited from std::iterator. This is a wrapper class that contains a pointer to the underlying iterator.

Definition at line 149 of file MeshIterator.h.

Member Typedef Documentation

◆ difference_type

Definition at line 154 of file MeshIterator.h.

◆ iterator_category

using AMP::Mesh::MeshIterator::iterator_category = std::random_access_iterator_tag

Definition at line 152 of file MeshIterator.h.

◆ pointer

Definition at line 155 of file MeshIterator.h.

◆ reference

Definition at line 156 of file MeshIterator.h.

◆ Type

Definition at line 157 of file MeshIterator.h.

◆ value_type

Definition at line 153 of file MeshIterator.h.

Constructor & Destructor Documentation

◆ MeshIterator() [1/6]

AMP::Mesh::MeshIterator::MeshIterator ( )

Empty MeshIterator constructor.

Referenced by create().

◆ MeshIterator() [2/6]

AMP::Mesh::MeshIterator::MeshIterator ( std::unique_ptr< MeshIteratorBase > &&  p)
inline

Default constructor.

Definition at line 172 of file MeshIterator.h.

◆ MeshIterator() [3/6]

AMP::Mesh::MeshIterator::MeshIterator ( MeshIterator &&  )

Move constructor.

◆ MeshIterator() [4/6]

AMP::Mesh::MeshIterator::MeshIterator ( const MeshIterator )

Copy constructor.

◆ ~MeshIterator()

AMP::Mesh::MeshIterator::~MeshIterator ( )
inline

Deconstructor.

Definition at line 190 of file MeshIterator.h.

References it.

◆ MeshIterator() [5/6]

AMP::Mesh::MeshIterator::MeshIterator ( MeshIteratorBase p)
inline

Constructor that takes ownership of the raw pointer.

Definition at line 385 of file MeshIterator.h.

◆ MeshIterator() [6/6]

AMP::Mesh::MeshIterator::MeshIterator ( int64_t  fid)

Member Function Documentation

◆ begin()

MeshIterator AMP::Mesh::MeshIterator::begin ( ) const
inline

Return an iterator to the beginning.

Definition at line 196 of file MeshIterator.h.

References it.

◆ className()

std::string AMP::Mesh::MeshIterator::className ( ) const
inline

Return the class name.

Definition at line 193 of file MeshIterator.h.

References it.

◆ create()

template<class T , typename... Args>
static MeshIterator AMP::Mesh::MeshIterator::create ( Args...  args)
inlinestatic

Create a mesh iterator.

Definition at line 163 of file MeshIterator.h.

References MeshIterator().

◆ empty()

bool AMP::Mesh::MeshIterator::empty ( ) const
inline

Check if the iterator is empty.

Definition at line 279 of file MeshIterator.h.

References it.

◆ end()

MeshIteratorEnd AMP::Mesh::MeshIterator::end ( ) const
inline

Return an iterator to the end (use tombstone class)

Definition at line 199 of file MeshIterator.h.

◆ get()

const MeshElement * AMP::Mesh::MeshIterator::get ( ) const
inline

Dereference the iterator.

Definition at line 309 of file MeshIterator.h.

References it.

◆ getID()

uint64_t AMP::Mesh::MeshIterator::getID ( ) const
inline

Return a unique hash id.

Definition at line 270 of file MeshIterator.h.

References it.

◆ operator!=() [1/3]

bool AMP::Mesh::MeshIterator::operator!= ( const MeshIterator rhs) const
inline

Check if two iterators are not equal.

Definition at line 258 of file MeshIterator.h.

References it.

◆ operator!=() [2/3]

bool AMP::Mesh::MeshIterator::operator!= ( const MeshIteratorBase rhs) const
inline

Check if two iterators are not equal.

Definition at line 264 of file MeshIterator.h.

References it.

◆ operator!=() [3/3]

bool AMP::Mesh::MeshIterator::operator!= ( MeshIteratorEnd  rhs) const
inline

Check if two iterators are not equal.

Definition at line 261 of file MeshIterator.h.

References it.

◆ operator*()

const MeshElement & AMP::Mesh::MeshIterator::operator* ( ) const
inline

Dereference the iterator.

Definition at line 303 of file MeshIterator.h.

References it.

◆ operator+() [1/2]

MeshIterator AMP::Mesh::MeshIterator::operator+ ( const MeshIterator it) const

Arithmetic operator+.

Random access increment to advance the iterator by the given iterator. Note: not all iterators support random access (libmesh). In this case, the pre-increment will be used instead and may reduce performance.

Parameters
itIterator to add

◆ operator+() [2/2]

MeshIterator AMP::Mesh::MeshIterator::operator+ ( int  N) const

Arithmetic operator+.

Random access increment to advance the iterator by N. Note: not all iterators support random access (libmesh). In this case, the pre-increment will be used instead and may reduce performance. Note: the default behavior of all random access iterators will be to call this function so derived classes only need to impliment this function for improved performance.

Parameters
NNumber to increment by (may be negative)

◆ operator++() [1/2]

MeshIterator & AMP::Mesh::MeshIterator::operator++ ( )
inline

Pre-Increment.

Pre-Increment the mesh iterator and return the reference to the iterator. This should be the fastest way to increment the iterator.

Definition at line 206 of file MeshIterator.h.

References it.

◆ operator++() [2/2]

MeshIterator AMP::Mesh::MeshIterator::operator++ ( int  )

Post-Increment.

Post-Increment the mesh iterator and return a reference to a temporary iterator. This should be avoided and pre-increment used whenever possible.

◆ operator+=() [1/2]

MeshIterator & AMP::Mesh::MeshIterator::operator+= ( const MeshIterator it)

Arithmetic operator+=.

Random access increment to advance the iterator by the given iterator. Note: not all iterators support random access (libmesh). In this case, the pre-increment will be used instead and may reduce performance.

Parameters
itIterator to add

◆ operator+=() [2/2]

MeshIterator & AMP::Mesh::MeshIterator::operator+= ( int  N)
inline

Arithmetic operator+=.

Random access increment to advance the iterator by N. Note: not all iterators support random access (libmesh). In this case, the pre-increment will be used instead and may reduce performance. Note: the default behavior of all random access assignment iterators will be to call this function so derived classes only need to implement this function for improved performance.

Parameters
NNumber to increment by (may be negative)

Definition at line 233 of file MeshIterator.h.

References it.

◆ operator-() [1/2]

MeshIterator AMP::Mesh::MeshIterator::operator- ( const MeshIterator it) const

Arithmetic operator-.

Random access decrement to reverse the iterator by the given iterator. Note: not all iterators support random access (libmesh). In this case, the pre-decrement will be used instead and may reduce performance.

Parameters
itIterator to subtract

◆ operator-() [2/2]

MeshIterator AMP::Mesh::MeshIterator::operator- ( int  N) const

Arithmetic operator-.

Random access decrement to reverse the iterator by N. Note: not all iterators support random access (libmesh). In this case, the pre-decrement will be used instead and may reduce performance.

Parameters
NNumber to decrement by (may be negative)

◆ operator--() [1/2]

MeshIterator & AMP::Mesh::MeshIterator::operator-- ( )
inline

Pre-Decrement.

Pre-Decrement the mesh iterator and return the reference to the iterator. This should be the fastest way to decrement the iterator. Note: not all iterators support decrementing the iterator (libmesh).

Definition at line 218 of file MeshIterator.h.

References it.

◆ operator--() [2/2]

MeshIterator AMP::Mesh::MeshIterator::operator-- ( int  )

Post-Decrement.

Post-Decrement the mesh iterator and return a reference to a temporary iterator. This should be avoided and pre-decrement used whenever possible. Note: not all iterators support decrementing the iterator (libmesh).

◆ operator-=() [1/2]

MeshIterator & AMP::Mesh::MeshIterator::operator-= ( const MeshIterator it)

Arithmetic operator-=.

Random access decrement to reverse the iterator by the given iterator. Note: not all iterators support random access (libmesh). In this case, the pre-decrement will be used instead and may reduce performance.

Parameters
itIterator to subtract

◆ operator-=() [2/2]

MeshIterator & AMP::Mesh::MeshIterator::operator-= ( int  N)

Arithmetic operator-=.

Random access decrement to reverse the iterator by N. Note: not all iterators support random access (libmesh). In this case, the pre-decrement will be used instead and may reduce performance.

Parameters
NNumber to decrement by (may be negative)

◆ operator->()

const MeshElement * AMP::Mesh::MeshIterator::operator-> ( ) const
inline

Dereference the iterator.

Definition at line 306 of file MeshIterator.h.

References it.

◆ operator<()

bool AMP::Mesh::MeshIterator::operator< ( const MeshIterator rhs) const
inline

Operator <.

Definition at line 291 of file MeshIterator.h.

References pos().

◆ operator<=()

bool AMP::Mesh::MeshIterator::operator<= ( const MeshIterator rhs) const
inline

Operator <=.

Definition at line 294 of file MeshIterator.h.

References pos().

◆ operator=() [1/3]

MeshIterator & AMP::Mesh::MeshIterator::operator= ( const MeshIterator )

Assignment operator.

◆ operator=() [2/3]

MeshIterator & AMP::Mesh::MeshIterator::operator= ( MeshIterator &&  )

Move operator.

◆ operator=() [3/3]

MeshIterator & AMP::Mesh::MeshIterator::operator= ( std::unique_ptr< MeshIteratorBase > &&  )

Assignment operator.

◆ operator==() [1/3]

bool AMP::Mesh::MeshIterator::operator== ( const MeshIterator rhs) const
inline

Check if two iterators are equal.

Definition at line 249 of file MeshIterator.h.

References it.

◆ operator==() [2/3]

bool AMP::Mesh::MeshIterator::operator== ( const MeshIteratorBase rhs) const
inline

Check if two iterators are equal.

Definition at line 255 of file MeshIterator.h.

References it.

◆ operator==() [3/3]

bool AMP::Mesh::MeshIterator::operator== ( MeshIteratorEnd  rhs) const
inline

Check if two iterators are equal.

Definition at line 252 of file MeshIterator.h.

References it.

◆ operator>()

bool AMP::Mesh::MeshIterator::operator> ( const MeshIterator rhs) const
inline

Operator >

Definition at line 297 of file MeshIterator.h.

References pos().

◆ operator>=()

bool AMP::Mesh::MeshIterator::operator>= ( const MeshIterator rhs) const
inline

Operator >=.

Definition at line 300 of file MeshIterator.h.

References pos().

◆ pos()

size_t AMP::Mesh::MeshIterator::pos ( ) const
inline

Return the current position (from the beginning) in the iterator.

Definition at line 285 of file MeshIterator.h.

References it.

Referenced by operator<(), operator<=(), operator>(), and operator>=().

◆ rawIterator() [1/2]

MeshIteratorBase * AMP::Mesh::MeshIterator::rawIterator ( )
inline

Return the raw iterator (may be this)

Definition at line 273 of file MeshIterator.h.

References it.

◆ rawIterator() [2/2]

const MeshIteratorBase * AMP::Mesh::MeshIterator::rawIterator ( ) const
inline

Return the raw iterator (may be this)

Definition at line 276 of file MeshIterator.h.

References it.

◆ registerChildObjects()

void AMP::Mesh::MeshIterator::registerChildObjects ( AMP::IO::RestartManager manager) const

◆ release()

MeshIteratorBase * AMP::Mesh::MeshIterator::release ( )

Return a pointer to the underlying and release ownership.

This function will return the raw pointer to the underlying iterator and release its ownership. It is up to the user to properly destroy the returned iterator. Note: This function invalidates *this and any future calls to this object may result in a dereferencing a null pointer. Return a pointer to the underlying and releases the ownership

◆ setPos()

void AMP::Mesh::MeshIterator::setPos ( size_t  i)
inline

Set the position in the iterator.

Definition at line 288 of file MeshIterator.h.

References it.

◆ size()

size_t AMP::Mesh::MeshIterator::size ( ) const
inline

Return the number of elements in the iterator.

Definition at line 282 of file MeshIterator.h.

References it.

◆ type()

Type AMP::Mesh::MeshIterator::type ( ) const
inline

Return the iterator type.

Definition at line 267 of file MeshIterator.h.

References it.

◆ writeRestart()

void AMP::Mesh::MeshIterator::writeRestart ( int64_t  fid) const

Member Data Documentation

◆ it

MeshIteratorBase* AMP::Mesh::MeshIterator::it = nullptr
protected

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



Advanced Multi-Physics (AMP)
Oak Ridge National Laboratory
Idaho National Laboratory
Los Alamos National Laboratory
This page automatically produced from the
source code by doxygen
Last updated: Tue Mar 10 2026 13:06:43.
Comments on this page