Function gamer::Vect2Index¶
Defined in File gamer.h
Function Documentation¶
-
inline 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++){ }}}
- Parameters
i – [in] Value of the first index
j – [in] Value of the second index
k – [in] Value of the third index
dim – [in] Dimensions of the 3D array
- Returns
Index of flat array corresponding to indices in 3D array.