Intrepid2
|
A helper class that allows iteration over some part of a Kokkos View, while allowing the calling code to remain agnostic as to the rank of the view. More...
#include <Intrepid2_ViewIterator.hpp>
Public Member Functions | |
KOKKOS_INLINE_FUNCTION | ViewIterator (ViewType view) |
KOKKOS_INLINE_FUNCTION ScalarType | get () |
KOKKOS_INLINE_FUNCTION void | set (ScalarType &value) |
KOKKOS_INLINE_FUNCTION int | nextIncrementRank () |
KOKKOS_INLINE_FUNCTION int | increment () |
KOKKOS_INLINE_FUNCTION bool | decrement () |
KOKKOS_INLINE_FUNCTION int | getEnumerationIndex () |
KOKKOS_INLINE_FUNCTION int | getIndex (int dimension) |
KOKKOS_INLINE_FUNCTION int | getExtent (int dimension) |
KOKKOS_INLINE_FUNCTION void | reset (int from_rank_number=0) |
KOKKOS_INLINE_FUNCTION void | setLocation (const Kokkos::Array< int, 7 > &location) |
KOKKOS_INLINE_FUNCTION Kokkos::Array< int, 7 > & | getLocation () |
Private Attributes | |
ViewType | view_ |
Kokkos::Array< int, 7 > | dims_ |
Kokkos::Array< int, 7 > | index_ |
A helper class that allows iteration over some part of a Kokkos View, while allowing the calling code to remain agnostic as to the rank of the view.
Usage is as follows:
For example, if a rank-4 View has dimensions (D1,D2,D3,D4) = (10,15,20,25), and logical threads are assigned to each (D1,D2) pair, then each thread would call setLocation({D1,D2,0,0,0,0,0}), and would stop traversal when increment() returned 1, indicating that the D2 rank had been incremented, which in turn would imply that all (D3,D4) pairs had been visited.
Definition at line 74 of file Intrepid2_ViewIterator.hpp.
|
inline |
Constructor
[in] | view | - the View to iterate over |
Definition at line 83 of file Intrepid2_ViewIterator.hpp.
|
inline |
move to the previous location
Definition at line 160 of file Intrepid2_ViewIterator.hpp.
|
inline |
Getter
Definition at line 102 of file Intrepid2_ViewIterator.hpp.
Referenced by Intrepid2::TensorViewIterator< TensorViewType, ViewType1, ViewType2, ScalarType >::getView1Entry(), and Intrepid2::TensorViewIterator< TensorViewType, ViewType1, ViewType2, ScalarType >::getView2Entry().
|
inline |
Enumeration index refers to a 1D enumeration of the entries in the View, with dimensions in order of their significance (dimension 0 is the slowest-moving).
Definition at line 186 of file Intrepid2_ViewIterator.hpp.
|
inline |
The extent of the View in the specified dimension. (Extents in dimensions beyond the rank of the View, but less than 7, are defined to be 1.)
[in] | dimension | - the dimension for which the extent should be returned. |
Definition at line 211 of file Intrepid2_ViewIterator.hpp.
Referenced by Intrepid2::TensorViewIterator< TensorViewType, ViewType1, ViewType2, ScalarType >::setLocation().
|
inline |
The index of the current location in the specified dimension. (Indices in dimensions beyond the rank of the View, but less than 7, are defined to be 0.)
[in] | dimension | - the dimension for which the current index should be returned. |
Definition at line 202 of file Intrepid2_ViewIterator.hpp.
|
inline |
Sets the current location.
[in] | location | - the location as a 7-element array value. |
Definition at line 238 of file Intrepid2_ViewIterator.hpp.
|
inline |
move to the next location
Definition at line 135 of file Intrepid2_ViewIterator.hpp.
Referenced by Intrepid2::TensorViewIterator< TensorViewType, ViewType1, ViewType2, ScalarType >::increment().
|
inline |
Definition at line 118 of file Intrepid2_ViewIterator.hpp.
Referenced by Intrepid2::TensorViewIterator< TensorViewType, ViewType1, ViewType2, ScalarType >::increment(), and Intrepid2::TensorViewIterator< TensorViewType, ViewType1, ViewType2, ScalarType >::nextIncrementRank().
|
inline |
Resets the location to index 0 in each dimension, starting from the specified dimension.
[in] | from_rank_number | - the first dimension in which to set the index to 0. |
Definition at line 219 of file Intrepid2_ViewIterator.hpp.
Referenced by Intrepid2::ViewIterator< TensorViewType, ScalarType >::decrement(), and Intrepid2::TensorViewIterator< TensorViewType, ViewType1, ViewType2, ScalarType >::increment().
|
inline |
Setter
[in] | value | - the value to set at the current location |
Definition at line 110 of file Intrepid2_ViewIterator.hpp.
Referenced by Intrepid2::TensorViewIterator< TensorViewType, ViewType1, ViewType2, ScalarType >::set().
|
inline |
Sets the current location.
[in] | location | - the location as a 7-element array value. |
Definition at line 230 of file Intrepid2_ViewIterator.hpp.
Referenced by Intrepid2::TensorViewIterator< TensorViewType, ViewType1, ViewType2, ScalarType >::setLocation().