cpp: void kernel_fdtd_apml(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_2D(clf,CYM+1,CXM+1,cym+1,cxm+1),\nDATA_TYPE POLYBENCH_2D(tmp,CYM+1,CXM+1,cym+1,cxm+1),\nDATA_TYPE POLYBENCH_3D(Bza,CZ+1,CYM+1,CXM+1,cz+1,cym+1,cxm+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 iz, iy, ix;\n\n#pragma scop\nfor (iz = 0; iz < _PB_CZ; iz++)\n{\nfor (iy = 0; iy < _PB_CYM; iy++)\n{\nfor (ix = 0; ix < _PB_CXM; ix++)\n{\nclf[iz][iy] = Ex[iz][iy][ix] - Ex[iz][iy+1][ix] + Ey[iz][iy][ix+1] - Ey[iz][iy][ix];\ntmp[iz][iy] = (cymh[iy] / cyph[iy]) * Bza[iz][iy][ix] - (ch / cyph[iy]) * clf[iz][iy];\nHz[iz][iy][ix] = (cxmh[ix] /cxph[ix]) * Hz[iz][iy][ix]\n+ (mui * czp[iz] / cxph[ix]) * tmp[iz][iy]\n- (mui * czm[iz] / cxph[ix]) * Bza[iz][iy][ix];\nBza[iz][iy][ix] = tmp[iz][iy];\n}\nclf[iz][iy] = Ex[iz][iy][_PB_CXM] - Ex[iz][iy+1][_PB_CXM] + Ry[iz][iy] - Ey[iz][iy][_PB_CXM];\ntmp[iz][iy] = (cymh[iy] / cyph[iy]) * Bza[iz][iy][_PB_CXM] - (ch / cyph[iy]) * clf[iz][iy];\nHz[iz][iy][_PB_CXM]=(cxmh[_PB_CXM] / cxph[_PB_CXM]) * Hz[iz][iy][_PB_CXM]\n+ (mui * czp[iz] / cxph[_PB_CXM]) * tmp[iz][iy]\n- (mui * czm[iz] / cxph[_PB_CXM]) * Bza[iz][iy][_PB_CXM];\nBza[iz][iy][_PB_CXM] = tmp[iz][iy];\nfor (ix = 0; ix < _PB_CXM; ix++)\n{\nclf[iz][iy] = Ex[iz][_PB_CYM][ix] - Ax[iz][ix] + Ey[iz][_PB_CYM][ix+1] - Ey[iz][_PB_CYM][ix];\ntmp[iz][iy] = (cymh[_PB_CYM] / cyph[iy]) * Bza[iz][iy][ix] - (ch / cyph[iy]) * clf[iz][iy];\nHz[iz][_PB_CYM][ix] = (cxmh[ix] / cxph[ix]) * Hz[iz][_PB_CYM][ix]\n+ (mui * czp[iz] / cxph[ix]) * tmp[iz][iy]\n- (mui * czm[iz] / cxph[ix]) * Bza[iz][_PB_CYM][ix];\nBza[iz][_PB_CYM][ix] = tmp[iz][iy];\n}\nclf[iz][iy] = Ex[iz][_PB_CYM][_PB_CXM] - Ax[iz][_PB_CXM] + Ry[iz][_PB_CYM] - Ey[iz][_PB_CYM][_PB_CXM];\ntmp[iz][iy] = (cymh[_PB_CYM] / cyph[_PB_CYM]) * Bza[iz][_PB_CYM][_PB_CXM] - (ch / cyph[_PB_CYM]) * clf[iz][iy];\nHz[iz][_PB_CYM][_PB_CXM] = (cxmh[_PB_CXM] / cxph[_PB_CXM]) * Hz[iz][_PB_CYM][_PB_CXM]\n+ (mui * czp[iz] / cxph[_PB_CXM]) * tmp[iz][iy]\n- (mui * czm[iz] / cxph[_PB_CXM]) * Bza[iz][_PB_CYM][_PB_CXM];\nBza[iz][_PB_CYM][_PB_CXM] = tmp[iz][iy];\n}\n}\n#pragma endscop\n\n}
fortran: subroutine kernel_fdtd_apml(cz, cxm, cym, mui, ch, &\nax, ry, clf, tmp, bza, ex, ey, &\nhz, czm, czp, cxmh, cxph, cymh, cyph)\nimplicit none\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) :: clf\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, dimension(cxm + 1, cym + 1) :: tmp\nDATA_TYPE, dimension(cxm + 1, cym + 1, cz + 1) :: bza\nDATA_TYPE :: mui, ch\ninteger :: ix, iy, iz\n\n!$pragma scop\ndo iz = 1, _PB_CZ\ndo iy = 1, _PB_CYM\ndo ix = 1, _PB_CXM\nclf(iy, iz) = ex(ix, iy, iz) - ex(ix, iy + 1, iz) + &\ney(ix + 1, iy, iz) - ey(ix, iy, iz)\ntmp(iy, iz) = ((cymh(iy) / cyph(iy)) * bza(ix, iy, iz)) - &\n((ch / cyph(iy)) * clf(iy, iz))\nhz(ix, iy, iz) = ((cxmh(ix) / cxph(ix)) * hz(ix, iy, iz)) &\n+ ((mui * czp(iz) / cxph(ix)) * tmp(iy, iz)) &\n- ((mui * czm(iz) / cxph(ix)) * &\nbza(ix, iy, iz))\nbza(ix, iy, iz) = tmp(iy, iz)\nend do\nclf(iy, iz) = ex(_PB_CXM + 1, iy, iz) - &\nex(_PB_CXM + 1, iy + 1, iz) + &\nry(iy, iz) - ey(_PB_CXM + 1, iy, iz)\ntmp(iy, iz) = ((cymh(iy) / cyph(iy)) * &\nbza(_PB_CXM + 1, iy, iz)) - ((ch / cyph(iy))  &\n* clf(iy, iz))\nhz(_PB_CXM + 1, iy, iz) = ((cxmh(_PB_CXM + 1) / &\ncxph(_PB_CXM + 1)) * &\nhz(_PB_CXM + 1, iy, iz)) + &\n((mui * czp(iz) / &\ncxph(_PB_CXM + 1)) * &\ntmp(iy, iz)) - &\n((mui * czm(iz) / &\ncxph(_PB_CXM + 1)) * &\nbza(_PB_CXM + 1, iy, iz))\nbza(_PB_CXM + 1, iy, iz) = tmp(iy, iz)\n\ndo ix = 1, _PB_CXM\nclf(iy, iz) = ex(ix, _PB_CYM + 1, iz) - ax(ix, iz) + &\ney(ix + 1, _PB_CYM + 1, iz) - &\ney(ix, _PB_CYM + 1, iz)\ntmp(iy, iz) = ((cymh(_PB_CYM + 1) / cyph(iy)) * &\nbza(ix, iy, iz)) - ((ch / cyph(iy)) * &\nclf(iy, iz))\nhz(ix, _PB_CYM + 1, iz) = ((cxmh(ix) / cxph(ix)) * &\nhz(ix, _PB_CYM + 1, iz)) + &\n((mui * czp(iz) / cxph(ix)) * &\ntmp(iy, iz)) - &\n((mui * czm(iz) / cxph(ix)) * &\nbza(ix, _PB_CYM + 1, iz))\nbza(ix, _PB_CYM + 1, iz) = tmp(iy, iz)\nend do\nclf(iy, iz) = ex(_PB_CXM + 1, _PB_CYM + 1, iz) - &\nax(_PB_CXM + 1, iz) + ry(_PB_CYM + 1, iz) - &\ney(_PB_CXM + 1, _PB_CYM + 1, iz)\ntmp(iy, iz) = ((cymh(_PB_CYM + 1) / cyph(_PB_CYM + 1)) * &\nbza(_PB_CXM + 1, _PB_CYM + 1, iz)) - &\n((ch / cyph(_PB_CYM + 1)) * clf(iy, iz))\nhz(_PB_CXM + 1, _PB_CYM + 1, iz) = &\n((cxmh(_PB_CXM + 1) / cxph(_PB_CXM + 1)) * &\nhz(_PB_CXM + 1, _PB_CYM + 1, iz)) + &\n((mui * czp(iz) / cxph(_PB_CXM + 1)) * tmp(iy, iz)) - &\n((mui * czm(iz) / cxph(_PB_CXM + 1)) * &\nbza(_PB_CXM + 1, _PB_CYM + 1, iz))\nbza(_PB_CXM + 1, _PB_CYM + 1, iz) = tmp(iy, iz)\nend do\nend do\n\n!$pragma endscop\nend subroutine