Go to the documentation of this file.
7 #ifndef INCLUDE_JET_ARRAY_ACCESSOR2_H_
8 #define INCLUDE_JET_ARRAY_ACCESSOR2_H_
57 void reset(
size_t width,
size_t height, T*
const data);
63 const T&
at(
size_t i)
const;
72 T&
at(
size_t i,
size_t j);
75 const T&
at(
size_t i,
size_t j)
const;
132 template <
typename Callback>
163 template <
typename Callback>
186 template <
typename Callback>
207 template <
typename Callback>
214 size_t index(
size_t i,
size_t j)
const;
260 template <
typename T>
276 size_t width,
size_t height,
const T*
const data);
285 const T&
at(
size_t i)
const;
291 const T&
at(
size_t i,
size_t j)
const;
297 const T*
const end()
const;
339 template <
typename Callback>
370 template <
typename Callback>
391 template <
typename Callback>
398 size_t index(
size_t i,
size_t j)
const;
419 #include "detail/array_accessor2-inl.h"
421 #endif // INCLUDE_JET_ARRAY_ACCESSOR2_H_
2-D point class.
Definition: point2.h:23
const T & at(const Point2UI &pt) const
Returns the const reference to the element at (pt.x, pt.y).
const T & operator()(size_t i, size_t j) const
Returns the const reference to the element at (i, j).
const T & at(size_t i, size_t j) const
Returns the const reference to the element at (i, j).
T * begin()
Returns the begin iterator of the array.
size_t height() const
Returns the height of the array.
T & at(size_t i)
Returns the reference to the i-th element.
ConstArrayAccessor(const ConstArrayAccessor &other)
Copy constructor.
void reset(const Size2 &size, T *const data)
Resets the array.
size_t index(size_t i, size_t j) const
Returns the linear index of the given 2-D coordinate (i, j).
const T & at(size_t i, size_t j) const
Returns the const reference to the element at (i, j).
T *const end() const
Returns the end iterator of the array.
const T & at(size_t i) const
Returns the reference to the i-th element.
void swap(ArrayAccessor &other)
Swaps the content of with other array accessor.
void parallelForEachIndex(Callback func) const
Iterates the array and invoke given func for each index in parallel using multi-threading.
const T *const end() const
Returns the end iterator of the array.
const T & operator()(const Point2UI &pt) const
Returns the const reference to the element at (pt.x, pt.y).
ConstArrayAccessor()
Constructs empty 2-D read-only array accessor.
T & at(const Point2UI &pt)
Returns the reference to the element at (pt.x, pt.y).
const T & operator()(size_t i, size_t j) const
Returns the const reference to the element at (i, j).
ArrayAccessor & operator=(const ArrayAccessor &other)
Copies given array accessor other.
size_t width() const
Returns the width of the array.
ConstArrayAccessor(const ArrayAccessor< T, 2 > &other)
Constructs a read-only array accessor from read/write accessor.
ArrayAccessor(const ArrayAccessor &other)
Copy constructor.
void set(const ArrayAccessor &other)
Replaces the content with given other array accessor.
size_t width() const
Returns the width of the array.
const T & at(size_t i) const
Returns the const reference to the i-th element.
ConstArrayAccessor(size_t width, size_t height, const T *const data)
Definition: advection_solver2.h:18
Size2 size() const
Returns the size of the array.
2-D read-only array accessor class.
Definition: array_accessor2.h:261
const T & operator[](size_t i) const
Returns the const reference to the i-th element.
void forEachIndex(Callback func) const
Iterates the array and invoke given func for each index.
size_t height() const
Returns the height of the array.
Generic N-dimensional read-only array accessor class interface.
Definition: array_accessor.h:47
ArrayAccessor()
Constructs empty 2-D array accessor.
void parallelForEachIndex(Callback func) const
Iterates the array and invoke given func for each index in parallel using multi-threading.
void forEachIndex(Callback func) const
Iterates the array and invoke given func for each index.
const T *const data() const
Returns the raw pointer to the array data.
ArrayAccessor(size_t width, size_t height, T *const data)
void reset(size_t width, size_t height, T *const data)
Resets the array.
ConstArrayAccessor(const Size2 &size, const T *const data)
size_t index(const Point2UI &pt) const
Returns the linear index of the given 2-D coordinate (pt.x, pt.y).
2-D size class.
Definition: size2.h:19
T * end()
Returns the end iterator of the array.
2-D array accessor class.
Definition: array_accessor2.h:31
T *const data() const
Returns the raw pointer to the array data.
size_t index(const Point2UI &pt) const
Returns the linear index of the given 2-D coordinate (pt.x, pt.y).
T *const begin() const
Returns the begin iterator of the array.
const T & operator()(const Point2UI &pt) const
Returns the const reference to the element at (pt.x, pt.y).
size_t index(size_t i, size_t j) const
Returns the linear index of the given 2-D coordinate (i, j).
void forEach(Callback func) const
Iterates the array and invoke given func for each index.
T & at(size_t i, size_t j)
Returns the reference to the element at (i, j).
const T *const begin() const
Returns the begin iterator of the array.
T & operator[](size_t i)
Returns the reference to the i-th element.
ArrayAccessor(const Size2 &size, T *const data)
T & operator()(size_t i, size_t j)
Returns the reference to the element at (i, j).
const T & at(const Point2UI &pt) const
Returns the const reference to the element at (pt.x, pt.y).
Size2 size() const
Returns the size of the array.
T & operator()(const Point2UI &pt)
Returns the reference to the element at (pt.x, pt.y).
void parallelForEach(Callback func)
Iterates the array and invoke given func for each index in parallel.
void forEach(Callback func) const
Iterates the array and invoke given func for each index.
Generic N-dimensional array accessor class interface.
Definition: array_accessor.h:29
const T & operator[](size_t i) const
Returns the const reference to the i-th element.