summaryrefslogtreecommitdiffstats
path: root/tools/h5dump/h5dump.c
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2008-01-16 16:12:08 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2008-01-16 16:12:08 (GMT)
commit8005df6417fa0f57b8769be046ae9bd7b32f9202 (patch)
treee8f1af762f6d5e4fdcad76e0d4c72811948401ab /tools/h5dump/h5dump.c
parent5382d51033772833b1d32edc4b4a648576cbf0ee (diff)
downloadhdf5-8005df6417fa0f57b8769be046ae9bd7b32f9202.zip
hdf5-8005df6417fa0f57b8769be046ae9bd7b32f9202.tar.gz
hdf5-8005df6417fa0f57b8769be046ae9bd7b32f9202.tar.bz2
[svn-r14437] bug fix for h5dump subsetting (deal with blocks)and new test runs
add a check for block overlap after the command line parsing * Algorithm * * In a inner loop, the parameters from SSET are translated into temporary * variables so that 1 row is printed at a time (getting the coordinate indices * at each row). * We define the stride, count and block to be 1 in the row dimension to achieve * this and advance until all points are printed. * An outer loop for cases where dimensionality is greater than 2D is made. * In each iteration, the 2D block is displayed in the inner loop. The remaining * slower dimensions above the first 2 are incremented one at a time in the outer loop * * The element position is obtained from the matrix according to: * Given an index I(z,y,x) its position from the beginning of an array * of sizes A(size_z, size_y,size_x) is given by * Position of I(z,y,x) = index_z * size_y * size_x * + index_y * size_x * + index_x * tested: windows, linux
Diffstat (limited to 'tools/h5dump/h5dump.c')
-rw-r--r--tools/h5dump/h5dump.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 3bcb40a..70d889f 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -3181,6 +3181,8 @@ parse_subset_params(char *dset)
* Tuesday, 9. January 2001
*
* Modifications:
+ * Pedro Vicente, Tuesday, January 15, 2008
+ * check for block overlap
*
*-------------------------------------------------------------------------
*/
@@ -3253,6 +3255,38 @@ handle_datasets(hid_t fid, char *dset, void *data)
}
}
+
+ /*-------------------------------------------------------------------------
+ * check for block overlap
+ *-------------------------------------------------------------------------
+ */
+
+ if(sset)
+ {
+ hid_t sid = H5Dget_space(dsetid);
+ unsigned int ndims = H5Sget_simple_extent_ndims(sid);
+ unsigned int i;
+
+ for ( i = 0; i < ndims; i++)
+ {
+ if ( sset->count[i] > 1 )
+ {
+
+ if ( sset->stride[i] < sset->block[i] )
+ {
+ error_msg(progname, "wrong subset selection; blocks overlap\n");
+ d_status = EXIT_FAILURE;
+ return;
+
+ }
+
+ }
+
+ }
+ H5Sclose(sid);
+
+ }
+
H5Oget_info(dsetid, &oinfo);
if(oinfo.rc > 1) {
obj_t *found_obj; /* Found object */