From 3d2b4e80fee7da7264a227741dd24979fd10487f Mon Sep 17 00:00:00 2001 From: tradke Date: Tue, 1 Jun 2004 09:55:11 +0000 Subject: Fixed 2D output which used wrong slice center settings. git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOASCII/trunk@176 94b1c47f-dcfd-45ef-a468-0854c0e9e350 --- src/ChooseOutput.c | 20 ++++++++++---------- src/Write2D.c | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/ChooseOutput.c b/src/ChooseOutput.c index 42ad065..b198422 100644 --- a/src/ChooseOutput.c +++ b/src/ChooseOutput.c @@ -71,10 +71,10 @@ void IOASCII_Choose1D (const cGH *GH) /* allocate arrays for origins */ - origin_phys[0] = (CCTK_REAL *) malloc (3 * 3 * sizeof (CCTK_REAL)); + origin_phys[0] = malloc (3 * 3 * sizeof (CCTK_REAL)); origin_phys[1] = origin_phys[0] + 3; origin_phys[2] = origin_phys[1] + 3; - origin_index[0] = (int *) malloc (3 * 3 * sizeof (int)); + origin_index[0] = malloc (3 * 3 * sizeof (int)); origin_index[1] = origin_index[0] + 3; origin_index[2] = origin_index[1] + 3; @@ -87,16 +87,16 @@ void IOASCII_Choose1D (const cGH *GH) GET_SLICE (out1D_zline_y, out_zline_y, origin_index[2][1], origin_phys[2][1]); maxdim = CCTK_MaxDim (); - myGH = (asciiioGH *) CCTK_GHExtension (GH, "IOASCII"); - myGH->spxyz = (int ***) malloc (maxdim * sizeof (int **)); + myGH = CCTK_GHExtension (GH, "IOASCII"); + myGH->spxyz = malloc (maxdim * sizeof (int **)); for (i = 0; i < maxdim; i++) { - myGH->spxyz[i] = (int **) malloc ((i + 1) * sizeof (int *)); + myGH->spxyz[i] = malloc ((i + 1) * sizeof (int *)); for (j = 0; j <= i; j++) { - myGH->spxyz[i][j] = (int *) calloc (i + 1, sizeof (int)); + myGH->spxyz[i][j] = calloc (i + 1, sizeof (int)); } if (i < 3) @@ -141,14 +141,14 @@ void IOASCII_Choose2D (const cGH *GH) GET_SLICE (out2D_yzplane_x, out_yzplane_x, origin_index[2], origin_phys[2]); maxdim = CCTK_MaxDim (); - myGH = (asciiioGH *) CCTK_GHExtension (GH, "IOASCII"); - myGH->sp2xyz = (int **) malloc (3 * sizeof (int *)); + myGH = CCTK_GHExtension (GH, "IOASCII"); + myGH->sp2xyz = malloc (3 * sizeof (int *)); for (i = 0; i < maxdim; i++) { - myGH->sp2xyz[i] = (int *) calloc (i + 1, sizeof (int)); + myGH->sp2xyz[i] = calloc (i + 1, sizeof (int)); - if (i > 0 && i < 3) + if (i == 2) { IOUtil_2DPlanes (GH, i + 1, origin_index, origin_phys, myGH->sp2xyz[i]); } diff --git a/src/Write2D.c b/src/Write2D.c index 57def8c..66e25f3 100644 --- a/src/Write2D.c +++ b/src/Write2D.c @@ -258,7 +258,7 @@ int IOASCII_Write2D (const cGH *GH, int vindex, const char *alias) memset (origin, 0, sizeof (origin)); if (have_coords) { - origin[maxdir-dir-1] = myGH->sp2xyz[gdata.dim - 1][dir]; + origin[maxdir-dir-1] = myGH->sp2xyz[gdata.dim-1][dir]; } /* set the direction vector */ @@ -419,7 +419,7 @@ static FILE **OpenFile (const cGH *GH, { /* give the slice origin as range [1 .. n] */ sprintf (slicename, "%s_[%d]", extensions[dir], - myGH->sp2xyz[dim - 1][dir]); + myGH->sp2xyz[dim-1][dir]); } sprintf (filename, "%s%s_%s.asc", myGH->out2D_dir, alias, slicename); -- cgit v1.2.3