Go to the documentation of this file.
7 #ifndef INCLUDE_JET_ARRAY3_H_
8 #define INCLUDE_JET_ARRAY3_H_
46 typedef typename ContainerType::iterator
Iterator;
55 explicit Array(
const Size3& size,
const T& initVal = T());
63 explicit Array(
size_t width,
size_t height,
size_t depth,
64 const T& initVal = T());
87 Array(
const std::initializer_list<
88 std::initializer_list<std::initializer_list<T>>>& lst);
97 void set(
const T& value);
123 void set(
const std::initializer_list<
124 std::initializer_list<std::initializer_list<T>>>& lst);
134 void resize(
size_t width,
size_t height,
size_t depth,
135 const T& initVal = T());
155 const T&
at(
size_t i)
const;
164 T&
at(
size_t i,
size_t j,
size_t k);
167 const T&
at(
size_t i,
size_t j,
size_t k)
const;
236 template <
typename Callback>
267 template <
typename Callback>
289 template <
typename Callback>
309 template <
typename Callback>
379 std::initializer_list<std::initializer_list<T>>>& lst);
389 std::vector<T> _data;
393 template <
typename T>
398 #include "detail/array3-inl.h"
400 #endif // INCLUDE_JET_ARRAY3_H_
3-D read-only array accessor class.
Definition: array_accessor3.h:270
Iterator end()
Returns the end iterator of the array.
ConstIterator end() const
Returns the end const iterator of the array.
std::vector< T > ContainerType
Definition: array3.h:45
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.
const T & at(size_t i, size_t j, size_t k) const
Returns the const reference to the element at (i, j, k).
Array & operator=(const T &value)
Sets entire array with given value.
ContainerType::const_iterator ConstIterator
Definition: array3.h:47
void parallelForEach(Callback func)
Iterates the array and invoke given func for each index in parallel.
ConstArrayAccessor3< T > constAccessor() const
Returns the const array accessor.
void forEach(Callback func) const
Iterates the array and invoke given func for each index.
Array(Array &&other)
Move constructor.
T & operator()(size_t i, size_t j, size_t k)
Returns the reference to the element at (i, j, k).
const T & operator()(const Point3UI &pt) const
Returns the const reference to the element at (pt.x, pt.y, pt.z).
void forEachIndex(Callback func) const
Iterates the array and invoke given func for each index.
size_t depth() const
Returns the depth of the array.
T * data()
Returns the raw pointer to the array data.
Array()
Constructs zero-sized 3-D array.
Definition: advection_solver2.h:18
Array & operator=(Array &&other)
Move assignment.
Size3 size() const
Returns the size of the array.
T & at(size_t i, size_t j, size_t k)
Returns the reference to the element at (i, j, k).
void set(const T &value)
Sets entire array with given value.
void set(const Array &other)
Copies given array other to this array.
ContainerType::iterator Iterator
Definition: array3.h:46
Array(const Size3 &size, const T &initVal=T())
T & operator[](size_t i)
Returns the reference to the i-th element.
Array(size_t width, size_t height, size_t depth, const T &initVal=T())
void swap(Array &other)
Swaps the content of the array with other array.
3-D size class.
Definition: size3.h:19
T & operator()(const Point3UI &pt)
Returns the reference to the element at (pt.x, pt.y, pt.z).
ArrayAccessor3< T > accessor()
Returns the array accessor.
ConstIterator begin() const
Returns the begin const iterator of the array.
3-D point class.
Definition: point3.h:23
T & at(size_t i)
Returns the reference to the i-th element.
void resize(size_t width, size_t height, size_t depth, const T &initVal=T())
3-D array accessor class.
Definition: array_accessor3.h:31
void parallelForEachIndex(Callback func) const
Iterates the array and invoke given func for each index in parallel using multi-threading.
Array(const Array &other)
Copy constructor.
T & at(const Point3UI &pt)
Returns the reference to the element at (pt.x, pt.y, pt.z).
void clear()
Clears the array and resizes to zero.
Generic N-dimensional array class interface.
Definition: array.h:26
size_t height() const
Returns the height of the array.
const T *const data() const
Returns the const raw pointer to the array data.
Iterator begin()
Returns the begin iterator of the array.
const T & operator()(size_t i, size_t j, size_t k) const
Returns the const reference to the element at (i, j, k).
Array(const std::initializer_list< std::initializer_list< std::initializer_list< T >>> &lst)
Constructs 3-D array with given initializer list lst.
Array & operator=(const Array &other)
Copies given array other to this array.
void set(const std::initializer_list< std::initializer_list< std::initializer_list< T >>> &lst)
3-D array class.
Definition: array3.h:43
Array & operator=(const std::initializer_list< std::initializer_list< std::initializer_list< T >>> &lst)
const T & at(const Point3UI &pt) const
Returns the const reference to the element at (pt.x, pt.y, pt.z).
const T & operator[](size_t i) const
Returns the const reference to the i-th element.
void resize(const Size3 &size, const T &initVal=T())
Resizes the array with size and fill the new element with initVal.