A helper class that allows iteration over three Kokkos Views simultaneously, according to tensor combination rules:
More...
|
| KOKKOS_INLINE_FUNCTION | TensorViewIterator (TensorViewType tensor_view, ViewType1 view1, ViewType2 view2, RankCombinationViewType rank_combination_types) |
| | Constructor.
|
| KOKKOS_INLINE_FUNCTION int | nextIncrementRank () |
| KOKKOS_INLINE_FUNCTION int | increment () |
| KOKKOS_INLINE_FUNCTION void | setLocation (const Kokkos::Array< int, 7 > location) |
| KOKKOS_INLINE_FUNCTION void | setLocation (Kokkos::Array< int, 7 > location1, Kokkos::Array< int, 7 > location2) |
| KOKKOS_INLINE_FUNCTION ScalarType | getView1Entry () |
| KOKKOS_INLINE_FUNCTION ScalarType | getView2Entry () |
| KOKKOS_INLINE_FUNCTION void | set (ScalarType value) |
template<class TensorViewType, class ViewType1, class ViewType2, typename ScalarType>
class Intrepid2::TensorViewIterator< TensorViewType, ViewType1, ViewType2, ScalarType >
A helper class that allows iteration over three Kokkos Views simultaneously, according to tensor combination rules:
- component view 1,
- component view 2, and
- the combination tensor view
- See also
- Intrepid2::ViewIterator
Definition at line 40 of file Intrepid2_TensorViewIterator.hpp.
template<class TensorViewType, class ViewType1, class ViewType2, typename ScalarType>
| KOKKOS_INLINE_FUNCTION Intrepid2::TensorViewIterator< TensorViewType, ViewType1, ViewType2, ScalarType >::TensorViewIterator |
( |
TensorViewType | tensor_view, |
|
|
ViewType1 | view1, |
|
|
ViewType2 | view2, |
|
|
RankCombinationViewType | rank_combination_types ) |
|
inline |
Constructor.
- Parameters
-
| [in] | tensor_view | - the view that stores the tensor combination |
| [in] | view1 | - first component view |
| [in] | view2 | - second component view |
| [in] | rank_combination_types | - vector with length equal to the maximum rank of the views provided, specifying how component views should be combined to produce tensor view. rank_combination_types entries can be as follows:
- DIMENSION_MATCH: component views and tensor view all have same extent in this rank, and should iterate in tandem.
- TENSOR_PRODUCT: if component views have extents a and b in this rank, the tensor view has extent a*b.
- TENSOR_CONTRACTION: component views have matching extents in this rank; tensor view has extent 1.
|
For TENSOR_PRODUCT combinations in a given rank, view1 increments first. For example, if view1 has entries [x,y] and view2 has entries [0,1] in a given TENSOR_PRODUCT rank, there will be four entries in the tensor_view, in the following order:
Tensor contractions are only allowed in the final dimension(s); if rank d has a TENSOR_CONTRACTION entry, then all subsequent ranks must also contract.
Definition at line 78 of file Intrepid2_TensorViewIterator.hpp.
template<class TensorViewType, class ViewType1, class ViewType2, typename ScalarType>
Move to the next location. Note that during contractions, the tensor view location will not change; the returned rank corresponds to the other two views in that case.
- Returns
- the rank of the leftmost index that was changed in any of the views; -1 if increment reached the end of the views
Definition at line 155 of file Intrepid2_TensorViewIterator.hpp.
template<class TensorViewType, class ViewType1, class ViewType2, typename ScalarType>
| KOKKOS_INLINE_FUNCTION void Intrepid2::TensorViewIterator< TensorViewType, ViewType1, ViewType2, ScalarType >::setLocation |
( |
Kokkos::Array< int, 7 > | location1, |
|
|
Kokkos::Array< int, 7 > | location2 ) |
|
inline |
Sets the current location in the two component views to the specified locations, and sets the tensor view location to the location corresponding to the two component locations.
- Parameters
-
| [in] | location1 | - the location in view1 as a 7-element array value. |
| [in] | location2 | - the location in view2 as a 7-element array value. |
Definition at line 216 of file Intrepid2_TensorViewIterator.hpp.