diff options
author | tradke <tradke@7842ec3a-9562-4be5-9c5b-06ba18f2b668> | 2001-08-02 12:23:50 +0000 |
---|---|---|
committer | tradke <tradke@7842ec3a-9562-4be5-9c5b-06ba18f2b668> | 2001-08-02 12:23:50 +0000 |
commit | 18d2a2d23167259c7d098d83a430ae13cefb22c6 (patch) | |
tree | 38003e349695428624af4f921555e0b57ab3fe60 /src/DumpUtils.c | |
parent | df5fe6326b8a80bd9c7c20bfeb4dc0f4cee46c67 (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/IOHDF5Util/trunk@41 7842ec3a-9562-4be5-9c5b-06ba18f2b668
Diffstat (limited to 'src/DumpUtils.c')
-rw-r--r-- | src/DumpUtils.c | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/src/DumpUtils.c b/src/DumpUtils.c index 8274388..0cdc89f 100644 --- a/src/DumpUtils.c +++ b/src/DumpUtils.c @@ -270,26 +270,34 @@ void IOHDF5Util_DumpCommonAttributes (cGH *GH, WRITE_ATTRIBUTE ("time", &GH->cctk_time, dataset, myGH->scalar_dataspace, 0, IOHDF5_REAL); - /* attributes describing the underlying grid */ + /* 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. */ vdim = CCTK_GroupDimFromVarI (vindex); - attr_real = (CCTK_REAL *) malloc (2 * vdim * sizeof (CCTK_REAL)); - /* FIXME: this hardcodes it for cartesian coordinate systems */ 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 = (CCTK_REAL *) malloc (2 * 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); + } - WRITE_ATTRIBUTE ("origin", attr_real, dataset, - myGH->array_dataspace, vdim, IOHDF5_REAL); - WRITE_ATTRIBUTE ("min_ext", attr_real, dataset, - myGH->array_dataspace, vdim, IOHDF5_REAL); - WRITE_ATTRIBUTE ("max_ext", attr_real + vdim, dataset, - myGH->array_dataspace, vdim, IOHDF5_REAL); - WRITE_ATTRIBUTE ("delta", GH->cctk_delta_space, dataset, - myGH->array_dataspace, vdim, IOHDF5_REAL); - free (attr_real); + WRITE_ATTRIBUTE ("origin", attr_real, dataset, + myGH->array_dataspace, vdim, IOHDF5_REAL); + WRITE_ATTRIBUTE ("min_ext", attr_real, dataset, + myGH->array_dataspace, vdim, IOHDF5_REAL); + WRITE_ATTRIBUTE ("max_ext", attr_real + vdim, dataset, + myGH->array_dataspace, vdim, IOHDF5_REAL); + WRITE_ATTRIBUTE ("delta", GH->cctk_delta_space, dataset, + myGH->array_dataspace, vdim, IOHDF5_REAL); + free (attr_real); + } #if 0 /* attributes describing the hyperslab */ |