diff options
author | tradke <tradke@7842ec3a-9562-4be5-9c5b-06ba18f2b668> | 2001-07-04 12:50:33 +0000 |
---|---|---|
committer | tradke <tradke@7842ec3a-9562-4be5-9c5b-06ba18f2b668> | 2001-07-04 12:50:33 +0000 |
commit | fd4cd0198f1faf4f711561865acb39b3712b95be (patch) | |
tree | e092d026f1524f4c1a5f873eb930f5992a73c61e /src/DumpUtils.c | |
parent | 56c65d135cff696ef247a5529f06425b46ca7d7c (diff) |
Fix for dumping the bounding box attributes.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOHDF5Util/trunk@39 7842ec3a-9562-4be5-9c5b-06ba18f2b668
Diffstat (limited to 'src/DumpUtils.c')
-rw-r--r-- | src/DumpUtils.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/DumpUtils.c b/src/DumpUtils.c index 1393787..8274388 100644 --- a/src/DumpUtils.c +++ b/src/DumpUtils.c @@ -241,10 +241,11 @@ void IOHDF5Util_DumpCommonAttributes (cGH *GH, { DECLARE_CCTK_PARAMETERS char *groupname; - int maxdim; + int dim, vdim; CCTK_INT attr_int; CCTK_REAL *attr_real; ioHDF5UtilGH *myGH; + char coord_system_name[20]; /* prevent compiler warning about unused parameter */ @@ -270,20 +271,24 @@ void IOHDF5Util_DumpCommonAttributes (cGH *GH, myGH->scalar_dataspace, 0, IOHDF5_REAL); /* attributes describing the underlying grid */ - maxdim = CCTK_MaxDim (); - attr_real = (CCTK_REAL *) malloc (2 * maxdim * sizeof (CCTK_REAL)); - CCTK_CoordRange (GH, &attr_real[0], &attr_real[maxdim+0], -1, "x", "cart3d"); - CCTK_CoordRange (GH, &attr_real[1], &attr_real[maxdim+1], -1, "y", "cart3d"); - CCTK_CoordRange (GH, &attr_real[2], &attr_real[maxdim+2], -1, "z", "cart3d"); + 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++) + { + 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, maxdim, IOHDF5_REAL); + myGH->array_dataspace, vdim, IOHDF5_REAL); WRITE_ATTRIBUTE ("min_ext", attr_real, dataset, - myGH->array_dataspace, maxdim, IOHDF5_REAL); - WRITE_ATTRIBUTE ("max_ext", attr_real + maxdim, dataset, - myGH->array_dataspace, maxdim, IOHDF5_REAL); + 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, maxdim, IOHDF5_REAL); + myGH->array_dataspace, vdim, IOHDF5_REAL); free (attr_real); #if 0 |