diff options
author | tradke <tradke@4825ed28-b72c-4eae-9704-e50c059e567d> | 2002-03-05 13:01:25 +0000 |
---|---|---|
committer | tradke <tradke@4825ed28-b72c-4eae-9704-e50c059e567d> | 2002-03-05 13:01:25 +0000 |
commit | 32f3aac693624a83f352b87dfb86d9489d8452e3 (patch) | |
tree | c8a68aa2a3ae03fcb72d7e34de4951915d6f70ef | |
parent | ed066e7e7a0b3239d3896460c0b5df19b7668112 (diff) |
Another fix for the delta attribute.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOHDF5/trunk@109 4825ed28-b72c-4eae-9704-e50c059e567d
-rw-r--r-- | src/util/hdf5_bitant_to_fullmode.c | 44 |
1 files changed, 31 insertions, 13 deletions
diff --git a/src/util/hdf5_bitant_to_fullmode.c b/src/util/hdf5_bitant_to_fullmode.c index 8fd18d5..67818fb 100644 --- a/src/util/hdf5_bitant_to_fullmode.c +++ b/src/util/hdf5_bitant_to_fullmode.c @@ -456,24 +456,26 @@ static herr_t CopyAttribute (hid_t from, static void FixBoundingBox (hid_t object) { hid_t attr, datatype, dataspace; - double delta[3], min_ext[3]; + double delta[3], min_ext[3], max_ext[3]; int global_size[3], do_it; - /* try to read the "delta" and "global_size" attributes */ + /* try to read the "global_size" and "max_ext" attributes */ H5E_BEGIN_TRY { - attr = H5Aopen_name (object, "delta"); + attr = H5Aopen_name (object, "global_size"); do_it = attr >= 0; if (do_it) { CHECK_ERROR (datatype = H5Aget_type (attr)); CHECK_ERROR (dataspace = H5Aget_space (attr)); - if (H5Tget_class (datatype) == H5T_FLOAT && + if (H5Tget_class (datatype) == H5T_INTEGER && H5Sis_simple (dataspace) > 0 && H5Sget_simple_extent_npoints (dataspace) == 3) { - CHECK_ERROR (H5Aread (attr, H5T_NATIVE_DOUBLE, delta)); + CHECK_ERROR (H5Aread (attr, H5T_NATIVE_INT, global_size)); + global_size[2] = 2 * (global_size[2] - stencil); + CHECK_ERROR (H5Awrite (attr, H5T_NATIVE_INT, global_size)); } else { @@ -486,20 +488,18 @@ static void FixBoundingBox (hid_t object) if (do_it) { - attr = H5Aopen_name (object, "global_size"); + attr = H5Aopen_name (object, "max_ext"); do_it = attr >= 0; } if (do_it) { CHECK_ERROR (datatype = H5Aget_type (attr)); CHECK_ERROR (dataspace = H5Aget_space (attr)); - if (H5Tget_class (datatype) == H5T_INTEGER && + if (H5Tget_class (datatype) == H5T_FLOAT && H5Sis_simple (dataspace) > 0 && H5Sget_simple_extent_npoints (dataspace) == 3) { - CHECK_ERROR (H5Aread (attr, H5T_NATIVE_INT, global_size)); - global_size[2] += global_size[2] - 1; - CHECK_ERROR (H5Awrite (attr, H5T_NATIVE_INT, global_size)); + CHECK_ERROR (H5Aread (attr, H5T_NATIVE_DOUBLE, max_ext)); } else { @@ -511,7 +511,7 @@ static void FixBoundingBox (hid_t object) } } H5E_END_TRY; - /* now fix the "min_ext" and "origin" attributes */ + /* now fix the "min_ext", "origin", and "delta" attributes */ if (do_it) { CHECK_ERROR (attr = H5Aopen_name (object, "min_ext")); @@ -524,7 +524,7 @@ static void FixBoundingBox (hid_t object) H5Sget_simple_extent_npoints (dataspace) == 3) { CHECK_ERROR (H5Aread (attr, H5T_NATIVE_DOUBLE, min_ext)); - min_ext[2] -= delta[2] * ((global_size[2] + 1) / 2); + min_ext[2] = -max_ext[2]; CHECK_ERROR (H5Awrite (attr, H5T_NATIVE_DOUBLE, min_ext)); } CHECK_ERROR (H5Aclose (attr)); @@ -542,12 +542,30 @@ static void FixBoundingBox (hid_t object) H5Sget_simple_extent_npoints (dataspace) == 3) { CHECK_ERROR (H5Aread (attr, H5T_NATIVE_DOUBLE, min_ext)); - min_ext[2] -= delta[2] * ((global_size[2] + 1) / 2); + min_ext[2] = -max_ext[2]; CHECK_ERROR (H5Awrite (attr, H5T_NATIVE_DOUBLE, min_ext)); } CHECK_ERROR (H5Aclose (attr)); CHECK_ERROR (H5Sclose (dataspace)); CHECK_ERROR (H5Tclose (datatype)); } + + CHECK_ERROR (attr = H5Aopen_name (object, "delta")); + if (attr >= 0) + { + CHECK_ERROR (datatype = H5Aget_type (attr)); + CHECK_ERROR (dataspace = H5Aget_space (attr)); + if (H5Tget_class (datatype) == H5T_FLOAT && + H5Sis_simple (dataspace) > 0 && + H5Sget_simple_extent_npoints (dataspace) == 3) + { + CHECK_ERROR (H5Aread (attr, H5T_NATIVE_DOUBLE, delta)); + delta[2] = (max_ext[2] - min_ext[2]) / (global_size[2] + 1); + CHECK_ERROR (H5Awrite (attr, H5T_NATIVE_DOUBLE, delta)); + } + CHECK_ERROR (H5Aclose (attr)); + CHECK_ERROR (H5Sclose (dataspace)); + CHECK_ERROR (H5Tclose (datatype)); + } } } |