9 #ifndef CUBBYFLOW_ARRAY_ACCESSOR3_IMPL_H 10 #define CUBBYFLOW_ARRAY_ACCESSOR3_IMPL_H 36 Reset(width, height, depth, data);
48 Reset(other.m_size, other.m_data);
61 Reset(
Size3(width, height, depth), data);
67 assert(i < Width() * Height() * Depth());
74 assert(i < Width() * Height() * Depth());
81 return At(pt.
x, pt.
y, pt.
z);
87 return At(pt.
x, pt.
y, pt.
z);
93 assert(i < Width() && j < Height() && k < Depth());
94 return m_data[Index(i, j, k)];
100 assert(i < Width() && j < Height() && k < Depth());
101 return m_data[Index(i, j, k)];
104 template <
typename T>
110 template <
typename T>
113 return m_data + Width() * Height() * Depth();
116 template <
typename T>
122 template <
typename T>
125 return m_data + Width() * Height() * Depth();
128 template <
typename T>
134 template <
typename T>
140 template <
typename T>
146 template <
typename T>
152 template <
typename T>
158 template <
typename T>
161 std::swap(other.m_data, m_data);
162 std::swap(other.m_size, m_size);
165 template <
typename T>
166 template <
typename Callback>
169 for (
size_t k = 0; k < Depth(); ++k)
171 for (
size_t j = 0; j < Height(); ++j)
173 for (
size_t i = 0; i < Width(); ++i)
181 template <
typename T>
182 template <
typename Callback>
185 for (
size_t k = 0; k < Depth(); ++k)
187 for (
size_t j = 0; j < Height(); ++j)
189 for (
size_t i = 0; i < Width(); ++i)
197 template <
typename T>
198 template <
typename Callback>
207 template <
typename T>
208 template <
typename Callback>
214 template <
typename T>
217 assert(pt.
x < Width() && pt.
y < Height() && pt.
z < Depth());
218 return pt.
x + Width() * pt.
y + Width() * Height() * pt.
z;
221 template <
typename T>
224 assert(i < Width() && j < Height() && k < Depth());
225 return i + Width() * j + Width() * Height() * k;
228 template <
typename T>
234 template <
typename T>
240 template <
typename T>
243 return m_data[Index(pt)];
246 template <
typename T>
249 return m_data[Index(pt)];
252 template <
typename T>
255 return m_data[Index(i, j, k)];
258 template <
typename T>
261 return m_data[Index(i, j, k)];
264 template <
typename T>
271 template <
typename T>
277 template <
typename T>
284 template <
typename T>
291 template <
typename T>
294 m_size =
Size3(width, height, depth);
298 template <
typename T>
301 m_size = other.
size();
302 m_data = other.
data();
305 template <
typename T>
308 m_size = other.m_size;
309 m_data = other.m_data;
312 template <
typename T>
315 assert(i < Width() * Height() * Depth());
319 template <
typename T>
322 return At(pt.
x, pt.
y, pt.
z);
325 template <
typename T>
329 assert(j < Height());
331 return m_data[Index(i, j, k)];
334 template <
typename T>
340 template <
typename T>
343 return m_data + Width() * Height() * Depth();
346 template <
typename T>
352 template <
typename T>
358 template <
typename T>
364 template <
typename T>
370 template <
typename T>
376 template <
typename T>
377 template <
typename Callback>
380 for (
size_t k = 0; k < Depth(); ++k)
382 for (
size_t j = 0; j < Height(); ++j)
384 for (
size_t i = 0; i < Width(); ++i)
392 template <
typename T>
393 template <
typename Callback>
396 for (
size_t k = 0; k < Depth(); ++k)
398 for (
size_t j = 0; j < Height(); ++j)
400 for (
size_t i = 0; i < Width(); ++i)
408 template <
typename T>
409 template <
typename Callback>
415 template <
typename T>
418 assert(pt.
x < m_size.x && pt.
y < m_size.y && pt.
z < m_size.z);
419 return pt.
x + Width() * pt.
y + Width() * Height() * pt.
z;
422 template <
typename T>
425 assert(i < m_size.x && j < m_size.y && k < m_size.z);
426 return i + Width() * j + Width() * Height() * k;
429 template <
typename T>
435 template <
typename T>
438 return m_data[Index(i, j, k)];
441 template <
typename T>
444 return m_data[Index(pt)];
3-D array accessor class.
Definition: ArrayAccessor3.h:31
3-D read-only array accessor class.
Definition: ArrayAccessor3.h:269
3-D point class.
Definition: Point3.h:26
Generic N-dimensional array accessor class interface.
Definition: ArrayAccessor.h:31
Definition: pybind11Utils.h:24
void ParallelFor(IndexType beginIndex, IndexType endIndex, const Function &function, ExecutionPolicy policy)
Makes a for-loop from beginIndex to endIndex in parallel.
Definition: Parallel-Impl.h:201
Generic N-dimensional read-only array accessor class interface.
Definition: ArrayAccessor.h:52
T z
Z (or the third) component of the point.
Definition: Point3.h:38
T y
Y (or the second) component of the point.
Definition: Point3.h:35
constexpr size_t ZERO_SIZE
Zero size_t.
Definition: Constants.h:18
T x
X (or the first) component of the point.
Definition: Point3.h:29
Size3 size() const
Returns the size of the array.
Definition: ArrayAccessor3-Impl.h:129
T *const data() const
Returns the raw pointer to the array data.
Definition: ArrayAccessor3-Impl.h:153
Point3< size_t > Size3
Definition: Size3.h:16