Question

The cells of a structured grid are usually saved linearly in memory. For example, in 2D the cells (i, j) are saved to the linear memory space at indices according

to the following scheme: \text { Let a structured grid in } 3 \mathrm{D} \text { consist of }\left(n_{x}, n_{y}, n_{z}\right) \text { grid points in each dimension. } (a) Find the map (i, j, k) →l that maps 3D cell indices to linear cell indices. Assume that the first dimension(i) varies fastest in the linear memory space. (b) Find the map l → (i, j, k) that maps linear cell indices to 3D cell indices. Assume again that the first dimension (i) varies fastest in the linear memory space.

Fig: 1

Fig: 2

Fig: 3

Fig: 4

Fig: 5