aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortradke <tradke@7842ec3a-9562-4be5-9c5b-06ba18f2b668>2003-06-12 11:14:07 +0000
committertradke <tradke@7842ec3a-9562-4be5-9c5b-06ba18f2b668>2003-06-12 11:14:07 +0000
commitdf68bc90b0fe3a201b2ce78878371e8f04598404 (patch)
treedb1c27b71e962b250b702538f2c26e02a23ba7a6 /src
parent960df42ae16a5dd2389b6a7c108cb29b1a24cf97 (diff)
Fix the bounding box attributes "origin", "min_ext", "max_ext", and "delta"
which weren't taking hyperslab parameters into account. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOHDF5Util/trunk@88 7842ec3a-9562-4be5-9c5b-06ba18f2b668
Diffstat (limited to 'src')
-rw-r--r--src/DumpUtils.c60
1 files changed, 18 insertions, 42 deletions
diff --git a/src/DumpUtils.c b/src/DumpUtils.c
index 182f063..e417843 100644
--- a/src/DumpUtils.c
+++ b/src/DumpUtils.c
@@ -2,9 +2,9 @@
@file DumpUtils.c
@date Fri Oct 6 2000
@author Thomas Radke
- @desc
+ @desc
Utility routines for dumping data into HDF5 files.
- @enddesc
+ @enddesc
@version $Id$
@@*/
@@ -201,12 +201,12 @@ void IOHDF5Util_DumpCommonAttributes (const cGH *GH, const ioRequest *request,
char *groupname;
CCTK_INT attr_int;
CCTK_REAL *attr_real;
- ioHDF5UtilGH *myGH;
+ const ioHDF5UtilGH *myGH;
char coord_system_name[20];
DECLARE_CCTK_PARAMETERS
- myGH = (ioHDF5UtilGH *) CCTK_GHExtension (GH, "IOHDF5Util");
+ myGH = CCTK_GHExtension (GH, "IOHDF5Util");
/* attributes describing the variable */
groupname = CCTK_GroupNameFromVarI (request->vindex);
@@ -231,11 +231,19 @@ void IOHDF5Util_DumpCommonAttributes (const cGH *GH, const ioRequest *request,
if (CCTK_GroupTypeFromVarI (request->vindex) == CCTK_GF &&
CCTK_CoordSystemHandle (coord_system_name) >= 0)
{
- attr_real = (CCTK_REAL *) malloc (2 * vdim * sizeof (CCTK_REAL));
+ attr_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 + 0*vdim] +=
+ request->origin[dim] * GH->cctk_delta_space[dim];
+ attr_real[dim + 1*vdim] +=
+ (request->origin[dim] + request->extent[dim]-1) *
+ GH->cctk_delta_space[dim];
+ attr_real[dim + 2*vdim] =
+ GH->cctk_delta_space[dim] * request->downsample[dim];
}
WRITE_ATTRIBUTE ("origin", attr_real, object, myGH, vdim, HDF5_REAL);
@@ -245,38 +253,6 @@ void IOHDF5Util_DumpCommonAttributes (const cGH *GH, const ioRequest *request,
HDF5_REAL);
free (attr_real);
}
-
-#if 0
- /* attributes describing the hyperslab */
- /* FIXME: what attributes are really needed here ?? ***/
- if (request)
- {
- attr_real = (CCTK_REAL *) malloc (4 * request->hdim * sizeof (CCTK_REAL));
- for (dim = 0; dim < request->hdim; dim++)
- {
- attr_real[dim + 0*request->hdim] =
- request->origin[request->direction[dim]] *
- GH->cctk_delta_space[request->direction[dim]];
- attr_real[dim + 1*request->hdim] =
- request->origin[dim] * GH->cctk_delta_space[dim];
- attr_real[dim + 2*request->hdim] =
- (request->origin[dim] + request->actlen[dim]-1) *
- GH->cctk_delta_space[dim] * request->downsample[dim];
- attr_real[dim + 3*request->hdim] =
- GH->cctk_delta_space[request->direction[dim]] *
- request->downsample[request->direction[dim]];
- }
- WRITE_ATTRIBUTE ("origin_slab", attr_real + 0*dim, object, myGH, dim,
- HDF5_REAL);
- WRITE_ATTRIBUTE ("min_ext_slab", attr_real + 1*dim, object, myGH, dim,
- HDF5_REAL);
- WRITE_ATTRIBUTE ("max_ext_slab", attr_real + 2*dim, object, myGH, dim,
- HDF5_REAL);
- WRITE_ATTRIBUTE ("delta_slab", attr_real + 3*dim, object, myGH, dim,
- HDF5_REAL);
- free (attr_real);
- }
-#endif
}
@@ -324,7 +300,7 @@ void IOHDF5Util_DumpParameters (const cGH *GH, int all, hid_t file)
if (parameters)
{
- myGH = (ioHDF5UtilGH *) CCTK_GHExtension (GH, "IOHDF5Util");
+ myGH = CCTK_GHExtension (GH, "IOHDF5Util");
HDF5_ERROR (group = H5Gcreate (file, CACTUS_PARAMETERS_GROUP, 0));
WRITE_ATTRIBUTE (ALL_PARAMETERS, parameters, group, myGH, 0,
myGH->HDF5_STRING);
@@ -361,8 +337,8 @@ void IOHDF5Util_DumpGHExtensions (const cGH *GH, hid_t file)
hid_t group;
char buffer[128];
const char *version;
- ioGH *ioUtilGH;
- ioHDF5UtilGH *myGH;
+ const ioGH *ioUtilGH;
+ const ioHDF5UtilGH *myGH;
DECLARE_CCTK_PARAMETERS
@@ -371,8 +347,8 @@ void IOHDF5Util_DumpGHExtensions (const cGH *GH, hid_t file)
CCTK_INFO ("Dumping GH extensions ...");
}
- ioUtilGH = (ioGH *) CCTK_GHExtension (GH, "IO");
- myGH = (ioHDF5UtilGH *) CCTK_GHExtension (GH, "IOHDF5Util");
+ ioUtilGH = CCTK_GHExtension (GH, "IO");
+ myGH = CCTK_GHExtension (GH, "IOHDF5Util");
HDF5_ERROR (group = H5Gcreate (file, GLOBAL_ATTRIBUTES_GROUP, 0));