summaryrefslogtreecommitdiffstats
path: root/tools/h5dump
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2006-12-14 21:18:08 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2006-12-14 21:18:08 (GMT)
commitaa646b5b43361597e547cea18af1825b43ad8ecb (patch)
tree46b46713137bcbb0da32c66223739faee75be08d /tools/h5dump
parent57a786d9c0242b7c94d0b0a1c8519f9b906d194a (diff)
downloadhdf5-aa646b5b43361597e547cea18af1825b43ad8ecb.zip
hdf5-aa646b5b43361597e547cea18af1825b43ad8ecb.tar.gz
hdf5-aa646b5b43361597e547cea18af1825b43ad8ecb.tar.bz2
[svn-r13064]
Fix several bugs 1) the parsing of subsetting was using atoi to convert the parameter to an int, which caused problems for numbers greater that int. Substitute with atof 2) the printing of indices in the subsetting case was not being done. Solution: calculate the element position at the start of the subsetting using the algorythm 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 And pass that position to the function that dumps data, h5tools_dump_simple_data. 3) several index counters were declared as int, use hsize_t instead 4) modified the test generation program so that it includes test cases for subsetting of 1d, 2d, 3d, and 4d arrays and add these tests to the shell script
Diffstat (limited to 'tools/h5dump')
-rw-r--r--tools/h5dump/h5dump.c2
-rw-r--r--tools/h5dump/h5dumpgentest.c26
-rw-r--r--tools/h5dump/testh5dump.sh.in6
3 files changed, 20 insertions, 14 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 9768272..97644bf 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -2962,7 +2962,7 @@ parse_hsize_list(const char *h_list)
for (ptr = h_list; i < size_count && ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++)
if (isdigit(*ptr)) {
/* we should have an integer now */
- p_list[i++] = (hsize_t)atoi(ptr);
+ p_list[i++] = (hsize_t)atof(ptr);
while (isdigit(*ptr))
/* scroll to end of integer */
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index 463f718..83f009a 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -5364,14 +5364,14 @@ static void gent_aindices(void)
hid_t fid; /* file id */
hid_t gid[6]; /* group ids */
hsize_t dims1[1] = {100};
- hsize_t dims2[2] = {2,100};
- hsize_t dims3[3] = {2,2,100};
- hsize_t dims4[4] = {2,3,4,5};
+ hsize_t dims2[2] = {10,10};
+ hsize_t dims3[3] = {2,10,10};
+ hsize_t dims4[4] = {2,2,10,10};
hsize_t dims5[2] = {32,4097}; /* big enough data size to force a second stripmine read */
int buf1[100];
- int buf2[2][100];
- int buf3[2][2][100];
- int buf4[2][3][4][5];
+ int buf2[10][10];
+ int buf3[2][10][10];
+ int buf4[2][2][10][10];
double *buf5;
int i, j, k, l, n, ret;
@@ -5379,22 +5379,22 @@ static void gent_aindices(void)
buf1[i]=n++;
}
- for (i=n=0; i<2; i++){
- for (j=0; j<100; j++){
+ for (i=n=0; i<10; i++){
+ for (j=0; j<10; j++){
buf2[i][j]=n++;
}
}
for (i=n=0; i<2; i++){
- for (j=0; j<2; j++){
- for (k=0; k<100; k++){
+ for (j=0; j<10; j++){
+ for (k=0; k<10; k++){
buf3[i][j][k]=n++;
}
}
}
for (i=n=0; i<2; i++){
- for (j=0; j<3; j++){
- for (k=0; k<4; k++){
- for (l=0; l<5; l++){
+ for (j=0; j<2; j++){
+ for (k=0; k<10; k++){
+ for (l=0; l<10; l++){
buf4[i][j][k][l]=n++;
}
}
diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in
index 8368385..4c6414d 100644
--- a/tools/h5dump/testh5dump.sh.in
+++ b/tools/h5dump/testh5dump.sh.in
@@ -256,6 +256,12 @@ TOOLTEST tstring2.ddl -r -d str4 tstr3.h5
TOOLTEST tindicesyes.ddl taindices.h5
TOOLTEST tindicesno.ddl -y taindices.h5
+# array indices with subsetting
+TOOLTEST tindicessub1.ddl -d 1d -s 3 -c 40 taindices.h5
+TOOLTEST tindicessub2.ddl -d 2d -s 1,3 -c 6,4 taindices.h5
+TOOLTEST tindicessub3.ddl -d 3d -s 0,1,3 -c 1,6,4 taindices.h5
+TOOLTEST tindicessub4.ddl -d 4d -s 0,0,1,3 -c 1,1,1,1 taindices.h5
+
# tests for filters
# SZIP