diff options
author | lanfer <lanfer@eec4d7dc-71c2-46d6-addf-10296150bf52> | 2002-04-30 12:51:41 +0000 |
---|---|---|
committer | lanfer <lanfer@eec4d7dc-71c2-46d6-addf-10296150bf52> | 2002-04-30 12:51:41 +0000 |
commit | 59e0b5145d5b8cd2ed9b731bb5770bd52581d976 (patch) | |
tree | 757a4baee16520e98999a608c5c566cecf08f29e | |
parent | d1728da8a8fd497db2e6da2170b001bfa551622d (diff) |
storing the coordinate index in a static variable once, to avoid looking it up every time (CoordIndex contains CCTK_Equals).
git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/Cartoon2D/trunk@30 eec4d7dc-71c2-46d6-addf-10296150bf52
-rw-r--r-- | src/Cartoon2DBC.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/Cartoon2DBC.c b/src/Cartoon2DBC.c index ae5a673..9fcbfc4 100644 --- a/src/Cartoon2DBC.c +++ b/src/Cartoon2DBC.c @@ -60,6 +60,8 @@ CCTK_INT BndCartoon2DVI(cGH *GH, CCTK_INT tensortype, CCTK_INT vi) { DECLARE_CCTK_PARAMETERS + static int xindx=-1; + CCTK_INT i, j, k, di, dj, ijk; CCTK_INT jj, n, s; CCTK_INT lnx, lny, lnz, ny; @@ -93,7 +95,11 @@ CCTK_INT BndCartoon2DVI(cGH *GH, CCTK_INT tensortype, CCTK_INT vi) lny = GH->cctk_lsh[1]; lnz = GH->cctk_lsh[2]; ny = GH->cctk_gsh[1]; - xp = GH->data[CCTK_CoordIndex(-1,"x","cart3d")][0]; + + xindx = (xindx<0)?CCTK_CoordIndex(-1,"x","cart3d"):xindx; + xp = GH->data[xindx][0]; + +/* xp = GH->data[CCTK_CoordIndex(-1,"x","cart3d")][0];*/ lx0 = xp[0]; dx0 = GH->cctk_delta_space[0]/GH->cctk_levfac[0]; dy0 = GH->cctk_delta_space[1]/GH->cctk_levfac[1]; @@ -279,6 +285,8 @@ CCTK_REAL Cartoon2DInterp(cGH *GH, CCTK_REAL *f, CCTK_INT i, CCTK_INT di, { DECLARE_CCTK_PARAMETERS + static int xindx=-1; + CCTK_REAL x0; CCTK_REAL lx0, dx0; CCTK_REAL y[6], r; @@ -287,7 +295,12 @@ CCTK_REAL Cartoon2DInterp(cGH *GH, CCTK_REAL *f, CCTK_INT i, CCTK_INT di, CCTK_INT n, offset; lnx = GH->cctk_lsh[0]; - xp = GH->data[CCTK_CoordIndex(-1,"x","cart3d")][0]; + + xindx = (xindx<0)?CCTK_CoordIndex(-1,"x","cart3d"):xindx; + xp = GH->data[xindx][0]; + + +/* xp = GH->data[CCTK_CoordIndex(-1,"x","cart3d")][0];*/ lx0 = xp[0]; dx0 = GH->cctk_delta_space[0]/GH->cctk_levfac[0]; |