diff options
author | allen <allen@ebee0441-1374-4afa-a3b5-247f3ba15b9a> | 2000-07-12 11:45:36 +0000 |
---|---|---|
committer | allen <allen@ebee0441-1374-4afa-a3b5-247f3ba15b9a> | 2000-07-12 11:45:36 +0000 |
commit | 94edf906d4ac38646501a0d614f04acb181f4aea (patch) | |
tree | e649e1ab8287e6abb33e4004911c6438aa786f93 /src/Write2D.c | |
parent | 2269f3828402342c0917d187613916011161829e (diff) |
Parameters for choosing 1D and 2D slices
New CCTK coordinate functions
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOFlexIO/trunk@136 ebee0441-1374-4afa-a3b5-247f3ba15b9a
Diffstat (limited to 'src/Write2D.c')
-rw-r--r-- | src/Write2D.c | 71 |
1 files changed, 48 insertions, 23 deletions
diff --git a/src/Write2D.c b/src/Write2D.c index 643965d..0c1daed 100644 --- a/src/Write2D.c +++ b/src/Write2D.c @@ -74,11 +74,13 @@ void IOFlexIO_Write2D (cGH *GH, int index, const char *alias) DECLARE_CCTK_PARAMETERS int i, j, k, l; int myproc, nprocs; + int dimension; pGH *pughGH; ioGH *ioUtilGH; flexioGH *myGH; int dir, ngpoints; CCTK_INT npoints, *nrempoints, bnd [4]; + CCTK_REAL dummy; void *data; int ni, nj; /* "x" and "y" direction ns */ /* Attributes */ @@ -102,7 +104,8 @@ void IOFlexIO_Write2D (cGH *GH, int index, const char *alias) char *fullname = CCTK_FullName (index); CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING, - "No IOFlexIO 2D output for '%s' (no storage)", fullname); + "IOFlexIO_Write2D: No IOFlexIO 2D output for '%s' (no storage)" + , fullname); free (fullname); return; } @@ -122,6 +125,9 @@ void IOFlexIO_Write2D (cGH *GH, int index, const char *alias) printf ("2D Slice for [%s]\n", alias); } + /* Dimension of group variables */ + dimension = CCTK_GroupDimI(index); + variable_type = CCTK_VarTypeI (index); switch (variable_type) { case CCTK_VARIABLE_CHAR: @@ -188,7 +194,8 @@ void IOFlexIO_Write2D (cGH *GH, int index, const char *alias) if (! IOisValid (IEEEfile_2D [i])) { CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Cannot open 2D output file '%s'", fname); + "IOFlexIO_Write2D: Cannot open 2D output file '%s'", + fname); return; } } @@ -229,10 +236,10 @@ void IOFlexIO_Write2D (cGH *GH, int index, const char *alias) { npoints = 0; /* Figure out the number of points */ - if ((pughGH->GFExtras[2]->ownership[0][0][dir] - <= ioUtilGH->sp2xyz[dir]) && - (ioUtilGH->sp2xyz[dir] - < pughGH->GFExtras[2]->ownership[0][1][dir])) + if ((pughGH->GFExtras[2]->ownership[0][0][dir] <= + myGH->sp2xyz[dimension-1][dir]) && + (myGH->sp2xyz[dimension-1][dir] < + pughGH->GFExtras[2]->ownership[0][1][dir])) { npoints = (pughGH->GFExtras[2]->ownership[0][1][(dir+1)%3] - @@ -247,30 +254,30 @@ void IOFlexIO_Write2D (cGH *GH, int index, const char *alias) { ngpoints = GH->cctk_gsh[1] * GH->cctk_gsh[2]; ni = GH->cctk_gsh[1]; - origin[0] = CCTK_CoordOrigin ("y"); + CCTK_CoordRange (GH,&origin[0],&dummy,-1,"y","cart3d"); delta[0] = pughGH->dy0; nj = GH->cctk_gsh[2]; - origin[1] = CCTK_CoordOrigin ("z"); + CCTK_CoordRange (GH,&origin[1],&dummy,-1,"z","cart3d"); delta[1] = pughGH->dz0; } else if (dir == 1) { ngpoints = GH->cctk_gsh[0] * GH->cctk_gsh[2]; ni = GH->cctk_gsh[0]; - origin[0] = CCTK_CoordOrigin ("x"); + CCTK_CoordRange (GH,&origin[0],&dummy,-1,"x","cart3d"); delta[0] = pughGH->dx0; nj = GH->cctk_gsh[2]; - origin[1] = CCTK_CoordOrigin ("z"); + CCTK_CoordRange (GH,&origin[1],&dummy,-1,"z","cart3d"); delta[1] = pughGH->dz0; } else { ngpoints = GH->cctk_gsh[0] * GH->cctk_gsh[1]; ni = GH->cctk_gsh[0]; - origin[0] = CCTK_CoordOrigin ("x"); + CCTK_CoordRange (GH,&origin[0],&dummy,-1,"x","cart3d"); delta[0] = pughGH->dx0; nj = GH->cctk_gsh[1]; - origin[1] = CCTK_CoordOrigin ("y"); + CCTK_CoordRange (GH,&origin[1],&dummy,-1,"y","cart3d"); delta[1] = pughGH->dy0; } @@ -365,9 +372,18 @@ void IOFlexIO_Write2D (cGH *GH, int index, const char *alias) for (j = locbnd [0]; j < locbnd [1]; j++) { int pt = 0; - if (dir==0) pt = DATINDEX (GA->extras, ioUtilGH->sp2xyz[dir], j, k); - if (dir==1) pt = DATINDEX (GA->extras, j, ioUtilGH->sp2xyz[dir], k); - if (dir==2) pt = DATINDEX (GA->extras, j, k, ioUtilGH->sp2xyz[dir]); + if (dir==0) + { + pt = DATINDEX (GA->extras, myGH->sp2xyz[dimension-1][dir], j, k); + } + if (dir==1) + { + pt = DATINDEX (GA->extras, j, myGH->sp2xyz[dimension-1][dir], k); + } + if (dir==2) + { + pt = DATINDEX (GA->extras, j, k, myGH->sp2xyz[dimension-1][dir]); + } assert (l <= npoints && pt <= GA->extras->npoints); char_locdat [l++] = ((CCTK_CHAR *) data) [pt]; } @@ -380,9 +396,18 @@ void IOFlexIO_Write2D (cGH *GH, int index, const char *alias) for (j = locbnd [0]; j < locbnd [1]; j++) { int pt = 0; - if (dir==0) pt = DATINDEX (GA->extras, ioUtilGH->sp2xyz[dir], j, k); - if (dir==1) pt = DATINDEX (GA->extras, j, ioUtilGH->sp2xyz[dir], k); - if (dir==2) pt = DATINDEX (GA->extras, j, k, ioUtilGH->sp2xyz[dir]); + if (dir==0) + { + pt = DATINDEX (GA->extras, myGH->sp2xyz[dimension-1][dir], j, k); + } + if (dir==1) + { + pt = DATINDEX (GA->extras, j, myGH->sp2xyz[dimension-1][dir], k); + } + if (dir==2) + { + pt = DATINDEX (GA->extras, j, k, myGH->sp2xyz[dimension-1][dir]); + } assert (l <= npoints && pt <= GA->extras->npoints); int_locdat [l++] = ((CCTK_INT *) data) [pt]; } @@ -396,15 +421,15 @@ void IOFlexIO_Write2D (cGH *GH, int index, const char *alias) int pt = 0; if (dir==0) { - pt = DATINDEX (GA->extras, ioUtilGH->sp2xyz [dir], j, k); + pt = DATINDEX (GA->extras, myGH->sp2xyz [dimension-1][dir], j, k); } if (dir==1) { - pt = DATINDEX (GA->extras, j, ioUtilGH->sp2xyz [dir], k); + pt = DATINDEX (GA->extras, j, myGH->sp2xyz[dimension-1] [dir], k); } if (dir==2) { - pt = DATINDEX (GA->extras, j, k, ioUtilGH->sp2xyz [dir]); + pt = DATINDEX (GA->extras, j, k, myGH->sp2xyz[dimension-1] [dir]); } assert (l <= npoints && pt <= GA->extras->npoints); if (ioUtilGH->out_single) @@ -525,8 +550,8 @@ void IOFlexIO_Write2D (cGH *GH, int index, const char *alias) "delta", FLEXIO_REAL, 2, delta)); /* and also the coordinate ranges */ - CCTK_CoordRange (GH, &min_ext [0], &max_ext [0], "x"); - CCTK_CoordRange (GH, &min_ext [1], &max_ext [1], "x"); + CCTK_CoordRange (GH, &min_ext [0], &max_ext [0], 1, NULL, "cart3d"); + CCTK_CoordRange (GH, &min_ext [1], &max_ext [1], 1, NULL, "cart3d"); CACTUS_IEEEIO_ERROR (IOwriteAttribute (IEEEfile_2D [dir], "min_ext", FLEXIO_REAL, 2, min_ext)); CACTUS_IEEEIO_ERROR (IOwriteAttribute (IEEEfile_2D [dir], |