diff options
author | sai <sai@eec4d7dc-71c2-46d6-addf-10296150bf52> | 2000-09-20 19:58:18 +0000 |
---|---|---|
committer | sai <sai@eec4d7dc-71c2-46d6-addf-10296150bf52> | 2000-09-20 19:58:18 +0000 |
commit | ee032d6a08170ee11c32339382bc959d108da73b (patch) | |
tree | d7e528dbbdce2c531a60108cf95bf5823532d9dd /src | |
parent | 86b26685b6a92973091ee84eb87bdc318b373551 (diff) |
Changes for Cactus 4.0.b8.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/Cartoon2D/trunk@15 eec4d7dc-71c2-46d6-addf-10296150bf52
Diffstat (limited to 'src')
-rw-r--r-- | src/Cartoon2DBC.c | 69 | ||||
-rw-r--r-- | src/CheckParameters.c | 6 | ||||
-rw-r--r-- | src/interpolate.c | 4 |
3 files changed, 45 insertions, 34 deletions
diff --git a/src/Cartoon2DBC.c b/src/Cartoon2DBC.c index 8100ed1..95e82a4 100644 --- a/src/Cartoon2DBC.c +++ b/src/Cartoon2DBC.c @@ -10,8 +10,6 @@ @enddesc @@*/ -static char *rcsid = "$Id$"; - #include <stdio.h> #include <assert.h> #include <stdlib.h> @@ -26,15 +24,19 @@ static char *rcsid = "$Id$"; #include "cartoon2D_tensortypes.h" -CCTK_INT Cartoon2DBCVar(cGH *GH, CCTK_INT tensortype, const char *var); -CCTK_INT Cartoon2DBCVarI(cGH *GH, CCTK_INT tensortype, CCTK_INT vi); +static char *rcsid = "$Id$"; + +CCTK_FILEVERSION(Development_Cartoon2D_Cartoon2DBC_c) + +CCTK_INT BndCartoon2DVN(cGH *GH, CCTK_INT tensortype, const char *var); +CCTK_INT BndCartoon2DVI(cGH *GH, CCTK_INT tensortype, CCTK_INT vi); CCTK_REAL Cartoon2DInterp(cGH *GH, CCTK_REAL *f, CCTK_INT i, CCTK_INT di, CCTK_INT ijk, CCTK_REAL x); CCTK_REAL interpolate_local(CCTK_INT order, CCTK_REAL x0, CCTK_REAL dx, CCTK_REAL y[], CCTK_REAL x); -void CCTK_FCALL CCTK_FNAME(Cartoon2DBCVarI)(CCTK_INT *retval, cGH *GH, +void CCTK_FCALL CCTK_FNAME(BndCartoon2DVI)(CCTK_INT *retval, cGH *GH, CCTK_INT *tensortype, CCTK_INT *vi); -void CCTK_FCALL CCTK_FNAME(Cartoon2DBCVar)(CCTK_INT *retval, cGH *GH, +void CCTK_FCALL CCTK_FNAME(BndCartoon2DVN)(CCTK_INT *retval, cGH *GH, CCTK_INT *tensortype, ONE_FORTSTRING_ARG); @@ -53,15 +55,16 @@ void CCTK_FCALL CCTK_FNAME(Cartoon2DBCVar)(CCTK_INT *retval, cGH *GH, cos(phi) etc with messy signs */ -CCTK_INT Cartoon2DBCVarI(cGH *GH, CCTK_INT tensortype, CCTK_INT vi) +CCTK_INT BndCartoon2DVI(cGH *GH, CCTK_INT tensortype, CCTK_INT vi) { DECLARE_CCTK_PARAMETERS - CCTK_INT i, j, k, di, dj, dk, ijk; + CCTK_INT i, j, k, di, dj, ijk; CCTK_INT jj, n, s; CCTK_INT lnx, lny, lnz, ny; CCTK_INT n_tensortype; + CCTK_INT timelevel; CCTK_REAL *xp; CCTK_REAL x, y, rho; CCTK_REAL lx0, dx0, dy0; @@ -70,6 +73,7 @@ CCTK_INT Cartoon2DBCVarI(cGH *GH, CCTK_INT tensortype, CCTK_INT vi) CCTK_REAL f[6], fx, fy, fz, fxx, fxy, fxz, fyy, fyz, fzz; CCTK_REAL *t, *tx, *ty, *tz, *txx, *txy, *txz, *tyy, *tyz, *tzz; + switch (tensortype) { case TENSORTYPE_SCALAR: n_tensortype = N_TENSORTYPE_SCALAR; @@ -89,17 +93,18 @@ CCTK_INT Cartoon2DBCVarI(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("x")][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]; + timelevel = CCTK_NumTimeLevelsFromVarI(vi) - 1; + /* Cactus loop in C: grid points with y = 0 */ /* compare thorn_BAM_Elliptic */ /* strides used in stencils, should be provided by cactus */ di = 1; dj = lnx; - dk = lnx*lny; /* y = 0 */ j = ny/2; @@ -141,18 +146,18 @@ CCTK_INT Cartoon2DBCVarI(cGH *GH, CCTK_INT tensortype, CCTK_INT vi) /* interpolate grid functions */ for (n = 0; n < n_tensortype; n++) - f[n] = Cartoon2DInterp(GH, GH->data[vi+n][0], i, di, ijk, rho); + f[n] = Cartoon2DInterp(GH, GH->data[vi+n][timelevel], i, di, ijk, rho); /* rotate grid tensor by matrix multiplication */ if (tensortype == TENSORTYPE_SCALAR) { - t = GH->data[vi][0]; + t = GH->data[vi][timelevel]; t[ijk+dj] = f[0]; t[ijk-dj] = f[0]; } else if (tensortype == TENSORTYPE_U) { - tx = GH->data[vi][0]; - ty = GH->data[vi+1][0]; - tz = GH->data[vi+2][0]; + tx = GH->data[vi][timelevel]; + ty = GH->data[vi+1][timelevel]; + tz = GH->data[vi+2][timelevel]; fx = f[0]; fy = f[1]; fz = f[2]; @@ -166,12 +171,12 @@ CCTK_INT Cartoon2DBCVarI(cGH *GH, CCTK_INT tensortype, CCTK_INT vi) tz[ijk-dj] = fz; } else if (tensortype == TENSORTYPE_DDSYM) { - txx = GH->data[vi][0]; - txy = GH->data[vi+1][0]; - txz = GH->data[vi+2][0]; - tyy = GH->data[vi+3][0]; - tyz = GH->data[vi+4][0]; - tzz = GH->data[vi+5][0]; + txx = GH->data[vi][timelevel]; + txy = GH->data[vi+1][timelevel]; + txz = GH->data[vi+2][timelevel]; + tyy = GH->data[vi+3][timelevel]; + tyz = GH->data[vi+4][timelevel]; + tzz = GH->data[vi+5][timelevel]; fxx = f[0]; fxy = f[1]; fxz = f[2]; @@ -207,11 +212,11 @@ CCTK_INT Cartoon2DBCVarI(cGH *GH, CCTK_INT tensortype, CCTK_INT vi) return(0); } -void CCTK_FCALL CCTK_FNAME(Cartoon2DBCVarI)(CCTK_INT *retval, cGH *GH, CCTK_INT *tensortype, CCTK_INT *vi) { - *retval = Cartoon2DBCVarI(GH, *tensortype, *vi); +void CCTK_FCALL CCTK_FNAME(BndCartoon2DVI)(CCTK_INT *retval, cGH *GH, CCTK_INT *tensortype, CCTK_INT *vi) { + *retval = BndCartoon2DVI(GH, *tensortype, *vi); } -CCTK_INT Cartoon2DBCVar(cGH *GH, CCTK_INT tensortype, const char *impvarname) +CCTK_INT BndCartoon2DVN(cGH *GH, CCTK_INT tensortype, const char *impvarname) { DECLARE_CCTK_PARAMETERS @@ -220,16 +225,16 @@ CCTK_INT Cartoon2DBCVar(cGH *GH, CCTK_INT tensortype, const char *impvarname) if (verbose) printf("cartoon2D called for %s\n", impvarname); vi = CCTK_VarIndex(impvarname); - return(Cartoon2DBCVarI(GH, tensortype, vi)); + return(BndCartoon2DVI(GH, tensortype, vi)); } -void CCTK_FCALL CCTK_FNAME(Cartoon2DBCVar)(CCTK_INT *retval, cGH *GH, CCTK_INT *tensortype, ONE_FORTSTRING_ARG) { +void CCTK_FCALL CCTK_FNAME(BndCartoon2DVN)(CCTK_INT *retval, cGH *GH, CCTK_INT *tensortype, ONE_FORTSTRING_ARG) { ONE_FORTSTRING_CREATE(impvarname) - *retval = Cartoon2DBCVar(GH, *tensortype, impvarname); + *retval = BndCartoon2DVN(GH, *tensortype, impvarname); free(impvarname); } -CCTK_INT Cartoon2DBCGroup(cGH *GH, CCTK_INT tensortype, const char *group) +CCTK_INT BndCartoon2DGN(cGH *GH, CCTK_INT tensortype, const char *group) { DECLARE_CCTK_PARAMETERS @@ -260,11 +265,11 @@ CCTK_INT Cartoon2DBCGroup(cGH *GH, CCTK_INT tensortype, const char *group) free(msg); } - return(Cartoon2DBCVarI(GH, tensortype, CCTK_FirstVarIndex(group))); + return(BndCartoon2DVI(GH, tensortype, CCTK_FirstVarIndex(group))); } -void CCTK_FCALL CCTK_FNAME(Cartoon2DBCGroup)(CCTK_INT *retval, cGH *GH, CCTK_INT *tensortype, ONE_FORTSTRING_ARG) { +void CCTK_FCALL CCTK_FNAME(BndCartoon2DGN)(CCTK_INT *retval, cGH *GH, CCTK_INT *tensortype, ONE_FORTSTRING_ARG) { ONE_FORTSTRING_CREATE(group) - *retval = Cartoon2DBCGroup(GH, *tensortype, group); + *retval = BndCartoon2DGN(GH, *tensortype, group); free(group); } @@ -282,7 +287,7 @@ 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("x")][0]; + xp = GH->data[CCTK_CoordIndex(-1,"x","cart3d")][0]; lx0 = xp[0]; dx0 = GH->cctk_delta_space[0]/GH->cctk_levfac[0]; diff --git a/src/CheckParameters.c b/src/CheckParameters.c index 9c195df..f2d7574 100644 --- a/src/CheckParameters.c +++ b/src/CheckParameters.c @@ -13,6 +13,8 @@ static char *rcsid = "$Id$"; +CCTK_FILEVERSION(Development_Cartoon2D_CheckParameters_c) + /*@@ @routine Cartoon2D_CheckParameters @date Wed Nov 3 10:17:46 MET 1999 @@ -28,9 +30,9 @@ static char *rcsid = "$Id$"; @@*/ -void Cartoon2D_CheckParameters(CCTK_CARGUMENTS) +void Cartoon2D_CheckParameters(CCTK_ARGUMENTS) { - DECLARE_CCTK_CARGUMENTS + DECLARE_CCTK_ARGUMENTS DECLARE_CCTK_PARAMETERS if(cctk_gsh[1] != 2*cctk_nghostzones[1]+1) diff --git a/src/interpolate.c b/src/interpolate.c index fe8cbb0..13e7f6f 100644 --- a/src/interpolate.c +++ b/src/interpolate.c @@ -93,6 +93,10 @@ case 4: case 5: return( interpolate_local_order5(x0, dx, y, x) ); break; + +default: + CCTK_WARN(0, "Interpolation order not supported"); + return(0); } } |