#include #include #include #include #include static void TestLoopControlPointwise_All(CCTK_ARGUMENTS); static void TestLoopControlPointwise_Int(CCTK_ARGUMENTS); static void TestLoopControlPointwise_Bnd(CCTK_ARGUMENTS); static void TestLoopControlPointwise_IntBnd(CCTK_ARGUMENTS); void TestLoopControlPointwise_All(CCTK_ARGUMENTS) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; for (int k=0; k 0) { CCTK_WARN(CCTK_WARN_ABORT, "TestLoopControlPointwise_All failed"); } } void TestLoopControlPointwise_Int(CCTK_ARGUMENTS) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; CCTK_INT bndsize [6]; CCTK_INT is_ghostbnd[6]; CCTK_INT is_symbnd [6]; CCTK_INT is_physbnd [6]; GetBoundarySizesAndTypes (cctkGH, 6, bndsize, is_ghostbnd, is_symbnd, is_physbnd); int imin[3], imax[3]; for (int d=0; d<3; ++d) { imin[d] = bndsize[2*d]; imax[d] = cctk_lsh[d] - bndsize[2*d+1]; } for (int k=0; k 0) { CCTK_WARN(CCTK_WARN_ABORT, "TestLoopControlPointwise_Int failed"); } } void TestLoopControlPointwise_Bnd(CCTK_ARGUMENTS) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; CCTK_INT bndsize [6]; CCTK_INT is_ghostbnd[6]; CCTK_INT is_symbnd [6]; CCTK_INT is_physbnd [6]; GetBoundarySizesAndTypes (cctkGH, 6, bndsize, is_ghostbnd, is_symbnd, is_physbnd); for (int k=0; k 0) { CCTK_WARN(CCTK_WARN_ABORT, "TestLoopControlPointwise_Bnd failed"); } } void TestLoopControlPointwise_IntBnd(CCTK_ARGUMENTS) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; CCTK_INT bndsize [6]; CCTK_INT is_ghostbnd[6]; CCTK_INT is_symbnd [6]; CCTK_INT is_physbnd [6]; GetBoundarySizesAndTypes (cctkGH, 6, bndsize, is_ghostbnd, is_symbnd, is_physbnd); for (int k=0; k 0) { is_any_physbnd |= is_physbnd [2*d+1]; is_any_ghostbnd |= is_ghostbnd[2*d+1]; is_any_symbnd |= is_symbnd [2*d+1]; } } /* Iterate over this region if it is a physical boundary, and if it is neither a ghost nor a symmetry boundary */ if (is_any_physbnd && !is_any_ghostbnd && !is_any_symbnd) { int imin[3], imax[3]; for (int d=0; d<3; ++d) { if (idir[d] < 0) { imin[d] = 0; imax[d] = bndsize[2*d]; } else if (idir[d] == 0) { imin[d] = bndsize[2*d]; imax[d] = cctk_lsh[d] - bndsize[2*d+1]; } else if (idir[d] > 0) { imin[d] = cctk_lsh[d] - bndsize[2*d+1]; imax[d] = cctk_lsh[d]; } } for (int k=imin[2]; k 0) { CCTK_WARN(CCTK_WARN_ABORT, "TestLoopControlPointwise_IntBnd failed"); } } void TestLoopControlPointwise(CCTK_ARGUMENTS) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; if (cctk_dim != 3) { CCTK_WARN(CCTK_WARN_ABORT, "cctk_dim out of range"); } TestLoopControlPointwise_All(CCTK_PASS_CTOC); TestLoopControlPointwise_Int(CCTK_PASS_CTOC); TestLoopControlPointwise_Bnd(CCTK_PASS_CTOC); TestLoopControlPointwise_IntBnd(CCTK_PASS_CTOC); }