cpp: void init_array (int cz,\nint cxm,\nint cym,\nDATA_TYPE *mui,\nDATA_TYPE *ch,\nDATA_TYPE POLYBENCH_2D(Ax,CZ+1,CYM+1,cz+1,cym+1),\nDATA_TYPE POLYBENCH_2D(Ry,CZ+1,CYM+1,cz+1,cym+1),\nDATA_TYPE POLYBENCH_3D(Ex,CZ+1,CYM+1,CXM+1,cz+1,cym+1,cxm+1),\nDATA_TYPE POLYBENCH_3D(Ey,CZ+1,CYM+1,CXM+1,cz+1,cym+1,cxm+1),\nDATA_TYPE POLYBENCH_3D(Hz,CZ+1,CYM+1,CXM+1,cz+1,cym+1,cxm+1),\nDATA_TYPE POLYBENCH_1D(czm,CZ+1,cz+1),\nDATA_TYPE POLYBENCH_1D(czp,CZ+1,cz+1),\nDATA_TYPE POLYBENCH_1D(cxmh,CXM+1,cxm+1),\nDATA_TYPE POLYBENCH_1D(cxph,CXM+1,cxm+1),\nDATA_TYPE POLYBENCH_1D(cymh,CYM+1,cym+1),\nDATA_TYPE POLYBENCH_1D(cyph,CYM+1,cym+1))\n{\nint i, j, k;\n*mui = 2341;\n*ch = 42;\nfor (i = 0; i <= cz; i++)\n{\nczm[i] = ((DATA_TYPE) i + 1) / cxm;\nczp[i] = ((DATA_TYPE) i + 2) / cxm;\n}\nfor (i = 0; i <= cxm; i++)\n{\ncxmh[i] = ((DATA_TYPE) i + 3) / cxm;\ncxph[i] = ((DATA_TYPE) i + 4) / cxm;\n}\nfor (i = 0; i <= cym; i++)\n{\ncymh[i] = ((DATA_TYPE) i + 5) / cxm;\ncyph[i] = ((DATA_TYPE) i + 6) / cxm;\n}\n\nfor (i = 0; i <= cz; i++)\nfor (j = 0; j <= cym; j++)\n{\nRy[i][j] = ((DATA_TYPE) i*(j+1) + 10) / cym;\nAx[i][j] = ((DATA_TYPE) i*(j+2) + 11) / cym;\nfor (k = 0; k <= cxm; k++)\n{\nEx[i][j][k] = ((DATA_TYPE) i*(j+3) + k + 1) / cxm;\nEy[i][j][k] = ((DATA_TYPE) i*(j+4) + k + 2) / cym;\nHz[i][j][k] = ((DATA_TYPE) i*(j+5) + k + 3) / cz;\n}\n}\n}
fortran: subroutine init_array(cz, cxm, cym, mui, ch, ax, ry, ex, ey, hz, &\nczm, czp, cxmh, cxph, cymh, cyph)\nimplicit none\n\ninteger :: cz, cym, cxm\nDATA_TYPE, dimension(cxm + 1, cym + 1, cz + 1) :: ex\nDATA_TYPE, dimension(cxm + 1, cym + 1, cz + 1) :: ey\nDATA_TYPE, dimension(cxm + 1, cym + 1, cz + 1) :: hz\nDATA_TYPE, dimension(cym + 1, cz + 1) :: ry\nDATA_TYPE, dimension(cym + 1, cz + 1) :: ax\nDATA_TYPE, dimension(cym + 1) :: cymh\nDATA_TYPE, dimension(cym + 1) :: cyph\nDATA_TYPE, dimension(cxm + 1) :: cxmh\nDATA_TYPE, dimension(cxm + 1) :: cxph\nDATA_TYPE, dimension(cz + 1) :: czm\nDATA_TYPE, dimension(cz + 1) :: czp\nDATA_TYPE :: mui, ch\ninteger :: i, j, k\n\nmui = 2341\nch = 42\ndo i = 1, cz + 1\nczm(i) = (DBLE(i - 1) + 1.0D0) / DBLE(cxm)\nczp(i) = (DBLE(i - 1) + 2.0D0) / DBLE(cxm)\nend do\ndo i = 1, cxm + 1\ncxmh(i) = (DBLE(i - 1) + 3.0D0) / DBLE(cxm)\ncxph(i) = (DBLE(i - 1) + 4.0D0) / DBLE(cxm)\nend do\ndo i = 1, cym + 1\ncymh(i) = (DBLE(i - 1) + 5.0D0) / DBLE(cxm)\ncyph(i) = (DBLE(i - 1) + 6.0D0) / DBLE(cxm)\nend do\ndo i = 1, cz + 1\ndo j = 1, cym + 1\nry(j, i) = ((DBLE(i - 1) * DBLE(j)) + 10.0D0) / &\nDBLE(cym)\nax(j, i) = ((DBLE(i - 1) * DBLE(j + 1)) + 11.0D0) / &\nDBLE(cym)\ndo k = 1, cxm + 1\nex(k, j, i) = ((DBLE(i - 1) * DBLE(j + 2)) + DBLE(k - 1) + &\n1.0D0) / DBLE(cxm)\ney(k, j, i) = ((DBLE(i - 1) * DBLE(j + 3)) + DBLE(k - 1) + &\n2.0D0) / DBLE(cym)\nhz(k, j, i) = ((DBLE(i - 1) * DBLE(j + 4)) + DBLE(k - 1) + &\n3.0D0) / DBLE(cz)\nend do\nend do\nend do\nend subroutine