diff options
-rw-r--r-- | src/rotatingsymmetry180.c | 23 | ||||
-rw-r--r-- | src/rotatingsymmetry180.h | 32 |
2 files changed, 47 insertions, 8 deletions
diff --git a/src/rotatingsymmetry180.c b/src/rotatingsymmetry180.c index 216dc78..c26c576 100644 --- a/src/rotatingsymmetry180.c +++ b/src/rotatingsymmetry180.c @@ -14,6 +14,8 @@ #include "Slab.h" +#include "rotatingsymmetry180.h" + int BndRot180VI (cGH const * restrict const cctkGH, @@ -288,17 +290,22 @@ int BndRot180VI (cGH const * restrict const cctkGH, parity = parities[0] * parities[1]; assert (abs(parity) == 1); if (parity == -1) { + int imin[3], imax[3]; int i, j, k; + for (d=0; d<3; ++d) { + imin[d] = xferinfo[d].dst.off; + imax[d] = xferinfo[d].dst.off + xferinfo[d].dst.len; + imin[d] -= cctk_lbnd[d]; + imax[d] -= cctk_lbnd[d]; + if (imin[d] < 0) imin[d] = 0; + if (imax[d] >= cctk_lsh[d]) imax[d] = cctk_lsh[d]; + } assert (group.dim == 3); assert (group.vartype == CCTK_VARIABLE_REAL); - for (k=0; k<xferinfo[2].dst.len; ++k) { - for (j=0; j<xferinfo[1].dst.len; ++j) { - for (i=0; i<xferinfo[0].dst.len; ++i) { - const int ind - = CCTK_GFINDEX3D(cctkGH, - xferinfo[0].dst.off + i - cctk_lbnd[0], - xferinfo[1].dst.off + j - cctk_lbnd[1], - xferinfo[2].dst.off + k - cctk_lbnd[2]); + for (k=imin[0]; k<imax[2]; ++k) { + for (j=imin[1]; j<imax[1]; ++j) { + for (i=imin[2]; i<imax[0]; ++i) { + const int ind = CCTK_GFINDEX3D(cctkGH, i, j, k); ((CCTK_REAL *) varptr) [ind] *= -1; } } diff --git a/src/rotatingsymmetry180.h b/src/rotatingsymmetry180.h new file mode 100644 index 0000000..d795e8c --- /dev/null +++ b/src/rotatingsymmetry180.h @@ -0,0 +1,32 @@ +/* $Header$ */ + +#ifndef ROTATINGSYMMETRY180_H +#define ROTATINGSYMMETRY180_H + +#include "cctk.h" +#include "cctk_Arguments.h" + +void Rot180_RegisterSymmetry (CCTK_ARGUMENTS); + +int BndRot180VI (cGH const * restrict const cctkGH, + int const * restrict const stencil, + int const vi); +void Rot180_ApplyBC (CCTK_ARGUMENTS); + +CCTK_INT +Rot180_SymmetryInterpolate (CCTK_POINTER_TO_CONST const cctkGH_, + CCTK_INT const N_dims, + CCTK_INT const local_interp_handle, + CCTK_INT const param_table_handle, + CCTK_INT const coord_system_handle, + CCTK_INT const N_interp_points, + CCTK_INT const interp_coords_type, + CCTK_POINTER_TO_CONST const interp_coords[], + CCTK_INT const N_input_arrays, + CCTK_INT const input_array_indices[], + CCTK_INT const N_output_arrays, + CCTK_INT const output_array_types[], + CCTK_POINTER const output_arrays[], + CCTK_INT const faces[]); + +#endif /* ! defined ROTATINGSYMMETRY180_H */ |