AEVGZIZEUIC52MCK3J4V547YEV2R4YQL3JUJW7FSP4R34PSZ43DAC
const Box &fbx = mfi.fabbox(); // allocated array
const Box &vbx = mfi.validbox(); // interior region (without ghosts)
const Box &bx = mfi.tilebox(); // current region (without ghosts)
const Box &fbx = mfi.fabbox(); // allocated array
// const Box &vbx = mfi.validbox(); // interior region (without ghosts)
const Box &bx = mfi.tilebox(); // current region (without ghosts)
const Box &gbx = mfi.growntilebox(); // current region (with ghosts)
cctkGH->cctk_bbox[2 * d + f] = bx[orient(d, f)] == vbx[orient(d, f)];
cctkGH->cctk_bbox[2 * d + f] = bx[orient(d, f)] != gbx[orient(d, f)];
// Grid function pointers
const Dim3 imin = lbound(bx);
const Array4<CCTK_REAL> &vars = ghext->mfab.array(mfi);
for (int vi = 0; vi < 4; ++vi)
cctkGH->data[vi][0] = vars.ptr(imin.x, imin.y, imin.z, vi);
for (int d = 0; d < dim; ++d)
cctkGH->cctk_lbnd[d] = undefined;
for (int d = 0; d < dim; ++d)
cctkGH->cctk_ubnd[d] = undefined;
for (int d = 0; d < dim; ++d)
for (int f = 0; f < 2; ++f)
cctkGH->cctk_bbox[2 * d + f] = undefined;
int nvars = CCTK_NumVars();
for (int vi = 0; vi < nvars; ++vi)
cctkGH->data[vi][0] = nullptr;
// CCTK_VINFO("gsh=[%d,%d,%d]", cctkGH->cctk_gsh[0], cctkGH->cctk_gsh[1],
// cctkGH->cctk_gsh[2]);
// CCTK_VINFO("ash=[%d,%d,%d]", cctkGH->cctk_ash[0], cctkGH->cctk_ash[1],
// cctkGH->cctk_ash[2]);
// CCTK_VINFO("lbnd=[%d,%d,%d]", cctkGH->cctk_lbnd[0], cctkGH->cctk_lbnd[1],
// cctkGH->cctk_lbnd[2]);
// CCTK_VINFO("lsh=[%d,%d,%d]", cctkGH->cctk_lsh[0], cctkGH->cctk_lsh[1],
// cctkGH->cctk_lsh[2]);
// CCTK_VINFO("nghostzones=[%d,%d,%d]", cctkGH->cctk_nghostzones[0],
// cctkGH->cctk_nghostzones[1], cctkGH->cctk_nghostzones[2]);
CCTK_VINFO("x0=[%g,%g,%g]", cctkGH->cctk_origin_space[0],
cctkGH->cctk_origin_space[1], cctkGH->cctk_origin_space[2]);
CCTK_VINFO("dx=[%g,%g,%g]", cctkGH->cctk_delta_space[0],
cctkGH->cctk_delta_space[1], cctkGH->cctk_delta_space[2]);
CCTK_REAL mindx = 1.0 / 0.0;
for (int d = 0; d < dim; ++d)
mindx = fmin(mindx, cctkGH->cctk_delta_space[d]);
const CCTK_REAL *restrict const x0 = ghext->geom.ProbLo();
const CCTK_REAL *restrict const x1 = ghext->geom.ProbHi();
// Initialize phi
const MFIter &mfi = *mfis.at(omp_get_thread_num());
const Box &fbx = mfi.fabbox();
const Box &bx = mfi.growntilebox();
const Dim3 amin = lbound(fbx);
const Dim3 amax = ubound(fbx);
const Dim3 imin = lbound(bx);
const Dim3 imax = ubound(bx);
constexpr int di = 1;
const int dj = di * (amax.x - amin.x + 1);
const int dk = dj * (amax.y - amin.y + 1);
const CCTK_REAL *restrict const x0 = cctk_origin_space;
const CCTK_REAL *restrict const dx = cctk_delta_space;
const Array4<CCTK_REAL> &vars = ghext->mfab.array(mfi);
CCTK_REAL *restrict const phi = vars.ptr(0, 0, 0, 0);
CCTK_REAL *restrict const phi_p = vars.ptr(0, 0, 0, 1);
for (int k = imin.z; k <= imax.z; ++k)
for (int j = imin.y; j <= imax.y; ++j)
for (int k = 0; k < cctk_lsh[2]; ++k)
for (int j = 0; j < cctk_lsh[1]; ++j)
for (int i = imin.x; i <= imax.x; ++i) {
const int idx = i * di + j * dj + k * dk;
CCTK_REAL x = linterp(x0[0], x1[0], -1, 2 * ghext->ncells - 1, 2 * i);
CCTK_REAL y = linterp(x0[1], x1[1], -1, 2 * ghext->ncells - 1, 2 * j);
CCTK_REAL z = linterp(x0[2], x1[2], -1, 2 * ghext->ncells - 1, 2 * k);
phi[idx] = standing(t0, x, y, z);
phi_p[idx] = standing(t0 - dt, x, y, z);
for (int i = 0; i < cctk_lsh[0]; ++i) {
const int idx = CCTK_GFINDEX3D(cctkGH, i, j, k);
CCTK_REAL x = x0[0] + (cctk_lbnd[0] + i) * dx[0];
CCTK_REAL y = x0[1] + (cctk_lbnd[1] + j) * dx[1];
CCTK_REAL z = x0[2] + (cctk_lbnd[2] + k) * dx[2];
phi[idx] = standing(t, x, y, z);
phi_p[idx] = standing(t - dt, x, y, z);
// Evolve phi
const MFIter &mfi = *mfis.at(omp_get_thread_num());
const Box &fbx = mfi.fabbox();
const Box &bx = mfi.tilebox();
const Dim3 amin = lbound(fbx);
const Dim3 amax = ubound(fbx);
const Dim3 imin = lbound(bx);
const Dim3 imax = ubound(bx);
const int dj = di * (amax.x - amin.x + 1);
const int dk = dj * (amax.y - amin.y + 1);
const Array4<CCTK_REAL> &vars = ghext->mfab.array(mfi);
CCTK_REAL *restrict const phi = vars.ptr(0, 0, 0, 0);
const CCTK_REAL *restrict const phi_p = vars.ptr(0, 0, 0, 1);
const CCTK_REAL *restrict const phi_p_p = vars.ptr(0, 0, 0, 2);
const int dj = di * cctk_ash[0];
const int dk = dj * cctk_ash[1];
const CCTK_REAL t0 = cctk_time;
const CCTK_REAL *restrict const x0 = ghext->geom.ProbLo();
const CCTK_REAL *restrict const x1 = ghext->geom.ProbHi();
const CCTK_REAL t = cctk_time;
const CCTK_REAL *restrict const x0 = cctk_origin_space;
const CCTK_REAL *restrict const dx = cctk_delta_space;
const MFIter &mfi = *mfis.at(omp_get_thread_num());
const Box &fbx = mfi.fabbox();
const Box &bx = mfi.growntilebox();
const Dim3 amin = lbound(fbx);
const Dim3 amax = ubound(fbx);
const Dim3 imin = lbound(bx);
const Dim3 imax = ubound(bx);
constexpr int di = 1;
const int dj = di * (amax.x - amin.x + 1);
const int dk = dj * (amax.y - amin.y + 1);
const Array4<CCTK_REAL> &vars = ghext->mfab.array(mfi);
CCTK_REAL *restrict const err = vars.ptr(0, 0, 0, 3);
const CCTK_REAL *restrict const phi = vars.ptr(0, 0, 0, 0);
for (int k = imin.z; k <= imax.z; ++k)
for (int j = imin.y; j <= imax.y; ++j)
for (int k = 0; k < cctk_lsh[2]; ++k)
for (int j = 0; j < cctk_lsh[1]; ++j)
for (int i = imin.x; i <= imax.x; ++i) {
const int idx = i * di + j * dj + k * dk;
CCTK_REAL x = linterp(x0[0], x1[0], -1, 2 * ghext->ncells - 1, 2 * i);
CCTK_REAL y = linterp(x0[1], x1[1], -1, 2 * ghext->ncells - 1, 2 * j);
CCTK_REAL z = linterp(x0[2], x1[2], -1, 2 * ghext->ncells - 1, 2 * k);
err[idx] = phi[idx] - standing(t0, x, y, z);
for (int i = 0; i < cctk_lsh[0]; ++i) {
const int idx = CCTK_GFINDEX3D(cctkGH, i, j, k);
CCTK_REAL x = x0[0] + (cctk_lbnd[0] + i) * dx[0];
CCTK_REAL y = x0[1] + (cctk_lbnd[1] + j) * dx[1];
CCTK_REAL z = x0[2] + (cctk_lbnd[2] + k) * dx[2];
err[idx] = phi[idx] - standing(t, x, y, z);