52 int operator*() {
return current_m; }
56 current_m -= stride_m;
61 current_m -= stride_m;
67 current_m += stride_m;
72 current_m += stride_m;
77 current_m += (stride_m * i);
82 current_m -= (stride_m * i);
86 iterator operator+(
int i)
const {
return iterator(current_m + i * stride_m, stride_m); }
88 iterator operator-(
int i)
const {
return iterator(current_m - i * stride_m, stride_m); }
90 int operator[](
int i)
const {
return current_m + i * stride_m; }
92 bool operator==(
const iterator& y)
const {
93 return (current_m == y.current_m) && (stride_m == y.stride_m);
96 bool operator<(
const iterator& y)
const {
97 return (current_m < y.current_m)
98 || ((current_m == y.current_m) && (stride_m < y.stride_m));
101 bool operator!=(
const iterator& y)
const {
return !((*this) == y); }
103 bool operator>(
const iterator& y)
const {
return y < (*this); }
105 bool operator<=(
const iterator& y)
const {
return !(y < (*this)); }
107 bool operator>=(
const iterator& y)
const {
return !((*this) < y); }
117 KOKKOS_INLINE_FUNCTION
Index();
123 KOKKOS_INLINE_FUNCTION
Index(
size_t n);
131 KOKKOS_INLINE_FUNCTION
Index(
int f,
int l);
139 KOKKOS_INLINE_FUNCTION
Index(
int f,
int l,
int s);
141 KOKKOS_DEFAULTED_FUNCTION
147 KOKKOS_INLINE_FUNCTION
int min() const noexcept;
152 KOKKOS_INLINE_FUNCTION
int max() const noexcept;
157 KOKKOS_INLINE_FUNCTION
size_t length() const noexcept;
162 KOKKOS_INLINE_FUNCTION
int stride() const noexcept;
167 KOKKOS_INLINE_FUNCTION
int first() const noexcept;
172 KOKKOS_INLINE_FUNCTION
int last() const noexcept;
177 KOKKOS_INLINE_FUNCTION
bool empty() const noexcept;
179 KOKKOS_INLINE_FUNCTION
Index& operator+=(
int);
181 KOKKOS_INLINE_FUNCTION
Index& operator-=(
int);
184 KOKKOS_INLINE_FUNCTION friend
Index operator+(const
Index&,
int);
186 KOKKOS_INLINE_FUNCTION friend
Index operator+(
int, const
Index&);
188 KOKKOS_INLINE_FUNCTION friend
Index operator-(const
Index&,
int);
190 KOKKOS_INLINE_FUNCTION friend
Index operator-(
int, const
Index&);
193 KOKKOS_INLINE_FUNCTION friend
Index operator-(const
Index&);
195 KOKKOS_INLINE_FUNCTION friend
Index operator*(const
Index&,
int);
197 KOKKOS_INLINE_FUNCTION friend
Index operator*(
int, const
Index&);
199 KOKKOS_INLINE_FUNCTION friend
Index operator/(const
Index&,
int);
202 KOKKOS_INLINE_FUNCTION
Index intersect(const
Index&) const;
205 KOKKOS_INLINE_FUNCTION
Index grow(
int ncells) const;
208 KOKKOS_INLINE_FUNCTION
bool touches(const
Index& a) const;
210 KOKKOS_INLINE_FUNCTION
bool contains(const
Index& a) const;
212 KOKKOS_INLINE_FUNCTION
bool split(
Index& l,
Index& r) const;
214 KOKKOS_INLINE_FUNCTION
bool split(
Index& l,
Index& r,
int i) const;
216 KOKKOS_INLINE_FUNCTION
bool split(
Index& l,
Index& r,
double a) const;
221 iterator end() {
return iterator(first_m + stride_m * length_m, stride_m); }
224 KOKKOS_INLINE_FUNCTION
bool operator<(
const Index& r)
const {
226 (length_m < r.length_m)
227 || ((length_m == r.length_m)
228 && ((first_m < r.first_m)
229 || ((first_m == r.first_m) && (length_m > 0) && (stride_m < r.stride_m)))));
232 KOKKOS_INLINE_FUNCTION
bool operator==(
const Index& r)
const noexcept {
233 return (length_m == r.length_m) && (first_m == r.first_m) && (stride_m == r.stride_m);
242 KOKKOS_INLINE_FUNCTION
Index reverse()
const;
247 KOKKOS_INLINE_FUNCTION
Index(
int m,
int a,
const Index& b);
249 KOKKOS_INLINE_FUNCTION
Index(
int f,
int s,
const Index* b);
252 KOKKOS_INLINE_FUNCTION
Index general_intersect(
const Index&)
const;