My job made me work with OpenFOAM (fluid simulation stuff) which is based on C++. I know nothing about C++, not even how to compile a hello world program. In OpenFOAM you can output a three dimensional array as ascii in a text file. This is okay because my calculation doesn't take long. In the file it then has one value per line. Which order do these values have?
So, in Fortran I can do
WRITE(*,*) 3d_array
and it will display the values of the array in the order they were saved, this means the first iteration is in x direction, then in y and then in z direction. The output is in the same order as if I'd output it this way:
integer, allocatable, dimension(x,y,z)::3d_array
[...]
do k=1,z
do j=1,y
do i=1,x
write(*,*) 3d_array(i,j,k)
end do
end do
end do
How does it work in C++?