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 (const 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 void | setEnumerationIndex (const int &enumerationIndex) |
KOKKOS_INLINE_FUNCTION int | getIndex (int dimension) |
KOKKOS_INLINE_FUNCTION int | getExtent (int dimension) |
KOKKOS_INLINE_FUNCTION void | reset (unsigned 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 42 of file Intrepid2_ViewIterator.hpp.
|
inline |
Constructor
[in] | view | - the View to iterate over |
Definition at line 51 of file Intrepid2_ViewIterator.hpp.
|
inline |
move to the previous location
Definition at line 128 of file Intrepid2_ViewIterator.hpp.
|
inline |
Getter
Definition at line 70 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 154 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 195 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 186 of file Intrepid2_ViewIterator.hpp.
|
inline |
Sets the current location.
[in] | location | - the location as a 7-element array value. |
Definition at line 222 of file Intrepid2_ViewIterator.hpp.
|
inline |
move to the next location
Definition at line 103 of file Intrepid2_ViewIterator.hpp.
Referenced by Intrepid2::TensorViewIterator< TensorViewType, ViewType1, ViewType2, ScalarType >::increment().
|
inline |
Definition at line 86 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 203 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 78 of file Intrepid2_ViewIterator.hpp.
Referenced by Intrepid2::TensorViewIterator< TensorViewType, ViewType1, ViewType2, ScalarType >::set().
|
inline |
The 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).
[in] | enumerationIndex | - the index to which the location should be set |
Definition at line 169 of file Intrepid2_ViewIterator.hpp.
|
inline |
Sets the current location.
[in] | location | - the location as a 7-element array value. |
Definition at line 214 of file Intrepid2_ViewIterator.hpp.
Referenced by Intrepid2::ViewIterator< TensorViewType, ScalarType >::setEnumerationIndex(), and Intrepid2::TensorViewIterator< TensorViewType, ViewType1, ViewType2, ScalarType >::setLocation().