49 #ifndef Intrepid2_ViewIterator_h
50 #define Intrepid2_ViewIterator_h
73 template<
class ViewType,
typename ScalarType>
77 Kokkos::Array<int,7> dims_;
78 Kokkos::Array<int,7> index_;
82 KOKKOS_INLINE_FUNCTION
87 for (
unsigned d=0; d<view.rank(); d++)
89 dims_[d] = view.extent_int(d);
92 for (
unsigned d=view.rank(); d<7; d++)
101 KOKKOS_INLINE_FUNCTION
104 return view_.access(index_[0],index_[1],index_[2],index_[3],index_[4],index_[5],index_[6]);
109 KOKKOS_INLINE_FUNCTION
110 void set(ScalarType &value)
112 view_.access(index_[0],index_[1],index_[2],index_[3],index_[4],index_[5],index_[6]) = value;
117 KOKKOS_INLINE_FUNCTION
120 const auto rank = view_.rank();
121 for (
int r=rank-1; r>=0; r--)
123 if (index_[r]+1 < dims_[r])
134 KOKKOS_INLINE_FUNCTION
137 const auto rank = view_.rank();
138 for (
int r=rank-1; r>=0; r--)
140 if (index_[r]+1 < dims_[r])
159 KOKKOS_INLINE_FUNCTION
162 const auto rank = view_.rank();
163 for (
int r=rank-1; r>=0; r--)
165 if (index_[r]-1 >= 0)
173 index_[r] = dims_[r]-1;
185 KOKKOS_INLINE_FUNCTION
189 for (
int d=0; d<7; d++)
191 if (d>0) index_1D *= dims_[d-1];
192 index_1D += index_[d];
201 KOKKOS_INLINE_FUNCTION
204 return index_[dimension];
210 KOKKOS_INLINE_FUNCTION
213 return dims_[dimension];
218 KOKKOS_INLINE_FUNCTION
221 for (
unsigned d=from_rank_number; d<view_.rank(); d++)
229 KOKKOS_INLINE_FUNCTION
237 KOKKOS_INLINE_FUNCTION
KOKKOS_INLINE_FUNCTION int nextIncrementRank()
KOKKOS_INLINE_FUNCTION int getExtent(int dimension)
KOKKOS_INLINE_FUNCTION int getEnumerationIndex()
KOKKOS_INLINE_FUNCTION void reset(int from_rank_number=0)
KOKKOS_INLINE_FUNCTION void set(ScalarType &value)
KOKKOS_INLINE_FUNCTION bool decrement()
KOKKOS_INLINE_FUNCTION int increment()
KOKKOS_INLINE_FUNCTION void setLocation(const Kokkos::Array< int, 7 > &location)
A helper class that allows iteration over some part of a Kokkos View, while allowing the calling code...
KOKKOS_INLINE_FUNCTION Kokkos::Array< int, 7 > & getLocation()
KOKKOS_INLINE_FUNCTION int getIndex(int dimension)
KOKKOS_INLINE_FUNCTION ViewIterator(ViewType view)