diff options
author | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2016-04-13 17:41:24 (GMT) |
---|---|---|
committer | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2016-04-13 17:41:24 (GMT) |
commit | 257689f6b4511ed3031d08d638550aa2e864d294 (patch) | |
tree | a05fb4bbd91ca946baea2282d7f34ac75c08eb4a /tools/h5dump | |
parent | afd696593b786db4c68d7ad0235da145ba250568 (diff) | |
parent | 261f8c83611db7b19f3a697720926d825b375a1d (diff) | |
download | hdf5-257689f6b4511ed3031d08d638550aa2e864d294.zip hdf5-257689f6b4511ed3031d08d638550aa2e864d294.tar.gz hdf5-257689f6b4511ed3031d08d638550aa2e864d294.tar.bz2 |
[svn-r29689] old merge from trunk.
Diffstat (limited to 'tools/h5dump')
-rw-r--r-- | tools/h5dump/CMakeTests.cmake | 25 | ||||
-rw-r--r-- | tools/h5dump/CMakeTestsVDS.cmake | 28 | ||||
-rw-r--r-- | tools/h5dump/h5dump.c | 18 | ||||
-rw-r--r-- | tools/h5dump/h5dump.h | 2 | ||||
-rw-r--r-- | tools/h5dump/h5dump_ddl.c | 306 | ||||
-rw-r--r-- | tools/h5dump/h5dump_extern.h | 2 | ||||
-rw-r--r-- | tools/h5dump/h5dumpgentest.c | 177 | ||||
-rw-r--r-- | tools/h5dump/testh5dump.sh.in | 13 | ||||
-rw-r--r-- | tools/h5dump/testh5dumpvds.sh.in | 18 |
9 files changed, 387 insertions, 202 deletions
diff --git a/tools/h5dump/CMakeTests.cmake b/tools/h5dump/CMakeTests.cmake index c256e11..9f7e2b0 100644 --- a/tools/h5dump/CMakeTests.cmake +++ b/tools/h5dump/CMakeTests.cmake @@ -103,6 +103,12 @@ ${HDF5_TOOLS_SRC_DIR}/testfiles/tindicessub3.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tindicessub4.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tindicesyes.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/tints4dims.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/tints4dimsBlock2.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/tints4dimsBlockEq.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/tints4dimsCount2.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/tints4dimsCountEq.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/tints4dimsStride2.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tintsattrs.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tlarge_objname.ddl #${HDF5_TOOLS_SRC_DIR}/testfiles/tldouble.ddl @@ -244,6 +250,7 @@ ${HDF5_TOOLS_SRC_DIR}/testfiles/tgrp_comments.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/thlink.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/thyperslab.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tints4dims.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tintsattrs.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tlarge_objname.h5 #${HDF5_TOOLS_SRC_DIR}/testfiles/tldouble.h5 @@ -915,6 +922,18 @@ texceedsubblock.out.err tindicesyes.out tindicesyes.out.err + tints4dims.out + tints4dims.out.err + tints4dimsBlock2.out + tints4dimsBlock2.out.err + tints4dimsBlockEq.out + tints4dimsBlockEq.out.err + tints4dimsCount2.out + tints4dimsCount2.out.err + tints4dimsCountEq.out + tints4dimsCountEq.out.err + tints4dimsStride2.out + tints4dimsStride2.out.err tintsattrs.out tintsattrs.out.err tlarge_objname.out @@ -1236,6 +1255,12 @@ ADD_H5_TEST (tdset-3s 0 --enable-error-stack -d "/dset1[1,1;;;]" tdset.h5) ADD_H5_TEST (tno-subset 0 --enable-error-stack --no-compact-subset -d "AHFINDERDIRECT::ah_centroid_t[0] it=0 tl=0" tno-subset.h5) + ADD_H5_TEST (tints4dimsCount2 0 --enable-error-stack -d FourDimInts -s 0,0,0,0 -c 2,2,2,2 tints4dims.h5) + ADD_H5_TEST (tints4dimsBlock2 0 --enable-error-stack -d FourDimInts -s 0,0,0,0 -c 1,1,1,1 -k 2,2,2,2 tints4dims.h5) + ADD_H5_TEST (tints4dimsStride2 0 --enable-error-stack -d FourDimInts -s 0,0,0,0 -S 2,2,2,2 -c 2,2,2,2 tints4dims.h5) + ADD_H5_TEST (tints4dimsCountEq 0 --enable-error-stack -d FourDimInts -s 0,0,0,0 -S 2,2,1,1 -k 1,2,1,1 -c 2,2,4,4 tints4dims.h5) + ADD_H5_TEST (tints4dimsBlockEq 0 --enable-error-stack -d FourDimInts -s 0,0,0,0 -S 2,2,1,1 -c 2,2,1,1 -k 1,2,4,4 tints4dims.h5) + # test printing characters in ASCII instead of decimal ADD_H5_TEST (tchar1 0 --enable-error-stack -r tchar.h5) diff --git a/tools/h5dump/CMakeTestsVDS.cmake b/tools/h5dump/CMakeTestsVDS.cmake index 58287fa..cc68896 100644 --- a/tools/h5dump/CMakeTestsVDS.cmake +++ b/tools/h5dump/CMakeTestsVDS.cmake @@ -22,6 +22,11 @@ tvds_layout-3_2.ddl tvds_layout-4.ddl tvds_layout-5.ddl + vds-first.ddl + vds-gap1.ddl + vds-gap2.ddl + vds_layout-eiger.ddl + vds_layout-maxmin.ddl ) set (HDF5_REFERENCE_TEST_VDS 1_a.h5 @@ -47,6 +52,14 @@ 5_b.h5 5_c.h5 5_vds.h5 + a.h5 + b.h5 + c.h5 + d.h5 + vds-percival-unlim-maxmin.h5 + f-0.h5 + f-3.h5 + vds-eiger.h5 ) set (HDF5_ERROR_REFERENCE_VDS ) @@ -184,6 +197,12 @@ tvds-4.out.err tvds-5.out tvds-5.out.err + vds-first.out + vds-first.out.err + vds-gap1.out + vds-gap1.out.err + vds-gap2.out + vds-gap2.out.err tvds_layout-1.out tvds_layout-1.out.err tvds_layout-2.out @@ -196,6 +215,10 @@ tvds_layout-4.out.err tvds_layout-5.out tvds_layout-5.out.err + vds_layout-eiger.out + vds_layout-eiger.out.err + vds_layout-maxmin.out + vds_layout-maxmin.out.err ) set_tests_properties (H5DUMP_VDS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") if (NOT "${last_vds_test}" STREQUAL "") @@ -225,6 +248,9 @@ ADD_H5_VDS_TEST (tvds-3_2 0 --enable-error-stack 3_2_vds.h5) ADD_H5_VDS_TEST (tvds-4 0 --enable-error-stack 4_vds.h5) ADD_H5_VDS_TEST (tvds-5 0 --enable-error-stack 5_vds.h5) + ADD_H5_VDS_TEST (vds-first 0 --vds-view-first-missing --enable-error-stack vds-percival-unlim-maxmin.h5) + ADD_H5_VDS_TEST (vds-gap1 0 -d /VDS-Eiger --vds-gap-size=1 --enable-error-stack vds-eiger.h5) + ADD_H5_VDS_TEST (vds-gap2 0 --vds-gap-size=2 --enable-error-stack vds-eiger.h5) endif (USE_FILTER_DEFLATE) # Layout read @@ -235,4 +261,6 @@ ADD_H5_VDS_LAYOUT (tvds_layout-3_2 0 --enable-error-stack 3_2_vds.h5) ADD_H5_VDS_LAYOUT (tvds_layout-4 0 --enable-error-stack 4_vds.h5) ADD_H5_VDS_LAYOUT (tvds_layout-5 0 --enable-error-stack 5_vds.h5) + ADD_H5_VDS_LAYOUT (vds_layout-eiger 0 --enable-error-stack vds-eiger.h5) + ADD_H5_VDS_LAYOUT (vds_layout-maxmin 0 --enable-error-stack vds-percival-unlim-maxmin.h5) endif (USE_FILTER_DEFLATE) diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index ffba581..553db93 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -71,7 +71,7 @@ struct handler_t { */ /* The following initialization makes use of C language cancatenating */ /* "xxx" "yyy" into "xxxyyy". */ -static const char *s_opts = "hn*peyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o*b*F:s:S:A*q:z:m:RECM:O*N:"; +static const char *s_opts = "hn*peyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o*b*F:s:S:A*q:z:m:RECM:O*N:vG:"; static struct long_options l_opts[] = { { "help", no_arg, 'h' }, { "hel", no_arg, 'h' }, @@ -190,6 +190,8 @@ static struct long_options l_opts[] = { { "no-compact-subset", no_arg, 'C' }, { "ddl", optional_arg, 'O' }, { "any_path", require_arg, 'N' }, + { "vds-view-first-missing", no_arg, 'v' }, + { "vds-gap-size", require_arg, 'G' }, { NULL, 0, '\0' } }; @@ -242,7 +244,7 @@ usage(const char *prog) PRINTVALSTREAM(rawoutstream, " -o F, --output=F Output raw data into file F\n"); PRINTVALSTREAM(rawoutstream, " -b B, --binary=B Binary file output, of form B\n"); PRINTVALSTREAM(rawoutstream, " -O F, --ddl=F Output ddl text into file F\n"); - PRINTVALSTREAM(rawoutstream, " Do not use filename F to suppress ddl display\n"); + PRINTVALSTREAM(rawoutstream, " Use blank(empty) filename F to suppress ddl display\n"); PRINTVALSTREAM(rawoutstream, "--------------- Object Options ---------------\n"); PRINTVALSTREAM(rawoutstream, " -a P, --attribute=P Print the specified attribute\n"); PRINTVALSTREAM(rawoutstream, " If an attribute name contains a slash (/), escape the\n"); @@ -256,6 +258,8 @@ usage(const char *prog) PRINTVALSTREAM(rawoutstream, " P can be the absolute path or just a relative path.\n"); PRINTVALSTREAM(rawoutstream, " -A, --onlyattr Print the header and value of attributes\n"); PRINTVALSTREAM(rawoutstream, " Optional value 0 suppresses printing attributes.\n"); + PRINTVALSTREAM(rawoutstream, " --vds-view-first-missing Set the VDS bounds to first missing mapped elements.\n"); + PRINTVALSTREAM(rawoutstream, " --vds-gap-size=N Set the missing file gap size, N=non-negative integers\n"); PRINTVALSTREAM(rawoutstream, "--------------- Object Property Options ---------------\n"); PRINTVALSTREAM(rawoutstream, " -i, --object-ids Print the object ids\n"); PRINTVALSTREAM(rawoutstream, " -p, --properties Print dataset filters, storage layout and fill value\n"); @@ -1121,6 +1125,16 @@ parse_start: } display_packed_bits = TRUE; break; + case 'v': + display_vds_first = TRUE; + break; + case 'G': + vds_gap_size = HDatoi(opt_arg); + if (vds_gap_size < 0) { + usage(h5tools_getprogname()); + goto error; + } + break; /** begin XML parameters **/ case 'x': diff --git a/tools/h5dump/h5dump.h b/tools/h5dump/h5dump.h index 2b1fb04..7cf4efd 100644 --- a/tools/h5dump/h5dump.h +++ b/tools/h5dump/h5dump.h @@ -78,6 +78,8 @@ int enable_error_stack= FALSE; /* re-enable error stack */ int disable_compact_subset= FALSE; /* disable compact form of subset notation */ int display_packed_bits = FALSE; /*print 1-8 byte numbers as packed bits*/ int include_attrs = TRUE; /* Display attributes */ +int display_vds_first = FALSE; /* vds display to all by default*/ +int vds_gap_size = 0; /* vds skip missing files default is none */ /* sort parameters */ H5_index_t sort_by = H5_INDEX_NAME; /*sort_by [creation_order | name] */ diff --git a/tools/h5dump/h5dump_ddl.c b/tools/h5dump/h5dump_ddl.c index fd50710..09751ab 100644 --- a/tools/h5dump/h5dump_ddl.c +++ b/tools/h5dump/h5dump_ddl.c @@ -26,12 +26,12 @@ typedef struct { hid_t fid; /* File ID being traversed */ - char *op_name; /* Object name wanted */ + char *op_name; /* Object name wanted */ } trav_handle_udata_t; typedef struct { - char *path; /* Path of object being searched */ - char *op_name; /* Object name wanted */ + char *path; /* Path of object being searched */ + char *op_name; /* Object name wanted */ } trav_attr_udata_t; /* callback function used by H5Literate() */ @@ -90,7 +90,7 @@ dump_dataspace(hid_t space) HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; - + h5tools_dump_dataspace(rawoutstream, outputformat, &ctx, space); } @@ -117,19 +117,19 @@ dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED * h5tools_context_t ctx; /* print context */ h5tool_format_t *outputformat = &h5tools_dataformat; h5tool_format_t string_dataformat; - + hid_t attr_id; herr_t ret = SUCCEED; HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; - + attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT); oid_output = display_oid; data_output = display_data; attr_data_output = display_attr_data; - + string_dataformat = *outputformat; if (fp_format) { @@ -155,7 +155,7 @@ dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED * h5tools_setstatus(EXIT_FAILURE); ret = FAIL; } - + return ret; } @@ -185,6 +185,7 @@ static herr_t dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR_UNUSED *op_data) { hid_t obj; + hid_t dapl_id = H5P_DEFAULT; /* dataset access property list ID */ herr_t ret = SUCCEED; char *obj_path = NULL; /* Full path of object */ h5tools_str_t buffer; /* string into which to render */ @@ -199,7 +200,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; - + string_dataformat = *outputformat; if (fp_format) { @@ -222,8 +223,8 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR if(!obj_path) { ret = FAIL; goto done; - } - + } + HDstrcpy(obj_path, prefix); HDstrcat(obj_path, "/"); HDstrcat(obj_path, name); @@ -269,7 +270,20 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR break; case H5O_TYPE_DATASET: - if((obj = H5Dopen2(group, name, H5P_DEFAULT)) >= 0) { + if(display_data) { + if ((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) { + error_msg("error in creating default access property list ID\n"); + } + if (display_vds_first) { + if(H5Pset_virtual_view(dapl_id, H5D_VDS_FIRST_MISSING) < 0) + error_msg("error in setting access property list ID, virtual_view\n"); + } + if (vds_gap_size > 0) { + if(H5Pset_virtual_printf_gap(dapl_id, (hsize_t)vds_gap_size) < 0) + error_msg("error in setting access property list ID, virtual_printf_gap\n"); + } + } + if((obj = H5Dopen2(group, name, dapl_id)) >= 0) { if(oinfo.rc > 1 || hit_elink) { obj_t *found_obj; /* Found object */ @@ -308,9 +322,11 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR h5tools_setstatus(EXIT_FAILURE); ret = FAIL; + if (dapl_id != H5P_DEFAULT) + H5Pclose(dapl_id); H5Dclose(obj); goto done; - } + } else if(found_obj->displayed) { ctx.need_prefix = TRUE; h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); @@ -347,18 +363,24 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + if (dapl_id != H5P_DEFAULT) + H5Pclose(dapl_id); H5Dclose(obj); goto done; - } + } else { found_obj->displayed = TRUE; } } /* end if */ dump_function_table->dump_dataset_function(obj, name, NULL); + if (dapl_id != H5P_DEFAULT) + H5Pclose(dapl_id); H5Dclose(obj); - } + } else { + if (dapl_id) + H5Pclose(dapl_id && dapl_id != H5P_DEFAULT); error_msg("unable to dump dataset \"%s\"\n", name); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; @@ -370,7 +392,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR error_msg("unable to dump datatype \"%s\"\n", name); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; - } + } else { dump_function_table->dump_named_datatype_function(obj, name); H5Tclose(obj); @@ -408,7 +430,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR error_msg("unable to get link value\n"); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; - } + } else { /* print the value of a soft link */ /* Standard DDL: no modification */ @@ -558,7 +580,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR done: h5tools_str_close(&buffer); - + if(obj_path) HDfree(obj_path); return ret; @@ -650,7 +672,7 @@ dump_named_datatype(hid_t tid, const char *name) HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; - + string_dataformat = *outputformat; if (fp_format) { @@ -685,7 +707,7 @@ dump_named_datatype(hid_t tid, const char *name) } ctx.need_prefix = TRUE; - + /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s \"%s\" %s", @@ -718,7 +740,7 @@ dump_named_datatype(hid_t tid, const char *name) else found_obj->displayed = TRUE; } /* end if */ - + /* Render the element */ h5tools_str_reset(&buffer); h5tools_print_datatype(rawoutstream, &buffer, outputformat, &ctx, tid, FALSE); @@ -726,7 +748,7 @@ dump_named_datatype(hid_t tid, const char *name) if(H5Tget_class(tid) != H5T_COMPOUND) { h5tools_str_append(&buffer, ";"); } - + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); /* print attributes */ @@ -813,7 +835,7 @@ dump_group(hid_t gid, const char *name) HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; - + string_dataformat = *outputformat; if (fp_format) { @@ -839,7 +861,7 @@ dump_group(hid_t gid, const char *name) h5tools_dump_header_format->groupbegin, name, h5tools_dump_header_format->groupblockbegin); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - + ctx.indent_level++; dump_indent += COL; @@ -948,7 +970,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; - + string_dataformat = *outputformat; if (fp_format) { @@ -982,7 +1004,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) ctx.need_prefix = TRUE; h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - + /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s \"%s\" %s", @@ -994,7 +1016,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) dump_indent += COL; ctx.indent_level++; - + type = H5Dget_type(did); h5dump_type_table = type_table; h5tools_dump_datatype(rawoutstream, outputformat, &ctx, type); @@ -1018,6 +1040,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) if(display_data) { int data_loop = 1; int i; + if(display_packed_bits) data_loop = packed_bits_num; for(i=0; i<data_loop; i++) { @@ -1042,7 +1065,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "DATA{ not yet implemented.}"); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - + ctx.indent_level--; break; @@ -1079,7 +1102,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) ctx.need_prefix = TRUE; h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - + /* Render the element */ h5tools_str_reset(&buffer); if(HDstrlen(h5tools_dump_header_format->datasetblockend)) { @@ -1189,7 +1212,7 @@ dump_fcpl(hid_t fid) fdriver=H5Pget_driver(fapl); H5Pclose(fapl); #endif - + /*------------------------------------------------------------------------- * SUPER_BLOCK *------------------------------------------------------------------------- @@ -1308,54 +1331,54 @@ static herr_t attr_search(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ainfo, void *_op_data) { herr_t ret = SUCCEED; - int i; - int j; - int k; - char *obj_op_name; + int i; + int j; + int k; + char *obj_op_name; char *obj_name; - trav_attr_udata_t *attr_data = (trav_attr_udata_t*)_op_data; + trav_attr_udata_t *attr_data = (trav_attr_udata_t*)_op_data; char *buf = attr_data->path; - char *op_name = attr_data->op_name; + char *op_name = attr_data->op_name; j = (int)HDstrlen(op_name) - 1; /* find the last / */ while(j >= 0) { - if (op_name[j] == '/' && (j==0 || (j>0 && op_name[j-1]!='\\'))) - break; - j--; + if (op_name[j] == '/' && (j==0 || (j>0 && op_name[j-1]!='\\'))) + break; + j--; } obj_op_name = h5tools_str_replace(op_name + j + 1, "\\/", "/"); if(obj_op_name == NULL) { - h5tools_setstatus(EXIT_FAILURE); - ret = FAIL; + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; } else { - if(HDstrcmp(attr_name, obj_op_name)==0) { - /* object name */ - i = (int)HDstrlen(buf); - j = (int)HDstrlen(op_name); - k = (size_t)i + 1 + (size_t)j + 1 + 2; - obj_name = (char *)HDmalloc((size_t)k); - if(obj_name == NULL) { - h5tools_setstatus(EXIT_FAILURE); - ret = FAIL; - } - else { - HDmemset(obj_name, '\0', (size_t)k); - if(op_name[0] != '/') { - HDstrncat(obj_name, buf, (size_t)i + 1); - if(buf[i-1] != '/') - HDstrncat(obj_name, "/", (size_t)2); - } - HDstrncat(obj_name, op_name, (size_t)j + 1); - - handle_attributes(oid, obj_name, NULL, 0, NULL); - HDfree(obj_name); - } - } - HDfree(obj_op_name); + if(HDstrcmp(attr_name, obj_op_name)==0) { + /* object name */ + i = (int)HDstrlen(buf); + j = (int)HDstrlen(op_name); + k = (size_t)i + 1 + (size_t)j + 1 + 2; + obj_name = (char *)HDmalloc((size_t)k); + if(obj_name == NULL) { + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } + else { + HDmemset(obj_name, '\0', (size_t)k); + if(op_name[0] != '/') { + HDstrncat(obj_name, buf, (size_t)i + 1); + if(buf[i-1] != '/') + HDstrncat(obj_name, "/", (size_t)2); + } + HDstrncat(obj_name, op_name, (size_t)j + 1); + + handle_attributes(oid, obj_name, NULL, 0, NULL); + HDfree(obj_name); + } + } + HDfree(obj_op_name); } return ret; } /* end attr_search() */ @@ -1363,7 +1386,7 @@ attr_search(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *a static herr_t obj_search(const char *path, const H5O_info_t *oi, const char H5_ATTR_UNUSED *already_visited, void *_op_data) { - trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data; + trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data; char *op_name = (char*)handle_data->op_name; trav_attr_udata_t attr_data; @@ -1372,22 +1395,22 @@ obj_search(const char *path, const H5O_info_t *oi, const char H5_ATTR_UNUSED *al H5Aiterate_by_name(handle_data->fid, path, H5_INDEX_NAME, H5_ITER_INC, NULL, attr_search, (void*)&attr_data, H5P_DEFAULT); if(HDstrcmp(path, op_name)==0) { - switch(oi->type) { - case H5O_TYPE_GROUP: - handle_groups(handle_data->fid, path, NULL, 0, NULL); - break; - case H5O_TYPE_DATASET: - handle_datasets(handle_data->fid, path, NULL, 0, NULL); - break; - case H5O_TYPE_NAMED_DATATYPE: - handle_datatypes(handle_data->fid, path, NULL, 0, NULL); - break; - case H5O_TYPE_UNKNOWN: - case H5O_TYPE_NTYPES: - default: - error_msg("unknown object type value\n"); - h5tools_setstatus(EXIT_FAILURE); - } /* end switch */ + switch(oi->type) { + case H5O_TYPE_GROUP: + handle_groups(handle_data->fid, path, NULL, 0, NULL); + break; + case H5O_TYPE_DATASET: + handle_datasets(handle_data->fid, path, NULL, 0, NULL); + break; + case H5O_TYPE_NAMED_DATATYPE: + handle_datatypes(handle_data->fid, path, NULL, 0, NULL); + break; + case H5O_TYPE_UNKNOWN: + case H5O_TYPE_NTYPES: + default: + error_msg("unknown object type value\n"); + h5tools_setstatus(EXIT_FAILURE); + } /* end switch */ } return 0; @@ -1397,48 +1420,48 @@ static herr_t lnk_search(const char *path, const H5L_info_t *li, void *_op_data) { int search_len; - int k; + int k; char *search_name; - trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data; + trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data; char *op_name = (char*)handle_data->op_name; search_len = HDstrlen(op_name); if(search_len > 0 && op_name[0] != '/') { - k = 2; + k = 2; } else k = 1; - search_name = (char *)HDmalloc((size_t)(search_len + k)); + search_name = (char *)HDmalloc((size_t)(search_len + k)); if(search_name == NULL) { - error_msg("creating temporary link\n"); - h5tools_setstatus(EXIT_FAILURE); + error_msg("creating temporary link\n"); + h5tools_setstatus(EXIT_FAILURE); } else { - if (k == 2) { - HDstrcpy(search_name, "/"); - HDstrncat(search_name, op_name, (size_t)search_len + 1); - } - else - HDstrncpy(search_name, op_name, (size_t)search_len + 1); - search_name[search_len + k - 1] = '\0'; - - if(HDstrcmp(path, search_name) == 0) { - switch(li->type) { - case H5L_TYPE_SOFT: - case H5L_TYPE_EXTERNAL: - handle_links(handle_data->fid, op_name, NULL, 0, NULL); - break; - - case H5L_TYPE_HARD: - case H5L_TYPE_MAX: - case H5L_TYPE_ERROR: - default: - error_msg("unknown link type value\n"); - h5tools_setstatus(EXIT_FAILURE); - break; - } /* end switch() */ - } - HDfree(search_name); + if (k == 2) { + HDstrcpy(search_name, "/"); + HDstrncat(search_name, op_name, (size_t)search_len + 1); + } + else + HDstrncpy(search_name, op_name, (size_t)search_len + 1); + search_name[search_len + k - 1] = '\0'; + + if(HDstrcmp(path, search_name) == 0) { + switch(li->type) { + case H5L_TYPE_SOFT: + case H5L_TYPE_EXTERNAL: + handle_links(handle_data->fid, op_name, NULL, 0, NULL); + break; + + case H5L_TYPE_HARD: + case H5L_TYPE_MAX: + case H5L_TYPE_ERROR: + default: + error_msg("unknown link type value\n"); + h5tools_setstatus(EXIT_FAILURE); + break; + } /* end switch() */ + } + HDfree(search_name); } return 0; } /* end lnk_search() */ @@ -1465,7 +1488,7 @@ handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED * data, int H hid_t gcpl_id; unsigned crt_order_flags; unsigned attr_crt_order_flags; - trav_handle_udata_t handle_udata; /* User data for traversal */ + trav_handle_udata_t handle_udata; /* User data for traversal */ if ((gcpl_id = H5Gget_create_plist(gid)) < 0) { error_msg("error in getting group creation property list ID\n"); @@ -1489,12 +1512,12 @@ handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED * data, int H h5tools_setstatus(EXIT_FAILURE); } - handle_udata.fid = fid; - handle_udata.op_name = (char*)path_name; - if(h5trav_visit(fid, "/", TRUE, TRUE, obj_search, lnk_search, &handle_udata) < 0) { - error_msg("error traversing information\n"); - h5tools_setstatus(EXIT_FAILURE); - } + handle_udata.fid = fid; + handle_udata.op_name = (char*)path_name; + if(h5trav_visit(fid, "/", TRUE, TRUE, obj_search, lnk_search, &handle_udata) < 0) { + error_msg("error traversing information\n"); + h5tools_setstatus(EXIT_FAILURE); + } } } @@ -1536,7 +1559,7 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED * data, int H /* find the last / */ while(j >= 0) { - if (attr[j] == '/' && (j==0 || (j>0 && attr[j-1]!='\\'))) + if (attr[j] == '/' && (j==0 || (j>0 && attr[j-1]!='\\'))) break; j--; } @@ -1571,7 +1594,7 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED * data, int H string_dataformat.do_escape = display_escape; outputformat = &string_dataformat; - attr_name = h5tools_str_replace(attr + j + 1, "\\/", "/"); + attr_name = h5tools_str_replace(attr + j + 1, "\\/", "/"); /* handle error case: cannot open the object with the attribute */ if((oid = H5Oopen(fid, obj_name, H5P_DEFAULT)) < 0) { @@ -1627,7 +1650,7 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED * data, int H } /* end if */ HDfree(obj_name); - HDfree(attr_name); + HDfree(attr_name); dump_indent -= COL; return; @@ -1635,9 +1658,9 @@ error: h5tools_setstatus(EXIT_FAILURE); if(obj_name) HDfree(obj_name); - - if (attr_name) - HDfree(attr_name); + + if (attr_name) + HDfree(attr_name); H5E_BEGIN_TRY { H5Oclose(oid); @@ -1672,10 +1695,24 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis { H5O_info_t oinfo; hid_t dsetid; + hid_t dapl_id = H5P_DEFAULT; /* dataset access property list ID */ struct subset_t *sset = (struct subset_t *)data; const char *real_name = display_name ? display_name : dset; - if((dsetid = H5Dopen2(fid, dset, H5P_DEFAULT)) < 0) { + if(display_data) { + if ((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) { + error_msg("error in creating default access property list ID\n"); + } + if (display_vds_first) { + if(H5Pset_virtual_view(dapl_id, H5D_VDS_FIRST_MISSING) < 0) + error_msg("error in setting access property list ID, virtual_view\n"); + } + if (vds_gap_size > 0) { + if(H5Pset_virtual_printf_gap(dapl_id, (hsize_t)vds_gap_size) < 0) + error_msg("error in setting access property list ID, virtual_printf_gap\n"); + } + } + if((dsetid = H5Dopen2(fid, dset, dapl_id)) < 0) { if (pe) { handle_links(fid, dset, data, pe, display_name); } @@ -1752,7 +1789,7 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis h5tools_setstatus(EXIT_FAILURE); return; } - + /*------------------------------------------------------------------------- * check for block overlap *------------------------------------------------------------------------- @@ -1785,7 +1822,7 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis PRINTSTREAM(rawoutstream, "%s \"%s\"\n", HARDLINK, found_obj->objname); indentation(dump_indent); end_obj(h5tools_dump_header_format->datasetend, h5tools_dump_header_format->datasetblockend); - } + } else { found_obj->displayed = TRUE; dump_indent += COL; @@ -1801,7 +1838,8 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis dump_dataset(dsetid, real_name, sset); dump_indent -= COL; } - + if (dapl_id != H5P_DEFAULT) + H5Pclose(dapl_id); if(H5Dclose(dsetid) < 0) h5tools_setstatus(EXIT_FAILURE); } @@ -1884,11 +1922,11 @@ handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_AT if(H5Lget_info(fid, links, &linfo, H5P_DEFAULT) < 0) { error_msg("unable to get link info from \"%s\"\n", links); h5tools_setstatus(EXIT_FAILURE); - } + } else if(linfo.type == H5L_TYPE_HARD) { error_msg("\"%s\" is a hard link\n", links); h5tools_setstatus(EXIT_FAILURE); - } + } else { char *buf = (char *)HDmalloc(linfo.u.val_size); PRINTVALSTREAM(rawoutstream, "\n"); @@ -1925,12 +1963,12 @@ handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_AT PRINTSTREAM(rawoutstream, "TARGETFILE \"%s\"\n", elink_file); indentation(COL); PRINTSTREAM(rawoutstream, "TARGETPATH \"%s\"\n", elink_path); - } + } else { error_msg("h5dump error: unable to unpack external link value for \"%s\"\n", links); h5tools_setstatus(EXIT_FAILURE); } - } + } else { error_msg("h5dump error: unable to get external link value for \"%s\"\n", links); h5tools_setstatus(EXIT_FAILURE); diff --git a/tools/h5dump/h5dump_extern.h b/tools/h5dump/h5dump_extern.h index 08f9e36..62477d0 100644 --- a/tools/h5dump/h5dump_extern.h +++ b/tools/h5dump/h5dump_extern.h @@ -77,6 +77,8 @@ extern int enable_error_stack; /* re-enable error stack */ extern int disable_compact_subset; /* disable compact form of subset notation */ extern int display_packed_bits; /*print 1-8 byte numbers as packed bits*/ extern int include_attrs; /* Display attributes */ +extern int display_vds_first; /* vds display to first missing */ +extern int vds_gap_size; /* vds skip missing files */ /* sort parameters */ extern H5_index_t sort_by; /*sort_by [creation_order | name] */ diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index 80051d4..668e3f7 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -110,6 +110,7 @@ #define FILE78 "tscalarintattrsize.h5" #define FILE79 "tintsattrs.h5" #define FILE80 "tbitnopaque.h5" +#define FILE81 "tints4dims.h5" /*------------------------------------------------------------------------- * prototypes @@ -271,20 +272,20 @@ typedef struct s1_t { #define THRESHOLD10 10 /* Free space section threshold */ /* "FILE66" macros and for FILE69 */ -#define F66_XDIM 8 +#define F66_XDIM 8 #define F66_DATASETU08 "DU08BITS" #define F66_DATASETS08 "DS08BITS" -#define F66_YDIM8 8 +#define F66_YDIM8 8 #define F66_DATASETU16 "DU16BITS" #define F66_DATASETS16 "DS16BITS" -#define F66_YDIM16 16 +#define F66_YDIM16 16 #define F66_DATASETU32 "DU32BITS" #define F66_DATASETS32 "DS32BITS" -#define F66_YDIM32 32 +#define F66_YDIM32 32 #define F66_DATASETU64 "DU64BITS" #define F66_DATASETS64 "DS64BITS" #define F66_YDIM64 64 -#define F66_DUMMYDBL "DummyDBL" +#define F66_DUMMYDBL "DummyDBL" /* "FILE70" macros and for FILE71 */ /* Name of dataset to create in datafile */ @@ -352,6 +353,13 @@ typedef struct s1_t { #define F80_DIM32 32 +#define F81_DATASETNAME "FourDimInts" +#define F81_RANK 4 +#define F81_WDIM 10 +#define F81_XDIM 8 +#define F81_YDIM 6 +#define F81_ZDIM 4 + static void gent_group(void) { @@ -568,7 +576,7 @@ static void gent_softlink(void) * Function: gent_softlink2 * * Purpose: Create soft links to various objects. - * Return: + * Return: * SUCCEED * FAIL * Programmer: Jonathan Kim @@ -582,7 +590,7 @@ static int gent_softlink2(void) hid_t gid1 = -1, gid2 = -1; hid_t datatype = -1; hid_t dset1 = -1, dset2 = -1; - hid_t dataspace = -1; + hid_t dataspace = -1; hsize_t dimsf[2]; /* dataset dimensions */ int data1[NX][NY] = {{0,0},{1,1},{2,2},{3,3}}; int data2[NX][NY] = {{0,0},{0,1},{0,2},{3,3}}; @@ -626,7 +634,7 @@ static int gent_softlink2(void) status = H5Tcommit2(fileid1, "dtype", datatype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", FILE4_1); + fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", FILE4_1); status = FAIL; goto out; } @@ -2896,9 +2904,9 @@ static void gent_vldatatypes5(void) } /* This is big enough to make h5dump to use hyperslap to read - from file and display portion by portion. This also prints out array indices + from file and display portion by portion. This also prints out array indices via region reference for testing refion reference output. - Note: this was added originally prepared for bug2092. before the fix h5dump didn't + Note: this was added originally prepared for bug2092. before the fix h5dump didn't display array indices every 262 x N (N > 0) based on 2000x1000 dims. */ #define SPACE_ARRAY1BIG_DIM 2000 @@ -2945,7 +2953,7 @@ static void gent_array1_big(void) fid1 = H5Fcreate(FILE25_BIG, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); /*------------------------- - * Array type dataset + * Array type dataset */ /* Create dataspace for datasets */ sid1 = H5Screate_simple(SPACE1_RANK, sdims1, NULL); @@ -2961,7 +2969,7 @@ static void gent_array1_big(void) HDassert(ret >= 0); /*--------------------------- - * Region Reference dataset + * Region Reference dataset */ /* Create dataspace for the reference dataset */ sid2 = H5Screate_simple(SPACE1_RANK, dims2, NULL); @@ -5210,7 +5218,7 @@ static void gent_zero_dim_size(void) space = H5Screate_simple(SPACE3_RANK, dims1, NULL); /* dataset */ - dataset = H5Dcreate2(fid, "dset of 0 dimension size", H5T_STD_I32BE, space, H5P_DEFAULT, + dataset = H5Dcreate2(fid, "dset of 0 dimension size", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* nothing should be written */ H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &dset_buf); @@ -7064,7 +7072,7 @@ gent_packedbits(void) space = H5Screate_simple(2, dims, NULL); dataset = H5Dcreate2(fid, F66_DATASETU16, H5T_STD_U16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - valu16bits = (uint16_t) ~0u; /* all 1s */ + valu16bits = (uint16_t) ~0u; /* all 1s */ for(i = 0; i < dims[0]; i++){ dsetu16[i][0] = valu16bits; for(j = 1; j < dims[1]; j++) @@ -7081,7 +7089,7 @@ gent_packedbits(void) space = H5Screate_simple(2, dims, NULL); dataset = H5Dcreate2(fid, F66_DATASETU32, H5T_STD_U32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - valu32bits = (uint32_t) ~0u; /* all 1s */ + valu32bits = (uint32_t) ~0u; /* all 1s */ for(i = 0; i < dims[0]; i++){ dsetu32[i][0] = valu32bits; for(j = 1; j < dims[1]; j++) @@ -7115,7 +7123,7 @@ gent_packedbits(void) space = H5Screate_simple(2, dims, NULL); dataset = H5Dcreate2(fid, F66_DATASETS08, H5T_STD_I8LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - val8bits = (int8_t) ~0; /* all 1s */ + val8bits = (int8_t) ~0; /* all 1s */ for(i = 0; i < dims[0]; i++){ dset8[i][0] = val8bits; for(j = 1; j < dims[1]; j++) @@ -7132,7 +7140,7 @@ gent_packedbits(void) space = H5Screate_simple(2, dims, NULL); dataset = H5Dcreate2(fid, F66_DATASETS16, H5T_STD_I16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - val16bits = (int16_t) ~0; /* all 1s */ + val16bits = (int16_t) ~0; /* all 1s */ for(i = 0; i < dims[0]; i++){ dset16[i][0] = val16bits; for(j = 1; j < dims[1]; j++) @@ -7149,7 +7157,7 @@ gent_packedbits(void) space = H5Screate_simple(2, dims, NULL); dataset = H5Dcreate2(fid, F66_DATASETS32, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - val32bits = (int32_t) ~0; /* all 1s */ + val32bits = (int32_t) ~0; /* all 1s */ for(i = 0; i < dims[0]; i++){ dset32[i][0] = val32bits; for(j = 1; j < dims[1]; j++) @@ -8638,7 +8646,7 @@ static void gent_compound_int_array(void) { valu8bits = (uint8_t) ~0u; /* all 1s */ for(n = 0; n < dims[0]; n++){ - Cmpd1[m].dsetu8[n] = valu8bits; + Cmpd1[m].dsetu8[n] = valu8bits; valu8bits <<= 1; } @@ -8647,7 +8655,7 @@ static void gent_compound_int_array(void) { valu16bits = (uint16_t) ~0u; /* all 1s */ for(n = 0; n < dims[0]; n++){ - Cmpd1[m].dsetu16[n] = valu16bits; + Cmpd1[m].dsetu16[n] = valu16bits; valu16bits <<= 1; } @@ -8656,7 +8664,7 @@ static void gent_compound_int_array(void) { valu32bits = (uint32_t) ~0u; /* all 1s */ for(n = 0; n < dims[0]; n++){ - Cmpd1[m].dsetu32[n] = valu32bits; + Cmpd1[m].dsetu32[n] = valu32bits; valu32bits <<= 1; } @@ -8665,7 +8673,7 @@ static void gent_compound_int_array(void) { valu64bits = (uint64_t) ~0Lu; /* all 1s */ for(n = 0; n < dims[0]; n++){ - Cmpd1[m].dsetu64[n] = valu64bits; + Cmpd1[m].dsetu64[n] = valu64bits; valu64bits <<= 1; } @@ -8674,7 +8682,7 @@ static void gent_compound_int_array(void) { val8bits = (int8_t) ~0; /* all 1s */ for(n = 0; n < dims[0]; n++){ - Cmpd1[m].dset8[n] = val8bits; + Cmpd1[m].dset8[n] = val8bits; val8bits <<= 1; } @@ -8683,7 +8691,7 @@ static void gent_compound_int_array(void) { val16bits = (int16_t) ~0; /* all 1s */ for(n = 0; n < dims[0]; n++){ - Cmpd1[m].dset16[n] = val16bits; + Cmpd1[m].dset16[n] = val16bits; val16bits <<= 1; } @@ -8692,7 +8700,7 @@ static void gent_compound_int_array(void) { val32bits = (int32_t) ~0; /* all 1s */ for(n = 0; n < dims[0]; n++){ - Cmpd1[m].dset32[n] = val32bits; + Cmpd1[m].dset32[n] = val32bits; val32bits <<= 1; } @@ -8701,7 +8709,7 @@ static void gent_compound_int_array(void) { val64bits = (int64_t) ~0L; /* all 1s */ for(n = 0; n < dims[0]; n++){ - Cmpd1[m].dset64[n] = val64bits; + Cmpd1[m].dset64[n] = val64bits; val64bits <<= 1; } @@ -8709,7 +8717,7 @@ static void gent_compound_int_array(void) { dims[0] = F76_DIM8; for(n = 0; n < dims[0]; n++) - Cmpd1[m].dsetdbl[n] = 0.0001F + n; + Cmpd1[m].dsetdbl[n] = 0.0001F + n; } /* Create the array data type for the 8 bits signed int array */ @@ -8884,64 +8892,64 @@ static void gent_compound_ints(void) { for (m = 0; m < F77_LENGTH; m++) { /* Array of 8 bits unsigned int */ - if((m % F76_DIM8) == 0) - valu8bits = (uint8_t) ~0u; /* all 1s */ - Cmpd1[m].dsetu8 = valu8bits; - Cmpd2[m].dsetu8 = valu8bits; + if((m % F76_DIM8) == 0) + valu8bits = (uint8_t) ~0u; /* all 1s */ + Cmpd1[m].dsetu8 = valu8bits; + Cmpd2[m].dsetu8 = valu8bits; valu8bits <<= 1; /* Array of 16 bits unsigned int */ - if((m % F76_DIM16) == 0) + if((m % F76_DIM16) == 0) valu16bits = (uint16_t) ~0u; /* all 1s */ - Cmpd1[m].dsetu16 = valu16bits; - Cmpd2[m].dsetu16 = valu16bits; - valu16bits <<= 1; + Cmpd1[m].dsetu16 = valu16bits; + Cmpd2[m].dsetu16 = valu16bits; + valu16bits <<= 1; /* Array of 32 bits unsigned int */ - if((m % F76_DIM32) == 0) + if((m % F76_DIM32) == 0) valu32bits = (uint32_t) ~0u; /* all 1s */ - Cmpd1[m].dsetu32 = valu32bits; - Cmpd2[m].dsetu32 = valu32bits; - valu32bits <<= 1; + Cmpd1[m].dsetu32 = valu32bits; + Cmpd2[m].dsetu32 = valu32bits; + valu32bits <<= 1; /* Array of 64 bits unsigned int */ - if((m % F76_DIM64) == 0) + if((m % F76_DIM64) == 0) valu64bits = (uint64_t) ~0Lu; /* all 1s */ - Cmpd1[m].dsetu64 = valu64bits; - Cmpd2[m].dsetu64 = valu64bits; - valu64bits <<= 1; + Cmpd1[m].dsetu64 = valu64bits; + Cmpd2[m].dsetu64 = valu64bits; + valu64bits <<= 1; /* Array of 8 bits signed int */ - if((m % F76_DIM8) == 0) + if((m % F76_DIM8) == 0) val8bits = (int8_t) ~0; /* all 1s */ - Cmpd1[m].dset8 = val8bits; - Cmpd2[m].dset8 = val8bits; - val8bits <<= 1; + Cmpd1[m].dset8 = val8bits; + Cmpd2[m].dset8 = val8bits; + val8bits <<= 1; /* Array of 16 bits signed int */ - if((m % F76_DIM16) == 0) + if((m % F76_DIM16) == 0) val16bits = (int16_t) ~0; /* all 1s */ - Cmpd1[m].dset16 = val16bits; - Cmpd2[m].dset16 = val16bits; - val16bits <<= 1; + Cmpd1[m].dset16 = val16bits; + Cmpd2[m].dset16 = val16bits; + val16bits <<= 1; /* Array of 32 bits signed int */ - if((m % F76_DIM32) == 0) + if((m % F76_DIM32) == 0) val32bits = (int32_t) ~0; /* all 1s */ - Cmpd1[m].dset32 = val32bits; - Cmpd2[m].dset32 = val32bits; - val32bits <<= 1; + Cmpd1[m].dset32 = val32bits; + Cmpd2[m].dset32 = val32bits; + val32bits <<= 1; /* Array of 64 bits signed int */ - if((m % F76_DIM64) == 0) + if((m % F76_DIM64) == 0) val64bits = (int64_t) ~0L; /* all 1s */ - Cmpd1[m].dset64 = val64bits; - Cmpd2[m].dset64 = val64bits; - val64bits <<= 1; + Cmpd1[m].dset64 = val64bits; + Cmpd2[m].dset64 = val64bits; + val64bits <<= 1; /* Double Dummy set for failure tests */ - Cmpd1[m].dsetdbl = 0.0001F + m; - Cmpd2[m].dsetdbl = 0.0001F + m; + Cmpd1[m].dsetdbl = 0.0001F + m; + Cmpd2[m].dsetdbl = 0.0001F + m; } /* Create the dataspace */ @@ -9352,7 +9360,7 @@ gent_intsattrs(void) space = H5Screate_simple(2, dims, NULL); dataset = H5Dcreate2(fid, F66_DATASETU16, H5T_STD_U16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - valu16bits = (uint16_t) ~0u; /* all 1s */ + valu16bits = (uint16_t) ~0u; /* all 1s */ for(i = 0; i < dims[0]; i++){ dsetu16[i][0] = valu16bits; asetu16[i*dims[1]] = dsetu16[i][0]; @@ -9379,7 +9387,7 @@ gent_intsattrs(void) space = H5Screate_simple(2, dims, NULL); dataset = H5Dcreate2(fid, F66_DATASETU32, H5T_STD_U32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - valu32bits = (uint32_t) ~0u; /* all 1s */ + valu32bits = (uint32_t) ~0u; /* all 1s */ for(i = 0; i < dims[0]; i++){ dsetu32[i][0] = valu32bits; asetu32[i*dims[1]] = dsetu32[i][0]; @@ -9433,7 +9441,7 @@ gent_intsattrs(void) space = H5Screate_simple(2, dims, NULL); dataset = H5Dcreate2(fid, F66_DATASETS08, H5T_STD_I8LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - val8bits = (int8_t) ~0; /* all 1s */ + val8bits = (int8_t) ~0; /* all 1s */ for(i = 0; i < dims[0]; i++){ dset8[i][0] = val8bits; aset8[i*dims[1]] = dset8[i][0]; @@ -9460,7 +9468,7 @@ gent_intsattrs(void) space = H5Screate_simple(2, dims, NULL); dataset = H5Dcreate2(fid, F66_DATASETS16, H5T_STD_I16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - val16bits = (int16_t) ~0; /* all 1s */ + val16bits = (int16_t) ~0; /* all 1s */ for(i = 0; i < dims[0]; i++){ dset16[i][0] = val16bits; aset16[i*dims[1]] = dset16[i][0]; @@ -9487,7 +9495,7 @@ gent_intsattrs(void) space = H5Screate_simple(2, dims, NULL); dataset = H5Dcreate2(fid, F66_DATASETS32, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - val32bits = (int32_t) ~0; /* all 1s */ + val32bits = (int32_t) ~0; /* all 1s */ for(i = 0; i < dims[0]; i++){ dset32[i][0] = val32bits; aset32[i*dims[1]] = dset32[i][0]; @@ -9710,6 +9718,41 @@ static void gent_bitnopaquefields(void) H5Fclose(file); } +/*------------------------------------------------------------------------- + * Function: gent_intsfourdims + * + * Purpose: Generate a file to be used in the h5dump subsetting tests. + * One datasets of unsigned int types are created in four dimensions 2,4,6,10. + *------------------------------------------------------------------------- + */ +static void +gent_intsfourdims(void) +{ + hid_t fid, dataset, space, tid; + hsize_t dims[F81_RANK]; + uint32_t dset1[F81_ZDIM][F81_YDIM][F81_XDIM][F81_WDIM]; + unsigned int i, j, k, l; + + fid = H5Fcreate(FILE81, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* Dataset of 32 bits unsigned int */ + dims[0] = F81_ZDIM; dims[1] = F81_YDIM; dims[2] = F81_XDIM; dims[3] = F81_WDIM; + space = H5Screate_simple(F81_RANK, dims, NULL); + dataset = H5Dcreate2(fid, F81_DATASETNAME, H5T_STD_U32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + for(i = 0; i < F81_ZDIM; i++) + for(j = 0; j < F81_YDIM; j++) + for(k = 0; k < F81_XDIM; k++) + for(l = 0; l < F81_WDIM; l++) + dset1[i][j][k][l] = i*F81_YDIM*F81_XDIM*F81_WDIM + j*F81_XDIM*F81_WDIM + k*F81_WDIM + l; + + H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1); + H5Sclose(space); + H5Dclose(dataset); + + H5Fclose(fid); +} + /*------------------------------------------------------------------------- * Function: main @@ -9802,6 +9845,8 @@ int main(void) gent_intsattrs(); gent_bitnopaquefields(); + gent_intsfourdims(); + return 0; } diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index 267ac44..6d481c6 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -133,6 +133,7 @@ $SRC_H5DUMP_TESTFILES/tgrp_comments.h5 $SRC_H5DUMP_TESTFILES/thlink.h5 $SRC_H5DUMP_TESTFILES/thyperslab.h5 $SRC_H5DUMP_TESTFILES/tintsattrs.h5 +$SRC_H5DUMP_TESTFILES/tints4dims.h5 $SRC_H5DUMP_TESTFILES/tlarge_objname.h5 #$SRC_H5DUMP_TESTFILES/tldouble.h5 $SRC_H5DUMP_TESTFILES/tlonglinks.h5 @@ -265,6 +266,12 @@ $SRC_H5DUMP_TESTFILES/tindicessub2.ddl $SRC_H5DUMP_TESTFILES/tindicessub3.ddl $SRC_H5DUMP_TESTFILES/tindicessub4.ddl $SRC_H5DUMP_TESTFILES/tindicesyes.ddl +$SRC_H5DUMP_TESTFILES/tints4dims.ddl +$SRC_H5DUMP_TESTFILES/tints4dimsBlock2.ddl +$SRC_H5DUMP_TESTFILES/tints4dimsBlockEq.ddl +$SRC_H5DUMP_TESTFILES/tints4dimsCount2.ddl +$SRC_H5DUMP_TESTFILES/tints4dimsCountEq.ddl +$SRC_H5DUMP_TESTFILES/tints4dimsStride2.ddl $SRC_H5DUMP_TESTFILES/tintsattrs.ddl $SRC_H5DUMP_TESTFILES/tlarge_objname.ddl #$SRC_H5DUMP_TESTFILES/tldouble.ddl @@ -1106,6 +1113,12 @@ TOOLTEST tall-5s.ddl --enable-error-stack -d "/g1/g1.1/dset1.1.2[0;2;10;]" tall. TOOLTEST tdset-3s.ddl --enable-error-stack -d "/dset1[1,1;;;]" tdset.h5 TOOLTEST tno-subset.ddl --enable-error-stack --no-compact-subset -d "AHFINDERDIRECT::ah_centroid_t[0] it=0 tl=0" tno-subset.h5 +TOOLTEST tints4dimsCount2.ddl --enable-error-stack -d FourDimInts -s 0,0,0,0 -c 2,2,2,2 tints4dims.h5 +TOOLTEST tints4dimsBlock2.ddl --enable-error-stack -d FourDimInts -s 0,0,0,0 -c 1,1,1,1 -k 2,2,2,2 tints4dims.h5 +TOOLTEST tints4dimsStride2.ddl --enable-error-stack -d FourDimInts -s 0,0,0,0 -S 2,2,2,2 -c 2,2,2,2 tints4dims.h5 +TOOLTEST tints4dimsCountEq.ddl --enable-error-stack -d FourDimInts -s 0,0,0,0 -S 2,2,1,1 -k 1,2,1,1 -c 2,2,4,4 tints4dims.h5 +TOOLTEST tints4dimsBlockEq.ddl --enable-error-stack -d FourDimInts -s 0,0,0,0 -S 2,2,1,1 -c 2,2,1,1 -k 1,2,4,4 tints4dims.h5 + # test printing characters in ASCII instead of decimal TOOLTEST tchar1.ddl --enable-error-stack -r tchar.h5 diff --git a/tools/h5dump/testh5dumpvds.sh.in b/tools/h5dump/testh5dumpvds.sh.in index b15606f..850c03a 100644 --- a/tools/h5dump/testh5dumpvds.sh.in +++ b/tools/h5dump/testh5dumpvds.sh.in @@ -98,6 +98,14 @@ $SRC_H5DUMP_TESTFILES/vds/5_a.h5 $SRC_H5DUMP_TESTFILES/vds/5_b.h5 $SRC_H5DUMP_TESTFILES/vds/5_c.h5 $SRC_H5DUMP_TESTFILES/vds/5_vds.h5 +$SRC_H5DUMP_TESTFILES/vds/a.h5 +$SRC_H5DUMP_TESTFILES/vds/b.h5 +$SRC_H5DUMP_TESTFILES/vds/c.h5 +$SRC_H5DUMP_TESTFILES/vds/d.h5 +$SRC_H5DUMP_TESTFILES/vds/vds-percival-unlim-maxmin.h5 +$SRC_H5DUMP_TESTFILES/vds/f-0.h5 +$SRC_H5DUMP_TESTFILES/vds/f-3.h5 +$SRC_H5DUMP_TESTFILES/vds/vds-eiger.h5 " LIST_OTHER_TEST_FILES=" @@ -113,6 +121,11 @@ $SRC_H5DUMP_TESTFILES/vds/tvds_layout-3_1.ddl $SRC_H5DUMP_TESTFILES/vds/tvds_layout-3_2.ddl $SRC_H5DUMP_TESTFILES/vds/tvds_layout-4.ddl $SRC_H5DUMP_TESTFILES/vds/tvds_layout-5.ddl +$SRC_H5DUMP_TESTFILES/vds/vds-first.ddl +$SRC_H5DUMP_TESTFILES/vds/vds-gap1.ddl +$SRC_H5DUMP_TESTFILES/vds/vds-gap2.ddl +$SRC_H5DUMP_TESTFILES/vds/vds_layout-eiger.ddl +$SRC_H5DUMP_TESTFILES/vds/vds_layout-maxmin.ddl " LIST_ERROR_TEST_FILES=" @@ -480,6 +493,9 @@ if test $USE_FILTER_DEFLATE = "yes" ; then TOOLTEST tvds-3_2.ddl --enable-error-stack 3_2_vds.h5 TOOLTEST tvds-4.ddl --enable-error-stack 4_vds.h5 TOOLTEST tvds-5.ddl --enable-error-stack 5_vds.h5 + TOOLTEST vds-first.ddl --vds-view-first-missing --enable-error-stack vds-percival-unlim-maxmin.h5 + TOOLTEST vds-gap1.ddl -d /VDS-Eiger --vds-gap-size=1 --enable-error-stack vds-eiger.h5 + TOOLTEST vds-gap2.ddl --vds-gap-size=2 --enable-error-stack vds-eiger.h5 fi # Layout read @@ -490,6 +506,8 @@ if test $USE_FILTER_DEFLATE = "yes" ; then TOOLTEST tvds_layout-3_2.ddl -p --enable-error-stack 3_2_vds.h5 TOOLTEST tvds_layout-4.ddl -p --enable-error-stack 4_vds.h5 TOOLTEST tvds_layout-5.ddl -p --enable-error-stack 5_vds.h5 + TOOLTEST vds_layout-eiger.ddl -p --enable-error-stack vds-eiger.h5 + TOOLTEST vds_layout-maxmin.ddl -p --enable-error-stack vds-percival-unlim-maxmin.h5 fi # Clean up temporary files/directories |