cpp: void print_array(int nx,\nint ny,\nDATA_TYPE POLYBENCH_2D(ex,NX,NY,nx,ny),\nDATA_TYPE POLYBENCH_2D(ey,NX,NY,nx,ny),\nDATA_TYPE POLYBENCH_2D(hz,NX,NY,nx,ny))\n{\nint i, j;\n\nfor (i = 0; i < nx; i++)\nfor (j = 0; j < ny; j++) {\nfprintf(stderr, DATA_PRINTF_MODIFIER, ex[i][j]);\nfprintf(stderr, DATA_PRINTF_MODIFIER, ey[i][j]);\nfprintf(stderr, DATA_PRINTF_MODIFIER, hz[i][j]);\nif ((i * nx + j) % 20 == 0) fprintf(stderr, "\n");\n}\nfprintf(stderr, "\n");\n}
fortran: subroutine print_array(nx, ny, ex, ey, hz)\nimplicit none\n\nDATA_TYPE, dimension(ny, nx) :: ex\nDATA_TYPE, dimension(ny, nx) :: ey\nDATA_TYPE, dimension(ny, nx) :: hz\ninteger :: nx, ny\ninteger :: i, j\ndo i = 1, nx\ndo j = 1, ny\nwrite(0, DATA_PRINTF_MODIFIER) ex(j, i)\nwrite(0, DATA_PRINTF_MODIFIER) ey(j, i)\nwrite(0, DATA_PRINTF_MODIFIER) hz(j, i)\nif (mod(((i - 1) * nx) + j - 1, 20) == 0) then\nwrite(0, *)\nend if\nend do\nend do\nwrite(0, *)\nend subroutine