#include #include #include #include #include #include #include #include "bits.h" void CoordBase_SetupMask (CCTK_ARGUMENTS) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; CCTK_INT nboundaryzones[2*cctk_dim]; CCTK_INT is_internal[2*cctk_dim]; CCTK_INT is_staggered[2*cctk_dim]; CCTK_INT shiftout[2*cctk_dim]; CCTK_INT is_periodic[2*cctk_dim]; int bnd_points[2*cctk_dim]; /* points outside the domain */ int int_points[cctk_dim]; /* global interior points */ int gmin[cctk_dim], gmax[cctk_dim]; /* global domain extent */ int imin[cctk_dim], imax[cctk_dim]; /* domain extent */ int bmin[cctk_dim], bmax[cctk_dim]; /* boundary extent */ int ierr; int const reflevel = GetRefinementLevel(cctkGH); if (CCTK_IsFunctionAliased ("MultiPatch_GetBoundarySpecification")) { int const m = MultiPatch_GetMap (cctkGH); assert (m >= 0); ierr = MultiPatch_GetBoundarySpecification (m, 2*cctk_dim, nboundaryzones, is_internal, is_staggered, shiftout); } else { ierr = GetBoundarySpecification (2*cctk_dim, nboundaryzones, is_internal, is_staggered, shiftout); } if (ierr != 0) { CCTK_WARN (CCTK_WARN_ABORT, "Could not get boundary specification"); } for (int d=0; d cctk_lsh[d]) { CCTK_WARN (CCTK_WARN_ABORT, "Illegal number of boundary points"); } /* Calculate the extent of the local part of the domain */ for (int dd=0; dd= 1); /* Check whether the domain is empty */ if (int_points[d] == 1) { /* The domain is empty. The correct thing to do would be to set the weights to 0. But this is boring, because then there are no interior points left, and all reductions become trivial. Instead, leave the non-staggered boundary points alone, and assume that the user wants to perform a reduction in one fewer dimensions. */ /* do nothing */ } else { /* Adapt the extent of the boundary */ if (f==0) { /* lower face */ bmin[d] = bmax[d]; bmax[d] = bmin[d] + 1; } else { /* upper face */ bmax[d] = bmin[d]; bmin[d] = bmax[d] - 1; } /* Loop over the points next to boundary */ unsigned const bits = BMSK(cctk_dim); unsigned bmask = 0; for (unsigned b=0; b