Jacobi Iteration in 3D

I have written a code for a 2D Laplace equation solver using Jacobi Iteration. However, I find it hard to extend it to 3D. There don’t seem to be an option to initialize a 3D array.

May I know how do we deal with 3D cases in general in CUDA? Thanks in advanced.

You may do 3D array manually, computing 1D indexes of 3d array, it will be not so slow.

Does that means something like this:
If I want to generate a 333 3D array, I can generate a 3*9 matrix. Then I just do the index mapping so that it works like a 3D array?

A 3d array is just a big 1d array (for the sake of this conversation). Anything of the form array[depth][height][width] can be transformed to array[depthheightwidth] and then indexed as array[kheightwidth+j*width+i]

Hope this helps!