diff options
author | tradke <tradke@ebee0441-1374-4afa-a3b5-247f3ba15b9a> | 2001-08-02 12:24:08 +0000 |
---|---|---|
committer | tradke <tradke@ebee0441-1374-4afa-a3b5-247f3ba15b9a> | 2001-08-02 12:24:08 +0000 |
commit | d677da6363292eb42307ac54148523bac95814bc (patch) | |
tree | ef95af779b7a10a281b535f7ea2e625fb2226efa | |
parent | b2f15940644dc82b027eda831b27aba2f6204173 (diff) |
Store min_ext, max_ext, origin attributes only for grid function variables
which are associated with a coordinate system.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOFlexIO/trunk@215 ebee0441-1374-4afa-a3b5-247f3ba15b9a
-rw-r--r-- | src/DumpVar.c | 59 |
1 files changed, 34 insertions, 25 deletions
diff --git a/src/DumpVar.c b/src/DumpVar.c index bc86751..285877a 100644 --- a/src/DumpVar.c +++ b/src/DumpVar.c @@ -550,32 +550,43 @@ static void IOFlexIO_AddCommonAttributes (cGH *GH, int vindex, int timelevel, CACTUS_IEEEIO_ERROR (IOwriteAttribute (iof, "time", FLEXIO_REAL, 1,&GH->cctk_time)); - attr_real = (CCTK_REAL *) malloc (3 * vdim * sizeof (CCTK_REAL)); - /* FIXME: this hardcodes it for cartesian coordinate systems */ + /* attributes describing the underlying grid + These are only stored for CCTK_GF variables if they are associated + with coordinates. */ + /* FIXME: This is hardcoded for cartesian coordinate systems. + A better solution would be to be able to query the coordinate + system which is associated with the variable. */ sprintf (coord_system_name, "cart%dd", vdim); - for (dim = 0; dim < vdim; dim++) + if (CCTK_GroupTypeFromVarI (vindex) == CCTK_GF && + CCTK_CoordSystemHandle (coord_system_name) >= 0) { - CCTK_CoordRange (GH, &attr_real[dim], &attr_real[dim + vdim], dim + 1, - NULL, coord_system_name); - attr_real [dim + 2*vdim] = GH->cctk_delta_space [dim] * - ioUtilGH->downsample [dim]; - } + attr_real = (CCTK_REAL *) malloc (3 * vdim * sizeof (CCTK_REAL)); + for (dim = 0; dim < vdim; dim++) + { + CCTK_CoordRange (GH, &attr_real[dim], &attr_real[dim + vdim], dim + 1, + NULL, coord_system_name); + attr_real [dim + 2*vdim] = GH->cctk_delta_space [dim] * + ioUtilGH->downsample [dim]; + } - CACTUS_IEEEIO_ERROR (IOwriteAttribute (iof, "origin", FLEXIO_REAL, vdim, - attr_real)); - CACTUS_IEEEIO_ERROR (IOwriteAttribute (iof, "min_ext", FLEXIO_REAL, vdim, - attr_real)); - CACTUS_IEEEIO_ERROR (IOwriteAttribute (iof, "max_ext", FLEXIO_REAL, vdim, - attr_real + vdim)); - CACTUS_IEEEIO_ERROR (IOwriteAttribute (iof, "delta", FLEXIO_REAL, vdim, - attr_real + 2*vdim)); - - if (ioUtilGH->downsample [0] > 1 || - ioUtilGH->downsample [1] > 1 || - ioUtilGH->downsample [2] > 1) - { - CACTUS_IEEEIO_ERROR (IOwriteAttribute (iof, "evolution_delta", FLEXIO_REAL, - vdim, GH->cctk_delta_space)); + CACTUS_IEEEIO_ERROR (IOwriteAttribute (iof, "origin", FLEXIO_REAL, vdim, + attr_real)); + CACTUS_IEEEIO_ERROR (IOwriteAttribute (iof, "min_ext", FLEXIO_REAL, vdim, + attr_real)); + CACTUS_IEEEIO_ERROR (IOwriteAttribute (iof, "max_ext", FLEXIO_REAL, vdim, + attr_real + vdim)); + CACTUS_IEEEIO_ERROR (IOwriteAttribute (iof, "delta", FLEXIO_REAL, vdim, + attr_real + 2*vdim)); + + if (ioUtilGH->downsample [0] > 1 || + ioUtilGH->downsample [1] > 1 || + ioUtilGH->downsample [2] > 1) + { + CACTUS_IEEEIO_ERROR (IOwriteAttribute (iof, "evolution_delta", FLEXIO_REAL, + vdim, GH->cctk_delta_space)); + } + + free (attr_real); } CACTUS_IEEEIO_ERROR (IOwriteAttribute (iof, "global_size", FLEXIO_INT4, @@ -596,8 +607,6 @@ static void IOFlexIO_AddCommonAttributes (cGH *GH, int vindex, int timelevel, attr_int4 = GH->cctk_iteration; CACTUS_IEEEIO_ERROR (IOwriteAttribute (iof, "iteration", FLEXIO_INT4, 1, &attr_int4)); - - free (attr_real); } |