Function gamer::Vect2Index¶
Defined in File gamer.h
Function Documentation¶
-
std::size_t
gamer
::
Vect2Index
(const std::size_t i, const std::size_t j, const std::size_t k, const Vector3szt &dim)¶ Convert 3D array indices to the index of a flat array.
As a convention use the following loop structure to optimize cache efficiency:
In short, index i should occupy the inner most scope followed by j then k.for (int k;...; k++){ for (int j;...; j++){ for (int i;...; i++){ }}}
- Return
Index of flat array corresponding to indices in 3D array.
- Parameters
[in] i
: Value of the first index[in] j
: Value of the second index[in] k
: Value of the third index[in] dim
: Dimensions of the 3D array