Iterator that traverses a disjoint partition of the indices of a view's elements. More...
Public Member Functions | |
view_index_iterator (View const &view, std::size_t vs_len, bool b_replicated) | |
Construct an iterator that will cover the elements of the view that are local. More... | |
bool | at_end (void) const |
Returns whether all local subviews of the view have been processed in the current iteration. | |
std::size_t | size () const |
Returns the number of local subviews of the view, or in the case of a multi-view algorithm the number of local subviews of the first view. | |
bool | contains (size_t const &idx) const |
Returns whether the specified index is part of the partition handled by this iterator. More... | |
void | reset (void) |
Reset the iterator to allow another traversal of the view elements by the factory. More... | |
id_t | operator* () |
view_index_iterator & | operator++ () |
view_index_iterator | operator++ (int) |
Iterator that traverses a disjoint partition of the indices of a view's elements.
View | The type of the view whose partitioned domain is being abstracted by the iterator. |
The class is used in factories to easily partition the work of specifying the tasks of a PARAGRAPH across all locations on which the PARAGRAPH is being executed.
stapl::view_index_iterator< View >::view_index_iterator | ( | View const & | view, |
std::size_t | vs_len, | ||
bool | b_replicated | ||
) |
Construct an iterator that will cover the elements of the view that are local.
view | The view whose elements will be partitioned by the iterator. |
vs_len | The number of local subviews. |
b_replicated | Indicated if the view is a repeat_view. |
m_vs_length can differ from m_size in cases where the factory is processing multiple views. In that case vs_len
is the number of local subviews of the first view, which we use to drive the behavior of the factory.
bool stapl::view_index_iterator< View >::contains | ( | size_t const & | idx | ) | const |
Returns whether the specified index is part of the partition handled by this iterator.
|
virtual |
Reset the iterator to allow another traversal of the view elements by the factory.
This is used in factories such as map_reduce_factory where multiple traversals of the view indices are required to generate the reduce trees.
Implements stapl::view_index_iterator_base.