diff options
Diffstat (limited to 'src/rotatingsymmetry180.c')
-rw-r--r-- | src/rotatingsymmetry180.c | 79 |
1 files changed, 66 insertions, 13 deletions
diff --git a/src/rotatingsymmetry180.c b/src/rotatingsymmetry180.c index 62b859d..ccafa3c 100644 --- a/src/rotatingsymmetry180.c +++ b/src/rotatingsymmetry180.c @@ -1,5 +1,3 @@ -/* $Header$ */ - #include <assert.h> #include <math.h> #include <stdlib.h> @@ -45,7 +43,6 @@ int BndRot180VI (cGH const * restrict const cctkGH, int offset[3]; /* offset 0..1 due to avoid_origin */ struct xferinfo * restrict xferinfo; - int options; int var; @@ -54,6 +51,7 @@ int BndRot180VI (cGH const * restrict const cctkGH, int otherdir; /* the other direction of the rotation */ int q; int d; + int icnt; int ierr; /* Check arguments */ @@ -451,16 +449,71 @@ int BndRot180VI (cGH const * restrict const cctkGH, xferinfo[ dir].flip = 1; xferinfo[otherdir].flip = 1; - options = Util_TableCreateFromString ("useghosts=1"); - assert (options>=0); - - ierr = Slab_MultiTransfer - (cctkGH, group.dim, xferinfo, options, - nvars, vartypes, varptrs, vartypes, varptrs); - assert (!ierr); - - ierr = Util_TableDestroy (options); - assert (!ierr); + if (CCTK_EQUALS (hyperslabber, "TAT/Slab")) { + + if (CCTK_IsFunctionAliased("GetLocalComponents")) { + int const num_local_components = GetLocalComponents(cctkGH); + if (num_local_components > 1) { + CCTK_WARN (CCTK_WARN_ABORT, + "TAT/Slab can only be used if there is a single local component per MPI process"); + } + } + + int options; + options = Util_TableCreateFromString ("useghosts=1"); + assert (options>=0); + + ierr = Slab_MultiTransfer + (cctkGH, group.dim, xferinfo, options, + nvars, vartypes, varptrs, vartypes, varptrs); + assert (!ierr); + + ierr = Util_TableDestroy (options); + assert (!ierr); + + } else if (CCTK_EQUALS (hyperslabber, "GetHyperslab")) { + + CCTK_INT const direction[3*3] = {1, 0, 0, 0, 1, 0, 0, 0, 1}; + CCTK_INT const origin[3] = + {xferinfo[0].src.off, xferinfo[1].src.off, xferinfo[2].src.off}; + CCTK_INT const extent[3] = + {xferinfo[0].src.len, xferinfo[1].src.len, xferinfo[2].src.len}; + CCTK_INT const downsample[3] = + {xferinfo[0].src.str, xferinfo[1].src.str, xferinfo[2].src.str}; + int mapping; + CCTK_INT hsize[3], total_hsize; + CCTK_POINTER hdata[nvars]; + + assert (nvars > 0); + mapping = Hyperslab_GlobalMappingByIndex + (cctkGH, vis[0], 3, direction, origin, extent, downsample, + -1, NULL, &hsize); + assert (mapping>=0); + + total_hsize = hsize[0] * hsize[1] * hsize[2]; + assert (total_hsize >= 0); + for (var=0; var<nvars; ++var) { + hdata[var] = malloc(total_hsize * CCTK_VarTypeSize(CCTK_VarTypeI(var))); + assert (total_hsize==0 || hdata[var]); + } + + icnt = Hyperslab_GetList + (cctkGH, mapping, nvars, NULL, vis, NULL, NULL, hdata, NULL); + assert (icnt == nvars); + + // copy hyperslabs into grid functions + assert (0); + + for (var=0; var<nvars; ++var) { + free (hdata[var]); + } + + ierr = Hyperslab_FreeMapping (mapping); + assert (!ierr); + + } else { + CCTK_WARN (CCTK_WARN_ABORT, "internal error"); + } if (poison_boundaries) { /* check destination grid points for poison */ |