1#ifndef included_AMP_MeshIterators
2#define included_AMP_MeshIterators
4#include "AMP/mesh/MeshElement.h"
115 virtual std::unique_ptr<MeshIteratorBase>
clone()
const = 0;
162 template<
class T,
typename... Args>
165 return MeshIterator(
new T( std::forward<Args>( args )... ) );
270 inline uint64_t
getID()
const {
return it->getID(); }
279 inline bool empty()
const {
return it->empty(); }
282 inline size_t size()
const {
return it->size(); }
285 inline size_t pos()
const {
return it->pos(); }
288 inline void setPos(
size_t i ) {
it->setPos( i ); }
Class to manage reading/writing restart data.
A base class used to iterate over elements in a Mesh.
size_t d_size
Size of the iterator.
virtual MeshIteratorBase & operator++()=0
MeshIteratorBase()=default
size_t pos() const
Return the current position (from the beginning) in the iterator.
const MeshElement * d_element
Pointer to the current element.
Type d_iteratorType
Type of iterator.
MeshIteratorBase(const MeshIteratorBase &)=delete
MeshIteratorBase & operator=(MeshIteratorBase &&)=delete
std::random_access_iterator_tag iterator_category
Type type() const
Return the iterator type.
MeshIteratorBase & operator=(const MeshIteratorBase &)=delete
size_t d_pos
Position of the iterator.
size_t empty() const
Return the number of elements in the iterator.
virtual MeshIterator begin() const =0
Return an iterator to the beginning.
virtual std::string className() const =0
Return the class name.
bool operator!=(MeshIteratorEnd) const
Check if two iterators are not equal.
const MeshElement & operator*() const
Dereference the iterator.
virtual MeshIteratorBase & operator--()=0
virtual bool operator!=(const MeshIteratorBase &rhs) const =0
Check if two iterators are not equal.
Type
Enum for the type of iterator supported.
MeshIteratorBase(int64_t, AMP::IO::RestartManager *)
virtual ~MeshIteratorBase()=default
Virtual destructor.
virtual void setPos(size_t)=0
Set the position in the iterator.
virtual std::unique_ptr< MeshIteratorBase > clone() const =0
Clone the iterator.
virtual void registerChildObjects(AMP::IO::RestartManager *) const =0
bool operator==(MeshIteratorEnd) const
Check if two iterators are equal.
uint32_t d_typeHash
Unique hash for the type.
const MeshElement * operator->() const
Dereference the iterator.
ptrdiff_t difference_type
MeshIteratorBase(MeshIteratorBase &&)=delete
virtual MeshIteratorBase & operator+=(int N)=0
virtual void writeRestart(int64_t) const =0
size_t size() const
Return the number of elements in the iterator.
uint64_t getID() const
Return a unique hash id.
virtual bool operator==(const MeshIteratorBase &rhs) const =0
Check if two iterators are equal.
MeshIteratorEnd end() const
Return an iterator to the end (use tombstone class)
A base class used to represent the end iterator.
A class used to iterate over elements in a Mesh.
MeshIteratorBase * rawIterator()
Return the raw iterator (may be this)
bool operator>(const MeshIterator &rhs) const
Operator >
bool empty() const
Check if the iterator is empty.
std::random_access_iterator_tag iterator_category
MeshIterator & operator-=(const MeshIterator &it)
Arithmetic operator-=.
const MeshElement & operator*() const
Dereference the iterator.
ptrdiff_t difference_type
MeshIterator & operator=(MeshIterator &&)
Move operator.
MeshIterator(int64_t fid)
MeshIterator()
Empty MeshIterator constructor.
MeshIterator & operator+=(const MeshIterator &it)
Arithmetic operator+=.
MeshIterator(MeshIterator &&)
Move constructor.
size_t pos() const
Return the current position (from the beginning) in the iterator.
static MeshIterator create(Args... args)
Create a mesh iterator.
MeshIterator & operator=(std::unique_ptr< MeshIteratorBase > &&)
Assignment operator.
MeshIteratorEnd end() const
Return an iterator to the end (use tombstone class)
const MeshIteratorBase * rawIterator() const
Return the raw iterator (may be this)
MeshIterator(const MeshIterator &)
Copy constructor.
bool operator==(MeshIteratorEnd rhs) const
Check if two iterators are equal.
void registerChildObjects(AMP::IO::RestartManager *manager) const
MeshIterator operator+(const MeshIterator &it) const
Arithmetic operator+.
MeshIterator(MeshIteratorBase *p)
Constructor that takes ownership of the raw pointer.
MeshIterator & operator+=(int N)
Arithmetic operator+=.
MeshIterator(std::unique_ptr< MeshIteratorBase > &&p)
Default constructor.
MeshIteratorBase * release()
Return a pointer to the underlying and release ownership.
bool operator!=(MeshIteratorEnd rhs) const
Check if two iterators are not equal.
void setPos(size_t i)
Set the position in the iterator.
bool operator!=(const MeshIteratorBase &rhs) const
Check if two iterators are not equal.
MeshIterator operator+(int N) const
Arithmetic operator+.
MeshIterator & operator-=(int N)
Arithmetic operator-=.
std::string className() const
Return the class name.
bool operator<(const MeshIterator &rhs) const
Operator <.
MeshIterator begin() const
Return an iterator to the beginning.
void writeRestart(int64_t fid) const
bool operator==(const MeshIteratorBase &rhs) const
Check if two iterators are equal.
bool operator<=(const MeshIterator &rhs) const
Operator <=.
const MeshElement * get() const
Dereference the iterator.
bool operator==(const MeshIterator &rhs) const
Check if two iterators are equal.
bool operator>=(const MeshIterator &rhs) const
Operator >=.
uint64_t getID() const
Return a unique hash id.
size_t size() const
Return the number of elements in the iterator.
MeshIterator operator-(int N) const
Arithmetic operator-.
MeshIterator & operator--()
Pre-Decrement.
MeshIterator operator++(int)
Post-Increment.
MeshIterator operator--(int)
Post-Decrement.
Type type() const
Return the iterator type.
bool operator!=(const MeshIterator &rhs) const
Check if two iterators are not equal.
MeshIterator operator-(const MeshIterator &it) const
Arithmetic operator-.
const MeshElement * operator->() const
Dereference the iterator.
MeshIterator & operator=(const MeshIterator &)
Assignment operator.
MeshIterator & operator++()
Pre-Increment.
~MeshIterator()
Deconstructor.