diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2008-08-04 12:07:25 -0500 |
---|---|---|
committer | Ian Hinder <ian.hinder@aei.mpg.de> | 2009-04-27 21:48:44 +0200 |
commit | f29fad1ac38b99c37416dd96fd8e1449d1c0b77f (patch) | |
tree | 8abf314498adc969d84a31b1dd0f91827838a472 /Auxiliary/Cactus/KrancNumericalTools/GenericFD | |
parent | 4c2116d9271c337418ed7ae15f535e73de6bb234 (diff) |
Use cctk_lssh instead of cctk_lsh when calculating grid function extents. This will allow future optimisations with cache-aligned memory allocations.
Correct an error in declaring local variables for partial derivatives.
Don't register constrained variables, which is in general not necessary
but which can use much memory.
Register symmetries in the schedule group SymmetryRegister instad of at
basegrid.
Diffstat (limited to 'Auxiliary/Cactus/KrancNumericalTools/GenericFD')
-rw-r--r-- | Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.c | 25 | ||||
-rw-r--r-- | Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.h | 7 |
2 files changed, 21 insertions, 11 deletions
diff --git a/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.c b/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.c index 3477909..3958dce 100644 --- a/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.c +++ b/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.c @@ -71,6 +71,7 @@ CCTK_INT sgn(CCTK_REAL x) */ void GenericFD_GetBoundaryInfo(cGH const * restrict const cctkGH, CCTK_INT const * restrict const cctk_lsh, + CCTK_INT const * restrict const cctk_lssh, CCTK_INT const * restrict const cctk_bbox, CCTK_INT const * restrict const cctk_nghostzones, CCTK_INT * restrict const imin, @@ -169,7 +170,7 @@ void GenericFD_GetBoundaryInfo(cGH const * restrict const cctkGH, imin[dir] = npoints; break; case 1: /* Upper boundary */ - imax[dir] = cctk_lsh[dir] - npoints; + imax[dir] = cctk_lssh[CCTK_LSSH_IDX(0, dir)] - npoints; break; default: CCTK_WARN(0, "internal error"); @@ -189,7 +190,9 @@ void GenericFD_LoopOverEverything(cGH *cctkGH, Kranc_Calculation calc) CCTK_REAL tangentA[] = {0,0,0}; CCTK_REAL tangentB[] = {0,0,0}; CCTK_INT bmin[] = {0,0,0}; - CCTK_INT bmax[] = {cctk_lsh[0], cctk_lsh[1], cctk_lsh[2]}; + CCTK_INT bmax[] = {cctk_lssh[CCTK_LSSH_IDX(0,0)], + cctk_lssh[CCTK_LSSH_IDX(0,1)], + cctk_lssh[CCTK_LSSH_IDX(0,2)]}; calc(cctkGH, dir, face, normal, tangentA, tangentB, bmin, bmax, 0, NULL); return; @@ -216,7 +219,8 @@ void GenericFD_LoopOverBoundary(cGH *cctkGH, Kranc_Calculation calc) int old_dir = 0; int old_face = 0; - GenericFD_GetBoundaryInfo(cctkGH, cctk_lsh, cctk_bbox, cctk_nghostzones, + GenericFD_GetBoundaryInfo(cctkGH, cctk_lsh, cctk_lssh, cctk_bbox, + cctk_nghostzones, imin, imax, is_symbnd, is_physbnd, is_ipbnd); /* Loop over all faces */ @@ -250,7 +254,7 @@ void GenericFD_LoopOverBoundary(cGH *cctkGH, Kranc_Calculation calc) break; case +1: bmin[d] = imax[d]; - bmax[d] = cctk_lsh[d]; + bmax[d] = cctk_lssh[CCTK_LSSH_IDX(0,d)]; have_bnd = 1; all_physbnd = all_physbnd && is_physbnd[2*d+1]; break; @@ -308,7 +312,8 @@ void GenericFD_LoopOverBoundaryWithGhosts(cGH *cctkGH, Kranc_Calculation calc) int old_dir = 0; int old_face = 0; - GenericFD_GetBoundaryInfo(cctkGH, cctk_lsh, cctk_bbox, cctk_nghostzones, + GenericFD_GetBoundaryInfo(cctkGH, cctk_lsh, cctk_lssh, cctk_bbox, + cctk_nghostzones, imin, imax, is_symbnd, is_physbnd, is_ipbnd); /* Loop over all faces */ @@ -342,7 +347,7 @@ void GenericFD_LoopOverBoundaryWithGhosts(cGH *cctkGH, Kranc_Calculation calc) break; case +1: bmin[d] = imax[d]; - bmax[d] = cctk_lsh[d]; + bmax[d] = cctk_lssh[CCTK_LSSH_IDX(0,d)]; have_bnd = 1; have_physbnd = have_physbnd || is_physbnd[2*d+1]; break; @@ -393,7 +398,8 @@ void GenericFD_LoopOverInterior(cGH *cctkGH, Kranc_Calculation calc) int dir = 0; int face = 0; - GenericFD_GetBoundaryInfo(cctkGH, cctk_lsh, cctk_bbox, cctk_nghostzones, + GenericFD_GetBoundaryInfo(cctkGH, cctk_lsh, cctk_lssh, cctk_bbox, + cctk_nghostzones, imin, imax, is_symbnd, is_physbnd, is_ipbnd); calc(cctkGH, dir, face, normal, tangentA, tangentB, imin, imax, 0, NULL); @@ -407,6 +413,7 @@ void GenericFD_PenaltyPrim2Char(cGH *cctkGH, CCTK_INT const dir, CCTK_REAL const * restrict const base, CCTK_INT const * restrict const lbnd, CCTK_INT const * restrict const lsh, + CCTK_INT const * restrict const lssh, CCTK_INT const rhs_flag, CCTK_INT const num_modes, CCTK_POINTER const * restrict const modes, @@ -419,7 +426,9 @@ void GenericFD_PenaltyPrim2Char(cGH *cctkGH, CCTK_INT const dir, CCTK_REAL tangentA[] = {0,0,0}; CCTK_REAL tangentB[] = {0,0,0}; CCTK_INT bmin[] = {0,0,0}; - CCTK_INT bmax[] = {cctk_lsh[0], cctk_lsh[1], cctk_lsh[2]}; + CCTK_INT bmax[] = {cctk_lssh[CCTK_LSSH_IDX(0,0)], + cctk_lssh[CCTK_LSSH_IDX(0,1)], + cctk_lssh[CCTK_LSSH_IDX(0,2)]}; CCTK_REAL **all_vars; int i = 0; diff --git a/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.h b/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.h index 8cab09d..d15b7ab 100644 --- a/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.h +++ b/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.h @@ -675,6 +675,7 @@ CCTK_INT sgn(CCTK_REAL x); void GenericFD_GetBoundaryInfo(cGH const * restrict cctkGH, CCTK_INT const * restrict cctk_lsh, + CCTK_INT const * restrict cctk_lssh, CCTK_INT const * restrict cctk_bbox, CCTK_INT const * restrict cctk_nghostzones, CCTK_INT * restrict imin, @@ -691,7 +692,7 @@ static inline CCTK_REAL sbp_deriv_x(int i, int j, int k, CCTK_REAL *var, CCTK_REAL *q, cGH *cctkGH) { CCTK_REAL dvarl = 0; - int ni = cctkGH->cctk_lsh[0]; + int ni = cctkGH->cctk_lssh[CCTK_LSSH_IDX(0,0)]; for (int ii=min[i]-1; ii<=max[i]-1; ++ii) { dvarl += q[ii+ni*i]*var[CCTK_GFINDEX3D (cctkGH, ii, j, k)]; } @@ -705,7 +706,7 @@ static inline CCTK_REAL sbp_deriv_y(int i, int j, int k, CCTK_REAL *var, CCTK_REAL *q, cGH *cctkGH) { CCTK_REAL dvarl = 0; - int nj = cctkGH->cctk_lsh[1]; + int nj = cctkGH->cctk_lssh[CCTK_LSSH_IDX(0,1)]; for (int jj=min[j]-1; jj<=max[j]-1; ++jj) { dvarl += q[jj+nj*j]*var[CCTK_GFINDEX3D (cctkGH, i, jj, k)]; } @@ -719,7 +720,7 @@ static inline CCTK_REAL sbp_deriv_z(int i, int j, int k, CCTK_REAL *var, CCTK_REAL *q, cGH *cctkGH) { CCTK_REAL dvarl = 0; - int nk = cctkGH->cctk_lsh[2]; + int nk = cctkGH->cctk_lssh[CCTK_LSSH_IDX(0,2)]; for (int kk=min[k]-1; kk<=max[k]-1; ++kk) { dvarl += q[kk+nk*k]*var[CCTK_GFINDEX3D (cctkGH, i, j, kk)]; } |