diff options
author | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2008-04-30 19:51:13 (GMT) |
---|---|---|
committer | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2008-04-30 19:51:13 (GMT) |
commit | aec106e324ce20e5efb725c25a6a333c7970127b (patch) | |
tree | 234df369115a46b08037c5f385061cf58823e497 /tools | |
parent | 5773fd34bc5adf59b4530d95ac9f0c0585902803 (diff) | |
download | hdf5-aec106e324ce20e5efb725c25a6a333c7970127b.zip hdf5-aec106e324ce20e5efb725c25a6a333c7970127b.tar.gz hdf5-aec106e324ce20e5efb725c25a6a333c7970127b.tar.bz2 |
[svn-r14903] Undoing change committed in r14902.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/h5diff/h5diffgentest.c | 251 | ||||
-rw-r--r-- | tools/h5dump/h5dump.c | 83 | ||||
-rw-r--r-- | tools/h5dump/h5dumpgentest.c | 38 | ||||
-rw-r--r-- | tools/h5dump/testh5dump.sh.in | 3 | ||||
-rwxr-xr-x | tools/h5import/h5import.c | 55 | ||||
-rwxr-xr-x | tools/h5import/h5importtest.c | 439 | ||||
-rwxr-xr-x | tools/h5import/h5importtestutil.sh | 55 | ||||
-rwxr-xr-x | tools/h5import/testfiles/binfp64.conf (renamed from tools/h5import/testfiles/conbfp64) | 0 | ||||
-rw-r--r-- | tools/h5import/testfiles/binfp64.h5 (renamed from tools/h5import/testfiles/test8.h5) | bin | 10760 -> 10760 bytes | |||
-rwxr-xr-x | tools/h5import/testfiles/binin16.conf (renamed from tools/h5import/testfiles/conbin16) | 0 | ||||
-rw-r--r-- | tools/h5import/testfiles/binin16.h5 (renamed from tools/h5import/testfiles/test9.h5) | bin | 10760 -> 10760 bytes | |||
-rwxr-xr-x | tools/h5import/testfiles/binin32.conf (renamed from tools/h5import/testfiles/conbin32) | 0 | ||||
-rw-r--r-- | tools/h5import/testfiles/binin32.h5 (renamed from tools/h5import/testfiles/test11.h5) | bin | 9472 -> 9472 bytes | |||
-rwxr-xr-x | tools/h5import/testfiles/binin8.conf (renamed from tools/h5import/testfiles/conbin8) | 0 | ||||
-rw-r--r-- | tools/h5import/testfiles/binin8.h5 (renamed from tools/h5import/testfiles/test10.h5) | bin | 10760 -> 10760 bytes | |||
-rw-r--r-- | tools/h5import/testfiles/binin8w.conf | 9 | ||||
-rw-r--r-- | tools/h5import/testfiles/binin8w.h5 | bin | 0 -> 2852 bytes | |||
-rwxr-xr-x | tools/h5import/testfiles/binuin16.conf (renamed from tools/h5import/testfiles/conbuin16) | 0 | ||||
-rw-r--r-- | tools/h5import/testfiles/binuin16.h5 (renamed from tools/h5import/testfiles/test12.h5) | bin | 10760 -> 10760 bytes | |||
-rwxr-xr-x | tools/h5import/testfiles/binuin32.conf (renamed from tools/h5import/testfiles/conbuin32) | 0 | ||||
-rw-r--r-- | tools/h5import/testfiles/binuin32.h5 (renamed from tools/h5import/testfiles/test13.h5) | bin | 6384 -> 6384 bytes | |||
-rwxr-xr-x | tools/h5import/testfiles/conbfp32 | 12 | ||||
-rwxr-xr-x | tools/h5import/testfiles/txtfp32.conf (renamed from tools/h5import/testfiles/textfp32) | 0 | ||||
-rw-r--r-- | tools/h5import/testfiles/txtfp32.h5 (renamed from tools/h5import/testfiles/test6.h5) | bin | 4192 -> 4192 bytes | |||
-rwxr-xr-x | tools/h5import/testfiles/txtfp32.txt (renamed from tools/h5import/testfiles/fp1) | 0 | ||||
-rwxr-xr-x | tools/h5import/testfiles/txtfp64.conf (renamed from tools/h5import/testfiles/textfp64) | 0 | ||||
-rw-r--r-- | tools/h5import/testfiles/txtfp64.h5 (renamed from tools/h5import/testfiles/test7.h5) | bin | 9784 -> 9784 bytes | |||
-rwxr-xr-x | tools/h5import/testfiles/txtfp64.txt (renamed from tools/h5import/testfiles/fp2) | 0 | ||||
-rwxr-xr-x | tools/h5import/testfiles/txtin16.conf (renamed from tools/h5import/testfiles/textin16) | 0 | ||||
-rw-r--r-- | tools/h5import/testfiles/txtin16.h5 (renamed from tools/h5import/testfiles/test2.h5) | bin | 9784 -> 9784 bytes | |||
-rw-r--r--[-rwxr-xr-x] | tools/h5import/testfiles/txtin16.txt (renamed from tools/h5import/testfiles/in1) | 0 | ||||
-rwxr-xr-x | tools/h5import/testfiles/txtin32.conf (renamed from tools/h5import/testfiles/textin32) | 0 | ||||
-rw-r--r-- | tools/h5import/testfiles/txtin32.h5 (renamed from tools/h5import/testfiles/test1.h5) | bin | 4192 -> 4192 bytes | |||
-rw-r--r-- | tools/h5import/testfiles/txtin32.txt | 15 | ||||
-rwxr-xr-x | tools/h5import/testfiles/txtin8.conf (renamed from tools/h5import/testfiles/textin8) | 0 | ||||
-rw-r--r-- | tools/h5import/testfiles/txtin8.h5 (renamed from tools/h5import/testfiles/test3.h5) | bin | 9784 -> 9784 bytes | |||
-rw-r--r-- | tools/h5import/testfiles/txtstr.conf (renamed from tools/h5import/testfiles/textstr) | 0 | ||||
-rw-r--r-- | tools/h5import/testfiles/txtstr.h5 (renamed from tools/h5import/testfiles/teststr.h5) | bin | 10240 -> 10240 bytes | |||
-rw-r--r-- | tools/h5import/testfiles/txtstr.txt (renamed from tools/h5import/testfiles/txtstr) | 0 | ||||
-rwxr-xr-x | tools/h5import/testfiles/txtuin16.conf (renamed from tools/h5import/testfiles/textuin16) | 0 | ||||
-rw-r--r-- | tools/h5import/testfiles/txtuin16.h5 (renamed from tools/h5import/testfiles/test5.h5) | bin | 10240 -> 10240 bytes | |||
-rwxr-xr-x | tools/h5import/testfiles/txtuin32.conf (renamed from tools/h5import/testfiles/textuin32) | 0 | ||||
-rw-r--r-- | tools/h5import/testfiles/txtuin32.h5 (renamed from tools/h5import/testfiles/test4.h5) | bin | 6240 -> 6240 bytes | |||
-rwxr-xr-x | tools/h5import/testfiles/txtuin32.txt | 15 | ||||
-rw-r--r-- | tools/h5repack/h5repack.c | 2 | ||||
-rw-r--r-- | tools/h5repack/h5repack.h | 14 | ||||
-rw-r--r-- | tools/h5stat/h5stat_gentest.c | 2 | ||||
-rw-r--r-- | tools/h5stat/testfiles/h5stat_newgrat.ddl | 20 | ||||
-rw-r--r-- | tools/h5stat/testfiles/h5stat_newgrat.h5 | bin | 72236 -> 6363055 bytes | |||
-rw-r--r-- | tools/lib/h5diff.c | 217 | ||||
-rw-r--r-- | tools/lib/h5diff_array.c | 276 | ||||
-rw-r--r-- | tools/lib/h5diff_dset.c | 1369 | ||||
-rw-r--r-- | tools/lib/h5diff_util.c | 268 | ||||
-rw-r--r-- | tools/lib/h5tools.c | 42 | ||||
-rw-r--r-- | tools/testfiles/h5diff_58.txt | 2 | ||||
-rw-r--r-- | tools/testfiles/h5diff_70.txt | 236 | ||||
-rw-r--r-- | tools/testfiles/h5diff_80.txt | 83 | ||||
-rw-r--r-- | tools/testfiles/h5diff_attr1.h5 | bin | 19136 -> 26000 bytes | |||
-rw-r--r-- | tools/testfiles/h5diff_attr2.h5 | bin | 19136 -> 26000 bytes | |||
-rw-r--r-- | tools/testfiles/h5diff_basic2.h5 | bin | 4240 -> 5728 bytes | |||
-rw-r--r-- | tools/testfiles/h5diff_dset1.h5 | bin | 19888 -> 22752 bytes | |||
-rw-r--r-- | tools/testfiles/h5diff_dset2.h5 | bin | 19888 -> 22752 bytes | |||
-rw-r--r-- | tools/testfiles/tallfilters.ddl | 2 | ||||
-rw-r--r-- | tools/testfiles/tbin4.ddl | 2 | ||||
-rw-r--r-- | tools/testfiles/tbinary.h5 | bin | 806144 -> 2144 bytes | |||
-rw-r--r-- | tools/testfiles/tdeflate.ddl | 2 | ||||
-rw-r--r-- | tools/testfiles/tnbit.ddl | 2 | ||||
-rw-r--r-- | tools/testfiles/tscaleoffset.ddl | 2 | ||||
-rw-r--r-- | tools/testfiles/tszip.ddl | 2 |
69 files changed, 2094 insertions, 1424 deletions
diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c index 735dc0f..2fd6fa6 100644 --- a/tools/h5diff/h5diffgentest.c +++ b/tools/h5diff/h5diffgentest.c @@ -254,7 +254,6 @@ int test_basic(const char *fname1, */ { -#if 1 float data15[6]; float data16[6]; @@ -274,48 +273,9 @@ int test_basic(const char *fname1, write_dset(gid1,1,dims1,"fp15",H5T_NATIVE_FLOAT,data15); write_dset(gid1,1,dims1,"fp16",H5T_NATIVE_FLOAT,data16); -#else - -#define NU_ELMTS 1000000 - - hsize_t i; - - hsize_t dims2[1] = { NU_ELMTS }; - - float *data15 = malloc (NU_ELMTS * sizeof(float) ); - float *data16 = malloc (NU_ELMTS * sizeof(float) ); - - data15[0] = (float) sqrt( (double)-1 ); - data15[1] = 1; - data15[2] = (float) sqrt( (double)-1 ); - data15[3] = 1; - data15[4] = 1; - data15[5] = 1; - - data16[0] = (float) sqrt( (double)-1 ); - data16[1] = (float) sqrt( (double)-1 ); - data16[2] = 1; - data16[3] = 1; - data16[4] = 1; - data16[5] = 1; - - for ( i = 6; i < NU_ELMTS; i++ ) - { - data15[i] = /*data15[0];*/ 2; - data16[i] = 1; - } - - write_dset(gid1,1,dims2,"fp15",H5T_NATIVE_FLOAT,data15); - write_dset(gid1,1,dims2,"fp16",H5T_NATIVE_FLOAT,data16); - - free( data15 ); - free( data16 ); -#endif } - - /*------------------------------------------------------------------------- * NaNs in H5T_NATIVE_DOUBLE *------------------------------------------------------------------------- @@ -343,9 +303,7 @@ int test_basic(const char *fname1, write_dset(gid1,1,dims1,"fp18",H5T_NATIVE_DOUBLE,data18); } - - - + /*------------------------------------------------------------------------- * close @@ -444,7 +402,7 @@ int test_types(const char *fname) */ H5Lcreate_external("filename", "objname", fid1, "ext_link", H5P_DEFAULT, H5P_DEFAULT); H5Lregister(UD_link_class); - H5Lcreate_ud(fid1, "ud_link", MY_LINKCLASS, NULL, 0, H5P_DEFAULT, H5P_DEFAULT); + H5Lcreate_ud(fid1, "ud_link", MY_LINKCLASS, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT); /*------------------------------------------------------------------------- * Close @@ -772,13 +730,13 @@ int test_datasets(const char *file, write_dset_in(gid,"/dset",fid,make_diffs); - /* Close */ + /* close */ status = H5Dclose(did); assert(status >= 0); status = H5Gclose(gid); assert(status >= 0); - /* Close file */ + /* close file */ status = H5Fclose(fid); assert(status >= 0); return status; @@ -814,12 +772,13 @@ void write_attr_in(hid_t loc_id, hid_t sid; hid_t tid; herr_t status; - int val, i, j, k, n; + int val, i, j, k, l, n; float f; /* create 1D attributes with dimension [2], 2 elements */ hsize_t dims[1]={2}; - char buf1[2][2]= {"ab","de"}; /* string */ + char buf1[2][STR_SIZE]= {"ab","de"}; /* string */ + char *buf1a[2]; /* VL string */ char buf2[2]= {1,2}; /* bitfield, opaque */ s_t buf3[2]= {{1,2},{3,4}}; /* compound */ hobj_ref_t buf4[2]; /* reference */ @@ -832,7 +791,8 @@ void write_attr_in(hid_t loc_id, /* create 2D attributes with dimension [3][2], 6 elements */ hsize_t dims2[2]={3,2}; - char buf12[6][2]= {"ab","cd","ef","gh","ij","kl"}; /* string */ + char buf12[3][2][STR_SIZE]= {{"ab","cd"},{"ef","gh"},{"ij","kl"}}; /* string */ + char *buf12a[3][2]; /* VL string */ char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */ s_t buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; /* compound */ hobj_ref_t buf42[3][2]; /* reference */ @@ -844,9 +804,11 @@ void write_attr_in(hid_t loc_id, /* create 3D attributes with dimension [4][3][2], 24 elements */ hsize_t dims3[3]={4,3,2}; - char buf13[24][2]= {"ab","cd","ef","gh","ij","kl","mn","pq", - "rs","tu","vw","xz","AB","CD","EF","GH", - "IJ","KL","MN","PQ","RS","TU","VW","XZ"}; /* string */ + char buf13[4][3][2][STR_SIZE]= {{{"ab","cd"},{"ef","gh"},{"ij","kl"}}, + {{"mn","pq"},{"rs","tu"},{"vw","xz"}}, + {{"AB","CD"},{"EF","GH"},{"IJ","KL"}}, + {{"MN","PQ"},{"RS","TU"},{"VW","XZ"}}}; /* string */ + char *buf13a[4][3][2]; /* VL string */ char buf23[4][3][2]; /* bitfield, opaque */ s_t buf33[4][3][2]; /* compound */ hobj_ref_t buf43[4][3][2]; /* reference */ @@ -871,9 +833,7 @@ void write_attr_in(hid_t loc_id, { for (i=0; i<2; i++) for (j=0; j<2; j++) - { buf1[i][j]='z'; - } } /* buf1[2][2]= {"ab","de"}; @@ -888,10 +848,17 @@ void write_attr_in(hid_t loc_id, [ 1 ] e z */ tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, 2); + status = H5Tset_size(tid, (size_t)STR_SIZE); write_attr(loc_id,1,dims,"string",tid,buf1); status = H5Tclose(tid); + for (i=0; i<2; i++) + buf1a[i]=buf1[i]; + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, H5T_VARIABLE); + write_attr(loc_id,1,dims,"VLstring",tid,buf1a); + status = H5Tclose(tid); + /*------------------------------------------------------------------------- * H5T_BITFIELD *------------------------------------------------------------------------- @@ -935,7 +902,7 @@ void write_attr_in(hid_t loc_id, [ 1 ] 2 0 2 */ - tid = H5Tcreate(H5T_OPAQUE, 1); + tid = H5Tcreate(H5T_OPAQUE, (size_t)1); status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ write_attr(loc_id,1,dims,"opaque",tid,buf2); status = H5Tclose(tid); @@ -1126,7 +1093,10 @@ position array of </g1> array of </g1> difference */ if (make_diffs) { - memset(buf12, 'z', sizeof buf12); + for (i=0; i<3; i++) + for (j=0; j<2; j++) + for (k=0; k<2; k++) + buf12[i][j][k]='z'; } /* @@ -1150,10 +1120,18 @@ position array of </g1> array of </g1> difference */ tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, 2); + status = H5Tset_size(tid, (size_t)STR_SIZE); write_attr(loc_id,2,dims2,"string2D",tid,buf12); status = H5Tclose(tid); + for (i=0; i<3; i++) + for (j=0; j<2; j++) + buf12a[i][j]=buf12[i][j]; + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, H5T_VARIABLE); + write_attr(loc_id,2,dims2,"VLstring2D",tid,buf12a); + status = H5Tclose(tid); + /*------------------------------------------------------------------------- * H5T_BITFIELD *------------------------------------------------------------------------- @@ -1201,7 +1179,7 @@ position array of </g1> array of </g1> difference [ 2 0 ] 5 0 5 [ 2 1 ] 6 0 6 */ - tid = H5Tcreate(H5T_OPAQUE, 1); + tid = H5Tcreate(H5T_OPAQUE, (size_t)1); status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ write_attr(loc_id,2,dims2,"opaque2D",tid,buf22); status = H5Tclose(tid); @@ -1288,7 +1266,6 @@ position enum2D of </g1> enum2D of </g1> difference n=0; for (i = 0; i < 3; i++) { for (j = 0; j < 2; j++) { - int l; buf52[i][j].p = malloc((i + 1) * sizeof(int)); buf52[i][j].len = i + 1; for (l = 0; l < i + 1; l++) @@ -1411,7 +1388,11 @@ position float2D of </g1> float2D of </g1> difference if (make_diffs) { - memset(buf13,'z',sizeof buf13); + for (i=0; i<4; i++) + for (j=0; j<3; j++) + for (k=0; k<2; k++) + for (l=0; l<2; l++) + buf13[i][j][k][l]='z'; } /* @@ -1472,10 +1453,19 @@ position string3D of </g1> string3D of </g1> difference */ tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, 2); + status = H5Tset_size(tid, (size_t)STR_SIZE); write_attr(loc_id,3,dims3,"string3D",tid,buf13); status = H5Tclose(tid); + for (i=0; i<4; i++) + for (j=0; j<3; j++) + for (k=0; k<2; k++) + buf13a[i][j][k]=buf13[i][j][k]; + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, H5T_VARIABLE); + write_attr(loc_id,3,dims3,"VLstring3D",tid,buf13a); + status = H5Tclose(tid); + /*------------------------------------------------------------------------- * H5T_BITFIELD *------------------------------------------------------------------------- @@ -1528,7 +1518,7 @@ position bitfield3D of </g1> bitfield3D of </g1> difference * H5T_OPAQUE *------------------------------------------------------------------------- */ - tid = H5Tcreate(H5T_OPAQUE, 1); + tid = H5Tcreate(H5T_OPAQUE, (size_t)1); status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ write_attr(loc_id,3,dims3,"opaque3D",tid,buf23); status = H5Tclose(tid); @@ -1686,7 +1676,6 @@ position enum3D of </g1> enum3D of </g1> difference for (i = 0; i < 4; i++) { for (j = 0; j < 3; j++) { for (k = 0; k < 2; k++) { - int l; buf53[i][j][k].p = malloc((i + 1) * sizeof(int)); buf53[i][j][k].len = i + 1; for (l = 0; l < i + 1; l++) @@ -1821,13 +1810,14 @@ void write_dset_in(hid_t loc_id, hid_t tid; hid_t dcpl; herr_t status; - int val, i, j, k, n; + int val, i, j, k, l, n; float f; int fillvalue=2; /* create 1D attributes with dimension [2], 2 elements */ hsize_t dims[1]={2}; char buf1[2][STR_SIZE]= {"ab","de"}; /* string */ + char *buf1a[2]; /* VL string */ char buf2[2]= {1,2}; /* bitfield, opaque */ s_t buf3[2]= {{1,2},{3,4}}; /* compound */ hobj_ref_t buf4[2]; /* reference */ @@ -1840,7 +1830,8 @@ void write_dset_in(hid_t loc_id, /* create 2D attributes with dimension [3][2], 6 elements */ hsize_t dims2[2]={3,2}; - char buf12[6][STR_SIZE]= {"ab","cd","ef","gh","ij","kl"}; /* string */ + char buf12[3][2][STR_SIZE]= {{"ab","cd"},{"ef","gh"},{"ij","kl"}}; /* string */ + char *buf12a[3][2]; /* VL string */ char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */ s_t buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; /* compound */ hobj_ref_t buf42[3][2]; /* reference */ @@ -1851,9 +1842,11 @@ void write_dset_in(hid_t loc_id, /* create 3D attributes with dimension [4][3][2], 24 elements */ hsize_t dims3[3]={4,3,2}; - char buf13[24][STR_SIZE]= {"ab","cd","ef","gh","ij","kl","mn","pq", - "rs","tu","vw","xz","AB","CD","EF","GH", - "IJ","KL","MN","PQ","RS","TU","VW","XZ"}; /* string */ + char buf13[4][3][2][STR_SIZE]= {{{"ab","cd"},{"ef","gh"},{"ij","kl"}}, + {{"mn","pq"},{"rs","tu"},{"vw","xz"}}, + {{"AB","CD"},{"EF","GH"},{"IJ","KL"}}, + {{"MN","PQ"},{"RS","TU"},{"VW","XZ"}}}; /* string */ + char *buf13a[4][3][2]; /* VL string */ char buf23[4][3][2]; /* bitfield, opaque */ s_t buf33[4][3][2]; /* compound */ hobj_ref_t buf43[4][3][2]; /* reference */ @@ -1878,17 +1871,22 @@ void write_dset_in(hid_t loc_id, { for (i=0; i<2; i++) for (j=0; j<2; j++) - { buf1[i][j]='z'; - } } tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid,STR_SIZE); + status = H5Tset_size(tid,(size_t)STR_SIZE); write_dset(loc_id,1,dims,"string",tid,buf1); status = H5Tclose(tid); + for (i=0; i<2; i++) + buf1a[i]=buf1[i]; + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, H5T_VARIABLE); + write_dset(loc_id,1,dims,"VLstring",tid,buf1a); + status = H5Tclose(tid); + /*------------------------------------------------------------------------- * H5T_BITFIELD *------------------------------------------------------------------------- @@ -1917,7 +1915,7 @@ void write_dset_in(hid_t loc_id, } } - tid = H5Tcreate(H5T_OPAQUE, 1); + tid = H5Tcreate(H5T_OPAQUE, (size_t)1); status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ write_dset(loc_id,1,dims,"opaque",tid,buf2); status = H5Tclose(tid); @@ -2051,15 +2049,26 @@ void write_dset_in(hid_t loc_id, if (make_diffs) { - memset(buf12, 'z', sizeof buf12); + for (i=0; i<3; i++) + for (j=0; j<2; j++) + for (k=0; k<2; k++) + buf12[i][j][k]='z'; } tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid,STR_SIZE); + status = H5Tset_size(tid,(size_t)STR_SIZE); write_dset(loc_id,2,dims2,"string2D",tid,buf12); status = H5Tclose(tid); + for (i=0; i<3; i++) + for (j=0; j<2; j++) + buf12a[i][j]=buf12[i][j]; + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, H5T_VARIABLE); + write_dset(loc_id,2,dims2,"VLstring2D",tid,buf12a); + status = H5Tclose(tid); + /*------------------------------------------------------------------------- * H5T_BITFIELD *------------------------------------------------------------------------- @@ -2079,7 +2088,7 @@ void write_dset_in(hid_t loc_id, * H5T_OPAQUE *------------------------------------------------------------------------- */ - tid = H5Tcreate(H5T_OPAQUE, 1); + tid = H5Tcreate(H5T_OPAQUE, (size_t)1); status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ write_dset(loc_id,2,dims2,"opaque2D",tid,buf22); status = H5Tclose(tid); @@ -2135,8 +2144,6 @@ void write_dset_in(hid_t loc_id, n = 0; for(i = 0; i < 3; i++) for(j = 0; j < 2; j++) { - int l; - buf52[i][j].p = malloc((i + 1) * sizeof(int)); buf52[i][j].len = i + 1; for(l = 0; l < i + 1; l++) @@ -2213,14 +2220,27 @@ void write_dset_in(hid_t loc_id, if (make_diffs) { - memset(buf13,'z',sizeof buf13); + for (i=0; i<4; i++) + for (j=0; j<3; j++) + for (k=0; k<2; k++) + for (l=0; l<2; l++) + buf13[i][j][k][l]='z'; } tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid,STR_SIZE); + status = H5Tset_size(tid,(size_t)STR_SIZE); write_dset(loc_id,3,dims3,"string3D",tid,buf13); status = H5Tclose(tid); + for (i=0; i<4; i++) + for (j=0; j<3; j++) + for (k=0; k<2; k++) + buf13a[i][j][k]=buf13[i][j][k]; + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, H5T_VARIABLE); + write_dset(loc_id,3,dims3,"VLstring3D",tid,buf13a); + status = H5Tclose(tid); + /*------------------------------------------------------------------------- * H5T_BITFIELD *------------------------------------------------------------------------- @@ -2246,7 +2266,7 @@ void write_dset_in(hid_t loc_id, * H5T_OPAQUE *------------------------------------------------------------------------- */ - tid = H5Tcreate(H5T_OPAQUE, 1); + tid = H5Tcreate(H5T_OPAQUE, (size_t)1); status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ write_dset(loc_id,3,dims3,"opaque3D",tid,buf23); status = H5Tclose(tid); @@ -2316,8 +2336,6 @@ void write_dset_in(hid_t loc_id, for(i = 0; i < 4; i++) for(j = 0; j < 3; j++) for(k = 0; k < 2; k++) { - int l; - buf53[i][j][k].p = malloc((i + 1) * sizeof(int)); buf53[i][j][k].len = i + 1; for(l = 0; l < i + 1; l++) @@ -2410,7 +2428,7 @@ void gen_datareg(hid_t fid, int i; /* allocate the buffer for write the references */ - rbuf = calloc(2, sizeof(hdset_reg_ref_t)); + rbuf = calloc((size_t)2, sizeof(hdset_reg_ref_t)); /* allocate the buffer for write the data dataset */ buf = malloc(10 * 10 * sizeof(int)); @@ -2455,7 +2473,7 @@ void gen_datareg(hid_t fid, coord[3][0]=2; coord[3][1]=5; coord[4][0]=1; coord[4][1]=7; } - H5Sselect_elements(sid1,H5S_SELECT_SET,5,coord); + H5Sselect_elements(sid1,H5S_SELECT_SET,(size_t)5,(const hsize_t *)coord); H5Sget_select_npoints(sid1); /* store second dataset region */ @@ -2524,7 +2542,7 @@ int test_hyperslab(const char *fname, goto out; /* create a evenly divided buffer from 0 to 127 */ - buf = (char *)HDmalloc((unsigned)(nelmts * size)); + buf = (char *)HDmalloc((size_t)(nelmts * size)); s = 1024 * 1024 / 127; for(i = 0, j = 0, c = 0; i < 1024 * 1024; j++, i++) { if(j == s) { @@ -2595,31 +2613,35 @@ int write_attr(hid_t loc_id, hid_t tid, void *buf) { - hid_t aid; - hid_t sid; - - /* create a space */ - if((sid = H5Screate_simple(rank, dims, NULL)) < 0) - goto out; - - /* create the attribute */ - if((aid = H5Acreate2(loc_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; - - /* write */ - if(buf) - if(H5Awrite(aid, tid, buf) < 0) - goto out; - - /* close */ - H5Aclose(aid); - H5Sclose(sid); - - return SUCCEED; - + hid_t aid=-1; + hid_t sid=-1; + + /* create a space */ + if((sid = H5Screate_simple(rank, dims, NULL)) < 0) + goto out; + + /* create the attribute */ + if((aid = H5Acreate2(loc_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; + + /* write */ + if(buf) + { + if(H5Awrite(aid, tid, buf) < 0) + goto out; + } + + /* close */ + H5Aclose(aid); + H5Sclose(sid); + + return SUCCEED; + out: - - return FAIL; + + H5Aclose(aid); + H5Sclose(sid); + return FAIL; } /*------------------------------------------------------------------------- @@ -2637,8 +2659,8 @@ int write_dset( hid_t loc_id, hid_t tid, void *buf ) { - hid_t did; - hid_t sid; + hid_t did=-1; + hid_t sid=-1; /* create a space */ if((sid = H5Screate_simple(rank, dims, NULL)) < 0) @@ -2650,8 +2672,10 @@ int write_dset( hid_t loc_id, /* write */ if(buf) + { if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto out; + } /* close */ H5Dclose(did); @@ -2660,6 +2684,9 @@ int write_dset( hid_t loc_id, return SUCCEED; out: + + H5Dclose(did); + H5Sclose(sid); return FAIL; } diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 70d889f..2389ef4 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -2440,6 +2440,9 @@ static void dump_fill_value(hid_t dcpl,hid_t type_id, hid_t obj_id) * * Programmer: pvn * + * Modifications: pvn, March 28, 2008 + * Add a COMPRESSION ratio information for cases when filters are present + * *------------------------------------------------------------------------- */ static void @@ -2455,7 +2458,7 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) unsigned szip_pixels_per_block; hsize_t chsize[64]; /* chunk size in elements */ int rank; /* rank */ - char name[256]; /* external file name */ + char name[256]; /* external file name */ off_t offset; /* offset of external file */ hsize_t size; /* size of external file */ H5D_fill_value_t fvstatus; @@ -2467,11 +2470,12 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) unsigned j; storage_size=H5Dget_storage_size(obj_id); + nfilters = H5Pget_nfilters(dcpl_id); ioffset=H5Dget_offset(obj_id); next=H5Pget_external_count(dcpl_id); strcpy(f_name,"\0"); - /*------------------------------------------------------------------------- + /*------------------------------------------------------------------------- * STORAGE_LAYOUT *------------------------------------------------------------------------- */ @@ -2490,7 +2494,72 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) HDfprintf(stdout, ", %Hu", chsize[i]); printf(" %s\n", dump_header_format->dataspacedimend); indentation(indent + COL); - HDfprintf(stdout, "SIZE %Hu\n ", storage_size); + + + /* if there are filters, print a compression ratio */ + if ( nfilters ) + { + + hid_t sid = H5Dget_space( obj_id ); + hid_t tid = H5Dget_type( obj_id ); + size_t datum_size = H5Tget_size( tid ); + hsize_t dims[H5S_MAX_RANK]; + int ndims = H5Sget_simple_extent_dims( sid, dims, NULL); + hsize_t nelmts = 1; + hsize_t size; + double per = 0; + hssize_t a, b; + int ok = 0; + + /* only print the compression ratio for these filters */ + for ( i = 0; i < nfilters; i++) + { + cd_nelmts = NELMTS(cd_values); + filtn = H5Pget_filter2(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts, + cd_values, sizeof(f_name), f_name, NULL); + + switch (filtn) + { + case H5Z_FILTER_DEFLATE: + case H5Z_FILTER_SZIP: + case H5Z_FILTER_NBIT: + case H5Z_FILTER_SCALEOFFSET: + ok = 1; + break; + } + } + + if (ndims && ok ) + { + + for (i = 0; i < ndims; i++) + { + nelmts *= dims[i]; + } + size = nelmts * datum_size; + + a = size; b = storage_size; + if (a!=0) + per = (double) (b-a)/a; + + per = -per; + per *=100; + + HDfprintf(stdout, "SIZE %Hu (%.1f%%COMPRESSION)\n ", storage_size, per); + + } + else + HDfprintf(stdout, "SIZE %Hu\n ", storage_size); + + + H5Sclose(sid); + H5Tclose(tid); + + } + else + { + HDfprintf(stdout, "SIZE %Hu\n ", storage_size); + } /*end indent */ indent -= COL; @@ -2563,14 +2632,16 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) * FILTERS *------------------------------------------------------------------------- */ - nfilters = H5Pget_nfilters(dcpl_id); + indentation(indent + COL); printf("%s %s\n", FILTERS, BEGIN); indent += COL; - if (nfilters) { - for (i=0; i<nfilters; i++) { + if (nfilters) + { + for (i=0; i<nfilters; i++) + { cd_nelmts = NELMTS(cd_values); filtn = H5Pget_filter2(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts, cd_values, sizeof(f_name), f_name, NULL); diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index b21a020..4070425 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -5542,8 +5542,7 @@ error: * Contains: * 1) an integer dataset * 2) a float dataset - * 3) an array dataset - * 4) a large double dataset + * 4) a double dataset * *------------------------------------------------------------------------- */ @@ -5551,64 +5550,43 @@ static void gent_binary(void) { hid_t fid, sid, did, tid; - hsize_t dims[1] = {6}; - hsize_t dimarray[1] = {2}; - hsize_t dimsl[1] = {100000}; + hsize_t dims[1] = {6}; int ibuf[6] = {1,2,3,4,5,6}; float fbuf[6] = {1,2,3,4,5,6}; - int abuf[2][6] = {{1,2,3,4,5,6},{7,8,9,10,11,12}}; /* array */ - double *dbuf=NULL; + double dbuf[6] = {1,2,3,4,5,6}; fid = H5Fcreate(FILE55, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + sid = H5Screate_simple(1, dims, NULL); /*------------------------------------------------------------------------- * integer *------------------------------------------------------------------------- */ - sid = H5Screate_simple(1, dims, NULL); + did = H5Dcreate2(fid, "integer", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf); H5Dclose(did); - H5Sclose(sid); /*------------------------------------------------------------------------- * float *------------------------------------------------------------------------- */ - sid = H5Screate_simple(1, dims, NULL); did = H5Dcreate2(fid, "float", H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, fbuf); H5Dclose(did); - H5Sclose(sid); - -/*------------------------------------------------------------------------- - * array - *------------------------------------------------------------------------- - */ - tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dims); - sid = H5Screate_simple(1, dimarray, NULL); - did = H5Dcreate2(fid, "array", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, abuf); - H5Dclose(did); - H5Tclose(tid); - H5Sclose(sid); /*------------------------------------------------------------------------- * double *------------------------------------------------------------------------- */ - sid = H5Screate_simple(1, dimsl, NULL); did = H5Dcreate2(fid, "double", H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - dbuf = calloc(100000, sizeof(double)); - if(dbuf != NULL) { - H5Dwrite(did, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dbuf); - free(dbuf); - } + H5Dwrite(did, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dbuf); H5Dclose(did); - H5Sclose(sid); + /* close */ + H5Sclose(sid); H5Fclose(fid); } diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index b7b8429..1a8c18a 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -325,8 +325,7 @@ TOOLTEST tall-2B.ddl -A -r tall.h5 TOOLTEST tall-4s.ddl --dataset=/g1/g1.1/dset1.1.1 --start=1,1 --stride=2,3 --count=3,2 --block=1,1 tall.h5 TOOLTEST tall-5s.ddl -d "/g1/g1.1/dset1.1.2[0;2;10;]" tall.h5 TOOLTEST tdset-3s.ddl -d "/dset1[1,1;;;]" tdset.h5 -# block -# TOOLTEST tdset2-1s.ddl -d "/dset1[;3,2;4,4;1,4]" tdset2.h5 + # test printing characters in ASCII instead of decimal TOOLTEST tchar1.ddl -r tchar.h5 diff --git a/tools/h5import/h5import.c b/tools/h5import/h5import.c index f8f518b..d1b15bb 100755 --- a/tools/h5import/h5import.c +++ b/tools/h5import/h5import.c @@ -45,10 +45,6 @@ int main(int argc, char *argv[]) (void)HDsetvbuf(stderr, (char *) NULL, _IOLBF, 0); (void)HDsetvbuf(stdout, (char *) NULL, _IOLBF, 0); -#if defined __MWERKS__ - argc = ccommand(&argv); -#endif - if ( argv[1] && (strcmp("-V",argv[1])==0) ) { print_version("h5import"); @@ -275,7 +271,7 @@ gtoken(char *s) * Programmer: pkmat * * Modifications: pvn - * 7/23/2007. Added support for STR type + * 7/23/2007. Added support for STR type, extra parameter FILE_ID * *------------------------------------------------------------------------- */ @@ -293,12 +289,53 @@ processDataFile(char *infile, struct Input *in, FILE **strm, hid_t file_id) const char *err10 = "Unrecognized input class type.\n"; const char *err11 = "Error in reading string data.\n"; - if ((*strm = fopen(infile, "r")) == NULL) + /*------------------------------------------------------------------------- + * special case for opening binary classes in WIN32 + * "FP" denotes a floating point binary file, + * "IN" denotes a signed integer binary file, + * "UIN" denotes an unsigned integer binary file, + *------------------------------------------------------------------------- + */ + if ( in->inputClass == 4 /* "IN" */ || + in->inputClass == 3 /* "FP" */ || + in->inputClass == 7 /* "UIN" */ + + ) + { + +#ifdef WIN32 + + if ((*strm = fopen(infile, "rb")) == NULL) + { + (void) fprintf(stderr, err1, infile); + return(-1); + } +#else + + if ((*strm = fopen(infile, "r")) == NULL) + { + (void) fprintf(stderr, err1, infile); + return(-1); + } + +#endif + + } + /*------------------------------------------------------------------------- + * if the input class is not binary, just use "r" + *------------------------------------------------------------------------- + */ + else { - (void) fprintf(stderr, err1, infile); - return(-1); + if ((*strm = fopen(infile, "r")) == NULL) + { + (void) fprintf(stderr, err1, infile); + return(-1); + } } + + switch(in->inputClass) { case 0: /* TEXTIN */ @@ -372,7 +409,7 @@ readIntegerData(FILE **strm, struct Input *in) H5DT_INT8 *in08; H5DT_INT16 *in16, temp; H5DT_INT32 *in32; -#ifndef _WIN32 +#ifndef WIN32 H5DT_INT64 *in64; char buffer[256]; #endif diff --git a/tools/h5import/h5importtest.c b/tools/h5import/h5importtest.c index 2a8c827..9272632 100755 --- a/tools/h5import/h5importtest.c +++ b/tools/h5import/h5importtest.c @@ -21,271 +21,378 @@ * h5importtest * * Description: - * This program creates files that can be + * This program creates that can be * used to test the h5import program. * */ -/* - * Define names for test files - */ int main(void) { - int nrow = 3, ncol = 4, npln = 5; - int i, j, k; - FILE *sp; - + int nrow = 3, ncol = 4, npln = 5; + int i, j, k; + FILE *sp; + float b32r3[5][3][4]; float row4[3], col4[4], pln4[5]; float rowo4 = (float)11.0e0, colo4 = (float)21.0e0, plno4 = (float)51.0e0; float rowi4 = (float)1.0e0, coli4 = (float)2.0e0, plni4 = (float)5.0e0; - - int b32i3[5][3][4]; - int row4i[3], col4i[4], pln4i[5]; - int rowo4i = (int)11 , colo4i = (int)21 , plno4i = (int)51 ; - int rowi4i = (int)1 , coli4i = (int)2 , plni4i = (int)5 ; - -#ifndef _WIN32 - long_long b64i2[3][4], b64i3[5][3][4]; - long_long row4i64[3], col4i64[4], pln4i64[5]; - long_long rowo4i64 = (long_long)11 , colo4i64 = (long_long)21 , plno4i64 = (long_long)51 ; - long_long rowi4i64 = (long_long)1 , coli4i64 = (long_long)2 , plni4i64 = (long_long)5 ; + + int b32i3[5][3][4]; + int row4i[3], col4i[4], pln4i[5]; + int rowo4i = (int)11 , colo4i = (int)21 , plno4i = (int)51 ; + int rowi4i = (int)1 , coli4i = (int)2 , plni4i = (int)5 ; + +#ifndef WIN32 + long_long b64i2[3][4], b64i3[5][3][4]; + long_long row4i64[3], col4i64[4], pln4i64[5]; + long_long rowo4i64 = (long_long)11 , colo4i64 = (long_long)21 , plno4i64 = (long_long)51 ; + long_long rowi4i64 = (long_long)1 , coli4i64 = (long_long)2 , plni4i64 = (long_long)5 ; #endif - + short b16i3[5][3][4]; short row4i16[3], col4i16[4], pln4i16[5]; short rowo4i16 = (short)11 , colo4i16 = (short)21 , plno4i16 = (short)51 ; short rowi4i16 = (short)1 , coli4i16 = (short)2 , plni4i16 = (short)5 ; - - char b8i3[5][3][4]; - char row4i8[3], col4i8[4], pln4i8[5]; - char rowo4i8 = (char)11 , colo4i8 = (char)21 , plno4i8 = (char)51 ; - char rowi4i8 = (char)1 , coli4i8 = (char)2 , plni4i8 = (char)5 ; - - double b64r3[5][3][4]; - double row8[3], col8[4], pln8[5]; - double rowo8 = 11.0e0, colo8 = 21.0e0, plno8 = 51.0e0; - double rowi8 = 1.0e0, coli8 = 2.0e0, plni8 = 5.0e0; - - + + char b8i3[5][3][4]; + char row4i8[3], col4i8[4], pln4i8[5]; + char rowo4i8 = (char)11 , colo4i8 = (char)21 , plno4i8 = (char)51 ; + char rowi4i8 = (char)1 , coli4i8 = (char)2 , plni4i8 = (char)5 ; + + double b64r3[5][3][4]; + double row8[3], col8[4], pln8[5]; + double rowo8 = 11.0e0, colo8 = 21.0e0, plno8 = 51.0e0; + double rowi8 = 1.0e0, coli8 = 2.0e0, plni8 = 5.0e0; + + /* - * initialize the row, column, and plane vectors - * - * row values start at 11 and increment by 1 => 11, 12, 13 - * column values start at 21 and increment by 2 => 21, 23, 25, 27 - * plane values start at 51 and increment by 5 => 51, 56, 61, 66, 71 - */ - - + * initialize the row, column, and plane vectors + * + * row values start at 11 and increment by 1 => 11, 12, 13 + * column values start at 21 and increment by 2 => 21, 23, 25, 27 + * plane values start at 51 and increment by 5 => 51, 56, 61, 66, 71 + */ + + /* - * build array elements - rank 2 - * - * element value = sum of row value and col values - */ - + * build array elements - rank 2 + * + * element value = sum of row value and col values + */ + row4[0] = rowo4; col4[0] = colo4; pln4[0] = plno4; - + row8[0] = rowo8; col8[0] = colo8; pln8[0] = plno8; - + row4i[0] = rowo4i; col4i[0] = colo4i; pln4i[0] = plno4i; - -#ifndef _WIN32 + +#ifndef WIN32 row4i64[0] = rowo4i64; col4i64[0] = colo4i64; pln4i64[0] = plno4i64; #endif - + row4i16[0] = rowo4i16; col4i16[0] = colo4i16; pln4i16[0] = plno4i16; - + row4i8[0] = rowo4i8; col4i8[0] = colo4i8; pln4i8[0] = plno4i8; - + for (i = 1; i < nrow; i++) { row4[i] = row4[i - 1] + rowi4; row8[i] = row8[i - 1] + rowi8; row4i[i] = row4i[i - 1] + rowi4i; -#ifndef _WIN32 - row4i64[i] = row4i64[i - 1] + rowi4i64; +#ifndef WIN32 + row4i64[i] = row4i64[i - 1] + rowi4i64; #endif - row4i16[i] = row4i16[i - 1] + rowi4i16; - row4i8[i] = row4i8[i - 1] + rowi4i8; + row4i16[i] = row4i16[i - 1] + rowi4i16; + row4i8[i] = row4i8[i - 1] + rowi4i8; } for (j = 1; j < ncol; j++) { - col4[j] = col4[j - 1] + coli4; - col8[j] = col8[j - 1] + coli8; - col4i[j] = col4i[j - 1] + coli4i; -#ifndef _WIN32 - col4i64[j] = col4i64[j - 1] + coli4i64; + col4[j] = col4[j - 1] + coli4; + col8[j] = col8[j - 1] + coli8; + col4i[j] = col4i[j - 1] + coli4i; +#ifndef WIN32 + col4i64[j] = col4i64[j - 1] + coli4i64; #endif - col4i16[j] = col4i16[j - 1] + coli4i16; - col4i8[j] = col4i8[j - 1] + coli4i8; + col4i16[j] = col4i16[j - 1] + coli4i16; + col4i8[j] = col4i8[j - 1] + coli4i8; } for (k = 1; k < npln; k++) { - pln4[k] = pln4[k - 1] + plni4; - pln8[k] = pln8[k - 1] + plni8; - pln4i[k] = pln4i[k - 1] + plni4i; -#ifndef _WIN32 - pln4i64[k] = pln4i64[k - 1] + plni4i64; + pln4[k] = pln4[k - 1] + plni4; + pln8[k] = pln8[k - 1] + plni8; + pln4i[k] = pln4i[k - 1] + plni4i; +#ifndef WIN32 + pln4i64[k] = pln4i64[k - 1] + plni4i64; #endif - pln4i16[k] = pln4i16[k - 1] + plni4i16; - pln4i8[k] = pln4i8[k - 1] + plni4i8; - } - - for (i = 0; i < nrow; i++) - { - for (j = 0; j < ncol; j++) - { -#ifndef _WIN32 - b64i2[i][j] = row4i64[i] + col4i64[j]; + pln4i16[k] = pln4i16[k - 1] + plni4i16; + pln4i8[k] = pln4i8[k - 1] + plni4i8; + } + + for (i = 0; i < nrow; i++) + { + for (j = 0; j < ncol; j++) + { +#ifndef WIN32 + b64i2[i][j] = row4i64[i] + col4i64[j]; #endif - } - } + } + } /* - * build array elements - rank 3 - * - * element value = sum of row value, col, and plane values - */ - + * build array elements - rank 3 + * + * element value = sum of row value, col, and plane values + */ + for (i = 0; i < nrow; i++) - { - for (j = 0; j < ncol; j++) + { + for (j = 0; j < ncol; j++) + { + for (k = 0; k < npln; k++) { - for (k = 0; k < npln; k++) - { - b32r3[k][i][j] = row4[i] + col4[j] + pln4[k]; - b64r3[k][i][j] = row8[i] + col8[j] + pln8[k]; - b32i3[k][i][j] = row4i[i] + col4i[j] + pln4i[k]; -#ifndef _WIN32 - b64i3[k][i][j] = row4i64[i] + col4i64[j] + pln4i64[k]; + b32r3[k][i][j] = row4[i] + col4[j] + pln4[k]; + b64r3[k][i][j] = row8[i] + col8[j] + pln8[k]; + b32i3[k][i][j] = row4i[i] + col4i[j] + pln4i[k]; +#ifndef WIN32 + b64i3[k][i][j] = row4i64[i] + col4i64[j] + pln4i64[k]; #endif - b16i3[k][i][j] = row4i16[i] + col4i16[j] + pln4i16[k]; - b8i3[k][i][j] = row4i8[i] + col4i8[j] + pln4i8[k]; - } + b16i3[k][i][j] = row4i16[i] + col4i16[j] + pln4i16[k]; + b8i3[k][i][j] = row4i8[i] + col4i8[j] + pln4i8[k]; } - } + } + } - /* - * binary 32-bit file - rank 2 & 3 - */ + #ifndef UNICOS - sp = fopen("txtin16", "w"); - for (k = 0; k < npln; k++) - for (i = 0; i < nrow; i++) + + /*------------------------------------------------------------------------- + * TOOLTEST txtin16.txt -c $srcdir/testfiles/txtin16.conf -o txtin16.h5 + *------------------------------------------------------------------------- + */ + + + sp = fopen("txtin16.txt", "w"); + for (k = 0; k < npln; k++) + { + for (i = 0; i < nrow; i++) { - for (j = 0; j < ncol; j++) - (void) fprintf(sp, "%10u", b16i3[k][i][j]); - (void) fprintf(sp, "\n"); + for (j = 0; j < ncol; j++) + (void) fprintf(sp, "%10u", b16i3[k][i][j]); + (void) fprintf(sp, "\n"); } + } (void) fclose(sp); - sp = fopen("txtin32", "w"); - for (k = 0; k < npln; k++) - for (i = 0; i < nrow; i++) + /*------------------------------------------------------------------------- + * TOOLTEST txtin32.txt -c $srcdir/testfiles/textin32.conf -o textin32.h5 + *------------------------------------------------------------------------- + */ + + sp = fopen("txtin32.txt", "w"); + for (k = 0; k < npln; k++) + { + for (i = 0; i < nrow; i++) { - for (j = 0; j < ncol; j++) - (void) fprintf(sp, "%10d", b32i3[k][i][j]); - (void) fprintf(sp, "\n"); + for (j = 0; j < ncol; j++) + (void) fprintf(sp, "%10d", b32i3[k][i][j]); + (void) fprintf(sp, "\n"); } - (void) fclose(sp); + } + (void) fclose(sp); + + /*------------------------------------------------------------------------- + * TOOLTEST binin32.bin -c $srcdir/testfiles/binin32.conf -o binin32.h5 + *------------------------------------------------------------------------- + */ - sp = fopen("bin32", "w"); +#ifdef WIN32 + sp = fopen("binin32.bin", "wb"); +#else + sp = fopen("binin32.bin", "w"); +#endif for (k = 0; k < npln; k++) - for (i = 0; i < nrow; i++) - for (j = 0; j < ncol; j++) - (void) fwrite((char *) &b32i3[k][i][j], sizeof(int), 1, sp); + { + for (i = 0; i < nrow; i++) + { + for (j = 0; j < ncol; j++) + { + (void) fwrite((char *) &b32i3[k][i][j], sizeof(int), 1, sp); + } + } + } (void) fclose(sp); + /*------------------------------------------------------------------------- + * TOOLTEST binuin32.bin -c $srcdir/testfiles/binuin32.conf -o binuin32.h5 + *------------------------------------------------------------------------- + */ - sp = fopen("buin32", "w"); +#ifdef WIN32 + sp = fopen("binuin32.bin", "wb"); +#else + sp = fopen("binuin32.bin", "w"); +#endif for (k = 0; k < npln; k++) - for (i = 0; i < nrow; i++) - for (j = 0; j < ncol; j++) - (void) fwrite((char *) &b32i3[k][i][j], sizeof(unsigned int), 1, sp); + { + for (i = 0; i < nrow; i++) + { + for (j = 0; j < ncol; j++) + { + (void) fwrite((char *) &b32i3[k][i][j], sizeof(unsigned int), 1, sp); + } + } + } (void) fclose(sp); -#ifndef _WIN32 - sp = fopen("bin64-2", "w"); - for (i = 0; i < nrow; i++) - for (j = 0; j < ncol; j++) - (void) fwrite((char *) &b64i2[i][j], sizeof(long_long), 1, sp); - (void) fclose(sp); -#endif - sp = fopen("bfp32", "w"); + + /*------------------------------------------------------------------------- + * TOOLTEST binin16.bin -c $srcdir/testfiles/binin16.conf -o binin16.h5 + *------------------------------------------------------------------------- + */ + +#ifdef WIN32 + sp = fopen("binin16.bin", "wb"); +#else + sp = fopen("binin16.bin", "w"); +#endif for (k = 0; k < npln; k++) + { for (i = 0; i < nrow; i++) + { for (j = 0; j < ncol; j++) - (void) fwrite((char *) &b32r3[k][i][j], - sizeof(float), 1, sp); + { + (void) fwrite((char *) &b16i3[k][i][j], sizeof(short), 1, sp); + } + } + } (void) fclose(sp); - sp = fopen("bin16", "w"); - for (k = 0; k < npln; k++) - for (i = 0; i < nrow; i++) - for (j = 0; j < ncol; j++) - (void) fwrite((char *) &b16i3[k][i][j], sizeof(short), 1, - sp); + /*------------------------------------------------------------------------- + * TOOLTEST binuin16.bin -c $srcdir/testfiles/binuin16.conf -o binuin16.h5 + *------------------------------------------------------------------------- + */ +#ifdef WIN32 + sp = fopen("binuin16.bin", "wb"); +#else + sp = fopen("binuin16.bin", "w"); +#endif + for (k = 0; k < npln; k++) + { + for (i = 0; i < nrow; i++) + { + for (j = 0; j < ncol; j++) + { + (void) fwrite((char *) &b16i3[k][i][j], sizeof(unsigned short), 1, sp); + } + } + } (void) fclose(sp); - sp = fopen("buin16", "w"); - for (k = 0; k < npln; k++) - for (i = 0; i < nrow; i++) - for (j = 0; j < ncol; j++) - (void) fwrite((char *) &b16i3[k][i][j], sizeof(unsigned short), 1, - sp); - (void) fclose(sp); -#ifndef _WIN32 - sp = fopen("bin64-3", "w"); - for (k = 0; k < npln; k++) - for (i = 0; i < nrow; i++) - for (j = 0; j < ncol; j++) - (void) fwrite((char *) &b64i3[k][i][j], sizeof(long_long), 1, - sp); - (void) fclose(sp); -#endif + /*------------------------------------------------------------------------- + * TOOLTEST binin8.bin -c $srcdir/testfiles/binin8.conf -o binin8.h5 + *------------------------------------------------------------------------- + */ - sp = fopen("bin8", "w"); +#ifdef WIN32 + sp = fopen("binin8.bin", "wb"); +#else + sp = fopen("binin8.bin", "w"); +#endif for (k = 0; k < npln; k++) - for (i = 0; i < nrow; i++) - for (j = 0; j < ncol; j++) - (void) fwrite((char *) &b8i3[k][i][j], sizeof(char), 1, - sp); + { + for (i = 0; i < nrow; i++) + { + for (j = 0; j < ncol; j++) + { + (void) fwrite((char *) &b8i3[k][i][j], sizeof(char), 1, sp); + } + } + } (void) fclose(sp); -#endif +#endif /* UNICOS */ - /* - * binary 64-bit file - rank 2 & 3 - */ - sp = fopen("bfp64", "w"); + + + /*------------------------------------------------------------------------- + * TOOLTEST binfp64.bin -c $srcdir/testfiles/binfp64.conf -o binfp64.h5 + *------------------------------------------------------------------------- + */ + + /* + * binary 64-bit file - rank 2 & 3 + */ + +#ifdef WIN32 + sp = fopen("binfp64.bin", "wb"); +#else + sp = fopen("binfp64.bin", "w"); +#endif for (k = 0; k < npln; k++) + { for (i = 0; i < nrow; i++) + { for (j = 0; j < ncol; j++) - (void) fwrite((char *) &b64r3[k][i][j], - sizeof(double), 1, sp); + { + (void) fwrite((char *) &b64r3[k][i][j], sizeof(double), 1, sp); + } + } + } (void) fclose(sp); + + + + /*------------------------------------------------------------------------- + * TOOLTEST binin8w.bin -c $srcdir/testfiles/binin8w.conf -o binin8w.h5 + *------------------------------------------------------------------------- + */ + + { + /* test CR+LF (13,10) and EOF (26) in windows */ + char bin8w[4] = {13,10,26,0}; + +#ifdef WIN32 + sp = fopen("binin8w.bin", "wb"); +#else + sp = fopen("binin8w.bin", "w"); +#endif + for (i = 0; i < 4; i++) + { + char c = bin8w[i]; + if ( fwrite( &c, sizeof(char), 1, sp) != 1 ) + printf("error writing file\n"); + } + fclose(sp); + + + } + + + + + return (0); } diff --git a/tools/h5import/h5importtestutil.sh b/tools/h5import/h5importtestutil.sh index 0687871..ff7dc35 100755 --- a/tools/h5import/h5importtestutil.sh +++ b/tools/h5import/h5importtestutil.sh @@ -60,49 +60,72 @@ cp $srcdir/testfiles/*.h5 tmp_testfiles/ $RUNSERIAL ./h5importtest TESTING "ASCII I32 rank 3 - Output BE " ; -TOOLTEST txtin32 -c $srcdir/testfiles/textin32 -o test1.h5 +#TOOLTEST txtin32 -c $srcdir/testfiles/textin32 -o test1.h5 +TOOLTEST $srcdir/testfiles/txtin16.txt -c $srcdir/testfiles/txtin32.conf -o txtin32.h5 TESTING "ASCII I16 rank 3 - Output LE - CHUNKED - extended" -TOOLTEST txtin16 -c $srcdir/testfiles/textin16 -o test2.h5 +#TOOLTEST txtin16 -c $srcdir/testfiles/textin16 -o test2.h5 +TOOLTEST $srcdir/testfiles/txtin16.txt -c $srcdir/testfiles/txtin16.conf -o txtin16.h5 + TESTING "ASCII I8 - rank 3 - Output I16 LE-Chunked+Extended+Compressed " -TOOLTEST txtin16 -c $srcdir/testfiles/textin8 -o test3.h5 +#TOOLTEST txtin16 -c $srcdir/testfiles/textin8 -o test3.h5 +TOOLTEST $srcdir/testfiles/txtin16.txt -c $srcdir/testfiles/txtin8.conf -o txtin8.h5 TESTING "ASCII UI32 - rank 3 - Output BE" -TOOLTEST $srcdir/testfiles/in1 -c $srcdir/testfiles/textuin32 -o test4.h5 +#TOOLTEST $srcdir/testfiles/in1 -c $srcdir/testfiles/textuin32 -o test4.h5 +TOOLTEST $srcdir/testfiles/txtuin32.txt -c $srcdir/testfiles/txtuin32.conf -o txtuin32.h5 TESTING "ASCII UI16 - rank 2 - Output LE+Chunked+Compressed " -TOOLTEST $srcdir/testfiles/in1 -c $srcdir/testfiles/textuin16 -o test5.h5 +#TOOLTEST $srcdir/testfiles/in1 -c $srcdir/testfiles/textuin16 -o test5.h5 +TOOLTEST $srcdir/testfiles/txtuin32.txt -c $srcdir/testfiles/txtuin16.conf -o txtuin16.h5 TESTING "ASCII F32 - rank 3 - Output LE " -TOOLTEST $srcdir/testfiles/fp1 -c $srcdir/testfiles/textfp32 -o test6.h5 +#TOOLTEST $srcdir/testfiles/fp1 -c $srcdir/testfiles/textfp32 -o test6.h5 +TOOLTEST $srcdir/testfiles/txtfp32.txt -c $srcdir/testfiles/txtfp32.conf -o txtfp32.h5 + TESTING "ASCII F64 - rank 3 - Output BE + CHUNKED+Extended+Compressed " -TOOLTEST $srcdir/testfiles/fp2 -c $srcdir/testfiles/textfp64 -o test7.h5 +#TOOLTEST $srcdir/testfiles/fp2 -c $srcdir/testfiles/textfp64 -o test7.h5 +TOOLTEST $srcdir/testfiles/txtfp64.txt -c $srcdir/testfiles/txtfp64.conf -o txtfp64.h5 TESTING "BINARY F64 - rank 3 - Output LE+CHUNKED+Extended+Compressed " -TOOLTEST bfp64 -c $srcdir/testfiles/conbfp64 -o test8.h5 +#TOOLTEST bfp64 -c $srcdir/testfiles/conbfp64 -o test8.h5 +TOOLTEST binfp64.bin -c $srcdir/testfiles/binfp64.conf -o binfp64.h5 + TESTING "BINARY I16 - rank 3 - Output order LE + CHUNKED + extended " -TOOLTEST bin16 -c $srcdir/testfiles/conbin16 -o test9.h5 +#TOOLTEST bin16 -c $srcdir/testfiles/conbin16 -o test9.h5 +TOOLTEST binin16.bin -c $srcdir/testfiles/binin16.conf -o binin16.h5 + TESTING "BINARY I8 - rank 3 - Output I16LE + Chunked+Extended+Compressed " -TOOLTEST bin8 -c $srcdir/testfiles/conbin8 -o test10.h5 +#TOOLTEST bin8 -c $srcdir/testfiles/conbin8 -o test10.h5 +TOOLTEST binin8.bin -c $srcdir/testfiles/binin8.conf -o binin8.h5 + TESTING "BINARY I32 - rank 3 - Output BE + CHUNKED " -TOOLTEST bin32 -c $srcdir/testfiles/conbin32 -o test11.h5 +#TOOLTEST bin32 -c $srcdir/testfiles/conbin32 -o test11.h5 +TOOLTEST binin32.bin -c $srcdir/testfiles/binin32.conf -o binin32.h5 + TESTING "BINARY UI16 - rank 3 - Output byte BE + CHUNKED " -TOOLTEST buin16 -c $srcdir/testfiles/conbuin16 -o test12.h5 +#TOOLTEST buin16 -c $srcdir/testfiles/conbuin16 -o test12.h5 +TOOLTEST binuin16.bin -c $srcdir/testfiles/binuin16.conf -o binuin16.h5 TESTING "BINARY UI32 - rank 3 - Output LE + CHUNKED " -TOOLTEST buin32 -c $srcdir/testfiles/conbuin32 -o test13.h5 +#TOOLTEST buin32 -c $srcdir/testfiles/conbuin32 -o test13.h5 +TOOLTEST binuin32.bin -c $srcdir/testfiles/binuin32.conf -o binuin32.h5 + TESTING "STR" -TOOLTEST $srcdir/testfiles/txtstr -c $srcdir/testfiles/textstr -o teststr.h5 +TOOLTEST $srcdir/testfiles/txtstr.txt -c $srcdir/testfiles/txtstr.conf -o txtstr.h5 + +TESTING "BINARY I8 CR LF EOF" +TOOLTEST binin8w.bin -c $srcdir/testfiles/binin8w.conf -o binin8w.h5 + -rm -f tx* b* *.dat -rm -f test*.h5 +rm -f *.txt *.bin *.h5 rm -rf tmp_testfiles else echo "** h5import or h5importtest not available ***" diff --git a/tools/h5import/testfiles/conbfp64 b/tools/h5import/testfiles/binfp64.conf index 6b4c361..6b4c361 100755 --- a/tools/h5import/testfiles/conbfp64 +++ b/tools/h5import/testfiles/binfp64.conf diff --git a/tools/h5import/testfiles/test8.h5 b/tools/h5import/testfiles/binfp64.h5 Binary files differindex 80e3a8a..80e3a8a 100644 --- a/tools/h5import/testfiles/test8.h5 +++ b/tools/h5import/testfiles/binfp64.h5 diff --git a/tools/h5import/testfiles/conbin16 b/tools/h5import/testfiles/binin16.conf index 06869cb..06869cb 100755 --- a/tools/h5import/testfiles/conbin16 +++ b/tools/h5import/testfiles/binin16.conf diff --git a/tools/h5import/testfiles/test9.h5 b/tools/h5import/testfiles/binin16.h5 Binary files differindex 0825bbc..0825bbc 100644 --- a/tools/h5import/testfiles/test9.h5 +++ b/tools/h5import/testfiles/binin16.h5 diff --git a/tools/h5import/testfiles/conbin32 b/tools/h5import/testfiles/binin32.conf index 11996ef..11996ef 100755 --- a/tools/h5import/testfiles/conbin32 +++ b/tools/h5import/testfiles/binin32.conf diff --git a/tools/h5import/testfiles/test11.h5 b/tools/h5import/testfiles/binin32.h5 Binary files differindex fd8faa9..fd8faa9 100644 --- a/tools/h5import/testfiles/test11.h5 +++ b/tools/h5import/testfiles/binin32.h5 diff --git a/tools/h5import/testfiles/conbin8 b/tools/h5import/testfiles/binin8.conf index 1edd80a..1edd80a 100755 --- a/tools/h5import/testfiles/conbin8 +++ b/tools/h5import/testfiles/binin8.conf diff --git a/tools/h5import/testfiles/test10.h5 b/tools/h5import/testfiles/binin8.h5 Binary files differindex a1d1a37..a1d1a37 100644 --- a/tools/h5import/testfiles/test10.h5 +++ b/tools/h5import/testfiles/binin8.h5 diff --git a/tools/h5import/testfiles/binin8w.conf b/tools/h5import/testfiles/binin8w.conf new file mode 100644 index 0000000..fccb4ac --- /dev/null +++ b/tools/h5import/testfiles/binin8w.conf @@ -0,0 +1,9 @@ + +INPUT-CLASS IN +INPUT-SIZE 8 +RANK 1 +DIMENSION-SIZES 4 +OUTPUT-BYTE-ORDER LE +OUTPUT-CLASS IN +OUTPUT-SIZE 8 +OUTPUT-ARCHITECTURE STD diff --git a/tools/h5import/testfiles/binin8w.h5 b/tools/h5import/testfiles/binin8w.h5 Binary files differnew file mode 100644 index 0000000..64acaed --- /dev/null +++ b/tools/h5import/testfiles/binin8w.h5 diff --git a/tools/h5import/testfiles/conbuin16 b/tools/h5import/testfiles/binuin16.conf index a4603df..a4603df 100755 --- a/tools/h5import/testfiles/conbuin16 +++ b/tools/h5import/testfiles/binuin16.conf diff --git a/tools/h5import/testfiles/test12.h5 b/tools/h5import/testfiles/binuin16.h5 Binary files differindex c486c89..c486c89 100644 --- a/tools/h5import/testfiles/test12.h5 +++ b/tools/h5import/testfiles/binuin16.h5 diff --git a/tools/h5import/testfiles/conbuin32 b/tools/h5import/testfiles/binuin32.conf index a649e97..a649e97 100755 --- a/tools/h5import/testfiles/conbuin32 +++ b/tools/h5import/testfiles/binuin32.conf diff --git a/tools/h5import/testfiles/test13.h5 b/tools/h5import/testfiles/binuin32.h5 Binary files differindex 41699d7..41699d7 100644 --- a/tools/h5import/testfiles/test13.h5 +++ b/tools/h5import/testfiles/binuin32.h5 diff --git a/tools/h5import/testfiles/conbfp32 b/tools/h5import/testfiles/conbfp32 deleted file mode 100755 index 66e6b35..0000000 --- a/tools/h5import/testfiles/conbfp32 +++ /dev/null @@ -1,12 +0,0 @@ -PATH /fpbin/32-bit -INPUT-CLASS FP -INPUT-SIZE 32 -RANK 3 -DIMENSION-SIZES 5 3 4 -OUTPUT-ARCHITECTURE IEEE -OUTPUT-BYTE-ORDER BE -CHUNKED-DIMENSION-SIZES 2 2 2 -COMPRESSION-PARAM 2 - - - diff --git a/tools/h5import/testfiles/textfp32 b/tools/h5import/testfiles/txtfp32.conf index 9696a7f..9696a7f 100755 --- a/tools/h5import/testfiles/textfp32 +++ b/tools/h5import/testfiles/txtfp32.conf diff --git a/tools/h5import/testfiles/test6.h5 b/tools/h5import/testfiles/txtfp32.h5 Binary files differindex f74e003..f74e003 100644 --- a/tools/h5import/testfiles/test6.h5 +++ b/tools/h5import/testfiles/txtfp32.h5 diff --git a/tools/h5import/testfiles/fp1 b/tools/h5import/testfiles/txtfp32.txt index 142c94f..142c94f 100755 --- a/tools/h5import/testfiles/fp1 +++ b/tools/h5import/testfiles/txtfp32.txt diff --git a/tools/h5import/testfiles/textfp64 b/tools/h5import/testfiles/txtfp64.conf index fbab6a6..fbab6a6 100755 --- a/tools/h5import/testfiles/textfp64 +++ b/tools/h5import/testfiles/txtfp64.conf diff --git a/tools/h5import/testfiles/test7.h5 b/tools/h5import/testfiles/txtfp64.h5 Binary files differindex b6ba4f5..b6ba4f5 100644 --- a/tools/h5import/testfiles/test7.h5 +++ b/tools/h5import/testfiles/txtfp64.h5 diff --git a/tools/h5import/testfiles/fp2 b/tools/h5import/testfiles/txtfp64.txt index 6c83dc3..6c83dc3 100755 --- a/tools/h5import/testfiles/fp2 +++ b/tools/h5import/testfiles/txtfp64.txt diff --git a/tools/h5import/testfiles/textin16 b/tools/h5import/testfiles/txtin16.conf index d2d11c3..d2d11c3 100755 --- a/tools/h5import/testfiles/textin16 +++ b/tools/h5import/testfiles/txtin16.conf diff --git a/tools/h5import/testfiles/test2.h5 b/tools/h5import/testfiles/txtin16.h5 Binary files differindex dc6c1ea..dc6c1ea 100644 --- a/tools/h5import/testfiles/test2.h5 +++ b/tools/h5import/testfiles/txtin16.h5 diff --git a/tools/h5import/testfiles/in1 b/tools/h5import/testfiles/txtin16.txt index 0688e9b..0688e9b 100755..100644 --- a/tools/h5import/testfiles/in1 +++ b/tools/h5import/testfiles/txtin16.txt diff --git a/tools/h5import/testfiles/textin32 b/tools/h5import/testfiles/txtin32.conf index ca4802a..ca4802a 100755 --- a/tools/h5import/testfiles/textin32 +++ b/tools/h5import/testfiles/txtin32.conf diff --git a/tools/h5import/testfiles/test1.h5 b/tools/h5import/testfiles/txtin32.h5 Binary files differindex 350333c..350333c 100644 --- a/tools/h5import/testfiles/test1.h5 +++ b/tools/h5import/testfiles/txtin32.h5 diff --git a/tools/h5import/testfiles/txtin32.txt b/tools/h5import/testfiles/txtin32.txt new file mode 100644 index 0000000..0688e9b --- /dev/null +++ b/tools/h5import/testfiles/txtin32.txt @@ -0,0 +1,15 @@ + 83 85 87 89 + 84 86 88 90 + 85 87 89 91 + 88 90 92 94 + 89 91 93 95 + 90 92 94 96 + 93 95 97 99 + 94 96 98 100 + 95 97 99 101 + 98 100 102 104 + 99 101 103 105 + 100 102 104 106 + 103 105 107 109 + 104 106 108 110 + 105 107 109 111 diff --git a/tools/h5import/testfiles/textin8 b/tools/h5import/testfiles/txtin8.conf index 4405338..4405338 100755 --- a/tools/h5import/testfiles/textin8 +++ b/tools/h5import/testfiles/txtin8.conf diff --git a/tools/h5import/testfiles/test3.h5 b/tools/h5import/testfiles/txtin8.h5 Binary files differindex 42e7727..42e7727 100644 --- a/tools/h5import/testfiles/test3.h5 +++ b/tools/h5import/testfiles/txtin8.h5 diff --git a/tools/h5import/testfiles/textstr b/tools/h5import/testfiles/txtstr.conf index 85079e0..85079e0 100644 --- a/tools/h5import/testfiles/textstr +++ b/tools/h5import/testfiles/txtstr.conf diff --git a/tools/h5import/testfiles/teststr.h5 b/tools/h5import/testfiles/txtstr.h5 Binary files differindex ceb0810..ceb0810 100644 --- a/tools/h5import/testfiles/teststr.h5 +++ b/tools/h5import/testfiles/txtstr.h5 diff --git a/tools/h5import/testfiles/txtstr b/tools/h5import/testfiles/txtstr.txt index 25be0a6..25be0a6 100644 --- a/tools/h5import/testfiles/txtstr +++ b/tools/h5import/testfiles/txtstr.txt diff --git a/tools/h5import/testfiles/textuin16 b/tools/h5import/testfiles/txtuin16.conf index 753e6e8..753e6e8 100755 --- a/tools/h5import/testfiles/textuin16 +++ b/tools/h5import/testfiles/txtuin16.conf diff --git a/tools/h5import/testfiles/test5.h5 b/tools/h5import/testfiles/txtuin16.h5 Binary files differindex 9ee166a..9ee166a 100644 --- a/tools/h5import/testfiles/test5.h5 +++ b/tools/h5import/testfiles/txtuin16.h5 diff --git a/tools/h5import/testfiles/textuin32 b/tools/h5import/testfiles/txtuin32.conf index d61e1a1..d61e1a1 100755 --- a/tools/h5import/testfiles/textuin32 +++ b/tools/h5import/testfiles/txtuin32.conf diff --git a/tools/h5import/testfiles/test4.h5 b/tools/h5import/testfiles/txtuin32.h5 Binary files differindex 1a4dda5..1a4dda5 100644 --- a/tools/h5import/testfiles/test4.h5 +++ b/tools/h5import/testfiles/txtuin32.h5 diff --git a/tools/h5import/testfiles/txtuin32.txt b/tools/h5import/testfiles/txtuin32.txt new file mode 100755 index 0000000..0688e9b --- /dev/null +++ b/tools/h5import/testfiles/txtuin32.txt @@ -0,0 +1,15 @@ + 83 85 87 89 + 84 86 88 90 + 85 87 89 91 + 88 90 92 94 + 89 91 93 95 + 90 92 94 96 + 93 95 97 99 + 94 96 98 100 + 95 97 99 101 + 98 100 102 104 + 99 101 103 105 + 100 102 104 106 + 103 105 107 109 + 104 106 108 110 + 105 107 109 111 diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c index 954f3e7..febf7d7 100644 --- a/tools/h5repack/h5repack.c +++ b/tools/h5repack/h5repack.c @@ -45,7 +45,7 @@ static int have_request(pack_opt_t *options); * Purpose: locate all high-level HDF5 objects in the file * and compress/chunk them using options * - * Algorythm: 2 traversals are made to the file; the 1st builds a list of + * Algorithm: 2 traversals are made to the file; the 1st builds a list of * the objects, the 2nd makes a copy of them, using the options; * the reason for the 1st traversal is to check for invalid * object name requests diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h index baa888e..80fb1b0 100644 --- a/tools/h5repack/h5repack.h +++ b/tools/h5repack/h5repack.h @@ -19,17 +19,12 @@ #include "hdf5.h" #include "h5trav.h" -#include "H5Zprivate.h" /* H5Z_COMMON_CD_VALUES */ - - #define H5FOPENERROR "unable to open file" - -#define PFORMAT "%-7s %-7s %-7s\n" /*chunk info, compression info, name*/ -#define PFORMAT1 "%-7s %-7s %-7s" /*chunk info, compression info, name*/ - -#define MAX_NC_NAME 256 /* max length of a name */ -#define MAX_VAR_DIMS 32 /* max per variable dimensions */ +#define PFORMAT "%-7s %-7s %-7s\n" /* chunk info, compression info, name*/ +#define PFORMAT1 "%-7s %-7s %-7s" /* chunk info, compression info, name*/ +#define MAX_NC_NAME 256 /* max length of a name */ +#define MAX_VAR_DIMS 32 /* max per variable dimensions */ /*------------------------------------------------------------------------- * data structures for command line options @@ -53,7 +48,6 @@ typedef struct { H5Z_FILTER_SCALEOFFSET 6 , scaleoffset compression */ -/* #define CD_VALUES H5Z_COMMON_CD_VALUES */ #define CD_VALUES 20 typedef struct { diff --git a/tools/h5stat/h5stat_gentest.c b/tools/h5stat/h5stat_gentest.c index 28d20ce..ef644d8 100644 --- a/tools/h5stat/h5stat_gentest.c +++ b/tools/h5stat/h5stat_gentest.c @@ -29,7 +29,7 @@ #define DATASET_NAME "DATASET_NAME" #define GROUP_NAME "GROUP" #define ATTR_NAME "ATTR" -#define NUM_GRPS 350 +#define NUM_GRPS 35000 #define NUM_ATTRS 100 /* diff --git a/tools/h5stat/testfiles/h5stat_newgrat.ddl b/tools/h5stat/testfiles/h5stat_newgrat.ddl index 6881ca9..d704f00 100644 --- a/tools/h5stat/testfiles/h5stat_newgrat.ddl +++ b/tools/h5stat/testfiles/h5stat_newgrat.ddl @@ -3,20 +3,20 @@ Expected output for 'h5stat h5stat_newgrat.h5' ############################# Filename: h5stat_newgrat.h5 File information - # of unique groups: 351 + # of unique groups: 35001 # of unique datasets: 1 # of unique named dataypes: 0 # of unique links: 0 # of unique other: 0 Max. # of links to object: 1 - Max. # of objects in group: 351 + Max. # of objects in group: 35001 Object header size: (total/unused) - Groups: 51597/32292 + Groups: 5145147/3220092 Datasets: 414/312 Storage information: Groups: - B-tree/List: 5158 - Heap: 7643 + B-tree/List: 470054 + Heap: 739128 Attributes: B-tree/List: 2598 Heap: 4442 @@ -28,12 +28,12 @@ Storage information: Heap: 0 Superblock extension: 0 Small groups: - # of groups of size 0: 350 - Total # of small groups: 350 + # of groups of size 0: 35000 + Total # of small groups: 35000 Group bins: - # of groups of size 0: 350 - # of groups of size 100 - 999: 1 - Total # of groups: 351 + # of groups of size 0: 35000 + # of groups of size 10000 - 99999: 1 + Total # of groups: 35001 Dataset dimension information: Max. rank of datasets: 0 Dataset ranks: diff --git a/tools/h5stat/testfiles/h5stat_newgrat.h5 b/tools/h5stat/testfiles/h5stat_newgrat.h5 Binary files differindex cab98bb..8083122 100644 --- a/tools/h5stat/testfiles/h5stat_newgrat.h5 +++ b/tools/h5stat/testfiles/h5stat_newgrat.h5 diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 4f4074f..9d64e44 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -47,7 +47,7 @@ int print_objname (diff_opt_t * options, hsize_t nfound) { - return ((options->m_verbose || nfound) && !options->m_quiet) ? 1 : 0; + return ((options->m_verbose || nfound) && !options->m_quiet) ? 1 : 0; } /*------------------------------------------------------------------------- @@ -186,15 +186,17 @@ hsize_t h5diff(const char *fname1, const char *objname2, diff_opt_t *options) { - trav_info_t *info1; - trav_info_t *info2; - hid_t file1_id = (-1), file2_id = (-1); + trav_info_t *info1=NULL; + trav_info_t *info2=NULL; + hid_t file1_id = (-1); + hid_t file2_id = (-1); char filenames[2][1024]; hsize_t nfound = 0; HDmemset(filenames, 0, 1024 * 2); - if(options->m_quiet && (options->m_verbose || options->m_report)) { + if(options->m_quiet && (options->m_verbose || options->m_report)) + { printf("Error: -q (quiet mode) cannot be added to verbose or report modes\n"); options->err_stat=1; return 0; @@ -206,9 +208,11 @@ hsize_t h5diff(const char *fname1, */ /* disable error reporting */ - H5E_BEGIN_TRY { - /* Open the files */ - if((file1_id = H5Fopen(fname1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) { + H5E_BEGIN_TRY + { + /* open the files */ + if((file1_id = H5Fopen(fname1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) + { printf("h5diff: <%s>: unable to open file\n", fname1); options->err_stat = 1; @@ -219,7 +223,8 @@ hsize_t h5diff(const char *fname1, #endif goto out; } /* end if */ - if((file2_id = H5Fopen(fname2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) { + if((file2_id = H5Fopen(fname2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) + { printf("h5diff: <%s>: unable to open file\n", fname2); options->err_stat = 1; @@ -255,11 +260,12 @@ hsize_t h5diff(const char *fname1, goto out; } /* end if */ - /*------------------------------------------------------------------------- + /*------------------------------------------------------------------------- * object name was supplied *------------------------------------------------------------------------- */ - if(objname1) { + if( objname1 ) + { #ifdef H5_HAVE_PARALLEL if(g_Parallel) /* Let tasks know that they won't be needed */ @@ -267,22 +273,31 @@ hsize_t h5diff(const char *fname1, #endif assert(objname2); options->cmn_objs = 1; /* eliminate warning */ - nfound = diff_compare(file1_id, fname1, objname1, info1, - file2_id, fname2, objname2, info2, + nfound = diff_compare(file1_id, + fname1, + objname1, + info1, + file2_id, + fname2, + objname2, + info2, options); } /* end if */ - /*------------------------------------------------------------------------- + /*------------------------------------------------------------------------- * compare all *------------------------------------------------------------------------- */ - else { + else + { #ifdef H5_HAVE_PARALLEL - if(g_Parallel) { + if(g_Parallel) + { int i; - if((HDstrlen(fname1) > 1024) || (HDstrlen(fname2) > 1024)) { + if((HDstrlen(fname1) > 1024) || (HDstrlen(fname2) > 1024)) + { fprintf(stderr, "The parallel diff only supports path names up to 1024 characters\n"); MPI_Abort(MPI_COMM_WORLD, 0); } /* end if */ @@ -295,7 +310,12 @@ hsize_t h5diff(const char *fname1, MPI_Send(filenames, (1024 * 2), MPI_CHAR, i, MPI_TAG_PARALLEL, MPI_COMM_WORLD); } /* end if */ #endif - nfound = diff_match(file1_id, info1, file2_id, info2, options); + + nfound = diff_match(file1_id, + info1, + file2_id, + info2, + options); } /* end else */ trav_info_free(info1); @@ -303,7 +323,8 @@ hsize_t h5diff(const char *fname1, out: /* close */ - H5E_BEGIN_TRY { + H5E_BEGIN_TRY + { H5Fclose(file1_id); H5Fclose(file2_id); } H5E_END_TRY; @@ -332,22 +353,23 @@ out: *------------------------------------------------------------------------- */ hsize_t diff_match(hid_t file1_id, - trav_info_t * info1, - hid_t file2_id, - trav_info_t * info2, - diff_opt_t * options) + trav_info_t *info1, + hid_t file2_id, + trav_info_t *info2, + diff_opt_t *options) { trav_table_t *table = NULL; - size_t curr1, curr2; - unsigned infile[2]; - hsize_t nfound = 0; - unsigned i; + size_t curr1; + size_t curr2; + unsigned infile[2]; + hsize_t nfound = 0; + unsigned i; /*------------------------------------------------------------------------- * build the list *------------------------------------------------------------------------- */ - trav_table_init(&table); + trav_table_init( &table ); curr1 = 0; curr2 = 0; @@ -393,11 +415,12 @@ hsize_t diff_match(hid_t file1_id, curr2++; } /* end while */ - /*------------------------------------------------------------------------- + /*------------------------------------------------------------------------- * print the list *------------------------------------------------------------------------- */ - if(options->m_verbose) { + if(options->m_verbose) + { printf("\n"); printf("file1 file2\n"); printf("---------------------------------------\n"); @@ -702,59 +725,64 @@ hsize_t diff_match(hid_t file1_id, *------------------------------------------------------------------------- */ -hsize_t diff_compare (hid_t file1_id, - const char *file1_name, - const char *obj1_name, - trav_info_t * info1, - hid_t file2_id, - const char *file2_name, - const char *obj2_name, - trav_info_t * info2, - diff_opt_t * options) +hsize_t diff_compare(hid_t file1_id, + const char *file1_name, + const char *obj1_name, + trav_info_t *info1, + hid_t file2_id, + const char *file2_name, + const char *obj2_name, + trav_info_t *info2, + diff_opt_t *options) { - int f1 = 0, f2 = 0; - hsize_t nfound = 0; - - ssize_t i = h5trav_getindex (info1, obj1_name); - ssize_t j = h5trav_getindex (info2, obj2_name); - - if (i == -1) - { - parallel_print ("Object <%s> could not be found in <%s>\n", obj1_name, - file1_name); - f1 = 1; - } - if (j == -1) - { - parallel_print ("Object <%s> could not be found in <%s>\n", obj2_name, - file2_name); - f2 = 1; - } - if (f1 || f2) - { - options->err_stat = 1; - return 0; - } - - /* use the name with "/" first, as obtained by iterator function */ - obj1_name = info1->paths[i].path; - obj2_name = info2->paths[j].path; - - /* objects are not the same type */ - if (info1->paths[i].type != info2->paths[j].type) - { - if (options->m_verbose) - parallel_print("Comparison not possible: <%s> is of type %s and <%s> is of type %s\n", - obj1_name, get_type(info1->paths[i].type), obj2_name, - get_type(info2->paths[j].type)); - options->not_cmp=1; - return 0; - } - - nfound = - diff (file1_id, obj1_name, file2_id, obj2_name, options, info1->paths[i].type); - - return nfound; + int f1 = 0; + int f2 = 0; + hsize_t nfound = 0; + + ssize_t i = h5trav_getindex (info1, obj1_name); + ssize_t j = h5trav_getindex (info2, obj2_name); + + if (i == -1) + { + parallel_print ("Object <%s> could not be found in <%s>\n", obj1_name, + file1_name); + f1 = 1; + } + if (j == -1) + { + parallel_print ("Object <%s> could not be found in <%s>\n", obj2_name, + file2_name); + f2 = 1; + } + if (f1 || f2) + { + options->err_stat = 1; + return 0; + } + + /* use the name with "/" first, as obtained by iterator function */ + obj1_name = info1->paths[i].path; + obj2_name = info2->paths[j].path; + + /* objects are not the same type */ + if (info1->paths[i].type != info2->paths[j].type) + { + if (options->m_verbose) + parallel_print("Comparison not possible: <%s> is of type %s and <%s> is of type %s\n", + obj1_name, get_type(info1->paths[i].type), obj2_name, + get_type(info2->paths[j].type)); + options->not_cmp=1; + return 0; + } + + nfound = diff(file1_id, + obj1_name, + file2_id, + obj2_name, + options, + info1->paths[i].type); + + return nfound; } @@ -784,14 +812,15 @@ hsize_t diff(hid_t file1_id, diff_opt_t * options, h5trav_type_t type) { - hid_t type1_id = (-1); - hid_t type2_id = (-1); - hid_t grp1_id = (-1); - hid_t grp2_id = (-1); - int ret; + hid_t type1_id = (-1); + hid_t type2_id = (-1); + hid_t grp1_id = (-1); + hid_t grp2_id = (-1); + int ret; hsize_t nfound = 0; - switch(type) { + switch(type) + { /*------------------------------------------------------------------------- * H5TRAV_TYPE_DATASET *------------------------------------------------------------------------- @@ -801,7 +830,8 @@ hsize_t diff(hid_t file1_id, * verbose, always print name *------------------------------------------------------------------------- */ - if(options->m_verbose) { + if(options->m_verbose) + { if(print_objname(options, (hsize_t)1)) do_print_objname("dataset", path1, path2); nfound = diff_dataset(file1_id, file2_id, path1, path2, options); @@ -813,15 +843,18 @@ hsize_t diff(hid_t file1_id, * disabling quiet mode *------------------------------------------------------------------------- */ - else { - if(options->m_quiet == 0) { + else + { + if(options->m_quiet == 0) + { /* shut up temporarily */ options->m_quiet = 1; nfound = diff_dataset(file1_id, file2_id, path1, path2, options); /* print again */ options->m_quiet = 0; - if(nfound) { + if(nfound) + { if(print_objname(options,nfound)) do_print_objname("dataset", path1, path2); nfound = diff_dataset(file1_id, file2_id, path1, path2, options); diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 008b6b9..c5646ed 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -119,7 +119,7 @@ static int not_comparable; is_zero=1; \ } -# define PDIFF(a,b) ( (b>a) ? (b-a) : (a-b)) +#define PDIFF(a,b) ( (b>a) ? (b-a) : (a-b)) /*------------------------------------------------------------------------- * local prototypes @@ -127,11 +127,12 @@ static int not_comparable; */ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id,hid_t region1_id, hid_t region2_id, diff_opt_t *options); static hbool_t all_zero(const void *_mem, size_t size); -static int ull2float(unsigned long_long ull_value, float *f_value); static hsize_t character_compare(unsigned char *mem1,unsigned char *mem2,hsize_t i,int rank,hsize_t *dims,hsize_t *acc,hsize_t *pos,diff_opt_t *options,const char *obj1,const char *obj2,int *ph); static hsize_t character_compare_opt(unsigned char *mem1,unsigned char *mem2,hsize_t i,int rank,hsize_t *dims,hsize_t *acc,hsize_t *pos,diff_opt_t *options,const char *obj1,const char *obj2,int *ph); static hbool_t equal_float(float value, float expected); static hbool_t equal_double(double value, double expected); +static int ull2float(unsigned long_long ull_value, float *f_value); + /*------------------------------------------------------------------------- * NaN detection @@ -266,8 +267,6 @@ hsize_t diff_array( void *_mem1, size_t size; /* size of datum */ unsigned char *mem1 = (unsigned char*)_mem1; unsigned char *mem2 = (unsigned char*)_mem2; - unsigned char *tmp1; - unsigned char *tmp2; hsize_t acc[32]; /* accumulator position */ hsize_t pos[32]; /* matrix position */ int ph=1; /* print header */ @@ -288,23 +287,26 @@ hsize_t diff_array( void *_mem1, if(H5Tis_variable_str(m_type)) { - tmp1 = ((unsigned char**)mem1)[0]; - tmp2 = ((unsigned char**)mem2)[0]; - nfound+=diff_datum( - tmp1, - tmp2, - m_type, - (hsize_t)0, - rank, - dims, - acc, - pos, - options, - name1, - name2, - container1_id, - container2_id, - &ph); + for ( i = 0; i < nelmts; i++) + { + nfound+=diff_datum( + ((unsigned char**)mem1)[(size_t)i], + ((unsigned char**)mem2)[(size_t)i], + m_type, + i, + rank, + dims, + acc, + pos, + options, + name1, + name2, + container1_id, + container2_id, + &ph); + if (options->n && nfound>=options->count) + return nfound; + } /* i */ } else @@ -515,42 +517,35 @@ hsize_t diff_datum(void *_mem1, case H5T_STRING: { - H5T_str_t pad; char *s; - if(H5Tis_variable_str(m_type)) - { - /* mem1 is the pointer into the struct where a `char*' is stored. So we have - * to dereference the pointer to get the `char*' to pass to HDstrlen(). */ - s = *(char**)mem1; - if(s!=NULL) - size = HDstrlen(s); - } - else - { - s = (char *)mem1; - size = H5Tget_size(m_type); - } - - pad = H5Tget_strpad(m_type); - + /* Get pointer to first string to compare */ + s = (char *)mem1; + /* check for NULL pointer for string */ if(s!=NULL) { + if(H5Tis_variable_str(m_type)) + size = HDstrlen(s); + else + size = H5Tget_size(m_type); + + pad = H5Tget_strpad(m_type); + for (u=0; u<size && (s[u] || pad!=H5T_STR_NULLTERM); u++) nfound+=character_compare( - mem1 + u, - mem2 + u, /* offset */ - i, /* index position */ - rank, - dims, - acc, - pos, - options, - obj1, - obj2, - ph); + mem1 + u, + mem2 + u, /* offset */ + i, /* index position */ + rank, + dims, + acc, + pos, + options, + obj1, + obj2, + ph); } } @@ -697,7 +692,6 @@ hsize_t diff_datum(void *_mem1, H5Tclose(memb_type); } break; - /*------------------------------------------------------------------------- @@ -2867,7 +2861,6 @@ hsize_t diff_float(unsigned char *mem1, } - /*------------------------------------------------------------------------- * Function: diff_double * @@ -2897,80 +2890,111 @@ hsize_t diff_double(unsigned char *mem1, hsize_t i; double per; int both_zero; + int isnan1; + int isnan2; - - /* -d and !-p */ + + /*------------------------------------------------------------------------- + * -d and !-p + *------------------------------------------------------------------------- + */ + if (options->d && !options->p) { - for ( i = 0; i < nelmts; i++) { memcpy(&temp1_double, mem1, sizeof(double)); memcpy(&temp2_double, mem2, sizeof(double)); - - if (ABS(temp1_double-temp2_double) > options->delta) - { - if ( print_data(options) ) + + /*------------------------------------------------------------------------- + * detect NaNs + *------------------------------------------------------------------------- + */ + isnan1 = my_isnan(FLT_DOUBLE,&temp1_double); + isnan2 = my_isnan(FLT_DOUBLE,&temp2_double); + + if ( !isnan1 && !isnan2) + { + if (ABS(temp1_double-temp2_double) > options->delta) { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double)); + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double)); + } + nfound++; } - nfound++; - } + } /* NaN */ mem1+=sizeof(double); mem2+=sizeof(double); if (options->n && nfound>=options->count) return nfound; - } + } /* i */ } - - /* !-d and -p */ + + /*------------------------------------------------------------------------- + * !-d and -p + *------------------------------------------------------------------------- + */ else if (!options->d && options->p) { - for ( i = 0; i < nelmts; i++) { memcpy(&temp1_double, mem1, sizeof(double)); memcpy(&temp2_double, mem2, sizeof(double)); - PER(temp1_double,temp2_double); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT_P_NOTCOMP,temp1_double,temp2_double, - ABS(temp1_double-temp2_double)); - } - options->not_cmp=1; - nfound++; - } + /*------------------------------------------------------------------------- + * detect NaNs + *------------------------------------------------------------------------- + */ + isnan1 = my_isnan(FLT_DOUBLE,&temp1_double); + isnan2 = my_isnan(FLT_DOUBLE,&temp2_double); - else + if ( !isnan1 && !isnan2) + { + + PER(temp1_double,temp2_double); - if ( per > options->percent ) + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) { print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); parallel_print(SPACES); - parallel_print(F_FORMAT_P,temp1_double,temp2_double, - ABS(temp1_double-temp2_double), - ABS(1-temp2_double/temp1_double)); + parallel_print(F_FORMAT_P_NOTCOMP,temp1_double,temp2_double, + ABS(temp1_double-temp2_double)); } + options->not_cmp=1; nfound++; } - mem1+=sizeof(double); - mem2+=sizeof(double); - if (options->n && nfound>=options->count) - return nfound; - } + + else + + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT_P,temp1_double,temp2_double, + ABS(temp1_double-temp2_double), + ABS(1-temp2_double/temp1_double)); + } + nfound++; + } + } /* NaN */ + mem1+=sizeof(double); + mem2+=sizeof(double); + if (options->n && nfound>=options->count) + return nfound; + } /* i */ } - /* -d and -p */ + /*------------------------------------------------------------------------- + * -d and -p + *------------------------------------------------------------------------- + */ else if ( options->d && options->p) { @@ -2979,41 +3003,58 @@ hsize_t diff_double(unsigned char *mem1, memcpy(&temp1_double, mem1, sizeof(double)); memcpy(&temp2_double, mem2, sizeof(double)); - PER(temp1_double,temp2_double); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT_P_NOTCOMP,temp1_double,temp2_double, - ABS(temp1_double-temp2_double)); - } - options->not_cmp=1; - nfound++; - } + /*------------------------------------------------------------------------- + * detect NaNs + *------------------------------------------------------------------------- + */ + isnan1 = my_isnan(FLT_DOUBLE,&temp1_double); + isnan2 = my_isnan(FLT_DOUBLE,&temp2_double); - else + if ( !isnan1 && !isnan2) + { + + PER(temp1_double,temp2_double); - if ( per > options->percent && ABS(temp1_double-temp2_double) > options->delta ) + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) { print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); parallel_print(SPACES); - parallel_print(F_FORMAT_P,temp1_double,temp2_double, - ABS(temp1_double-temp2_double), - ABS(1-temp2_double/temp1_double)); + parallel_print(F_FORMAT_P_NOTCOMP,temp1_double,temp2_double, + ABS(temp1_double-temp2_double)); } + options->not_cmp=1; nfound++; } - mem1+=sizeof(double); - mem2+=sizeof(double); - if (options->n && nfound>=options->count) - return nfound; - } + + else + + if ( per > options->percent && ABS(temp1_double-temp2_double) > options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT_P,temp1_double,temp2_double, + ABS(temp1_double-temp2_double), + ABS(1-temp2_double/temp1_double)); + } + nfound++; + } + + } /* NaN */ + mem1+=sizeof(double); + mem2+=sizeof(double); + if (options->n && nfound>=options->count) + return nfound; + } /* i */ } + + /*------------------------------------------------------------------------- + * no -d and -p + *------------------------------------------------------------------------- + */ else { @@ -3044,6 +3085,9 @@ hsize_t diff_double(unsigned char *mem1, return nfound; } + + + /*------------------------------------------------------------------------- * Function: diff_schar * diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index ea833db..3f4e6a3 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -19,33 +19,6 @@ #include "h5tools.h" /*------------------------------------------------------------------------- - * Function: print_size - * - * Purpose: print dimensions - * - *------------------------------------------------------------------------- - */ -#if defined (H5DIFF_DEBUG) -static void -print_size (int rank, hsize_t *dims) -{ - int i; - - parallel_print("[" ); - for ( i = 0; i < rank-1; i++) - { - parallel_print("%"H5_PRINTF_LL_WIDTH"u", (unsigned long_long)dims[i]); - parallel_print("x"); - } - parallel_print("%"H5_PRINTF_LL_WIDTH"u", (unsigned long_long)dims[rank-1]); - parallel_print("]\n" ); - -} -#endif /* H5DIFF_DEBUG */ - - - -/*------------------------------------------------------------------------- * Function: diff_dataset * * Purpose: check for comparable datasets and read into a compatible @@ -65,79 +38,85 @@ hsize_t diff_dataset( hid_t file1_id, const char *obj2_name, diff_opt_t *options) { - hid_t did1 = -1; - hid_t did2 = -1; - hid_t dcpl1 = -1; - hid_t dcpl2 = -1; - hsize_t nfound = 0; - -/*------------------------------------------------------------------------- - * open the handles - *------------------------------------------------------------------------- - */ - /* disable error reporting */ - H5E_BEGIN_TRY { - /* Open the datasets */ - if((did1 = H5Dopen2(file1_id, obj1_name, H5P_DEFAULT)) < 0) { - printf("Cannot open dataset <%s>\n", obj1_name); - goto error; - } - if((did2 = H5Dopen2(file2_id, obj2_name, H5P_DEFAULT)) < 0) { - printf("Cannot open dataset <%s>\n", obj2_name); - goto error; - } - /* enable error reporting */ - } H5E_END_TRY; - - - if((dcpl1 = H5Dget_create_plist(did1)) < 0) - goto error; - if((dcpl2 = H5Dget_create_plist(did2)) < 0) - goto error; - -/*------------------------------------------------------------------------- - * check if the dataset creation property list has filters that - * are not registered in the current configuration - * 1) the external filters GZIP and SZIP might not be available - * 2) the internal filters might be turned off - *------------------------------------------------------------------------- - */ - if ((h5tools_canreadf((options->m_verbose?obj1_name:NULL),dcpl1)==1) && - (h5tools_canreadf((options->m_verbose?obj2_name:NULL),dcpl2)==1)) - { - nfound=diff_datasetid(did1, - did2, - obj1_name, - obj2_name, - options); - } -/*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ - /* disable error reporting */ - H5E_BEGIN_TRY { - H5Pclose(dcpl1); - H5Pclose(dcpl2); - H5Dclose(did1); - H5Dclose(did2); - /* enable error reporting */ - } H5E_END_TRY; - - return nfound; - + hid_t did1 = -1; + hid_t did2 = -1; + hid_t dcpl1 = -1; + hid_t dcpl2 = -1; + hsize_t nfound = 0; + + /*------------------------------------------------------------------------- + * open the handles + *------------------------------------------------------------------------- + */ + /* disable error reporting */ + H5E_BEGIN_TRY + { + /* open the datasets */ + if((did1 = H5Dopen2(file1_id, obj1_name, H5P_DEFAULT)) < 0) + { + printf("Cannot open dataset <%s>\n", obj1_name); + goto error; + } + + if((did2 = H5Dopen2(file2_id, obj2_name, H5P_DEFAULT)) < 0) + { + printf("Cannot open dataset <%s>\n", obj2_name); + goto error; + } + /* enable error reporting */ + } H5E_END_TRY; + + + if ((dcpl1 = H5Dget_create_plist(did1)) < 0) + goto error; + if ((dcpl2 = H5Dget_create_plist(did2)) < 0) + goto error; + + /*------------------------------------------------------------------------- + * check if the dataset creation property list has filters that + * are not registered in the current configuration + * 1) the external filters GZIP and SZIP might not be available + * 2) the internal filters might be turned off + *------------------------------------------------------------------------- + */ + if ((h5tools_canreadf((options->m_verbose?obj1_name:NULL),dcpl1)==1) && + (h5tools_canreadf((options->m_verbose?obj2_name:NULL),dcpl2)==1)) + { + nfound=diff_datasetid(did1, + did2, + obj1_name, + obj2_name, + options); + } + /*------------------------------------------------------------------------- + * close + *------------------------------------------------------------------------- + */ + /* disable error reporting */ + H5E_BEGIN_TRY + { + H5Pclose(dcpl1); + H5Pclose(dcpl2); + H5Dclose(did1); + H5Dclose(did2); + /* enable error reporting */ + } H5E_END_TRY; + + return nfound; + error: - options->err_stat=1; - /* disable error reporting */ - H5E_BEGIN_TRY { - H5Pclose(dcpl1); - H5Pclose(dcpl2); - H5Dclose(did1); - H5Dclose(did2); - /* enable error reporting */ - } H5E_END_TRY; - - return nfound; + options->err_stat=1; + /* disable error reporting */ + H5E_BEGIN_TRY + { + H5Pclose(dcpl1); + H5Pclose(dcpl2); + H5Dclose(did1); + H5Dclose(did2); + /* enable error reporting */ + } H5E_END_TRY; + + return nfound; } /*------------------------------------------------------------------------- @@ -154,7 +133,6 @@ error: * * Modifications: * - * * October 2006: Read by hyperslabs for big datasets. * * A threshold of H5TOOLS_MALLOCSIZE (128 MB) is the limit upon which I/O hyperslab is done @@ -204,448 +182,456 @@ hsize_t diff_datasetid( hid_t did1, const char *obj2_name, diff_opt_t *options) { - hid_t sid1=-1; - hid_t sid2=-1; - hid_t f_tid1=-1; - hid_t f_tid2=-1; - hid_t m_tid1=-1; - hid_t m_tid2=-1; - size_t m_size1; - size_t m_size2; - H5T_sign_t sign1; - H5T_sign_t sign2; - int rank1; - int rank2; - hsize_t nelmts1; - hsize_t nelmts2; - hsize_t dims1[H5S_MAX_RANK]; - hsize_t dims2[H5S_MAX_RANK]; - hsize_t maxdim1[H5S_MAX_RANK]; - hsize_t maxdim2[H5S_MAX_RANK]; - const char *name1=NULL; /* relative names */ - const char *name2=NULL; - hsize_t storage_size1; - hsize_t storage_size2; - hsize_t nfound=0; /* number of differences found */ - int cmp=1; /* do diff or not */ - void *buf1=NULL; - void *buf2=NULL; - void *sm_buf1=NULL; - void *sm_buf2=NULL; - size_t need; /* bytes needed for malloc */ - int i; - - /* Get the dataspace handle */ - if ( (sid1 = H5Dget_space(did1)) < 0 ) - goto error; - - /* Get rank */ - if ( (rank1 = H5Sget_simple_extent_ndims(sid1)) < 0 ) - goto error; - - /* Get the dataspace handle */ - if ( (sid2 = H5Dget_space(did2)) < 0 ) - goto error; - - /* Get rank */ - if ( (rank2 = H5Sget_simple_extent_ndims(sid2)) < 0 ) - goto error; - - /* Get dimensions */ - if ( H5Sget_simple_extent_dims(sid1,dims1,maxdim1) < 0 ) - goto error; - - /* Get dimensions */ - if ( H5Sget_simple_extent_dims(sid2,dims2,maxdim2) < 0 ) - goto error; - -/*------------------------------------------------------------------------- - * Get the file data type - *------------------------------------------------------------------------- - */ - - /* Get the data type */ - if ( (f_tid1 = H5Dget_type(did1)) < 0 ) - goto error; - - /* Get the data type */ - if ( (f_tid2 = H5Dget_type(did2)) < 0 ) - goto error; - -/*------------------------------------------------------------------------- - * check for empty datasets - *------------------------------------------------------------------------- - */ - - storage_size1=H5Dget_storage_size(did1); - storage_size2=H5Dget_storage_size(did2); - - if (storage_size1==0 || storage_size2==0) - { - if (options->m_verbose && obj1_name && obj2_name) - parallel_print("<%s> or <%s> are empty datasets\n", obj1_name, obj2_name); - cmp=0; - options->not_cmp=1; - } - -/*------------------------------------------------------------------------- - * check for comparable TYPE and SPACE - *------------------------------------------------------------------------- - */ - - if (diff_can_type(f_tid1, - f_tid2, - rank1, - rank2, - dims1, - dims2, - maxdim1, - maxdim2, - obj1_name, - obj2_name, - options)!=1) - { - cmp=0; - options->not_cmp=1; - } - -/*------------------------------------------------------------------------- - * memory type and sizes - *------------------------------------------------------------------------- - */ - if ((m_tid1=h5tools_get_native_type(f_tid1)) < 0) - goto error; - - if ((m_tid2=h5tools_get_native_type(f_tid2)) < 0) - goto error; - - m_size1 = H5Tget_size( m_tid1 ); - m_size2 = H5Tget_size( m_tid2 ); - -/*------------------------------------------------------------------------- - * check for different signed/unsigned types - *------------------------------------------------------------------------- - */ - - sign1=H5Tget_sign(m_tid1); - sign2=H5Tget_sign(m_tid2); - if ( sign1 != sign2 ) - { - if (options->m_verbose && obj1_name) { - parallel_print("Comparison not supported: <%s> has sign %s ", obj1_name, get_sign(sign1)); - parallel_print("and <%s> has sign %s\n", obj2_name, get_sign(sign2)); + hid_t sid1=-1; + hid_t sid2=-1; + hid_t f_tid1=-1; + hid_t f_tid2=-1; + hid_t m_tid1=-1; + hid_t m_tid2=-1; + size_t m_size1; + size_t m_size2; + H5T_sign_t sign1; + H5T_sign_t sign2; + int rank1; + int rank2; + hsize_t nelmts1; + hsize_t nelmts2; + hsize_t dims1[H5S_MAX_RANK]; + hsize_t dims2[H5S_MAX_RANK]; + hsize_t maxdim1[H5S_MAX_RANK]; + hsize_t maxdim2[H5S_MAX_RANK]; + const char *name1=NULL; /* relative names */ + const char *name2=NULL; + hsize_t storage_size1; + hsize_t storage_size2; + hsize_t nfound=0; /* number of differences found */ + int cmp=1; /* do diff or not */ + void *buf1=NULL; + void *buf2=NULL; + void *sm_buf1=NULL; + void *sm_buf2=NULL; + size_t need; /* bytes needed for malloc */ + int i; + + /* get the dataspace handle */ + if ( (sid1 = H5Dget_space(did1)) < 0 ) + goto error; + + /* get rank */ + if ( (rank1 = H5Sget_simple_extent_ndims(sid1)) < 0 ) + goto error; + + /* get the dataspace handle */ + if ( (sid2 = H5Dget_space(did2)) < 0 ) + goto error; + + /* get rank */ + if ( (rank2 = H5Sget_simple_extent_ndims(sid2)) < 0 ) + goto error; + + /* get dimensions */ + if ( H5Sget_simple_extent_dims(sid1,dims1,maxdim1) < 0 ) + goto error; + + /* get dimensions */ + if ( H5Sget_simple_extent_dims(sid2,dims2,maxdim2) < 0 ) + goto error; + + /*------------------------------------------------------------------------- + * get the file data type + *------------------------------------------------------------------------- + */ + + /* get the data type */ + if ( (f_tid1 = H5Dget_type(did1)) < 0 ) + goto error; + + /* get the data type */ + if ( (f_tid2 = H5Dget_type(did2)) < 0 ) + goto error; + + /*------------------------------------------------------------------------- + * check for empty datasets + *------------------------------------------------------------------------- + */ + + storage_size1=H5Dget_storage_size(did1); + storage_size2=H5Dget_storage_size(did2); + if (storage_size1<0 || storage_size2<0) + goto error; + + if (storage_size1==0 || storage_size2==0) + { + if (options->m_verbose && obj1_name && obj2_name) + parallel_print("<%s> or <%s> are empty datasets\n", obj1_name, obj2_name); + cmp=0; + options->not_cmp=1; + } + + /*------------------------------------------------------------------------- + * check for comparable TYPE and SPACE + *------------------------------------------------------------------------- + */ + + if (diff_can_type(f_tid1, + f_tid2, + rank1, + rank2, + dims1, + dims2, + maxdim1, + maxdim2, + obj1_name, + obj2_name, + options)!=1) + { + cmp=0; + options->not_cmp=1; + } + + /*------------------------------------------------------------------------- + * memory type and sizes + *------------------------------------------------------------------------- + */ + if ((m_tid1=h5tools_get_native_type(f_tid1)) < 0) + goto error; + + if ((m_tid2=h5tools_get_native_type(f_tid2)) < 0) + goto error; + + m_size1 = H5Tget_size( m_tid1 ); + m_size2 = H5Tget_size( m_tid2 ); + + /*------------------------------------------------------------------------- + * check for different signed/unsigned types + *------------------------------------------------------------------------- + */ + + sign1=H5Tget_sign(m_tid1); + sign2=H5Tget_sign(m_tid2); + if ( sign1 != sign2 ) + { + if (options->m_verbose && obj1_name) + { + parallel_print("Comparison not supported: <%s> has sign %s ", obj1_name, get_sign(sign1)); + parallel_print("and <%s> has sign %s\n", obj2_name, get_sign(sign2)); + } + + cmp=0; + options->not_cmp=1; + } + + /*------------------------------------------------------------------------- + * only attempt to compare if possible + *------------------------------------------------------------------------- + */ + if (cmp) + { + + /*------------------------------------------------------------------------- + * get number of elements + *------------------------------------------------------------------------- + */ + nelmts1 = 1; + for (i = 0; i < rank1; i++) + { + nelmts1 *= dims1[i]; + } + + nelmts2 = 1; + for (i = 0; i < rank2; i++) + { + nelmts2 *= dims2[i]; + } + + assert(nelmts1==nelmts2); + + /*------------------------------------------------------------------------- + * "upgrade" the smaller memory size + *------------------------------------------------------------------------- + */ + + if ( m_size1 != m_size2 ) + { + if ( m_size1 < m_size2 ) + { + H5Tclose(m_tid1); + + if ((m_tid1=h5tools_get_native_type(f_tid2)) < 0) + goto error; + + m_size1 = H5Tget_size( m_tid1 ); + } + else + { + H5Tclose(m_tid2); + + if ((m_tid2=h5tools_get_native_type(f_tid1)) < 0) + goto error; + + m_size2 = H5Tget_size( m_tid2 ); + } + } + assert(m_size1==m_size2); + + /* print names */ + if (obj1_name) { + name1=diff_basename(obj1_name); + } + if (obj2_name) { + name2=diff_basename(obj2_name); + } + + + /*------------------------------------------------------------------------- + * read/compare + *------------------------------------------------------------------------- + */ + + need = (size_t)(nelmts1*m_size1); /* bytes needed */ + if ( need < H5TOOLS_MALLOCSIZE) + { + buf1 = HDmalloc(need); + buf2 = HDmalloc(need); + } + + if ( buf1!=NULL && buf2!=NULL) + { + if ( H5Dread(did1,m_tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf1) < 0 ) + goto error; + if ( H5Dread(did2,m_tid2,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf2) < 0 ) + goto error; + + /* array diff */ + nfound = diff_array(buf1, + buf2, + nelmts1, + (hsize_t)0, + rank1, + dims1, + options, + name1, + name2, + m_tid1, + did1, + did2); + } + + else /* possibly not enough memory, read/compare by hyperslabs */ + + { + size_t p_type_nbytes = m_size1; /*size of memory type */ + hsize_t p_nelmts = nelmts1; /*total selected elmts */ + hsize_t elmtno; /*counter */ + int carry; /*counter carry value */ + unsigned int vl_data = 0; /*contains VL datatypes */ + + /* stripmine info */ + hsize_t sm_size[H5S_MAX_RANK]; /*stripmine size */ + hsize_t sm_nbytes; /*bytes per stripmine */ + hsize_t sm_nelmts; /*elements per stripmine*/ + hid_t sm_space; /*stripmine data space */ + + /* hyperslab info */ + hsize_t hs_offset[H5S_MAX_RANK]; /*starting offset */ + hsize_t hs_size[H5S_MAX_RANK]; /*size this pass */ + hsize_t hs_nelmts; /*elements in request */ + hsize_t zero[8]; /*vector of zeros */ + + /* check if we have VL data in the dataset's datatype */ + if (H5Tdetect_class(m_tid1, H5T_VLEN) == TRUE) + vl_data = TRUE; + + /* + * determine the strip mine size and allocate a buffer. The strip mine is + * a hyperslab whose size is manageable. + */ + sm_nbytes = p_type_nbytes; + + for (i = rank1; i > 0; --i) + { + sm_size[i - 1] = MIN(dims1[i - 1], H5TOOLS_BUFSIZE / sm_nbytes); + sm_nbytes *= sm_size[i - 1]; + assert(sm_nbytes > 0); + } + + sm_buf1 = malloc((size_t)sm_nbytes); + sm_buf2 = malloc((size_t)sm_nbytes); + + sm_nelmts = sm_nbytes / p_type_nbytes; + sm_space = H5Screate_simple(1, &sm_nelmts, NULL); + + /* the stripmine loop */ + memset(hs_offset, 0, sizeof hs_offset); + memset(zero, 0, sizeof zero); + + for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) + { + /* calculate the hyperslab size */ + if (rank1 > 0) + { + for (i = 0, hs_nelmts = 1; i < rank1; i++) + { + hs_size[i] = MIN(dims1[i] - hs_offset[i], sm_size[i]); + hs_nelmts *= hs_size[i]; + } + if (H5Sselect_hyperslab(sid1, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0) + goto error; + if (H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0) + goto error; + if (H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL) < 0) + goto error; + } + else + { + H5Sselect_all(sid1); + H5Sselect_all(sid2); + H5Sselect_all(sm_space); + hs_nelmts = 1; + } /* rank */ + + if ( H5Dread(did1,m_tid1,sm_space,sid1,H5P_DEFAULT,sm_buf1) < 0 ) + goto error; + if ( H5Dread(did2,m_tid2,sm_space,sid2,H5P_DEFAULT,sm_buf2) < 0 ) + goto error; + + /* get array differences. in the case of hyperslab read, increment the + number of differences found in each hyperslab and pass the + position at the beggining for printing + */ + nfound += diff_array(sm_buf1, + sm_buf2, + hs_nelmts, + elmtno, + rank1, + dims1, + options, + name1, + name2, + m_tid1, + did1, + did2); + + /* reclaim any VL memory, if necessary */ + if(vl_data) + { + H5Dvlen_reclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf1); + H5Dvlen_reclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf2); + } + + /* calculate the next hyperslab offset */ + for (i = rank1, carry = 1; i > 0 && carry; --i) + { + hs_offset[i - 1] += hs_size[i - 1]; + if (hs_offset[i - 1] == dims1[i - 1]) + hs_offset[i - 1] = 0; + else + carry = 0; + } /* i */ + } /* elmtno */ + + H5Sclose(sm_space); + /* free */ + if (sm_buf1!=NULL) + { + free(sm_buf1); + sm_buf1=NULL; + } + if (sm_buf2!=NULL) + { + free(sm_buf2); + sm_buf2=NULL; + } + + } /* hyperslab read */ + }/*cmp*/ + + /*------------------------------------------------------------------------- + * compare attributes + * the if condition refers to cases when the dataset is a referenced object + *------------------------------------------------------------------------- + */ + + if (obj1_name) + nfound += diff_attr(did1,did2,obj1_name,obj2_name,options); + + /*------------------------------------------------------------------------- + * close + *------------------------------------------------------------------------- + */ + + /* free */ + if (buf1!=NULL) + { + free(buf1); + buf1=NULL; } - - cmp=0; - options->not_cmp=1; - } - -/*------------------------------------------------------------------------- - * only attempt to compare if possible - *------------------------------------------------------------------------- - */ - if (cmp) - { - -/*------------------------------------------------------------------------- - * get number of elements - *------------------------------------------------------------------------- - */ - nelmts1 = 1; - for (i = 0; i < rank1; i++) - { - nelmts1 *= dims1[i]; - } - - nelmts2 = 1; - for (i = 0; i < rank2; i++) - { - nelmts2 *= dims2[i]; - } - - assert(nelmts1==nelmts2); - -/*------------------------------------------------------------------------- - * "upgrade" the smaller memory size - *------------------------------------------------------------------------- - */ - - if ( m_size1 != m_size2 ) - { - if ( m_size1 < m_size2 ) + if (buf2!=NULL) { - H5Tclose(m_tid1); - - if ((m_tid1=h5tools_get_native_type(f_tid2)) < 0) - goto error; - - m_size1 = H5Tget_size( m_tid1 ); + free(buf2); + buf2=NULL; } - else + if (sm_buf1!=NULL) { - H5Tclose(m_tid2); - - if ((m_tid2=h5tools_get_native_type(f_tid1)) < 0) - goto error; - - m_size2 = H5Tget_size( m_tid2 ); + free(sm_buf1); + sm_buf1=NULL; } - } - assert(m_size1==m_size2); - - /* print names */ - if (obj1_name) { - name1=diff_basename(obj1_name); - } - if (obj2_name) { - name2=diff_basename(obj2_name); - } - - -/*------------------------------------------------------------------------- - * read/compare - *------------------------------------------------------------------------- - */ - - need = (size_t)(nelmts1*m_size1); /* bytes needed */ - if ( need < H5TOOLS_MALLOCSIZE) - { - buf1 = HDmalloc(need); - buf2 = HDmalloc(need); - } - - if ( buf1!=NULL && buf2!=NULL) - { - if ( H5Dread(did1,m_tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf1) < 0 ) - goto error; - if ( H5Dread(did2,m_tid2,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf2) < 0 ) - goto error; - - /* array diff */ - nfound = diff_array(buf1, - buf2, - nelmts1, - (hsize_t)0, - rank1, - dims1, - options, - name1, - name2, - m_tid1, - did1, - did2); - } - - else /* possibly not enough memory, read/compare by hyperslabs */ - - { - size_t p_type_nbytes = m_size1; /*size of memory type */ - hsize_t p_nelmts = nelmts1; /*total selected elmts */ - hsize_t elmtno; /*counter */ - int carry; /*counter carry value */ - unsigned int vl_data = 0; /*contains VL datatypes */ - - /* stripmine info */ - hsize_t sm_size[H5S_MAX_RANK]; /*stripmine size */ - hsize_t sm_nbytes; /*bytes per stripmine */ - hsize_t sm_nelmts; /*elements per stripmine*/ - hid_t sm_space; /*stripmine data space */ - - /* hyperslab info */ - hsize_t hs_offset[H5S_MAX_RANK]; /*starting offset */ - hsize_t hs_size[H5S_MAX_RANK]; /*size this pass */ - hsize_t hs_nelmts; /*elements in request */ - hsize_t zero[8]; /*vector of zeros */ - - /* check if we have VL data in the dataset's datatype */ - if (H5Tdetect_class(m_tid1, H5T_VLEN) == TRUE) - vl_data = TRUE; - - /* - * determine the strip mine size and allocate a buffer. The strip mine is - * a hyperslab whose size is manageable. - */ - sm_nbytes = p_type_nbytes; - - for (i = rank1; i > 0; --i) { - sm_size[i - 1] = MIN(dims1[i - 1], H5TOOLS_BUFSIZE / sm_nbytes); - sm_nbytes *= sm_size[i - 1]; - assert(sm_nbytes > 0); + if (sm_buf2!=NULL) + { + free(sm_buf2); + sm_buf2=NULL; } - sm_buf1 = malloc((size_t)sm_nbytes); - sm_buf2 = malloc((size_t)sm_nbytes); + H5E_BEGIN_TRY + { + H5Sclose(sid1); + H5Sclose(sid2); + H5Tclose(f_tid1); + H5Tclose(f_tid2); + H5Tclose(m_tid1); + H5Tclose(m_tid2); + } H5E_END_TRY; - sm_nelmts = sm_nbytes / p_type_nbytes; - sm_space = H5Screate_simple(1, &sm_nelmts, NULL); + return nfound; - /* the stripmine loop */ - memset(hs_offset, 0, sizeof hs_offset); - memset(zero, 0, sizeof zero); - - for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) - { - /* calculate the hyperslab size */ - if (rank1 > 0) - { - for (i = 0, hs_nelmts = 1; i < rank1; i++) - { - hs_size[i] = MIN(dims1[i] - hs_offset[i], sm_size[i]); - hs_nelmts *= hs_size[i]; - } - if (H5Sselect_hyperslab(sid1, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0) - goto error; - if (H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0) - goto error; - if (H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL) < 0) - goto error; - } - else - { - H5Sselect_all(sid1); - H5Sselect_all(sid2); - H5Sselect_all(sm_space); - hs_nelmts = 1; - } /* rank */ - - if ( H5Dread(did1,m_tid1,sm_space,sid1,H5P_DEFAULT,sm_buf1) < 0 ) - goto error; - if ( H5Dread(did2,m_tid2,sm_space,sid2,H5P_DEFAULT,sm_buf2) < 0 ) - goto error; - - /* get array differences. in the case of hyperslab read, increment the number of differences - found in each hyperslab and pass the position at the beggining for printing */ - nfound += diff_array(sm_buf1, - sm_buf2, - hs_nelmts, - elmtno, - rank1, - dims1, - options, - name1, - name2, - m_tid1, - did1, - did2); - - /* reclaim any VL memory, if necessary */ - if(vl_data) - { - H5Dvlen_reclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf1); - H5Dvlen_reclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf2); - } - - /* calculate the next hyperslab offset */ - for (i = rank1, carry = 1; i > 0 && carry; --i) - { - hs_offset[i - 1] += hs_size[i - 1]; - if (hs_offset[i - 1] == dims1[i - 1]) - hs_offset[i - 1] = 0; - else - carry = 0; - } /* i */ - } /* elmtno */ +error: + options->err_stat=1; - H5Sclose(sm_space); /* free */ + if (buf1!=NULL) + { + free(buf1); + buf1=NULL; + } + if (buf2!=NULL) + { + free(buf2); + buf2=NULL; + } if (sm_buf1!=NULL) { - free(sm_buf1); - sm_buf1=NULL; + free(sm_buf1); + sm_buf1=NULL; } if (sm_buf2!=NULL) { - free(sm_buf2); - sm_buf2=NULL; + free(sm_buf2); + sm_buf2=NULL; } - } /* hyperslab read */ - }/*cmp*/ - -/*------------------------------------------------------------------------- - * compare attributes - * the if condition refers to cases when the dataset is a referenced object - *------------------------------------------------------------------------- - */ - - if (obj1_name) - nfound += diff_attr(did1,did2,obj1_name,obj2_name,options); - -/*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ - - /* free */ - if (buf1!=NULL) - { - free(buf1); - buf1=NULL; - } - if (buf2!=NULL) - { - free(buf2); - buf2=NULL; - } - if (sm_buf1!=NULL) - { - free(sm_buf1); - sm_buf1=NULL; - } - if (sm_buf2!=NULL) - { - free(sm_buf2); - sm_buf2=NULL; - } - - H5E_BEGIN_TRY { - H5Sclose(sid1); - H5Sclose(sid2); - H5Tclose(f_tid1); - H5Tclose(f_tid2); - H5Tclose(m_tid1); - H5Tclose(m_tid2); - } H5E_END_TRY; - - return nfound; - -error: - options->err_stat=1; - - /* free */ - if (buf1!=NULL) - { - free(buf1); - buf1=NULL; - } - if (buf2!=NULL) - { - free(buf2); - buf2=NULL; - } - if (sm_buf1!=NULL) - { - free(sm_buf1); - sm_buf1=NULL; - } - if (sm_buf2!=NULL) - { - free(sm_buf2); - sm_buf2=NULL; - } - - /* disable error reporting */ - H5E_BEGIN_TRY { - H5Sclose(sid1); - H5Sclose(sid2); - H5Tclose(f_tid1); - H5Tclose(f_tid2); - H5Tclose(m_tid1); - H5Tclose(m_tid2); - /* enable error reporting */ - } H5E_END_TRY; - - return nfound; + /* disable error reporting */ + H5E_BEGIN_TRY + { + H5Sclose(sid1); + H5Sclose(sid2); + H5Tclose(f_tid1); + H5Tclose(f_tid2); + H5Tclose(m_tid1); + H5Tclose(m_tid2); + /* enable error reporting */ + } H5E_END_TRY; + + return nfound; } /*------------------------------------------------------------------------- @@ -677,163 +663,164 @@ int diff_can_type( hid_t f_tid1, /* file data type */ const char *obj2_name, diff_opt_t *options ) { - - - H5T_class_t tclass1; - H5T_class_t tclass2; - int maxdim_diff=0; /* maximum dimensions are different */ - int dim_diff=0; /* current dimensions are different */ - int i; - -/*------------------------------------------------------------------------- - * check for the same class - *------------------------------------------------------------------------- - */ - - if ((tclass1=H5Tget_class(f_tid1)) < 0) - return -1; - - if ((tclass2=H5Tget_class(f_tid2)) < 0) - return -1; - - if ( tclass1 != tclass2 ) - { - if (options->m_verbose && obj1_name) { - printf("Comparison not possible: <%s> is of class %s and <%s> is of class %s\n", - obj1_name, get_class(tclass1), - obj2_name, get_class(tclass2) ); - } - return 0; - } - -/*------------------------------------------------------------------------- - * check for non supported classes - *------------------------------------------------------------------------- - */ - - assert(tclass1==tclass2); - switch (tclass1) - { - case H5T_INTEGER: - case H5T_FLOAT: - case H5T_COMPOUND: - case H5T_STRING: - case H5T_ARRAY: - case H5T_BITFIELD: - case H5T_OPAQUE: - case H5T_ENUM: - case H5T_VLEN: - case H5T_REFERENCE: - - break; - - default: /*H5T_TIME */ - if (options->m_verbose && obj1_name ) - printf("Comparison not supported: <%s> and <%s> are of class %s\n", - obj1_name,obj2_name,get_class(tclass2) ); - return 0; - } - -/*------------------------------------------------------------------------- - * check for equal file datatype; warning only - *------------------------------------------------------------------------- - */ - - if ( (H5Tequal(f_tid1, f_tid2)==0) && options->m_verbose && obj1_name) - { - printf("Warning: different storage datatype\n"); - printf("<%s> has file datatype ", obj1_name); - print_type(f_tid1); - printf("\n"); - printf("<%s> has file datatype ", obj2_name); - print_type(f_tid2); - printf("\n"); - } - -/*------------------------------------------------------------------------- - * check for the same rank - *------------------------------------------------------------------------- - */ - - if ( rank1 != rank2 ) - { - if (options->m_verbose && obj1_name) { - printf("Comparison not supported: <%s> has rank %d, dimensions ", obj1_name, rank1); - print_dimensions(rank1,dims1); - printf(", max dimensions "); - print_dimensions(rank1,maxdim1); - printf("\n" ); - printf("<%s> has rank %d, dimensions ", obj2_name, rank2); - print_dimensions(rank2,dims2); - printf(", max dimensions "); - print_dimensions(rank2,maxdim2); - } - return 0; - } - -/*------------------------------------------------------------------------- - * check for different dimensions - *------------------------------------------------------------------------- - */ - - assert(rank1==rank2); - for ( i=0; i<rank1; i++) - { - if (maxdim1 && maxdim2) - { - if ( maxdim1[i] != maxdim2[i] ) - maxdim_diff=1; - } - if ( dims1[i] != dims2[i] ) - dim_diff=1; - } - -/*------------------------------------------------------------------------- - * current dimensions - *------------------------------------------------------------------------- - */ - - if (dim_diff==1) - { - if (options->m_verbose && obj1_name) { - printf("Comparison not supported: <%s> has rank %d, dimensions ", obj1_name, rank1); - print_dimensions(rank1,dims1); - if (maxdim1 && maxdim2) { - printf(", max dimensions "); - print_dimensions(rank1,maxdim1); - printf("\n" ); - printf("<%s> has rank %d, dimensions ", obj2_name, rank2); - print_dimensions(rank2,dims2); - printf(", max dimensions "); - print_dimensions(rank2,maxdim2); - } - } - return 0; - } - -/*------------------------------------------------------------------------- - * maximum dimensions; just give a warning - *------------------------------------------------------------------------- - */ - if (maxdim1 && maxdim2 && maxdim_diff==1 && obj1_name ) - { - if (options->m_verbose) { - printf( "Warning: different maximum dimensions\n"); - printf("<%s> has max dimensions ", obj1_name); - print_dimensions(rank1,maxdim1); - printf("\n"); - printf("<%s> has max dimensions ", obj2_name); - print_dimensions(rank2,maxdim2); - printf("\n"); - } - } - - return 1; + H5T_class_t tclass1; + H5T_class_t tclass2; + int maxdim_diff=0; /* maximum dimensions are different */ + int dim_diff=0; /* current dimensions are different */ + int i; + + /*------------------------------------------------------------------------- + * check for the same class + *------------------------------------------------------------------------- + */ + + if ((tclass1=H5Tget_class(f_tid1)) < 0) + return -1; + + if ((tclass2=H5Tget_class(f_tid2)) < 0) + return -1; + + if ( tclass1 != tclass2 ) + { + if (options->m_verbose && obj1_name) + { + printf("Comparison not possible: <%s> is of class %s and <%s> is of class %s\n", + obj1_name, get_class(tclass1), + obj2_name, get_class(tclass2) ); + } + return 0; + } + + /*------------------------------------------------------------------------- + * check for non supported classes + *------------------------------------------------------------------------- + */ + + assert(tclass1==tclass2); + switch (tclass1) + { + case H5T_INTEGER: + case H5T_FLOAT: + case H5T_COMPOUND: + case H5T_STRING: + case H5T_ARRAY: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_ENUM: + case H5T_VLEN: + case H5T_REFERENCE: + + break; + + default: /*H5T_TIME */ + if (options->m_verbose && obj1_name ) + printf("Comparison not supported: <%s> and <%s> are of class %s\n", + obj1_name,obj2_name,get_class(tclass2) ); + return 0; + } + + /*------------------------------------------------------------------------- + * check for equal file datatype; warning only + *------------------------------------------------------------------------- + */ + + if ( (H5Tequal(f_tid1, f_tid2)==0) && options->m_verbose && obj1_name) + { + printf("Warning: different storage datatype\n"); + printf("<%s> has file datatype ", obj1_name); + print_type(f_tid1); + printf("\n"); + printf("<%s> has file datatype ", obj2_name); + print_type(f_tid2); + printf("\n"); + } + + /*------------------------------------------------------------------------- + * check for the same rank + *------------------------------------------------------------------------- + */ + + if ( rank1 != rank2 ) + { + if (options->m_verbose && obj1_name) + { + printf("Comparison not supported: <%s> has rank %d, dimensions ", obj1_name, rank1); + print_dimensions(rank1,dims1); + printf(", max dimensions "); + print_dimensions(rank1,maxdim1); + printf("\n" ); + printf("<%s> has rank %d, dimensions ", obj2_name, rank2); + print_dimensions(rank2,dims2); + printf(", max dimensions "); + print_dimensions(rank2,maxdim2); + } + return 0; + } + + /*------------------------------------------------------------------------- + * check for different dimensions + *------------------------------------------------------------------------- + */ + + assert(rank1==rank2); + for ( i=0; i<rank1; i++) + { + if (maxdim1 && maxdim2) + { + if ( maxdim1[i] != maxdim2[i] ) + maxdim_diff=1; + } + if ( dims1[i] != dims2[i] ) + dim_diff=1; + } + + /*------------------------------------------------------------------------- + * current dimensions + *------------------------------------------------------------------------- + */ + + if (dim_diff==1) + { + if (options->m_verbose && obj1_name) + { + printf("Comparison not supported: <%s> has rank %d, dimensions ", obj1_name, rank1); + print_dimensions(rank1,dims1); + if (maxdim1 && maxdim2) + { + printf(", max dimensions "); + print_dimensions(rank1,maxdim1); + printf("\n" ); + printf("<%s> has rank %d, dimensions ", obj2_name, rank2); + print_dimensions(rank2,dims2); + printf(", max dimensions "); + print_dimensions(rank2,maxdim2); + } + } + return 0; + } + + /*------------------------------------------------------------------------- + * maximum dimensions; just give a warning + *------------------------------------------------------------------------- + */ + if (maxdim1 && maxdim2 && maxdim_diff==1 && obj1_name ) + { + if (options->m_verbose) + { + printf( "Warning: different maximum dimensions\n"); + printf("<%s> has max dimensions ", obj1_name); + print_dimensions(rank1,maxdim1); + printf("\n"); + printf("<%s> has max dimensions ", obj2_name); + print_dimensions(rank2,maxdim2); + printf("\n"); + } + } + + return 1; } - - /*------------------------------------------------------------------------- * Function: print_sizes * @@ -887,3 +874,29 @@ void print_sizes( const char *obj1, printf("\n"); } #endif /* H5DIFF_DEBUG */ + +/*------------------------------------------------------------------------- + * Function: print_size + * + * Purpose: print dimensions + * + *------------------------------------------------------------------------- + */ +#if defined (H5DIFF_DEBUG) +static void +print_size (int rank, hsize_t *dims) +{ + int i; + + parallel_print("[" ); + for ( i = 0; i < rank-1; i++) + { + parallel_print("%"H5_PRINTF_LL_WIDTH"u", (unsigned long_long)dims[i]); + parallel_print("x"); + } + parallel_print("%"H5_PRINTF_LL_WIDTH"u", (unsigned long_long)dims[rank-1]); + parallel_print("]\n" ); + +} +#endif /* H5DIFF_DEBUG */ + diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c index 9e9c556..4cddbfb 100644 --- a/tools/lib/h5diff_util.c +++ b/tools/lib/h5diff_util.c @@ -131,91 +131,91 @@ print_dimensions (int rank, hsize_t *dims) */ void print_type(hid_t type) { - switch (H5Tget_class(type)) - { - default: - return; - case H5T_INTEGER: - if (H5Tequal(type, H5T_STD_I8BE)) { - printf("H5T_STD_I8BE"); - } else if (H5Tequal(type, H5T_STD_I8LE)) { - printf("H5T_STD_I8LE"); - } else if (H5Tequal(type, H5T_STD_I16BE)) { - printf("H5T_STD_I16BE"); - } else if (H5Tequal(type, H5T_STD_I16LE)) { - printf("H5T_STD_I16LE"); - } else if (H5Tequal(type, H5T_STD_I32BE)) { - printf("H5T_STD_I32BE"); - } else if (H5Tequal(type, H5T_STD_I32LE)) { - printf("H5T_STD_I32LE"); - } else if (H5Tequal(type, H5T_STD_I64BE)) { - printf("H5T_STD_I64BE"); - } else if (H5Tequal(type, H5T_STD_I64LE)) { - printf("H5T_STD_I64LE"); - } else if (H5Tequal(type, H5T_STD_U8BE)) { - printf("H5T_STD_U8BE"); - } else if (H5Tequal(type, H5T_STD_U8LE)) { - printf("H5T_STD_U8LE"); - } else if (H5Tequal(type, H5T_STD_U16BE)) { - printf("H5T_STD_U16BE"); - } else if (H5Tequal(type, H5T_STD_U16LE)) { - printf("H5T_STD_U16LE"); - } else if (H5Tequal(type, H5T_STD_U32BE)) { - printf("H5T_STD_U32BE"); - } else if (H5Tequal(type, H5T_STD_U32LE)) { - printf("H5T_STD_U32LE"); - } else if (H5Tequal(type, H5T_STD_U64BE)) { - printf("H5T_STD_U64BE"); - } else if (H5Tequal(type, H5T_STD_U64LE)) { - printf("H5T_STD_U64LE"); - } else if (H5Tequal(type, H5T_NATIVE_SCHAR)) { - printf("H5T_NATIVE_SCHAR"); - } else if (H5Tequal(type, H5T_NATIVE_UCHAR)) { - printf("H5T_NATIVE_UCHAR"); - } else if (H5Tequal(type, H5T_NATIVE_SHORT)) { - printf("H5T_NATIVE_SHORT"); - } else if (H5Tequal(type, H5T_NATIVE_USHORT)) { - printf("H5T_NATIVE_USHORT"); - } else if (H5Tequal(type, H5T_NATIVE_INT)) { - printf("H5T_NATIVE_INT"); - } else if (H5Tequal(type, H5T_NATIVE_UINT)) { - printf("H5T_NATIVE_UINT"); - } else if (H5Tequal(type, H5T_NATIVE_LONG)) { - printf("H5T_NATIVE_LONG"); - } else if (H5Tequal(type, H5T_NATIVE_ULONG)) { - printf("H5T_NATIVE_ULONG"); - } else if (H5Tequal(type, H5T_NATIVE_LLONG)) { - printf("H5T_NATIVE_LLONG"); - } else if (H5Tequal(type, H5T_NATIVE_ULLONG)) { - printf("H5T_NATIVE_ULLONG"); - } else { - printf("undefined integer"); - } - break; - - case H5T_FLOAT: - if (H5Tequal(type, H5T_IEEE_F32BE)) { - printf("H5T_IEEE_F32BE"); - } else if (H5Tequal(type, H5T_IEEE_F32LE)) { - printf("H5T_IEEE_F32LE"); - } else if (H5Tequal(type, H5T_IEEE_F64BE)) { - printf("H5T_IEEE_F64BE"); - } else if (H5Tequal(type, H5T_IEEE_F64LE)) { - printf("H5T_IEEE_F64LE"); - } else if (H5Tequal(type, H5T_NATIVE_FLOAT)) { - printf("H5T_NATIVE_FLOAT"); - } else if (H5Tequal(type, H5T_NATIVE_DOUBLE)) { - printf("H5T_NATIVE_DOUBLE"); + switch (H5Tget_class(type)) + { + default: + return; + case H5T_INTEGER: + if (H5Tequal(type, H5T_STD_I8BE)) { + printf("H5T_STD_I8BE"); + } else if (H5Tequal(type, H5T_STD_I8LE)) { + printf("H5T_STD_I8LE"); + } else if (H5Tequal(type, H5T_STD_I16BE)) { + printf("H5T_STD_I16BE"); + } else if (H5Tequal(type, H5T_STD_I16LE)) { + printf("H5T_STD_I16LE"); + } else if (H5Tequal(type, H5T_STD_I32BE)) { + printf("H5T_STD_I32BE"); + } else if (H5Tequal(type, H5T_STD_I32LE)) { + printf("H5T_STD_I32LE"); + } else if (H5Tequal(type, H5T_STD_I64BE)) { + printf("H5T_STD_I64BE"); + } else if (H5Tequal(type, H5T_STD_I64LE)) { + printf("H5T_STD_I64LE"); + } else if (H5Tequal(type, H5T_STD_U8BE)) { + printf("H5T_STD_U8BE"); + } else if (H5Tequal(type, H5T_STD_U8LE)) { + printf("H5T_STD_U8LE"); + } else if (H5Tequal(type, H5T_STD_U16BE)) { + printf("H5T_STD_U16BE"); + } else if (H5Tequal(type, H5T_STD_U16LE)) { + printf("H5T_STD_U16LE"); + } else if (H5Tequal(type, H5T_STD_U32BE)) { + printf("H5T_STD_U32BE"); + } else if (H5Tequal(type, H5T_STD_U32LE)) { + printf("H5T_STD_U32LE"); + } else if (H5Tequal(type, H5T_STD_U64BE)) { + printf("H5T_STD_U64BE"); + } else if (H5Tequal(type, H5T_STD_U64LE)) { + printf("H5T_STD_U64LE"); + } else if (H5Tequal(type, H5T_NATIVE_SCHAR)) { + printf("H5T_NATIVE_SCHAR"); + } else if (H5Tequal(type, H5T_NATIVE_UCHAR)) { + printf("H5T_NATIVE_UCHAR"); + } else if (H5Tequal(type, H5T_NATIVE_SHORT)) { + printf("H5T_NATIVE_SHORT"); + } else if (H5Tequal(type, H5T_NATIVE_USHORT)) { + printf("H5T_NATIVE_USHORT"); + } else if (H5Tequal(type, H5T_NATIVE_INT)) { + printf("H5T_NATIVE_INT"); + } else if (H5Tequal(type, H5T_NATIVE_UINT)) { + printf("H5T_NATIVE_UINT"); + } else if (H5Tequal(type, H5T_NATIVE_LONG)) { + printf("H5T_NATIVE_LONG"); + } else if (H5Tequal(type, H5T_NATIVE_ULONG)) { + printf("H5T_NATIVE_ULONG"); + } else if (H5Tequal(type, H5T_NATIVE_LLONG)) { + printf("H5T_NATIVE_LLONG"); + } else if (H5Tequal(type, H5T_NATIVE_ULLONG)) { + printf("H5T_NATIVE_ULLONG"); + } else { + printf("undefined integer"); + } + break; + + case H5T_FLOAT: + if (H5Tequal(type, H5T_IEEE_F32BE)) { + printf("H5T_IEEE_F32BE"); + } else if (H5Tequal(type, H5T_IEEE_F32LE)) { + printf("H5T_IEEE_F32LE"); + } else if (H5Tequal(type, H5T_IEEE_F64BE)) { + printf("H5T_IEEE_F64BE"); + } else if (H5Tequal(type, H5T_IEEE_F64LE)) { + printf("H5T_IEEE_F64LE"); + } else if (H5Tequal(type, H5T_NATIVE_FLOAT)) { + printf("H5T_NATIVE_FLOAT"); + } else if (H5Tequal(type, H5T_NATIVE_DOUBLE)) { + printf("H5T_NATIVE_DOUBLE"); #if H5_SIZEOF_LONG_DOUBLE !=0 - } else if (H5Tequal(type, H5T_NATIVE_LDOUBLE)) { - printf("H5T_NATIVE_LDOUBLE"); + } else if (H5Tequal(type, H5T_NATIVE_LDOUBLE)) { + printf("H5T_NATIVE_LDOUBLE"); #endif - } else { - printf("undefined float"); - } - break; - - }/*switch*/ + } else { + printf("undefined float"); + } + break; + + }/*switch*/ } /*------------------------------------------------------------------------- @@ -232,21 +232,21 @@ void print_type(hid_t type) const char* diff_basename(const char *name) { - size_t i; - - if (name==NULL) - return NULL; - - /* Find the end of the base name */ - i = strlen(name); - while (i>0 && '/'==name[i-1]) - --i; - - /* Skip backward over base name */ - while (i>0 && '/'!=name[i-1]) - --i; - - return(name+i); + size_t i; + + if (name==NULL) + return NULL; + + /* Find the end of the base name */ + i = strlen(name); + while (i>0 && '/'==name[i-1]) + --i; + + /* Skip backward over base name */ + while (i>0 && '/'!=name[i-1]) + --i; + + return(name+i); } /*------------------------------------------------------------------------- @@ -295,15 +295,15 @@ get_type(h5trav_type_t type) const char* get_sign(H5T_sign_t sign) { - switch (sign) - { - default: - return("H5T_SGN_ERROR"); - case H5T_SGN_NONE: - return("H5T_SGN_NONE"); - case H5T_SGN_2: - return("H5T_SGN_2"); - } + switch (sign) + { + default: + return("H5T_SGN_ERROR"); + case H5T_SGN_NONE: + return("H5T_SGN_NONE"); + case H5T_SGN_2: + return("H5T_SGN_2"); + } } @@ -321,33 +321,33 @@ get_sign(H5T_sign_t sign) const char* get_class(H5T_class_t tclass) { - switch (tclass) - { - default: - return("Invalid class"); - case H5T_TIME: - return("H5T_TIME"); - case H5T_INTEGER: - return("H5T_INTEGER"); - case H5T_FLOAT: - return("H5T_FLOAT"); - case H5T_STRING: - return("H5T_STRING"); - case H5T_BITFIELD: - return("H5T_BITFIELD"); - case H5T_OPAQUE: - return("H5T_OPAQUE"); - case H5T_COMPOUND: - return("H5T_COMPOUND"); - case H5T_REFERENCE: - return("H5T_REFERENCE"); - case H5T_ENUM: - return("H5T_ENUM"); - case H5T_VLEN: - return("H5T_VLEN"); - case H5T_ARRAY: - return("H5T_ARRAY"); - } + switch (tclass) + { + default: + return("Invalid class"); + case H5T_TIME: + return("H5T_TIME"); + case H5T_INTEGER: + return("H5T_INTEGER"); + case H5T_FLOAT: + return("H5T_FLOAT"); + case H5T_STRING: + return("H5T_STRING"); + case H5T_BITFIELD: + return("H5T_BITFIELD"); + case H5T_OPAQUE: + return("H5T_OPAQUE"); + case H5T_COMPOUND: + return("H5T_COMPOUND"); + case H5T_REFERENCE: + return("H5T_REFERENCE"); + case H5T_ENUM: + return("H5T_ENUM"); + case H5T_VLEN: + return("H5T_VLEN"); + case H5T_ARRAY: + return("H5T_ARRAY"); + } } /*------------------------------------------------------------------------- diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 6fc09d7..120d433 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -538,29 +538,31 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai hsize_t nelmts, hid_t type, void *_mem) { unsigned char *mem = (unsigned char*)_mem; - hsize_t i; /*element counter */ - char *s, *section; /*a section of output */ - int secnum; /*section sequence number */ - size_t size; /*size of each datum */ - size_t ncols = 80; /*available output width */ - h5tools_str_t buffer; /*string into which to render */ - int multiline; /*datum was multiline */ - hsize_t curr_pos; /* total data element position */ - int elmt_counter = 0;/*counts the # elements printed. - *I (ptl?) needed something that - *isn't going to get reset when a new - *line is formed. I'm going to use - *this var to count elements and - *break after we see a number equal - *to the ctx->size_last_dim. */ + hsize_t i; /*element counter */ + char *s; + char *section; /*a section of output */ + int secnum; /*section sequence number */ + size_t size; /*size of each datum */ + size_t ncols = 80; /*available output width */ + h5tools_str_t buffer; /*string into which to render */ + int multiline; /*datum was multiline */ + hsize_t curr_pos; /* total data element position */ + int elmt_counter = 0;/*counts the # elements printed. + *I (ptl?) needed something that + *isn't going to get reset when a new + *line is formed. I'm going to use + *this var to count elements and + *break after we see a number equal + *to the ctx->size_last_dim. */ /* binary dump */ - if(bin_output) { + if(bin_output) + { do_bin_output(stream, nelmts, type, _mem); - bin_output = 0; } /* end if */ - else { - /* Setup */ + else + { + /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); size = H5Tget_size(type); @@ -613,7 +615,7 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai } /* - * We need to break after each row_counter of a dimension---> we should + * We need to break after each row of a dimension---> we should * break at the end of the each last dimension well that is the * way the dumper did it before */ diff --git a/tools/testfiles/h5diff_58.txt b/tools/testfiles/h5diff_58.txt index 38d3177..b582c88 100644 --- a/tools/testfiles/h5diff_58.txt +++ b/tools/testfiles/h5diff_58.txt @@ -2,7 +2,7 @@ Expected output for 'h5diff -v h5diff_dset1.h5 h5diff_dset2.h5 refreg' ############################# dataset: </refreg> and </refreg> -Referenced dataset 5904 5904 +Referenced dataset 10272 10272 ------------------------------------------------------------ Region blocks block #0 (2,2)-(7,7) (0,0)-(2,2) diff --git a/tools/testfiles/h5diff_70.txt b/tools/testfiles/h5diff_70.txt index fe3e03f..bc9efbe 100644 --- a/tools/testfiles/h5diff_70.txt +++ b/tools/testfiles/h5diff_70.txt @@ -19,6 +19,15 @@ position string of </> string of </> difference [ 1 ] d z [ 1 ] e z 4 differences found +attribute: <VLstring of </>> and <VLstring of </>> +size: [2] [2] +position VLstring of </> VLstring of </> difference +------------------------------------------------------------ +[ 0 ] a z +[ 0 ] b z +[ 1 ] d z +[ 1 ] e z +4 differences found attribute: <bitfield of </>> and <bitfield of </>> size: [2] [2] position bitfield of </> bitfield of </> difference @@ -99,6 +108,23 @@ position string2D of </> string2D of </> difference [ 2 1 ] k z [ 2 1 ] l z 12 differences found +attribute: <VLstring2D of </>> and <VLstring2D of </>> +size: [3x2] [3x2] +position VLstring2D of </> VLstring2D of </> difference +------------------------------------------------------------ +[ 0 0 ] a z +[ 0 0 ] b z +[ 0 1 ] c z +[ 0 1 ] d z +[ 1 0 ] e z +[ 1 0 ] f z +[ 1 1 ] g z +[ 1 1 ] h z +[ 2 0 ] i z +[ 2 0 ] j z +[ 2 1 ] k z +[ 2 1 ] l z +12 differences found attribute: <bitfield2D of </>> and <bitfield2D of </>> size: [3x2] [3x2] position bitfield2D of </> bitfield2D of </> difference @@ -262,6 +288,58 @@ position string3D of </> string3D of </> difference [ 3 2 1 ] X z [ 3 2 1 ] Z z 47 differences found +attribute: <VLstring3D of </>> and <VLstring3D of </>> +size: [4x3x2] [4x3x2] +position VLstring3D of </> VLstring3D of </> difference +------------------------------------------------------------ +[ 0 0 0 ] a z +[ 0 0 0 ] b z +[ 0 0 1 ] c z +[ 0 0 1 ] d z +[ 0 1 0 ] e z +[ 0 1 0 ] f z +[ 0 1 1 ] g z +[ 0 1 1 ] h z +[ 0 2 0 ] i z +[ 0 2 0 ] j z +[ 0 2 1 ] k z +[ 0 2 1 ] l z +[ 1 0 0 ] m z +[ 1 0 0 ] n z +[ 1 0 1 ] p z +[ 1 0 1 ] q z +[ 1 1 0 ] r z +[ 1 1 0 ] s z +[ 1 1 1 ] t z +[ 1 1 1 ] u z +[ 1 2 0 ] v z +[ 1 2 0 ] w z +[ 1 2 1 ] x z +[ 2 0 0 ] A z +[ 2 0 0 ] B z +[ 2 0 1 ] C z +[ 2 0 1 ] D z +[ 2 1 0 ] E z +[ 2 1 0 ] F z +[ 2 1 1 ] G z +[ 2 1 1 ] H z +[ 2 2 0 ] I z +[ 2 2 0 ] J z +[ 2 2 1 ] K z +[ 2 2 1 ] L z +[ 3 0 0 ] M z +[ 3 0 0 ] N z +[ 3 0 1 ] P z +[ 3 0 1 ] Q z +[ 3 1 0 ] R z +[ 3 1 0 ] S z +[ 3 1 1 ] T z +[ 3 1 1 ] U z +[ 3 2 0 ] V z +[ 3 2 0 ] W z +[ 3 2 1 ] X z +[ 3 2 1 ] Z z +47 differences found attribute: <bitfield3D of </>> and <bitfield3D of </>> size: [4x3x2] [4x3x2] position bitfield3D of </> bitfield3D of </> difference @@ -612,6 +690,15 @@ position string of </dset> string of </dset> difference [ 1 ] d z [ 1 ] e z 4 differences found +attribute: <VLstring of </dset>> and <VLstring of </dset>> +size: [2] [2] +position VLstring of </dset> VLstring of </dset> difference +------------------------------------------------------------ +[ 0 ] a z +[ 0 ] b z +[ 1 ] d z +[ 1 ] e z +4 differences found attribute: <bitfield of </dset>> and <bitfield of </dset>> size: [2] [2] position bitfield of </dset> bitfield of </dset> difference @@ -694,6 +781,23 @@ position string2D of </dset> string2D of </dset> difference [ 2 1 ] k z [ 2 1 ] l z 12 differences found +attribute: <VLstring2D of </dset>> and <VLstring2D of </dset>> +size: [3x2] [3x2] +position VLstring2D of </dset> VLstring2D of </dset> difference +------------------------------------------------------------ +[ 0 0 ] a z +[ 0 0 ] b z +[ 0 1 ] c z +[ 0 1 ] d z +[ 1 0 ] e z +[ 1 0 ] f z +[ 1 1 ] g z +[ 1 1 ] h z +[ 2 0 ] i z +[ 2 0 ] j z +[ 2 1 ] k z +[ 2 1 ] l z +12 differences found attribute: <bitfield2D of </dset>> and <bitfield2D of </dset>> size: [3x2] [3x2] position bitfield2D of </dset> bitfield2D of </dset> difference @@ -859,6 +963,58 @@ position string3D of </dset> string3D of </dset> difference [ 3 2 1 ] X z [ 3 2 1 ] Z z 47 differences found +attribute: <VLstring3D of </dset>> and <VLstring3D of </dset>> +size: [4x3x2] [4x3x2] +position VLstring3D of </dset> VLstring3D of </dset> difference +------------------------------------------------------------ +[ 0 0 0 ] a z +[ 0 0 0 ] b z +[ 0 0 1 ] c z +[ 0 0 1 ] d z +[ 0 1 0 ] e z +[ 0 1 0 ] f z +[ 0 1 1 ] g z +[ 0 1 1 ] h z +[ 0 2 0 ] i z +[ 0 2 0 ] j z +[ 0 2 1 ] k z +[ 0 2 1 ] l z +[ 1 0 0 ] m z +[ 1 0 0 ] n z +[ 1 0 1 ] p z +[ 1 0 1 ] q z +[ 1 1 0 ] r z +[ 1 1 0 ] s z +[ 1 1 1 ] t z +[ 1 1 1 ] u z +[ 1 2 0 ] v z +[ 1 2 0 ] w z +[ 1 2 1 ] x z +[ 2 0 0 ] A z +[ 2 0 0 ] B z +[ 2 0 1 ] C z +[ 2 0 1 ] D z +[ 2 1 0 ] E z +[ 2 1 0 ] F z +[ 2 1 1 ] G z +[ 2 1 1 ] H z +[ 2 2 0 ] I z +[ 2 2 0 ] J z +[ 2 2 1 ] K z +[ 2 2 1 ] L z +[ 3 0 0 ] M z +[ 3 0 0 ] N z +[ 3 0 1 ] P z +[ 3 0 1 ] Q z +[ 3 1 0 ] R z +[ 3 1 0 ] S z +[ 3 1 1 ] T z +[ 3 1 1 ] U z +[ 3 2 0 ] V z +[ 3 2 0 ] W z +[ 3 2 1 ] X z +[ 3 2 1 ] Z z +47 differences found attribute: <bitfield3D of </dset>> and <bitfield3D of </dset>> size: [4x3x2] [4x3x2] position bitfield3D of </dset> bitfield3D of </dset> difference @@ -1200,7 +1356,7 @@ position float3D of </dset> float3D of </dset> difference [ 3 2 0 ] 23 0 23 [ 3 2 1 ] 24 0 24 24 differences found -456 differences found +519 differences found group : </g1> and </g1> 0 differences found attribute: <string of </g1>> and <string of </g1>> @@ -1212,6 +1368,15 @@ position string of </g1> string of </g1> difference [ 1 ] d z [ 1 ] e z 4 differences found +attribute: <VLstring of </g1>> and <VLstring of </g1>> +size: [2] [2] +position VLstring of </g1> VLstring of </g1> difference +------------------------------------------------------------ +[ 0 ] a z +[ 0 ] b z +[ 1 ] d z +[ 1 ] e z +4 differences found attribute: <bitfield of </g1>> and <bitfield of </g1>> size: [2] [2] position bitfield of </g1> bitfield of </g1> difference @@ -1292,6 +1457,23 @@ position string2D of </g1> string2D of </g1> difference [ 2 1 ] k z [ 2 1 ] l z 12 differences found +attribute: <VLstring2D of </g1>> and <VLstring2D of </g1>> +size: [3x2] [3x2] +position VLstring2D of </g1> VLstring2D of </g1> difference +------------------------------------------------------------ +[ 0 0 ] a z +[ 0 0 ] b z +[ 0 1 ] c z +[ 0 1 ] d z +[ 1 0 ] e z +[ 1 0 ] f z +[ 1 1 ] g z +[ 1 1 ] h z +[ 2 0 ] i z +[ 2 0 ] j z +[ 2 1 ] k z +[ 2 1 ] l z +12 differences found attribute: <bitfield2D of </g1>> and <bitfield2D of </g1>> size: [3x2] [3x2] position bitfield2D of </g1> bitfield2D of </g1> difference @@ -1455,6 +1637,58 @@ position string3D of </g1> string3D of </g1> difference [ 3 2 1 ] X z [ 3 2 1 ] Z z 47 differences found +attribute: <VLstring3D of </g1>> and <VLstring3D of </g1>> +size: [4x3x2] [4x3x2] +position VLstring3D of </g1> VLstring3D of </g1> difference +------------------------------------------------------------ +[ 0 0 0 ] a z +[ 0 0 0 ] b z +[ 0 0 1 ] c z +[ 0 0 1 ] d z +[ 0 1 0 ] e z +[ 0 1 0 ] f z +[ 0 1 1 ] g z +[ 0 1 1 ] h z +[ 0 2 0 ] i z +[ 0 2 0 ] j z +[ 0 2 1 ] k z +[ 0 2 1 ] l z +[ 1 0 0 ] m z +[ 1 0 0 ] n z +[ 1 0 1 ] p z +[ 1 0 1 ] q z +[ 1 1 0 ] r z +[ 1 1 0 ] s z +[ 1 1 1 ] t z +[ 1 1 1 ] u z +[ 1 2 0 ] v z +[ 1 2 0 ] w z +[ 1 2 1 ] x z +[ 2 0 0 ] A z +[ 2 0 0 ] B z +[ 2 0 1 ] C z +[ 2 0 1 ] D z +[ 2 1 0 ] E z +[ 2 1 0 ] F z +[ 2 1 1 ] G z +[ 2 1 1 ] H z +[ 2 2 0 ] I z +[ 2 2 0 ] J z +[ 2 2 1 ] K z +[ 2 2 1 ] L z +[ 3 0 0 ] M z +[ 3 0 0 ] N z +[ 3 0 1 ] P z +[ 3 0 1 ] Q z +[ 3 1 0 ] R z +[ 3 1 0 ] S z +[ 3 1 1 ] T z +[ 3 1 1 ] U z +[ 3 2 0 ] V z +[ 3 2 0 ] W z +[ 3 2 1 ] X z +[ 3 2 1 ] Z z +47 differences found attribute: <bitfield3D of </g1>> and <bitfield3D of </g1>> size: [4x3x2] [4x3x2] position bitfield3D of </g1> bitfield3D of </g1> difference diff --git a/tools/testfiles/h5diff_80.txt b/tools/testfiles/h5diff_80.txt index 90ee5c0..9c0bd33 100644 --- a/tools/testfiles/h5diff_80.txt +++ b/tools/testfiles/h5diff_80.txt @@ -8,6 +8,9 @@ file1 file2 x x /dset x x /dsetref x x /g1 + x x /g1/VLstring + x x /g1/VLstring2D + x x /g1/VLstring3D x x /g1/array x x /g1/array2D x x /g1/array3D @@ -53,6 +56,84 @@ dataset: </dsetref> and </dsetref> 0 differences found group : </g1> and </g1> 0 differences found +dataset: </g1/VLstring> and </g1/VLstring> +size: [2] [2] +position VLstring VLstring difference +------------------------------------------------------------ +[ 0 ] a z +[ 0 ] b z +[ 1 ] d z +[ 1 ] e z +4 differences found +dataset: </g1/VLstring2D> and </g1/VLstring2D> +size: [3x2] [3x2] +position VLstring2D VLstring2D difference +------------------------------------------------------------ +[ 0 0 ] a z +[ 0 0 ] b z +[ 0 1 ] c z +[ 0 1 ] d z +[ 1 0 ] e z +[ 1 0 ] f z +[ 1 1 ] g z +[ 1 1 ] h z +[ 2 0 ] i z +[ 2 0 ] j z +[ 2 1 ] k z +[ 2 1 ] l z +12 differences found +dataset: </g1/VLstring3D> and </g1/VLstring3D> +size: [4x3x2] [4x3x2] +position VLstring3D VLstring3D difference +------------------------------------------------------------ +[ 0 0 0 ] a z +[ 0 0 0 ] b z +[ 0 0 1 ] c z +[ 0 0 1 ] d z +[ 0 1 0 ] e z +[ 0 1 0 ] f z +[ 0 1 1 ] g z +[ 0 1 1 ] h z +[ 0 2 0 ] i z +[ 0 2 0 ] j z +[ 0 2 1 ] k z +[ 0 2 1 ] l z +[ 1 0 0 ] m z +[ 1 0 0 ] n z +[ 1 0 1 ] p z +[ 1 0 1 ] q z +[ 1 1 0 ] r z +[ 1 1 0 ] s z +[ 1 1 1 ] t z +[ 1 1 1 ] u z +[ 1 2 0 ] v z +[ 1 2 0 ] w z +[ 1 2 1 ] x z +[ 2 0 0 ] A z +[ 2 0 0 ] B z +[ 2 0 1 ] C z +[ 2 0 1 ] D z +[ 2 1 0 ] E z +[ 2 1 0 ] F z +[ 2 1 1 ] G z +[ 2 1 1 ] H z +[ 2 2 0 ] I z +[ 2 2 0 ] J z +[ 2 2 1 ] K z +[ 2 2 1 ] L z +[ 3 0 0 ] M z +[ 3 0 0 ] N z +[ 3 0 1 ] P z +[ 3 0 1 ] Q z +[ 3 1 0 ] R z +[ 3 1 0 ] S z +[ 3 1 1 ] T z +[ 3 1 1 ] U z +[ 3 2 0 ] V z +[ 3 2 0 ] W z +[ 3 2 1 ] X z +[ 3 2 1 ] Z z +47 differences found dataset: </g1/array> and </g1/array> size: [2] [2] position array array difference @@ -776,7 +857,7 @@ position vlen3D vlen3D difference [ 3 2 1 ] 59 0 59 59 differences found dataset: </refreg> and </refreg> -Referenced dataset 5904 5904 +Referenced dataset 10272 10272 ------------------------------------------------------------ Region blocks block #0 (2,2)-(7,7) (0,0)-(2,2) diff --git a/tools/testfiles/h5diff_attr1.h5 b/tools/testfiles/h5diff_attr1.h5 Binary files differindex e261486..c44066b 100644 --- a/tools/testfiles/h5diff_attr1.h5 +++ b/tools/testfiles/h5diff_attr1.h5 diff --git a/tools/testfiles/h5diff_attr2.h5 b/tools/testfiles/h5diff_attr2.h5 Binary files differindex 0a59fc5..5de3303 100644 --- a/tools/testfiles/h5diff_attr2.h5 +++ b/tools/testfiles/h5diff_attr2.h5 diff --git a/tools/testfiles/h5diff_basic2.h5 b/tools/testfiles/h5diff_basic2.h5 Binary files differindex 209485f..ad45cc0 100644 --- a/tools/testfiles/h5diff_basic2.h5 +++ b/tools/testfiles/h5diff_basic2.h5 diff --git a/tools/testfiles/h5diff_dset1.h5 b/tools/testfiles/h5diff_dset1.h5 Binary files differindex 3f853be..ab6b96f 100644 --- a/tools/testfiles/h5diff_dset1.h5 +++ b/tools/testfiles/h5diff_dset1.h5 diff --git a/tools/testfiles/h5diff_dset2.h5 b/tools/testfiles/h5diff_dset2.h5 Binary files differindex 1f14d29..3db0c8e 100644 --- a/tools/testfiles/h5diff_dset2.h5 +++ b/tools/testfiles/h5diff_dset2.h5 diff --git a/tools/testfiles/tallfilters.ddl b/tools/testfiles/tallfilters.ddl index 282c085..43c27a9 100644 --- a/tools/testfiles/tallfilters.ddl +++ b/tools/testfiles/tallfilters.ddl @@ -7,7 +7,7 @@ DATASET "all" { DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) } STORAGE_LAYOUT { CHUNKED ( 10, 5 ) - SIZE 458 + SIZE 458 (42.8%COMPRESSION) } FILTERS { PREPROCESSING SHUFFLE diff --git a/tools/testfiles/tbin4.ddl b/tools/testfiles/tbin4.ddl index 89849e4..78a6cd2 100644 --- a/tools/testfiles/tbin4.ddl +++ b/tools/testfiles/tbin4.ddl @@ -1,7 +1,7 @@ HDF5 "tbinary.h5" { DATASET "double" { DATATYPE H5T_IEEE_F64LE - DATASPACE SIMPLE { ( 100000 ) / ( 100000 ) } + DATASPACE SIMPLE { ( 6 ) / ( 6 ) } DATA { } } diff --git a/tools/testfiles/tbinary.h5 b/tools/testfiles/tbinary.h5 Binary files differindex 691b008..adc5b15 100644 --- a/tools/testfiles/tbinary.h5 +++ b/tools/testfiles/tbinary.h5 diff --git a/tools/testfiles/tdeflate.ddl b/tools/testfiles/tdeflate.ddl index fc98432..cc5b49b 100644 --- a/tools/testfiles/tdeflate.ddl +++ b/tools/testfiles/tdeflate.ddl @@ -7,7 +7,7 @@ DATASET "deflate" { DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) } STORAGE_LAYOUT { CHUNKED ( 10, 5 ) - SIZE 385 + SIZE 385 (51.9%COMPRESSION) } FILTERS { COMPRESSION DEFLATE { LEVEL 9 } diff --git a/tools/testfiles/tnbit.ddl b/tools/testfiles/tnbit.ddl index a8bf549..2f932b5 100644 --- a/tools/testfiles/tnbit.ddl +++ b/tools/testfiles/tnbit.ddl @@ -7,7 +7,7 @@ DATASET "nbit" { DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) } STORAGE_LAYOUT { CHUNKED ( 10, 5 ) - SIZE 76 + SIZE 76 (90.5%COMPRESSION) } FILTERS { COMPRESSION NBIT diff --git a/tools/testfiles/tscaleoffset.ddl b/tools/testfiles/tscaleoffset.ddl index 6693f92..c9a46f4 100644 --- a/tools/testfiles/tscaleoffset.ddl +++ b/tools/testfiles/tscaleoffset.ddl @@ -7,7 +7,7 @@ DATASET "scaleoffset" { DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) } STORAGE_LAYOUT { CHUNKED ( 10, 5 ) - SIZE 152 + SIZE 152 (81.0%COMPRESSION) } FILTERS { COMPRESSION SCALEOFFSET { MIN BITS 4 } diff --git a/tools/testfiles/tszip.ddl b/tools/testfiles/tszip.ddl index 4c6af47..6411bc3 100644 --- a/tools/testfiles/tszip.ddl +++ b/tools/testfiles/tszip.ddl @@ -7,7 +7,7 @@ DATASET "szip" { DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) } STORAGE_LAYOUT { CHUNKED ( 10, 5 ) - SIZE 372 + SIZE 372 (53.5%COMPRESSION) } FILTERS { COMPRESSION SZIP { |