Iterator for local data in a vector. More...
#include <VectorDataIterator.h>
Public Types | |
| using | difference_type = ptrdiff_t |
| using | iterator_category = std::random_access_iterator_tag |
| using | pointer = const TYPE * |
| using | reference = const TYPE & |
| using | value_type = TYPE |
Public Member Functions | |
| VectorDataIterator | begin () const |
| Return a new iterator to the beginning of this iterator. | |
| VectorDataIterator | end () const |
| Return a new iterator to the end of this iterator. | |
| bool | operator!= (const VectorDataIterator &rhs) const |
| Test for inequality. | |
| TYPE & | operator* () |
| Dereference the iterator. | |
| VectorDataIterator | operator+ (int i) |
| Add a constant to this iterator. | |
| VectorDataIterator & | operator++ () |
| Increment the iterator. | |
| VectorDataIterator | operator++ (int) |
| Increment the iterator. | |
| VectorDataIterator & | operator+= (int i) |
| Add a constant to this iterator. | |
| int | operator- (const VectorDataIterator &rhs) const |
| Compute distance between two iterators. | |
| VectorDataIterator | operator- (int i) |
| Subtract a constant to this iterator. | |
| VectorDataIterator & | operator-- () |
| Decrement the iterator. | |
| VectorDataIterator | operator-- (int) |
| Decrement the iterator. | |
| VectorDataIterator & | operator-= (int i) |
| Subtract a constant to this iterator. | |
| bool | operator< (const VectorDataIterator &rhs) const |
| Less than operator. | |
| bool | operator<= (const VectorDataIterator &rhs) const |
| Less than or equal operator. | |
| VectorDataIterator & | operator= (const VectorDataIterator &rhs) |
| VectorDataIterator & | operator= (VectorDataIterator &&rhs) |
| bool | operator== (const VectorDataIterator &rhs) const |
| Test for equality. | |
| bool | operator> (const VectorDataIterator &rhs) const |
| Greater than operator. | |
| bool | operator>= (const VectorDataIterator &rhs) const |
| Greater than or equal operator. | |
| TYPE & | operator[] (int i) |
| Return data a distance from the current iterator. | |
| size_t | position () const |
| Return the position of the iterator. | |
| size_t | size () const |
| Return the size of the iterator. | |
| VectorDataIterator () | |
| Default constructor. | |
| VectorDataIterator (const VectorDataIterator &rhs) | |
| Copy constructor. | |
| VectorDataIterator (VectorData *p, size_t position) | |
| Constructor from a vector. | |
| VectorDataIterator (VectorDataIterator &&rhs) | |
| ~VectorDataIterator () | |
| Destructor. | |
Private Types | |
| using | TYPE2 = typename AMP::remove_cvref_t< TYPE > |
Private Member Functions | |
| void | advance (size_t) |
| void | recede (size_t) |
Private Attributes | |
| size_t * | d_blockSize |
| size_t | d_CurBlock |
| size_t | d_CurOffset |
| TYPE ** | d_data |
| TYPE2 | d_dataCast |
| size_t | d_hashcode |
| size_t | d_N_blocks |
| size_t | d_pos |
| size_t | d_size |
| uint64_t * | d_typeHash |
Iterator for local data in a vector.
Even though a vector may have non-contiguous storage of data, the interface presents a contiguous block of memory to the user: each element in the vector is given an offset from 0 and the vector is packed. This allows for a random access iterator on the data.
Vector::begin() and Vector::end() return this class. This class uses the DataBlock interface in vectors to access data. As a result, for some non-AMP managed vectors, this class may not be the most efficient.
Definition at line 31 of file VectorDataIterator.h.
| using AMP::LinearAlgebra::VectorDataIterator< TYPE >::difference_type = ptrdiff_t |
Definition at line 36 of file VectorDataIterator.h.
| using AMP::LinearAlgebra::VectorDataIterator< TYPE >::iterator_category = std::random_access_iterator_tag |
Definition at line 34 of file VectorDataIterator.h.
| using AMP::LinearAlgebra::VectorDataIterator< TYPE >::pointer = const TYPE * |
Definition at line 37 of file VectorDataIterator.h.
| using AMP::LinearAlgebra::VectorDataIterator< TYPE >::reference = const TYPE & |
Definition at line 38 of file VectorDataIterator.h.
|
private |
Definition at line 41 of file VectorDataIterator.h.
| using AMP::LinearAlgebra::VectorDataIterator< TYPE >::value_type = TYPE |
Definition at line 35 of file VectorDataIterator.h.
| AMP::LinearAlgebra::VectorDataIterator< TYPE >::VectorDataIterator | ( | ) |
Default constructor.
| AMP::LinearAlgebra::VectorDataIterator< TYPE >::~VectorDataIterator | ( | ) |
Destructor.
| AMP::LinearAlgebra::VectorDataIterator< TYPE >::VectorDataIterator | ( | const VectorDataIterator< TYPE > & | rhs | ) |
Copy constructor.
| [in] | rhs | iterator to copy |
Copies an iterator
| AMP::LinearAlgebra::VectorDataIterator< TYPE >::VectorDataIterator | ( | VectorDataIterator< TYPE > && | rhs | ) |
Move constructor
| rhs | Iterator to copy |
|
explicit |
Constructor from a vector.
This will construct an iterator over the local data in the vector. Vector::begin() and Vector::end() call this function to instantiate a new iterator. This method should not be invoked outside of this use.
| [in] | p | A (non-reference counted) pointer to the vector being iterated over |
| [in] | position | The local position in the vector. |
|
private |
| VectorDataIterator AMP::LinearAlgebra::VectorDataIterator< TYPE >::begin | ( | ) | const |
Return a new iterator to the beginning of this iterator.
| VectorDataIterator AMP::LinearAlgebra::VectorDataIterator< TYPE >::end | ( | ) | const |
Return a new iterator to the end of this iterator.
|
inline |
Test for inequality.
Returns !(*this == rhs)
|
inline |
Dereference the iterator.
This returns a reference to the data pointed to by the iterator
| VectorDataIterator AMP::LinearAlgebra::VectorDataIterator< TYPE >::operator+ | ( | int | i | ) |
Add a constant to this iterator.
| [in] | i | Offset to move forward |
Equivalent to
except it is \(O(1)\) in most cases.
| VectorDataIterator & AMP::LinearAlgebra::VectorDataIterator< TYPE >::operator++ | ( | ) |
Increment the iterator.
| VectorDataIterator AMP::LinearAlgebra::VectorDataIterator< TYPE >::operator++ | ( | int | ) |
Increment the iterator.
| VectorDataIterator & AMP::LinearAlgebra::VectorDataIterator< TYPE >::operator+= | ( | int | i | ) |
Add a constant to this iterator.
| [in] | i | Offset to move forward |
Equivalent to
except it is \(O(1)\) in most cases.
| int AMP::LinearAlgebra::VectorDataIterator< TYPE >::operator- | ( | const VectorDataIterator< TYPE > & | rhs | ) | const |
Compute distance between two iterators.
| rhs | The other iterator to measure distance to |
If rhs is after this, this is equivalent to
except it is \(O(1)\) in most cases. If rhs is before this, the equivalent code is the same except t and answer are decremented.
| VectorDataIterator AMP::LinearAlgebra::VectorDataIterator< TYPE >::operator- | ( | int | i | ) |
Subtract a constant to this iterator.
| [in] | i | Offset to move backward |
Equivalent to
except it is \(O(1)\) in most cases.
| VectorDataIterator & AMP::LinearAlgebra::VectorDataIterator< TYPE >::operator-- | ( | ) |
Decrement the iterator.
| VectorDataIterator AMP::LinearAlgebra::VectorDataIterator< TYPE >::operator-- | ( | int | ) |
Decrement the iterator.
| VectorDataIterator & AMP::LinearAlgebra::VectorDataIterator< TYPE >::operator-= | ( | int | i | ) |
Subtract a constant to this iterator.
| [in] | i | Offset to move backward |
Equivalent to
except it is \(O(1)\) in most cases.
|
inline |
Less than operator.
|
inline |
Less than or equal operator.
| VectorDataIterator & AMP::LinearAlgebra::VectorDataIterator< TYPE >::operator= | ( | const VectorDataIterator< TYPE > & | rhs | ) |
Assignment operator
| rhs | Iterator to copy |
| VectorDataIterator & AMP::LinearAlgebra::VectorDataIterator< TYPE >::operator= | ( | VectorDataIterator< TYPE > && | rhs | ) |
Move assignment operator
| rhs | Iterator to copy |
|
inline |
Test for equality.
Returns true iff rhs points to the exact same offset of the same vector. It is possible for two iterators to point to the same spot in memory and return false. This is due to the abstraction of a contiguous block presented by Vector.
|
inline |
Greater than operator.
|
inline |
Greater than or equal operator.
| TYPE & AMP::LinearAlgebra::VectorDataIterator< TYPE >::operator[] | ( | int | i | ) |
Return data a distance from the current iterator.
| i | Offset from this iterator |
Equivalent to
|
inline |
Return the position of the iterator.
Definition at line 107 of file VectorDataIterator.h.
References AMP::LinearAlgebra::VectorDataIterator< TYPE >::d_pos.
|
private |
|
inline |
Return the size of the iterator.
Definition at line 103 of file VectorDataIterator.h.
References AMP::LinearAlgebra::VectorDataIterator< TYPE >::d_size.
|
private |
Definition at line 44 of file VectorDataIterator.h.
|
private |
Definition at line 42 of file VectorDataIterator.h.
|
private |
Definition at line 42 of file VectorDataIterator.h.
|
private |
Definition at line 45 of file VectorDataIterator.h.
|
mutableprivate |
Definition at line 47 of file VectorDataIterator.h.
|
private |
Definition at line 43 of file VectorDataIterator.h.
|
private |
Definition at line 42 of file VectorDataIterator.h.
|
private |
Definition at line 42 of file VectorDataIterator.h.
Referenced by AMP::LinearAlgebra::VectorDataIterator< TYPE >::position().
|
private |
Definition at line 42 of file VectorDataIterator.h.
Referenced by AMP::LinearAlgebra::VectorDataIterator< TYPE >::size().
|
private |
Definition at line 46 of file VectorDataIterator.h.
|
Advanced Multi-Physics (AMP) Oak Ridge National Laboratory Idaho National Laboratory Los Alamos National Laboratory |
This page automatically produced from the source code by Last updated: Tue Mar 10 2026 13:06:43. Comments on this page |