From 79ab42a17b17e72fdb0adc0113a569cd2a48e862 Mon Sep 17 00:00:00 2001 From: schnetter Date: Wed, 16 Jan 2008 15:05:14 +0000 Subject: Loop over the grid points in a different order. This may or may not solve a problem. The code is surely less clever and more readable. git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/Cartoon2D/trunk@102 eec4d7dc-71c2-46d6-addf-10296150bf52 --- src/Cartoon2DBC.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Cartoon2DBC.c b/src/Cartoon2DBC.c index 7653424..027e9f7 100644 --- a/src/Cartoon2DBC.c +++ b/src/Cartoon2DBC.c @@ -160,6 +160,7 @@ int BndCartoon2DVI(const cGH *cctkGH, int tensortype, int prolongtype, int vi) dj = lnx; /* y = 0 */ + assert (ny % 2 == 1); j = ny/2; /* make sure that the input data is synced */ @@ -169,10 +170,19 @@ int BndCartoon2DVI(const cGH *cctkGH, int tensortype, int prolongtype, int vi) for (k = 0; k < lnz; k++) /* y-direction: as many zombies as the evolution stencil needs */ +#if 0 for (jj = 1, dj = jj*lnx; jj <= ny/2; jj++, dj = jj*lnx) +#else + for (jj = 0, dj = jj*lnx; jj <= ny/2; jj++, dj = jj*lnx) +#endif /* x-direction: zombie for x < 0, including upper boundary for extrapol */ +#if 0 for (i = -s; i < lnx; i++) { +#else + for (i = 0; i < lnx; i++) + if (! (i > s && jj == 0)) { +#endif /* index into linear memory */ ijk = CCTK_GFINDEX3D(cctkGH,i,j,k); @@ -182,7 +192,11 @@ int BndCartoon2DVI(const cGH *cctkGH, int tensortype, int prolongtype, int vi) /* compute coordinates (could also use Cactus grid function) */ x = lx0 + dx0 * i; +#if 0 y = (dj) ? dy0 * jj : 0; +#else + y = dy0 * jj; +#endif rho = sqrt(x*x + y*y); /* compute rotation matrix @@ -280,8 +294,10 @@ int BndCartoon2DVI(const cGH *cctkGH, int tensortype, int prolongtype, int vi) return(-1); } +#if 0 /* what a neat way to hack out the zombies for x < 0, y = 0 */ if (dj == 0) {i -= s; ijk -= s; dj = jj*lnx;} +#endif } /* syncs needed after interpolation (actually only for x direction) */ -- cgit v1.2.3