diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2016-10-27 15:04:42 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2016-10-27 15:04:42 (GMT) |
commit | 5b562d9ce9b2945d0378b9c03e01f42923da80f4 (patch) | |
tree | 3fa67d9656f2b32330e3fe31996952f60f71cdb9 /tools/h5repack | |
parent | b34423f620b470e1c5dc38cdd3abbd5fe8adc4ec (diff) | |
download | hdf5-5b562d9ce9b2945d0378b9c03e01f42923da80f4.zip hdf5-5b562d9ce9b2945d0378b9c03e01f42923da80f4.tar.gz hdf5-5b562d9ce9b2945d0378b9c03e01f42923da80f4.tar.bz2 |
Split tools into src and test - remove folders
Diffstat (limited to 'tools/h5repack')
59 files changed, 0 insertions, 18049 deletions
diff --git a/tools/h5repack/CMakeLists.txt b/tools/h5repack/CMakeLists.txt deleted file mode 100644 index 4a21605..0000000 --- a/tools/h5repack/CMakeLists.txt +++ /dev/null @@ -1,114 +0,0 @@ -cmake_minimum_required (VERSION 3.1.0) -PROJECT (HDF5_TOOLS_H5REPACK) - -#----------------------------------------------------------------------------- -# Setup include Directories -#----------------------------------------------------------------------------- -INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) -INCLUDE_DIRECTORIES (${HDF5_TEST_SRC_DIR}) - -# -------------------------------------------------------------------- -# Add h5Repack executables -# -------------------------------------------------------------------- -set (REPACK_COMMON_SOURCES - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repack_copy.c - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repack_filters.c - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repack_opttable.c - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repack_parse.c - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repack_refs.c - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repack_verify.c - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repack.c -) - -add_executable (h5repack ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repack_main.c) -TARGET_NAMING (h5repack STATIC) -TARGET_C_PROPERTIES (h5repack STATIC " " " ") -target_link_libraries (h5repack ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) -set_target_properties (h5repack PROPERTIES FOLDER tools) -set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repack") - -set (H5_DEP_EXECUTABLES h5repack) - -if (BUILD_TESTING) - # -------------------------------------------------------------------- - # Add h5Repack test executables - # -------------------------------------------------------------------- - add_executable (testh5repack_detect_szip ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testh5repack_detect_szip.c) - TARGET_NAMING (testh5repack_detect_szip STATIC) - TARGET_C_PROPERTIES (testh5repack_detect_szip STATIC " " " ") - target_link_libraries (testh5repack_detect_szip ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) - set_target_properties (testh5repack_detect_szip PROPERTIES FOLDER tools) - - add_executable (h5repacktest ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repacktst.c) - TARGET_NAMING (h5repacktest STATIC) - TARGET_C_PROPERTIES (h5repacktest STATIC " " " ") - target_link_libraries (h5repacktest ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) - set_target_properties (h5repacktest PROPERTIES FOLDER tools) - - #----------------------------------------------------------------------------- - # If plugin library tests can be tested - #----------------------------------------------------------------------------- - set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibadd") - set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") - set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) - set (HDF5_TOOL_PLUGIN_LIB_VCORENAME "dynlibvers") - set (HDF5_TOOL_PLUGIN_LIB_VNAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_VCORENAME}") - set (HDF5_TOOL_PLUGIN_LIB_VTARGET ${HDF5_TOOL_PLUGIN_LIB_VCORENAME}) - add_definitions (${HDF_EXTRA_C_FLAGS}) - INCLUDE_DIRECTORIES (${HDF5_SRC_DIR}) - - add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_rpk.c) - TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED " " " ") - target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) - H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION}) - - add_library (${HDF5_TOOL_PLUGIN_LIB_VTARGET} SHARED dynlib_vrpk.c) - TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_VTARGET} SHARED " " " ") - target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_VTARGET} ${HDF5_TEST_LIB_TARGET}) - H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_VTARGET} ${HDF5_TOOL_PLUGIN_LIB_VNAME} SHARED ${HDF5_PACKAGE_SOVERSION}) - - # make plugins dir - file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") - #----------------------------------------------------------------------------- - # Copy plugin library to a plugins folder - #----------------------------------------------------------------------------- - add_custom_command ( - TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different - "$<TARGET_FILE:${HDF5_TOOL_PLUGIN_LIB_TARGET}>" - "${CMAKE_BINARY_DIR}/plugins/$<TARGET_FILE_NAME:${HDF5_TOOL_PLUGIN_LIB_TARGET}>" - ) - add_custom_command ( - TARGET ${HDF5_TOOL_PLUGIN_LIB_VTARGET} - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different - "$<TARGET_FILE:${HDF5_TOOL_PLUGIN_LIB_VTARGET}>" - "${CMAKE_BINARY_DIR}/plugins/$<TARGET_FILE_NAME:${HDF5_TOOL_PLUGIN_LIB_VTARGET}>" - ) - - include (CMakeTests.cmake) - -endif (BUILD_TESTING) - -############################################################################## -############################################################################## -### I N S T A L L A T I O N ### -############################################################################## -############################################################################## - -#----------------------------------------------------------------------------- -# Rules for Installation of tools using make Install target -#----------------------------------------------------------------------------- - -#INSTALL_PROGRAM_PDB (h5repack ${HDF5_INSTALL_BIN_DIR} toolsapplications) - -install ( - TARGETS - h5repack - EXPORT - ${HDF5_EXPORTED_TARGETS} - RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications -) diff --git a/tools/h5repack/CMakeTests.cmake b/tools/h5repack/CMakeTests.cmake deleted file mode 100644 index e8ee00f..0000000 --- a/tools/h5repack/CMakeTests.cmake +++ /dev/null @@ -1,1153 +0,0 @@ - -############################################################################## -############################################################################## -### T E S T I N G ### -############################################################################## -############################################################################## - - if (HDF5_TEST_VFD) - set (VFD_LIST - sec2 - stdio - core - split - multi - family - ) - - if (DIRECT_VFD) - set (VFD_LIST ${VFD_LIST} direct) - endif (DIRECT_VFD) - - MACRO (ADD_VFD_TEST vfdname resultcode) - add_test ( - NAME H5REPACK-VFD-${vfdname}-h5repacktest - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:h5repacktest>" - -D "TEST_ARGS:STRING=" - -D "TEST_VFD:STRING=${vfdname}" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_OUTPUT=h5repacktest" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" - ) - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5REPACK-VFD-${vfdname}-h5repacktest PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") - set (last_test "H5REPACK-VFD-${vfdname}-h5repacktest") - ENDMACRO (ADD_VFD_TEST) - endif (HDF5_TEST_VFD) - - # -------------------------------------------------------------------- - # Copy all the HDF5 files from the source directory into the test directory - # -------------------------------------------------------------------- - set (LIST_HDF5_TEST_FILES - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_attr.h5 - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_attr_refs.h5 - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_deflate.h5 - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_early.h5 - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_ext.h5 - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_fill.h5 - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_filters.h5 - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_fletcher.h5 - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_hlink.h5 - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.h5 - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layouto.h5 - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout2.h5 - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout3.h5 - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.UD.h5 - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_named_dtypes.h5 - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_nbit.h5 - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_objs.h5 - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_refs.h5 - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_shuffle.h5 - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_soffset.h5 - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_szip.h5 - # h5diff/testfile - ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_attr1.h5 - # tools/testfiles - ${HDF5_TOOLS_DIR}/testfiles/tfamily00000.h5 - ${HDF5_TOOLS_DIR}/testfiles/tfamily00001.h5 - ${HDF5_TOOLS_DIR}/testfiles/tfamily00002.h5 - ${HDF5_TOOLS_DIR}/testfiles/tfamily00003.h5 - ${HDF5_TOOLS_DIR}/testfiles/tfamily00004.h5 - ${HDF5_TOOLS_DIR}/testfiles/tfamily00005.h5 - ${HDF5_TOOLS_DIR}/testfiles/tfamily00006.h5 - ${HDF5_TOOLS_DIR}/testfiles/tfamily00007.h5 - ${HDF5_TOOLS_DIR}/testfiles/tfamily00008.h5 - ${HDF5_TOOLS_DIR}/testfiles/tfamily00009.h5 - ${HDF5_TOOLS_DIR}/testfiles/tfamily00010.h5 - # tools/testfiles/vds - ${HDF5_TOOLS_DIR}/testfiles/vds/1_a.h5 - ${HDF5_TOOLS_DIR}/testfiles/vds/1_b.h5 - ${HDF5_TOOLS_DIR}/testfiles/vds/1_c.h5 - ${HDF5_TOOLS_DIR}/testfiles/vds/1_d.h5 - ${HDF5_TOOLS_DIR}/testfiles/vds/1_e.h5 - ${HDF5_TOOLS_DIR}/testfiles/vds/1_f.h5 - ${HDF5_TOOLS_DIR}/testfiles/vds/1_vds.h5 - ${HDF5_TOOLS_DIR}/testfiles/vds/2_a.h5 - ${HDF5_TOOLS_DIR}/testfiles/vds/2_b.h5 - ${HDF5_TOOLS_DIR}/testfiles/vds/2_c.h5 - ${HDF5_TOOLS_DIR}/testfiles/vds/2_d.h5 - ${HDF5_TOOLS_DIR}/testfiles/vds/2_e.h5 - ${HDF5_TOOLS_DIR}/testfiles/vds/2_vds.h5 - ${HDF5_TOOLS_DIR}/testfiles/vds/3_1_vds.h5 - ${HDF5_TOOLS_DIR}/testfiles/vds/3_2_vds.h5 - ${HDF5_TOOLS_DIR}/testfiles/vds/4_0.h5 - ${HDF5_TOOLS_DIR}/testfiles/vds/4_1.h5 - ${HDF5_TOOLS_DIR}/testfiles/vds/4_2.h5 - ${HDF5_TOOLS_DIR}/testfiles/vds/4_vds.h5 - ${HDF5_TOOLS_DIR}/testfiles/vds/5_a.h5 - ${HDF5_TOOLS_DIR}/testfiles/vds/5_b.h5 - ${HDF5_TOOLS_DIR}/testfiles/vds/5_c.h5 - ${HDF5_TOOLS_DIR}/testfiles/vds/5_vds.h5 - ) - - set (LIST_OTHER_TEST_FILES - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack-help.txt - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_ext.bin - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/ublock.bin - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack.info - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/deflate_limit.h5repack_layout.h5.ddl - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.h5.ddl - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_filters.h5-gzip_verbose_filters.tst - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.h5-plugin_test.ddl - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/plugin_test.h5repack_layout.h5.tst - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.UD.h5-plugin_none.ddl - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/plugin_none.h5repack_layout.UD.h5.tst - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.h5-plugin_version_test.ddl - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/plugin_version_test.h5repack_layout.h5.tst - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/1_vds.h5-vds_dset_chunk20x10x5-v.ddl - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/2_vds.h5-vds_chunk3x6x9-v.ddl - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/3_1_vds.h5-vds_chunk2x5x8-v.ddl - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/4_vds.h5-vds_compa-v.ddl - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/4_vds.h5-vds_conti-v.ddl - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.h5-plugin_zero.tst - ) - - foreach (h5_file ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) - get_filename_component(fname "${h5_file}" NAME) - HDFTEST_COPY_FILE("${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${fname}" "h5repack_files") - endforeach (h5_file ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) - add_custom_target(h5repack_files ALL COMMENT "Copying files needed by h5repack tests" DEPENDS ${h5repack_files_list}) - -############################################################################## -############################################################################## -### T H E T E S T S M A C R O S ### -############################################################################## -############################################################################## - - MACRO (ADD_HELP_TEST testname resultcode) - # If using memchecker add tests without using scripts - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5REPACK-${testname} COMMAND $<TARGET_FILE:h5repack> ${ARGN}) - set_tests_properties (H5REPACK-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5REPACK-${testname} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5REPACK-${testname}") - else (HDF5_ENABLE_USING_MEMCHECKER) - add_test ( - NAME H5REPACK-h5repack-${testname} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:h5repack>" - -D "TEST_ARGS:STRING=${ARGN}" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" - -D "TEST_OUTPUT=h5repack-${testname}.out" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_REFERENCE=h5repack-${testname}.txt" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif (HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_HELP_TEST) - - MACRO (ADD_H5_TEST_OLD testname testtype testfile) - if ("${testtype}" STREQUAL "SKIP") - if (NOT HDF5_ENABLE_USING_MEMCHECKER) - add_test ( - NAME H5REPACK_OLD-${testname}-SKIPPED - COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}" - ) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - else ("${testtype}" STREQUAL "SKIP") - add_test ( - NAME H5REPACK_OLD-${testname} - COMMAND $<TARGET_FILE:h5repack> ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} - ) - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5REPACK_OLD-${testname} PROPERTIES DEPENDS ${last_test}) - endif () - add_test ( - NAME H5REPACK_OLD-${testname}_DFF - COMMAND $<TARGET_FILE:h5diff> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} - ) - set_tests_properties (H5REPACK_OLD-${testname}_DFF PROPERTIES DEPENDS H5REPACK_OLD-${testname}) - endif ("${testtype}" STREQUAL "SKIP") - ENDMACRO (ADD_H5_TEST_OLD) - - MACRO (ADD_H5_TEST testname testtype testfile) - if ("${testtype}" STREQUAL "SKIP") - if (NOT HDF5_ENABLE_USING_MEMCHECKER) - add_test ( - NAME H5REPACK-${testname}-SKIPPED - COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}" - ) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - else ("${testtype}" STREQUAL "SKIP") - add_test ( - NAME H5REPACK-${testname} - COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} - ) - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5REPACK-${testname} PROPERTIES DEPENDS ${last_test}) - endif () - add_test ( - NAME H5REPACK-${testname}_DFF - COMMAND $<TARGET_FILE:h5diff> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} - ) - set_tests_properties (H5REPACK-${testname}_DFF PROPERTIES DEPENDS H5REPACK-${testname}) - endif ("${testtype}" STREQUAL "SKIP") - ENDMACRO (ADD_H5_TEST) - - MACRO (ADD_H5_CMP_TEST testname testfilter testtype resultcode resultfile) - if ("${testtype}" STREQUAL "SKIP") - if (NOT HDF5_ENABLE_USING_MEMCHECKER) - add_test ( - NAME H5REPACK_CMP-${testname}-SKIPPED - COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" - ) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - else ("${testtype}" STREQUAL "SKIP") - # If using memchecker add tests without using scripts - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test ( - NAME H5REPACK_CMP-${testname} - COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}) - else (HDF5_ENABLE_USING_MEMCHECKER) - add_test ( - NAME H5REPACK_CMP-${testname} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:h5repack>" - -D "TEST_ARGS:STRING=${ARGN};${resultfile};out-${testname}.${resultfile}" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" - -D "TEST_OUTPUT=${resultfile}-${testname}.out" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_FILTER:STRING=${testfilter}" - -D "TEST_REFERENCE=${resultfile}-${testname}.tst" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif (HDF5_ENABLE_USING_MEMCHECKER) - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5REPACK_CMP-${testname} PROPERTIES DEPENDS ${last_test}) - endif () - endif ("${testtype}" STREQUAL "SKIP") - ENDMACRO (ADD_H5_CMP_TEST) - - MACRO (ADD_H5_MASK_TEST testname testtype resultcode resultfile) - if ("${testtype}" STREQUAL "SKIP") - if (NOT HDF5_ENABLE_USING_MEMCHECKER) - add_test ( - NAME H5REPACK_MASK-${testname}-SKIPPED - COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" - ) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - else ("${testtype}" STREQUAL "SKIP") - # If using memchecker add tests without using scripts - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test ( - NAME H5REPACK_MASK-${testname} - COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}) - else (HDF5_ENABLE_USING_MEMCHECKER) - add_test ( - NAME H5REPACK_MASK-${testname} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:h5repack>" - -D "TEST_ARGS:STRING=${ARGN};${resultfile};out-${testname}.${resultfile}" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" - -D "TEST_OUTPUT=${resultfile}-${testname}.out" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_MASK_ERROR=true" - -D "TEST_REFERENCE=${resultfile}-${testname}.tst" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif (HDF5_ENABLE_USING_MEMCHECKER) - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5REPACK_MASK-${testname} PROPERTIES DEPENDS ${last_test}) - endif () - endif ("${testtype}" STREQUAL "SKIP") - ENDMACRO (ADD_H5_MASK_TEST) - - MACRO (ADD_H5_DMP_TEST testname testtype resultcode resultfile) - if ("${testtype}" STREQUAL "SKIP") - if (NOT HDF5_ENABLE_USING_MEMCHECKER) - add_test ( - NAME H5REPACK_DMP-${testname}-SKIPPED - COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" - ) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - else ("${testtype}" STREQUAL "SKIP") - # If using memchecker add tests without using scripts - add_test ( - NAME H5REPACK_DMP-${testname} - COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}) - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5REPACK_DMP-${testname} PROPERTIES DEPENDS ${last_test}) - endif () - if (NOT HDF5_ENABLE_USING_MEMCHECKER) - add_test ( - NAME H5REPACK_DMP-h5dump-${testname} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>" - -D "TEST_ARGS:STRING=-pH;out-${testname}.${resultfile}" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" - -D "TEST_OUTPUT=${resultfile}-${testname}.out" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_REFERENCE=${testname}.${resultfile}.ddl" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - set_tests_properties (H5REPACK_DMP-h5dump-${testname} PROPERTIES DEPENDS "H5REPACK_DMP-${testname}") - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - endif ("${testtype}" STREQUAL "SKIP") - ENDMACRO (ADD_H5_DMP_TEST) - - MACRO (ADD_H5_VERIFY_TEST testname testtype resultcode testfile testdset testfilter) - if ("${testtype}" STREQUAL "SKIP") - if (NOT HDF5_ENABLE_USING_MEMCHECKER) - add_test ( - NAME H5REPACK_VERIFY_LAYOUT-${testname}-SKIPPED - COMMAND ${CMAKE_COMMAND} -E echo "SKIP -d ${testdset} -pH ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" - ) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - else ("${testtype}" STREQUAL "SKIP") - if (NOT HDF5_ENABLE_USING_MEMCHECKER) - add_test ( - NAME H5REPACK_VERIFY_LAYOUT-${testname} - COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} - ) - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname} PROPERTIES DEPENDS ${last_test}) - endif () - add_test ( - NAME H5REPACK_VERIFY_LAYOUT-${testname}_DFF - COMMAND $<TARGET_FILE:h5diff> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} - ) - set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}_DFF PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}) - if ("${resultcode}" STREQUAL "0") - add_test ( - NAME H5REPACK_VERIFY_LAYOUT-${testname}_DMP - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>" - -D "TEST_ARGS:STRING=-d;${testdset};-pH;out-${testname}.${testfile}" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" - -D "TEST_OUTPUT=${testfile}-${testname}-v.out" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_FILTER:STRING=${testfilter}" - -D "TEST_REFERENCE=${testfilter}" - -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" - ) - set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}_DMP PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}_DFF) - else ("${resultcode}" STREQUAL "0") - if ("${testfilter}" STREQUAL "CHUNKED") - set (nottestfilter "(CONTIGUOUS|COMPACT)") - endif () - if ("${testfilter}" STREQUAL "CONTIGUOUS") - set (nottestfilter "(CHUNK|COMPACT)") - endif () - if ("${testfilter}" STREQUAL "COMPACT") - set (nottestfilter "(CONTIGUOUS|CHUNK)") - endif () - add_test ( - NAME H5REPACK_VERIFY_LAYOUT-${testname}_DMP - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>" - -D "TEST_ARGS:STRING=-pH;out-${testname}.${testfile}" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" - -D "TEST_OUTPUT=${testfile}-${testname}-v.out" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_FILTER:STRING=${nottestfilter}" - -D "TEST_REFERENCE=${testfilter}" - -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" - ) - set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}_DMP PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}_DFF) - endif ("${resultcode}" STREQUAL "0") - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - endif ("${testtype}" STREQUAL "SKIP") - ENDMACRO (ADD_H5_VERIFY_TEST) - - MACRO (ADD_H5_VERIFY_VDS testname testtype resultcode testfile testdset testfilter) - if ("${testtype}" STREQUAL "SKIP") - if (NOT HDF5_ENABLE_USING_MEMCHECKER) - add_test ( - NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname}-SKIPPED - COMMAND ${CMAKE_COMMAND} -E echo "SKIP -d ${testdset} -pH ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" - ) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - else ("${testtype}" STREQUAL "SKIP") - if (NOT HDF5_ENABLE_USING_MEMCHECKER) - add_test ( - NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname} - COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} - ) - set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname} PROPERTIES DEPENDS ${last_test}) - endif () - add_test ( - NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname}_DMP - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>" - -D "TEST_ARGS:STRING=-d;${testdset};-p;out-${testname}.${testfile}" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" - -D "TEST_OUTPUT=${testfile}-${testname}-v.out" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_REFERENCE=${testfile}-${testname}-v.ddl" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname}_DMP PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname}_DMP PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT_VDS-${testname}) - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - endif ("${testtype}" STREQUAL "SKIP") - ENDMACRO (ADD_H5_VERIFY_VDS) - - MACRO (ADD_H5_TEST_META testname testfile) - add_test ( - NAME H5REPACK_META-${testname}_N - COMMAND $<TARGET_FILE:h5repack> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_N.${testname}.h5 - ) - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5REPACK_META-${testname}_N PROPERTIES DEPENDS ${last_test}) - endif () - add_test ( - NAME H5REPACK_META-${testname}_M - COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_M.${testname}.h5 - ) - set_tests_properties (H5REPACK_META-${testname}_M PROPERTIES DEPENDS H5REPACK_META-${testname}_N) - - add_test (NAME H5REPACK_META-${testname} COMMAND ${CMAKE_COMMAND} -E compare_files ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_N.${testname}.h5 ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_M.${testname}.h5) - set_tests_properties (H5REPACK_META-${testname} PROPERTIES WILL_FAIL "true") - set_tests_properties (H5REPACK_META-${testname} PROPERTIES DEPENDS H5REPACK_META-${testname}_M) - ENDMACRO (ADD_H5_TEST_META) - - MACRO (ADD_H5_UD_TEST testname resultcode resultfile) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - add_test ( - NAME H5REPACK_UD-${testname}-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/out-${testname}.${resultfile} - ) - add_test ( - NAME H5REPACK_UD-${testname} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:h5repack>" - -D "TEST_ARGS:STRING=${ARGN};${resultfile};out-${testname}.${resultfile}" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_FILTER:STRING=O?...ing file[^\n]+\n" - -D "TEST_OUTPUT=${testname}.${resultfile}.out" - -D "TEST_REFERENCE=${testname}.${resultfile}.tst" - -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" - -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - set_tests_properties (H5REPACK_UD-${testname} PROPERTIES DEPENDS H5REPACK_UD-${testname}-clearall-objects) - add_test ( - NAME H5REPACK_UD-h5dump-${testname} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>" - -D "TEST_ARGS:STRING=-pH;out-${testname}.${resultfile}" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" - -D "TEST_OUTPUT=${resultfile}-${testname}.out" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_REFERENCE=${resultfile}-${testname}.ddl" - -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" - -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - set_tests_properties (H5REPACK_UD-h5dump-${testname} PROPERTIES DEPENDS "H5REPACK_UD-${testname}") - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_UD_TEST) - -############################################################################## -############################################################################## -### T H E T E S T S ### -############################################################################## -############################################################################## - - # -------------------------------------------------------------------- - # test file names - # -------------------------------------------------------------------- - set (INFO_FILE testfiles/h5repack.info) - - set (FILE0 h5repack_fill.h5) - set (FILE1 h5repack_objs.h5) - set (FILE2 h5repack_attr.h5) - set (FILE3 h5repack_hlink.h5) - set (FILE4 h5repack_layout.h5) - set (FILE5 h5repack_early.h5) - set (FILE7 h5repack_szip.h5) - set (FILE8 h5repack_deflate.h5) - set (FILE9 h5repack_shuffle.h5) - set (FILE10 h5repack_fletcher.h5) - set (FILE11 h5repack_filters.h5) - set (FILE12 h5repack_nbit.h5) - set (FILE13 h5repack_soffset.h5) - set (FILE14 h5repack_layouto.h5 ) # A file with an older version of the layout message (copy of test/tlayouto.h5) - set (FILE15 h5repack_named_dtypes.h5) - set (FILE16 tfamily%05d.h5) # located in common testfiles folder - set (FILE18 h5repack_layout2.h5) - set (FILE_REF h5repack_refs.h5) - set (FILE_ATTR_REF h5repack_attr_refs.h5) - set (FILEV1 1_vds.h5) - set (FILEV2 2_vds.h5) - set (FILEV3_1 3_1_vds.h5) - set (FILEV3_2 3_2_vds.h5) - set (FILEV4 4_vds.h5) - set (FILEV5 5_vds.h5) - - # Remove any output file left over from previous test run - add_test ( - NAME H5REPACK-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ./testfiles/h5dump-help.out - ./testfiles/h5repack_filters.h5-gzip_verbose_filters.out - ./testfiles/h5repack_filters.h5-gzip_verbose_filters.out.err - ./testfiles/h5repack_layout.h5-chunk_18x13-v.out - ./testfiles/h5repack_layout.h5-chunk_18x13-v.out.err - ./testfiles/h5repack_layout.h5-chunk_20x10-v.out - ./testfiles/h5repack_layout.h5-chunk_20x10-v.out.err - ./testfiles/h5repack_layout.h5-chunk_compa-v.out - ./testfiles/h5repack_layout.h5-chunk_compa-v.out.err - ./testfiles/h5repack_layout.h5-chunk_conti-v.out - ./testfiles/h5repack_layout.h5-chunk_conti-v.out.err - ./testfiles/h5repack_layout.h5-compa-v.out - ./testfiles/h5repack_layout.h5-compa-v.out.err - ./testfiles/h5repack_layout.h5-conti-v.out - ./testfiles/h5repack_layout.h5-conti-v.out.err - ./testfiles/h5repack_layout.h5-deflate_limit.out - ./testfiles/h5repack_layout.h5-deflate_limit.out.err - ./testfiles/h5repack_layout.h5-dset2_chunk_20x10-v.out - ./testfiles/h5repack_layout.h5-dset2_chunk_20x10-v.out.err - ./testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.out - ./testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.out.err - ./testfiles/h5repack_layout.h5-dset2_compa-v.out - ./testfiles/h5repack_layout.h5-dset2_compa-v.out.err - ./testfiles/h5repack_layout.h5-dset2_conti-v.out - ./testfiles/h5repack_layout.h5-dset2_conti-v.out.err - ./testfiles/h5repack_layout.h5-dset_compa_chunk-v.out - ./testfiles/h5repack_layout.h5-dset_compa_chunk-v.out.err - ./testfiles/h5repack_layout.h5-dset_compa_compa-v.out - ./testfiles/h5repack_layout.h5-dset_compa_compa-v.out.err - ./testfiles/h5repack_layout.h5-dset_compa_conti-v.out - ./testfiles/h5repack_layout.h5-dset_compa_conti-v.out.err - ./testfiles/h5repack_layout.h5-dset_conti_chunk-v.out - ./testfiles/h5repack_layout.h5-dset_conti_chunk-v.out.err - ./testfiles/h5repack_layout.h5-dset_conti_compa-v.out - ./testfiles/h5repack_layout.h5-dset_conti_compa-v.out.err - ./testfiles/h5repack_layout.h5-dset_conti_conti-v.out - ./testfiles/h5repack_layout.h5-dset_conti_conti-v.out.err - ./testfiles/h5repack_layout.h5-layout_long_switches-v.out - ./testfiles/h5repack_layout.h5-layout_long_switches-v.out.err - ./testfiles/h5repack_layout.h5-layout_short_switches-v.out - ./testfiles/h5repack_layout.h5-layout_short_switches-v.out.err - ./testfiles/h5repack_layout.h5-plugin_test.out - ./testfiles/h5repack_layout.h5-plugin_test.out.err - ./testfiles/h5repack_layout2.h5-contig_small_compa-v.out - ./testfiles/h5repack_layout2.h5-contig_small_compa-v.out.err - ./testfiles/h5repack_layout2.h5-contig_small_fixed_compa-v.out - ./testfiles/h5repack_layout2.h5-contig_small_fixed_compa-v.out.err - ./testfiles/h5repack_layout3.h5-ckdim_biger-v.out - ./testfiles/h5repack_layout3.h5-ckdim_biger-v.out.err - ./testfiles/h5repack_layout3.h5-ckdim_smaller-v.out - ./testfiles/h5repack_layout3.h5-ckdim_smaller-v.out.err - ./testfiles/h5repack_layout3.h5-chunk2chunk-v.out - ./testfiles/h5repack_layout3.h5-chunk2chunk-v.out.err - ./testfiles/h5repack_layout3.h5-chunk2compa-v.out - ./testfiles/h5repack_layout3.h5-chunk2compa-v.out.err - ./testfiles/h5repack_layout3.h5-chunk2conti-v.out - ./testfiles/h5repack_layout3.h5-chunk2conti-v.out.err - ./testfiles/h5repack_layout3.h5-error1-v.out - ./testfiles/h5repack_layout3.h5-error1-v.out.err - ./testfiles/h5repack_layout3.h5-error2-v.out - ./testfiles/h5repack_layout3.h5-error2-v.out.err - ./testfiles/h5repack_layout3.h5-error3-v.out - ./testfiles/h5repack_layout3.h5-error3-v.out.err - ./testfiles/out-family.tfamily%05d.h5 - ./testfiles/out-HDFFV-7840.h5diff_attr1.h5 - ./testfiles/out-attr.h5repack_attr.h5 - ./testfiles/out-native_attr.h5repack_attr.h5 - ./testfiles/out-HDFFV-5932.h5repack_attr_refs.h5 - ./testfiles/out-deflate_copy.h5repack_deflate.h5 - ./testfiles/out-deflate_remove.h5repack_deflate.h5 - ./testfiles/out-early.h5repack_early.h5 - ./testfiles/out-fill.h5repack_fill.h5 - ./testfiles/out-native_fill.h5repack_fill.h5 - ./testfiles/out-gzip_verbose_filters.h5repack_filters.h5 - ./testfiles/out-fletcher_copy.h5repack_fletcher.h5 - ./testfiles/out-fletcher_remove.h5repack_fletcher.h5 - ./testfiles/out-hlink.h5repack_hlink.h5 - ./testfiles/out-chunk_18x13.h5repack_layout.h5 - ./testfiles/out-chunk_20x10.h5repack_layout.h5 - ./testfiles/out-chunk_compa.h5repack_layout.h5 - ./testfiles/out-chunk_conti.h5repack_layout.h5 - ./testfiles/out-compa.h5repack_layout.h5 - ./testfiles/out-conti.h5repack_layout.h5 - ./testfiles/out-deflate_file.h5repack_layout.h5 - ./testfiles/out-deflate_limit.h5repack_layout.h5 - ./testfiles/out-dset2_chunk_20x10.h5repack_layout.h5 - ./testfiles/out-dset2_compa.h5repack_layout.h5 - ./testfiles/out-dset2_conti.h5repack_layout.h5 - ./testfiles/out-dset_compa_chunk.h5repack_layout.h5 - ./testfiles/out-dset_compa_compa.h5repack_layout.h5 - ./testfiles/out-dset_compa_conti.h5repack_layout.h5 - ./testfiles/out-dset_conti_chunk.h5repack_layout.h5 - ./testfiles/out-dset_conti_compa.h5repack_layout.h5 - ./testfiles/out-dset_conti_conti.h5repack_layout.h5 - ./testfiles/out-fletcher_all.h5repack_layout.h5 - ./testfiles/out-fletcher_individual.h5repack_layout.h5 - ./testfiles/out-global_filters.h5repack_layout.h5 - ./testfiles/out-gzip_all.h5repack_layout.h5 - ./testfiles/out-gzip_individual.h5repack_layout.h5 - ./testfiles/out-layout.h5repack_layout.h5 - ./testfiles/out-layout_long_switches.h5repack_layout.h5 - ./testfiles/out-layout_short_switches.h5repack_layout.h5 - ./testfiles/out-old_style_layout_short_switches.h5repack_layout.h5 - ./testfiles/out-plugin_test.h5repack_layout.h5 - ./testfiles/out-shuffle_all.h5repack_layout.h5 - ./testfiles/out-shuffle_individual.h5repack_layout.h5 - ./testfiles/out-upgrade_layout.h5repack_layouto.h5 - ./testfiles/out-contig_small_compa.h5repack_layout2.h5 - ./testfiles/out-contig_small_fixed_compa.h5repack_layout2.h5 - ./testfiles/out-ckdim_biger.h5repack_layout3.h5 - ./testfiles/out-ckdim_smaller.h5repack_layout3.h5 - ./testfiles/out-chunk2chunk.h5repack_layout3.h5 - ./testfiles/out-chunk2compa.h5repack_layout3.h5 - ./testfiles/out-chunk2conti.h5repack_layout3.h5 - ./testfiles/out-error1.h5repack_layout3.h5 - ./testfiles/out-error2.h5repack_layout3.h5 - ./testfiles/out-error3.h5repack_layout3.h5 - ./testfiles/out-error4.h5repack_layout3.h5 - ./testfiles/out-committed_dt.h5repack_named_dtypes.h5 - ./testfiles/out-nbit_add.h5repack_nbit.h5 - ./testfiles/out-nbit_copy.h5repack_nbit.h5 - ./testfiles/out-nbit_remove.h5repack_nbit.h5 - ./testfiles/out-add_alignment.h5repack_objs.h5 - ./testfiles/out-add_userblock.h5repack_objs.h5 - ./testfiles/out-objs.h5repack_objs.h5 - ./testfiles/out-gt_mallocsize.h5repack_objs.h5 - ./testfiles/out-bug1814.h5repack_refs.h5 - ./testfiles/out-shuffle_copy.h5repack_shuffle.h5 - ./testfiles/out-shuffle_remove.h5repack_shuffle.h5 - ./testfiles/out-scale_add.h5repack_soffset.h5 - ./testfiles/out-scale_copy.h5repack_soffset.h5 - ./testfiles/out-scale_remove.h5repack_soffset.h5 - ./testfiles/out-meta_short_M.meta_short.h5 - ./testfiles/out-meta_short_N.meta_short.h5 - ./testfiles/out-meta_long_M.meta_long.h5 - ./testfiles/out-meta_long_N.meta_long.h5 - ./testfiles/1_vds.h5-vds_dset_chunk20x10x5-v.out - ./testfiles/1_vds.h5-vds_dset_chunk20x10x5-v.out.err - ./testfiles/2_vds.h5-vds_chunk3x6x9-v.out - ./testfiles/2_vds.h5-vds_chunk3x6x9-v.out.err - ./testfiles/3_1_vds.h5-vds_chunk2x5x8-v.out - ./testfiles/3_1_vds.h5-vds_chunk2x5x8-v.out.err - ./testfiles/4_vds.h5-vds_compa-v.out - ./testfiles/4_vds.h5-vds_compa-v.out.err - ./testfiles/4_vds.h5-vds_conti-v.out - ./testfiles/4_vds.h5-vds_conti-v.out.err - ./testfiles/out-vds_compa.4_vds.h5 - ./testfiles/out-vds_conti.4_vds.h5 - ./testfiles/out-vds_chunk2x5x8.3_1_vds.h5 - ./testfiles/out-vds_chunk3x6x9.2_vds.h5 - ./testfiles/out-vds_dset_chunk20x10x5.1_vds.h5 - h5repack_attr.h5 - h5repack_attr_out.h5 - h5repack_attr_refs.h5 - h5repack_big.h5 - h5repack_deflate.h5 - h5repack_deflate_out.h5 - h5repack_early2.h5 - h5repack_early.h5 - h5repack_early_out.h5 - h5repack_ext.h5 - h5repack_ext_out.h5 - h5repack_fill.h5 - h5repack_fill_out.h5 - h5repack_filters.h5 - h5repack_filters_out.h5 - h5repack_fletcher.h5 - h5repack_fletcher_out.h5 - h5repack_hlink.h5 - h5repack_hlink_out.h5 - h5repack_layout.h5 - h5repack_layout_out.h5 - h5repack_layout2.h5 - h5repack_layout3.h5 - h5repack_named_dtypes.h5 - h5repack_named_dtypes_out.h5 - h5repack_nbit.h5 - h5repack_nbit_out.h5 - h5repack_objs.h5 - h5repack_objs_out.h5 - h5repack_refs.h5 - h5repack_shuffle.h5 - h5repack_shuffle_out.h5 - h5repack_soffset.h5 - h5repack_soffset_out.h5 - h5repack_szip.h5 - h5repack_szip_out.h5 - h5repack_ub.h5 - h5repack_ub_out.h5 - h5repack_ext.bin - ublock.bin - ) - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5REPACK-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") - - ADD_HELP_TEST(help 0 -h) - - add_test (NAME H5REPACK-testh5repack_detect_szip COMMAND $<TARGET_FILE:testh5repack_detect_szip>) - if (HDF5_ENABLE_SZIP_SUPPORT) - if (HDF5_ENABLE_SZIP_ENCODING) - set (passRegex "yes") - set_tests_properties (H5REPACK-testh5repack_detect_szip PROPERTIES PASS_REGULAR_EXPRESSION "yes") - else (HDF5_ENABLE_SZIP_ENCODING) - set (passRegex "no") - set_tests_properties (H5REPACK-testh5repack_detect_szip PROPERTIES PASS_REGULAR_EXPRESSION "no") - endif (HDF5_ENABLE_SZIP_ENCODING) - else (HDF5_ENABLE_SZIP_SUPPORT) - set (passRegex "no") - set_tests_properties (H5REPACK-testh5repack_detect_szip PROPERTIES PASS_REGULAR_EXPRESSION "no") - endif (HDF5_ENABLE_SZIP_SUPPORT) - set_tests_properties (H5REPACK-testh5repack_detect_szip PROPERTIES DEPENDS H5REPACK-clearall-objects) - - add_test (NAME H5REPACK-h5repacktest COMMAND $<TARGET_FILE:h5repacktest>) - set_tests_properties (H5REPACK-h5repacktest PROPERTIES DEPENDS H5REPACK-testh5repack_detect_szip) - set (last_test "H5REPACK-h5repacktest") - -# -# The tests -# We use the files generated by h5repacktst -# Each run generates "<file>.out.h5" and the tool h5diff is used to -# compare the input and output files -# -# the tests are the same as the program h5repacktst, but run from the CLI -# - -# See which filters are usable (and skip tests for filters we -# don't have). Do this by searching H5pubconf.h to see which -# filters are defined. - -# detect whether the encoder is present. - set (USE_FILTER_SZIP_ENCODER "no") - if (HDF5_ENABLE_SZIP_ENCODING) - set (USE_FILTER_SZIP_ENCODER ${testh5repack_detect_szip}) - endif (HDF5_ENABLE_SZIP_ENCODING) - - if (H5_HAVE_FILTER_DEFLATE) - set (USE_FILTER_DEFLATE "true") - endif (H5_HAVE_FILTER_DEFLATE) - - if (H5_HAVE_FILTER_SZIP) - set (USE_FILTER_SZIP "true") - endif (H5_HAVE_FILTER_SZIP) - -# copy files (these files have no filters) - ADD_H5_TEST (fill "TEST" ${FILE0}) - ADD_H5_TEST (objs "TEST" ${FILE1}) - ADD_H5_TEST (attr "TEST" ${FILE2}) - ADD_H5_TEST (hlink "TEST" ${FILE3}) - ADD_H5_TEST (layout "TEST" ${FILE4}) - ADD_H5_TEST (early "TEST" ${FILE5}) - -# use $FILE4 to write some filters (this file has no filters) - -# gzip with individual object - set (arg ${FILE4} -f dset1:GZIP=1 -l dset1:CHUNK=20x10) - set (TESTTYPE "TEST") - if (NOT USE_FILTER_DEFLATE) - set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_DEFLATE) - ADD_H5_TEST (gzip_individual ${TESTTYPE} ${arg}) - -# gzip for all - set (arg ${FILE4} -f GZIP=1) - set (TESTTYPE "TEST") - if (NOT USE_FILTER_DEFLATE) - set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_DEFLATE) - ADD_H5_TEST (gzip_all ${TESTTYPE} ${arg}) - -# szip with individual object - set (arg ${FILE4} -f dset2:SZIP=8,EC -l dset2:CHUNK=20x10) - set (TESTTYPE "TEST") - if (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP) - set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP) - ADD_H5_TEST (szip_individual ${TESTTYPE} ${arg}) - -# szip for all - set (arg ${FILE4} -f SZIP=8,NN) - set (TESTTYPE "TEST") - if (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP) - set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP) - ADD_H5_TEST (szip_all ${TESTTYPE} ${arg}) - -# shuffle with individual object - set (arg ${FILE4} -f dset2:SHUF -l dset2:CHUNK=20x10) - ADD_H5_TEST (shuffle_individual "TEST" ${arg}) - -# shuffle for all - set (arg ${FILE4} -f SHUF) - ADD_H5_TEST (shuffle_all "TEST" ${arg}) - -# fletcher32 with individual object - set (arg ${FILE4} -f dset2:FLET -l dset2:CHUNK=20x10) - ADD_H5_TEST (fletcher_individual "TEST" ${arg}) - -# fletcher32 for all - set (arg ${FILE4} -f FLET) - ADD_H5_TEST (fletcher_all "TEST" ${arg}) - -# all filters - set (arg ${FILE4} -f dset2:SHUF -f dset2:FLET -f dset2:SZIP=8,NN -f dset2:GZIP=1 -l dset2:CHUNK=20x10) - set (TESTTYPE "TEST") - if (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_DEFLATE) - set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_DEFLATE) - ADD_H5_TEST (all_filters ${TESTTYPE} ${arg}) - -# verbose gzip with individual object - set (arg ${FILE11} -v -f /dset_deflate:GZIP=9) - set (TESTTYPE "TEST") - if (NOT USE_FILTER_DEFLATE) - set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_DEFLATE) - ADD_H5_CMP_TEST (gzip_verbose_filters "O?...ing file[^\n]+\n" ${TESTTYPE} 0 ${arg}) - -########################################################### -# the following tests assume the input files have filters -########################################################### - -# szip copy - set (arg ${FILE7}) - set (TESTTYPE "TEST") - if (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP) - set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP) - ADD_H5_TEST (szip_copy ${TESTTYPE} ${arg}) - -# szip remove - set (arg ${FILE7} --filter=dset_szip:NONE) - set (TESTTYPE "TEST") - if (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP) - set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP) - ADD_H5_TEST (szip_remove ${TESTTYPE} ${arg}) - -# deflate copy - set (arg ${FILE8}) - set (TESTTYPE "TEST") - if (NOT USE_FILTER_DEFLATE) - set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_DEFLATE) - ADD_H5_TEST (deflate_copy ${TESTTYPE} ${arg}) - -# deflate remove - set (arg ${FILE8} -f dset_deflate:NONE) - set (TESTTYPE "TEST") - if (NOT USE_FILTER_DEFLATE) - set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_DEFLATE) - ADD_H5_TEST (deflate_remove ${TESTTYPE} ${arg}) - -# shuffle copy - set (arg ${FILE9}) - ADD_H5_TEST (shuffle_copy "TEST" ${arg}) - -# shuffle remove - set (arg ${FILE9} -f dset_shuffle:NONE) - ADD_H5_TEST (shuffle_remove "TEST" ${arg}) - -# fletcher32 copy - set (arg ${FILE10}) - ADD_H5_TEST (fletcher_copy "TEST" ${arg}) - -# fletcher32 remove - set (arg ${FILE10} -f dset_fletcher32:NONE) - ADD_H5_TEST (fletcher_remove "TEST" ${arg}) - -# nbit copy - set (arg ${FILE12}) - ADD_H5_TEST (nbit_copy "TEST" ${arg}) - -# nbit remove - set (arg ${FILE12} -f dset_nbit:NONE) - ADD_H5_TEST (nbit_remove "TEST" ${arg}) - -# nbit add - set (arg ${FILE12} -f dset_int31:NBIT) - ADD_H5_TEST (nbit_add "TEST" ${arg}) - -# scaleoffset copy - set (arg ${FILE13}) - ADD_H5_TEST (scale_copy "TEST" ${arg}) - -# scaleoffset add - set (arg ${FILE13} -f dset_none:SOFF=31,IN) - ADD_H5_TEST (scale_add "TEST" ${arg}) - -# scaleoffset remove - set (arg ${FILE13} -f dset_scaleoffset:NONE) - ADD_H5_TEST (scale_remove "TEST" ${arg}) - -# remove all filters - set (arg ${FILE11} -f NONE) - set (TESTTYPE "TEST") - if (NOT USE_FILTER_DEFLATE OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_SZIP_ENCODER) - set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_DEFLATE OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_SZIP_ENCODER) - ADD_H5_TEST (remove_all ${TESTTYPE} ${arg}) - -#filter conversions - set (arg ${FILE8} -f dset_deflate:SZIP=8,NN) - set (TESTTYPE "TEST") - if (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_DEFLATE) - set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_DEFLATE) - ADD_H5_TEST (deflate_convert ${TESTTYPE} ${arg}) - - set (arg ${FILE7} -f dset_szip:GZIP=1) - set (TESTTYPE "TEST") - if (NOT USE_FILTER_SZIP OR NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_DEFLATE) - set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_SZIP OR NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_DEFLATE) - ADD_H5_TEST (szip_convert ${TESTTYPE} ${arg}) - -#limit - set (arg ${FILE4} -f GZIP=1 -m 1024) - set (TESTTYPE "TEST") - if (NOT USE_FILTER_DEFLATE) - set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_DEFLATE) - ADD_H5_DMP_TEST (deflate_limit ${TESTTYPE} 0 ${arg}) - -#file - set (arg ${FILE4} -e ${INFO_FILE}) - set (TESTTYPE "TEST") - if (NOT USE_FILTER_DEFLATE) - set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_DEFLATE) - ADD_H5_TEST (deflate_file ${TESTTYPE} ${arg}) - -######################################################### -# layout options (these files have no filters) -######################################################### - ADD_H5_VERIFY_TEST (dset2_chunk_20x10 "TEST" 0 ${FILE4} dset2 CHUNKED --layout=dset2:CHUNK=20x10) - ADD_H5_VERIFY_TEST (chunk_20x10 "TEST" 1 ${FILE4} null CHUNKED -l CHUNK=20x10) - ADD_H5_VERIFY_TEST (dset2_conti "TEST" 0 ${FILE4} dset2 CONTIGUOUS -l dset2:CONTI) - ADD_H5_VERIFY_TEST (conti "TEST" 1 ${FILE4} null CONTIGUOUS -l CONTI) - ADD_H5_VERIFY_TEST (dset2_compa "TEST" 0 ${FILE4} dset2 COMPACT -l dset2:COMPA) - ADD_H5_VERIFY_TEST (compa "TEST" 1 ${FILE4} null COMPACT -l COMPA) - ADD_H5_MASK_TEST (dset2_chunk_20x10-errstk "TEST" 0 ${FILE4} --layout=dset2:CHUNK=20x10x5 --enable-error-stack) - -################################################################ -# layout conversions (file has no filters) -############################################################### - ADD_H5_VERIFY_TEST (dset_compa_conti "TEST" 0 ${FILE4} dset_compact CONTIGUOUS -l dset_compact:CONTI) - ADD_H5_VERIFY_TEST (dset_compa_chunk "TEST" 0 ${FILE4} dset_compact CHUNKED -l dset_compact:CHUNK=2x5) - ADD_H5_VERIFY_TEST (dset_compa_compa "TEST" 0 ${FILE4} dset_compact COMPACT -l dset_compact:COMPA) - ADD_H5_VERIFY_TEST (dset_conti_compa "TEST" 0 ${FILE4} dset_contiguous COMPACT -l dset_contiguous:COMPA) - ADD_H5_VERIFY_TEST (dset_conti_chunk "TEST" 0 ${FILE4} dset_contiguous CHUNKED -l dset_contiguous:CHUNK=3x6) - ADD_H5_VERIFY_TEST (dset_conti_conti "TEST" 0 ${FILE4} dset_contiguous CONTIGUOUS -l dset_contiguous:CONTI) - ADD_H5_VERIFY_TEST (chunk_compa "TEST" 0 ${FILE4} dset_chunk COMPACT -l dset_chunk:COMPA) - ADD_H5_VERIFY_TEST (chunk_conti "TEST" 0 ${FILE4} dset_chunk CONTIGUOUS -l dset_chunk:CONTI) - ADD_H5_VERIFY_TEST (chunk_18x13 "TEST" 0 ${FILE4} dset_chunk CHUNKED -l dset_chunk:CHUNK=18x13) - -# test convert small size dataset ( < 1k) to compact layout without -m - ADD_H5_VERIFY_TEST (contig_small_compa "TEST" 0 ${FILE18} contig_small COMPACT -l contig_small:COMPA) - ADD_H5_VERIFY_TEST (contig_small_fixed_compa "TEST" 0 ${FILE18} chunked_small_fixed COMPACT -l chunked_small_fixed:COMPA) - -#--------------------------------------------------------------------------- -# Test file contains chunked datasets (need multiple dsets) with -# unlimited max dims. (HDFFV-7933) -# Use first dset to test. -#--------------------------------------------------------------------------- -# chunk to chunk - specify chunk dim bigger than any current dim - ADD_H5_VERIFY_TEST (chunk2chunk "TEST" 0 h5repack_layout3.h5 chunk_unlimit1 CHUNK -l chunk_unlimit1:CHUNK=100x300) - -# chunk to contiguous - ADD_H5_VERIFY_TEST (chunk2conti "TEST" 0 h5repack_layout3.h5 chunk_unlimit1 CONTI -l chunk_unlimit1:CONTI) - -# chunk to compact - convert big dataset (should be > 64k) for this purpose, -# should remain as original layout (chunk) - ADD_H5_VERIFY_TEST (chunk2compa "TEST" 0 h5repack_layout3.h5 chunk_unlimit1 CHUNK -l chunk_unlimit1:COMPA) - -#-------------------------------------------------------------------------- -# Test -f for some specific cases. Chunked dataset with unlimited max dims. -# (HDFFV-8012) -#-------------------------------------------------------------------------- -# - should not fail -# - should not change max dims from unlimit - -# chunk dim is bigger than dataset dim. ( dset size < 64k ) - ADD_H5_VERIFY_TEST (error1 "TEST" 0 h5repack_layout3.h5 chunk_unlimit1 H5S_UNLIMITED -f chunk_unlimit1:NONE) - -# chunk dim is bigger than dataset dim. ( dset size > 64k ) - ADD_H5_VERIFY_TEST (error2 "TEST" 0 h5repack_layout3.h5 chunk_unlimit2 H5S_UNLIMITED -f chunk_unlimit2:NONE) - -# chunk dims are smaller than dataset dims. ( dset size < 64k ) - ADD_H5_VERIFY_TEST (error3 "TEST" 0 h5repack_layout3.h5 chunk_unlimit3 H5S_UNLIMITED -f chunk_unlimit3:NONE) - -# file input - should not fail - ADD_H5_TEST (error4 "TEST" h5repack_layout3.h5 -f NONE) - -#-------------------------------------------------------------------------- -# Test base: Convert CHUNK to CONTI for a chunked dataset with small dataset -# (dset size < 64K) and with unlimited max dims on a condition as follow. -# (HDFFV-8214) -#-------------------------------------------------------------------------- -# chunk dim is bigger than dataset dim. should succeed. - ADD_H5_VERIFY_TEST (ckdim_biger "TEST" 0 h5repack_layout3.h5 chunk_unlimit2 CONTI -l chunk_unlimit2:CONTI) -# chunk dim is smaller than dataset dim. should succeed. - ADD_H5_VERIFY_TEST (ckdim_smaller "TEST" 0 h5repack_layout3.h5 chunk_unlimit3 CONTI -l chunk_unlimit3:CONTI) - - - -# Native option -# Do not use FILE1, as the named dtype will be converted to native, and h5diff will -# report a difference. - ADD_H5_TEST (native_fill "TEST" ${FILE0} -n) - ADD_H5_TEST (native_attr "TEST" ${FILE2} -n) - -# latest file format with long switches. use FILE4=h5repack_layout.h5 (no filters) - set (arg --layout CHUNK=20x10 --filter GZIP=1 --minimum=10 --native --latest --compact=8 --indexed=6 --ssize=8[:dtype]) - set (TESTTYPE "TEST") - if (NOT USE_FILTER_DEFLATE) - set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_DEFLATE) - ADD_H5_VERIFY_TEST (layout_long_switches ${TESTTYPE} 1 ${FILE4} null CHUNKED ${arg}) - -# latest file format with short switches. use FILE4=h5repack_layout.h5 (no filters) - set (arg -l CHUNK=20x10 -f GZIP=1 -m 10 -n -L -c 8 -d 6 -s 8[:dtype]) - set (TESTTYPE "TEST") - if (NOT USE_FILTER_DEFLATE) - set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_DEFLATE) - ADD_H5_VERIFY_TEST (layout_short_switches ${TESTTYPE} 1 ${FILE4} null CHUNKED ${arg}) - -# several global filters - set (arg ${FILE4} --filter GZIP=1 --filter SHUF) - set (TESTTYPE "TEST") - if (NOT USE_FILTER_DEFLATE) - set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_DEFLATE) - ADD_H5_TEST (global_filters ${TESTTYPE} ${arg}) - -# syntax of -i infile -o outfile -# latest file format with short switches. use FILE4=h5repack_layout.h5 (no filters) - set (arg ${FILE4} -l CHUNK=20x10 -f GZIP=1 -m 10 -n -L -c 8 -d 6 -s 8[:dtype]) - set (TESTTYPE "LEGACY") - if (NOT USE_FILTER_DEFLATE) - set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_DEFLATE) - ADD_H5_TEST_OLD (old_style_layout_short_switches ${TESTTYPE} ${arg}) - -# add a userblock to file - set (arg ${FILE1} -u ${PROJECT_BINARY_DIR}/testfiles/ublock.bin -b 2048) - ADD_H5_TEST (add_userblock "TEST" ${arg}) - -# add alignment - set (arg ${FILE1} -t 1 -a 1) - ADD_H5_TEST (add_alignment "TEST" ${arg}) - -# Check repacking file with old version of layout message (should get upgraded -# to new version and be readable, etc.) - ADD_H5_TEST (upgrade_layout "TEST" ${FILE14}) - -# test for datum size > H5TOOLS_MALLOCSIZE - ADD_H5_TEST (gt_mallocsize "TEST" ${FILE1} -f GZIP=1) - -# Check repacking file with committed datatypes in odd configurations - ADD_H5_TEST (committed_dt "TEST" ${FILE15}) - -# tests family driver (file is located in common testfiles folder, uses TOOLTEST1 - ADD_H5_TEST (family "TEST" ${FILE16}) - -# test various references (bug 1814 and 1726) - ADD_H5_TEST (bug1814 "TEST" ${FILE_REF}) - -# test attribute with various references (bug1797 / HDFFV-5932) -# the references in attribute of compund or vlen datatype - ADD_H5_TEST (HDFFV-5932 "TEST" ${FILE_ATTR_REF}) - -# Add test for memory leak in attirbute. This test is verified by CTEST. -# 1. leak from vlen string -# 2. leak from compound type without reference member -# (HDFFV-7840, ) -# Note: this test is experimental for sharing test file among tools - ADD_H5_TEST (HDFFV-7840 "TEST" h5diff_attr1.h5) - -# tests for metadata block size option ('-M') - ADD_H5_TEST_META (meta_short h5repack_layout.h5 -M 8192) - ADD_H5_TEST_META (meta_long h5repack_layout.h5 --metadata_block_size=8192) - -# VDS tests - -################################################################ -# layout conversions -############################################################### - set (TESTTYPE "TEST") - if (NOT USE_FILTER_DEFLATE) - set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_DEFLATE) - ADD_H5_VERIFY_VDS (vds_dset_chunk20x10x5 ${TESTTYPE} 0 ${FILEV1} vds_dset CHUNKED -l vds_dset:CHUNK=20x10x5) - - set (TESTTYPE "TEST") - if (NOT USE_FILTER_DEFLATE) - set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_DEFLATE) - ADD_H5_VERIFY_VDS (vds_chunk2x5x8 ${TESTTYPE} 0 ${FILEV3_1} vds_dset CHUNKED -l vds_dset:CHUNK=2x5x8) - - set (TESTTYPE "TEST") - if (NOT USE_FILTER_DEFLATE) - set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_DEFLATE) - ADD_H5_VERIFY_VDS (vds_chunk3x6x9 ${TESTTYPE} 0 ${FILEV2} vds_dset CHUNKED -l vds_dset:CHUNK=3x6x9) - - set (TESTTYPE "TEST") - if (NOT USE_FILTER_DEFLATE) - set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_DEFLATE) - ADD_H5_VERIFY_VDS (vds_compa ${TESTTYPE} 0 ${FILEV4} vds_dset COMPACT -l vds_dset:COMPA) - - set (TESTTYPE "TEST") - if (NOT USE_FILTER_DEFLATE) - set (TESTTYPE "SKIP") - endif (NOT USE_FILTER_DEFLATE) - ADD_H5_VERIFY_VDS (vds_conti ${TESTTYPE} 0 ${FILEV4} vds_dset CONTIGUOUS -l vds_dset:CONTI) - -############################################################################## -### P L U G I N T E S T S -############################################################################## - ADD_H5_UD_TEST (plugin_version_test 0 h5repack_layout.h5 -v -f UD=260,4,9,1,9,235) - ADD_H5_UD_TEST (plugin_test 0 h5repack_layout.h5 -v -f UD=257,1,9) - ADD_H5_UD_TEST (plugin_none 0 h5repack_layout.UD.h5 -v -f NONE) - # check for no parameters - set (TESTRETVAL 255) - if (WIN32) - set (TESTRETVAL -1) - endif() - ADD_H5_CMP_TEST (plugin_zero "" "TEST" ${TESTRETVAL} h5repack_layout.h5 -v -f UD=250,0) - - if (HDF5_TEST_VFD) - # Run test with different Virtual File Driver - foreach (vfd ${VFD_LIST}) - ADD_VFD_TEST (${vfd} 0) - endforeach (vfd ${VFD_LIST}) - endif (HDF5_TEST_VFD) diff --git a/tools/h5repack/Makefile.am b/tools/h5repack/Makefile.am deleted file mode 100644 index 5f32d73..0000000 --- a/tools/h5repack/Makefile.am +++ /dev/null @@ -1,79 +0,0 @@ -# -# Copyright by The HDF Group. -# Copyright by the Board of Trustees of the University of Illinois. -# All rights reserved. -# -# This file is part of HDF5. The full HDF5 copyright notice, including -# terms governing use, modification, and redistribution, is contained in -# the files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic HDF5 document set and -# is linked from the top-level documents page. It can also be found at -# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have -# access to either file, you may request a copy from help@hdfgroup.org. -## -## Makefile.am -## Run automake to generate a Makefile.in from this file. -# -# HDF5 Library Makefile(.in) -# - -include $(top_srcdir)/config/commence.am - -# Include src, test, and tools/lib directories -AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib - -# Test programs and scripts -TEST_SCRIPT=h5repack.sh -TEST_PROG=h5repacktst -noinst_PROGRAMS=testh5repack_detect_szip - -SCRIPT_DEPEND=h5repack$(EXEEXT) -if HAVE_SHARED_CONDITIONAL -if USE_PLUGINS_CONDITIONAL - TEST_SCRIPT += h5repack_plugin.sh -endif -endif - -check_SCRIPTS=$(TEST_SCRIPT) -check_PROGRAMS=$(TEST_PROG) - -# Our main target, h5repack tool -bin_PROGRAMS=h5repack - -# Add h5repack specific linker flags here -h5repack_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) - -# Depend on the hdf5 library, the tools library, the test library -LDADD=$(LIBH5TOOLS) $(LIBH5TEST) $(LIBHDF5) - -# Source files -COMMON_SOURCES=h5repack.c h5repack_copy.c h5repack_filters.c \ - h5repack_opttable.c h5repack_parse.c h5repack_refs.c \ - h5repack_verify.c - -h5repack_SOURCES=$(COMMON_SOURCES) h5repack_main.c - -h5repacktst_SOURCES=$(COMMON_SOURCES) h5repacktst.c - -testh5repack_detect_szip_SOURCES=testh5repack_detect_szip.c - -# The h5repack.sh script needs h5repacktst to run first. -h5repack.sh.chkexe_: h5repacktst.chkexe_ - -if HAVE_SHARED_CONDITIONAL - # Build it as shared library if configure is enabled for shared library. - lib_LTLIBRARIES=libdynlibadd.la libdynlibvers.la - libdynlibadd_la_SOURCES=dynlib_rpk.c - libdynlibvers_la_SOURCES=dynlib_vrpk.c - -install-exec-hook: - $(RM) $(DESTDIR)$(libdir)/*dynlib* -endif - -# Temporary files. *.h5 are generated by h5repack. They should -# copied to the testfiles/ directory if update is required. -CHECK_CLEANFILES+=*.h5 *.bin testfiles/h5diff_attr1.h5 testfiles/tfamily*.h5 -DISTCLEANFILES=h5repack.sh h5repack_plugin.sh - -include $(top_srcdir)/config/conclude.am diff --git a/tools/h5repack/dynlib_rpk.c b/tools/h5repack/dynlib_rpk.c deleted file mode 100644 index 3469e58..0000000 --- a/tools/h5repack/dynlib_rpk.c +++ /dev/null @@ -1,97 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic document set and is * - * linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have access * - * to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* - * Programmer: Raymond Lu - * 13 February 2013 - * - * Purpose: Tests the plugin module (H5PL) - */ - -#include <stdlib.h> -#include <stdio.h> -#include "H5PLextern.h" - -#define H5Z_FILTER_DYNLIB1 257 - -static size_t H5Z_filter_dynlib1(unsigned int flags, size_t cd_nelmts, - const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); - -/* This message derives from H5Z */ -const H5Z_class2_t H5Z_DYNLIB1[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_DYNLIB1, /* Filter id number */ - 1, 1, /* Encoding and decoding enabled */ - "dynlib1", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - (H5Z_func_t)H5Z_filter_dynlib1, /* The actual filter function */ -}}; - -H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;} -const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB1;} - -/*------------------------------------------------------------------------- - * Function: H5Z_filter_dynlib1 - * - * Purpose: A dynlib1 filter method that adds on and subtract from - * the original value with another value. It will be built - * as a shared library. plugin.c test will load and use - * this filter library. - * - * Return: Success: Data chunk size - * - * Failure: 0 - * - * Programmer: Raymond Lu - * 29 March 2013 - * - *------------------------------------------------------------------------- - */ -static size_t -H5Z_filter_dynlib1(unsigned int flags, size_t cd_nelmts, - const unsigned int *cd_values, size_t nbytes, - size_t *buf_size, void **buf) -{ - int *int_ptr = (int *)*buf; /* Pointer to the data values */ - size_t buf_left = *buf_size; /* Amount of data buffer left to process */ - int add_on = 0; - - /* Check for the correct number of parameters */ - if(cd_nelmts == 0) - return 0; - - /* Check that permanent parameters are set correctly */ - if(cd_values[0] > 9) - return 0; - - add_on = (int)cd_values[0]; - - if(flags & H5Z_FLAG_REVERSE) { /*read*/ - /* Substract the "add on" value to all the data values */ - while(buf_left > 0) { - *int_ptr++ -= add_on; - buf_left -= sizeof(int); - } /* end while */ - } /* end if */ - else { /*write*/ - /* Add the "add on" value to all the data values */ - while(buf_left > 0) { - *int_ptr++ += add_on; - buf_left -= sizeof(int); - } /* end while */ - } /* end else */ - - return nbytes; -} /* end H5Z_filter_dynlib1() */ - diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c deleted file mode 100644 index ef2085c..0000000 --- a/tools/h5repack/h5repack.c +++ /dev/null @@ -1,942 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include <stdlib.h> -#include <string.h> -#include <ctype.h> - -#include "H5private.h" -#include "h5repack.h" -#include "h5tools.h" -#include "h5tools_utils.h" - -/*------------------------------------------------------------------------- - * File: h5repack.c - * Purpose: Public API functions - *------------------------------------------------------------------------- - */ - -static int check_options(pack_opt_t *options); -static int check_objects(const char* fname, pack_opt_t *options); -static const char* get_sfilter(H5Z_filter_t filtn); -static int have_request(pack_opt_t *options); - -/*------------------------------------------------------------------------- - * Function: h5repack - * - * Purpose: locate all high-level HDF5 objects in the file - * and compress/chunk them using options - * - * 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 - * - * Return: 0, ok, -1, fail - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: September, 22, 2003 - * - *------------------------------------------------------------------------- - */ -int h5repack(const char* infile, const char* outfile, pack_opt_t *options) { - /* check input */ - if (check_options(options) < 0) - return -1; - - /* check for objects in input that are in the file */ - if (check_objects(infile, options) < 0) - return -1; - - /* copy the objects */ - if (copy_objects(infile, outfile, options) < 0) - return -1; - - return 0; -} - -/*------------------------------------------------------------------------- - * Function: h5repack_init - * - * Purpose: initialize options - * - * Return: 0, ok, -1, fail - * - *------------------------------------------------------------------------- - */ -int h5repack_init(pack_opt_t *options, int verbose, hbool_t latest, - H5F_file_space_type_t strategy, hsize_t threshold) { - int k, n; - - HDmemset(options, 0, sizeof(pack_opt_t)); - options->min_comp = 0; - options->verbose = verbose; - options->latest = latest; - options->layout_g = H5D_LAYOUT_ERROR; - - for (n = 0; n < H5_REPACK_MAX_NFILTERS; n++) { - options->filter_g[n].filtn = -1; - options->filter_g[n].cd_nelmts = 0; - for (k = 0; k < CD_VALUES; k++) - options->filter_g[n].cd_values[k] = 0; - } - - options->fs_strategy = strategy; - options->fs_threshold = threshold; - - return (options_table_init(&(options->op_tbl))); -} - -/*------------------------------------------------------------------------- - * Function: h5repack_end - * - * Purpose: free options table - * - *------------------------------------------------------------------------- - */ - -int h5repack_end(pack_opt_t *options) { - return options_table_free(options->op_tbl); -} - -/*------------------------------------------------------------------------- - * Function: h5repack_addfilter - * - * Purpose: add a compression -f option to table - * Example: -f dset:GZIP=6 - * - * Return: 0, ok, -1, fail - * - *------------------------------------------------------------------------- - */ -int -h5repack_addfilter(const char* str, pack_opt_t *options) -{ - obj_list_t *obj_list = NULL; /* one object list for the -f and -l option entry */ - filter_info_t filter; /* filter info for the current -f option entry */ - unsigned n_objs; /* number of objects in the current -f or -l option entry */ - int is_glb; /* is the filter global */ - - /* parse the -f option */ - if (NULL == (obj_list = parse_filter(str, &n_objs, &filter, options, &is_glb))) - return -1; - - /* if it applies to all objects */ - if (is_glb) { - int n; - - n = options->n_filter_g++; /* increase # of global filters */ - if (options->n_filter_g > H5_REPACK_MAX_NFILTERS) { - error_msg("maximum number of filters exceeded for <%s>\n", str); - HDfree(obj_list); - return -1; - } - - options->filter_g[n] = filter; - } - else - options_add_filter(obj_list, n_objs, filter, options->op_tbl); - - HDfree(obj_list); - return 0; -} - -/*------------------------------------------------------------------------- - * Function: h5repack_addlayout - * - * Purpose: add a layout option - * - * Return: 0, ok, -1, fail - * - *------------------------------------------------------------------------- - */ -int -h5repack_addlayout(const char* str, pack_opt_t *options) -{ - obj_list_t *obj_list = NULL; /*one object list for the -t and -c option entry */ - unsigned n_objs; /*number of objects in the current -t or -c option entry */ - pack_info_t pack; /*info about layout to extract from parse */ - int j; - int ret_value = -1; - - init_packobject(&pack); - - if (options->all_layout == 1) { - error_msg( "invalid layout input: 'all' option is present with other objects <%s>\n", str); - return ret_value; - } - - /* parse the layout option */ - obj_list = parse_layout(str, &n_objs, &pack, options); - if (obj_list) { - /* set layout option */ - options->layout_g = pack.layout; - - /* no individual dataset specified */ - if (options->all_layout == 1) { - if (pack.layout == H5D_CHUNKED) { - /* -2 means the NONE option, remove chunking - and set the global layout to contiguous */ - if (pack.chunk.rank == -2) - options->layout_g = H5D_CONTIGUOUS; - /* otherwise set the global chunking type */ - else { - options->chunk_g.rank = pack.chunk.rank; - for (j = 0; j < pack.chunk.rank; j++) - options->chunk_g.chunk_lengths[j] = pack.chunk.chunk_lengths[j]; - } - } - } - - /* individual dataset specified */ - if (options->all_layout == 0) - ret_value = options_add_layout(obj_list, n_objs, &pack, options->op_tbl); - - HDfree(obj_list); - ret_value = 0; - } - - return ret_value; -} - -/* Note: The below copy_named_datatype(), named_datatype_free(), copy_attr() - * were located in h5repack_copy.c as static prior to bugfix1726. - * Made shared functions as copy_attr() was needed in h5repack_refs.c. - * However copy_attr() may be obsoleted when H5Acopy is available and put back - * others to static in h5repack_copy.c. - */ -/*------------------------------------------------------------------------- - * Function: copy_named_datatype - * - * Purpose: Copies the specified datatype anonymously, and returns an open - * id for that datatype in the output file. The first time this - * is called it scans every named datatype in travt into a - * private stack, afterwards it simply scans that stack. The id - * returned must be closed after it is no longer needed. - * named_datatype_free must be called before the program exits - * to free the stack. - * - * Programmer: Neil Fortner - * - * Date: April 14, 2009 - * - *------------------------------------------------------------------------- - */ -hid_t copy_named_datatype(hid_t type_in, hid_t fidout, - named_dt_t **named_dt_head_p, trav_table_t *travt, pack_opt_t *options) { - named_dt_t *dt = *named_dt_head_p; /* Stack pointer */ - named_dt_t *dt_ret = NULL; /* Datatype to return */ - H5O_info_t oinfo; /* Object info of input dtype */ - hid_t ret_value = -1; /* The identifier of the named dtype in the out file */ - - if (H5Oget_info(type_in, &oinfo) < 0) - goto done; - - if (*named_dt_head_p) { - /* Stack already exists, search for the datatype */ - while (dt && dt->addr_in != oinfo.addr) - dt = dt->next; - - dt_ret = dt; - } - else { - /* Create the stack */ - size_t i; - - for (i = 0; i < travt->nobjs; i++) { - if (travt->objs[i].type == H5TRAV_TYPE_NAMED_DATATYPE) { - /* Push onto the stack */ - if (NULL == (dt = (named_dt_t *) HDmalloc(sizeof(named_dt_t)))) { - goto done; - } - dt->next = *named_dt_head_p; - *named_dt_head_p = dt; - - /* Update the address and id */ - dt->addr_in = travt->objs[i].objno; - dt->id_out = -1; - - /* Check if this type is the one requested */ - if (oinfo.addr == dt->addr_in) { - HDassert(!dt_ret); - dt_ret = dt; - } /* end if */ - } /* end if */ - } /* end for */ - } /* end else */ - - /* Handle the case that the requested datatype was not found. This is - * possible if the datatype was committed anonymously in the input file. */ - if (!dt_ret) { - /* Push the new datatype onto the stack */ - if (NULL == (dt_ret = (named_dt_t *) HDmalloc(sizeof(named_dt_t)))) { - goto done; - } - dt_ret->next = *named_dt_head_p; - *named_dt_head_p = dt_ret; - - /* Update the address and id */ - dt_ret->addr_in = oinfo.addr; - dt_ret->id_out = -1; - } /* end if */ - - /* If the requested datatype does not yet exist in the output file, copy it - * anonymously */ - if (dt_ret->id_out < 0) { - if (options->use_native == 1) - dt_ret->id_out = h5tools_get_native_type(type_in); - else - dt_ret->id_out = H5Tcopy(type_in); - if (dt_ret->id_out < 0) - goto done; - if (H5Tcommit_anon(fidout, dt_ret->id_out, H5P_DEFAULT, H5P_DEFAULT) < 0) - goto done; - } /* end if */ - - /* Set return value */ - ret_value = dt_ret->id_out; - - /* Increment the ref count on id_out, because the calling function will try - * to close it */ - if(H5Iinc_ref(ret_value) < 0) { - ret_value = -1; - } - -done: - return (ret_value); -} /* end copy_named_datatype */ - -/*------------------------------------------------------------------------- - * Function: named_datatype_free - * - * Purpose: Frees the stack of named datatypes. - * - * Programmer: Neil Fortner - * - * Date: April 14, 2009 - * - *------------------------------------------------------------------------- - */ -int named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err) { - named_dt_t *dt = *named_dt_head_p; - int ret_value = -1; - - while (dt) { - /* Pop the datatype off the stack and free it */ - if (H5Tclose(dt->id_out) < 0 && !ignore_err) - goto done; - dt = dt->next; - HDfree(*named_dt_head_p); - *named_dt_head_p = dt; - } /* end while */ - - ret_value = 0; - -done: - return (ret_value); -} /* end named_datatype_free */ - -/*------------------------------------------------------------------------- - * Function: copy_attr - * - * Purpose: copy attributes located in LOC_IN, which is obtained either from - * loc_id = H5Gopen2( fid, name); - * loc_id = H5Dopen2( fid, name); - * loc_id = H5Topen2( fid, name); - * - * Return: 0, ok, -1 no - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: October, 28, 2003 - * - *------------------------------------------------------------------------- - */ -int -copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, - trav_table_t *travt, pack_opt_t *options) -{ - int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ - hid_t attr_id = -1; /* attr ID */ - hid_t attr_out = -1; /* attr ID */ - hid_t space_id = -1; /* space ID */ - hid_t ftype_id = -1; /* file type ID */ - hid_t wtype_id = -1; /* read/write type ID */ - size_t msize; /* size of type */ - void *buf = NULL; /* data buffer */ - hsize_t nelmts; /* number of elements in dataset */ - int rank; /* rank of dataset */ - htri_t is_named; /* Whether the datatype is named */ - hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */ - char name[255]; - H5O_info_t oinfo; /* object info */ - int j; - unsigned u; - hbool_t is_ref = 0; - H5T_class_t type_class = -1; - - if (H5Oget_info(loc_in, &oinfo) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info failed"); - - /*------------------------------------------------------------------------- - * copy all attributes - *------------------------------------------------------------------------- - */ - for (u = 0; u < (unsigned) oinfo.num_attrs; u++) { - /* open attribute */ - if ((attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t) u, H5P_DEFAULT, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen_by_idx failed"); - - /* get name */ - if (H5Aget_name(attr_id, (size_t) 255, name) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - - /* get the file datatype */ - if ((ftype_id = H5Aget_type(attr_id)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_type failed"); - - /* Check if the datatype is committed */ - if ((is_named = H5Tcommitted(ftype_id)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tcommitted failed"); - if (is_named && travt) { - hid_t fidout; - - /* Create out file id */ - if ((fidout = H5Iget_file_id(loc_out)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Iget_file_id failed"); - - /* Copy named dt */ - if ((wtype_id = copy_named_datatype(ftype_id, fidout, named_dt_head_p, travt, options)) < 0) { - H5Fclose(fidout); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_named_datatype failed"); - } /* end if */ - - if (H5Fclose(fidout) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fclose failed"); - } /* end if */ - else { - if (options->use_native == 1) - wtype_id = h5tools_get_native_type(ftype_id); - else - wtype_id = H5Tcopy(ftype_id); - } /* end else */ - - /* get the dataspace handle */ - if ((space_id = H5Aget_space(attr_id)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_space failed"); - - /* get dimensions */ - if ((rank = H5Sget_simple_extent_dims(space_id, dims, NULL)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); - - nelmts = 1; - for (j = 0; j < rank; j++) - nelmts *= dims[j]; - - if ((msize = H5Tget_size(wtype_id)) == 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); - - /*------------------------------------------------------------------------- - * object references are a special case. We cannot just copy the buffers, - * but instead we recreate the reference. - * This is done on a second sweep of the file that just copies the referenced - * objects at copy_refs_attr() - *------------------------------------------------------------------------- - */ - type_class = H5Tget_class(wtype_id); - is_ref = (type_class == H5T_REFERENCE); - if (type_class == H5T_VLEN || type_class == H5T_ARRAY) { - hid_t base_type = -1; - - base_type = H5Tget_super(ftype_id); - is_ref = (is_ref || (H5Tget_class(base_type) == H5T_REFERENCE)); - H5Tclose(base_type); - } - - if (type_class == H5T_COMPOUND) { - int nmembers = H5Tget_nmembers(wtype_id); - - for (j = 0; j < nmembers; j++) { - hid_t mtid = H5Tget_member_type(wtype_id, (unsigned) j); - H5T_class_t mtclass = H5Tget_class(mtid); - H5Tclose(mtid); - - if (mtclass == H5T_REFERENCE) { - is_ref = 1; - break; - } - } /* for (j=0; i<nmembers; j++) */ - } /* if (type_class == H5T_COMPOUND) */ - - if (is_ref) { - ; /* handled by copy_refs_attr() */ - } - else { - /*------------------------------------------------------------------------- - * read to memory - *------------------------------------------------------------------------- - */ - - buf = (void *) HDmalloc((size_t)(nelmts * msize)); - if (buf == NULL) { - error_msg("h5repack", "cannot read into memory\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); - } /* end if */ - if (H5Aread(attr_id, wtype_id, buf) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aread failed"); - - /*------------------------------------------------------------------------- - * copy - *------------------------------------------------------------------------- - */ - - if ((attr_out = H5Acreate2(loc_out, name, wtype_id, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Acreate2 failed"); - if (H5Awrite(attr_out, wtype_id, buf) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Awrite failed"); - - /*close*/ - if (H5Aclose(attr_out) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose failed"); - - /* Check if we have VL data and string in the attribute's datatype that must - * be reclaimed */ - if (TRUE == h5tools_detect_vlen(wtype_id)) - H5Dvlen_reclaim(wtype_id, space_id, H5P_DEFAULT, buf); - HDfree(buf); - buf = NULL; - } /*H5T_REFERENCE*/ - - if (options->verbose) - printf(FORMAT_OBJ_ATTR, "attr", name); - - /*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ - - if (H5Tclose(ftype_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); - if (H5Tclose(wtype_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); - if (H5Sclose(space_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); - if (H5Aclose(attr_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose failed"); - } /* u */ - - return 0; - -done: - H5E_BEGIN_TRY { - if (buf) { - /* Check if we have VL data and string in the attribute's datatype that must - * be reclaimed */ - if (TRUE == h5tools_detect_vlen(wtype_id)) - H5Dvlen_reclaim(wtype_id, space_id, H5P_DEFAULT, buf); - - /* Free buf */ - HDfree(buf); - } /* end if */ - - H5Tclose(ftype_id); - H5Tclose(wtype_id); - H5Sclose(space_id); - H5Aclose(attr_id); - H5Aclose(attr_out); - } H5E_END_TRY; - - return ret_value; -} /* end copy_attr() */ - -/*------------------------------------------------------------------------- - * Function: check_options - * - * Purpose: print options, checks for invalid options - * - * Return: void, return -1 on error - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: September, 22, 2003 - * - * Modification: - * Peter Cao, July 9, 2007 - * Add "-L, --latest" and other options to pack a file with the latest file format - * - *------------------------------------------------------------------------- - */ -static int check_options(pack_opt_t *options) { - unsigned int i; - int k, j, has_cp = 0, has_ck = 0; - char slayout[30]; - - /*------------------------------------------------------------------------- - * objects to layout - *------------------------------------------------------------------------- - */ - if (options->verbose && have_request(options) /* only print if requested */) { - printf("Objects to modify layout are...\n"); - if (options->all_layout == 1) { - switch (options->layout_g) { - case H5D_COMPACT: - strcpy(slayout, "compact"); - break; - case H5D_CONTIGUOUS: - strcpy(slayout, "contiguous"); - break; - case H5D_CHUNKED: - strcpy(slayout, "chunked"); - break; - case H5D_VIRTUAL: - strcpy(slayout, "virtual"); - break; - case H5D_LAYOUT_ERROR: - case H5D_NLAYOUTS: - error_msg("invalid layout\n"); - return -1; - default: - strcpy(slayout, "invalid layout\n"); - return -1; - } - printf(" Apply %s layout to all\n", slayout); - if (H5D_CHUNKED == options->layout_g) { - printf("with dimension ["); - for (j = 0; j < options->chunk_g.rank; j++) - printf("%d ", (int) options->chunk_g.chunk_lengths[j]); - printf("]\n"); - } - } - }/* verbose */ - - for (i = 0; i < options->op_tbl->nelems; i++) { - char* name = options->op_tbl->objs[i].path; - - if (options->op_tbl->objs[i].chunk.rank > 0) { - if (options->verbose) { - printf(" <%s> with chunk size ", name); - for (k = 0; k < options->op_tbl->objs[i].chunk.rank; k++) - printf("%d ", - (int) options->op_tbl->objs[i].chunk.chunk_lengths[k]); - printf("\n"); - } - has_ck = 1; - } - else if (options->op_tbl->objs[i].chunk.rank == -2) { - if (options->verbose) - printf(" <%s> %s\n", name, "NONE (contigous)"); - has_ck = 1; - } - } - - if (options->all_layout == 1 && has_ck) { - error_msg( - "invalid chunking input: 'all' option\ - is present with other objects\n"); - return -1; - } - - /*------------------------------------------------------------------------- - * objects to filter - *------------------------------------------------------------------------- - */ - - if (options->verbose && have_request(options) /* only print if requested */) { - printf("Objects to apply filter are...\n"); - if (options->all_filter == 1) { - for (k = 0; k < options->n_filter_g; k++) { - H5Z_filter_t filtn = options->filter_g[k].filtn; - switch (filtn) { - case H5Z_FILTER_NONE: - printf(" Uncompress all\n"); - break; - case H5Z_FILTER_SHUFFLE: - case H5Z_FILTER_FLETCHER32: - printf(" All with %s\n", get_sfilter(filtn)); - break; - case H5Z_FILTER_SZIP: - case H5Z_FILTER_DEFLATE: - printf(" All with %s, parameter %d\n", get_sfilter(filtn), - options->filter_g[k].cd_values[0]); - break; - default: - printf(" User Defined %d\n", filtn); - break; - } /* k */ - }; - } - } /* verbose */ - - for (i = 0; i < options->op_tbl->nelems; i++) { - pack_info_t pack = options->op_tbl->objs[i]; - char* name = pack.path; - - for (j = 0; j < pack.nfilters; j++) { - if (options->verbose) { - printf(" <%s> with %s filter\n", name, - get_sfilter(pack.filter[j].filtn)); - } - - has_cp = 1; - - } /* j */ - } /* i */ - - if (options->all_filter == 1 && has_cp) { - error_msg( - "invalid compression input: 'all' option\ - is present with other objects\n"); - return -1; - } - - /*------------------------------------------------------------------------- - * check options for the latest format - *------------------------------------------------------------------------- - */ - - if (options->grp_compact < 0) { - error_msg( - "invalid maximum number of links to store as header messages\n"); - return -1; - } - if (options->grp_indexed < 0) { - error_msg( - "invalid minimum number of links to store in the indexed format\n"); - return -1; - } - if (options->grp_indexed > options->grp_compact) { - error_msg( - "minimum indexed size is greater than the maximum compact size\n"); - return -1; - } - for (i = 0; i < 8; i++) { - if (options->msg_size[i] < 0) { - error_msg("invalid shared message size\n"); - return -1; - } - } - - /*-------------------------------------------------------------------------------- - * verify new user userblock options; file name must be present - *--------------------------------------------------------------------------------- - */ - if (options->ublock_filename != NULL && options->ublock_size == 0) { - if (options->verbose) { - printf( - "Warning: user block size missing for file %s. Assigning a default size of 1024...\n", - options->ublock_filename); - options->ublock_size = 1024; - } - } - - if (options->ublock_filename == NULL && options->ublock_size != 0) { - error_msg("file name missing for user block\n", - options->ublock_filename); - return -1; - } - - /*-------------------------------------------------------------------------------- - * verify alignment options; threshold is zero default but alignment not - *--------------------------------------------------------------------------------- - */ - - if (options->alignment == 0 && options->threshold != 0) { - error_msg("alignment for H5Pset_alignment missing\n"); - return -1; - } - - return 0; -} - -/*------------------------------------------------------------------------- - * Function: check_objects - * - * Purpose: locate all HDF5 objects in the file and compare with user - * supplied list - * - * Return: 0, ok, -1 no - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: September, 23, 2003 - * - *------------------------------------------------------------------------- - */ -static int check_objects(const char* fname, pack_opt_t *options) { - hid_t fid; - unsigned int i; - trav_table_t *travt = NULL; - - /* nothing to do */ - if (options->op_tbl->nelems == 0) - return 0; - - /*------------------------------------------------------------------------- - * open the file - *------------------------------------------------------------------------- - */ - if ((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, 0)) - < 0) { - printf("<%s>: %s\n", fname, H5FOPENERROR); - return -1; - } - - /*------------------------------------------------------------------------- - * get the list of objects in the file - *------------------------------------------------------------------------- - */ - - /* init table */ - trav_table_init(&travt); - - /* get the list of objects in the file */ - if (h5trav_gettable(fid, travt) < 0) - goto out; - - /*------------------------------------------------------------------------- - * compare with user supplied list - *------------------------------------------------------------------------- - */ - - if (options->verbose) - printf("Opening file <%s>. Searching for objects to modify...\n", - fname); - - for (i = 0; i < options->op_tbl->nelems; i++) { - char* name = options->op_tbl->objs[i].path; - if (options->verbose) - printf(" <%s>", name); - - /* the input object names are present in the file and are valid */ - if (h5trav_getindext(name, travt) < 0) { - error_msg("%s Could not find <%s> in file <%s>. Exiting...\n", - (options->verbose ? "\n" : ""), name, fname); - goto out; - } - if (options->verbose) - printf("...Found\n"); - - /* check for extra filter conditions */ - switch (options->op_tbl->objs[i].filter->filtn) { - /* chunk size must be smaller than pixels per block */ - case H5Z_FILTER_SZIP: - { - int j; - hsize_t csize = 1; - unsigned ppb = options->op_tbl->objs[i].filter->cd_values[0]; - hsize_t dims[H5S_MAX_RANK]; - int rank; - hid_t did; - hid_t sid; - - if (options->op_tbl->objs[i].chunk.rank > 0) { - rank = options->op_tbl->objs[i].chunk.rank; - for (j = 0; j < rank; j++) - csize *= options->op_tbl->objs[i].chunk.chunk_lengths[j]; - } - else { - if ((did = H5Dopen2(fid, name, H5P_DEFAULT)) < 0) - goto out; - if ((sid = H5Dget_space(did)) < 0) - goto out; - if ((rank = H5Sget_simple_extent_ndims(sid)) < 0) - goto out; - HDmemset(dims, 0, sizeof dims); - if (H5Sget_simple_extent_dims(sid, dims, NULL) < 0) - goto out; - for (j = 0; j < rank; j++) - csize *= dims[j]; - if (H5Sclose(sid) < 0) - goto out; - if (H5Dclose(did) < 0) - goto out; - } - - if (csize < ppb) { - printf( - " <warning: SZIP settins, chunk size is smaller than pixels per block>\n"); - goto out; - } - } - break; - default: - break; - } - } /* i */ - - /*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ - H5Fclose(fid); - trav_table_free(travt); - return 0; - -out: - H5Fclose(fid); - trav_table_free(travt); - return -1; -} - -/*------------------------------------------------------------------------- - * Function: have_request - * - * Purpose: check if a filter or layout was requested - * - * Return: 1 yes, 0 no - * - * Date: May, 24, 2007 - * - *------------------------------------------------------------------------- - */ -static int have_request(pack_opt_t *options) { - - if (options->all_filter || options->all_layout || options->op_tbl->nelems) - return 1; - - return 0; - -} - -/*------------------------------------------------------------------------- - * Function: get_sfilter - * - * Purpose: return the filter as a string name - * - * Return: name of filter, exit on error - * - *------------------------------------------------------------------------- - */ - -static const char* get_sfilter(H5Z_filter_t filtn) { - if (filtn == H5Z_FILTER_NONE) - return "NONE"; - else if (filtn == H5Z_FILTER_DEFLATE) - return "GZIP"; - else if (filtn == H5Z_FILTER_SZIP) - return "SZIP"; - else if (filtn == H5Z_FILTER_SHUFFLE) - return "SHUFFLE"; - else if (filtn == H5Z_FILTER_FLETCHER32) - return "FLETCHER32"; - else if (filtn == H5Z_FILTER_NBIT) - return "NBIT"; - else if (filtn == H5Z_FILTER_SCALEOFFSET) - return "SOFF"; - else - return "UD"; -} - diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h deleted file mode 100644 index d2ab923..0000000 --- a/tools/h5repack/h5repack.h +++ /dev/null @@ -1,243 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - -#ifndef H5REPACK_H__ -#define H5REPACK_H__ - -#include "H5private.h" -#include "hdf5.h" -#include "h5trav.h" - -#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 FORMAT_OBJ " %-27s %s\n" /* obj type, name */ -#define FORMAT_OBJ_ATTR " %-27s %s\n" /* obj type, name */ -#define MAX_COMPACT_DSIZE 64512 /* max data size for compact layout. -1k for header size */ - -/*------------------------------------------------------------------------- - * data structures for command line options - *------------------------------------------------------------------------- - */ - -/* a list of names */ -typedef struct { - char obj[MAX_NC_NAME]; -} obj_list_t; - -/* - the type of filter and additional parameter - type can be one of the filters - H5Z_FILTER_NONE 0, uncompress if compressed - H5Z_FILTER_DEFLATE 1 , deflation like gzip - H5Z_FILTER_SHUFFLE 2 , shuffle the data - H5Z_FILTER_FLETCHER32 3 , letcher32 checksum of EDC - H5Z_FILTER_SZIP 4 , szip compression - H5Z_FILTER_NBIT 5 , nbit compression - H5Z_FILTER_SCALEOFFSET 6 , scaleoffset compression -*/ - -#define CD_VALUES 20 - -typedef struct { - H5Z_filter_t filtn; /* filter identification number */ - unsigned cd_values[CD_VALUES]; /* filter client data values */ - size_t cd_nelmts; /* filter client number of values */ -} filter_info_t; - -/* chunk lengths along each dimension and rank */ -typedef struct { - hsize_t chunk_lengths[MAX_VAR_DIMS]; - int rank; -} chunk_info_t; - -/* we currently define a maximum value for the filters array, - that corresponds to the current library filters */ -#define H5_REPACK_MAX_NFILTERS 6 - -/* information for one object, contains PATH, CHUNK info and FILTER info */ -typedef struct { - char path[MAX_NC_NAME]; /* name of object */ - filter_info_t filter[H5_REPACK_MAX_NFILTERS]; /* filter array */ - int nfilters; /* current number of filters */ - H5D_layout_t layout; /* layout information */ - chunk_info_t chunk; /* chunk information */ - hid_t refobj_id; /* object ID, references */ -} pack_info_t; - -/* store a table of all objects */ -typedef struct { - unsigned int size; - unsigned int nelems; - pack_info_t *objs; -} pack_opttbl_t; - - -/*------------------------------------------------------------------------- - * command line options - *------------------------------------------------------------------------- - */ - -/* all the above, ready to go to the hrepack call */ -typedef struct { - pack_opttbl_t *op_tbl; /*table with all -c and -f options */ - int all_layout; /*apply the layout to all objects */ - int all_filter; /*apply the filter to all objects */ - filter_info_t filter_g[H5_REPACK_MAX_NFILTERS]; /*global filter array for the ALL case */ - int n_filter_g; /*number of global filters */ - chunk_info_t chunk_g; /*global chunk INFO for the ALL case */ - H5D_layout_t layout_g; /*global layout information for the ALL case */ - int verbose; /*verbose mode */ - hsize_t min_comp; /*minimum size to compress, in bytes */ - int use_native; /*use a native type in write */ - hbool_t latest; /*pack file with the latest file format */ - int grp_compact; /* Set the maximum number of links to store as header messages in the group */ - int grp_indexed; /* Set the minimum number of links to store in the indexed format */ - int msg_size[8]; /* Minimum size of shared messages: dataspace, - datatype, fill value, filter pipleline, attribute */ - const char *ublock_filename; /* user block file name */ - hsize_t ublock_size; /* user block size */ - hsize_t meta_block_size; /* metadata aggregation block size (for H5Pset_meta_block_size) */ - hsize_t threshold; /* alignment threshold for H5Pset_alignment */ - hsize_t alignment; /* alignment for H5Pset_alignment */ - H5F_file_space_type_t fs_strategy; /* File space handling strategy */ - hsize_t fs_threshold; /* Free space section threshold */ -} pack_opt_t; - - -typedef struct named_dt_t { - haddr_t addr_in; /* Address of the named dtype in the in file */ - hid_t id_out; /* Open identifier for the dtype in the out file */ - struct named_dt_t *next; /* Next dtype */ -} named_dt_t; - -/*------------------------------------------------------------------------- - * public functions - *------------------------------------------------------------------------- - */ - -#ifdef __cplusplus -extern "C" { -#endif - -int h5repack(const char* infile, const char* outfile, pack_opt_t *options); -int h5repack_addfilter(const char* str, pack_opt_t *options); -int h5repack_addlayout(const char* str, pack_opt_t *options); -int h5repack_init(pack_opt_t *options, int verbose, hbool_t latest, - H5F_file_space_type_t strategy, hsize_t threshold); -int h5repack_end(pack_opt_t *options); -int h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options); -int h5repack_cmp_pl(const char *fname1, const char *fname2); - -/* Note: The below copy_named_datatype(), named_datatype_free(), copy_attr() - * and struct named_dt_t were located in h5repack_copy.c as static prior to - * bugfix1726. - * Made shared functions as copy_attr() was needed in h5repack_refs.c. - * However copy_attr() may be obsoleted when H5Acopy is available and put back - * others to static in h5repack_copy.c. - */ -hid_t copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, trav_table_t *travt, pack_opt_t *options); -int named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err); -int copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, - trav_table_t *travt, pack_opt_t *options); - -#ifdef __cplusplus -} -#endif - - - -/*------------------------------------------------------------------------- - * private functions - *------------------------------------------------------------------------- - */ - - -/*------------------------------------------------------------------------- - * copy module - *------------------------------------------------------------------------- - */ - -int copy_objects (const char* fnamein, - const char* fnameout, - pack_opt_t *options); - -int do_copy_refobjs(hid_t fidin, - hid_t fidout, - trav_table_t *travt, - pack_opt_t *options); - -/*------------------------------------------------------------------------- - * filters and verify module - *------------------------------------------------------------------------- - */ -void init_packobject(pack_info_t *obj); - - -/*------------------------------------------------------------------------- - * filters and copy module - *------------------------------------------------------------------------- - */ - -int apply_filters(const char* name, /* object name from traverse list */ - int rank, /* rank of dataset */ - hsize_t *dims, /* dimensions of dataset */ - size_t msize, /* size of type */ - hid_t dcpl_id, /* dataset creation property list */ - pack_opt_t *options, /* repack options */ - int *has_filter); /* (OUT) object NAME has a filter */ - - -/*------------------------------------------------------------------------- - * options table - *------------------------------------------------------------------------- - */ -int options_table_init( pack_opttbl_t **tbl ); -int options_table_free( pack_opttbl_t *table ); -int options_add_layout( obj_list_t *obj_list, - unsigned n_objs, - pack_info_t *pack, - pack_opttbl_t *table ); -int options_add_filter ( obj_list_t *obj_list, - unsigned n_objs, - filter_info_t filt, - pack_opttbl_t *table ); -pack_info_t* options_get_object( const char *path, - pack_opttbl_t *table); - -/*------------------------------------------------------------------------- - * parse functions - *------------------------------------------------------------------------- - */ - -obj_list_t* parse_filter(const char *str, - unsigned *n_objs, - filter_info_t *filt, - pack_opt_t *options, - int *is_glb); - -obj_list_t* parse_layout(const char *str, - unsigned *n_objs, - pack_info_t *pack, /* info about object */ - pack_opt_t *options); - - - - -#endif /* H5REPACK_H__ */ - diff --git a/tools/h5repack/h5repack.sh.in b/tools/h5repack/h5repack.sh.in deleted file mode 100644 index c2f0459..0000000 --- a/tools/h5repack/h5repack.sh.in +++ /dev/null @@ -1,1265 +0,0 @@ -#! /bin/sh -# -# Copyright by The HDF Group. -# Copyright by the Board of Trustees of the University of Illinois. -# All rights reserved. -# -# This file is part of HDF5. The full HDF5 copyright notice, including -# terms governing use, modification, and redistribution, is contained in -# the files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic HDF5 document set and -# is linked from the top-level documents page. It can also be found at -# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have -# access to either file, you may request a copy from help@hdfgroup.org. -# -# Tests for the h5repack tool -# -# Modification: -# Pedro Vicente Nunes, 11/15/2006 -# Added $FILEN variables for file names -# - -srcdir=@srcdir@ - -USE_FILTER_SZIP="@USE_FILTER_SZIP@" -USE_FILTER_DEFLATE="@USE_FILTER_DEFLATE@" - -TESTNAME=h5repack -EXIT_SUCCESS=0 -EXIT_FAILURE=1 - -H5REPACK=h5repack # The tool name -H5REPACK_BIN=`pwd`/$H5REPACK # The path of the tool binary - -H5DIFF=../h5diff/h5diff # The h5diff tool name -H5DIFF_BIN=`pwd`/$H5DIFF # The path of the h5diff tool binary - -H5DUMP=../h5dump/h5dump # The h5dump tool name -H5DUMP_BIN=`pwd`/$H5DUMP # The path of the h5dump tool binary - -RM='rm -rf' -CMP='cmp' -DIFF='diff -c' -GREP='grep' -CP='cp' -DIRNAME='dirname' -LS='ls' -AWK='awk' - -H5DETECTSZIP=testh5repack_detect_szip -H5DETECTSZIP_BIN=`pwd`/$H5DETECTSZIP - - -nerrors=0 -verbose=yes - -# source dirs -SRC_TOOLS="$srcdir/.." -SRC_TOOLS_TESTFILES="$SRC_TOOLS/testfiles" - -# testfiles source dirs for tools -SRC_H5LS_TESTFILES="$SRC_TOOLS_TESTFILES" -SRC_H5DUMP_TESTFILES="$SRC_TOOLS_TESTFILES" -SRC_H5DIFF_TESTFILES="$SRC_TOOLS/h5diff/testfiles" -SRC_H5COPY_TESTFILES="$SRC_TOOLS/h5copy/testfiles" -SRC_H5REPACK_TESTFILES="$SRC_TOOLS/h5repack/testfiles" -SRC_H5JAM_TESTFILES="$SRC_TOOLS/h5jam/testfiles" -SRC_H5STAT_TESTFILES="$SRC_TOOLS/h5stat/testfiles" -SRC_H5IMPORT_TESTFILES="$SRC_TOOLS/h5import/testfiles" - -TESTDIR=./testpack -test -d $TESTDIR || mkdir $TESTDIR - -###################################################################### -# test files -# -------------------------------------------------------------------- -# All the test files copy from source directory to test directory -# NOTE: Keep this framework to add/remove test files. -# Any test files from other tools can be used in this framework. -# This list are also used for checking exist. -# Comment '#' without space can be used. -# -------------------------------------------------------------------- -LIST_HDF5_TEST_FILES=" -$SRC_H5REPACK_TESTFILES/h5repack_attr.h5 -$SRC_H5REPACK_TESTFILES/h5repack_attr_refs.h5 -$SRC_H5REPACK_TESTFILES/h5repack_deflate.h5 -$SRC_H5REPACK_TESTFILES/h5repack_early.h5 -$SRC_H5REPACK_TESTFILES/h5repack_ext.h5 -$SRC_H5REPACK_TESTFILES/h5repack_fill.h5 -$SRC_H5REPACK_TESTFILES/h5repack_filters.h5 -$SRC_H5REPACK_TESTFILES/h5repack_fletcher.h5 -$SRC_H5REPACK_TESTFILES/h5repack_hlink.h5 -$SRC_H5REPACK_TESTFILES/h5repack_layout.h5 -$SRC_H5REPACK_TESTFILES/h5repack_layouto.h5 -$SRC_H5REPACK_TESTFILES/h5repack_layout2.h5 -$SRC_H5REPACK_TESTFILES/h5repack_layout3.h5 -$SRC_H5REPACK_TESTFILES/h5repack_named_dtypes.h5 -$SRC_H5REPACK_TESTFILES/h5repack_nested_8bit_enum.h5 -$SRC_H5REPACK_TESTFILES/h5repack_nested_8bit_enum_deflated.h5 -$SRC_H5REPACK_TESTFILES/h5repack_nbit.h5 -$SRC_H5REPACK_TESTFILES/h5repack_objs.h5 -$SRC_H5REPACK_TESTFILES/h5repack_refs.h5 -$SRC_H5REPACK_TESTFILES/h5repack_shuffle.h5 -$SRC_H5REPACK_TESTFILES/h5repack_soffset.h5 -$SRC_H5REPACK_TESTFILES/h5repack_szip.h5 -$SRC_H5DIFF_TESTFILES/h5diff_attr1.h5 -$SRC_TOOLS_TESTFILES/tfamily00000.h5 -$SRC_TOOLS_TESTFILES/tfamily00001.h5 -$SRC_TOOLS_TESTFILES/tfamily00002.h5 -$SRC_TOOLS_TESTFILES/tfamily00003.h5 -$SRC_TOOLS_TESTFILES/tfamily00004.h5 -$SRC_TOOLS_TESTFILES/tfamily00005.h5 -$SRC_TOOLS_TESTFILES/tfamily00006.h5 -$SRC_TOOLS_TESTFILES/tfamily00007.h5 -$SRC_TOOLS_TESTFILES/tfamily00008.h5 -$SRC_TOOLS_TESTFILES/tfamily00009.h5 -$SRC_TOOLS_TESTFILES/tfamily00010.h5 -$SRC_TOOLS_TESTFILES/vds/1_a.h5 -$SRC_TOOLS_TESTFILES/vds/1_b.h5 -$SRC_TOOLS_TESTFILES/vds/1_c.h5 -$SRC_TOOLS_TESTFILES/vds/1_d.h5 -$SRC_TOOLS_TESTFILES/vds/1_e.h5 -$SRC_TOOLS_TESTFILES/vds/1_f.h5 -$SRC_TOOLS_TESTFILES/vds/1_vds.h5 -$SRC_TOOLS_TESTFILES/vds/2_a.h5 -$SRC_TOOLS_TESTFILES/vds/2_b.h5 -$SRC_TOOLS_TESTFILES/vds/2_c.h5 -$SRC_TOOLS_TESTFILES/vds/2_d.h5 -$SRC_TOOLS_TESTFILES/vds/2_e.h5 -$SRC_TOOLS_TESTFILES/vds/2_vds.h5 -$SRC_TOOLS_TESTFILES/vds/3_1_vds.h5 -$SRC_TOOLS_TESTFILES/vds/3_2_vds.h5 -$SRC_TOOLS_TESTFILES/vds/4_0.h5 -$SRC_TOOLS_TESTFILES/vds/4_1.h5 -$SRC_TOOLS_TESTFILES/vds/4_2.h5 -$SRC_TOOLS_TESTFILES/vds/4_vds.h5 -$SRC_TOOLS_TESTFILES/vds/5_a.h5 -$SRC_TOOLS_TESTFILES/vds/5_b.h5 -$SRC_TOOLS_TESTFILES/vds/5_c.h5 -$SRC_TOOLS_TESTFILES/vds/5_vds.h5 -" - -LIST_OTHER_TEST_FILES=" -$SRC_H5REPACK_TESTFILES/h5repack-help.txt -$SRC_H5REPACK_TESTFILES/h5repack_ext.bin -$SRC_H5REPACK_TESTFILES/ublock.bin -$SRC_H5REPACK_TESTFILES/h5repack.info -$SRC_H5REPACK_TESTFILES/deflate_limit.h5repack_layout.h5.ddl -$SRC_H5REPACK_TESTFILES/h5repack_layout.h5.ddl -$SRC_H5REPACK_TESTFILES/h5repack_filters.h5-gzip_verbose_filters.tst -$SRC_H5REPACK_TESTFILES/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst -$SRC_H5REPACK_TESTFILES/h5repack_layout.h5-plugin_test.ddl -$SRC_H5REPACK_TESTFILES/plugin_test.h5repack_layout.h5.tst -$SRC_H5REPACK_TESTFILES/1_vds.h5-vds_dset_chunk20x10x5-v.ddl -$SRC_H5REPACK_TESTFILES/2_vds.h5-vds_chunk3x6x9-v.ddl -$SRC_H5REPACK_TESTFILES/3_1_vds.h5-vds_chunk2x5x8-v.ddl -$SRC_H5REPACK_TESTFILES/4_vds.h5-vds_compa-v.ddl -$SRC_H5REPACK_TESTFILES/4_vds.h5-vds_conti-v.ddl -" - -# -# copy test files and expected output files from source dirs to test dir -# -COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_OTHER_TEST_FILES" - -COPY_TESTFILES_TO_TESTDIR() -{ - # copy test files. Used -f to make sure get a new copy - for tstfile in $COPY_TESTFILES - do - # ignore '#' comment - echo $tstfile | tr -d ' ' | grep '^#' > /dev/null - RET=$? - if [ $RET -eq 1 ]; then - # skip cp if srcdir is same as destdir - # this occurs when build/test performed in source dir and - # make cp fail - SDIR=`$DIRNAME $tstfile` - INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` - if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $CP -f $tstfile $TESTDIR - if [ $? -ne 0 ]; then - echo "Error: FAILED to copy $tstfile ." - - # Comment out this to CREATE expected file - exit $EXIT_FAILURE - fi - fi - fi - done -} - -CLEAN_TESTFILES_AND_TESTDIR() -{ - # skip rm if srcdir is same as destdir - # this occurs when build/test performed in source dir and - # make cp fail - SDIR=$SRC_H5REPACK_TESTFILES - INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` - if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $RM $TESTDIR - fi -} - -# Print a $* message left justified in a field of 70 characters -# -MESSAGE() { - SPACES=" " - echo "$* $SPACES" | cut -c1-70 | tr -d '\012' -} - -# Print a line-line message left justified in a field of 70 characters -# beginning with the word "Testing". -# -TESTING() { - MESSAGE "Testing $*" -} - -# Print a line-line message left justified in a field of 70 characters -# beginning with the word "Verifying". -# -VERIFY() { - MESSAGE "Verifying $*" -} - -# Print a message that a test has been skipped (because a required filter -# was unavailable) -SKIP() { - TESTING $H5REPACK $@ - echo " -SKIP-" -} - -# Call the h5diff tool -# -DIFFTEST() -{ - VERIFY h5diff output $@ - ( - cd $TESTDIR - $RUNSERIAL $H5DIFF_BIN -q "$@" - ) - RET=$? - if [ $RET != 0 ] ; then - echo "*FAILED*" - nerrors="`expr $nerrors + 1`" - else - echo " PASSED" - fi - -} - -# Call h5repack -# - - -# call TOOLTEST_MAIN and delete $output file -TOOLTEST() -{ - echo $@ - infile=$2 - outfile=out-$1.$2 - shift - shift - - # Run test. - TESTING $H5REPACK $@ - ( - cd $TESTDIR - $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile - ) - RET=$? - if [ $RET != 0 ] ; then - echo "*FAILED*" - nerrors="`expr $nerrors + 1`" - else - echo " PASSED" - DIFFTEST $infile $outfile - fi - rm -f $outfile -} - -#------------------------------------------ -# Verifying layouts of a dataset -VERIFY_LAYOUT_DSET() -{ - layoutfile=layout-$1.$2 - dset=$3 - expectlayout=$4 - infile=$2 - outfile=out-$1.$2 - shift - shift - shift - shift - - TESTING $H5REPACK $@ - ( - cd $TESTDIR - $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile - ) - RET=$? - if [ $RET != 0 ] ; then - echo "*FAILED*" - nerrors="`expr $nerrors + 1`" - else - echo " PASSED" - DIFFTEST $infile $outfile - fi - - #--------------------------------- - # check the layout from a dataset - VERIFY "a dataset layout" - ( - cd $TESTDIR - $RUNSERIAL $H5DUMP_BIN -d $dset -pH $outfile > $layoutfile - ) - $GREP $expectlayout $TESTDIR/$layoutfile > /dev/null - if [ $? -eq 0 ]; then - echo " PASSED" - else - echo " FAILED" - nerrors="`expr $nerrors + 1`" - fi - - # clean up tmp files - rm -f $outfile - rm -f $layoutfile -} - -#------------------------------------------ -# Verifying layouts of a dataset -VERIFY_LAYOUT_VDS() -{ - layoutfile=layout-$1.$2 - dset=$3 - expectlayout=$4 - infile=$2 - outfile=out-$1.$2 - - expect="$TESTDIR/$2-$1-v.ddl" - actual="$TESTDIR/$2-$1-v.out" - actual_err="$TESTDIR/$2-$1-v.err" - - shift - shift - shift - shift - - TESTING $H5REPACK $@ - ( - cd $TESTDIR - $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile - ) - RET=$? - if [ $RET != 0 ] ; then - echo "*FAILED*" - nerrors="`expr $nerrors + 1`" - else - echo " PASSED" - fi - - #--------------------------------- - # check the layout from a dataset - VERIFY "a dataset layout" - ( - cd $TESTDIR - $RUNSERIAL $H5DUMP_BIN -d $dset -p $outfile - ) >$actual 2>$actual_err - - cat $actual_err >> $actual - - if [ ! -f $expect ]; then - # Create the expect file if it doesn't yet exist. - echo " CREATED" - cp $actual $expect - elif $CMP $expect $actual > /dev/null 2>&1 ; then - echo " PASSED" - else - echo "*FAILED*" - echo " Expected result (*.ddl) differs from actual result (*.out)" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $caseless $expect $actual |sed 's/^/ /' - fi - - # Clean up output file - if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err - fi - - # clean up tmp files - rm -f $outfile -} - -#---------------------------------------- -# Verifying layouts from entire file -VERIFY_LAYOUT_ALL() -{ - infile=$2 - outfile=out-$1.$2 - layoutfile=layout-$1.$2 - expectlayout=$3 - shift - shift - shift - - TESTING $H5REPACK $@ - ( - cd $TESTDIR - $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile - ) - RET=$? - if [ $RET != 0 ] ; then - echo "*FAILED*" - nerrors="`expr $nerrors + 1`" - else - echo " PASSED" - DIFFTEST $infile $outfile - fi - - - #--------------------------------- - # check the layout from a dataset - # check if the other layouts still exsit - VERIFY "layouts" - ( - cd $TESTDIR - echo - # if CONTIGUOUS - if [ $expectlayout = "CONTIGUOUS" ]; then - TESTING $H5DUMP_BIN -pH $outfile - ( - $RUNSERIAL $H5DUMP_BIN -pH $outfile > $layoutfile - ) - $GREP "COMPACT" $layoutfile > /dev/null - if [ $? -eq 0 ]; then - echo " FAILED" - nerrors="`expr $nerrors + 1`" - else - $GREP "CHUNKED" $layoutfile > /dev/null - if [ $? -eq 0 ]; then - echo " FAILED" - nerrors="`expr $nerrors + 1`" - else - echo " PASSED" - fi - fi - else - # if COMPACT - if [ $expectlayout = "COMPACT" ]; then - TESTING $H5DUMP_BIN -pH $outfile - ( - $RUNSERIAL $H5DUMP_BIN -pH $outfile > $layoutfile - ) - $GREP "CHUNKED" $layoutfile > /dev/null - if [ $? -eq 0 ]; then - echo " FAILED" - nerrors="`expr $nerrors + 1`" - else - $GREP "CONTIGUOUS" $layoutfile > /dev/null - if [ $? -eq 0 ]; then - echo " FAILED" - nerrors="`expr $nerrors + 1`" - else - echo " PASSED" - fi - fi - else - # if CHUNKED - if [ $expectlayout = "CHUNKED" ]; then - TESTING $H5DUMP_BIN -pH $outfile - ( - $RUNSERIAL $H5DUMP_BIN -pH $outfile > $layoutfile - ) - $GREP "CONTIGUOUS" $layoutfile > /dev/null - if [ $? -eq 0 ]; then - echo " FAILED" - nerrors="`expr $nerrors + 1`" - else - $GREP "COMPACT" $layoutfile > /dev/null - if [ $? -eq 0 ]; then - echo " FAILED" - nerrors="`expr $nerrors + 1`" - else - echo " PASSED" - fi - fi - fi - fi - fi - ) - - # clean up tmp files - rm -f $outfile - rm -f $layoutfile -} - -# same as TOOLTEST, but it uses the old syntax -i input_file -o output_file -# -TOOLTEST0() -{ - infile=$2 - outfile=out-$1.$2 - shift - shift - - # Run test. - TESTING $H5REPACK $@ - ( - cd $TESTDIR - $RUNSERIAL $H5REPACK_BIN -i $infile -o $outfile "$@" - ) - RET=$? - if [ $RET != 0 ] ; then - echo "*FAILED*" - nerrors="`expr $nerrors + 1`" - else - echo " PASSED" - DIFFTEST $infile $outfile - fi - rm -f $outfile -} - - -# same as TOOLTEST, but it uses without -i -o options -# used to test the family driver, where these files reside -# -TOOLTEST1() -{ - infile=$2 - outfile=out-$1.$2 - shift - shift - - # Run test. - TESTING $H5REPACK $@ - ( - cd $TESTDIR - $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile - ) - RET=$? - if [ $RET != 0 ] ; then - echo "*FAILED*" - nerrors="`expr $nerrors + 1`" - else - echo " PASSED" - DIFFTEST $infile $outfile - fi - rm -f $outfile -} - -# This is same as TOOLTEST() with comparing display output -# from -v option -# -TOOLTESTV() -{ - expect="$TESTDIR/$2-$1.tst" - actual="$TESTDIR/`basename $2 .ddl`.out" - actual_err="$TESTDIR/`basename $2 .ddl`.err" - - infile=$2 - outfile=out-$1.$2 - shift - shift - - # Run test. - TESTING $H5REPACK $@ - ( - cd $TESTDIR - $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile - ) >$actual 2>$actual_err - RET=$? - if [ $RET != 0 ] ; then - echo "*FAILED*" - nerrors="`expr $nerrors + 1`" - else - echo " PASSED" - DIFFTEST $infile $outfile - fi - - # display output compare - STDOUT_FILTER $actual - cat $actual_err >> $actual - - VERIFY output from $H5REPACK $@ - if cmp -s $expect $actual; then - echo " PASSED" - else - echo "*FAILED*" - echo " Expected result (*.tst) differs from actual result (*.out)" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && diff -c $expect $actual |sed 's/^/ /' - fi - - rm -f $actual $actual_err - rm -f $outfile -} - -# same as TOOLTESTV but filters error stack output and compares to an error file -# Extract file name, line number, version and thread IDs because they may be different -# ADD_H5ERR_MASK_TEST -TOOLTESTM() { - - expect="$TESTDIR/$2-$1.tst" - actual="$TESTDIR/`basename $2 .tst`.out" - actual_err="$TESTDIR/`basename $2 .tst`.oerr" - actual_sav=${actual}-sav - actual_err_sav=${actual_err}-sav - - infile=$2 - outfile=out-$1.$2 - shift - shift - - # Run test. - TESTING $H5REPACK $@ - ( - cd $TESTDIR - $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile - ) >$actual 2>$actual_err - - # save actual and actual_err in case they are needed later. - cp $actual $actual_sav - cp $actual_err $actual_err_sav - - # Extract file name, line number, version and thread IDs because they may be different - sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ - -e 's/line [0-9]*/line (number)/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ - -e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \ - -e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \ - $actual_err > $actual - - if [ ! -f $expect ]; then - # Create the expect file if it doesn't yet exist. - echo " CREATED" - cp $actual $expect - elif $CMP $expect $actual; then - echo " PASSED" - else - echo "*FAILED*" - echo " Expected result (*.tst) differs from actual result (*.out)" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' - fi - - # Clean up output file - if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err $actual_sav $actual_err_sav - fi - -} - -# This is same as TOOLTESTV() with comparing h5dump output -# from -pH option -# -TOOLTEST_DUMP() -{ - infile=$2 - outfile=out-$1.$2 - expect="$TESTDIR/$1.$2.ddl" - actual="$TESTDIR/out-$1.$2.out" - actual_err="$TESTDIR/out-$1.$2.err" - - shift - shift - - # Run test. - TESTING $H5REPACK $@ - ( - cd $TESTDIR - $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile - ) >$actual 2>$actual_err - RET=$? - if [ $RET != 0 ] ; then - echo "*FAILED*" - nerrors="`expr $nerrors + 1`" - else - echo " PASSED" - VERIFY h5dump output $@ - ( - cd $TESTDIR - $RUNSERIAL $H5DUMP_BIN -pH $outfile - ) >$actual 2>$actual_err - cat $actual_err >> $actual - - RET=$? - - fi - - if cmp -s $expect $actual; then - echo " PASSED" - else - echo "*FAILED*" - echo " Expected result (*.ddl) differs from actual result (*.out)" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && diff -c $expect $actual |sed 's/^/ /' - fi - - rm -f $actual $actual_err - rm -f $outfile -} - -# TOOLTEST_META: -# Test metadata block size option. -# Reason to create a function here is to localize all special steps related to -# metadata block size option in one place. This is a quick solution. More -# thought out solution needed when there is more time. -# -# $1: test input file -# $2:$: metadata options (either "-M size" or "--metadata_block_size=size") -# -# Algorithm: -# Run it once without the metadata option ($2-$); -# Save the result output file; -# Run it second time with the metadata option; -# Verify the output file of second run is larger than the one of 1st run. -TOOLTEST_META() -{ - infile=$2 - outfile=out-$1.$2 - shift - shift - - # Run test. - TESTING $H5REPACK $@ - ( - cd $TESTDIR - $RUNSERIAL $H5REPACK_BIN $infile $outfile - ) - RET=$? - if [ $RET != 0 ] ; then - echo "*FAILED*" - nerrors="`expr $nerrors + 1`" - else - echo " PASSED" - DIFFTEST $infile $outfile - fi - # get the size of the first output file - size1=`wc -c $TESTDIR/$outfile | cut -d' ' -f1` - - # 2nd run with metadata option - # Run test. - TESTING $H5REPACK $@ - ( - cd $TESTDIR - $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile - ) - RET=$? - if [ $RET != 0 ] ; then - echo "*FAILED*" - nerrors="`expr $nerrors + 1`" - else - echo " PASSED" - DIFFTEST $infile $outfile - fi - # get the size of the second output file - size2=`wc -c $TESTDIR/$outfile | cut -d' ' -f1` - - # verify sizes. - MESSAGE "Verify the sizes of both output files ($size1 vs $size2)" - if [ $size1 -lt $size2 ]; then - # pass - echo " PASSED" - else - #fail - echo "*FAILED*" - nerrors="`expr $nerrors + 1`" - fi - - rm -f $outfile -} - -# ADD_HELP_TEST -TOOLTEST_HELP() { - - expect="$TESTDIR/$1" - actual="$TESTDIR/`basename $1 .txt`.out" - actual_err="$TESTDIR/`basename $1 .txt`.err" - shift - - # Run test. - TESTING $H5REPACK $@ - ( - cd $TESTDIR - $RUNSERIAL $H5REPACK_BIN "$@" - ) >$actual 2>$actual_err - cat $actual_err >> $actual - - if [ ! -f $expect ]; then - # Create the expect data file if it doesn't yet exist. - echo " CREATED" - cp $actual $expect-CREATED - elif cmp -s $expect $actual; then - echo " PASSED" - else - echo "*FAILED*" - echo " Expected output (*.txt) differs from actual output (*.out)" - nerrors="`expr $nerrors + 1`" - fi - - # Clean up output file - if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err - fi - -} - -# This is different from $srcdir/../../bin/output_filter.sh -STDOUT_FILTER() { - result_file=$1 - tmp_file=/tmp/h5test_tmp_$$ - # Filter name of files. - cp $result_file $tmp_file - sed -e '/^Opening file/d' -e '/^Making file/d' \ - < $tmp_file > $result_file - # cleanup - rm -f $tmp_file -} - -# -# The tests -# We use the files generated by h5repacktst -# Each run generates "<file>.out.h5" and the tool h5diff is used to -# compare the input and output files -# -# the tests are the same as the program h5repacktst, but run from the CLI -# - -# See which filters are usable (and skip tests for filters we -# don't have). Do this by searching H5pubconf.h to see which -# filters are defined. - -# detect whether the encoder is present. -USE_FILTER_SZIP_ENCODER="no"; -if test $USE_FILTER_SZIP = "yes"; then -USE_FILTER_SZIP_ENCODER=`$RUNSERIAL $H5DETECTSZIP_BIN` -fi - -############################################################################## -### T H E T E S T S -############################################################################## -# prepare for test -COPY_TESTFILES_TO_TESTDIR - -TOOLTEST_HELP h5repack-help.txt -h - -# copy files (these files have no filters) -TOOLTEST fill h5repack_fill.h5 -TOOLTEST objs h5repack_objs.h5 -TOOLTEST attr h5repack_attr.h5 -TOOLTEST hlink h5repack_hlink.h5 -TOOLTEST layout h5repack_layout.h5 -TOOLTEST early h5repack_early.h5 - -# nested 8bit enum in both deflated and non-deflated datafiles -if [ $USE_FILTER_DEFLATE != "yes" ]; then -TOOLTEST nested_8bit_enum h5repack_nested_8bit_enum.h5 -else -TOOLTEST nested_8bit_enum h5repack_nested_8bit_enum_deflated.h5 -fi - -# use h5repack_layout.h5 to write some filters (this file has no filters) - -# gzip with individual object -arg="h5repack_layout.h5 -f dset1:GZIP=1 -l dset1:CHUNK=20x10" -if test $USE_FILTER_DEFLATE != "yes" ; then - SKIP $arg -else - TOOLTEST gzip_individual $arg -fi - -# gzip for all -arg="h5repack_layout.h5 -f GZIP=1" -if test $USE_FILTER_DEFLATE != "yes" ; then - SKIP $arg -else - TOOLTEST gzip_all $arg -fi - -# szip with individual object -arg="h5repack_layout.h5 -f dset2:SZIP=8,EC -l dset2:CHUNK=20x10" -if test $USE_FILTER_SZIP_ENCODER != "yes" -o $USE_FILTER_SZIP != "yes" ; then - SKIP $arg -else - TOOLTEST szip_individual $arg -fi - -# szip for all -arg="h5repack_layout.h5 -f SZIP=8,NN" -if test $USE_FILTER_SZIP_ENCODER != "yes" -o $USE_FILTER_SZIP != "yes" ; then - SKIP $arg -else - TOOLTEST szip_all $arg -fi - -# shuffle with individual object -arg="h5repack_layout.h5 -f dset2:SHUF -l dset2:CHUNK=20x10" -TOOLTEST shuffle_individual $arg - - -# shuffle for all -arg="h5repack_layout.h5 -f SHUF" -TOOLTEST shuffle_all $arg - -# fletcher32 with individual object -arg="h5repack_layout.h5 -f dset2:FLET -l dset2:CHUNK=20x10" -TOOLTEST fletcher_individual $arg - -# fletcher32 for all -arg="h5repack_layout.h5 -f FLET" -TOOLTEST fletcher_all $arg - -# all filters -arg="h5repack_layout.h5 -f dset2:SHUF -f dset2:FLET -f dset2:SZIP=8,NN -f dset2:GZIP=1 -l dset2:CHUNK=20x10" -if test $USE_FILTER_SZIP_ENCODER != "yes" -o $USE_FILTER_SZIP != "yes" -o $USE_FILTER_DEFLATE != "yes" ; then - SKIP $arg -else - TOOLTEST all_filters $arg -fi - -# verbose gzip with individual object -arg="h5repack_filters.h5 -v -f /dset_deflate:GZIP=9" -if test $USE_FILTER_DEFLATE != "yes" ; then - SKIP $arg -else - # compare output - TOOLTESTV gzip_verbose_filters $arg -fi - -########################################################### -# the following tests assume the input files have filters -########################################################### - -# szip copy -arg="h5repack_szip.h5" -if test $USE_FILTER_SZIP_ENCODER != "yes" -o $USE_FILTER_SZIP != "yes" ; then - SKIP $arg -else - TOOLTEST szip_copy $arg -fi - -# szip remove -arg="h5repack_szip.h5 --filter=dset_szip:NONE" -if test $USE_FILTER_SZIP_ENCODER != "yes" -o $USE_FILTER_SZIP != "yes" ; then - SKIP $arg -else - TOOLTEST szip_remove $arg -fi - -# deflate copy -arg="h5repack_deflate.h5" -if test $USE_FILTER_DEFLATE != "yes" ; then - SKIP $arg -else - TOOLTEST deflate_copy $arg -fi - -# deflate remove -arg="h5repack_deflate.h5 -f dset_deflate:NONE" -if test $USE_FILTER_DEFLATE != "yes" ; then - SKIP $arg -else - TOOLTEST deflate_remove $arg -fi - -# shuffle copy -arg="h5repack_shuffle.h5" -TOOLTEST shuffle_copy $arg - -# shuffle remove -arg="h5repack_shuffle.h5 -f dset_shuffle:NONE" -TOOLTEST shuffle_remove $arg - -# fletcher32 copy -arg="h5repack_fletcher.h5" -TOOLTEST fletcher_copy $arg - -# fletcher32 remove -arg="h5repack_fletcher.h5 -f dset_fletcher32:NONE" -TOOLTEST fletcher_remove $arg - -# nbit copy -arg="h5repack_nbit.h5" -TOOLTEST nbit_copy $arg - -# nbit remove -arg="h5repack_nbit.h5 -f dset_nbit:NONE" -TOOLTEST nbit_remove $arg - -# nbit add -arg="h5repack_nbit.h5 -f dset_int31:NBIT" -TOOLTEST nbit_add $arg - -# scaleoffset copy -arg="h5repack_soffset.h5" -TOOLTEST scale_copy $arg - -# scaleoffset add -arg="h5repack_soffset.h5 -f dset_none:SOFF=31,IN" -TOOLTEST scale_add $arg - -# scaleoffset remove -arg="h5repack_soffset.h5 -f dset_scaleoffset:NONE" -TOOLTEST scale_remove $arg - -# remove all filters -arg="h5repack_filters.h5 -f NONE" -if test $USE_FILTER_DEFLATE != "yes" -o $USE_FILTER_SZIP != "yes" -o $USE_FILTER_SZIP_ENCODER != "yes" ; then - SKIP $arg -else - TOOLTEST remove_all $arg -fi - -#filter conversions - -arg="h5repack_deflate.h5 -f dset_deflate:SZIP=8,NN" -if test $USE_FILTER_SZIP_ENCODER != "yes" -o $USE_FILTER_SZIP != "yes" -o $USE_FILTER_DEFLATE != "yes" ; then - SKIP $arg -else - TOOLTEST deflate_convert $arg -fi - -arg="h5repack_szip.h5 -f dset_szip:GZIP=1" -if test $USE_FILTER_SZIP != "yes" -o $USE_FILTER_SZIP_ENCODER != "yes" -o $USE_FILTER_DEFLATE != "yes" ; then - SKIP $arg -else - TOOLTEST szip_convert $arg -fi - - -#limit -arg="h5repack_layout.h5 -f GZIP=1 -m 1024" -if test $USE_FILTER_DEFLATE != "yes" ; then - SKIP $arg -else - TOOLTEST_DUMP deflate_limit $arg -fi - -#file -arg="h5repack_layout.h5 -e h5repack.info" -if test $USE_FILTER_DEFLATE != "yes" ; then - SKIP $arg -else - TOOLTEST deflate_file $arg -fi - -######################################################### -# layout options (these files have no filters) -######################################################### -VERIFY_LAYOUT_DSET dset2_chunk_20x10 h5repack_layout.h5 dset2 CHUNKED --layout dset2:CHUNK=20x10 - -VERIFY_LAYOUT_ALL chunk_20x10 h5repack_layout.h5 CHUNKED -l CHUNK=20x10 - -VERIFY_LAYOUT_DSET dset2_conti h5repack_layout.h5 dset2 CONTIGUOUS -l dset2:CONTI - -VERIFY_LAYOUT_ALL conti h5repack_layout.h5 CONTIGUOUS -l CONTI - -VERIFY_LAYOUT_DSET dset2_compa h5repack_layout.h5 dset2 COMPACT -l dset2:COMPA - -VERIFY_LAYOUT_ALL compa h5repack_layout.h5 COMPACT -l COMPA - -TOOLTESTM dset2_chunk_20x10-errstk h5repack_layout.h5 --layout=dset2:CHUNK=20x10x5 --enable-error-stack - -################################################################ -# layout conversions (file has no filters) -############################################################### - -VERIFY_LAYOUT_DSET dset_compa_conti h5repack_layout.h5 dset_compact CONTIGUOUS -l dset_compact:CONTI - -VERIFY_LAYOUT_DSET dset_compa_chunk h5repack_layout.h5 dset_compact CHUNKED -l dset_compact:CHUNK=2x5 - -VERIFY_LAYOUT_DSET dset_compa_compa h5repack_layout.h5 dset_compact COMPACT -l dset_compact:COMPA - -VERIFY_LAYOUT_DSET dset_conti_compa h5repack_layout.h5 dset_contiguous COMPACT -l dset_contiguous:COMPA - -VERIFY_LAYOUT_DSET dset_conti_chunk h5repack_layout.h5 dset_contiguous CHUNKED -l dset_contiguous:CHUNK=3x6 - -VERIFY_LAYOUT_DSET dset_conti_conti h5repack_layout.h5 dset_contiguous CONTIGUOUS -l dset_contiguous:CONTI - -VERIFY_LAYOUT_DSET chunk_compa h5repack_layout.h5 dset_chunk COMPACT -l dset_chunk:COMPA - -VERIFY_LAYOUT_DSET chunk_conti h5repack_layout.h5 dset_chunk CONTIGUOUS -l dset_chunk:CONTI - -VERIFY_LAYOUT_DSET chunk_18x13 h5repack_layout.h5 dset_chunk CHUNKED -l dset_chunk:CHUNK=18x13 - -# test convert small size dataset ( < 1k) to compact layout without -m -VERIFY_LAYOUT_DSET contig_small_compa h5repack_layout2.h5 contig_small COMPACT -l contig_small:COMPA - -VERIFY_LAYOUT_DSET contig_small_fixed_compa h5repack_layout2.h5 chunked_small_fixed COMPACT -l chunked_small_fixed:COMPA - -#--------------------------------------------------------------------------- -# Test file contains chunked datasets (need multiple dsets) with -# unlimited max dims. (HDFFV-7933) -# Use first dset to test. -#--------------------------------------------------------------------------- -# chunk to chunk - specify chunk dim bigger than any current dim -VERIFY_LAYOUT_DSET chunk2chunk h5repack_layout3.h5 chunk_unlimit1 CHUNK -l chunk_unlimit1:CHUNK=100x300 - -# chunk to contiguous -VERIFY_LAYOUT_DSET chunk2conti h5repack_layout3.h5 chunk_unlimit1 CONTI -l chunk_unlimit1:CONTI - -# chunk to compact - convert big dataset (should be > 64k) for this purpose, -# should remain as original layout (chunk) -VERIFY_LAYOUT_DSET chunk2compa h5repack_layout3.h5 chunk_unlimit1 CHUNK -l chunk_unlimit1:COMPA - -#-------------------------------------------------------------------------- -# Test -f for some specific cases. Chunked dataset with unlimited max dims. -# (HDFFV-8012) -#-------------------------------------------------------------------------- -# - should not fail -# - should not change max dims from unlimit - -# chunk dim is bigger than dataset dim. ( dset size < 64k ) -VERIFY_LAYOUT_DSET error1 h5repack_layout3.h5 chunk_unlimit1 H5S_UNLIMITED -f chunk_unlimit1:NONE -# chunk dim is bigger than dataset dim. ( dset size > 64k ) -VERIFY_LAYOUT_DSET error2 h5repack_layout3.h5 chunk_unlimit2 H5S_UNLIMITED -f chunk_unlimit2:NONE - -# chunk dims are smaller than dataset dims. ( dset size < 64k ) -#TOOLTEST_MAIN h5repack_layout3.h5 -f chunk_unlimit3:NONE -VERIFY_LAYOUT_DSET error3 h5repack_layout3.h5 chunk_unlimit3 H5S_UNLIMITED -f chunk_unlimit3:NONE - -# file input - should not fail -TOOLTEST error4 h5repack_layout3.h5 -f NONE - -#-------------------------------------------------------------------------- -# Test base: Convert CHUNK to CONTI for a chunked dataset with small dataset -# (dset size < 64K) and with unlimited max dims on a condition as follow. -# (HDFFV-8214) -#-------------------------------------------------------------------------- - -# chunk dim is bigger than dataset dim. should succeed. -VERIFY_LAYOUT_DSET ckdim_biger h5repack_layout3.h5 chunk_unlimit2 CONTI -l chunk_unlimit2:CONTI -# chunk dim is smaller than dataset dim. should succeed. -VERIFY_LAYOUT_DSET ckdim_smaller h5repack_layout3.h5 chunk_unlimit3 CONTI -l chunk_unlimit3:CONTI - - -# Native option -# Do not use FILE1, as the named dtype will be converted to native, and h5diff will -# report a difference. -TOOLTEST native_fill h5repack_fill.h5 -n -TOOLTEST native_attr h5repack_attr.h5 -n - - -# latest file format with long switches. use FILE4=h5repack_layout.h5 (no filters) -arg="h5repack_layout.h5 --layout CHUNK=20x10 --filter GZIP=1 --minimum=10 --native --latest --compact=8 --indexed=6 --ssize=8[:dtype]" -if test $USE_FILTER_DEFLATE != "yes" ; then - SKIP $arg -else - VERIFY_LAYOUT_ALL layout_long_switches h5repack_layout.h5 CHUNKED --layout CHUNK=20x10 --filter GZIP=1 --minimum=10 --native --latest --compact=8 --indexed=6 --ssize=8[:dtype] -fi - -# latest file format with short switches. use FILE4=h5repack_layout.h5 (no filters) -arg="h5repack_layout.h5 -l CHUNK=20x10 -f GZIP=1 -m 10 -n -L -c 8 -d 6 -s 8[:dtype]" -if test $USE_FILTER_DEFLATE != "yes" ; then - SKIP $arg -else - VERIFY_LAYOUT_ALL layout_short_switches h5repack_layout.h5 CHUNKED -l CHUNK=20x10 -f GZIP=1 -m 10 -n -L -c 8 -d 6 -s 8[:dtype] -fi - -# several global filters - -arg="h5repack_layout.h5 --filter GZIP=1 --filter SHUF" -if test $USE_FILTER_DEFLATE != "yes" ; then - SKIP $arg -else - TOOLTEST global_filters $arg -fi - -# syntax of -i infile -o outfile -# latest file format with short switches. use FILE4=h5repack_layout.h5 (no filters) -arg="h5repack_layout.h5 -l CHUNK=20x10 -f GZIP=1 -m 10 -n -L -c 8 -d 6 -s 8[:dtype]" -if test $USE_FILTER_DEFLATE != "yes" ; then - SKIP $arg -else - TOOLTEST0 old_style_layout_short_switches $arg -fi - -# add a userblock to file -arg="h5repack_objs.h5 -u ublock.bin -b 2048" -TOOLTEST add_userblock $arg - -# add alignment -arg="h5repack_objs.h5 -t 1 -a 1 " -TOOLTEST add_alignment $arg - -# Check repacking file with old version of layout message (should get upgraded -# to new version and be readable, etc.) -TOOLTEST upgrade_layout h5repack_layouto.h5 - -# test for datum size > H5TOOLS_MALLOCSIZE -TOOLTEST gt_mallocsize h5repack_objs.h5 -f GZIP=1 - -# Check repacking file with committed datatypes in odd configurations -TOOLTEST committed_dt h5repack_named_dtypes.h5 - -# tests family driver (file is located in common testfiles folder, uses TOOLTEST1 -TOOLTEST1 family tfamily%05d.h5 - -# test various references (bug 1814 and 1726) -TOOLTEST bug1814 h5repack_refs.h5 - -# test attribute with various references (bug1797 / HDFFV-5932) -# the references in attribute of compund or vlen datatype -TOOLTEST HDFFV-5932 h5repack_attr_refs.h5 - -# Add test for memory leak in attirbute. This test is verified by CTEST. -# 1. leak from vlen string -# 2. leak from compound type without reference member -# (HDFFV-7840, ) -# Note: this test is experimental for sharing test file among tools -TOOLTEST HDFFV-7840 h5diff_attr1.h5 - -# tests for metadata block size option -TOOLTEST_META meta_short h5repack_layout.h5 -M 8192 -TOOLTEST_META meta_long h5repack_layout.h5 --metadata_block_size=8192 - -# VDS tests - -################################################################ -# layout conversions -############################################################### -if test $USE_FILTER_DEFLATE != "yes" ; then - SKIP vds_dset_chunk_20x10x5 -else - VERIFY_LAYOUT_VDS vds_dset_chunk_20x10x5 1_vds.h5 vds_dset CHUNKED --layout vds_dset:CHUNK=20x10x5 -fi - -if test $USE_FILTER_DEFLATE != "yes" ; then - SKIP vds_chunk2x5x8 -else - VERIFY_LAYOUT_VDS vds_chunk2x5x8 3_1_vds.h5 vds_dset CHUNKED -l vds_dset:CHUNK=2x5x8 -fi - -if test $USE_FILTER_DEFLATE != "yes" ; then - SKIP vds_chunk3x6x9 -else - VERIFY_LAYOUT_VDS vds_chunk3x6x9 2_vds.h5 vds_dset CHUNKED -l vds_dset:CHUNK=3x6x9 -fi - -if test $USE_FILTER_DEFLATE != "yes" ; then - SKIP vds_compa 4_vds.h5 -else - VERIFY_LAYOUT_VDS vds_compa 4_vds.h5 vds_dset COMPACT -l vds_dset:COMPA -fi - -if test $USE_FILTER_DEFLATE != "yes" ; then - SKIP vds_conti 4_vds.h5 -else - VERIFY_LAYOUT_VDS vds_conti 4_vds.h5 vds_dset CONTIGUOUS -l vds_dset:CONTI -fi - -# Clean up temporary files/directories -CLEAN_TESTFILES_AND_TESTDIR - -if test $nerrors -eq 0 ; then - echo "All $TESTNAME tests passed." - exit $EXIT_SUCCESS -else - echo "$TESTNAME tests failed with $nerrors errors." - exit $EXIT_FAILURE -fi - diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c deleted file mode 100644 index 547f61a..0000000 --- a/tools/h5repack/h5repack_copy.c +++ /dev/null @@ -1,1581 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include "h5repack.h" -#include "h5tools.h" -#include "h5tools_utils.h" - -/*------------------------------------------------------------------------- - * typedefs - *------------------------------------------------------------------------- - */ - -/*------------------------------------------------------------------------- - * globals - *------------------------------------------------------------------------- - */ - -/*------------------------------------------------------------------------- - * macros - *------------------------------------------------------------------------- - */ - -/* size of buffer/# of bytes to xfer at a time when copying userblock */ -#define USERBLOCK_XFER_SIZE 512 - -/* check H5Dread()/H5Dwrite() error, e.g. memory allocation error inside the library. */ -#define CHECK_H5DRW_ERROR(_fun, _fail, _did, _mtid, _msid, _fsid, _pid, _buf) { \ - H5E_BEGIN_TRY { \ - if(_fun(_did, _mtid, _msid, _fsid, _pid, _buf) < 0) { \ - hid_t _err_num = 0; \ - char _msg[80]; \ - H5Ewalk2(H5E_DEFAULT, H5E_WALK_DOWNWARD, walk_error_callback, &_err_num); \ - H5Eget_msg(_err_num, NULL, _msg, (size_t)80); \ - error_msg("%s %s -- %s\n", #_fun, "failed", _msg); \ - HGOTO_DONE(_fail) \ - } \ - } H5E_END_TRY; \ -} - -/*------------------------------------------------------------------------- - * local functions - *------------------------------------------------------------------------- - */ -static int Get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], - size_t size_datum, hsize_t dims_hslab[], hsize_t * hslab_nbytes_p); -static void print_dataset_info(hid_t dcpl_id, char *objname, double per, int pr); -static int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, - pack_opt_t *options); -static int copy_user_block(const char *infile, const char *outfile, - hsize_t size); -#if defined (H5REPACK_DEBUG_USER_BLOCK) -static void print_user_block(const char *filename, hid_t fid); -#endif -static herr_t walk_error_callback(unsigned n, const H5E_error2_t *err_desc, void *udata); - -/* get the major number from the error stack. */ -static herr_t walk_error_callback(H5_ATTR_UNUSED unsigned n, const H5E_error2_t *err_desc, void *udata) { - if (err_desc) - *((hid_t *) udata) = err_desc->maj_num; - - return 0; -} - -/*------------------------------------------------------------------------- - * Function: copy_objects - * - * Purpose: duplicate all HDF5 objects in the file - * - * Return: 0, ok, -1 no - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: October, 23, 2003 - * - * Modification: - * Peter Cao, June 13, 2007 - * Add "-L, --latest" and other options to pack a file with the latest file format - * - * Peter Cao, September 25, 2007 - * Copy user block when repacking a file - * - * Pedro Vicente, August 20, 2008 - * Add a user block to file if requested - * - *------------------------------------------------------------------------- - */ - -int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) -{ - int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ - hid_t fidin; - hid_t fidout = -1; - trav_table_t *travt = NULL; - hsize_t ub_size = 0; /* size of user block */ - hid_t fcpl = H5P_DEFAULT; /* file creation property list ID */ - hid_t fapl = H5P_DEFAULT; /* file access property list ID */ - - /*------------------------------------------------------------------------- - * open input file - *------------------------------------------------------------------------- - */ - if ((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t) 0)) < 0) { - error_msg("<%s>: %s\n", fnamein, H5FOPENERROR); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - } - - /* get user block size and file space strategy/threshold */ - { - hid_t fcpl_in; /* file creation property list ID for input file */ - - if ((fcpl_in = H5Fget_create_plist(fidin)) < 0) { - error_msg("failed to retrieve file creation property list\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - } - - if (H5Pget_userblock(fcpl_in, &ub_size) < 0) { - error_msg("failed to retrieve userblock size\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - } - - if (!options->fs_strategy) { - if (H5Pget_file_space(fcpl_in, &options->fs_strategy, NULL) < 0) { - error_msg("failed to retrieve file space strategy\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - } - } - - if (!options->fs_threshold) { - if (H5Pget_file_space(fcpl_in, NULL, &options->fs_threshold) < 0) { - error_msg("failed to retrieve file space threshold\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - } - } - - if (H5Pclose(fcpl_in) < 0) { - error_msg("failed to close property list\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - } - } - - /* Check if we need to create a non-default file creation property list */ - if (options->latest || ub_size > 0) { - /* Create file creation property list */ - if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { - error_msg("fail to create a file creation property list\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - } - - if (ub_size > 0) { - if (H5Pset_userblock(fcpl, ub_size) < 0) { - error_msg("failed to set non-default userblock size\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - } - } - - if (options->latest) { - unsigned i = 0, nindex = 0, mesg_type_flags[5], min_mesg_sizes[5]; - - /* Adjust group creation parameters for root group */ - /* (So that it is created in "dense storage" form) */ - if (H5Pset_link_phase_change(fcpl, (unsigned) options->grp_compact, - (unsigned) options->grp_indexed) < 0) { - error_msg("fail to adjust group creation parameters for root group\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - } - - for (i = 0; i < 5; i++) { - if (options->msg_size[i] > 0) { - switch (i) { - case 0: - mesg_type_flags[nindex] = H5O_SHMESG_SDSPACE_FLAG; - break; - - case 1: - mesg_type_flags[nindex] = H5O_SHMESG_DTYPE_FLAG; - break; - - case 2: - mesg_type_flags[nindex] = H5O_SHMESG_FILL_FLAG; - break; - - case 3: - mesg_type_flags[nindex] = H5O_SHMESG_PLINE_FLAG; - break; - - case 4: - mesg_type_flags[nindex] = H5O_SHMESG_ATTR_FLAG; - break; - - default: - break; - } /* end switch */ - min_mesg_sizes[nindex] = (unsigned) options->msg_size[i]; - - nindex++; - } /* end if */ - } /* end for */ - - if (nindex > 0) { - if (H5Pset_shared_mesg_nindexes(fcpl, nindex) < 0) { - error_msg("fail to set the number of shared object header message indexes\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - } - - /* msg_size[0]=dataspace, 1=datatype, 2=file value, 3=filter pipleline, 4=attribute */ - for (i = 0; i < (nindex - 1); i++) { - if (H5Pset_shared_mesg_index(fcpl, i, mesg_type_flags[i], min_mesg_sizes[i]) < 0) { - error_msg("fail to configure the specified shared object header message index\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - } /* end if */ - } /* end for */ - } /* if (nindex>0) */ - - /* Create file access property list */ - if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { - error_msg("Could not create file access property list\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - } /* end if */ - - if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) { - error_msg("Could not set property for using latest version of the format\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - } /* end if */ - } /* end if */ - } /* end if */ -#if defined (H5REPACK_DEBUG_USER_BLOCK) -print_user_block(fnamein, fidin); -#endif - - /*------------------------------------------------------------------------- - * set the new user userblock options in the FCPL (before H5Fcreate ) - *------------------------------------------------------------------------- - */ - if (options->ublock_size > 0) { - /* either use the FCPL already created or create a new one */ - if (fcpl == H5P_DEFAULT) { - /* create a file creation property list */ - if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { - error_msg("fail to create a file creation property list\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - } - } - - /* set user block size */ - if (H5Pset_userblock(fcpl, options->ublock_size) < 0) { - error_msg("failed to set userblock size\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - } - } - - /*------------------------------------------------------------------------- - * set alignment options - *------------------------------------------------------------------------- - */ - if (options->alignment > 0) { - /* either use the FAPL already created or create a new one */ - if (fapl == H5P_DEFAULT) { - /* create a file access property list */ - if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { - error_msg("Could not create file access property list\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - } - } - - if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0) { - error_msg("failed to set alignment\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - } - } - - /*------------------------------------------------------------------------- - * set metadata block size option - *------------------------------------------------------------------------- - */ - if (options->meta_block_size > 0) { - /* either use the FAPL already created or create a new one */ - if (fapl == H5P_DEFAULT) { - /* create a file access property list */ - if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { - error_msg("Could not create file access property list\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - } - } - - if (H5Pset_meta_block_size(fapl, options->meta_block_size) < 0) { - error_msg("failed to set metadata block size\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - } - } - - /*------------------------------------------------------------------------- - * set free-space strategy options - *------------------------------------------------------------------------- - */ - - /* either use the FCPL already created or create a new one */ - if (fcpl == H5P_DEFAULT) { - /* create a file creation property list */ - if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { - error_msg("fail to create a file creation property list\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - } - } - - /* set file space strategy and free space threshold */ - if (H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0) { - error_msg("failed to set file space strategy & threshold \n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - } - - /*------------------------------------------------------------------------- - * create the output file - *------------------------------------------------------------------------- - */ - if (options->verbose) - printf("Making file <%s>...\n", fnameout); - - if ((fidout = H5Fcreate(fnameout, H5F_ACC_TRUNC, fcpl, fapl)) < 0) { - error_msg("<%s>: Could not create file\n", fnameout); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - } - - /*------------------------------------------------------------------------- - * write a new user block if requested - *------------------------------------------------------------------------- - */ - if (options->ublock_size > 0) { - if (copy_user_block(options->ublock_filename, fnameout, options->ublock_size) < 0) { - error_msg("Could not copy user block. Exiting...\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - } - } - - /*------------------------------------------------------------------------- - * get list of objects - *------------------------------------------------------------------------- - */ - - /* init table */ - trav_table_init(&travt); - - /* get the list of objects in the file */ - if (h5trav_gettable(fidin, travt) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - - /*------------------------------------------------------------------------- - * do the copy - *------------------------------------------------------------------------- - */ - if (do_copy_objects(fidin, fidout, travt, options) < 0) { - error_msg("<%s>: Could not copy data to: %s\n", fnamein, fnameout); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - } /* end if */ - - /*------------------------------------------------------------------------- - * do the copy of referenced objects - * and create hard links - *------------------------------------------------------------------------- - */ - if (do_copy_refobjs(fidin, fidout, travt, options) < 0) { - printf("h5repack: <%s>: Could not copy data to: %s\n", fnamein, fnameout); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - } - - /*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ - - if (fapl > 0) - H5Pclose(fapl); - - if (fcpl > 0) - H5Pclose(fcpl); - - H5Fclose(fidin); - H5Fclose(fidout); - - /* free table */ - trav_table_free(travt); - travt = NULL; - - /*------------------------------------------------------------------------- - * write only the input file user block if there is no user block file input - *------------------------------------------------------------------------- - */ - - if (ub_size > 0 && options->ublock_size == 0) { - if (copy_user_block(fnamein, fnameout, ub_size) < 0) { - error_msg("Could not copy user block. Exiting...\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - } - } - - return 0; - - /*------------------------------------------------------------------------- - * out - *------------------------------------------------------------------------- - */ - -done: - H5E_BEGIN_TRY { - H5Pclose(fapl); - H5Pclose(fcpl); - H5Fclose(fidin); - H5Fclose(fidout); - } H5E_END_TRY; - if (travt) - trav_table_free(travt); - - return ret_value; -} - -/*------------------------------------------------------------------------- - * Function: Get_hyperslab - * - * Purpose: Calulate a hyperslab from a dataset for higher performance. - * The size of hyperslab is limitted by H5TOOLS_BUFSIZE. - * Return the hyperslab dimentions and size in byte. - * - * Return: 0 - SUCCEED, -1 FAILED - * - * Parameters: - * dcpl_id : [IN] dataset creation property. - * rank_dset : [IN] dataset rank - * dims_dset[] : [IN] dataset dimentions - * size_datum : [IN] size of a data element in byte - * dims_hslab[] : [OUT] calculated hyperslab dimentions - * * hslab_nbytes_p : [OUT] total byte of the hyperslab - * - * Programmer: Jonathan Kim - * Date: Feburary, 2012 - * Update: - * The hyperslab calucation would be depend on if the dataset is chunked - * or not. - * - * There care 3 conditions to cover: - * 1. If chunked and a chunk fits in buffer, each chunk would be a unit of - * collection and the boundary would be dataset's dims. - * 2. If chunked but a chunk doesn't fit in buffer, each data element would - * be a unit of collection and the boundary would be the chunk itself. - * 3. If not chunked, each data element would be a unit of collection and - * the boundary would be dataset's dims. - * - * The calulation starts from the last dimention (h5dump dims output). - * - * Note: - * Added for JIRA HDFFV-7862. - *-----------------------------------------*/ - -int Get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], - size_t size_datum, hsize_t dims_hslab[], hsize_t * hslab_nbytes_p) -{ - int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ - int k; - H5D_layout_t dset_layout; - int rank_chunk; - hsize_t dims_chunk[H5S_MAX_RANK]; - hsize_t size_chunk = 1; - hsize_t nchunk_fit; /* number of chunks that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */ - hsize_t ndatum_fit; /* number of dataum that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */ - hsize_t chunk_dims_map[H5S_MAX_RANK]; /* mapped chunk dimentions */ - hsize_t hs_dims_map[H5S_MAX_RANK]; /* mapped hyperslab dimentions */ - hsize_t hslab_nbytes; /* size of hyperslab in byte */ - - /* init to set as size of a data element */ - hslab_nbytes = size_datum; - - /* get layout of dataset */ - dset_layout = H5Pget_layout(dcpl_id); - - /* if dataset is chunked */ - if (dset_layout == H5D_CHUNKED) { - /* get chunk dims */ - rank_chunk = H5Pget_chunk(dcpl_id, rank_dset, dims_chunk); - if (rank_chunk < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - - for (k = rank_dset; k > 0; --k) - size_chunk *= dims_chunk[k - 1]; - - /* figure out how many chunks can fit in the hyperslab buffer */ - nchunk_fit = (H5TOOLS_BUFSIZE / size_datum) / size_chunk; - - /* 1. if a chunk fit in hyperslab buffer */ - if (nchunk_fit >= 1) { - /* Calulate a hyperslab that contains as many chunks that can fit - * in hyperslab buffer. Hyperslab will be increased starting from - * the last dimention of the dataset (see h5dump's dims output). - * The calculation boundary is dataset dims. - * In the loop, used mapping from a datum to a chunk to figure out - * chunk based hyperslab. - */ - for (k = rank_dset; k > 0; --k) { - /* map dataset dimentions with a chunk dims */ - chunk_dims_map[k - 1] = dims_dset[k - 1] / dims_chunk[k - 1]; - - /* if reminder exist, increse by 1 to cover partial edge chunks */ - if (dims_dset[k - 1] % dims_chunk[k - 1] > 0) - chunk_dims_map[k - 1]++; - - /* get mapped hyperslab dims */ - hs_dims_map[k - 1] = MIN (nchunk_fit, chunk_dims_map[k-1]); - - /* prepare next round */ - nchunk_fit = nchunk_fit / chunk_dims_map[k - 1]; - /* if a chunk is bigger than the rest of buffer */ - if (nchunk_fit == 0) - nchunk_fit = 1; - - /* get hyperslab dimentions as unmapping to actual size */ - dims_hslab[k - 1] = MIN( (hs_dims_map[k-1] * dims_chunk[k-1]), dims_dset[k-1]); - - /* calculate total size for the hyperslab */ - hslab_nbytes *= dims_hslab[k - 1]; - } - } - /* 2. if a chunk is bigger than hyperslab buffer */ - else { - /* Calulate a hyperslab that contains as many data elements that - * can fit in hyperslab buffer. Hyperslab will be increased - * starting from the last dimention of the chunk (see h5dump's dims - * output). - * The calculation boundary is a chunk dims. - */ - for (k = rank_dset; k > 0; --k) { - ndatum_fit = H5TOOLS_BUFSIZE / hslab_nbytes; - - /* if a datum is bigger than rest of buffer */ - if (ndatum_fit == 0) - ndatum_fit = 1; - /* get hyperslab dimentions within a chunk boundary */ - dims_hslab[k - 1] = MIN (dims_chunk[k-1], ndatum_fit); - - /* calculate total size for the hyperslab */ - hslab_nbytes *= dims_hslab[k - 1]; - - if (hslab_nbytes <= 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - } - } - } - /* 3. if dataset is not chunked */ - else { - /* Calulate a hyperslab that contains as many data elements that can - * fit in hyperslab buffer. Hyperslab will be increased starting from - * the last dimention of the dataset (see h5dump's dims output). - * The calculation boundary is dataset dims. - */ - for (k = rank_dset; k > 0; --k) { - ndatum_fit = H5TOOLS_BUFSIZE / hslab_nbytes; - - /* if a datum is bigger than rest of buffer */ - if (ndatum_fit == 0) - ndatum_fit = 1; - /* get hyperslab dimentions within dataset boundary */ - dims_hslab[k - 1] = MIN(dims_dset[k - 1], ndatum_fit); - - /* calculate total size for the hyperslab */ - hslab_nbytes *= dims_hslab[k - 1]; - - if (hslab_nbytes <= 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - } - } - - /* pass out the hyperslab size*/ - *hslab_nbytes_p = hslab_nbytes; - -done: - return ret_value; -} - -/*------------------------------------------------------------------------- - * Function: do_copy_objects - * - * Purpose: duplicate all HDF5 objects in the file - * - * Return: 0, ok, -1 no - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: October, 23, 2003 - * - * Modifications: - * - * July 2004: Introduced the extra EC or NN option for SZIP - * - * December 2004: Added a check for H5Dcreate; if the dataset cannot be created - * with the requested filter, use the input one - * - * October 2006: Read/write using the file type by default. - * - * 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 - * i.e., if the memory needed to read a dataset is greater than this limit, - * then hyperslab I/O is done instead of one operation I/O - * For each dataset, the memory needed is calculated according to - * - * memory needed = number of elements * size of each element - * - * if the memory needed is lower than H5TOOLS_MALLOCSIZE, then the following operations - * are done - * - * H5Dread( input_dataset1 ) - * H5Dread( input_dataset2 ) - * - * with all elements in the datasets selected. If the memory needed is greater than - * H5TOOLS_MALLOCSIZE, then the following operations are done instead: - * - * a strip mine is defined for each dimension k (a strip mine is defined as a - * hyperslab whose size is memory manageable) according to the formula - * - * (1) strip_mine_size[k ] = MIN(dimension[k ], H5TOOLS_BUFSIZE / size of memory type) - * - * where H5TOOLS_BUFSIZE is a constant currently defined as 1MB. This formula assures - * that for small datasets (small relative to the H5TOOLS_BUFSIZE constant), the strip - * mine size k is simply defined as its dimension k, but for larger datasets the - * hyperslab size is still memory manageable. - * a cycle is done until the number of elements in the dataset is reached. In each - * iteration, two parameters are defined for the function H5Sselect_hyperslab, - * the start and size of each hyperslab, according to - * - * (2) hyperslab_size [k] = MIN(dimension[k] - hyperslab_offset[k], strip_mine_size [k]) - * - * where hyperslab_offset [k] is initially set to zero, and later incremented in - * hyperslab_size[k] offsets. The reason for the operation - * - * dimension[k] - hyperslab_offset[k] - * - * in (2) is that, when using the strip mine size, it assures that the "remaining" part - * of the dataset that does not fill an entire strip mine is processed. - * - * November 2006: Use H5Ocopy in the copy of objects. The logic for using - * H5Ocopy or not is if a change of filters or layout is requested by the user - * then use read/write else use H5Ocopy. - * - * May, 1, 2008: Add a printing of the compression ratio of old size / new size - * - * Feburary 2012: improve Read/Write by hyperslabs for big datasets. - * Programmer: Jonathan Kim - * - * A threshold of H5TOOLS_MALLOCSIZE is the limit upon which I/O hyperslab is done - * i.e., if the memory needed to read a dataset is greater than this limit, - * then hyperslab I/O is done instead of one operation I/O - * For each dataset, the memory needed is calculated according to - * - * memory needed = number of elements * size of each element - * - * if the memory needed is lower than H5TOOLS_MALLOCSIZE, then the following operations - * are done - * - * H5Dread( input_dataset ) - * H5Dwrite( output_dataset ) - * - * with all elements in the datasets selected. If the memory needed is greater than - * H5TOOLS_MALLOCSIZE, then the following operations are done instead: - * - * 1. figure out a hyperslab (dimentions) and size (refer to Get_hyperslab()). - * 2. Calculate the hyperslab selections as the selection is moving forward. - * Selection would be same as the hyperslab except for the remaining edge portion - * of the dataset. The code take care of the remaining portion if exist. - * - *------------------------------------------------------------------------- - */ - -int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, - pack_opt_t *options) /* repack options */ -{ - int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ - hid_t grp_in = -1; /* group ID */ - hid_t grp_out = -1; /* group ID */ - hid_t dset_in = -1; /* read dataset ID */ - hid_t dset_out = -1; /* write dataset ID */ - hid_t gcpl_in = -1; /* group creation property list */ - hid_t gcpl_out = -1; /* group creation property list */ - hid_t type_in = -1; /* named type ID */ - hid_t type_out = -1; /* named type ID */ - hid_t dcpl_in = -1; /* dataset creation property list ID */ - hid_t dcpl_out = -1; /* dataset creation property list ID */ - hid_t f_space_id = -1; /* file space ID */ - hid_t ftype_id = -1; /* file type ID */ - hid_t wtype_id = -1; /* read/write type ID */ - named_dt_t *named_dt_head = NULL; /* Pointer to the stack of named datatypes copied */ - size_t msize; /* size of type */ - hsize_t nelmts; /* number of elements in dataset */ - H5D_space_status_t space_status; /* determines whether space has been allocated for the dataset */ - int rank; /* rank of dataset */ - hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */ - hsize_t dsize_in; /* input dataset size before filter */ - hsize_t dsize_out; /* output dataset size after filter */ - int apply_s; /* flag for apply filter to small dataset sizes */ - int apply_f; /* flag for apply filter to return error on H5Dcreate */ - void *buf = NULL; /* buffer for raw data */ - void *hslab_buf = NULL; /* hyperslab buffer for raw data */ - int has_filter; /* current object has a filter */ - int req_filter; /* there was a request for a filter */ - int req_obj_layout = 0; /* request layout to current object */ - unsigned crt_order_flags; /* group creation order flag */ - unsigned i; - unsigned u; - int is_ref = 0; - htri_t is_named; - hbool_t limit_maxdims; - hsize_t size_dset; - - /*------------------------------------------------------------------------- - * copy the suppplied object list - *------------------------------------------------------------------------- - */ - - if (options->verbose) { - printf("-----------------------------------------\n"); - printf(" Type Filter (Compression) Name\n"); - printf("-----------------------------------------\n"); - } - - for (i = 0; i < travt->nobjs; i++) { - /* init variables per obj */ - buf = NULL; - limit_maxdims = FALSE; - - switch (travt->objs[i].type) { - case H5TRAV_TYPE_UNKNOWN: - HDassert(0); - break; - - /*------------------------------------------------------------------------- - * H5TRAV_TYPE_GROUP - *------------------------------------------------------------------------- - */ - case H5TRAV_TYPE_GROUP: - if (options->verbose) - printf(FORMAT_OBJ, "group", travt->objs[i].name); - - /* open input group */ - if ((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed"); - - /* get input group creation property list */ - if ((gcpl_in = H5Gget_create_plist(grp_in)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gget_create_plist failed"); - - /* query and set the group creation properties */ - if (H5Pget_link_creation_order(gcpl_in, &crt_order_flags) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_link_creation_order failed"); - - /* set up group creation property list */ - if ((gcpl_out = H5Pcreate(H5P_GROUP_CREATE)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed"); - - if (H5Pset_link_creation_order(gcpl_out, crt_order_flags) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_link_creation_order failed"); - - /*------------------------------------------------------------------------- - * the root is a special case, we get an ID for the root group - * and copy its attributes using that ID - *------------------------------------------------------------------------- - */ - if (HDstrcmp(travt->objs[i].name, "/") == 0) { - if ((grp_out = H5Gopen2(fidout, "/", H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed"); - } - else { - if (options->grp_compact > 0 || options->grp_indexed > 0) - if (H5Pset_link_phase_change(gcpl_out, (unsigned) options->grp_compact, (unsigned) options->grp_indexed) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_link_phase_change failed"); - - if ((grp_out = H5Gcreate2(fidout, travt->objs[i].name, H5P_DEFAULT, gcpl_out, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gcreate2 failed"); - } - - /*------------------------------------------------------------------------- - * copy attrs - *------------------------------------------------------------------------- - */ - if (copy_attr(grp_in, grp_out, &named_dt_head, travt, options) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed"); - - if (H5Pclose(gcpl_out) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - if (H5Pclose(gcpl_in) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - if (H5Gclose(grp_out) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed"); - if (H5Gclose(grp_in) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed"); - - break; - - /*------------------------------------------------------------------------- - * H5TRAV_TYPE_DATASET - *------------------------------------------------------------------------- - */ - case H5TRAV_TYPE_DATASET: - has_filter = 0; - req_filter = 0; - - /* check if global filters were requested */ - if (options->n_filter_g) - req_filter = 1; - - /* check if filters were requested for individual objects */ - for (u = 0; u < options->op_tbl->nelems; u++) - if (HDstrcmp(travt->objs[i].name, options->op_tbl->objs[u].path) == 0) - if (options->op_tbl->objs[u].filter->filtn > 0) - req_filter = 1; - - /* check if layout change requested individual object */ - if (options->layout_g != H5D_LAYOUT_ERROR) { - pack_info_t *pckinfo; - - /* any dataset is specified */ - if (options->op_tbl->nelems > 0) { - /* check if object exist */ - pckinfo = options_get_object(travt->objs[i].name, options->op_tbl); - if (pckinfo) - req_obj_layout = 1; - } - } - - /* early detection of references */ - if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); - if ((ftype_id = H5Dget_type(dset_in)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed"); - if (H5T_REFERENCE == H5Tget_class(ftype_id)) - is_ref = 1; - - /* Check if the datatype is committed */ - if ((is_named = H5Tcommitted(ftype_id)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tcommitted failed"); - if (is_named) - if ((wtype_id = copy_named_datatype(ftype_id, fidout, &named_dt_head, travt, options)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_named_datatype failed"); - - if (H5Tclose(ftype_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); - if (H5Dclose(dset_in) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); - - /*------------------------------------------------------------------------- - * check if we should use H5Ocopy or not - * if there is a request for filters/layout, we read/write the object - * otherwise we do a copy using H5Ocopy - *------------------------------------------------------------------------- - */ - if (options->op_tbl->nelems || options->all_filter == 1 - || options->all_layout == 1 || is_ref || is_named) { - - int j; - - if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); - if ((f_space_id = H5Dget_space(dset_in)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); - if ((ftype_id = H5Dget_type(dset_in)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed"); - if ((dcpl_in = H5Dget_create_plist(dset_in)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed"); - if ((dcpl_out = H5Pcopy(dcpl_in)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcopy failed"); - if ((rank = H5Sget_simple_extent_ndims(f_space_id)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); - HDmemset(dims, 0, sizeof dims); - if (H5Sget_simple_extent_dims(f_space_id, dims, NULL) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); - if (H5Dget_space_status(dset_in, &space_status) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space_status failed"); - - nelmts = 1; - for (j = 0; j < rank; j++) - nelmts *= dims[j]; - - /* wtype_id will have already been set if using a named dtype */ - if (!is_named) { - if (options->use_native == 1) - wtype_id = h5tools_get_native_type(ftype_id); - else - wtype_id = H5Tcopy(ftype_id); - } /* end if */ - - if ((msize = H5Tget_size(wtype_id)) == 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); - - /* size of current dset */ - size_dset = nelmts * msize; - - /*------------------------------------------------------------------------- - * 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((travt->objs[i].name), dcpl_in) == 1) { - apply_s = 1; - apply_f = 1; - - /*------------------------------------------------------------------------- - * references are a special case - * we cannot just copy the buffers, but instead we recreate the reference - * in a second traversal of the output file - *------------------------------------------------------------------------- - */ - if (H5T_REFERENCE != H5Tget_class(wtype_id)) { - /* get the storage size of the input dataset */ - dsize_in = H5Dget_storage_size(dset_in); - - /* check for small size datasets (less than 1k) except - * changing to COMPACT. For the reference, COMPACT is limited - * by size 64K by library. - */ - if (options->layout_g != H5D_COMPACT) - if (size_dset < options->min_comp) - apply_s = 0; - - /* apply the filter */ - if (apply_s) - if (apply_filters(travt->objs[i].name, rank, dims, msize, dcpl_out, options, &has_filter) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "apply_filters failed"); - - /* only if layout change requested for entire file or - * individual obj */ - if (options->all_layout > 0 || req_obj_layout == 1) - /*------------------------------------------------- - * Unset the unlimited max dims if convert to other - * than chunk layouts, because unlimited max dims - * only can be applied to chunk layout. - * Also perform only for targeted dataset - * Also check for size limit to convert to compact - *-------------------------------------------------*/ - if (options->layout_g != H5D_CHUNKED) { - /* any dataset is specified */ - if (options->op_tbl->nelems > 0) { - /* if current obj match specified obj */ - if (options_get_object(travt->objs[i].name, options->op_tbl)) - limit_maxdims = TRUE; - } - else /* no dataset is specified */ - limit_maxdims = TRUE; - - /* if convert to COMPACT */ - if (options->layout_g == H5D_COMPACT) - /* should be smaller than 64K */ - if (size_dset > MAX_COMPACT_DSIZE) - limit_maxdims = FALSE; - - /* unset unlimited max dims */ - if (limit_maxdims) - H5Sset_extent_simple(f_space_id, rank, dims, NULL); - } - - /*------------------------------------------------------------------------- - * create the output dataset; - * disable error checking in case the dataset cannot be created with the - * modified dcpl; in that case use the original instead - *------------------------------------------------------------------------- - */ - dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id, H5P_DEFAULT, dcpl_out, H5P_DEFAULT); - if (dset_out == FAIL) { - H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, "H5Dcreate2 failed"); - if (options->verbose) - printf(" warning: could not create dataset <%s>. Applying original settings\n", travt->objs[i].name); - - if ((dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id, H5P_DEFAULT, dcpl_in, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dcreate2 failed"); - apply_f = 0; - } - - /*------------------------------------------------------------------------- - * read/write - *------------------------------------------------------------------------- - */ - if (nelmts > 0 && space_status != H5D_SPACE_STATUS_NOT_ALLOCATED) { - size_t need = (size_t)(nelmts * msize); /* bytes needed */ - - /* have to read the whole dataset if there is only one element in the dataset */ - if (need < H5TOOLS_MALLOCSIZE) - buf = HDmalloc(need); - - if (buf != NULL) { - /* read/write: use the macro to check error, e.g. memory allocation error inside the library. */ - CHECK_H5DRW_ERROR(H5Dread, FAIL, dset_in, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); - CHECK_H5DRW_ERROR(H5Dwrite, FAIL, dset_out, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); - - /* Check if we have VL data in the dataset's - * datatype that must be reclaimed */ - if (TRUE == H5Tdetect_class(wtype_id, H5T_VLEN)) - if (H5Dvlen_reclaim(wtype_id, f_space_id, H5P_DEFAULT, buf) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dvlen_reclaim failed"); - } - else { /* possibly not enough memory, read/write by hyperslabs */ - size_t p_type_nbytes = msize; /*size of memory type */ - hsize_t p_nelmts = nelmts; /*total elements */ - hsize_t elmtno; /*counter */ - int carry; /*counter carry value */ - unsigned int vl_data = 0; /*contains VL datatypes */ - - /* hyperslab info */ - hsize_t hslab_dims[H5S_MAX_RANK]; /*hyperslab dims */ - hsize_t hslab_nbytes; /*bytes per hyperslab */ - hsize_t hslab_nelmts; /*elements per hyperslab*/ - hid_t hslab_space; /*hyperslab data space */ - - /* hyperslab selection info */ - hsize_t hs_sel_offset[H5S_MAX_RANK];/* selection offset */ - hsize_t hs_sel_count[H5S_MAX_RANK]; /* selection count */ - hsize_t hs_select_nelmts; /* selected elements */ - hsize_t zero[8]; /*vector of zeros */ - int k; - H5D_layout_t dset_layout; - hid_t dcpl_tmp = -1; /* dataset creation property list ID */ - - /* check if we have VL data in the dataset's datatype */ - if (H5Tdetect_class(wtype_id, H5T_VLEN) == TRUE) - vl_data = TRUE; - - /* check first if writing dataset is chunked, - * if so use its chunk layout for better performance. */ - dset_layout = H5Pget_layout(dcpl_out); - if (dset_layout == H5D_CHUNKED) - dcpl_tmp = dcpl_out; /* writing dataset */ - else { /* if reading dataset is chunked */ - dset_layout = H5Pget_layout(dcpl_in); - if (dset_layout == H5D_CHUNKED) - dcpl_tmp = dcpl_in; /* reading dataset */ - } - - /* get hyperslab dims and size in byte */ - if (Get_hyperslab(dcpl_tmp, rank, dims, p_type_nbytes, hslab_dims, &hslab_nbytes) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Get_hyperslab failed"); - - hslab_buf = HDmalloc((size_t)hslab_nbytes); - - hslab_nelmts = hslab_nbytes / p_type_nbytes; - hslab_space = H5Screate_simple(1, &hslab_nelmts, NULL); - - /* the hyperslab selection loop */ - HDmemset(hs_sel_offset, 0, sizeof hs_sel_offset); - HDmemset(zero, 0, sizeof zero); - - for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_select_nelmts) { - if (rank > 0) { - /* calculate the hyperslab selections. - * The selection would be same as the hyperslab - * except for remaining edge portion of the dataset - * which is smaller then the hyperslab. - */ - for (k = 0, hs_select_nelmts = 1; k < rank; k++) { - /* MIN() is used to get the remaining edge portion if exist. - * "dims[k] - hs_sel_offset[k]" is remaining edge portion that is smaller then the hyperslab.*/ - hs_sel_count[k] = MIN(dims[k] - hs_sel_offset[k], hslab_dims[k]); - hs_select_nelmts *= hs_sel_count[k]; - } - - if (H5Sselect_hyperslab(f_space_id, H5S_SELECT_SET, hs_sel_offset, NULL, hs_sel_count, NULL) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); - if (H5Sselect_hyperslab(hslab_space, H5S_SELECT_SET, zero, NULL, &hs_select_nelmts, NULL) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); - } - else { - H5Sselect_all(f_space_id); - H5Sselect_all(hslab_space); - hs_select_nelmts = 1; - } /* rank */ - - /* read/write: use the macro to check error, e.g. memory allocation error inside the library. */ - CHECK_H5DRW_ERROR(H5Dread, FAIL, dset_in, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf); - CHECK_H5DRW_ERROR(H5Dwrite, FAIL, dset_out, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf); - - /* reclaim any VL memory, if necessary */ - if (vl_data) - H5Dvlen_reclaim(wtype_id, hslab_space, H5P_DEFAULT, hslab_buf); - - /* calculate the next hyperslab offset */ - for (k = rank, carry = 1; k > 0 && carry; --k) { - hs_sel_offset[k - 1] += hs_sel_count[k - 1]; - /* if reached the end of a dim */ - if (hs_sel_offset[k - 1] == dims[k - 1]) - hs_sel_offset[k - 1] = 0; - else - carry = 0; - } /* k */ - } /* elmtno */ - - H5Sclose(hslab_space); - /* free */ - if (hslab_buf != NULL) { - HDfree(hslab_buf); - hslab_buf = NULL; - } - } /* hyperslab read */ - } /* if (nelmts>0 && space_status==H5D_SPACE_STATUS_NOT_ALLOCATED) */ - - /*------------------------------------------------------------------------- - * amount of compression used - *------------------------------------------------------------------------- - */ - if (options->verbose) { - double ratio = 0; - - /* only print the compression ration if there was a filter request */ - if (apply_s && apply_f && req_filter) { - /* get the storage size of the output dataset */ - dsize_out = H5Dget_storage_size(dset_out); - - /* compression ratio = uncompressed size / compressed size */ - if (dsize_out != 0) - ratio = (double) dsize_in / (double) dsize_out; - print_dataset_info(dcpl_out, travt->objs[i].name, ratio, 1); - } - else - print_dataset_info(dcpl_in, travt->objs[i].name, ratio, 0); - - /* print a message that the filter was not applied - (in case there was a filter) - */ - if (has_filter && apply_s == 0) - printf(" <warning: filter not applied to %s. dataset smaller than %d bytes>\n", travt->objs[i].name, (int) options->min_comp); - - if (has_filter && apply_f == 0) - printf(" <warning: could not apply the filter to %s>\n", travt->objs[i].name); - } /* verbose */ - - /*------------------------------------------------------------------------- - * copy attrs - *------------------------------------------------------------------------- - */ - if (copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed"); - - /*close */ - if (H5Dclose(dset_out) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); - }/*!H5T_REFERENCE*/ - }/*h5tools_canreadf*/ - - /*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ - if (H5Tclose(ftype_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); - if (H5Tclose(wtype_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); - if (H5Pclose(dcpl_in) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - if (H5Pclose(dcpl_out) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - if (H5Sclose(f_space_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); - if (H5Dclose(dset_in) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); - } - /*------------------------------------------------------------------------- - * we do not have request for filter/chunking use H5Ocopy instead - *------------------------------------------------------------------------- - */ - else { - hid_t pid; - - /* create property to pass copy options */ - if ((pid = H5Pcreate(H5P_OBJECT_COPY)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed"); - - /* set options for object copy */ - if (H5Pset_copy_object(pid, H5O_COPY_WITHOUT_ATTR_FLAG) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_copy_object failed"); - - /*------------------------------------------------------------------------- - * do the copy - *------------------------------------------------------------------------- - */ - - if (H5Ocopy(fidin, /* Source file or group identifier */ - travt->objs[i].name, /* Name of the source object to be copied */ - fidout, /* Destination file or group identifier */ - travt->objs[i].name, /* Name of the destination object */ - pid, /* Properties which apply to the copy */ - H5P_DEFAULT) < 0) /* Properties which apply to the new hard link */ - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Ocopy failed"); - - /* close property */ - if (H5Pclose(pid) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - - /*------------------------------------------------------------------------- - * copy attrs manually - *------------------------------------------------------------------------- - */ - if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); - if ((dset_out = H5Dopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); - if (copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed"); - if (H5Dclose(dset_in) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); - if (H5Dclose(dset_out) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); - - if (options->verbose) - printf(FORMAT_OBJ, "dset", travt->objs[i].name); - - } /* end do we have request for filter/chunking */ - break; - - /*------------------------------------------------------------------------- - * H5TRAV_TYPE_NAMED_DATATYPE - *------------------------------------------------------------------------- - */ - case H5TRAV_TYPE_NAMED_DATATYPE: - if (options->verbose) - printf(FORMAT_OBJ, "type", travt->objs[i].name); - - if ((type_in = H5Topen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Topen2 failed"); - - /* Copy the datatype anonymously */ - if ((type_out = copy_named_datatype(type_in, fidout, &named_dt_head, travt, options)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_named_datatype failed"); - - /* Link in to group structure */ - if (H5Lcreate_hard(type_out, ".", fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Lcreate_hard failed"); - - /*------------------------------------------------------------------------- - * copy attrs - *------------------------------------------------------------------------- - */ - if (copy_attr(type_in, type_out, &named_dt_head, travt, options) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed"); - - if (H5Tclose(type_in) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); - if (H5Tclose(type_out) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); - - break; - - /*------------------------------------------------------------------------- - * H5TRAV_TYPE_LINK - * H5TRAV_TYPE_UDLINK - * - * Only handles external links; H5Lcopy will fail for other UD link types - * since we don't have creation or copy callbacks for them. - *------------------------------------------------------------------------- - */ - case H5TRAV_TYPE_LINK: - case H5TRAV_TYPE_UDLINK: - if (options->verbose) - printf(FORMAT_OBJ, "link", travt->objs[i].name); - - if (H5Lcopy(fidin, travt->objs[i].name, fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Lcopy failed"); - - if (options->verbose) - printf(FORMAT_OBJ, "link", travt->objs[i].name); - break; - - default: - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Object type not found"); - } /* switch */ - - /* free */ - if (buf != NULL) { - HDfree(buf); - buf = NULL; - } - } /* i */ - - /* Finalize (link) the stack of named datatypes (if any) */ - named_datatype_free(&named_dt_head, 0); - - return ret_value; - -done: - H5E_BEGIN_TRY - { - H5Gclose(grp_in); - H5Gclose(grp_out); - H5Pclose(dcpl_in); - H5Pclose(gcpl_in); - H5Pclose(gcpl_out); - H5Sclose(f_space_id); - H5Dclose(dset_in); - H5Dclose(dset_out); - H5Tclose(ftype_id); - H5Tclose(wtype_id); - H5Tclose(type_in); - H5Tclose(type_out); - named_datatype_free(&named_dt_head, 1); - }H5E_END_TRY; - - /* free */ - if (buf != NULL) - HDfree(buf); - if (hslab_buf != NULL) - HDfree(hslab_buf); - - return ret_value; -} - -/*------------------------------------------------------------------------- - * Function: print_dataset_info - * - * Purpose: print name, filters, percentage compression of a dataset - * - *------------------------------------------------------------------------- - */ -static void print_dataset_info(hid_t dcpl_id, char *objname, double ratio, - int pr) -{ - char strfilter[255]; -#if defined (PRINT_DEBUG ) - char temp[255]; -#endif - int nfilters; /* number of filters */ - unsigned filt_flags; /* filter flags */ - H5Z_filter_t filtn; /* filter identification number */ - unsigned cd_values[20]; /* filter client data values */ - size_t cd_nelmts; /* filter client number of values */ - char f_objname[256]; /* filter objname */ - int i; - - HDstrcpy(strfilter, "\0"); - - /* get information about input filters */ - if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0) - return; - - 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_objname), f_objname, NULL); - - switch (filtn) { - case H5Z_FILTER_NONE: - HDstrcat(strfilter, "NONE "); - break; - - case H5Z_FILTER_DEFLATE: - HDstrcat(strfilter, "GZIP "); - -#if defined (PRINT_DEBUG) - { - unsigned level = cd_values[0]; - - sprintf(temp,"(%d)", level); - HDstrcat(strfilter, temp); - } -#endif - break; - - case H5Z_FILTER_SZIP: - HDstrcat(strfilter, "SZIP "); - -#if defined (PRINT_DEBUG) - { - unsigned options_mask = cd_values[0]; /* from dcpl, not filt*/ - unsigned ppb = cd_values[1]; - - sprintf(temp,"(%d,", ppb); - HDstrcat(strfilter, temp); - if (options_mask & H5_SZIP_EC_OPTION_MASK) - HDstrcpy(temp, "EC) "); - else if (options_mask & H5_SZIP_NN_OPTION_MASK) - HDstrcpy(temp, "NN) "); - } - HDstrcat(strfilter, temp); -#endif - break; - - case H5Z_FILTER_SHUFFLE: - HDstrcat(strfilter, "SHUF "); - break; - - case H5Z_FILTER_FLETCHER32: - HDstrcat(strfilter, "FLET "); - break; - - case H5Z_FILTER_NBIT: - HDstrcat(strfilter, "NBIT "); - break; - - case H5Z_FILTER_SCALEOFFSET: - HDstrcat(strfilter, "SCALEOFFSET "); - break; - - default: - HDstrcat(strfilter, "UD "); - break; - } /* switch */ - }/*i*/ - - if (!pr) - printf(FORMAT_OBJ, "dset", objname); - else { - char str[255], temp[28]; - - HDstrcpy(str, "dset "); - HDstrcat(str, strfilter); - sprintf(temp, " (%.3f:1)", ratio); - HDstrcat(str, temp); - printf(FORMAT_OBJ, str, objname); - } -} - -/*------------------------------------------------------------------------- - * Function: copy_user_block - * - * Purpose: copy user block from one file to another - * - * Return: 0, ok, -1 no - * - * Programmer: Peter Cao - * - * Date: October, 25, 2007 - * - *------------------------------------------------------------------------- - */ -static int copy_user_block(const char *infile, const char *outfile, - hsize_t size) -{ - int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ - int infid = -1, outfid = -1; /* File descriptors */ - - /* User block must be any power of 2 equal to 512 or greater (512, 1024, 2048, etc.) */ - HDassert(size > 0); - - /* Open files */ - if ((infid = HDopen(infile, O_RDONLY, 0)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDopen failed"); - if ((outfid = HDopen(outfile, O_WRONLY, 0644)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDopen failed"); - - /* Copy the userblock from the input file to the output file */ - while (size > 0) { - ssize_t nread, nbytes; /* # of bytes transfered, etc. */ - char rbuf[USERBLOCK_XFER_SIZE]; /* Buffer for reading */ - const char *wbuf; /* Pointer into buffer, for writing */ - - /* Read buffer from source file */ - if (size > USERBLOCK_XFER_SIZE) - nread = HDread(infid, rbuf, (size_t)USERBLOCK_XFER_SIZE); - else - nread = HDread(infid, rbuf, (size_t)size); - if (nread < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDread failed"); - - /* Write buffer to destination file */ - /* (compensating for interrupted writes & checking for errors, etc.) */ - nbytes = nread; - wbuf = rbuf; - while (nbytes > 0) { - ssize_t nwritten; /* # of bytes written */ - - do { - nwritten = HDwrite(outfid, wbuf, (size_t)nbytes); - } while (-1 == nwritten && EINTR == errno); - if (-1 == nwritten) /* error */ - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDwrite failed"); - HDassert(nwritten > 0); - HDassert(nwritten <= nbytes); - - /* Update # of bytes left & offset in buffer */ - nbytes -= nwritten; - wbuf += nwritten; - HDassert(nbytes == 0 || wbuf < (rbuf + USERBLOCK_XFER_SIZE)); - } /* end while */ - - /* Update size of userblock left to transfer */ - size = size - (hsize_t) nread; - } /* end while */ - -done: - if (infid > 0) - HDclose(infid); - if (outfid > 0) - HDclose(outfid); - - return ret_value; -} - -/*------------------------------------------------------------------------- - * Function: print_user_block - * - * Purpose: print user block - * - * Return: 0, ok, -1 no - * - * Programmer: Pedro Vicente - * - * Date: August, 20, 2008 - * - *------------------------------------------------------------------------- - */ -#if defined (H5REPACK_DEBUG_USER_BLOCK) -static -void print_user_block(const char *filename, hid_t fid) -{ - int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ - int fh; /* file handle */ - hsize_t ub_size; /* user block size */ - hsize_t size; /* size read */ - hid_t fcpl; /* file creation property list ID for HDF5 file */ - int i; - - /* get user block size */ - if(( fcpl = H5Fget_create_plist(fid)) < 0) { - error_msg("failed to retrieve file creation property list\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Fget_create_plist failed"); - } - - if(H5Pget_userblock(fcpl, &ub_size) < 0) { - error_msg("failed to retrieve userblock size\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pget_userblock failed"); - } - - if(H5Pclose(fcpl) < 0) { - error_msg("failed to close property list\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); - } - - /* open file */ - if((fh = HDopen(filename, O_RDONLY, 0)) < 0) { - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDopen failed"); - } - - size = ub_size; - - /* read file */ - while(size > 0) { - ssize_t nread; /* # of bytes read */ - char rbuf[USERBLOCK_XFER_SIZE]; /* buffer for reading */ - - /* read buffer */ - if(size > USERBLOCK_XFER_SIZE) - nread = HDread(fh, rbuf, (size_t)USERBLOCK_XFER_SIZE); - else - nread = HDread(fh, rbuf, (size_t)size); - - for(i = 0; i < nread; i++) { - - printf("%c ", rbuf[i]); - - } - printf("\n"); - - if(nread < 0) { - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "nread < 0"); - } - - /* update size of userblock left to transfer */ - size -= nread; - } - -done: - if(fh > 0) - HDclose(fh); - - return; -} -#endif - diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c deleted file mode 100644 index e21b829..0000000 --- a/tools/h5repack/h5repack_filters.c +++ /dev/null @@ -1,493 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include "h5repack.h" -#include "h5tools.h" -#include "h5tools_utils.h" - -/* number of members in an array */ -#ifndef NELMTS -# define NELMTS(X) (sizeof(X)/sizeof(X[0])) -#endif - -/* minimum of two values */ -#undef MIN -#define MIN(a,b) (((a)<(b)) ? (a) : (b)) - -/*------------------------------------------------------------------------- - * Function: aux_find_obj - * - * Purpose: find the object name NAME (got from the traverse list) - * in the repack options list - * - *------------------------------------------------------------------------- - */ -static int -aux_find_obj(const char* name, /* object name from traverse list */ - pack_opt_t *options, /* repack options */ - pack_info_t *obj /*OUT*/) /* info about object to filter */ -{ - char *pdest; - int result; - unsigned int i; - - for ( i=0; i<options->op_tbl->nelems; i++) - { - if (HDstrcmp(options->op_tbl->objs[i].path,name)==0) - { - *obj = options->op_tbl->objs[i]; - return (int)i; - } - - pdest = HDstrstr(name,options->op_tbl->objs[i].path); - result = (int)(pdest - name); - - /* found at position 1, meaning without '/' */ - if( pdest != NULL && result==1 ) - { - *obj = options->op_tbl->objs[i]; - return (int)i; - } - }/*i*/ - - return -1; -} - - -/*------------------------------------------------------------------------- - * Function: aux_assign_obj - * - * Purpose: find the object name NAME (got from the traverse list) - * in the repack options list; assign the filter information OBJ - * - * Return: 0 not found, 1 found - * - *------------------------------------------------------------------------- - */ -static int -aux_assign_obj(const char* name, /* object name from traverse list */ - pack_opt_t *options, /* repack options */ - pack_info_t *obj /*OUT*/) /* info about object to filter */ -{ - - int idx, i; - pack_info_t tmp; - - init_packobject(&tmp); - - idx = aux_find_obj(name,options,&tmp); - - /* name was on input */ - if (idx>=0) - { - - - /* applying to all objects */ - if (options->all_layout) - { - /* assign the global layout info to the OBJ info */ - tmp.layout=options->layout_g; - switch (options->layout_g) - { - case H5D_CHUNKED: - tmp.chunk.rank=options->chunk_g.rank; - for ( i=0; i<tmp.chunk.rank; i++) - tmp.chunk.chunk_lengths[i]=options->chunk_g.chunk_lengths[i]; - break; - case H5D_LAYOUT_ERROR: - case H5D_COMPACT: - case H5D_CONTIGUOUS: - case H5D_VIRTUAL: - case H5D_NLAYOUTS: - break; - default: - break; - }/*switch*/ - } - else - { - tmp.layout = options->op_tbl->objs[idx].layout; - switch (tmp.layout) - { - case H5D_CHUNKED: - tmp.chunk.rank = options->op_tbl->objs[idx].chunk.rank; - for ( i=0; i<tmp.chunk.rank; i++) - tmp.chunk.chunk_lengths[i]=options->op_tbl->objs[idx].chunk.chunk_lengths[i]; - break; - case H5D_LAYOUT_ERROR: - case H5D_COMPACT: - case H5D_CONTIGUOUS: - case H5D_VIRTUAL: - case H5D_NLAYOUTS: - break; - default: - break; - }/*switch*/ - - } - - /* applying to all objects */ - if (options->all_filter) - { - /* assign the global filter */ - tmp.nfilters=1; - tmp.filter[0]=options->filter_g[0]; - } /* if all */ - else - { - tmp.nfilters=options->op_tbl->objs[idx].nfilters; - for ( i=0; i<tmp.nfilters; i++) - { - tmp.filter[i] = options->op_tbl->objs[idx].filter[i]; - } - } - - - } /* if idx */ - - - /* no input name */ - - else - { - - if (options->all_filter) - { - int k; - - /* assign the global filters */ - tmp.nfilters=options->n_filter_g; - for ( k = 0; k < options->n_filter_g; k++) - tmp.filter[k]=options->filter_g[k]; - } - if (options->all_layout) - { - /* assign the global layout info to the OBJ info */ - tmp.layout=options->layout_g; - switch (options->layout_g) - { - case H5D_CHUNKED: - tmp.chunk.rank=options->chunk_g.rank; - for ( i=0; i<tmp.chunk.rank; i++) - tmp.chunk.chunk_lengths[i]=options->chunk_g.chunk_lengths[i]; - break; - case H5D_LAYOUT_ERROR: - case H5D_COMPACT: - case H5D_CONTIGUOUS: - case H5D_VIRTUAL: - case H5D_NLAYOUTS: - break; - default: - break; - }/*switch*/ - } - } - - *obj = tmp; - return 1; - -} - - -/*------------------------------------------------------------------------- - * Function: apply_filters - * - * Purpose: apply the filters in the object to the property list; - * do extra checking in the case of SZIP; delete all filters in the case - * of H5Z_FILTER_NONE present in the PACK_INFO_T filter array - * - * Return: 0 success, -1 an error occured - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: December 19, 2003 - * - *------------------------------------------------------------------------- - */ - -int apply_filters(const char* name, /* object name from traverse list */ - int rank, /* rank of dataset */ - hsize_t *dims, /* dimensions of dataset */ - size_t msize, /* size of type */ - hid_t dcpl_id, /* dataset creation property list */ - pack_opt_t *options, /* repack options */ - int *has_filter) /* (OUT) object NAME has a filter */ - - -{ - int nfilters; /* number of filters in DCPL */ - hsize_t chsize[64]; /* chunk size in elements */ - H5D_layout_t layout; - int i; - pack_info_t obj; - - *has_filter = 0; - - if (rank==0) /* scalar dataset, do not apply */ - return 0; - - /*------------------------------------------------------------------------- - * initialize the assigment object - *------------------------------------------------------------------------- - */ - init_packobject(&obj); - - /*------------------------------------------------------------------------- - * find options - *------------------------------------------------------------------------- - */ - if (aux_assign_obj(name,options,&obj)==0) - return 0; - - /* get information about input filters */ - if ((nfilters = H5Pget_nfilters(dcpl_id))<0) - return -1; - - /*------------------------------------------------------------------------- - * check if we have filters in the pipeline - * we want to replace them with the input filters - * only remove if we are inserting new ones - *------------------------------------------------------------------------- - */ - if (nfilters && obj.nfilters ) - { - *has_filter = 1; - if (H5Premove_filter(dcpl_id,H5Z_FILTER_ALL)<0) - return -1; - } - - /*------------------------------------------------------------------------- - * check if there is an existent chunk - * read it only if there is not a requested layout - *------------------------------------------------------------------------- - */ - if (obj.layout == -1 ) - { - if ((layout = H5Pget_layout(dcpl_id))<0) - return -1; - - if (layout == H5D_CHUNKED) - { - if ((rank = H5Pget_chunk(dcpl_id,NELMTS(chsize),chsize/*out*/))<0) - return -1; - obj.layout = H5D_CHUNKED; - obj.chunk.rank = rank; - for ( i = 0; i < rank; i++) - obj.chunk.chunk_lengths[i] = chsize[i]; - } - } - - /*------------------------------------------------------------------------- - * the type of filter and additional parameter - * type can be one of the filters - * H5Z_FILTER_NONE 0 , uncompress if compressed - * H5Z_FILTER_DEFLATE 1 , deflation like gzip - * H5Z_FILTER_SHUFFLE 2 , shuffle the data - * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC - * H5Z_FILTER_SZIP 4 , szip compression - * H5Z_FILTER_NBIT 5 , nbit compression - * H5Z_FILTER_SCALEOFFSET 6 , scaleoffset compression - *------------------------------------------------------------------------- - */ - - if (obj.nfilters) - { - - /*------------------------------------------------------------------------- - * filters require CHUNK layout; if we do not have one define a default - *------------------------------------------------------------------------- - */ - if (obj.layout==-1) - { - - /* stripmine info */ - hsize_t sm_size[H5S_MAX_RANK]; /*stripmine size */ - hsize_t sm_nbytes; /*bytes per stripmine */ - - obj.chunk.rank = rank; - - /* - * determine the strip mine size. The strip mine is - * a hyperslab whose size is manageable. - */ - - - - sm_nbytes = msize; - for ( i = rank; i > 0; --i) - { - hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes; - if ( size == 0) /* datum size > H5TOOLS_BUFSIZE */ - size = 1; - sm_size[i - 1] = MIN(dims[i - 1], size); - sm_nbytes *= sm_size[i - 1]; - HDassert(sm_nbytes > 0); - - } - - for ( i = 0; i < rank; i++) - { - obj.chunk.chunk_lengths[i] = sm_size[i]; - } - - } - - for ( i=0; i<obj.nfilters; i++) - { - switch (obj.filter[i].filtn) - { - - /*------------------------------------------------------------------------- - * H5Z_FILTER_NONE 0 , uncompress if compressed - *------------------------------------------------------------------------- - */ - case H5Z_FILTER_NONE: - break; - - /*------------------------------------------------------------------------- - * H5Z_FILTER_DEFLATE 1 , deflation like gzip - *------------------------------------------------------------------------- - */ - case H5Z_FILTER_DEFLATE: - { - unsigned aggression; /* the deflate level */ - - aggression = obj.filter[i].cd_values[0]; - /* set up for deflated data */ - if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0) - return -1; - if(H5Pset_deflate(dcpl_id,aggression)<0) - return -1; - } - break; - - /*------------------------------------------------------------------------- - * H5Z_FILTER_SZIP 4 , szip compression - *------------------------------------------------------------------------- - */ - case H5Z_FILTER_SZIP: - { - unsigned options_mask; - unsigned pixels_per_block; - - options_mask = obj.filter[i].cd_values[0]; - pixels_per_block = obj.filter[i].cd_values[1]; - - /* set up for szip data */ - if(H5Pset_chunk(dcpl_id,obj.chunk.rank,obj.chunk.chunk_lengths)<0) - return -1; - if (H5Pset_szip(dcpl_id,options_mask,pixels_per_block)<0) - return -1; - - } - break; - - /*------------------------------------------------------------------------- - * H5Z_FILTER_SHUFFLE 2 , shuffle the data - *------------------------------------------------------------------------- - */ - case H5Z_FILTER_SHUFFLE: - if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0) - return -1; - if (H5Pset_shuffle(dcpl_id)<0) - return -1; - break; - - /*------------------------------------------------------------------------- - * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC - *------------------------------------------------------------------------- - */ - case H5Z_FILTER_FLETCHER32: - if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0) - return -1; - if (H5Pset_fletcher32(dcpl_id)<0) - return -1; - break; - /*----------- ------------------------------------------------------------- - * H5Z_FILTER_NBIT , NBIT compression - *------------------------------------------------------------------------- - */ - case H5Z_FILTER_NBIT: - if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0) - return -1; - if (H5Pset_nbit(dcpl_id)<0) - return -1; - break; - /*----------- ------------------------------------------------------------- - * H5Z_FILTER_SCALEOFFSET , scale+offset compression - *------------------------------------------------------------------------- - */ - - case H5Z_FILTER_SCALEOFFSET: - { - H5Z_SO_scale_type_t scale_type; - int scale_factor; - - scale_type = (H5Z_SO_scale_type_t)obj.filter[i].cd_values[0]; - scale_factor = (int)obj.filter[i].cd_values[1]; - - if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0) - return -1; - if (H5Pset_scaleoffset(dcpl_id,scale_type,scale_factor)<0) - return -1; - } - break; - default: - { - if (H5Pset_filter (dcpl_id, obj.filter[i].filtn, H5Z_FLAG_MANDATORY, obj.filter[i].cd_nelmts, obj.filter[i].cd_values)<0) - return -1; - if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0) - return -1; - } - break; - } /* switch */ - }/*i*/ - - } - /*obj.nfilters*/ - - /*------------------------------------------------------------------------- - * layout - *------------------------------------------------------------------------- - */ - - if (obj.layout>=0) - { - /* a layout was defined */ - if (H5Pset_layout(dcpl_id, obj.layout)<0) - return -1; - - if (H5D_CHUNKED == obj.layout) - { - if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0) - return -1; - } - else if (H5D_COMPACT == obj.layout) - { - if (H5Pset_alloc_time(dcpl_id, H5D_ALLOC_TIME_EARLY)<0) - return -1; - } - /* remove filters for the H5D_CONTIGUOUS case */ - else if (H5D_CONTIGUOUS == obj.layout) - { - if (H5Premove_filter(dcpl_id,H5Z_FILTER_ALL)<0) - return -1; - } - - } - - return 0; -} - diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c deleted file mode 100644 index 2d48a04..0000000 --- a/tools/h5repack/h5repack_main.c +++ /dev/null @@ -1,664 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include "h5tools.h" -#include "h5tools_utils.h" -#include "h5repack.h" - -/* Name of tool */ -#define PROGRAMNAME "h5repack" - -static int parse_command_line(int argc, const char **argv, pack_opt_t* options); -static void leave(int ret) H5_ATTR_NORETURN; - - -/* module-scoped variables */ -static int has_i_o = 0; -const char *infile = NULL; -const char *outfile = NULL; - -/* - * Command-line options: The user can specify short or long-named - * parameters. - */ -static const char *s_opts = "hVvf:l:m:e:nLc:d:s:u:b:M:t:a:i:o:S:T:E"; -static struct long_options l_opts[] = { - { "help", no_arg, 'h' }, - { "version", no_arg, 'V' }, - { "verbose", no_arg, 'v' }, - { "filter", require_arg, 'f' }, - { "layout", require_arg, 'l' }, - { "minimum", require_arg, 'm' }, - { "file", require_arg, 'e' }, - { "native", no_arg, 'n' }, - { "latest", no_arg, 'L' }, - { "compact", require_arg, 'c' }, - { "indexed", require_arg, 'd' }, - { "ssize", require_arg, 's' }, - { "ublock", require_arg, 'u' }, - { "block", require_arg, 'b' }, - { "metadata_block_size", require_arg, 'M' }, - { "threshold", require_arg, 't' }, - { "alignment", require_arg, 'a' }, - { "infile", require_arg, 'i' }, /* -i for backward compability */ - { "outfile", require_arg, 'o' }, /* -o for backward compability */ - { "fs_strategy", require_arg, 'S' }, - { "fs_threshold", require_arg, 'T' }, - { "enable-error-stack", no_arg, 'E' }, - { NULL, 0, '\0' } -}; - -/*------------------------------------------------------------------------- - * Function: usage - * - * Purpose: print usage - * - * Return: void - * - *------------------------------------------------------------------------- - */ -static void usage(const char *prog) { - FLUSHSTREAM(rawoutstream); - PRINTSTREAM(rawoutstream, "usage: %s [OPTIONS] file1 file2\n", prog); - PRINTVALSTREAM(rawoutstream, " file1 Input HDF5 File\n"); - PRINTVALSTREAM(rawoutstream, " file2 Output HDF5 File\n"); - PRINTVALSTREAM(rawoutstream, " OPTIONS\n"); - PRINTVALSTREAM(rawoutstream, " -h, --help Print a usage message and exit\n"); - PRINTVALSTREAM(rawoutstream, " -v, --verbose Verbose mode, print object information\n"); - PRINTVALSTREAM(rawoutstream, " -V, --version Print version number and exit\n"); - PRINTVALSTREAM(rawoutstream, " -n, --native Use a native HDF5 type when repacking\n"); - PRINTVALSTREAM(rawoutstream, " -L, --latest Use latest version of file format\n"); - PRINTVALSTREAM(rawoutstream, " -c L1, --compact=L1 Maximum number of links in header messages\n"); - PRINTVALSTREAM(rawoutstream, " -d L2, --indexed=L2 Minimum number of links in the indexed format\n"); - PRINTVALSTREAM(rawoutstream, " -s S[:F], --ssize=S[:F] Shared object header message minimum size\n"); - PRINTVALSTREAM(rawoutstream, " -m M, --minimum=M Do not apply the filter to datasets smaller than M\n"); - PRINTVALSTREAM(rawoutstream, " -e E, --file=E Name of file E with the -f and -l options\n"); - PRINTVALSTREAM(rawoutstream, " -u U, --ublock=U Name of file U with user block data to be added\n"); - PRINTVALSTREAM(rawoutstream, " -b B, --block=B Size of user block to be added\n"); - PRINTVALSTREAM(rawoutstream, " -M A, --metadata_block_size=A Metadata block size for H5Pset_meta_block_size\n"); - PRINTVALSTREAM(rawoutstream, " -t T, --threshold=T Threshold value for H5Pset_alignment\n"); - PRINTVALSTREAM(rawoutstream, " -a A, --alignment=A Alignment value for H5Pset_alignment\n"); - PRINTVALSTREAM(rawoutstream, " -f FILT, --filter=FILT Filter type\n"); - PRINTVALSTREAM(rawoutstream, " -l LAYT, --layout=LAYT Layout type\n"); - PRINTVALSTREAM(rawoutstream, " -S FS_STRGY, --fs_strategy=FS_STRGY File space management strategy\n"); - PRINTVALSTREAM(rawoutstream, " -T FS_THRD, --fs_threshold=FS_THRD Free-space section threshold\n"); - PRINTVALSTREAM(rawoutstream, "\n"); - PRINTVALSTREAM(rawoutstream, " M - is an integer greater than 1, size of dataset in bytes (default is 0) \n"); - PRINTVALSTREAM(rawoutstream, " E - is a filename.\n"); - PRINTVALSTREAM(rawoutstream, " S - is an integer\n"); - PRINTVALSTREAM(rawoutstream, " U - is a filename.\n"); - PRINTVALSTREAM(rawoutstream, " T - is an integer\n"); - PRINTVALSTREAM(rawoutstream, " A - is an integer greater than zero\n"); - PRINTVALSTREAM(rawoutstream, " B - is the user block size, any value that is 512 or greater and is\n"); - PRINTVALSTREAM(rawoutstream, " a power of 2 (1024 default)\n"); - PRINTVALSTREAM(rawoutstream, " F - is the shared object header message type, any of <dspace|dtype|fill|\n"); - PRINTVALSTREAM(rawoutstream, " pline|attr>. If F is not specified, S applies to all messages\n"); - PRINTVALSTREAM(rawoutstream, "\n"); - PRINTVALSTREAM(rawoutstream, " --enable-error-stack Prints messages from the HDF5 error stack as they\n"); - PRINTVALSTREAM(rawoutstream, " occur.\n"); - PRINTVALSTREAM(rawoutstream, "\n"); - PRINTVALSTREAM(rawoutstream, " FS_STRGY is the file space management strategy to use for the output file.\n"); - PRINTVALSTREAM(rawoutstream, " It is a string as listed below:\n"); - PRINTVALSTREAM(rawoutstream, " ALL_PERSIST - Use persistent free-space managers, aggregators and virtual file driver\n"); - PRINTVALSTREAM(rawoutstream, " for file space allocation\n"); - PRINTVALSTREAM(rawoutstream, " ALL - Use non-persistent free-space managers, aggregators and virtual file driver\n"); - PRINTVALSTREAM(rawoutstream, " for file space allocation\n"); - PRINTVALSTREAM(rawoutstream, " AGGR_VFD - Use aggregators and virtual file driver for file space allocation\n"); - PRINTVALSTREAM(rawoutstream, " VFD - Use virtual file driver for file space allocation\n"); - PRINTVALSTREAM(rawoutstream, "\n"); - PRINTVALSTREAM(rawoutstream, " FS_THRD is the free-space section threshold to use for the output file.\n"); - PRINTVALSTREAM(rawoutstream, " It is the minimum size (in bytes) of free-space sections to be tracked\n"); - PRINTVALSTREAM(rawoutstream, " by the the library's free-space managers.\n"); - PRINTVALSTREAM(rawoutstream, "\n"); - PRINTVALSTREAM(rawoutstream, " FILT - is a string with the format:\n"); - PRINTVALSTREAM(rawoutstream, "\n"); - PRINTVALSTREAM(rawoutstream, " <list of objects>:<name of filter>=<filter parameters>\n"); - PRINTVALSTREAM(rawoutstream, "\n"); - PRINTVALSTREAM(rawoutstream, " <list of objects> is a comma separated list of object names, meaning apply\n"); - PRINTVALSTREAM(rawoutstream, " compression only to those objects. If no names are specified, the filter\n"); - PRINTVALSTREAM(rawoutstream, " is applied to all objects\n"); - PRINTVALSTREAM(rawoutstream, " <name of filter> can be:\n"); - PRINTVALSTREAM(rawoutstream, " GZIP, to apply the HDF5 GZIP filter (GZIP compression)\n"); - PRINTVALSTREAM(rawoutstream, " SZIP, to apply the HDF5 SZIP filter (SZIP compression)\n"); - PRINTVALSTREAM(rawoutstream, " SHUF, to apply the HDF5 shuffle filter\n"); - PRINTVALSTREAM(rawoutstream, " FLET, to apply the HDF5 checksum filter\n"); - PRINTVALSTREAM(rawoutstream, " NBIT, to apply the HDF5 NBIT filter (NBIT compression)\n"); - PRINTVALSTREAM(rawoutstream, " SOFF, to apply the HDF5 Scale/Offset filter\n"); - PRINTVALSTREAM(rawoutstream, " UD, to apply a user defined filter\n"); - PRINTVALSTREAM(rawoutstream, " NONE, to remove all filters\n"); - PRINTVALSTREAM(rawoutstream, " <filter parameters> is optional filter parameter information\n"); - PRINTVALSTREAM(rawoutstream, " GZIP=<deflation level> from 1-9\n"); - PRINTVALSTREAM(rawoutstream, " SZIP=<pixels per block,coding> pixels per block is a even number in\n"); - PRINTVALSTREAM(rawoutstream, " 2-32 and coding method is either EC or NN\n"); - PRINTVALSTREAM(rawoutstream, " SHUF (no parameter)\n"); - PRINTVALSTREAM(rawoutstream, " FLET (no parameter)\n"); - PRINTVALSTREAM(rawoutstream, " NBIT (no parameter)\n"); - PRINTVALSTREAM(rawoutstream, " SOFF=<scale_factor,scale_type> scale_factor is an integer and scale_type\n"); - PRINTVALSTREAM(rawoutstream, " is either IN or DS\n"); - PRINTVALSTREAM(rawoutstream, " UD=<filter_number,cd_value_count,value_1[,value_2,...,value_N]>\n"); - PRINTVALSTREAM(rawoutstream, " required values for filter_number,cd_value_count,value_1\n"); - PRINTVALSTREAM(rawoutstream, " optional values for value_2 to value_N\n"); - PRINTVALSTREAM(rawoutstream, " NONE (no parameter)\n"); - PRINTVALSTREAM(rawoutstream, "\n"); - PRINTVALSTREAM(rawoutstream, " LAYT - is a string with the format:\n"); - PRINTVALSTREAM(rawoutstream, "\n"); - PRINTVALSTREAM(rawoutstream, " <list of objects>:<layout type>=<layout parameters>\n"); - PRINTVALSTREAM(rawoutstream, "\n"); - PRINTVALSTREAM(rawoutstream, " <list of objects> is a comma separated list of object names, meaning that\n"); - PRINTVALSTREAM(rawoutstream, " layout information is supplied for those objects. If no names are\n"); - PRINTVALSTREAM(rawoutstream, " specified, the layout type is applied to all objects\n"); - PRINTVALSTREAM(rawoutstream, " <layout type> can be:\n"); - PRINTVALSTREAM(rawoutstream, " CHUNK, to apply chunking layout\n"); - PRINTVALSTREAM(rawoutstream, " COMPA, to apply compact layout\n"); - PRINTVALSTREAM(rawoutstream, " CONTI, to apply contiguous layout\n"); - PRINTVALSTREAM(rawoutstream, " <layout parameters> is optional layout information\n"); - PRINTVALSTREAM(rawoutstream, " CHUNK=DIM[xDIM...xDIM], the chunk size of each dimension\n"); - PRINTVALSTREAM(rawoutstream, " COMPA (no parameter)\n"); - PRINTVALSTREAM(rawoutstream, " CONTI (no parameter)\n"); - PRINTVALSTREAM(rawoutstream, "\n"); - PRINTVALSTREAM(rawoutstream, "Examples of use:\n"); - PRINTVALSTREAM(rawoutstream, "\n"); - PRINTVALSTREAM(rawoutstream, "1) h5repack -v -f GZIP=1 file1 file2\n"); - PRINTVALSTREAM(rawoutstream, "\n"); - PRINTVALSTREAM(rawoutstream, " GZIP compression with level 1 to all objects\n"); - PRINTVALSTREAM(rawoutstream, "\n"); - PRINTVALSTREAM(rawoutstream, "2) h5repack -v -f dset1:SZIP=8,NN file1 file2\n"); - PRINTVALSTREAM(rawoutstream, "\n"); - PRINTVALSTREAM(rawoutstream, " SZIP compression with 8 pixels per block and NN coding method to object dset1\n"); - PRINTVALSTREAM(rawoutstream, "\n"); - PRINTVALSTREAM(rawoutstream, "3) h5repack -v -l dset1,dset2:CHUNK=20x10 -f dset3,dset4,dset5:NONE file1 file2\n"); - PRINTVALSTREAM(rawoutstream, "\n"); - PRINTVALSTREAM(rawoutstream, " Chunked layout, with a layout size of 20x10, to objects dset1 and dset2\n"); - PRINTVALSTREAM(rawoutstream, " and remove filters to objects dset3, dset4, dset5\n"); - PRINTVALSTREAM(rawoutstream, "\n"); - PRINTVALSTREAM(rawoutstream, "4) h5repack -L -c 10 -s 20:dtype file1 file2 \n"); - PRINTVALSTREAM(rawoutstream, "\n"); - PRINTVALSTREAM(rawoutstream, " Using latest file format with maximum compact group size of 10 and\n"); - PRINTVALSTREAM(rawoutstream, " and minimum shared datatype size of 20\n"); - PRINTVALSTREAM(rawoutstream, "\n"); - PRINTVALSTREAM(rawoutstream, "5) h5repack -f SHUF -f GZIP=1 file1 file2 \n"); - PRINTVALSTREAM(rawoutstream, "\n"); - PRINTVALSTREAM(rawoutstream, " Add both filters SHUF and GZIP in this order to all datasets\n"); - PRINTVALSTREAM(rawoutstream, "\n"); - PRINTVALSTREAM(rawoutstream, "6) h5repack -f UD=307,1,9 file1 file2 \n"); - PRINTVALSTREAM(rawoutstream, "\n"); - PRINTVALSTREAM(rawoutstream, " Add bzip2 filter to all datasets\n"); - PRINTVALSTREAM(rawoutstream, "\n"); -} - -/*------------------------------------------------------------------------- - * Function: leave - * - * Purpose: Shutdown MPI & HDF5 and call exit() - * - * Return: Does not return - * - * Programmer: Quincey Koziol - * Saturday, 31. January 2004 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static void leave(int ret) { - h5tools_close(); - - HDexit(ret); -} - -/*------------------------------------------------------------------------- - * Function: read_info - * - * Purpose: read comp and chunk options from a file - * - * Return: void, exit on error - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: September, 22, 2003 - * - *------------------------------------------------------------------------- - */ - -static -int read_info(const char *filename, pack_opt_t *options) { - - char stype[10]; - char comp_info[1024]; - FILE *fp = NULL; - char c; - int i, rc = 1; - int ret_value = EXIT_SUCCESS; - - if ((fp = HDfopen(filename, "r")) == (FILE *) NULL) { - error_msg("cannot open options file %s\n", filename); - h5tools_setstatus(EXIT_FAILURE); - ret_value = EXIT_FAILURE; - goto done; - } - - /* cycle until end of file reached */ - while (1) { - rc = fscanf(fp, "%s", stype); - if (rc == -1) - break; - - /*------------------------------------------------------------------------- - * filter - *------------------------------------------------------------------------- - */ - if (HDstrcmp(stype,"-f") == 0) { - /* find begining of info */ - i = 0; - c = '0'; - while (c != ' ') { - if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) { - error_msg("fscanf error\n"); - h5tools_setstatus(EXIT_FAILURE); - ret_value = EXIT_FAILURE; - goto done; - } /* end if */ - if (HDfeof(fp)) - break; - } - c = '0'; - /* go until end */ - while (c != ' ') { - if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) { - error_msg("fscanf error\n"); - h5tools_setstatus(EXIT_FAILURE); - ret_value = EXIT_FAILURE; - goto done; - } /* end if */ - comp_info[i] = c; - i++; - if (HDfeof(fp)) - break; - if (c == 10 /*eol*/) - break; - } - comp_info[i - 1] = '\0'; /*cut the last " */ - - if (h5repack_addfilter(comp_info, options) == -1) { - error_msg("could not add compression option\n"); - h5tools_setstatus(EXIT_FAILURE); - ret_value = EXIT_FAILURE; - goto done; - } - } - /*------------------------------------------------------------------------- - * layout - *------------------------------------------------------------------------- - */ - else if (HDstrcmp(stype,"-l") == 0) { - - /* find begining of info */ - i = 0; - c = '0'; - while (c != ' ') { - if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) { - error_msg("fscanf error\n"); - h5tools_setstatus(EXIT_FAILURE); - ret_value = EXIT_FAILURE; - goto done; - } /* end if */ - if (HDfeof(fp)) - break; - } - c = '0'; - /* go until end */ - while (c != ' ') { - if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) { - error_msg("fscanf error\n"); - h5tools_setstatus(EXIT_FAILURE); - ret_value = EXIT_FAILURE; - goto done; - } /* end if */ - comp_info[i] = c; - i++; - if (HDfeof(fp)) - break; - if (c == 10 /*eol*/) - break; - } - comp_info[i - 1] = '\0'; /*cut the last " */ - - if (h5repack_addlayout(comp_info, options) == -1) { - error_msg("could not add chunck option\n"); - h5tools_setstatus(EXIT_FAILURE); - ret_value = EXIT_FAILURE; - goto done; - } - } - /*------------------------------------------------------------------------- - * not valid - *------------------------------------------------------------------------- - */ - else { - error_msg("bad file format for %s", filename); - h5tools_setstatus(EXIT_FAILURE); - ret_value = EXIT_FAILURE; - goto done; - } - } - -done: - if (fp) - HDfclose(fp); - - return ret_value; -} - -/*------------------------------------------------------------------------- - * Function: parse_command_line - * - * Purpose: parse command line input - * - *------------------------------------------------------------------------- - */ - -static -int parse_command_line(int argc, const char **argv, pack_opt_t* options) { - - int opt; - int ret_value = 0; - - /* parse command line options */ - while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { - switch ((char) opt) { - - /* -i for backward compability */ - case 'i': - infile = opt_arg; - has_i_o = 1; - break; - - /* -o for backward compability */ - case 'o': - outfile = opt_arg; - has_i_o = 1; - break; - - case 'h': - usage(h5tools_getprogname()); - h5tools_setstatus(EXIT_SUCCESS); - ret_value = -1; - goto done; - - case 'V': - print_version(h5tools_getprogname()); - h5tools_setstatus(EXIT_SUCCESS); - ret_value = -1; - goto done; - - case 'v': - options->verbose = 1; - break; - - case 'f': - /* parse the -f filter option */ - if (h5repack_addfilter(opt_arg, options) < 0) { - error_msg("in parsing filter\n"); - h5tools_setstatus(EXIT_FAILURE); - ret_value = -1; - goto done; - } - break; - - case 'l': - /* parse the -l layout option */ - if (h5repack_addlayout(opt_arg, options) < 0) { - error_msg("in parsing layout\n"); - h5tools_setstatus(EXIT_FAILURE); - ret_value = -1; - goto done; - } - break; - - case 'm': - options->min_comp = HDstrtoull(opt_arg , NULL, 0); - if ((int) options->min_comp <= 0) { - error_msg("invalid minimum compress size <%s>\n", opt_arg); - h5tools_setstatus(EXIT_FAILURE); - ret_value = -1; - goto done; - } - break; - - case 'e': - ret_value = read_info(opt_arg, options); - if (ret_value < 0) - goto done; - break; - - case 'n': - options->use_native = 1; - break; - - case 'L': - options->latest = TRUE; - break; - - case 'c': - options->grp_compact = HDatoi( opt_arg ); - if (options->grp_compact > 0) - options->latest = TRUE; /* must use latest format */ - break; - - case 'd': - options->grp_indexed = HDatoi( opt_arg ); - if (options->grp_indexed > 0) - options->latest = TRUE; /* must use latest format */ - break; - - case 's': - { - int idx = 0; - int ssize = 0; - char *msgPtr = HDstrchr( opt_arg, ':'); - options->latest = TRUE; /* must use latest format */ - if (msgPtr == NULL) { - ssize = HDatoi( opt_arg ); - for (idx = 0; idx < 5; idx++) - options->msg_size[idx] = ssize; - } - else { - char msgType[10]; - HDstrcpy(msgType, msgPtr + 1); - msgPtr[0] = '\0'; - ssize = HDatoi( opt_arg ); - if (HDstrncmp(msgType, "dspace",6) == 0) { - options->msg_size[0] = ssize; - } - else if (HDstrncmp(msgType, "dtype", 5) == 0) { - options->msg_size[1] = ssize; - } - else if (HDstrncmp(msgType, "fill", 4) == 0) { - options->msg_size[2] = ssize; - } - else if (HDstrncmp(msgType, "pline", 5) == 0) { - options->msg_size[3] = ssize; - } - else if (HDstrncmp(msgType, "attr", 4) == 0) { - options->msg_size[4] = ssize; - } - } - } - break; - - case 'u': - options->ublock_filename = opt_arg; - break; - - case 'b': - options->ublock_size = (hsize_t) HDatol( opt_arg ); - break; - - case 'M': - options->meta_block_size = (hsize_t) HDatol( opt_arg ); - break; - - case 't': - options->threshold = (hsize_t) HDatol( opt_arg ); - break; - - case 'a': - options->alignment = HDstrtoull(opt_arg , NULL, 0); - if (options->alignment < 1) { - error_msg("invalid alignment size\n", opt_arg); - h5tools_setstatus(EXIT_FAILURE); - ret_value = -1; - goto done; - } - break; - - case 'S': - { - char strategy[MAX_NC_NAME]; - - HDstrcpy(strategy, opt_arg); - if (!HDstrcmp(strategy, "ALL_PERSIST")) - options->fs_strategy = H5F_FILE_SPACE_ALL_PERSIST; - else if (!HDstrcmp(strategy, "ALL")) - options->fs_strategy = H5F_FILE_SPACE_ALL; - else if (!HDstrcmp(strategy, "AGGR_VFD")) - options->fs_strategy = H5F_FILE_SPACE_AGGR_VFD; - else if (!HDstrcmp(strategy, "VFD")) - options->fs_strategy = H5F_FILE_SPACE_VFD; - else { - error_msg("invalid file space management strategy\n", opt_arg); - h5tools_setstatus(EXIT_FAILURE); - ret_value = -1; - goto done; - } - } - break; - - case 'T': - options->fs_threshold = (hsize_t) HDatol( opt_arg ); - break; - - case 'E': - enable_error_stack = TRUE; - break; - - default: - break; - } /* switch */ - - } /* while */ - - if (has_i_o == 0) { - /* check for file names to be processed */ - if (argc <= opt_ind || argv[opt_ind + 1] == NULL) { - error_msg("missing file names\n"); - usage(h5tools_getprogname()); - h5tools_setstatus(EXIT_FAILURE); - ret_value = -1; - } - } - -done: - return ret_value; -} - -/*------------------------------------------------------------------------- - * Function: main - * - * Purpose: h5repack main program - * - * Return: Success: EXIT_SUCCESS(0) - * - * Failure: EXIT_FAILURE(1) - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: May 9, 2003 - * - * Comments: - * - *------------------------------------------------------------------------- - */ -int main(int argc, const char **argv) { - H5E_auto2_t func; - H5E_auto2_t tools_func; - void *edata; - void *tools_edata; - - pack_opt_t options; /*the global options */ - - h5tools_setprogname(PROGRAMNAME); - h5tools_setstatus(EXIT_SUCCESS); - - /* Disable error reporting */ - H5Eget_auto2(H5E_DEFAULT, &func, &edata); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - - /* Initialize h5tools lib */ - h5tools_init(); - - /* Disable tools error reporting */ - H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata); - H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL); - - /* update hyperslab buffer size from H5TOOLS_BUFSIZE env if exist */ - if (h5tools_getenv_update_hyperslab_bufsize() < 0) { - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - - /* initialize options */ - h5repack_init(&options, 0, FALSE, H5F_FILE_SPACE_DEFAULT, (hsize_t) 0); - - if (parse_command_line(argc, argv, &options) < 0) - goto done; - - /* get file names if they were not yet got */ - if (has_i_o == 0) { - - if (argv[opt_ind] != NULL && argv[opt_ind + 1] != NULL) { - infile = argv[opt_ind]; - outfile = argv[opt_ind + 1]; - - if ( HDstrcmp( infile, outfile ) == 0) { - error_msg("file names cannot be the same\n"); - usage(h5tools_getprogname()); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - } - else { - error_msg("file names missing\n"); - usage(h5tools_getprogname()); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - } - - if (enable_error_stack) { - H5Eset_auto2(H5E_DEFAULT, func, edata); - H5Eset_auto2(H5tools_ERR_STACK_g, tools_func, tools_edata); - } - - /* pack it */ - h5tools_setstatus(h5repack(infile, outfile, &options)); - -done: - /* free tables */ - h5repack_end(&options); - - leave(h5tools_getstatus()); -} - diff --git a/tools/h5repack/h5repack_opttable.c b/tools/h5repack/h5repack_opttable.c deleted file mode 100644 index 8c98b76..0000000 --- a/tools/h5repack/h5repack_opttable.c +++ /dev/null @@ -1,367 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include "h5repack.h" -#include "h5tools.h" -#include "h5tools_utils.h" - -/*------------------------------------------------------------------------- - * Function: init_packobject - * - * Purpose: initialize a pack_info_t structure - * - * Return: void - * - *------------------------------------------------------------------------- - */ - -void init_packobject(pack_info_t *obj) { - int j, k; - - HDstrcpy(obj->path, "\0"); - for (j = 0; j < H5_REPACK_MAX_NFILTERS; j++) { - obj->filter[j].filtn = -1; - for (k = 0; k < CD_VALUES; k++) - obj->filter[j].cd_values[k] = 0; - } - obj->chunk.rank = -1; - obj->refobj_id = -1; - obj->layout = H5D_LAYOUT_ERROR; - obj->nfilters = 0; -} - -/*------------------------------------------------------------------------- - * Function: aux_tblinsert_filter - * - * Purpose: auxiliary function, inserts the filter in object OBJS[ I ] - * - * Return: void - * - *------------------------------------------------------------------------- - */ - -static void aux_tblinsert_filter(pack_opttbl_t *table, unsigned int I, - filter_info_t filt) { - if (table->objs[I].nfilters < H5_REPACK_MAX_NFILTERS) { - table->objs[I].filter[table->objs[I].nfilters++] = filt; - } - else { - error_msg( - "cannot insert the filter in this object.\ - Maximum capacity exceeded\n"); - } -} - -/*------------------------------------------------------------------------- - * Function: aux_tblinsert_layout - * - * Purpose: auxiliary function, inserts the layout in object OBJS[ I ] - * - * Return: void - * - *------------------------------------------------------------------------- - */ - -static void aux_tblinsert_layout(pack_opttbl_t *table, unsigned int I, - pack_info_t *pack) { - int k; - - table->objs[I].layout = pack->layout; - if (H5D_CHUNKED == pack->layout) { - /* -2 means the NONE option, remove chunking - and set the layout to contiguous */ - if (pack->chunk.rank == -2) { - table->objs[I].layout = H5D_CONTIGUOUS; - table->objs[I].chunk.rank = -2; - } - /* otherwise set the chunking type */ - else { - table->objs[I].chunk.rank = pack->chunk.rank; - for (k = 0; k < pack->chunk.rank; k++) - table->objs[I].chunk.chunk_lengths[k] = - pack->chunk.chunk_lengths[k]; - } - } -} - -/*------------------------------------------------------------------------- - * Function: aux_inctable - * - * Purpose: auxiliary function, increases the size of the collection by N_OBJS - * - * Return: 0, ok, -1, fail - * - *------------------------------------------------------------------------- - */ -static int -aux_inctable(pack_opttbl_t *table, unsigned n_objs) -{ - unsigned u; - - table->size += n_objs; - table->objs = (pack_info_t*) HDrealloc(table->objs, table->size * sizeof(pack_info_t)); - if (table->objs == NULL) { - error_msg("not enough memory for options table\n"); - return -1; - } - - for (u = table->nelems; u < table->size; u++) - init_packobject(&table->objs[u]); - - return 0; -} - - -/*------------------------------------------------------------------------- - * Function: options_table_init - * - * Purpose: init options table - * - * Return: 0, ok, -1, fail - * - *------------------------------------------------------------------------- - */ -int options_table_init(pack_opttbl_t **tbl) { - unsigned int i; - pack_opttbl_t *table; - - if (NULL == (table = (pack_opttbl_t *) HDmalloc(sizeof(pack_opttbl_t)))) { - error_msg("not enough memory for options table\n"); - return -1; - } - - table->size = 30; - table->nelems = 0; - if (NULL == (table->objs = - (pack_info_t*) HDmalloc(table->size * sizeof(pack_info_t)))) { - error_msg("not enough memory for options table\n"); - HDfree(table); - return -1; - } - - for (i = 0; i < table->size; i++) - init_packobject(&table->objs[i]); - - *tbl = table; - return 0; -} - - -/*------------------------------------------------------------------------- - * Function: options_table_free - * - * Purpose: free table memory - * - * Return: 0 - * - *------------------------------------------------------------------------- - */ - -int options_table_free(pack_opttbl_t *table) { - HDfree(table->objs); - HDfree(table); - return 0; -} - -/*------------------------------------------------------------------------- - * Function: options_add_layout - * - * Purpose: add a layout option to the option list - * - * Return: 0, ok, -1, fail - * - *------------------------------------------------------------------------- - */ -int -options_add_layout(obj_list_t *obj_list, unsigned n_objs, pack_info_t *pack, - pack_opttbl_t *table) -{ - unsigned i, j, I; - unsigned added = 0; - hbool_t found = FALSE; - - /* increase the size of the collection by N_OBJS if necessary */ - if (table->nelems + n_objs >= table->size) - if (aux_inctable(table, n_objs) < 0) - return -1; - - /* search if this object is already in the table; "path" is the key */ - if (table->nelems > 0) { - /* go tru the supplied list of names */ - for (j = 0; j < n_objs; j++) { - /* linear table search */ - for (i = 0; i < table->nelems; i++) { - /*already on the table */ - if (HDstrcmp(obj_list[j].obj,table->objs[i].path) == 0) { - /* already chunk info inserted for this one; exit */ - if (table->objs[i].chunk.rank > 0) { - error_msg("chunk information already inserted for <%s>\n", obj_list[j].obj); - HDexit(EXIT_FAILURE); - } - /* insert the layout info */ - else { - aux_tblinsert_layout(table, i, pack); - found = TRUE; - break; - } - } /* if */ - } /* i */ - - if (!found) { - /* keep the grow in a temp var */ - I = table->nelems + added; - added++; - HDstrcpy(table->objs[I].path, obj_list[j].obj); - aux_tblinsert_layout(table, I, pack); - } - /* cases where we have an already inserted name but there is a new name also - example: - -f dset1:GZIP=1 -l dset1,dset2:CHUNK=20x20 - dset1 is already inserted, but dset2 must also be - */ - else - if(found && HDstrcmp(obj_list[j].obj,table->objs[i].path) != 0) { - /* keep the grow in a temp var */ - I = table->nelems + added; - added++; - HDstrcpy(table->objs[I].path, obj_list[j].obj); - aux_tblinsert_layout(table, I, pack); - } - } /* j */ - } - /* first time insertion */ - else { - /* go tru the supplied list of names */ - for (j = 0; j < n_objs; j++) { - I = table->nelems + added; - added++; - HDstrcpy(table->objs[I].path, obj_list[j].obj); - aux_tblinsert_layout(table, I, pack); - } - } - - table->nelems += added; - - return 0; -} - -/*------------------------------------------------------------------------- - * Function: options_add_filter - * - * Purpose: add a compression -f option to the option list - * - * Return: 0, ok, -1, fail - * - *------------------------------------------------------------------------- - */ -int -options_add_filter(obj_list_t *obj_list, unsigned n_objs, filter_info_t filt, - pack_opttbl_t *table) -{ - unsigned int i, j, I; - unsigned added = 0; - hbool_t found = FALSE; - - /* increase the size of the collection by N_OBJS if necessary */ - if (table->nelems + n_objs >= table->size) - if (aux_inctable(table, n_objs) < 0) - return -1; - - /* search if this object is already in the table; "path" is the key */ - if (table->nelems > 0) { - /* go tru the supplied list of names */ - for (j = 0; j < n_objs; j++) { - /* linear table search */ - for (i = 0; i < table->nelems; i++) { - /*already on the table */ - if (HDstrcmp(obj_list[j].obj, table->objs[i].path) == 0) { - /* insert */ - aux_tblinsert_filter(table, i, filt); - found = TRUE; - break; - } /* if */ - } /* i */ - - if (!found) { - /* keep the grow in a temp var */ - I = table->nelems + added; - added++; - HDstrcpy(table->objs[I].path, obj_list[j].obj); - aux_tblinsert_filter(table, I, filt); - } - /* cases where we have an already inserted name but there is a new name also - example: - -l dset1:CHUNK=20x20 -f dset1,dset2:GZIP=1 - dset1 is already inserted, but dset2 must also be - */ - else - if(found && HDstrcmp(obj_list[j].obj,table->objs[i].path) != 0) { - /* keep the grow in a temp var */ - I = table->nelems + added; - added++; - HDstrcpy(table->objs[I].path, obj_list[j].obj); - aux_tblinsert_filter(table, I, filt); - } - } /* j */ - } - - /* first time insertion */ - else { - /* go tru the supplied list of names */ - for (j = 0; j < n_objs; j++) { - I = table->nelems + added; - added++; - HDstrcpy(table->objs[I].path, obj_list[j].obj); - aux_tblinsert_filter(table, I, filt); - } - } - - table->nelems += added; - - return 0; -} - -/*------------------------------------------------------------------------- - * Function: options_get_object - * - * Purpose: get object from table; "path" is the key - * - * Return: pack_info_t* OBJECT or NULL if not found; PATH is the key - * - *------------------------------------------------------------------------- - */ - -pack_info_t* options_get_object(const char *path, pack_opttbl_t *table) { - unsigned int i; - char tbl_path[MAX_NC_NAME + 1]; /* +1 for start with "/" case */ - - for (i = 0; i < table->nelems; i++) { - /* make full path (start with "/") to compare correctly */ - if (HDstrncmp(table->objs[i].path, "/", 1)) { - HDstrcpy(tbl_path, "/"); - HDstrcat(tbl_path, table->objs[i].path); - } - else - HDstrcpy(tbl_path, table->objs[i].path); - - /* found it */ - if (HDstrcmp(tbl_path, path) == 0) { - return (&table->objs[i]); - } - } - - return NULL; -} - diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c deleted file mode 100644 index 004b9e4..0000000 --- a/tools/h5repack/h5repack_parse.c +++ /dev/null @@ -1,616 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include "h5repack.h" -#include "h5tools.h" -#include "h5tools_utils.h" - -/*------------------------------------------------------------------------- - * Function: parse_filter - * - * Purpose: read filter information - * - * Return: a list of names, the number of names and its compression type - * - * <name of filter> can be: - * GZIP, to apply the HDF5 GZIP filter (GZIP compression) - * SZIP, to apply the HDF5 SZIP filter (SZIP compression) - * SHUF, to apply the HDF5 shuffle filter - * FLET, to apply the HDF5 checksum filter - * NBIT, to apply the HDF5 NBIT filter (NBIT compression) - * SOFF, to apply the HDF5 scale+offset filter (compression) - * UD, to apply a User Defined filter k,m,n1[,…,nm] - * NONE, to remove the filter - * - * Examples: - * "GZIP=6" - * "A,B:NONE" - *------------------------------------------------------------------------- - */ -obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, - pack_opt_t *options, int *is_glb) { - size_t i, m, u; - char c; - size_t len = HDstrlen(str); - int k, l, p, q, end_obj = -1, no_param = 0; - unsigned j, n; - char sobj[MAX_NC_NAME]; - char scomp[10]; - char stype[6]; - char smask[3]; - obj_list_t* obj_list = NULL; - unsigned pixels_per_block; - - /* initialize compression info */ - HDmemset(filt, 0, sizeof(filter_info_t)); - *is_glb = 0; - - /* check for the end of object list and number of objects */ - for (i = 0, n = 0; i < len; i++) { - c = str[i]; - if (c == ':') - end_obj = (int) i; - if (c == ',') - n++; - } - - /* Check for missing : */ - if (end_obj == -1) { - /* apply to all objects */ - options->all_filter = 1; - *is_glb = 1; - } - - n++; - obj_list = (obj_list_t *) HDmalloc(n * sizeof(obj_list_t)); - if (obj_list == NULL) { - error_msg("could not allocate object list\n"); - return NULL; - } - *n_objs = n; - - /* get object list */ - if (end_obj > 0) - for (j = 0, k = 0, n = 0; j < (unsigned) end_obj; j++, k++) { - c = str[j]; - sobj[k] = c; - if (c == ',' || j == (unsigned) (end_obj - 1)) { - if (c == ',') - sobj[k] = '\0'; - else - sobj[k + 1] = '\0'; - HDstrcpy(obj_list[n].obj, sobj); - HDmemset(sobj, 0, sizeof(sobj)); - n++; - k = -1; - } - } - /* nothing after : */ - if (end_obj + 1 == (int) len) { - if (obj_list) - HDfree(obj_list); - error_msg("input Error: Invalid compression type in <%s>\n", str); - HDexit(EXIT_FAILURE); - } - - /* get filter additional parameters */ - m = 0; - for (i = (size_t)(end_obj + 1), k = 0, j = 0; i < len; i++, k++) { - c = str[i]; - scomp[k] = c; - if (c == '=' || i == len - 1) { - if (c == '=') { /*one more parameter */ - scomp[k] = '\0'; /*cut space */ - - /*------------------------------------------------------------------------- - * H5Z_FILTER_SZIP - * szip has the format SZIP=<pixels per block,coding> - * pixels per block is a even number in 2-32 and coding method is 'EC' or 'NN' - * example SZIP=8,NN - *------------------------------------------------------------------------- - */ - if (HDstrcmp(scomp, "SZIP") == 0) { - l = -1; /* mask index check */ - for (m = 0, u = i + 1; u < len; u++, m++) { - if (str[u] == ',') { - stype[m] = '\0'; /* end digit of szip */ - l = 0; /* start EC or NN search */ - u++; /* skip ',' */ - } - c = str[u]; - if (!HDisdigit(c) && l == -1) { - if (obj_list) - HDfree(obj_list); - error_msg("compression parameter not digit in <%s>\n", str); - HDexit(EXIT_FAILURE); - } - if (l == -1) - stype[m] = c; - else { - smask[l] = c; - l++; - if (l == 2) { - smask[l] = '\0'; - i = len - 1; /* end */ - (*n_objs)--; /* we counted an extra ',' */ - if (HDstrcmp(smask,"NN") == 0) - filt->cd_values[j++] = H5_SZIP_NN_OPTION_MASK; - else if (HDstrcmp(smask,"EC") == 0) - filt->cd_values[j++] = H5_SZIP_EC_OPTION_MASK; - else { - error_msg("szip mask must be 'NN' or 'EC' \n"); - HDexit(EXIT_FAILURE); - } - } - } - } /* u */ - } /*if */ - - /*------------------------------------------------------------------------- - * H5Z_FILTER_SCALEOFFSET - * scaleoffset has the format SOFF=<scale_factor,scale_type> - * scale_type can be - * integer datatype, H5Z_SO_INT (IN) - * float datatype using D-scaling method, H5Z_SO_FLOAT_DSCALE (DS) - * float datatype using E-scaling method, H5Z_SO_FLOAT_ESCALE (ES) , not yet implemented - * for integer datatypes, scale_factor denotes Minimum Bits - * for float datatypes, scale_factor denotes decimal scale factor - * examples - * SOFF=31,IN - * SOFF=3,DF - *------------------------------------------------------------------------- - */ - else if (HDstrcmp(scomp, "SOFF") == 0) { - l = -1; /* mask index check */ - for (m = 0, u = i + 1; u < len; u++, m++) { - if (str[u] == ',') { - stype[m] = '\0'; /* end digit */ - l = 0; /* start 'IN' , 'DS', or 'ES' search */ - u++; /* skip ',' */ - } - c = str[u]; - if (!HDisdigit(c) && l == -1) { - if (obj_list) - HDfree(obj_list); - error_msg("compression parameter is not a digit in <%s>\n", str); - HDexit(EXIT_FAILURE); - } - if (l == -1) - stype[m] = c; - else { - smask[l] = c; - l++; - if (l == 2) { - smask[l] = '\0'; - i = len - 1; /* end */ - (*n_objs)--; /* we counted an extra ',' */ - if (HDstrcmp(smask,"IN") == 0) - filt->cd_values[j++] = H5Z_SO_INT; - else if (HDstrcmp(smask, "DS") == H5Z_SO_FLOAT_DSCALE) - filt->cd_values[j++] = H5Z_SO_FLOAT_DSCALE; - else { - error_msg("scale type must be 'IN' or 'DS' \n"); - HDexit(EXIT_FAILURE); - } - } - } - } /* u */ - } /*if */ - - /*------------------------------------------------------------------------- - * User Defined - * has the format UD=<filter_number,cd_value_count,value_1[,value_2,...,value_N]> - * BZIP2 example - * UD=307,1,9 - *------------------------------------------------------------------------- - */ - else if (HDstrcmp(scomp, "UD") == 0) { - l = -1; /* filter number index check */ - p = -1; /* CD_VAL count check */ - for (m = 0, q = 0, u = i + 1; u < len; u++, m++, q++) { - if (str[u] == ',') { - stype[q] = '\0'; /* end digit */ - if (l == -1) { - filt->filtn = HDatoi(stype); - l = 0; - } - else if (p == -1) { - filt->cd_nelmts = HDstrtoull(stype, NULL, 0); - p = 0; - } - else - filt->cd_values[j++] = (unsigned)HDstrtoul(stype, NULL, 0); - q = 0; - u++; /* skip ',' */ - } - c = str[u]; - if (!HDisdigit(c) && l == -1) { - if (obj_list) - HDfree(obj_list); - error_msg("filter number parameter is not a digit in <%s>\n", str); - HDexit(EXIT_FAILURE); - } - stype[q] = c; - } /* for u */ - stype[q] = '\0'; - } /*if */ - - /*------------------------------------------------------------------------- - * all other filters - *------------------------------------------------------------------------- - */ - else { - /* here we could have 1 or 2 digits */ - for (m = 0, u = i + 1; u < len; u++, m++) { - c = str[u]; - if (!HDisdigit(c)) { - if (obj_list) - HDfree(obj_list); - error_msg("compression parameter is not a digit in <%s>\n", str); - HDexit(EXIT_FAILURE); - } - stype[m] = c; - } /* u */ - - stype[m] = '\0'; - } /*if */ - - filt->cd_values[j++] = (unsigned) HDstrtoul(stype, NULL, 0); - if(filt->cd_nelmts == 0) - j = 0; - i += m; /* jump */ - } - else if (i == len - 1) { /*no more parameters */ - scomp[k + 1] = '\0'; - no_param = 1; - } - - /*------------------------------------------------------------------------- - * translate from string to filter symbol - *------------------------------------------------------------------------- - */ - - /*------------------------------------------------------------------------- - * H5Z_FILTER_NONE - *------------------------------------------------------------------------- - */ - if (HDstrcmp(scomp, "NONE") == 0) { - filt->filtn = H5Z_FILTER_NONE; - filt->cd_nelmts = 0; - } - - /*------------------------------------------------------------------------- - * H5Z_FILTER_DEFLATE - *------------------------------------------------------------------------- - */ - else if (HDstrcmp(scomp, "GZIP") == 0) { - filt->filtn = H5Z_FILTER_DEFLATE; - filt->cd_nelmts = 1; - if (no_param) { /*no more parameters, GZIP must have parameter */ - if (obj_list) - HDfree(obj_list); - error_msg("missing compression parameter in <%s>\n", str); - HDexit(EXIT_FAILURE); - } - } - - /*------------------------------------------------------------------------- - * H5Z_FILTER_SZIP - *------------------------------------------------------------------------- - */ - else if (HDstrcmp(scomp, "SZIP") == 0) { - filt->filtn = H5Z_FILTER_SZIP; - filt->cd_nelmts = 2; - if (no_param) { /*no more parameters, SZIP must have parameter */ - if (obj_list) - HDfree(obj_list); - error_msg("missing compression parameter in <%s>\n", str); - HDexit(EXIT_FAILURE); - } - } - - /*------------------------------------------------------------------------- - * H5Z_FILTER_SHUFFLE - *------------------------------------------------------------------------- - */ - else if (HDstrcmp(scomp, "SHUF") == 0) { - filt->filtn = H5Z_FILTER_SHUFFLE; - filt->cd_nelmts = 0; - if (m > 0) { /*shuffle does not have parameter */ - if (obj_list) - HDfree(obj_list); - error_msg("extra parameter in SHUF <%s>\n", str); - HDexit(EXIT_FAILURE); - } - } - /*------------------------------------------------------------------------- - * H5Z_FILTER_FLETCHER32 - *------------------------------------------------------------------------- - */ - else if (HDstrcmp(scomp, "FLET") == 0) { - filt->filtn = H5Z_FILTER_FLETCHER32; - filt->cd_nelmts = 0; - if (m > 0) { /*shuffle does not have parameter */ - if (obj_list) - HDfree(obj_list); - error_msg("extra parameter in FLET <%s>\n", str); - HDexit(EXIT_FAILURE); - } - } - /*------------------------------------------------------------------------- - * H5Z_FILTER_NBIT - *------------------------------------------------------------------------- - */ - else if (HDstrcmp(scomp, "NBIT") == 0) { - filt->filtn = H5Z_FILTER_NBIT; - filt->cd_nelmts = 0; - if (m > 0) { /*nbit does not have parameter */ - if (obj_list) - HDfree(obj_list); - error_msg("extra parameter in NBIT <%s>\n", str); - HDexit(EXIT_FAILURE); - } - } - /*------------------------------------------------------------------------- - * H5Z_FILTER_SCALEOFFSET - *------------------------------------------------------------------------- - */ - else if (HDstrcmp(scomp, "SOFF") == 0) { - filt->filtn = H5Z_FILTER_SCALEOFFSET; - filt->cd_nelmts = 2; - if (no_param) { /*no more parameters, SOFF must have parameter */ - if (obj_list) - HDfree(obj_list); - error_msg("missing compression parameter in <%s>\n", str); - HDexit(EXIT_FAILURE); - } - } - /*------------------------------------------------------------------------- - * User Defined Filter - *------------------------------------------------------------------------- - */ - else if (HDstrcmp(scomp, "UD") == 0) { - /* parameters does not match count */ - if (filt->cd_nelmts != j) { - if (obj_list) - HDfree(obj_list); - error_msg("incorrect number of compression parameters in <%s>\n", str); - HDexit(EXIT_FAILURE); - } - } - else { - if (obj_list) - HDfree(obj_list); - error_msg("invalid filter type in <%s>\n", str); - HDexit(EXIT_FAILURE); - } - } - } /*i*/ - - /*------------------------------------------------------------------------- - * check valid parameters - *------------------------------------------------------------------------- - */ - - switch (filt->filtn) { - /*------------------------------------------------------------------------- - * H5Z_FILTER_DEFLATE - *------------------------------------------------------------------------- - */ - case H5Z_FILTER_DEFLATE: - if (filt->cd_values[0] > 9) { - if (obj_list) - HDfree(obj_list); - error_msg("invalid compression parameter in <%s>\n", str); - HDexit(EXIT_FAILURE); - } - break; - /*------------------------------------------------------------------------- - * H5Z_FILTER_SZIP - *------------------------------------------------------------------------- - */ - case H5Z_FILTER_SZIP: - pixels_per_block = filt->cd_values[0]; - if ((pixels_per_block % 2) == 1) { - if (obj_list) - HDfree(obj_list); - error_msg("pixels_per_block is not even in <%s>\n", str); - HDexit(EXIT_FAILURE); - } - if (pixels_per_block > H5_SZIP_MAX_PIXELS_PER_BLOCK) { - if (obj_list) - HDfree(obj_list); - error_msg("pixels_per_block is too large in <%s>\n", str); - HDexit(EXIT_FAILURE); - } - if ((HDstrcmp(smask,"NN") != 0) && (HDstrcmp(smask,"EC") != 0)) { - if (obj_list) - HDfree(obj_list); - error_msg("szip mask must be 'NN' or 'EC' \n"); - HDexit(EXIT_FAILURE); - } - break; - default: - break; - }; - - return obj_list; -} - - -/*------------------------------------------------------------------------- - * Function: parse_layout - * - * Purpose: read layout info - * - * Return: a list of names, the number of names and its chunking info for - * chunked. NULL, on error - * the layout type can be: - * CHUNK, to apply chunking layout - * CONTI, to apply contiguous layout - * COMPA, to apply compact layout - * - * Example: - * "AA,B,CDE:CHUNK=10X10" - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: December 30, 2003 - * - *------------------------------------------------------------------------- - */ -obj_list_t* parse_layout(const char *str, unsigned *n_objs, pack_info_t *pack, /* info about layout needed */ -pack_opt_t *options) { - obj_list_t* obj_list = NULL; - unsigned i, j, n; - char c; - size_t len = HDstrlen(str); - int k, end_obj = -1, c_index; - char sobj[MAX_NC_NAME]; - char sdim[10]; - char slayout[10]; - - HDmemset(sdim, '\0', sizeof(sdim)); - HDmemset(sobj, '\0', sizeof(sobj)); - HDmemset(slayout, '\0', sizeof(slayout)); - - /* check for the end of object list and number of objects */ - for (i = 0, n = 0; i < len; i++) { - c = str[i]; - if (c == ':') - end_obj = (int) i; - if (c == ',') - n++; - } - - if (end_obj == -1) { /* missing : chunk all */ - options->all_layout = 1; - } - - n++; - obj_list = (obj_list_t*) HDmalloc(n * sizeof(obj_list_t)); - if (obj_list == NULL) { - error_msg("could not allocate object list\n"); - return NULL; - } - *n_objs = n; - - /* get object list */ - if (end_obj > 0) - for (j = 0, k = 0, n = 0; j < (unsigned) end_obj; j++, k++) { - c = str[j]; - sobj[k] = c; - if (c == ',' || j == (unsigned) (end_obj - 1)) { - if (c == ',') - sobj[k] = '\0'; - else - sobj[k + 1] = '\0'; - HDstrcpy(obj_list[n].obj, sobj); - HDmemset(sobj, 0, sizeof(sobj)); - n++; - k = -1; - } - } - - /* nothing after : */ - if (end_obj + 1 == (int) len) { - if (obj_list) - HDfree(obj_list); - error_msg("in parse layout, no characters after : in <%s>\n", str); - HDexit(EXIT_FAILURE); - } - - /* get layout info */ - for (j = (unsigned) (end_obj + 1), n = 0; n <= 5; j++, n++) { - if (n == 5) { - slayout[n] = '\0'; /*cut string */ - if (HDstrcmp(slayout, "COMPA") == 0) - pack->layout = H5D_COMPACT; - else if (HDstrcmp(slayout, "CONTI") == 0) - pack->layout = H5D_CONTIGUOUS; - else if (HDstrcmp(slayout, "CHUNK") == 0) - pack->layout = H5D_CHUNKED; - else { - error_msg("in parse layout, not a valid layout in <%s>\n", str); - HDexit(EXIT_FAILURE); - } - } - else { - c = str[j]; - slayout[n] = c; - } - } /* j */ - - if (pack->layout == H5D_CHUNKED) { - /*------------------------------------------------------------------------- - * get chunk info - *------------------------------------------------------------------------- - */ - k = 0; - if (j > len) { - if (obj_list) - HDfree(obj_list); - error_msg("in parse layout, <%s> Chunk dimensions missing\n", str); - HDexit(EXIT_FAILURE); - } - - for (i = j, c_index = 0; i < len; i++) { - c = str[i]; - sdim[k] = c; - k++; /*increment sdim index */ - - if (!HDisdigit(c) && c != 'x' && c != 'N' && c != 'O' && c != 'N' && c != 'E') { - if (obj_list) - HDfree(obj_list); - error_msg("in parse layout, <%s> Not a valid character in <%s>\n", sdim, str); - HDexit(EXIT_FAILURE); - } - - if (c == 'x' || i == len - 1) { - if (c == 'x') { - sdim[k - 1] = '\0'; - k = 0; - pack->chunk.chunk_lengths[c_index] = HDstrtoull(sdim, NULL, 0); - if (pack->chunk.chunk_lengths[c_index] == 0) { - if (obj_list) - HDfree(obj_list); - error_msg("in parse layout, <%s> conversion to number in <%s>\n", sdim, str); - HDexit(EXIT_FAILURE); - } - c_index++; - } - else if (i == len - 1) { /*no more parameters */ - sdim[k] = '\0'; - k = 0; - if (HDstrcmp(sdim,"NONE") == 0) { - pack->chunk.rank = -2; - } - else { - pack->chunk.chunk_lengths[c_index] = HDstrtoull(sdim, NULL, 0); - if (pack->chunk.chunk_lengths[c_index] == 0) { - if (obj_list) - HDfree(obj_list); - error_msg("in parse layout, <%s> conversion to number in <%s>\n", sdim, str); - HDexit(EXIT_FAILURE); - } - pack->chunk.rank = c_index + 1; - } - } /*if */ - } /*if c=='x' || i==len-1 */ - } /*i*/ - } /*H5D_CHUNKED*/ - - return obj_list; -} diff --git a/tools/h5repack/h5repack_plugin.sh.in b/tools/h5repack/h5repack_plugin.sh.in deleted file mode 100644 index c8d5bf7..0000000 --- a/tools/h5repack/h5repack_plugin.sh.in +++ /dev/null @@ -1,275 +0,0 @@ -#! /bin/sh -# -# Copyright by The HDF Group. -# All rights reserved. -# -# This file is part of HDF5. The full HDF5 copyright notice, including -# terms governing use, modification, and redistribution, is contained in -# the files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic document set and is -# linked from the top-level documents page. It can also be found at -# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have access -# to either file, you may request a copy from help@hdfgroup.org. -# -srcdir=@srcdir@ -TOP_BUILDDIR=@top_builddir@ - -# Determine backward compatibility options enabled -DEPRECATED_SYMBOLS="@DEPRECATED_SYMBOLS@" - -EXIT_SUCCESS=0 -EXIT_FAILURE=1 - -H5REPACK=h5repack # The tool name -H5REPACK_BIN=`pwd`/$H5REPACK # The path of the tool binary - -H5DUMP=../h5dump/h5dump # The h5dump tool name -H5DUMP_BIN=`pwd`/$H5DUMP # The path of the h5dump tool binary - -nerrors=0 -verbose=yes -exit_code=$EXIT_SUCCESS - -TEST_NAME=ud_plugin -FROM_DIR=`pwd`/.libs -PLUGIN_LIB="$FROM_DIR/libdynlibadd.*" -PLUGIN_LIB2="$FROM_DIR/libdynlibvers.*" -PLUGIN_LIBDIR=testdir3 -RM='rm -rf' - -GREP='grep' -CP='cp' -DIRNAME='dirname' -LS='ls' -AWK='awk' - -# source dirs -SRC_TOOLS="$srcdir/.." - -# testfiles source dirs for tools -SRC_H5REPACK_TESTFILES="$SRC_TOOLS/h5repack/testfiles" - -TESTDIR=testplug -test -d $TESTDIR || mkdir $TESTDIR - -###################################################################### -# test files -# -------------------------------------------------------------------- -# All the test files copy from source directory to test directory -# NOTE: Keep this framework to add/remove test files. -# Any test files from other tools can be used in this framework. -# This list are also used for checking exist. -# Comment '#' without space can be used. -# -------------------------------------------------------------------- -LIST_HDF5_TEST_FILES=" -$SRC_H5REPACK_TESTFILES/h5repack_layout.h5 -$SRC_H5REPACK_TESTFILES/h5repack_layout.h5-plugin_test.ddl -$SRC_H5REPACK_TESTFILES/plugin_test.h5repack_layout.h5.tst -$SRC_H5REPACK_TESTFILES/h5repack_layout.h5-plugin_version_test.ddl -$SRC_H5REPACK_TESTFILES/plugin_version_test.h5repack_layout.h5.tst -" -#$SRC_H5REPACK_TESTFILES/h5repack_layout.UD.h5 -#$SRC_H5REPACK_TESTFILES/h5repack_layout.UD.h5-plugin_none.ddl -#$SRC_H5REPACK_TESTFILES/plugin_none.h5repack_layout.UD.h5.tst -#" - -# -# copy test files and expected output files from source dirs to test dir -# -COPY_TESTFILES="$LIST_HDF5_TEST_FILES" - -# Main Body -# Create test directories if not exists yet. -test -d $PLUGIN_LIBDIR || mkdir -p $PLUGIN_LIBDIR -if [ $? != 0 ]; then - echo "Failed to create test directory($PLUGIN_LIBDIR)" - exit $EXIT_FAILURE -fi - -# copy plugin library for test -$CP $PLUGIN_LIB $PLUGIN_LIBDIR -if [ $? != 0 ]; then - echo "Failed to copy plugin library ($PLUGIN_LIB) for test." - exit $EXIT_FAILURE -fi -$CP $PLUGIN_LIB2 $PLUGIN_LIBDIR -if [ $? != 0 ]; then - echo "Failed to copy plugin library ($PLUGIN_LIB2) for test." - exit $EXIT_FAILURE -fi - -# setup plugin path -ENVCMD="env HDF5_PLUGIN_PATH=../${PLUGIN_LIBDIR}" - -COPY_TESTFILES_TO_TESTDIR() -{ - # copy test files. Used -f to make sure get a new copy - for tstfile in $COPY_TESTFILES - do - # ignore '#' comment - echo $tstfile | tr -d ' ' | grep '^#' > /dev/null - RET=$? - if [ $RET -eq 1 ]; then - # skip cp if srcdir is same as destdir - # this occurs when build/test performed in source dir and - # make cp fail - SDIR=`$DIRNAME $tstfile` - INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` - if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $CP -f $tstfile $TESTDIR - if [ $? -ne 0 ]; then - echo "Error: FAILED to copy $tstfile ." - - # Comment out this to CREATE expected file - exit $EXIT_FAILURE - fi - fi - fi - done -} - -CLEAN_TESTFILES_AND_TESTDIR() -{ - # skip rm if srcdir is same as destdir - # this occurs when build/test performed in source dir and - # make cp fail - SDIR=$SRC_H5REPACK_TESTFILES - INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` - if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $RM $TESTDIR - fi -} - -# Print a $* message left justified in a field of 70 characters -# -MESSAGE() { - SPACES=" " - echo "$* $SPACES" | cut -c1-70 | tr -d '\012' -} - -# Print a line-line message left justified in a field of 70 characters -# beginning with the word "Testing". -# -TESTING() { - SPACES=" " - echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' -} - -# Print a line-line message left justified in a field of 70 characters -# beginning with the word "Verifying". -# -VERIFY() { - MESSAGE "Verifying $*" -} - -# This is different from $srcdir/../../bin/output_filter.sh -STDOUT_FILTER() { - result_file=$1 - tmp_file=/tmp/h5test_tmp_$$ - # Filter name of files. - cp $result_file $tmp_file - sed -e '/^Opening file/d' -e '/^Making file/d' \ - < $tmp_file > $result_file - # cleanup - rm -f $tmp_file -} - -# This runs h5repack comparing output with h5dump output -# from -pH option -# -TOOLTEST_DUMP() -{ - echo $@ - infile=$2 - outfile=out-$1.$2 - expect1="$TESTDIR/$1.$2.tst" - actual1="$TESTDIR/$1.$2.out" - actual1_err="$TESTDIR/$1.$2.err" - expect2="$TESTDIR/$2-$1.ddl" - actual2="$TESTDIR/$2-$1.out" - actual2_err="$TESTDIR/$2-$1.err" - - shift - shift - - # Run test. - TESTING $H5REPACK $@ - ( - cd $TESTDIR - $ENVCMD $H5REPACK_BIN "$@" $infile $outfile - ) >$actual1 2>$actual1_err - RET=$? - STDOUT_FILTER $actual1 - cat $actual1_err >> $actual1 - if [ $RET != 0 ] ; then - echo "*FAILED*" - nerrors="`expr $nerrors + 1`" - else - echo " PASSED" - if cmp -s $expect1 $actual1; then - echo " PASSED" - else - echo "*FAILED*" - echo " Expected result (*.tst) differs from actual result (*.out)" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && diff -c $expect1 $actual1 |sed 's/^/ /' - fi - VERIFY h5dump output -pH $outfile - ( - cd $TESTDIR - $ENVCMD $H5DUMP_BIN -pH $outfile - ) >$actual2 2>$actual2_err - RET=$? - cat $actual2_err >> $actual2 - - if cmp -s $expect2 $actual2; then - echo " PASSED" - else - echo "*FAILED*" - echo " Expected result (*.ddl) differs from actual result (*.out)" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && diff -c $expect2 $actual2 |sed 's/^/ /' - fi - - fi - - - rm -f $actual1 $actual1_err $actual2 $actual2_err - rm -f $outfile -} - -############################################################################## -### T H E T E S T S -############################################################################## -# prepare for test -COPY_TESTFILES_TO_TESTDIR - -# Run the test -arg="h5repack_layout.h5 -v -f UD=260,4,9,1,9,235" -TOOLTEST_DUMP plugin_version_test $arg - -arg="h5repack_layout.h5 -v -f UD=257,1,9" -TOOLTEST_DUMP plugin_test $arg - -#arg="h5repack_layout.UD.h5 -v -f NONE" -#TOOLTEST_DUMP plugin_none $arg - -# print results -if test $nerrors -ne 0 ; then - echo "$nerrors errors encountered" - exit_code=$EXIT_FAILURE -else - echo "All Plugin API tests passed." - exit_code=$EXIT_SUCCESS -fi - -# Clean up temporary files/directories -CLEAN_TESTFILES_AND_TESTDIR - -# Clean up temporary files/directories and leave -$RM $PLUGIN_LIBDIR - -exit $exit_code diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c deleted file mode 100644 index f0f32c3..0000000 --- a/tools/h5repack/h5repack_refs.c +++ /dev/null @@ -1,877 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include "h5repack.h" -#include "h5diff.h" -#include "h5tools.h" - - -/*------------------------------------------------------------------------- - * local functions - *------------------------------------------------------------------------- - */ - -static const char* MapIdToName(hid_t refobj_id,trav_table_t *travt); -static int copy_refs_attr(hid_t loc_in, hid_t loc_out, pack_opt_t *options, - trav_table_t *travt, hid_t fidout); -static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in, - hid_t fid_out, void *ref_out, trav_table_t *travt); - -/*------------------------------------------------------------------------- - * Function: do_copy_refobjs - * - * Purpose: duplicate all referenced HDF5 objects in the file - * and create hard links - * - * Return: 0, ok, -1 no - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: December, 10, 2003 - * - *------------------------------------------------------------------------- - */ - -int do_copy_refobjs(hid_t fidin, - hid_t fidout, - trav_table_t *travt, - pack_opt_t *options) /* repack options */ -{ - int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ - hid_t grp_in = (-1); /* read group ID */ - hid_t grp_out = (-1); /* write group ID */ - hid_t dset_in = (-1); /* read dataset ID */ - hid_t dset_out = (-1); /* write dataset ID */ - hid_t type_in = (-1); /* named type ID */ - hid_t dcpl_id = (-1); /* dataset creation property list ID */ - hid_t space_id = (-1); /* space ID */ - hid_t ftype_id = (-1); /* file data type ID */ - hid_t mtype_id = (-1); /* memory data type ID */ - size_t msize; /* memory size of memory type */ - hsize_t nelmts; /* number of elements in dataset */ - int rank; /* rank of dataset */ - hsize_t dims[H5S_MAX_RANK]; /* dimensions of dataset */ - unsigned int i, j; - int k; - named_dt_t *named_dt_head=NULL; /* Pointer to the stack of named datatypes - copied */ - - /*------------------------------------------------------------------------- - * browse - *------------------------------------------------------------------------- - */ - for(i = 0; i < travt->nobjs; i++) { - switch(travt->objs[i].type) - { - /*------------------------------------------------------------------------- - * H5TRAV_TYPE_GROUP - *------------------------------------------------------------------------- - */ - case H5TRAV_TYPE_GROUP: - /*------------------------------------------------------------------------- - * copy referenced objects in attributes - *------------------------------------------------------------------------- - */ - if((grp_out = H5Gopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed"); - - if((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed"); - - if(copy_refs_attr(grp_in, grp_out, options, travt, fidout) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_refs_attr failed"); - - if(H5Gclose(grp_out) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed"); - if(H5Gclose(grp_in) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed"); - - /*------------------------------------------------------------------------- - * check for hard links - *------------------------------------------------------------------------- - */ - if(travt->objs[i].nlinks) - for(j = 0; j < travt->objs[i].nlinks; j++) - H5Lcreate_hard(fidout, travt->objs[i].name, H5L_SAME_LOC, travt->objs[i].links[j].new_name, H5P_DEFAULT, H5P_DEFAULT); - break; - - /*------------------------------------------------------------------------- - * H5TRAV_TYPE_DATASET - *------------------------------------------------------------------------- - */ - case H5TRAV_TYPE_DATASET: - if((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); - if((space_id = H5Dget_space(dset_in)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); - if((ftype_id = H5Dget_type(dset_in)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed"); - if((dcpl_id = H5Dget_create_plist(dset_in)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed"); - if((rank = H5Sget_simple_extent_ndims(space_id)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); - if(H5Sget_simple_extent_dims(space_id, dims, NULL) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); - nelmts = 1; - for(k = 0; k < rank; k++) - nelmts *= dims[k]; - - if((mtype_id = h5tools_get_native_type(ftype_id)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5tools_get_native_type failed"); - - if((msize = H5Tget_size(mtype_id)) == 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); - - /*------------------------------------------------------------------------- - * 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(NULL, dcpl_id) == 1) { - /*------------------------------------------------------------------------- - * test for a valid output dataset - *------------------------------------------------------------------------- - */ - dset_out = FAIL; - - /*------------------------------------------------------------------------- - * object references are a special case - * we cannot just copy the buffers, but instead we recreate the reference - *------------------------------------------------------------------------- - */ - if(H5Tequal(mtype_id, H5T_STD_REF_OBJ)) { - hid_t refobj_id; - hobj_ref_t *refbuf = NULL; /* buffer for object references */ - hobj_ref_t *buf = NULL; - const char* refname; - unsigned u; - - /*------------------------------------------------------------------------- - * read to memory - *------------------------------------------------------------------------- - */ - if(nelmts) { - buf = (hobj_ref_t *)HDmalloc((unsigned)(nelmts * msize)); - if(buf==NULL) { - printf("cannot read into memory\n" ); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); - } /* end if */ - if(H5Dread(dset_in, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); - - refbuf = (hobj_ref_t*) HDcalloc((unsigned)nelmts, msize); - if(refbuf == NULL){ - printf("cannot allocate memory\n" ); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDcalloc failed"); - } /* end if */ - for(u = 0; u < nelmts; u++) { - H5E_BEGIN_TRY { - if((refobj_id = H5Rdereference2(dset_in, H5P_DEFAULT, H5R_OBJECT, &buf[u])) < 0) - continue; - } H5E_END_TRY; - - /* get the name. a valid name could only occur - * in the second traversal of the file - */ - if((refname = MapIdToName(refobj_id, travt)) != NULL) { - /* create the reference, -1 parameter for objects */ - if(H5Rcreate(&refbuf[u], fidout, refname, H5R_OBJECT, (hid_t)-1) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rcreate failed"); - if(options->verbose) - { - printf(FORMAT_OBJ,"dset",travt->objs[i].name ); - printf("object <%s> object reference created to <%s>\n", - travt->objs[i].name, - refname); - } - } /*refname*/ - H5Oclose(refobj_id); - } /* u */ - } /*nelmts*/ - - /*------------------------------------------------------------------------- - * create/write dataset/close - *------------------------------------------------------------------------- - */ - if((dset_out = H5Dcreate2(fidout, travt->objs[i].name, mtype_id, space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dcreate2 failed"); - if(nelmts) - if(H5Dwrite(dset_out, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, refbuf) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dwrite failed"); - - if(buf) - HDfree(buf); - if(refbuf) - HDfree(refbuf); - - /*------------------------------------------------------ - * copy attrs - *----------------------------------------------------*/ - if(copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed"); - } /*H5T_STD_REF_OBJ*/ - - /*------------------------------------------------------------------------- - * dataset region references - *------------------------------------------------------------------------- - */ - else if(H5Tequal(mtype_id, H5T_STD_REF_DSETREG)) - { - hid_t refobj_id; - hdset_reg_ref_t *refbuf = NULL; /* input buffer for region references */ - hdset_reg_ref_t *buf = NULL; /* output buffer */ - const char* refname; - unsigned u; - - /*------------------------------------------------------------------------- - * read input to memory - *------------------------------------------------------------------------- - */ - if(nelmts) { - buf = (hdset_reg_ref_t *)HDmalloc((unsigned)(nelmts * msize)); - if(buf == NULL) { - printf("cannot read into memory\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); - } /* end if */ - if(H5Dread(dset_in, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); - - /*------------------------------------------------------------------------- - * create output - *------------------------------------------------------------------------- - */ - refbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */ - if(refbuf == NULL) { - printf("cannot allocate memory\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDcalloc failed"); - } /* end if */ - - for(u = 0; u < nelmts; u++) { - H5E_BEGIN_TRY { - if((refobj_id = H5Rdereference2(dset_in, H5P_DEFAULT, H5R_DATASET_REGION, &buf[u])) < 0) - continue; - } H5E_END_TRY; - - /* get the name. a valid name could only occur - * in the second traversal of the file - */ - if((refname = MapIdToName(refobj_id, travt)) != NULL) { - hid_t region_id; /* region id of the referenced dataset */ - - if((region_id = H5Rget_region(dset_in, H5R_DATASET_REGION, &buf[u])) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rget_region failed"); - - /* create the reference, we need the space_id */ - if(H5Rcreate(&refbuf[u], fidout, refname, H5R_DATASET_REGION, region_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rcreate failed"); - if(H5Sclose(region_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); - if(options->verbose) - { - printf(FORMAT_OBJ,"dset",travt->objs[i].name ); - printf("object <%s> region reference created to <%s>\n", - travt->objs[i].name, - refname); - } - } /*refname*/ - H5Oclose(refobj_id); - } /* u */ - } /*nelmts*/ - - /*------------------------------------------------------------------------- - * create/write dataset/close - *------------------------------------------------------------------------- - */ - if((dset_out = H5Dcreate2(fidout, travt->objs[i].name, mtype_id, space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dcreate2 failed"); - if(nelmts) - if(H5Dwrite(dset_out, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, refbuf) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dwrite failed"); - - if(buf) - HDfree(buf); - if(refbuf) - HDfree(refbuf); - - /*----------------------------------------------------- - * copy attrs - *----------------------------------------------------*/ - if(copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed"); - } /* H5T_STD_REF_DSETREG */ - /*------------------------------------------------------------------------- - * not references, open previously created object in 1st traversal - *------------------------------------------------------------------------- - */ - else { - if((dset_out = H5Dopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); - } /* end else */ - - HDassert(dset_out != FAIL); - - /*------------------------------------------------------------------------- - * copy referenced objects in attributes - *------------------------------------------------------------------------- - */ - if(copy_refs_attr(dset_in, dset_out, options, travt, fidout) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_refs_attr failed"); - - /*------------------------------------------------------------------------- - * check for hard links - *------------------------------------------------------------------------- - */ - if(travt->objs[i].nlinks) - for(j = 0; j < travt->objs[i].nlinks; j++) - H5Lcreate_hard(fidout, travt->objs[i].name, H5L_SAME_LOC, travt->objs[i].links[j].new_name, H5P_DEFAULT, H5P_DEFAULT); - - if(H5Dclose(dset_out) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); - } /*can_read*/ - - /*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ - if(H5Tclose(ftype_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); - if(H5Tclose(mtype_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); - if(H5Pclose(dcpl_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - if(H5Sclose(space_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); - if(H5Dclose(dset_in) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); - break; - - /*------------------------------------------------------------------------- - * H5TRAV_TYPE_NAMED_DATATYPE - *------------------------------------------------------------------------- - */ - case H5TRAV_TYPE_NAMED_DATATYPE: - if((type_in = H5Topen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Topen2 failed"); - if(H5Tclose(type_in) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); - break; - - /*------------------------------------------------------------------------- - * H5TRAV_TYPE_LINK - *------------------------------------------------------------------------- - */ - case H5TRAV_TYPE_LINK: - /*nothing to do */ - break; - - case H5TRAV_TYPE_UNKNOWN: - case H5TRAV_TYPE_UDLINK: - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5TRAV invalid type"); - - default: - break; - } /* end switch */ - } /* end for */ - - /* Finalize (link) the stack of named datatypes (if any) - * This function is paired with copy_named_datatype() which is called - * in copy_attr(), so need to free. - */ - named_datatype_free(&named_dt_head, 0); - - return ret_value; - -done: - H5E_BEGIN_TRY { - H5Gclose(grp_in); - H5Gclose(grp_out); - H5Pclose(dcpl_id); - H5Sclose(space_id); - H5Dclose(dset_in); - H5Dclose(dset_out); - H5Tclose(ftype_id); - H5Tclose(mtype_id); - H5Tclose(type_in); - named_datatype_free(&named_dt_head, 0); - } H5E_END_TRY; - - return ret_value; -} - - -/*------------------------------------------------------------------------- - * Function: copy_refs_attr - * - * Purpose: duplicate all referenced HDF5 located in attributes - * relative to LOC_IN, which is obtained either from - * loc_id = H5Gopen2(fid, name, H5P_DEFAULT); - * loc_id = H5Dopen2(fid, name, H5P_DEFAULT); - * loc_id = H5Topen2(fid, name, H5P_DEFAULT); - * - * Return: 0, ok, -1 no - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Modifier: xcao@hdfgroup.org, 9/12/2011 - * Update values of references(object and region) for the following types: - * 1) References, - * 2) ARRAY of reference, - * 3) VLEN of references. - * 4) COMPOUND of references. - * This function does not handle references in other complicated structures, - * such as references in nested compound datatypes. - * - * Date: October, 28, 2003 - * - *------------------------------------------------------------------------- - */ - -static int copy_refs_attr(hid_t loc_in, - hid_t loc_out, - pack_opt_t *options, - trav_table_t *travt, - hid_t fidout /* for saving references */ - ) -{ - int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ - hid_t attr_id = -1; /* attr ID */ - hid_t attr_out = -1; /* attr ID */ - hid_t space_id = -1; /* space ID */ - hid_t ftype_id = -1; /* file data type ID */ - hid_t mtype_id = -1; /* memory data type ID */ - size_t msize; /* memory size of type */ - hsize_t nelmts; /* number of elements in dataset */ - hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */ - char name[255]; - H5O_info_t oinfo; /* Object info */ - unsigned u, i, j; - int rank; - H5T_class_t type_class = -1; - hbool_t is_ref=0, is_ref_vlen=0, is_ref_array=0, is_ref_comp=0; - void *refbuf = NULL; - void *buf = NULL; - const char* refname = NULL; - unsigned *ref_comp_index = NULL; - size_t *ref_comp_size = NULL; - int ref_comp_field_n = 0; - - - if(H5Oget_info(loc_in, &oinfo) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info failed"); - - for(u = 0; u < (unsigned)oinfo.num_attrs; u++) { - is_ref = is_ref_vlen = is_ref_array = is_ref_comp = 0; - - /* open attribute */ - if((attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen_by_idx failed"); - - /* get the file datatype */ - if((ftype_id = H5Aget_type(attr_id)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_type failed"); - - type_class = H5Tget_class(ftype_id); - - if((mtype_id = h5tools_get_native_type(ftype_id)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5tools_get_native_type failed"); - - if((msize = H5Tget_size(mtype_id)) == 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); - - is_ref = (type_class == H5T_REFERENCE); - - if(type_class == H5T_VLEN ) { - hid_t base_type; - - base_type = H5Tget_super(ftype_id); - is_ref_vlen = (H5Tget_class(base_type)==H5T_REFERENCE); - msize = H5Tget_size(base_type); - H5Tclose(base_type); - } - else if(type_class == H5T_ARRAY ) { - hid_t base_type; - - base_type = H5Tget_super(ftype_id); - is_ref_array = (H5Tget_class(base_type)==H5T_REFERENCE); - msize = H5Tget_size(base_type); - H5Tclose(base_type); - } - else if(type_class == H5T_COMPOUND) { - int nmembers = H5Tget_nmembers(ftype_id) ; - - if (nmembers < 1) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed"); - - ref_comp_index = (unsigned *)HDmalloc((size_t)nmembers*sizeof(unsigned)); - ref_comp_size = (size_t *)HDmalloc((size_t)nmembers*sizeof(ref_comp_size)); - ref_comp_field_n = 0; - - for (i=0; i<(unsigned)nmembers; i++) { - hid_t mtid = H5Tget_member_type( ftype_id, i ); - - if ((H5Tget_class(mtid)==H5T_REFERENCE)) { - ref_comp_index[ref_comp_field_n] = i; - ref_comp_size[ref_comp_field_n] = H5Tget_size(mtid); - ref_comp_field_n++; - } - H5Tclose(mtid); - } - - /* if compound don't contain reference type member, free the above - * mallocs. Otherwise there can be memory leaks by the 'continue' - * statement below. */ - if (!ref_comp_field_n) { - if (ref_comp_index) { - HDfree(ref_comp_index); - ref_comp_index = NULL; - } - - if (ref_comp_size) { - HDfree(ref_comp_size); - ref_comp_size = NULL; - } - } - } - - is_ref_comp = (ref_comp_field_n > 0); - - if (!(is_ref || is_ref_vlen || is_ref_array || is_ref_comp)) { - H5Tclose(mtype_id); - H5Tclose(ftype_id); - H5Aclose(attr_id); - continue; - } - - /* get name */ - if(H5Aget_name(attr_id, 255, name) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_name failed"); - - /* get the dataspace handle */ - if((space_id = H5Aget_space(attr_id)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_space failed"); - - /* get dimensions */ - if((rank = H5Sget_simple_extent_dims(space_id, dims, NULL)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); - - - /*------------------------------------------------------------------------- - * elements - *------------------------------------------------------------------------- - */ - nelmts = 1; - for(j = 0; j < (unsigned)rank; j++) - nelmts *= dims[j]; - - if (is_ref_array) { - unsigned array_rank = 0; - hsize_t array_size = 1; - hsize_t array_dims[H5S_MAX_RANK]; - hid_t base_type; - - base_type = H5Tget_super(ftype_id); - msize = H5Tget_size(base_type); - H5Tclose(base_type); - - array_rank = (unsigned)H5Tget_array_ndims(mtype_id); - H5Tget_array_dims2(mtype_id, array_dims); - for(j = 0; j <array_rank; j++) - array_size *= array_dims[j]; - nelmts *= array_size; - } - - if((attr_out = H5Acreate2(loc_out, name, ftype_id, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Acreate2 failed"); - - if (nelmts>0) { - /* handle object references */ - if((is_ref || is_ref_array) && (H5R_OBJ_REF_BUF_SIZE==msize)) { - buf = (hobj_ref_t *)HDmalloc((unsigned)(nelmts * msize)); - if(buf == NULL) { - printf("cannot read into memory\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); - } /* end if */ - if(H5Aread(attr_id, mtype_id, buf) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aread failed"); - - refbuf = (hobj_ref_t *)HDcalloc((unsigned)nelmts, msize); - if(refbuf == NULL) { - printf("cannot allocate memory\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDcalloc failed"); - } /* end if */ - - for(i = 0; i < (unsigned)nelmts; i++) { - if (update_ref_value(attr_id, H5R_OBJECT, &((hobj_ref_t *)buf)[i], fidout, &((hobj_ref_t *)refbuf)[i], travt)<0) - continue; - if(options->verbose) - printf("object <%s> reference created to <%s>\n", name, refname); - } /* i */ - } /* H5T_STD_REF_OBJ */ - /* handle region references */ - else if((is_ref || is_ref_array) && (H5R_DSET_REG_REF_BUF_SIZE == msize)) { - buf = (hdset_reg_ref_t *)HDmalloc((unsigned)(nelmts * msize)); - - if(buf == NULL) { - printf( "cannot read into memory\n" ); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); - } /* end if */ - if(H5Aread(attr_id, mtype_id, buf) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aread failed"); - - /*------------------------------------------------------------------------- - * create output - *------------------------------------------------------------------------- - */ - refbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */ - if(refbuf == NULL) { - printf( "cannot allocate memory\n" ); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDcalloc failed"); - } /* end if */ - - for(i = 0; i < (unsigned)nelmts; i++) { - if (update_ref_value(attr_id, H5R_DATASET_REGION, &((hdset_reg_ref_t *)buf)[i], fidout, &((hdset_reg_ref_t *)refbuf)[i], travt)<0) - continue; - if(options->verbose) - printf("object <%s> region reference created to <%s>\n", name, refname); - } - } /* H5T_STD_REF_DSETREG */ - else if (is_ref_vlen) { - /* handle VLEN of references */ - - buf = (hvl_t *)HDmalloc((unsigned)(nelmts * sizeof(hvl_t))); - refbuf = buf; /* reuse the read buffer for write */ - - if(buf == NULL) { - printf( "cannot read into memory\n" ); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); - } /* end if */ - - if(H5Aread(attr_id, mtype_id, buf) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aread failed"); - - if (H5R_OBJ_REF_BUF_SIZE==msize) { - hobj_ref_t ref_out; - - for (i=0; i<(unsigned)nelmts; i++) { - hobj_ref_t *ptr = (hobj_ref_t *)((hvl_t *)buf)[i].p; - - for (j=0; j<((hvl_t *)buf)[i].len; j++ ) { - if (update_ref_value(attr_id, H5R_OBJECT, &(ptr[j]), fidout, &ref_out, travt)<0) - continue; - HDmemcpy(&(ptr[j]), &ref_out, msize); - } - } /* for (i=0; i<nelems; i++) */ - } else if (H5R_DSET_REG_REF_BUF_SIZE == msize) { - hdset_reg_ref_t ref_out; - - for (i=0; i<(unsigned)nelmts; i++) { - hdset_reg_ref_t *ptr = (hdset_reg_ref_t *)((hvl_t *)buf)[i].p; - - for (j=0; j<((hvl_t *)buf)[i].len; j++ ) { - if (update_ref_value(attr_id, H5R_DATASET_REGION, &(ptr[j]), fidout, &ref_out, travt)<0) - continue; - HDmemcpy(&(ptr[j]), &ref_out, msize); - } - } /* for (i=0; i<nelems; i++) */ - } - } /* else if (is_ref_vlen) */ - else if (is_ref_comp) { - /* handle ref fields in a compound */ - - buf = HDmalloc((unsigned)(nelmts * msize)); - refbuf = buf; /* reuse the read buffer for write */ - - if(buf == NULL) - { - printf( "cannot read into memory\n" ); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); - } /* end if */ - - if(H5Aread(attr_id, mtype_id, buf) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aread failed"); - - for (i=0; i<(unsigned)nelmts; i++) { - for (j=0; j<(unsigned)ref_comp_field_n; j++) { - if (ref_comp_size[j] == H5R_OBJ_REF_BUF_SIZE) { - size_t idx = (i * msize) + H5Tget_member_offset(mtype_id, ref_comp_index[j]); - hobj_ref_t ref_out; - - if (update_ref_value(attr_id, H5R_OBJECT, (hobj_ref_t *)(((char *)buf)+idx), fidout, &ref_out, travt)<0) - continue; - HDmemcpy(((char *)buf)+idx, &ref_out, ref_comp_size[j]); - } /* if */ - else if (ref_comp_size[j] == H5R_DSET_REG_REF_BUF_SIZE) { - size_t idx = i * msize + H5Tget_member_offset(mtype_id, ref_comp_index[j]); - hdset_reg_ref_t ref_out; - - if (update_ref_value(attr_id, H5R_DATASET_REGION, (hdset_reg_ref_t *)(((char *)buf)+idx), fidout, &ref_out, travt)<0) - continue; - HDmemcpy(((char *)buf)+idx, &ref_out, ref_comp_size[j]); - } /* else if */ - } /* j */ - } /* i */ - } /* else if (is_ref_comp) */ - - if(H5Awrite(attr_out, mtype_id, refbuf) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Awrite failed"); - - if (is_ref_vlen && buf) - H5Dvlen_reclaim (mtype_id, space_id, H5P_DEFAULT, buf); - } /* if (nelmts) */ - - if (refbuf == buf) - refbuf = NULL; /* set it to NULL to avoid double free since buf and refbuf are the same. */ - - if(buf) { - HDfree(buf); - buf = NULL; - } - - if(refbuf) { - HDfree(refbuf); - refbuf = NULL; - } - - if (ref_comp_index) { - HDfree(ref_comp_index); - ref_comp_index = NULL; - } - - if (ref_comp_size) { - HDfree(ref_comp_size); - ref_comp_size = NULL; - } - - if(H5Aclose(attr_out) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose failed"); - - /*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ - if(H5Tclose(ftype_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); - if(H5Tclose(mtype_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); - if(H5Sclose(space_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); - if(H5Aclose(attr_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose failed"); - } /* for(u = 0; u < (unsigned)oinfo.num_attrs; u++) */ - - return ret_value; - -done: - if(refbuf) - HDfree(refbuf); - if(buf) - HDfree(buf); - - if (ref_comp_index) - HDfree(ref_comp_index); - - if (ref_comp_size) - HDfree(ref_comp_size); - - H5E_BEGIN_TRY { - H5Tclose(ftype_id); - H5Tclose(mtype_id); - H5Sclose(space_id); - H5Aclose(attr_id); - H5Aclose(attr_out); - } H5E_END_TRY; - - return ret_value; -} - -/*------------------------------------------------------------------------- - * Function: MapIdToName - * - * Purpose: map a ID from a reference to a dataset name - * - *------------------------------------------------------------------------- - */ -static const char* -MapIdToName(hid_t refobj_id, trav_table_t *travt) -{ - unsigned int u; - const char* ret = NULL; - - /* linear search */ - for(u = 0; u < travt->nobjs; u++) { - if(travt->objs[u].type == (h5trav_type_t)H5O_TYPE_DATASET || - travt->objs[u].type == (h5trav_type_t)H5O_TYPE_GROUP || - travt->objs[u].type == (h5trav_type_t)H5O_TYPE_NAMED_DATATYPE) { - H5O_info_t ref_oinfo; /* Stat for the refobj id */ - - /* obtain information to identify the referenced object uniquely */ - if(H5Oget_info(refobj_id, &ref_oinfo) < 0) - goto out; - - if(ref_oinfo.addr == travt->objs[u].objno) { - ret = travt->objs[u].name; - goto out; - } /* end if */ - } /* end if */ - } /* u */ - -out: - return ret; -} - -/*------------------------------------------------------------------------- - * Function: Update_Ref_value - * - * Purpose: Update a reference value - * - * Programmer: xcao@hdfgroup.org 9/12/2011 - * - *------------------------------------------------------------------------- - */ -static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in, - hid_t fid_out, void *ref_out, trav_table_t *travt) -{ - int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ - const char* ref_obj_name; - hid_t space_id=-1, ref_obj_id=-1; - - ref_obj_id = H5Rdereference2(obj_id, H5P_DEFAULT, ref_type, ref_in); - if (ref_obj_id < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rdereference2 failed"); - - ref_obj_name = MapIdToName(ref_obj_id, travt); - if (ref_obj_name == NULL) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "MapIdToName failed"); - - if (ref_type == H5R_DATASET_REGION) { - space_id = H5Rget_region(obj_id, H5R_DATASET_REGION, ref_in); - if (space_id < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rget_region failed"); - } - - if(H5Rcreate(ref_out, fid_out, ref_obj_name, ref_type, space_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rcreate failed"); - -done: - H5E_BEGIN_TRY { - H5Sclose(space_id); - H5Oclose(ref_obj_id); - } H5E_END_TRY; - - return ret_value; -} - diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c deleted file mode 100644 index 6765c49..0000000 --- a/tools/h5repack/h5repack_verify.c +++ /dev/null @@ -1,675 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include "h5repack.h" -#include "h5tools.h" -#include "h5tools_utils.h" - -/* number of members in an array */ -#ifndef NELMTS -# define NELMTS(X) (sizeof(X)/sizeof(X[0])) -#endif - -static int verify_layout(hid_t pid, pack_info_t *obj); -static int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter); - - -/*------------------------------------------------------------------------- - * Function: h5repack_verify - * - * Purpose: verify if filters and layout in the input file match the output file - * - * Return: - * 1 match - * 0 do not match - * -1 error - * - * Programmer: Pedro Vicente, pvn@hdfgroup.org - * - * Date: December 19, 2003 - * Modified: December, 19, 2007 (exactly 4 years later :-) ) - * Separate into 3 cases - * 1) no filter input, get all datasets and compare DCPLs. TO DO - * 2) filter input on selected datasets, get each one trough OBJ and match - * 3) filter input on all datasets, get all objects and match - * - *------------------------------------------------------------------------- - */ - -int -h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options) -{ - int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ - hid_t fidin = -1; /* file ID for input file*/ - hid_t fidout = -1; /* file ID for output file*/ - hid_t did = -1; /* dataset ID */ - hid_t pid = -1; /* dataset creation property list ID */ - hid_t sid = -1; /* space ID */ - hid_t tid = -1; /* type ID */ - unsigned int i; - trav_table_t *travt = NULL; - int ok = 1; - hid_t fcpl_in = -1; /* file creation property for input file */ - hid_t fcpl_out = -1; /* file creation property for output file */ - H5F_file_space_type_t in_strat, out_strat; /* file space handling strategy for in/output file */ - hsize_t in_thresh, out_thresh; /* free space section threshold for in/output file */ - - /* open the output file */ - if((fidout = H5Fopen(out_fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 ) - return -1; - - for(i = 0; i < options->op_tbl->nelems; i++) - { - char* name = options->op_tbl->objs[i].path; - pack_info_t *obj = &options->op_tbl->objs[i]; - - /*------------------------------------------------------------------------- - * open - *------------------------------------------------------------------------- - */ - if((did = H5Dopen2(fidout, name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); - if((sid = H5Dget_space(did)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); - if((pid = H5Dget_create_plist(did)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed"); - if((tid = H5Dget_type(did)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed"); - - /*------------------------------------------------------------------------- - * filter check - *------------------------------------------------------------------------- - */ - if(verify_filters(pid, tid, obj->nfilters, obj->filter) <= 0) - ok = 0; - - - /*------------------------------------------------------------------------- - * layout check - *------------------------------------------------------------------------- - */ - if((obj->layout != -1) && (verify_layout(pid, obj) == 0)) - ok = 0; - - /*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ - if(H5Pclose(pid) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - if (H5Sclose(sid) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); - if (H5Dclose(did) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); - if (H5Tclose(tid) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); - - } - - - /*------------------------------------------------------------------------- - * check for the "all" objects option - *------------------------------------------------------------------------- - */ - - if(options->all_filter == 1 || options->all_layout == 1) - { - - /* init table */ - trav_table_init(&travt); - - /* get the list of objects in the file */ - if(h5trav_gettable(fidout, travt) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5trav_gettable failed"); - - for(i = 0; i < travt->nobjs; i++) - { - char *name = travt->objs[i].name; - - if(travt->objs[i].type == H5TRAV_TYPE_DATASET) - { - - /*------------------------------------------------------------------------- - * open - *------------------------------------------------------------------------- - */ - if((did = H5Dopen2(fidout, name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); - if((sid = H5Dget_space(did)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); - if((pid = H5Dget_create_plist(did)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed"); - if((tid = H5Dget_type(did)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed"); - - /*------------------------------------------------------------------------- - * filter check - *------------------------------------------------------------------------- - */ - if(options->all_filter == 1) - { - if(verify_filters(pid, tid, options->n_filter_g, options->filter_g) <= 0) - ok = 0; - } - - /*------------------------------------------------------------------------- - * layout check - *------------------------------------------------------------------------- - */ - if(options->all_layout == 1) - { - pack_info_t pack; - - init_packobject(&pack); - pack.layout = options->layout_g; - pack.chunk = options->chunk_g; - if(verify_layout(pid, &pack) == 0) - ok = 0; - } - - - /*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ - if (H5Pclose(pid) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - if (H5Sclose(sid) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); - if (H5Dclose(did) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); - if (H5Tclose(tid) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); - } /* if */ - - } /* i */ - - /* free table */ - trav_table_free(travt); - } - - /*------------------------------------------------------------------------- - * Verify that file space strategy and free space threshold - * are set as expected - *------------------------------------------------------------------------- - */ - - /* open the input file */ - if((fidin = H5Fopen(in_fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 ) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fopen failed"); - - /* Get file creation property list for input file */ - if((fcpl_in = H5Fget_create_plist(fidin)) < 0) { - error_msg("failed to retrieve file creation property list\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed"); - } - - /* Get file space management info for input file */ - if(H5Pget_file_space(fcpl_in, &in_strat, &in_thresh) < 0) { - error_msg("failed to retrieve file space strategy & threshold\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space failed"); - } - - /* Output file is already opened */ - /* Get file creation property list for output file */ - if((fcpl_out = H5Fget_create_plist(fidout)) < 0) { - error_msg("failed to retrieve file creation property list\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed"); - } - - /* Get file space management info for output file */ - if(H5Pget_file_space(fcpl_out, &out_strat, &out_thresh) < 0) { - error_msg("failed to retrieve file space strategy & threshold\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space failed"); - } - - /* - * If the strategy option is not set, - * file space handling strategy should be the same for both - * input & output files. - * If the strategy option is set, - * the output file's file space handling strategy should be the same - * as what is set via the strategy option - */ - if(!options->fs_strategy && out_strat != in_strat) { - error_msg("file space strategy not set as unexpected\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected"); - - } - else if(options->fs_strategy && out_strat!= options->fs_strategy) { - error_msg("file space strategy not set as unexpected\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected"); - } - - /* - * If the threshold option is not set, - * the free space section threshold should be the same for both - * input & output files. - * If the threshold option is set, - * the output file's free space section threshold should be the same - * as what is set via the threshold option. - */ - if(!options->fs_threshold && out_thresh != in_thresh) { - error_msg("free space threshold not set as unexpected\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "free space threshold not set as unexpected"); - } - else if(options->fs_threshold && out_thresh != options->fs_threshold) { - error_msg("free space threshold not set as unexpected\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "free space threshold not set as unexpected"); - } - - /* Closing */ - if (H5Pclose(fcpl_in) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - if (H5Pclose(fcpl_out) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - if (H5Fclose(fidin) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fclose failed"); - if (H5Fclose(fidout) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fclose failed"); - - return ok; - -done: - H5E_BEGIN_TRY { - H5Pclose(fcpl_in); - H5Pclose(fcpl_out); - H5Pclose(pid); - H5Sclose(sid); - H5Dclose(did); - H5Fclose(fidin); - H5Fclose(fidout); - if (travt) - trav_table_free(travt); - } H5E_END_TRY; - - return ret_value; -} /* h5repack_verify() */ - - - -/*------------------------------------------------------------------------- - * Function: verify_layout - * - * Purpose: verify which layout is present in the property list DCPL_ID - * - * H5D_COMPACT = 0 - * H5D_CONTIGUOUS = 1 - * H5D_CHUNKED = 2 - * - * Return: 1 has, 0 does not, -1 error - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: December 30, 2003 - * - *------------------------------------------------------------------------- - */ - -int verify_layout(hid_t pid, - pack_info_t *obj) -{ - hsize_t chsize[64]; /* chunk size in elements */ - H5D_layout_t layout; /* layout */ - int nfilters; /* number of filters */ - int rank; /* rank */ - int i; /* index */ - - /* check if we have filters in the input object */ - if ((nfilters = H5Pget_nfilters(pid)) < 0) - return -1; - - /* a non chunked layout was requested on a filtered object */ - if (nfilters && obj->layout!=H5D_CHUNKED) - return 0; - - /* get layout */ - if ((layout = H5Pget_layout(pid)) < 0) - return -1; - - if (obj->layout != layout) - return 0; - - if (layout==H5D_CHUNKED) - { - if ((rank = H5Pget_chunk(pid,NELMTS(chsize),chsize/*out*/)) < 0) - return -1; - if (obj->chunk.rank != rank) - return 0; - for ( i=0; i<rank; i++) - if (chsize[i] != obj->chunk.chunk_lengths[i]) - return 0; - } - - return 1; -} - -/*------------------------------------------------------------------------- - * Function: h5repack_cmp_pl - * - * Purpose: compare 2 files for identical property lists of all objects - * - * Return: 1=identical, 0=not identical, -1=error - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: December 31, 2003 - * - *------------------------------------------------------------------------- - */ - -int h5repack_cmp_pl(const char *fname1, - const char *fname2) -{ - int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ - hid_t fid1=-1; /* file ID */ - hid_t fid2=-1; /* file ID */ - hid_t dset1=-1; /* dataset ID */ - hid_t dset2=-1; /* dataset ID */ - hid_t gid=-1; /* group ID */ - hid_t dcpl1=-1; /* dataset creation property list ID */ - hid_t dcpl2=-1; /* dataset creation property list ID */ - hid_t gcplid=-1; /* group creation property list */ - unsigned crt_order_flag1; /* group creation order flag */ - unsigned crt_order_flag2; /* group creation order flag */ - trav_table_t *trav=NULL; - int ret=1; - unsigned int i; - - /*------------------------------------------------------------------------- - * open the files - *------------------------------------------------------------------------- - */ - - /* disable error reporting */ - H5E_BEGIN_TRY - { - - /* Open the files */ - if ((fid1 = H5Fopen(fname1,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 ) - { - error_msg("<%s>: %s\n", fname1, H5FOPENERROR ); - return -1; - } - if ((fid2 = H5Fopen(fname2,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 ) - { - error_msg("<%s>: %s\n", fname2, H5FOPENERROR ); - H5Fclose(fid1); - return -1; - } - /* enable error reporting */ - } H5E_END_TRY; - - /*------------------------------------------------------------------------- - * get file table list of objects - *------------------------------------------------------------------------- - */ - trav_table_init(&trav); - if(h5trav_gettable(fid1, trav) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5trav_gettable failed"); - - /*------------------------------------------------------------------------- - * traverse the suppplied object list - *------------------------------------------------------------------------- - */ - for(i = 0; i < trav->nobjs; i++) - { - - if(trav->objs[i].type == H5TRAV_TYPE_GROUP) - { - - if ((gid = H5Gopen2(fid1, trav->objs[i].name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed"); - if ((gcplid = H5Gget_create_plist(gid)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gget_create_plist failed"); - if (H5Pget_link_creation_order(gcplid, &crt_order_flag1) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_link_creation_order failed"); - if (H5Pclose(gcplid) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - if (H5Gclose(gid) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed"); - - if ((gid = H5Gopen2(fid2, trav->objs[i].name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed"); - if ((gcplid = H5Gget_create_plist(gid)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gget_create_plist failed"); - if (H5Pget_link_creation_order(gcplid, &crt_order_flag2) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_link_creation_order failed"); - if (H5Pclose(gcplid) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - if (H5Gclose(gid) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed"); - - if (crt_order_flag1 != crt_order_flag2) { - error_msg("property lists for <%s> are different\n",trav->objs[i].name); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "property lists failed"); - } - - } - - - - else if(trav->objs[i].type == H5TRAV_TYPE_DATASET) - { - if((dset1 = H5Dopen2(fid1, trav->objs[i].name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); - if((dset2 = H5Dopen2(fid2, trav->objs[i].name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); - if((dcpl1 = H5Dget_create_plist(dset1)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed"); - if((dcpl2 = H5Dget_create_plist(dset2)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed"); - - /*------------------------------------------------------------------------- - * compare the property lists - *------------------------------------------------------------------------- - */ - if((ret = H5Pequal(dcpl1, dcpl2)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pequal failed"); - - if(ret == 0) { - error_msg("property lists for <%s> are different\n",trav->objs[i].name); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "property lists failed"); - } - - /*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ - if(H5Pclose(dcpl1) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - if(H5Pclose(dcpl2) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); - if(H5Dclose(dset1) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); - if(H5Dclose(dset2) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); - } /*if*/ - } /*i*/ - - /*------------------------------------------------------------------------- - * free - *------------------------------------------------------------------------- - */ - - trav_table_free(trav); - - /*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ - - H5Fclose(fid1); - H5Fclose(fid2); - - return ret; - -/*------------------------------------------------------------------------- -* error -*------------------------------------------------------------------------- -*/ -done: - H5E_BEGIN_TRY - { - H5Pclose(dcpl1); - H5Pclose(dcpl2); - H5Dclose(dset1); - H5Dclose(dset2); - H5Fclose(fid1); - H5Fclose(fid2); - H5Pclose(gcplid); - H5Gclose(gid); - trav_table_free(trav); - } H5E_END_TRY; - - return ret_value; -} - - -/*------------------------------------------------------------------------- - * Function: verify_filters - * - * Purpose: verify if all requested filters in the array FILTER obtained - * from user input are present in the property list PID obtained from - * the output file - * - * Return: - * 1 match - * 0 do not match - * -1 error - * - * Programmer: Pedro Vicente, pvn@hdfgroup.org - * - * Date: December 21, 2007 - * - *------------------------------------------------------------------------- - */ - -static -int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter) -{ - int nfilters_dcpl; /* number of filters in DCPL*/ - unsigned filt_flags; /* filter flags */ - H5Z_filter_t filtn; /* filter identification number */ - unsigned cd_values[20]; /* filter client data values */ - size_t cd_nelmts; /* filter client number of values */ - char f_name[256]; /* filter name */ - size_t size; /* type size */ - int i; /* index */ - unsigned j; /* index */ - - /* get information about filters */ - if((nfilters_dcpl = H5Pget_nfilters(pid)) < 0) - return -1; - - /* if we do not have filters and the requested filter is NONE, return 1 */ - if(!nfilters_dcpl && - nfilters == 1 && - filter[0].filtn == H5Z_FILTER_NONE ) - return 1; - - /* else the numbers of filters must match */ - if (nfilters_dcpl != nfilters ) - return 0; - - /*------------------------------------------------------------------------- - * build a list with DCPL filters - *------------------------------------------------------------------------- - */ - - for( i = 0; i < nfilters_dcpl; i++) - { - cd_nelmts = NELMTS(cd_values); - filtn = H5Pget_filter2(pid, (unsigned)i, &filt_flags, &cd_nelmts, - cd_values, sizeof(f_name), f_name, NULL); - - /* filter ID */ - if (filtn != filter[i].filtn) - return 0; - - /* compare client data values. some filters do return local values */ - switch (filtn) - { - - case H5Z_FILTER_NONE: - break; - - case H5Z_FILTER_SHUFFLE: - /* 1 private client value is returned by DCPL */ - if ( cd_nelmts != H5Z_SHUFFLE_TOTAL_NPARMS && filter[i].cd_nelmts != H5Z_SHUFFLE_USER_NPARMS ) - return 0; - - /* get dataset's type size */ - if((size = H5Tget_size(tid)) <= 0) - return -1; - - /* the private client value holds the dataset's type size */ - if ( size != cd_values[0] ) - return 0; - - break; - - case H5Z_FILTER_SZIP: - /* 4 private client values are returned by DCPL */ - if ( cd_nelmts != H5Z_SZIP_TOTAL_NPARMS && filter[i].cd_nelmts != H5Z_SZIP_USER_NPARMS ) - return 0; - - /* "User" parameter for pixels-per-block (index 1) */ - if ( cd_values[H5Z_SZIP_PARM_PPB] != filter[i].cd_values[H5Z_SZIP_PARM_PPB] ) - return 0; - - break; - - case H5Z_FILTER_NBIT: - /* only client data values number of values checked */ - if ( H5Z_NBIT_USER_NPARMS != filter[i].cd_nelmts) - return 0; - break; - - case H5Z_FILTER_SCALEOFFSET: - /* only client data values checked */ - for( j = 0; j < H5Z_SCALEOFFSET_USER_NPARMS; j++) - if (cd_values[j] != filter[i].cd_values[j]) - return 0; - break; - - /* for these filters values must match, no local values set in DCPL */ - case H5Z_FILTER_FLETCHER32: - case H5Z_FILTER_DEFLATE: - - if ( cd_nelmts != filter[i].cd_nelmts) - return 0; - - for( j = 0; j < cd_nelmts; j++) - if (cd_values[j] != filter[i].cd_values[j]) - return 0; - - break; - - default: - if ( cd_nelmts != filter[i].cd_nelmts) - return 0; - - for( j = 0; j < cd_nelmts; j++) - if (cd_values[j] != filter[i].cd_values[j]) - return 0; - break; - - } /* switch */ - } - - return 1; -} - diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c deleted file mode 100644 index 82b45fc..0000000 --- a/tools/h5repack/h5repacktst.c +++ /dev/null @@ -1,6856 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* Copyright by The HDF Group. * -* Copyright by the Board of Trustees of the University of Illinois. * -* All rights reserved. * -* * -* This file is part of HDF5. The full HDF5 copyright notice, including * -* terms governing use, modification, and redistribution, is contained in * -* the files COPYING and Copyright.html. COPYING can be found at the root * -* of the source code distribution tree; Copyright.html can be found at the * -* root level of an installed copy of the electronic HDF5 document set and * -* is linked from the top-level documents page. It can also be found at * -* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * -* access to either file, you may request a copy from help@hdfgroup.org. * -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include "h5repack.h" -#include "h5test.h" -#include "h5diff.h" -#include "h5tools.h" -#include "h5tools_utils.h" - -#define GOERROR {H5_FAILED(); goto error;} - - -/* fill value test */ -#define FNAME0 "h5repack_fill.h5" -#define FNAME0OUT "h5repack_fill_out.h5" -/* HDF5 objects and all dataset datatypes */ -#define FNAME1 "h5repack_objs.h5" -#define FNAME1OUT "h5repack_objs_out.h5" -/* attributes, all datatypes */ -#define FNAME2 "h5repack_attr.h5" -#define FNAME2OUT "h5repack_attr_out.h5" -/* hard links */ -#define FNAME3 "h5repack_hlink.h5" -#define FNAME3OUT "h5repack_hlink_out.h5" -/* layout */ -#define FNAME4 "h5repack_layout.h5" -#define FNAME4OUT "h5repack_layout_out.h5" -/* H5D_ALLOC_TIME_EARLY */ -#define FNAME5 "h5repack_early.h5" -#define FNAME5OUT "h5repack_early_out.h5" -#define FNAME6 "h5repack_early2.h5" -#ifdef H5_HAVE_FILTER_SZIP -/* SZIP filter */ -#define FNAME7 "h5repack_szip.h5" -#define FNAME7OUT "h5repack_szip_out.h5" -#endif -/* GZIP filter */ -#define FNAME8 "h5repack_deflate.h5" -#define FNAME8OUT "h5repack_deflate_out.h5" -/* GZIP filter */ -#define FNAME9 "h5repack_shuffle.h5" -#define FNAME9OUT "h5repack_shuffle_out.h5" -/* Fletcher filter */ -#define FNAME10 "h5repack_fletcher.h5" -#define FNAME10OUT "h5repack_fletcher_out.h5" -/* All filters */ -#define FNAME11 "h5repack_filters.h5" -#define FNAME11OUT "h5repack_filters_out.h5" -/* NBit filter */ -#define FNAME12 "h5repack_nbit.h5" -#define FNAME12OUT "h5repack_nbit_out.h5" -/* Scale Offset filter */ -#define FNAME13 "h5repack_soffset.h5" -#define FNAME13OUT "h5repack_soffset_out.h5" -/* Big file to test read by hyperslabs */ -#define FNAME14 "h5repack_big.h5" -#define FNAME14OUT "h5repack_big_out.h5" -/* external file */ -#define FNAME15 "h5repack_ext.h5" -#define FNAME15OUT "h5repack_ext_out.h5" -/* File w/userblock */ -#define FNAME16 "h5repack_ub.h5" -#define FNAME16OUT "h5repack_ub_out.h5" -/* Named datatypes */ -#define FNAME17 "h5repack_named_dtypes.h5" -#define FNAME17OUT "h5repack_named_dtypes_out.h5" - -#define FNAME18 "h5repack_layout2.h5" - -#define FNAME_UB "ublock.bin" - -/* obj and region references */ -#define FNAME_REF "h5repack_refs.h5" - -/* obj and region references in attr of compound and vlen type */ -#define FNAME_ATTR_REF "h5repack_attr_refs.h5" - -const char *H5REPACK_FILENAMES[] = { - "h5repack_big_out", - NULL -}; - -#define H5REPACK_EXTFILE "h5repack_ext.bin" - -/* Name of tool */ -#define PROGRAMNAME "h5repacktst" - - -#define DIM1 40 -#define DIM2 20 -#define CDIM1 DIM1/2 -#define CDIM2 DIM2/2 -#define RANK 2 - -/* Size of userblock (for userblock test) */ -#define USERBLOCK_SIZE 2048 - -/* obj and region references */ -#define NAME_OBJ_DS1 "Dset1" -#define NAME_OBJ_GRP "Group" -#define NAME_OBJ_NDTYPE "NamedDatatype" -#define NAME_OBJ_DS2 "Dset2" -#define REG_REF_DS1 "Dset_REGREF" - -/*------------------------------------------------------------------------- -* prototypes -*------------------------------------------------------------------------- -*/ -static int make_all_objects(hid_t loc_id); -static int make_attributes(hid_t loc_id); -static int make_hlinks(hid_t loc_id); -static int make_early(void); -static int make_layout(hid_t loc_id); -static int make_layout2(hid_t loc_id); -static int make_layout3(hid_t loc_id); -#ifdef H5_HAVE_FILTER_SZIP -static int make_szip(hid_t loc_id); -#endif /* H5_HAVE_FILTER_SZIP */ -static int make_deflate(hid_t loc_id); -static int make_shuffle(hid_t loc_id); -static int make_fletcher32(hid_t loc_id); -static int make_nbit(hid_t loc_id); -static int make_scaleoffset(hid_t loc_id); -static int make_all_filters(hid_t loc_id); -static int make_fill(hid_t loc_id); -static int make_big(hid_t loc_id); -static int make_testfiles(void); -static int write_dset_in(hid_t loc_id,const char* dset_name,hid_t file_id,int make_diffs ); -static int write_attr_in(hid_t loc_id,const char* dset_name,hid_t fid,int make_diffs ); -static int write_dset(hid_t loc_id,int rank,hsize_t *dims,const char *dset_name,hid_t tid,void *buf ); -static int make_dset(hid_t loc_id,const char *name,hid_t sid,hid_t dcpl,void *buf); -static int make_attr(hid_t loc_id,int rank,hsize_t *dims,const char *attr_name,hid_t tid,void *buf); -static int make_dset_reg_ref(hid_t loc_id); -static int make_external(hid_t loc_id); -static int make_userblock(void); -static int verify_userblock( const char* filename); -static int make_userblock_file(void); -static int make_named_dtype(hid_t loc_id); -static int make_references(hid_t loc_id); -static int make_complex_attr_references(hid_t loc_id); - - -/*------------------------------------------------------------------------- -* Function: main -* -* Purpose: Executes h5repack tests -* -* Return: Success: zero -* Failure: 1 -* -* Programmer: Pedro Vicente <pvn@ncsa.uiuc.edu> -* January, 6, 2004 -* -*------------------------------------------------------------------------- -*/ - -int main (void) -{ - pack_opt_t pack_options; - diff_opt_t diff_options; - hsize_t fs_size = 0; /* free space section threshold */ - H5F_file_space_type_t fs_type = H5F_FILE_SPACE_DEFAULT; /* file space handling strategy */ - h5_stat_t file_stat; - h5_stat_size_t fsize1, fsize2; /* file sizes */ -#if defined (H5_HAVE_FILTER_SZIP) - int szip_can_encode = 0; -#endif - - h5tools_setprogname(PROGRAMNAME); - h5tools_setstatus(EXIT_SUCCESS); - - /* Initialize h5tools lib */ - h5tools_init(); - - /* initialize */ - HDmemset(&diff_options, 0, sizeof (diff_opt_t)); - HDmemset(&pack_options, 0, sizeof (pack_opt_t)); - - /* run tests */ - puts("Testing h5repack:"); - - /* make the test files */ - TESTING(" generating datasets"); - if (make_testfiles() < 0) - GOERROR; - PASSED(); - - /*------------------------------------------------------------------------- - * Format of the tests: - * - * 1) make a copy of the file with h5repack - * 2) use the h5diff function to compare the input and output file - *------------------------------------------------------------------------- - */ - - - /*------------------------------------------------------------------------- - * file with fill values - *------------------------------------------------------------------------- - */ - - TESTING(" copy of datasets (fill values)"); - - /* fs_type = 0; fs_size = 0 */ - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack(FNAME0,FNAME0OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME0,FNAME0OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME0, FNAME0OUT,&pack_options)<=0) - GOERROR; - if (h5repack_cmp_pl(FNAME0,FNAME0OUT)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - PASSED(); - - - /*------------------------------------------------------------------------- - * file with all kinds of dataset datatypes - *------------------------------------------------------------------------- - */ - TESTING(" copy of datasets (all datatypes)"); - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack(FNAME1,FNAME1OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME1,FNAME1OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME1, FNAME1OUT,&pack_options)<=0) - GOERROR; - if (h5repack_cmp_pl(FNAME1,FNAME1OUT)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - PASSED(); - - - /*------------------------------------------------------------------------- - * file with attributes - *------------------------------------------------------------------------- - */ - TESTING(" copy of datasets (attributes)"); - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack(FNAME2,FNAME2OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME2,FNAME2OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME2, FNAME2OUT,&pack_options)<=0) - GOERROR; - if (h5repack_cmp_pl(FNAME2,FNAME2OUT)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - PASSED(); - - /*------------------------------------------------------------------------- - * file with hardlinks - *------------------------------------------------------------------------- - */ - TESTING(" copy of datasets (hardlinks)"); - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack(FNAME3,FNAME3OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME3,FNAME3OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME3, FNAME3OUT,&pack_options)<=0) - GOERROR; - if (h5repack_cmp_pl(FNAME3,FNAME3OUT)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - - PASSED(); - - /*------------------------------------------------------------------------- - * alloc early test - *------------------------------------------------------------------------- - */ - TESTING(" copy of allocation early file"); - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack(FNAME5,FNAME5OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME5,FNAME5OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME5, FNAME5OUT, &pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - PASSED(); - - /*------------------------------------------------------------------------- - * the remaining files differ in the dcpl's - *------------------------------------------------------------------------- - */ - - /*------------------------------------------------------------------------- - * deflate - *------------------------------------------------------------------------- - */ - TESTING(" adding deflate filter (old_format)"); - -#ifdef H5_HAVE_FILTER_DEFLATE - - /*------------------------------------------------------------------------- - * test an individual object option - *------------------------------------------------------------------------- - */ - - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack_addfilter("dset1:GZIP=9",&pack_options) < 0) - GOERROR; - if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - PASSED(); -#else - SKIPPED(); -#endif - - TESTING(" adding deflate filter (new format)"); -#ifdef H5_HAVE_FILTER_DEFLATE - /*------------------------------------------------------------------------- - * test an individual object option - * For new format, "dset1" should be using Fixed Array indexing - *------------------------------------------------------------------------- - */ - - if (h5repack_init (&pack_options, 0, TRUE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack_addfilter("dset1:GZIP=9",&pack_options) < 0) - GOERROR; - if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - PASSED(); -#else - SKIPPED(); -#endif - - /*------------------------------------------------------------------------- - * test all objects option - *------------------------------------------------------------------------- - */ - - TESTING(" adding deflate filter to all"); - -#ifdef H5_HAVE_FILTER_DEFLATE - - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack_addfilter("GZIP=1",&pack_options) < 0) - GOERROR; - if (h5repack_addlayout("CHUNK=20x10",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - - PASSED(); -#else - SKIPPED(); -#endif - - /*------------------------------------------------------------------------- - * SZIP - *------------------------------------------------------------------------- - */ - - TESTING(" adding szip filter"); - -#if defined (H5_HAVE_FILTER_SZIP) - if (h5tools_can_encode(H5Z_FILTER_SZIP) >0) { - szip_can_encode = 1; - } - - /*------------------------------------------------------------------------- - * test an individual object option - *------------------------------------------------------------------------- - */ - - if (szip_can_encode) { - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack_addfilter("dset2:SZIP=8,EC",&pack_options) < 0) - GOERROR; - if (h5repack_addlayout("dset2:CHUNK=20x10",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - - PASSED(); - } else { - SKIPPED(); - } -#else - SKIPPED(); -#endif - - - /*------------------------------------------------------------------------- - * test all objects option - *------------------------------------------------------------------------- - */ - TESTING(" adding szip filter to all"); - -#if defined (H5_HAVE_FILTER_SZIP) - if (szip_can_encode) { - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack_addfilter("SZIP=8,NN",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - - PASSED(); - } else { - SKIPPED(); - } -#else - SKIPPED(); -#endif - - - TESTING(" addding shuffle filter"); - - /*------------------------------------------------------------------------- - * test an individual object option - *------------------------------------------------------------------------- - */ - - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack_addfilter("dset1:SHUF",&pack_options) < 0) - GOERROR; - if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - - PASSED(); - - /*------------------------------------------------------------------------- - * test all objects option - *------------------------------------------------------------------------- - */ - - TESTING(" addding shuffle filter to all"); - - /* fs_type = H5F_FILE_SPACE_ALL_PERSIST; fs_size = 1 */ - if (h5repack_init (&pack_options, 0, FALSE, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0) - GOERROR; - if (h5repack_addfilter("SHUF",&pack_options) < 0) - GOERROR; - if (h5repack_addlayout("CHUNK=20x10",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - - PASSED(); - - - TESTING(" adding checksum filter"); - - /*------------------------------------------------------------------------- - * test an individual object option - *------------------------------------------------------------------------- - */ - - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack_addfilter("dset1:FLET",&pack_options) < 0) - GOERROR; - if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - - PASSED(); - - /*------------------------------------------------------------------------- - * test all objects option - *------------------------------------------------------------------------- - */ - - - TESTING(" adding checksum filter to all"); - - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack_addfilter("FLET",&pack_options) < 0) - GOERROR; - if (h5repack_addlayout("CHUNK=20x10",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - - PASSED(); - - - TESTING(" filter queue fletcher, shuffle, deflate, szip"); - - /*------------------------------------------------------------------------- - * add some filters - *------------------------------------------------------------------------- - */ - - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack_addlayout("dset1:CHUNK 20x10",&pack_options) < 0) - GOERROR; - if (h5repack_addfilter("dset1:FLET",&pack_options) < 0) - GOERROR; - if (h5repack_addfilter("dset1:SHUF",&pack_options) < 0) - GOERROR; - -#if defined (H5_HAVE_FILTER_SZIP) - if (szip_can_encode) { - if (h5repack_addfilter("dset1:SZIP=8,NN",&pack_options) < 0) - GOERROR; - } -#endif - -#ifdef H5_HAVE_FILTER_DEFLATE - if (h5repack_addfilter("dset1:GZIP=1",&pack_options) < 0) - GOERROR; -#endif - - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - - PASSED(); - - - TESTING(" adding layout chunked (old format)"); - - /*------------------------------------------------------------------------- - * test an individual object option - *------------------------------------------------------------------------- - */ - - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options )<= 0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - PASSED(); - - TESTING(" adding layout chunked (new format)"); - - /*------------------------------------------------------------------------- - * test an individual object option - * For new format, "dset1" should be using Fixed Array indexing - *------------------------------------------------------------------------- - */ - - if (h5repack_init (&pack_options, 0, TRUE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options )<= 0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - PASSED(); - - /*------------------------------------------------------------------------- - * test all objects option - *------------------------------------------------------------------------- - */ - TESTING(" adding layout chunked to all"); - - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack_addlayout("CHUNK=20x10",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - - PASSED(); - - TESTING(" adding layout contiguous"); - - /*------------------------------------------------------------------------- - * test an individual object option - *------------------------------------------------------------------------- - */ - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack_addlayout("dset1:CONTI",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - - PASSED(); - - TESTING(" adding layout contiguous to all"); - - /*------------------------------------------------------------------------- - * test all objects option - *------------------------------------------------------------------------- - */ - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack_addlayout("CONTI",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - - /*------------------------------------------------------------------------- - * do the same test for a file with filters (chunked) - *------------------------------------------------------------------------- - */ - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack_addlayout("CONTI",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME8,FNAME8OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME8,FNAME8OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME8, FNAME8OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - - PASSED(); - - TESTING(" adding layout compact"); - - /*------------------------------------------------------------------------- - * test an individual object option - *------------------------------------------------------------------------- - */ - - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack_addlayout("dset1:COMPA",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - PASSED(); - - TESTING(" adding layout compact to all"); - - /*------------------------------------------------------------------------- - * test all objects option - *------------------------------------------------------------------------- - */ - - /* fs_type = H5F_FILE_SPACE_ALL; fs_size = 2 */ - if (h5repack_init (&pack_options, 0, FALSE, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0) - GOERROR; - if (h5repack_addlayout("COMPA",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - - PASSED(); - - - TESTING(" layout compact to contiguous conversion"); - - /*------------------------------------------------------------------------- - * layout compact to contiguous conversion - *------------------------------------------------------------------------- - */ - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack_addlayout("dset_compact:CONTI",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - PASSED(); - - TESTING(" layout compact to chunk conversion"); - - /*------------------------------------------------------------------------- - * layout compact to chunk conversion - *------------------------------------------------------------------------- - */ - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack_addlayout("dset_compact:CHUNK=2x5",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - PASSED(); - - TESTING(" layout compact to compact conversion"); - - /*------------------------------------------------------------------------- - * layout compact to compact conversion - *------------------------------------------------------------------------- - */ - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack_addlayout("dset_compact:COMPA",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - PASSED(); - - TESTING(" layout contiguous to compact conversion"); - /*------------------------------------------------------------------------- - * layout contiguous to compact conversion - *------------------------------------------------------------------------- - */ - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack_addlayout("dset_contiguous:COMPA",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - PASSED(); - - TESTING(" layout contiguous to chunk conversion"); - /*------------------------------------------------------------------------- - * layout contiguous to chunk conversion - *------------------------------------------------------------------------- - */ - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack_addlayout("dset_contiguous:CHUNK=3x6",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - PASSED(); - - TESTING(" layout contiguous to contiguous conversion"); - - /*------------------------------------------------------------------------- - * layout contiguous to contiguous conversion - *------------------------------------------------------------------------- - */ - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack_addlayout("dset_contiguous:CONTI",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - PASSED(); - - TESTING(" layout chunked to compact conversion"); - /*------------------------------------------------------------------------- - * layout chunked to compact conversion - *------------------------------------------------------------------------- - */ - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack_addlayout("dset_chunk:COMPA",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - PASSED(); - - TESTING(" layout chunked to contiguous conversion"); - - /*------------------------------------------------------------------------- - * layout chunked to contiguous conversion - *------------------------------------------------------------------------- - */ - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack_addlayout("dset_chunk:CONTI",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - PASSED(); - - TESTING(" layout chunked to chunk conversion"); - /*------------------------------------------------------------------------- - * layout chunked to chunked conversion - *------------------------------------------------------------------------- - */ - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack_addlayout("dset_chunk:CHUNK=18x13",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME4, FNAME4OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - PASSED(); - - - /*------------------------------------------------------------------------- - * the following tests assume the input files have filters - * FNAME7 - * FNAME8 - * FNAME9 - * FNAME10 - * FNAME11 - *------------------------------------------------------------------------- - */ - - - TESTING(" copy of szip filter"); - -#if defined (H5_HAVE_FILTER_SZIP) - if (szip_can_encode) { - /* fs_type = H5F_FILE_SPACE_AGGR_VFD; fs_size = 3 */ - if (h5repack_init (&pack_options, 0, FALSE, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0) - GOERROR; - if (h5repack(FNAME7,FNAME7OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME7,FNAME7OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME7, FNAME7OUT,&pack_options)<=0) - GOERROR; - if (h5repack_cmp_pl(FNAME7,FNAME7OUT)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - - PASSED(); - } else { - SKIPPED(); - } -#else - SKIPPED(); -#endif - - TESTING(" removing szip filter"); - -#if defined (H5_HAVE_FILTER_SZIP) - if (szip_can_encode) { - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack_addfilter("dset_szip:NONE",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME7,FNAME7OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME7,FNAME7OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME7, FNAME7OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - - PASSED(); - } else { - SKIPPED(); - } -#else - SKIPPED(); -#endif - - - TESTING(" copy of deflate filter"); - -#ifdef H5_HAVE_FILTER_DEFLATE - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack(FNAME8,FNAME8OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME8,FNAME8OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME8, FNAME8OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - - PASSED(); -#else - SKIPPED(); -#endif - - - TESTING(" removing deflate filter"); - -#ifdef H5_HAVE_FILTER_DEFLATE - if (h5repack_init (&pack_options, 0, FALSE, fs_type, ++fs_size) < 0) - GOERROR; - if (h5repack_addfilter("dset_deflate:NONE",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME8,FNAME8OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME8,FNAME8OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME8, FNAME8OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - - PASSED(); -#else - SKIPPED(); -#endif - - - - TESTING(" copy of shuffle filter"); - - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack(FNAME9,FNAME9OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME9,FNAME9OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME9, FNAME9OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - - PASSED(); - - - TESTING(" removing shuffle filter"); - - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack_addfilter("dset_shuffle:NONE",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME9,FNAME9OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME9,FNAME9OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME9, FNAME9OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - - PASSED(); - - - TESTING(" copy of fletcher filter"); - - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack(FNAME10,FNAME10OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME10,FNAME10OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME10, FNAME10OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - - PASSED(); - - - TESTING(" removing fletcher filter"); - - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack_addfilter("dset_fletcher32:NONE",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME10,FNAME10OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME10,FNAME10OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME10, FNAME10OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - - PASSED(); - - - TESTING(" copy of nbit filter"); - - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack(FNAME12,FNAME12OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME12,FNAME12OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME12, FNAME12OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - - PASSED(); - - - TESTING(" removing nbit filter"); - - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack_addfilter("dset_nbit:NONE",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME12,FNAME12OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME12,FNAME12OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME12, FNAME12OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - - PASSED(); - - - TESTING(" adding nbit filter"); - - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack_addfilter("dset_int31:NBIT",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME12,FNAME12OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME12,FNAME12OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME12, FNAME12OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - - PASSED(); - - - TESTING(" copy of scaleoffset filter"); - - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack(FNAME13,FNAME13OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME13,FNAME13OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME13, FNAME13OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - - PASSED(); - - - TESTING(" removing scaleoffset filter"); - - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack_addfilter("dset_scaleoffset:NONE",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME13,FNAME13OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME13,FNAME13OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME13, FNAME13OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - - PASSED(); - - - TESTING(" adding scaleoffset filter"); - - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack_addfilter("dset_none:SOFF=31,IN",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME13,FNAME13OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME13,FNAME13OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME13, FNAME13OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - - PASSED(); - - - /*------------------------------------------------------------------------- - * file with all filters - * dset_all - * dset_deflate - * dset_szip - * dset_shuffle - * dset_fletcher32 - *------------------------------------------------------------------------- - */ - - - TESTING(" filter conversion from deflate to szip"); - -#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_HAVE_FILTER_DEFLATE) - - if (szip_can_encode) { - /* fs_type = H5F_FILE_SPACE_VFD; fs_size = 4 */ - if (h5repack_init (&pack_options, 0, FALSE, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0) - GOERROR; - if (h5repack_addfilter("dset_deflate:SZIP=8,NN",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME11,FNAME11OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME11,FNAME11OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME11, FNAME11OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - - PASSED(); - } else { - SKIPPED(); - } -#else - SKIPPED(); -#endif - - TESTING(" filter conversion from szip to deflate"); - -#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_HAVE_FILTER_DEFLATE) - - if (szip_can_encode) { - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack_addfilter("dset_szip:GZIP=1",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME11,FNAME11OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME11,FNAME11OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME11, FNAME11OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - - PASSED(); - } else { - SKIPPED(); - } -#else - SKIPPED(); -#endif - - - /*------------------------------------------------------------------------- - * test the NONE global option - *------------------------------------------------------------------------- - */ - - TESTING(" removing all filters"); - -#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_HAVE_FILTER_DEFLATE) - - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack_addfilter("NONE",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME11,FNAME11OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME11,FNAME11OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME11, FNAME11OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - - PASSED(); -#else - SKIPPED(); -#endif - - /*------------------------------------------------------------------------- - * test a big file - *------------------------------------------------------------------------- - */ - TESTING(" big file"); - - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack(FNAME14,FNAME14OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME14,FNAME14OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME14, FNAME14OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - PASSED(); - - /*------------------------------------------------------------------------- - * test external dataset - *------------------------------------------------------------------------- - */ - TESTING(" external datasets"); - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack(FNAME15,FNAME15OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME15,FNAME15OUT,NULL,NULL,&diff_options) > 0) - GOERROR; - if (h5repack_verify(FNAME15, FNAME15OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - PASSED(); - - /*------------------------------------------------------------------------- - * test file with userblock - *------------------------------------------------------------------------- - */ - TESTING(" file with userblock"); - if(h5repack_init(&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if(h5repack(FNAME16, FNAME16OUT, &pack_options) < 0) - GOERROR; - if(h5diff(FNAME16, FNAME16OUT, NULL, NULL, &diff_options) > 0) - GOERROR; - if(h5repack_verify(FNAME16, FNAME16OUT, &pack_options) <= 0) - GOERROR; - if(verify_userblock(FNAME16OUT) < 0) - GOERROR; - if(h5repack_end(&pack_options) < 0) - GOERROR; - PASSED(); - - /*------------------------------------------------------------------------- - * test --latest options - *------------------------------------------------------------------------- - */ - TESTING(" latest file format options"); - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - pack_options.latest=1; - pack_options.grp_compact=10; - pack_options.grp_indexed=5; - pack_options.msg_size[0] = 10; - pack_options.msg_size[1] = 20; - pack_options.msg_size[2] = 30; - pack_options.msg_size[3] = 40; - pack_options.msg_size[4] = 50; - if (h5repack(FNAME1,FNAME1OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME1,FNAME1OUT,NULL,NULL,&diff_options) > 0) - GOERROR; - if (h5repack_verify(FNAME1, FNAME1OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - PASSED(); - - - /*------------------------------------------------------------------------- - * test several global filters - *------------------------------------------------------------------------- - */ - - TESTING(" several global filters"); - -#if defined (H5_HAVE_FILTER_DEFLATE) - - if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - if (h5repack_addfilter("GZIP=1",&pack_options) < 0) - GOERROR; - if (h5repack_addfilter("SHUF",&pack_options) < 0) - GOERROR; - if (h5repack(FNAME11,FNAME11OUT,&pack_options) < 0) - GOERROR; - if (h5diff(FNAME11,FNAME11OUT,NULL,NULL,&diff_options) >0) - GOERROR; - if (h5repack_verify(FNAME11, FNAME11OUT,&pack_options)<=0) - GOERROR; - if (h5repack_end (&pack_options) < 0) - GOERROR; - - PASSED(); -#else - SKIPPED(); -#endif - - - /*------------------------------------------------------------------------- - * test file with userblock - *------------------------------------------------------------------------- - */ - TESTING(" file with added userblock"); - -#ifdef H5_HAVE_FILTER_DEFLATE - - if(h5repack_init(&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - - /* add the options for a user block size and user block filename */ - pack_options.ublock_size = USERBLOCK_SIZE; - pack_options.ublock_filename = FNAME_UB; - - if(h5repack(FNAME8, FNAME8OUT, &pack_options) < 0) - GOERROR; - if(h5diff(FNAME8, FNAME8OUT, NULL, NULL, &diff_options) > 0) - GOERROR; - if(h5repack_verify(FNAME8, FNAME8OUT, &pack_options) <= 0) - GOERROR; - if(verify_userblock(FNAME8OUT) < 0) - GOERROR; - if(h5repack_end(&pack_options) < 0) - GOERROR; - - - PASSED(); -#else - SKIPPED(); -#endif - - - /*------------------------------------------------------------------------- - * test file with aligment - *------------------------------------------------------------------------- - */ - TESTING(" file with aligment"); - -#ifdef H5_HAVE_FILTER_DEFLATE - - if(h5repack_init(&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - - /* add the options for aligment */ - pack_options.alignment = 1; - pack_options.threshold = 1; - - if(h5repack(FNAME8, FNAME8OUT, &pack_options) < 0) - GOERROR; - if(h5diff(FNAME8, FNAME8OUT, NULL, NULL, &diff_options) > 0) - GOERROR; - if(h5repack_verify(FNAME8, FNAME8OUT, &pack_options) <= 0) - GOERROR; - - /* verify aligment */ - { - hsize_t threshold; - hsize_t alignment; - hid_t fapl; - hid_t fid; - - if (( fid = H5Fopen(FNAME8OUT, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 ) - GOERROR; - if ((fapl = H5Fget_access_plist(fid)) < 0) - GOERROR; - if ( H5Pget_alignment(fapl, &threshold, &alignment ) < 0) - GOERROR; - if ( threshold != 1 ) - GOERROR; - if ( alignment != 1 ) - GOERROR; - if ( H5Pclose(fapl) < 0) - GOERROR; - if (H5Fclose(fid) < 0) - GOERROR; - - } - - - if(h5repack_end(&pack_options) < 0) - GOERROR; - - - PASSED(); -#else - SKIPPED(); -#endif - - /*------------------------------------------------------------------------- - * test file with userblock - *------------------------------------------------------------------------- - */ - TESTING(" file with committed datatypes"); - - if(h5repack_init(&pack_options, 0, FALSE, fs_type, fs_size) < 0) - GOERROR; - - if(h5repack(FNAME17, FNAME17OUT, &pack_options) < 0) - GOERROR; - if(h5diff(FNAME17, FNAME17OUT, NULL, NULL, &diff_options) > 0) - GOERROR; - if(h5repack_verify(FNAME17, FNAME17OUT, &pack_options) <= 0) - GOERROR; - if(h5repack_end(&pack_options) < 0) - GOERROR; - - - PASSED(); - - /*------------------------------------------------------------------------- - * test --metadata_block_size option - * Also verify that output file using the metadata_block_size option is - * larger than the output file one not using it. - * FNAME4 is used because it is the same as the test file used for the - * shell script version of this test (h5repack.sh). - *------------------------------------------------------------------------- - */ - TESTING(" metadata block size option"); - /* First run without metadata option. No need to verify the correctness */ - /* since this has been verified by earlier tests. Just record the file */ - /* size of the output file. */ - if(h5repack_init(&pack_options, 0, FALSE, H5F_FILE_SPACE_DEFAULT, (hsize_t)0) < 0) - GOERROR; - if(h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) - GOERROR; - if(HDstat(FNAME4OUT, &file_stat) < 0) - GOERROR; - fsize1 = file_stat.st_size; - if(h5repack_end(&pack_options) < 0) - GOERROR; - - /* run it again with metadata option */ - if(h5repack_init(&pack_options, 0, FALSE, H5F_FILE_SPACE_DEFAULT, (hsize_t)0) < 0) - GOERROR; - pack_options.meta_block_size = 8192; - if(h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) - GOERROR; - if(h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0) - GOERROR; - if(h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0) - GOERROR; - /* record the file size of the output file */ - if(HDstat(FNAME4OUT, &file_stat) < 0) - GOERROR; - fsize2 = file_stat.st_size; - /* verify second file size is larger than the first one */ - if(fsize2 <= fsize1) - GOERROR; - if(h5repack_end(&pack_options) < 0) - GOERROR; - PASSED(); - - - /*------------------------------------------------------------------------- - * clean temporary test files - *------------------------------------------------------------------------- - */ - { - hid_t fapl; - - fapl = h5_fileaccess(); - h5_clean_files(H5REPACK_FILENAMES, fapl); - - } - - puts("All h5repack tests passed."); - - h5tools_close(); - - return 0; - -error: - puts("***** H5REPACK TESTS FAILED *****"); - return 1; - -} - - -/*------------------------------------------------------------------------- -* Function: make_testfiles -* -* Purpose: make a test file with all types of HDF5 objects, -* datatypes and filters -* -*------------------------------------------------------------------------- -*/ -static -int make_testfiles(void) -{ - hid_t fid; - - /*------------------------------------------------------------------------- - * create a file for general copy test - *------------------------------------------------------------------------- - */ - if((fid = H5Fcreate(FNAME0,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) - return -1; - if (make_fill(fid) < 0) - goto out; - if(H5Fclose(fid) < 0) - return -1; - - /*------------------------------------------------------------------------- - * create another file for general copy test (all datatypes) - *------------------------------------------------------------------------- - */ - if((fid = H5Fcreate(FNAME1,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) - return -1; - if (make_all_objects(fid) < 0) - goto out; - if(H5Fclose(fid) < 0) - return -1; - - /*------------------------------------------------------------------------- - * create a file for attributes copy test - *------------------------------------------------------------------------- - */ - if((fid = H5Fcreate(FNAME2,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) - return -1; - if (make_attributes(fid) < 0) - goto out; - if(H5Fclose(fid) < 0) - return -1; - - /*------------------------------------------------------------------------- - * create a file for hard links test - *------------------------------------------------------------------------- - */ - if((fid = H5Fcreate(FNAME3,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) - return -1; - if (make_hlinks(fid) < 0) - goto out; - if(H5Fclose(fid) < 0) - return -1; - - /*------------------------------------------------------------------------- - * create a file for layouts test - *------------------------------------------------------------------------- - */ - if((fid = H5Fcreate(FNAME4,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) - return -1; - if (make_layout(fid) < 0) - goto out; - if(H5Fclose(fid) < 0) - return -1; - - /*------------------------------------------------------------------------- - * create a file for layout conversion test - *------------------------------------------------------------------------- - */ - if((fid = H5Fcreate(FNAME18, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) - return -1; - - if(make_layout2(fid) < 0) - goto out; - - if(H5Fclose(fid) < 0) - return -1; - - /*------------------------------------------------------------------------- - * for test layout conversions form chunk with unlimited max dims - *------------------------------------------------------------------------- - */ - if((fid = H5Fcreate("h5repack_layout3.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) - return -1; - - if(make_layout3(fid) < 0) - goto out; - - if(H5Fclose(fid) < 0) - return -1; - - /*------------------------------------------------------------------------- - * create a file for the H5D_ALLOC_TIME_EARLY test - *------------------------------------------------------------------------- - */ - if (make_early() < 0) - goto out; - - /*------------------------------------------------------------------------- - * create a file with the SZIP filter - *------------------------------------------------------------------------- - */ -#ifdef H5_HAVE_FILTER_SZIP - if((fid = H5Fcreate(FNAME7,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) - return -1; - if (make_szip(fid) < 0) - goto out; - if(H5Fclose(fid) < 0) - return -1; -#endif /* H5_HAVE_FILTER_SZIP */ - - - /*------------------------------------------------------------------------- - * create a file with the deflate filter - *------------------------------------------------------------------------- - */ - if((fid = H5Fcreate(FNAME8,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) - return -1; - if (make_deflate(fid) < 0) - goto out; - if(H5Fclose(fid) < 0) - return -1; - - /*------------------------------------------------------------------------- - * create a file with the shuffle filter - *------------------------------------------------------------------------- - */ - if((fid = H5Fcreate(FNAME9,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) - return -1; - if (make_shuffle(fid) < 0) - goto out; - if(H5Fclose(fid) < 0) - return -1; - - /*------------------------------------------------------------------------- - * create a file with the fletcher32 filter - *------------------------------------------------------------------------- - */ - if((fid = H5Fcreate(FNAME10,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) - return -1; - if (make_fletcher32(fid) < 0) - goto out; - if(H5Fclose(fid) < 0) - return -1; - - /*------------------------------------------------------------------------- - * create a file with all the filters - *------------------------------------------------------------------------- - */ - if((fid = H5Fcreate(FNAME11,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) - return -1; - if (make_all_filters(fid) < 0) - goto out; - if(H5Fclose(fid) < 0) - return -1; - - /*------------------------------------------------------------------------- - * create a file with the nbit filter - *------------------------------------------------------------------------- - */ - if((fid = H5Fcreate(FNAME12,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) - return -1; - if (make_nbit(fid) < 0) - goto out; - if(H5Fclose(fid) < 0) - return -1; - - /*------------------------------------------------------------------------- - * create a file with the scaleoffset filter - *------------------------------------------------------------------------- - */ - if((fid = H5Fcreate(FNAME13,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) - return -1; - if (make_scaleoffset(fid) < 0) - goto out; - if(H5Fclose(fid) < 0) - return -1; - - /*------------------------------------------------------------------------- - * create a big dataset - *------------------------------------------------------------------------- - */ - if((fid = H5Fcreate(FNAME14,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) - return -1; - if (make_big(fid) < 0) - goto out; - if(H5Fclose(fid) < 0) - return -1; - - /*------------------------------------------------------------------------- - * create a file with external dataset - *------------------------------------------------------------------------- - */ - if((fid = H5Fcreate(FNAME15,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) - return -1; - if (make_external(fid) < 0) - goto out; - if(H5Fclose(fid) < 0) - return -1; - - /*------------------------------------------------------------------------- - * create a file with userblock - *------------------------------------------------------------------------- - */ - if(make_userblock() < 0) - goto out; - - /*------------------------------------------------------------------------- - * create a userblock file - *------------------------------------------------------------------------- - */ - if(make_userblock_file() < 0) - goto out; - - /*------------------------------------------------------------------------- - * create a file with named datatypes - *------------------------------------------------------------------------- - */ - if((fid = H5Fcreate(FNAME17,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) - return -1; - if (make_named_dtype(fid) < 0) - goto out; - if(H5Fclose(fid) < 0) - return -1; - - /*------------------------------------------------------------------------- - * create obj and region reference type datasets (bug1814) - * add attribute with int type (bug1726) - * add attribute with obj and region reference type (bug1726) - *-------------------------------------------------------------------------*/ - if((fid = H5Fcreate(FNAME_REF,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) - return -1; - /* create reference type datasets */ - if (make_references(fid) < 0) - goto out; - if(H5Fclose(fid) < 0) - return -1; - - /*------------------------------------------------------------------------- - * create a file with obj and region references in attribute of compound and - * vlen datatype - *-------------------------------------------------------------------------*/ - if((fid = H5Fcreate(FNAME_ATTR_REF,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) - return -1; - if (make_complex_attr_references(fid) < 0) - goto out; - if(H5Fclose(fid) < 0) - return -1; - - return 0; - -out: - H5Fclose(fid); - return -1; -} - - - -/*------------------------------------------------------------------------- -* Function: make_all_objects -* -* Purpose: make a test file with all types of HDF5 objects -* -*------------------------------------------------------------------------- -*/ -static -int make_all_objects(hid_t loc_id) -{ - hid_t did=-1; - hid_t gid=-1; - hid_t tid=-1; - hid_t rid=-1; - hid_t sid=-1; - hid_t gcplid=-1; - hsize_t dims[1]={2}; - /* compound datatype */ - typedef struct s_t - { - int a; - float b; - } s_t; - - /*------------------------------------------------------------------------- - * H5G_DATASET - *------------------------------------------------------------------------- - */ - if ((sid = H5Screate_simple(1, dims, NULL)) < 0) - goto out; - if ((did = H5Dcreate2(loc_id, "dset_referenced", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; - - - /*------------------------------------------------------------------------- - * H5G_GROUP - *------------------------------------------------------------------------- - */ - if ((gid = H5Gcreate2(loc_id, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; - if (H5Gclose(gid) < 0) - goto out; - - /* create a group "g2" with H5P_CRT_ORDER_TRACKED set */ - if ((gcplid = H5Pcreate(H5P_GROUP_CREATE)) < 0) - goto out; - if (H5Pset_link_creation_order(gcplid, H5P_CRT_ORDER_TRACKED) < 0) - goto out; - if ((gid = H5Gcreate2(loc_id, "g2", H5P_DEFAULT, gcplid, H5P_DEFAULT)) < 0) - goto out; - if (H5Gclose(gid) < 0) - goto out; - - /*------------------------------------------------------------------------- - * H5G_TYPE - *------------------------------------------------------------------------- - */ - - /* create a compound datatype */ - if ((tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) < 0) - goto out; - if (H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_INT) < 0) - goto out; - if (H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_FLOAT) < 0) - goto out; - if (H5Tcommit2(loc_id, "type", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) - goto out; - - /*------------------------------------------------------------------------- - * H5G_LINK - *------------------------------------------------------------------------- - */ - - if (H5Lcreate_soft("dset", loc_id, "link", H5P_DEFAULT, H5P_DEFAULT) < 0) - goto out; - - /*------------------------------------------------------------------------- - * H5G_UDLINK - *------------------------------------------------------------------------- - */ - /* Create an external link. Other UD links are not supported by h5repack */ - if (H5Lcreate_external("file", "path", loc_id, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) - goto out; - - /*------------------------------------------------------------------------- - * write a series of datasetes at root - *------------------------------------------------------------------------- - */ - - if ((rid = H5Gopen2(loc_id, "/", H5P_DEFAULT)) < 0) - goto out; - if (write_dset_in(rid,"dset_referenced",loc_id,0) < 0) - goto out; - if (H5Gclose(rid) < 0) - goto out; - - /* close */ - if (H5Dclose(did) < 0) - goto out; - if (H5Sclose(sid) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - if (H5Pclose(gcplid) < 0) - goto out; - - return 0; - -out: - H5E_BEGIN_TRY - { - H5Dclose(did); - H5Gclose(gid); - H5Gclose(rid); - H5Sclose(sid); - H5Tclose(tid); - H5Pclose(gcplid); - } H5E_END_TRY; - return -1; -} - - -/*------------------------------------------------------------------------- -* Function: make_attributes -* -* Purpose: make a test file with all types of attributes -* -*------------------------------------------------------------------------- -*/ -static -int make_attributes(hid_t loc_id) -{ - hid_t did=-1; - hid_t gid=-1; - hid_t rid=-1; - hid_t sid=-1; - hsize_t dims[1]={2}; - - /*------------------------------------------------------------------------- - * H5G_DATASET - *------------------------------------------------------------------------- - */ - if ((sid = H5Screate_simple(1, dims, NULL)) < 0) - goto out; - if ((did = H5Dcreate2(loc_id, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; - - /*------------------------------------------------------------------------- - * H5G_GROUP - *------------------------------------------------------------------------- - */ - if ((gid = H5Gcreate2(loc_id, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; - if ((rid = H5Gopen2(loc_id, "/", H5P_DEFAULT)) < 0) - goto out; - - /*------------------------------------------------------------------------- - * write a series of attributes on the dataset, group, and root group - *------------------------------------------------------------------------- - */ - - if ( write_attr_in(did,"dset",loc_id,0) < 0) - goto out; - if (write_attr_in(gid,"dset",loc_id,0) < 0) - goto out; - if (write_attr_in(rid,"dset",loc_id,0) < 0) - goto out; - - /* close */ - if (H5Dclose(did) < 0) - goto out; - if (H5Gclose(gid) < 0) - goto out; - if (H5Gclose(rid) < 0) - goto out; - if (H5Sclose(sid) < 0) - goto out; - - return 0; - -out: - H5E_BEGIN_TRY - { - H5Dclose(did); - H5Gclose(gid); - H5Gclose(rid); - H5Sclose(sid); - } H5E_END_TRY; - return -1; - -} - -/*------------------------------------------------------------------------- -* Function: make_hlinks -* -* Purpose: make a test file with hard links -* -*------------------------------------------------------------------------- -*/ -static -int make_hlinks(hid_t loc_id) -{ - hid_t g1id=-1; - hid_t g2id=-1; - hid_t g3id=-1; - hsize_t dims[2]={3,2}; - int buf[3][2]= {{1,1},{1,2},{2,2}}; - - /*------------------------------------------------------------------------- - * create a dataset and some hard links to it - *------------------------------------------------------------------------- - */ - - if(write_dset(loc_id, 2, dims, "dset", H5T_NATIVE_INT, buf) < 0) - return -1; - if(H5Lcreate_hard(loc_id, "dset", H5L_SAME_LOC, "link1 to dset", H5P_DEFAULT, H5P_DEFAULT) < 0) - return -1; - if(H5Lcreate_hard(loc_id, "dset", H5L_SAME_LOC, "link2 to dset", H5P_DEFAULT, H5P_DEFAULT) < 0) - return -1; - if(H5Lcreate_hard(loc_id, "dset", H5L_SAME_LOC, "link3 to dset", H5P_DEFAULT, H5P_DEFAULT) < 0) - return -1; - - /*------------------------------------------------------------------------- - * create a group and some hard links to it - *------------------------------------------------------------------------- - */ - - if((g1id = H5Gcreate2(loc_id, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; - if((g2id = H5Gcreate2(g1id, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; - if((g3id = H5Gcreate2(g2id, "g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; - - if(H5Lcreate_hard(loc_id, "g1", g2id, "link1 to g1", H5P_DEFAULT, H5P_DEFAULT) < 0) - goto out; - if(H5Lcreate_hard(g1id, "g2", g3id, "link1 to g2", H5P_DEFAULT, H5P_DEFAULT) < 0) - goto out; - - - /* close */ - if (H5Gclose(g1id) < 0) - goto out; - if (H5Gclose(g2id) < 0) - goto out; - if (H5Gclose(g3id) < 0) - goto out; - - return 0; - -out: - H5E_BEGIN_TRY - { - H5Gclose(g1id); - H5Gclose(g2id); - H5Gclose(g3id); - } H5E_END_TRY; - return -1; - -} - - -/*------------------------------------------------------------------------- -* Function: make_szip -* -* Purpose: make a dataset with the SZIP filter -* -*------------------------------------------------------------------------- -*/ -#ifdef H5_HAVE_FILTER_SZIP -static -int make_szip(hid_t loc_id) -{ - hid_t dcpl; /* dataset creation property list */ - hid_t sid; /* dataspace ID */ - unsigned szip_options_mask=H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK; - unsigned szip_pixels_per_block=8; - hsize_t dims[RANK]={DIM1,DIM2}; - hsize_t chunk_dims[RANK]={CDIM1,CDIM2}; - int buf[DIM1][DIM2]; - int i, j, n; - int szip_can_encode = 0; - - for (i=n=0; i<DIM1; i++) - { - for (j=0; j<DIM2; j++) - { - buf[i][j]=n++; - } - } - /* create a space */ - if((sid = H5Screate_simple(RANK, dims, NULL)) < 0) - return -1; - /* create a dcpl */ - if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto out; - /* set up chunk */ - if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0) - goto out; - - /*------------------------------------------------------------------------- - * SZIP - *------------------------------------------------------------------------- - */ - /* Make sure encoding is enabled */ - if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) - { - szip_can_encode = 1; - } - if (szip_can_encode) - { - /* set szip data */ - if(H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block) < 0) - goto out; - if (make_dset(loc_id,"dset_szip",sid,dcpl,buf) < 0) - goto out; - } - else - { - /* WARNING? SZIP is decoder only, can't generate test files */ - } - - if(H5Sclose(sid) < 0) - goto out; - if(H5Pclose(dcpl) < 0) - goto out; - - return 0; - -out: - H5E_BEGIN_TRY { - H5Pclose(dcpl); - H5Sclose(sid); - } H5E_END_TRY; - return -1; -} -#endif /* H5_HAVE_FILTER_SZIP */ - - - -/*------------------------------------------------------------------------- -* Function: make_deflate -* -* Purpose: make a dataset with the deflate filter -* -*------------------------------------------------------------------------- -*/ -static -int make_deflate(hid_t loc_id) -{ - hid_t dcpl; /* dataset creation property list */ - hid_t sid; /* dataspace ID */ - hsize_t dims[RANK]={DIM1,DIM2}; - hsize_t chunk_dims[RANK]={CDIM1,CDIM2}; - int buf[DIM1][DIM2]; - hobj_ref_t bufref[1]; /* reference */ - hsize_t dims1r[1]={1}; - int i, j, n; - - for (i=n=0; i<DIM1; i++) - { - for (j=0; j<DIM2; j++) - { - buf[i][j]=n++; - } - } - - /* create a space */ - if((sid = H5Screate_simple(RANK, dims, NULL)) < 0) - return -1; - /* create a dcpl */ - if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto out; - /* set up chunk */ - if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0) - goto out; - - /*------------------------------------------------------------------------- - * GZIP - *------------------------------------------------------------------------- - */ -#if defined (H5_HAVE_FILTER_DEFLATE) - /* set deflate data */ - if(H5Pset_deflate(dcpl, 9) < 0) - goto out; - if (make_dset(loc_id,"dset_deflate",sid,dcpl,buf) < 0) - goto out; - - /* create a reference to the dataset, test second seeep of file for references */ - - if (H5Rcreate(&bufref[0],loc_id,"dset_deflate",H5R_OBJECT,(hid_t)-1) < 0) - goto out; - if (write_dset(loc_id,1,dims1r,"ref",H5T_STD_REF_OBJ,bufref) < 0) - goto out; -#endif - - - /*------------------------------------------------------------------------- - * close space and dcpl - *------------------------------------------------------------------------- - */ - if(H5Sclose(sid) < 0) - goto out; - if(H5Pclose(dcpl) < 0) - goto out; - - return 0; - -out: - H5E_BEGIN_TRY { - H5Pclose(dcpl); - H5Sclose(sid); - } H5E_END_TRY; - return -1; -} - - -/*------------------------------------------------------------------------- -* Function: make_shuffle -* -* Purpose: make a dataset with the shuffle filter -* -*------------------------------------------------------------------------- -*/ -static -int make_shuffle(hid_t loc_id) -{ - hid_t dcpl; /* dataset creation property list */ - hid_t sid; /* dataspace ID */ - hsize_t dims[RANK]={DIM1,DIM2}; - hsize_t chunk_dims[RANK]={CDIM1,CDIM2}; - int buf[DIM1][DIM2]; - int i, j, n; - - for (i=n=0; i<DIM1; i++) - { - for (j=0; j<DIM2; j++) - { - buf[i][j]=n++; - } - } - /* create a space */ - if((sid = H5Screate_simple(RANK, dims, NULL)) < 0) - return -1; - /* create a dcpl */ - if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto out; - /* set up chunk */ - if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0) - goto out; - - /*------------------------------------------------------------------------- - * shuffle - *------------------------------------------------------------------------- - */ - - /* set the shuffle filter */ - if (H5Pset_shuffle(dcpl) < 0) - goto out; - if (make_dset(loc_id,"dset_shuffle",sid,dcpl,buf) < 0) - goto out; - - - /*------------------------------------------------------------------------- - * close space and dcpl - *------------------------------------------------------------------------- - */ - if(H5Sclose(sid) < 0) - goto out; - if(H5Pclose(dcpl) < 0) - goto out; - - return 0; - -out: - H5E_BEGIN_TRY { - H5Pclose(dcpl); - H5Sclose(sid); - } H5E_END_TRY; - return -1; -} - -/*------------------------------------------------------------------------- -* Function: make_fletcher32 -* -* Purpose: make a dataset with the fletcher32 filter -* -*------------------------------------------------------------------------- -*/ -static -int make_fletcher32(hid_t loc_id) -{ - hid_t dcpl; /* dataset creation property list */ - hid_t sid; /* dataspace ID */ - hsize_t dims[RANK]={DIM1,DIM2}; - hsize_t chunk_dims[RANK]={CDIM1,CDIM2}; - int buf[DIM1][DIM2]; - int i, j, n; - - for (i=n=0; i<DIM1; i++) - { - for (j=0; j<DIM2; j++) - { - buf[i][j]=n++; - } - } - /* create a space */ - if((sid = H5Screate_simple(RANK, dims, NULL)) < 0) - return -1; - /* create a dataset creation property list; the same DCPL is used for all dsets */ - if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto out; - /* set up chunk */ - if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0) - goto out; - - - /*------------------------------------------------------------------------- - * fletcher32 - *------------------------------------------------------------------------- - */ - - /* remove the filters from the dcpl */ - if (H5Premove_filter(dcpl,H5Z_FILTER_ALL) < 0) - goto out; - /* set the checksum filter */ - if (H5Pset_fletcher32(dcpl) < 0) - goto out; - if (make_dset(loc_id,"dset_fletcher32",sid,dcpl,buf) < 0) - goto out; - - /*------------------------------------------------------------------------- - * close space and dcpl - *------------------------------------------------------------------------- - */ - if(H5Sclose(sid) < 0) - goto out; - if(H5Pclose(dcpl) < 0) - goto out; - - return 0; - -out: - H5E_BEGIN_TRY { - H5Pclose(dcpl); - H5Sclose(sid); - } H5E_END_TRY; - return -1; -} - - -/*------------------------------------------------------------------------- -* Function: make_nbit -* -* Purpose: make a dataset with the nbit filter -* -*------------------------------------------------------------------------- -*/ -static -int make_nbit(hid_t loc_id) -{ - hid_t dcpl; /* dataset creation property list */ - hid_t sid; /* dataspace ID */ - hid_t dtid; - hid_t dsid; - hsize_t dims[RANK]={DIM1,DIM2}; - hsize_t chunk_dims[RANK]={CDIM1,CDIM2}; - int buf[DIM1][DIM2]; - int i, j, n; - - for (i=n=0; i<DIM1; i++) - { - for (j=0; j<DIM2; j++) - { - buf[i][j]=n++; - } - } - /* create a space */ - if((sid = H5Screate_simple(RANK, dims, NULL)) < 0) - return -1; - /* create a dataset creation property list; the same DCPL is used for all dsets */ - if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto out; - /* set up chunk */ - if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0) - goto out; - - dtid = H5Tcopy(H5T_NATIVE_INT); - if (H5Tset_precision(dtid,(H5Tget_precision(dtid) - 1)) < 0) - { - H5Tclose(dtid); - goto out; - } - - /* remove the filters from the dcpl */ - if(H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0) - { - H5Tclose(dtid); - goto out; - } - if(H5Pset_nbit(dcpl) < 0) { - H5Tclose(dtid); - goto out; - } - if((dsid = H5Dcreate2(loc_id, "dset_nbit", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) { - H5Tclose(dtid); - goto out; - } - if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) { - H5Tclose(dtid); - goto out; - } - H5Dclose(dsid); - - if(H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0) { - H5Tclose(dtid); - goto out; - } - if((dsid = H5Dcreate2(loc_id, "dset_int31", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) { - H5Tclose(dtid); - goto out; - } - if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) { - H5Tclose(dtid); - goto out; - } - H5Dclose(dsid); - - /*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ - if(H5Sclose(sid) < 0) - goto out; - if(H5Pclose(dcpl) < 0) - goto out; - if (H5Tclose(dtid) < 0) - goto out; - - return 0; - -out: - H5E_BEGIN_TRY { - H5Pclose(dcpl); - H5Sclose(sid); - } H5E_END_TRY; - return -1; -} - - -/*------------------------------------------------------------------------- -* Function: make_scaleoffset -* -* Purpose: make a dataset with the scaleoffset filter -* -*------------------------------------------------------------------------- -*/ -static -int make_scaleoffset(hid_t loc_id) -{ - hid_t dcpl; /* dataset creation property list */ - hid_t sid; /* dataspace ID */ - hid_t dtid; - hid_t dsid; - hsize_t dims[RANK]={DIM1,DIM2}; - hsize_t chunk_dims[RANK]={CDIM1,CDIM2}; - int buf[DIM1][DIM2]; - int i, j, n; - - for (i=n=0; i<DIM1; i++) - { - for (j=0; j<DIM2; j++) - { - buf[i][j]=n++; - } - } - /* create a space */ - if((sid = H5Screate_simple(RANK, dims, NULL)) < 0) - return -1; - /* create a dataset creation property list; the same DCPL is used for all dsets */ - if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto out; - /* set up chunk */ - if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0) - goto out; - - dtid = H5Tcopy(H5T_NATIVE_INT); - - /* remove the filters from the dcpl */ - if(H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0) { - H5Tclose(dtid); - goto out; - } - if(H5Pset_scaleoffset(dcpl, H5Z_SO_INT, 31) < 0) { - H5Tclose(dtid); - goto out; - } - if((dsid = H5Dcreate2(loc_id, "dset_scaleoffset", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) { - H5Tclose(dtid); - goto out; - } - if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) { - H5Tclose(dtid); - goto out; - } - H5Dclose(dsid); - if((dsid = H5Dcreate2(loc_id, "dset_none", dtid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { - H5Tclose(dtid); - goto out; - } - if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) { - H5Tclose(dtid); - goto out; - } - H5Tclose(dtid); - H5Dclose(dsid); - - /*------------------------------------------------------------------------- - * close space and dcpl - *------------------------------------------------------------------------- - */ - if(H5Sclose(sid) < 0) - goto out; - if(H5Pclose(dcpl) < 0) - goto out; - - return 0; - -out: - H5E_BEGIN_TRY { - H5Pclose(dcpl); - H5Sclose(sid); - } H5E_END_TRY; - return -1; -} - - -/*------------------------------------------------------------------------- -* Function: make_all_filters -* -* Purpose: make a file with all filters -* -*------------------------------------------------------------------------- -*/ -static -int make_all_filters(hid_t loc_id) -{ - hid_t dcpl; /* dataset creation property list */ - hid_t sid; /* dataspace ID */ - hid_t dtid; - hid_t dsid; -#if defined (H5_HAVE_FILTER_SZIP) - unsigned szip_options_mask=H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK; - unsigned szip_pixels_per_block=8; -#endif /* H5_HAVE_FILTER_SZIP */ - hsize_t dims[RANK]={DIM1,DIM2}; - hsize_t chunk_dims[RANK]={CDIM1,CDIM2}; - int buf[DIM1][DIM2]; - int i, j, n; -#if defined (H5_HAVE_FILTER_SZIP) - int szip_can_encode = 0; -#endif - - for (i=n=0; i<DIM1; i++) - { - for (j=0; j<DIM2; j++) - { - buf[i][j]=n++; - } - } - /* create a space */ - if((sid = H5Screate_simple(RANK, dims, NULL)) < 0) - return -1; - /* create a dataset creation property list; the same DCPL is used for all dsets */ - if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto out; - /* set up chunk */ - if (H5Pset_chunk(dcpl, RANK, chunk_dims) < 0) - goto out; - - /* set the shuffle filter */ - if (H5Pset_shuffle(dcpl) < 0) - goto out; - - /* set the checksum filter */ - if (H5Pset_fletcher32(dcpl) < 0) - goto out; - -#if defined (H5_HAVE_FILTER_SZIP) - if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) - { - szip_can_encode = 1; - } - if (szip_can_encode) - { - /* set szip data */ - if(H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block) < 0) - goto out; - } else { - /* WARNING? SZIP is decoder only, can't generate test data using szip */ - } -#endif - -#if defined (H5_HAVE_FILTER_DEFLATE) - /* set deflate data */ - if(H5Pset_deflate(dcpl, 9) < 0) - goto out; -#endif - - if (make_dset(loc_id,"dset_all",sid,dcpl,buf) < 0) - goto out; - - /* remove the filters from the dcpl */ - if (H5Premove_filter(dcpl,H5Z_FILTER_ALL) < 0) - goto out; - /* set the checksum filter */ - if (H5Pset_fletcher32(dcpl) < 0) - goto out; - if (make_dset(loc_id,"dset_fletcher32",sid,dcpl,buf) < 0) - goto out; - - - /* Make sure encoding is enabled */ -#if defined (H5_HAVE_FILTER_SZIP) - if (szip_can_encode) - { - /* remove the filters from the dcpl */ - if (H5Premove_filter(dcpl,H5Z_FILTER_ALL) < 0) - goto out; - /* set szip data */ - if(H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block) < 0) - goto out; - if (make_dset(loc_id,"dset_szip",sid,dcpl,buf) < 0) - goto out; - } else - { - /* WARNING? SZIP is decoder only, can't generate test dataset */ - } -#endif - - - /* remove the filters from the dcpl */ - if (H5Premove_filter(dcpl,H5Z_FILTER_ALL) < 0) - goto out; - /* set the shuffle filter */ - if (H5Pset_shuffle(dcpl) < 0) - goto out; - if (make_dset(loc_id,"dset_shuffle",sid,dcpl,buf) < 0) - goto out; - - -#if defined (H5_HAVE_FILTER_DEFLATE) - /* remove the filters from the dcpl */ - if (H5Premove_filter(dcpl,H5Z_FILTER_ALL) < 0) - goto out; - /* set deflate data */ - if(H5Pset_deflate(dcpl, 1) < 0) - goto out; - if (make_dset(loc_id,"dset_deflate",sid,dcpl,buf) < 0) - goto out; -#endif - - - - /* remove the filters from the dcpl */ - if (H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0) - goto out; - /* set the shuffle filter */ - if (H5Pset_nbit(dcpl) < 0) - goto out; - if ((dtid = H5Tcopy(H5T_NATIVE_INT)) < 0) - goto out; - if (H5Tset_precision(dtid, (H5Tget_precision(dtid) - 1)) < 0) - goto out; - if((dsid = H5Dcreate2(loc_id, "dset_nbit", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - goto out; - if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - goto out; - - /* close */ - if(H5Tclose(dtid) < 0) - return -1; - if(H5Dclose(dsid) < 0) - return -1; - - if(H5Sclose(sid) < 0) - goto out; - if(H5Pclose(dcpl) < 0) - goto out; - - return 0; - -out: - H5E_BEGIN_TRY - { - H5Pclose(dcpl); - H5Sclose(sid); - } H5E_END_TRY; - return -1; -} - - - -/*------------------------------------------------------------------------- -* Function: make_early -* -* Purpose: create a file for the H5D_ALLOC_TIME_EARLY test -* -*------------------------------------------------------------------------- -*/ -static -int make_early(void) -{ - hsize_t dims[1] ={3000}; - hsize_t cdims[1]={30}; - hid_t fid=-1; - hid_t did=-1; - hid_t sid=-1; - hid_t tid=-1; - hid_t dcpl=-1; - int i; - char name[10]; - int iter=100; - - if ((fid = H5Fcreate(FNAME5, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) - return -1; - if (H5Fclose(fid) < 0) - goto out; - - if ((sid = H5Screate_simple(1, dims, NULL)) < 0) - goto out; - if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto out; - if (H5Pset_chunk(dcpl, 1, cdims) < 0) - goto out; - if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0) - goto out; - - for(i = 0; i < iter; i++) - { - if ((fid = H5Fopen(FNAME5, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) - goto out; - if ((did = H5Dcreate2(fid, "early", H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - goto out; - if ((tid = H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) - goto out; - sprintf(name, "%d", i); - if ((H5Tcommit2(fid, name, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - if (H5Dclose(did) < 0) - goto out; - if (H5Ldelete(fid, "early", H5P_DEFAULT) < 0) - goto out; - if (H5Fclose(fid) < 0) - goto out; - } - - /*------------------------------------------------------------------------- - * do the same without close/opening the file and creating the dataset - *------------------------------------------------------------------------- - */ - - if ((fid = H5Fcreate(FNAME6, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) - return -1; - - for(i = 0; i < iter; i++) - { - if ((tid = H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) - goto out; - sprintf(name, "%d", i); - if ((H5Tcommit2(fid, name, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - } - - if (H5Sclose(sid) < 0) - goto out; - if (H5Pclose(dcpl) < 0) - goto out; - if (H5Fclose(fid) < 0) - goto out; - - return 0; - -out: - H5E_BEGIN_TRY - { - H5Tclose(tid); - H5Pclose(dcpl); - H5Sclose(sid); - H5Dclose(did); - H5Fclose(fid); - } H5E_END_TRY; - return -1; -} - - -/*------------------------------------------------------------------------- -* Function: make_layout -* -* Purpose: make several datasets with several layouts in location LOC_ID -* -*------------------------------------------------------------------------- -*/ -static -int make_layout(hid_t loc_id) -{ - hid_t dcpl=-1; /* dataset creation property list */ - hid_t sid=-1; /* dataspace ID */ - hsize_t dims[RANK]={DIM1,DIM2}; - hsize_t chunk_dims[RANK]={CDIM1,CDIM2}; - int buf[DIM1][DIM2]; - int i, j, n; - char name[6]; - - - for (i=n=0; i<DIM1; i++) - { - for (j=0; j<DIM2; j++) - { - buf[i][j]=n++; - } - } - - /*------------------------------------------------------------------------- - * make several dataset with no filters - *------------------------------------------------------------------------- - */ - for (i=0; i<4; i++) - { - sprintf(name,"dset%d",i+1); - if (write_dset(loc_id,RANK,dims,name,H5T_NATIVE_INT,buf) < 0) - return -1; - } - - - /*------------------------------------------------------------------------- - * make several dataset with several layout options - *------------------------------------------------------------------------- - */ - /* create a space */ - if((sid = H5Screate_simple(RANK, dims, NULL)) < 0) - return -1; - /* create a dataset creation property list; the same DCPL is used for all dsets */ - if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - { - goto out; - } - - /*------------------------------------------------------------------------- - * H5D_COMPACT - *------------------------------------------------------------------------- - */ - if(H5Pset_layout (dcpl,H5D_COMPACT) < 0) - goto out; - if (make_dset(loc_id,"dset_compact",sid,dcpl,buf) < 0) - { - goto out; - } - - /*------------------------------------------------------------------------- - * H5D_CONTIGUOUS - *------------------------------------------------------------------------- - */ - if(H5Pset_layout (dcpl,H5D_CONTIGUOUS) < 0) - goto out; - if (make_dset(loc_id,"dset_contiguous",sid,dcpl,buf) < 0) - { - goto out; - } - - /*------------------------------------------------------------------------- - * H5D_CHUNKED - *------------------------------------------------------------------------- - */ - if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0) - goto out; - if (make_dset(loc_id,"dset_chunk",sid,dcpl,buf) < 0) - { - goto out; - } - - /*------------------------------------------------------------------------- - * close space and dcpl - *------------------------------------------------------------------------- - */ - if(H5Sclose(sid) < 0) - goto out; - if(H5Pclose(dcpl) < 0) - goto out; - - return 0; - -out: - H5E_BEGIN_TRY - { - H5Pclose(dcpl); - H5Sclose(sid); - } H5E_END_TRY; - return -1; -} - -/*------------------------------------------------------------------------- - * Function: make_layout2 - * - * Purpose: create datasets with contiguous and chunked layouts: - * - * contig_small: < 1k, fixed dims datspace - * chunked_small_fixed: < 1k, fixed dims dataspace - * - *------------------------------------------------------------------------- - */ -#define S_DIM1 4 -#define S_DIM2 10 -#define CONTIG_S "contig_small" -#define CHUNKED_S_FIX "chunked_small_fixed" - -static -int make_layout2(hid_t loc_id) -{ - - hid_t contig_dcpl = -1; /* dataset creation property list */ - hid_t chunked_dcpl = -1; /* dataset creation property list */ - - int i, j, n; /* Local index variables */ - int ret_value = -1; /* Return value */ - hid_t s_sid = -1; /* dataspace ID */ - - hsize_t s_dims[RANK] = {S_DIM1,S_DIM2}; /* Dataspace (< 1 k) */ - hsize_t chunk_dims[RANK] = {S_DIM1/2, S_DIM2/2}; /* Dimension sizes for chunks */ - - int s_buf[S_DIM1][S_DIM2]; /* Temporary buffer */ - - for(i = n = 0; i < S_DIM1; i++) { - for (j = 0; j < S_DIM2; j++) { - s_buf[i][j] = n++; - } - } - - /* Create dataspaces */ - if((s_sid = H5Screate_simple(RANK, s_dims, NULL)) < 0) - goto out; - - /* Create contiguous datasets */ - if((contig_dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto out; - if(H5Pset_layout(contig_dcpl, H5D_CONTIGUOUS) < 0) - goto out; - if(make_dset(loc_id, CONTIG_S, s_sid, contig_dcpl, s_buf) < 0) - goto out; - - /* Create chunked datasets */ - if((chunked_dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto out; - if(H5Pset_chunk(chunked_dcpl, RANK, chunk_dims) < 0) - goto out; - if(make_dset(loc_id, CHUNKED_S_FIX, s_sid, chunked_dcpl, s_buf) < 0) - goto out; - - ret_value = 0; - -out: - H5E_BEGIN_TRY { - H5Pclose(contig_dcpl); - H5Pclose(chunked_dcpl); - - H5Sclose(s_sid); - - } H5E_END_TRY; - - return(ret_value); - -} /* make_layout2() */ - -/*------------------------------------------------------------------------- -* Function: make_layout3 -* -* Purpose: make chunked datasets with unlimited max dim and chunk dim is -* bigger than current dim. (HDFFV-7933) -* Test for converting chunk to chunk , chunk to conti and chunk -* to compact. -* - The chunk to chunk changes layout bigger than any current dim -* again. -* - The chunk to compact test dataset bigger than 64K, should -* remain original layout.* -* -*------------------------------------------------------------------------- -*/ -#define DIM1_L3 300 -#define DIM2_L3 200 -/* small size */ -#define SDIM1_L3 4 -#define SDIM2_L3 50 -static -int make_layout3(hid_t loc_id) -{ - hid_t dcpl1=-1; /* dataset creation property list */ - hid_t dcpl2=-1; /* dataset creation property list */ - hid_t dcpl3=-1; /* dataset creation property list */ - hid_t sid1=-1; /* dataspace ID */ - hid_t sid2=-1; /* dataspace ID */ - hsize_t dims1[RANK]={DIM1_L3,DIM2_L3}; - hsize_t dims2[RANK]={SDIM1_L3,SDIM2_L3}; - hsize_t maxdims[RANK]={H5S_UNLIMITED, H5S_UNLIMITED}; - hsize_t chunk_dims1[RANK]={DIM1_L3*2,5}; - hsize_t chunk_dims2[RANK]={SDIM1_L3 + 2, SDIM2_L3/2}; - hsize_t chunk_dims3[RANK]={SDIM1_L3 - 2, SDIM2_L3/2}; - int buf1[DIM1_L3][DIM2_L3]; - int buf2[SDIM1_L3][SDIM2_L3]; - int i, j, n; - - /* init buf1 */ - for (i=n=0; i<DIM1_L3; i++) - { - for (j=0; j<DIM2_L3; j++) - { - buf1[i][j]=n++; - } - } - - /* init buf2 */ - for (i=n=0; i<SDIM1_L3; i++) - { - for (j=0; j<SDIM2_L3; j++) - { - buf2[i][j]=n++; - } - } - - /*------------------------------------------------------------------------- - * make chunked dataset with - * - dset maxdims are UNLIMIT - * - a chunk dim is bigger than dset dim - * - dset size bigger than compact max (64K) - *------------------------------------------------------------------------- - */ - /* create a space */ - if((sid1 = H5Screate_simple(RANK, dims1, maxdims)) < 0) - return -1; - /* create a dataset creation property list; the same DCPL is used for all dsets */ - if ((dcpl1 = H5Pcreate(H5P_DATASET_CREATE)) < 0) - { - goto out; - } - - if(H5Pset_chunk(dcpl1, RANK, chunk_dims1) < 0) - goto out; - if (make_dset(loc_id,"chunk_unlimit1",sid1,dcpl1,buf1) < 0) - { - goto out; - } - - /*------------------------------------------------------------------------- - * make chunked dataset with - * - dset maxdims are UNLIMIT - * - a chunk dim is bigger than dset dim - * - dset size smaller than compact (64K) - *------------------------------------------------------------------------- - */ - - /* create a space */ - if((sid2 = H5Screate_simple(RANK, dims2, maxdims)) < 0) - return -1; - /* create a dataset creation property list; the same DCPL is used for all dsets */ - if ((dcpl2 = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto out; - - if(H5Pset_chunk(dcpl2, RANK, chunk_dims2) < 0) - goto out; - - if (make_dset(loc_id,"chunk_unlimit2",sid2,dcpl2,buf2) < 0) - goto out; - - /*------------------------------------------------------------------------- - * make chunked dataset with - * - dset maxdims are UNLIMIT - * - a chunk dims are smaller than dset dims - * - dset size smaller than compact (64K) - *------------------------------------------------------------------------- - */ - /* create a dataset creation property list; the same DCPL is used for all dsets */ - if ((dcpl3 = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto out; - - if(H5Pset_chunk(dcpl3, RANK, chunk_dims3) < 0) - goto out; - - if (make_dset(loc_id,"chunk_unlimit3",sid2,dcpl3,buf2) < 0) - goto out; - - /*------------------------------------------------------------------------- - * close space and dcpl - *------------------------------------------------------------------------- - */ - if(H5Sclose(sid1) < 0) - goto out; - if(H5Sclose(sid2) < 0) - goto out; - if(H5Pclose(dcpl1) < 0) - goto out; - if(H5Pclose(dcpl2) < 0) - goto out; - if(H5Pclose(dcpl3) < 0) - goto out; - - return 0; - -out: - H5E_BEGIN_TRY - { - H5Sclose(sid1); - H5Sclose(sid2); - H5Pclose(dcpl1); - H5Pclose(dcpl2); - H5Pclose(dcpl3); - } H5E_END_TRY; - return -1; -} - -/*------------------------------------------------------------------------- -* Function: make a file with an integer dataset with a fill value -* -* Purpose: test copy of fill values -* -*------------------------------------------------------------------------- -*/ -static -int make_fill(hid_t loc_id) -{ - hid_t did=-1; - hid_t sid=-1; - hid_t dcpl; - hsize_t dims[2]={3,2}; - int buf[3][2]= {{1,1},{1,2},{2,2}}; - int fillvalue = 2; - - /*------------------------------------------------------------------------- - * H5T_INTEGER, write a fill value - *------------------------------------------------------------------------- - */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto out; - if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillvalue) < 0) - goto out; - if((sid = H5Screate_simple(2,dims,NULL)) < 0) - goto out; - if((did = H5Dcreate2(loc_id, "dset_fill", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - goto out; - if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - goto out; - - /* close */ - if(H5Sclose(sid) < 0) - goto out; - if(H5Pclose(dcpl) < 0) - goto out; - if(H5Dclose(did) < 0) - goto out; - - return 0; - -out: - H5E_BEGIN_TRY { - H5Pclose(dcpl); - H5Sclose(sid); - H5Dclose(did); - } H5E_END_TRY; - return -1; - -} - -/*------------------------------------------------------------------------- -* Function: make_big -* -* Purpose: used in test read by hyperslabs. Creates a 128MB dataset. -* Only 1 1024Kb hyperslab is written. -* -*------------------------------------------------------------------------- -*/ -static -int make_big(hid_t loc_id) -{ - hid_t did=-1; - hid_t f_sid=-1; - hid_t m_sid=-1; - hid_t tid; - hid_t dcpl; - hsize_t dims[1]={ H5TOOLS_MALLOCSIZE + 1}; /* dataset dimensions */ - hsize_t hs_size[1]; /* hyperslab dimensions */ - hsize_t hs_start[1]; /* hyperslab start */ - hsize_t chunk_dims[1]={1024}; /* chunk dimensions */ - size_t size; - size_t nelmts=(size_t)1024; - signed char fillvalue=-1; - signed char *buf=NULL; - - /* write one 1024 byte hyperslab */ - hs_start[0] = 0; - hs_size[0] = 1024; - - /* create */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto out; - if(H5Pset_fill_value(dcpl, H5T_NATIVE_SCHAR, &fillvalue) < 0) - goto out; - if(H5Pset_chunk(dcpl, 1, chunk_dims) < 0) - goto out; - if((f_sid = H5Screate_simple(1,dims,NULL)) < 0) - goto out; - if((did = H5Dcreate2(loc_id, "dset", H5T_NATIVE_SCHAR, f_sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - goto out; - if((m_sid = H5Screate_simple(1, hs_size, hs_size)) < 0) - goto out; - if((tid = H5Dget_type(did)) < 0) - goto out; - if((size = H5Tget_size(tid))<=0) - goto out; - - /* initialize buffer to 0 */ - buf=(signed char *) HDcalloc( nelmts, size); - - if (H5Sselect_hyperslab (f_sid,H5S_SELECT_SET,hs_start,NULL,hs_size, NULL) < 0) - goto out; - if (H5Dwrite (did,H5T_NATIVE_SCHAR,m_sid,f_sid,H5P_DEFAULT,buf) < 0) - goto out; - - HDfree(buf); - buf=NULL; - - /* close */ - if(H5Sclose(f_sid) < 0) - goto out; - if(H5Sclose(m_sid) < 0) - goto out; - if(H5Pclose(dcpl) < 0) - goto out; - if(H5Dclose(did) < 0) - goto out; - - return 0; - -out: - H5E_BEGIN_TRY { - H5Pclose(dcpl); - H5Sclose(f_sid); - H5Sclose(m_sid); - H5Dclose(did); - } H5E_END_TRY; - return -1; - -} - - -/*------------------------------------------------------------------------- -* Function: make_external -* -* Purpose: create a external dataset -* -*------------------------------------------------------------------------- -*/ -static -int make_external(hid_t loc_id) -{ - hid_t did=-1; - hid_t sid=-1; - hid_t dcpl; - int buf[2]={1,2}; - hsize_t cur_size[1]; /* data space current size */ - hsize_t max_size[1]; /* data space maximum size */ - hsize_t size; - - cur_size[0] = max_size[0] = 2; - size = max_size[0] * sizeof(int); - - /* create */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto out; - if(H5Pset_external(dcpl, H5REPACK_EXTFILE, (off_t)0, size) < 0) - goto out; - if((sid = H5Screate_simple(1,cur_size, max_size)) < 0) - goto out; - if((did = H5Dcreate2(loc_id, "external", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - goto out; - if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - goto out; - - /* close */ - if(H5Sclose(sid) < 0) - goto out; - if(H5Pclose(dcpl) < 0) - goto out; - if(H5Dclose(did) < 0) - goto out; - - return 0; - -out: - H5E_BEGIN_TRY - { - H5Pclose(dcpl); - H5Sclose(sid); - H5Dclose(did); - } H5E_END_TRY; - return -1; - -} - -/*------------------------------------------------------------------------- -* Function: make_userblock -* -* Purpose: create a file for the userblock copying test -* -*------------------------------------------------------------------------- -*/ -static int -make_userblock(void) -{ - hid_t fid = -1; - hid_t fcpl = -1; - int fd = -1; /* File descriptor for writing userblock */ - char ub[USERBLOCK_SIZE]; /* User block data */ - ssize_t nwritten; /* # of bytes written */ - size_t u; /* Local index variable */ - - /* Create file creation property list with userblock set */ - if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - goto out; - if(H5Pset_userblock(fcpl, (hsize_t)USERBLOCK_SIZE) < 0) - goto out; - - /* Create file with userblock */ - if((fid = H5Fcreate(FNAME16, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0) - goto out; - if(H5Fclose(fid) < 0) - goto out; - - /* Close file creation property list */ - if(H5Pclose(fcpl) < 0) - goto out; - - - /* Initialize userblock data */ - for(u = 0; u < USERBLOCK_SIZE; u++) - ub[u] = (char)('a' + (char)(u % 26)); - - /* Re-open HDF5 file, as "plain" file */ - if((fd = HDopen(FNAME16, O_WRONLY, 0644)) < 0) - goto out; - - /* Write userblock data */ - nwritten = HDwrite(fd, ub, (size_t)USERBLOCK_SIZE); - HDassert(nwritten == USERBLOCK_SIZE); - - /* Close file */ - HDclose(fd); - - return 0; - -out: - H5E_BEGIN_TRY { - H5Pclose(fcpl); - H5Fclose(fid); - } H5E_END_TRY; - if(fd > 0) - HDclose(fd); - - return -1; -} /* end make_userblock() */ - -/*------------------------------------------------------------------------- -* Function: verify_userblock -* -* Purpose: Verify that the userblock was copied correctly -* -*------------------------------------------------------------------------- -*/ -static int -verify_userblock( const char* filename) -{ - hid_t fid = -1; - hid_t fcpl = -1; - int fd = -1; /* File descriptor for writing userblock */ - char ub[USERBLOCK_SIZE]; /* User block data */ - hsize_t ub_size = 0; /* User block size */ - ssize_t nread; /* # of bytes read */ - size_t u; /* Local index variable */ - - /* Open file with userblock */ - if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) - goto out; - - /* Retrieve file creation property list & userblock size */ - if((fcpl = H5Fget_create_plist(fid)) < 0) - goto out; - if(H5Pget_userblock(fcpl, &ub_size) < 0) - goto out; - - /* Verify userblock size is correct */ - if(ub_size != USERBLOCK_SIZE) - goto out; - - /* Close file creation property list */ - if(H5Pclose(fcpl) < 0) - goto out; - - if(H5Fclose(fid) < 0) - goto out; - - - /* Re-open HDF5 file, as "plain" file */ - if((fd = HDopen(filename, O_RDONLY, 0)) < 0) - goto out; - - /* Read userblock data */ - nread = HDread(fd, ub, (size_t)USERBLOCK_SIZE); - HDassert(nread == USERBLOCK_SIZE); - - /* Verify userblock data */ - for(u = 0; u < USERBLOCK_SIZE; u++) - if(ub[u] != (char)('a' + (u % 26))) - goto out; - - /* Close file */ - HDclose(fd); - - return 0; - -out: - H5E_BEGIN_TRY { - H5Pclose(fcpl); - H5Fclose(fid); - } H5E_END_TRY; - if(fd > 0) - HDclose(fd); - - return -1; -} /* end verify_userblock() */ - - -/*------------------------------------------------------------------------- -* Function: make_userblock_file -* -* Purpose: create a file for the userblock add test -* -*------------------------------------------------------------------------- -*/ -static int -make_userblock_file(void) -{ - int fd = -1; /* File descriptor for writing userblock */ - char ub[USERBLOCK_SIZE]; /* User block data */ - ssize_t nwritten; /* # of bytes written */ - size_t u; /* Local index variable */ - - /* initialize userblock data */ - for(u = 0; u < USERBLOCK_SIZE; u++) - ub[u] = (char)('a' + (char)(u % 26)); - - /* open file */ - if((fd = HDopen(FNAME_UB,O_WRONLY|O_CREAT|O_TRUNC, 0644 )) < 0) - goto out; - - /* write userblock data */ - nwritten = HDwrite(fd, ub, (size_t)USERBLOCK_SIZE); - HDassert(nwritten == USERBLOCK_SIZE); - - /* close file */ - HDclose(fd); - - return 0; - -out: - - if(fd > 0) - HDclose(fd); - - return -1; -} - -/*------------------------------------------------------------------------- -* Function: write_dset_in -* -* Purpose: write datasets in LOC_ID -* -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu -* -* Date: November 12, 2003 -* -*------------------------------------------------------------------------- -*/ -static -int write_dset_in(hid_t loc_id, - const char* dset_name, /* for saving reference to dataset*/ - hid_t file_id, - int make_diffs /* flag to modify data buffers */) -{ - /* compound datatype */ - typedef struct s_t - { - char a; - double b; - } s_t; - - typedef enum - { - RED, - GREEN - } e_t; - - hid_t did=-1; - hid_t sid=-1; - hid_t tid=-1; - hid_t pid=-1; - unsigned i, j; - int val, k, n; - float f; - - /* create 1D attributes with dimension [2], 2 elements */ - hsize_t dims[1]={2}; - hsize_t dims1r[1]={2}; - char buf1[2][3]= {"ab","de"}; /* string */ - char buf2[2]= {1,2}; /* bitfield, opaque */ - s_t buf3[2]= {{1,2},{3,4}}; /* compound */ - hobj_ref_t buf4[2]; /* reference */ - e_t buf45[2]= {RED,GREEN}; /* enum */ - hvl_t buf5[2]; /* vlen */ - hsize_t dimarray[1]={3}; /* array dimension */ - int buf6[2][3]= {{1,2,3},{4,5,6}}; /* array */ - int buf7[2]= {1,2}; /* integer */ - float buf8[2]= {1,2}; /* float */ - - /* create 2D attributes with dimension [3][2], 6 elements */ - hsize_t dims2[2]={3,2}; - hsize_t dims2r[2]={1,1}; - char buf12[6][3]= {"ab","cd","ef","gh","ij","kl"}; /* 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[1][1]; /* reference */ - hvl_t buf52[3][2]; /* vlen */ - int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */ - int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */ - float buf82[3][2]= {{1,2},{3,4},{5,6}}; /* float */ - - /* create 3D attributes with dimension [4][3][2], 24 elements */ - hsize_t dims3[3]={4,3,2}; - hsize_t dims3r[3]={1,1,1}; - char buf13[24][3]= {"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 buf23[4][3][2]; /* bitfield, opaque */ - s_t buf33[4][3][2]; /* compound */ - hobj_ref_t buf43[1][1][1]; /* reference */ - hvl_t buf53[4][3][2]; /* vlen */ - int buf63[24][3]; /* array */ - int buf73[4][3][2]; /* integer */ - float buf83[4][3][2]; /* float */ - - - /*------------------------------------------------------------------------- - * 1D - *------------------------------------------------------------------------- - */ - - /*------------------------------------------------------------------------- - * H5T_STRING - *------------------------------------------------------------------------- - */ - - - if(make_diffs) { - for(i = 0; i < 2; i++) - for(j = 0; j < 2; j++) - buf1[i][j] = 'z'; - } - - - if ((tid = H5Tcopy(H5T_C_S1)) < 0) - goto out; - if (H5Tset_size(tid, (size_t)2) < 0) - goto out; - if (write_dset(loc_id,1,dims,"string",tid,buf1) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - - - /* create hard link */ - if (H5Lcreate_hard(loc_id, "string", H5L_SAME_LOC, "string_link", H5P_DEFAULT, H5P_DEFAULT) < 0) - goto out; - - /*------------------------------------------------------------------------- - * H5T_BITFIELD - *------------------------------------------------------------------------- - */ - - if(make_diffs) { - for(i = 0; i < 2; i++) - buf2[i] = buf2[1] = 0; - } - - if ((tid = H5Tcopy(H5T_STD_B8LE)) < 0) - goto out; - if (write_dset(loc_id,1,dims,"bitfield",tid,buf2) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - - /*------------------------------------------------------------------------- - * H5T_OPAQUE - *------------------------------------------------------------------------- - */ - - if(make_diffs) { - for(i = 0; i < 2; i++) { - buf3[i].a = 0; - buf3[i].b = 0; - } - } - - if ((tid = H5Tcreate(H5T_OPAQUE, (size_t)1)) < 0) - goto out; - if (H5Tset_tag(tid, "1-byte opaque type") < 0) - goto out; - if (write_dset(loc_id,1,dims,"opaque",tid,buf2) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - - /*------------------------------------------------------------------------- - * H5T_COMPOUND - *------------------------------------------------------------------------- - */ - - - if(make_diffs) { - for(i = 0; i < 2; i++) - buf45[i] = GREEN; - } - - if ((tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t))) < 0) - goto out; - if (H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR) < 0) - goto out; - if (H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE) < 0) - goto out; - if (write_dset(loc_id,1,dims,"compound",tid,buf3) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - - /*------------------------------------------------------------------------- - * H5T_REFERENCE - *------------------------------------------------------------------------- - */ - /* object references ( H5R_OBJECT ) */ - buf4[0]=0; - buf4[1]=0; - if (dset_name) - { - if (H5Rcreate(&buf4[0],file_id,dset_name,H5R_OBJECT,(hid_t)-1) < 0) - goto out; - if (write_dset(loc_id,1,dims1r,"refobj",H5T_STD_REF_OBJ,buf4) < 0) - goto out; - } - - /* Dataset region reference ( H5R_DATASET_REGION ) */ - if (make_dset_reg_ref(loc_id) < 0) - goto out; - - - /*------------------------------------------------------------------------- - * H5T_ENUM - *------------------------------------------------------------------------- - */ - if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0) - goto out; - if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0) - goto out; - if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0) - goto out; - if (write_dset(loc_id,1,dims,"enum",tid,buf45) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - - /*------------------------------------------------------------------------- - * H5T_VLEN - *------------------------------------------------------------------------- - */ - - /* Allocate and initialize VL dataset to write */ - - buf5[0].len = 1; - buf5[0].p = HDmalloc( 1 * sizeof(int)); - ((int *)buf5[0].p)[0]=1; - buf5[1].len = 2; - buf5[1].p = HDmalloc( 2 * sizeof(int)); - ((int *)buf5[1].p)[0] = 2; - ((int *)buf5[1].p)[1] = 3; - - if(make_diffs) { - ((int *)buf5[0].p)[0] = 0; - ((int *)buf5[1].p)[0] = 0; - ((int *)buf5[1].p)[1] = 0; - } - - if ((sid = H5Screate_simple(1, dims, NULL)) < 0) - goto out; - if ((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) - goto out; - if ((did = H5Dcreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; - if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5) < 0) - goto out; - if (H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5) < 0) - goto out; - if (H5Dclose(did) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - if (H5Sclose(sid) < 0) - goto out; - - /*------------------------------------------------------------------------- - * H5T_ARRAY - *------------------------------------------------------------------------- - */ - - if(make_diffs) { - for(i = 0; i < 2; i++) - for(j = 0; j < 3; j++) - buf6[i][j] = 0; - } - - if ((tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray)) < 0) - goto out; - if (write_dset(loc_id, 1, dims, "array", tid, buf6) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - - { - - hsize_t TEST_BUFSIZE = (128 * 1024 * 1024); /* 128MB */ - double *dbuf; /* information to write */ - size_t size; - hsize_t sdims[] = {1}; - hsize_t tdims[] = {TEST_BUFSIZE / sizeof(double) + 1}; - unsigned u; - - /* allocate and initialize array data to write */ - size = ( TEST_BUFSIZE / sizeof(double) + 1 ) * sizeof(double); - dbuf = (double*)HDmalloc( size ); - if (NULL == dbuf) - { - printf ("\nError: Cannot allocate memory for \"arrayd\" data buffer size %dMB.\n", (int) size / 1000000 ); - goto out; - } - - for( u = 0; u < TEST_BUFSIZE / sizeof(double) + 1; u++) - dbuf[u] = u; - - if (make_diffs) - { - dbuf[5] = 0; - dbuf[6] = 0; - } - - /* create a type larger than TEST_BUFSIZE */ - if ((tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, 1, tdims)) < 0) - goto out; - size = H5Tget_size(tid); - if ((sid = H5Screate_simple(1, sdims, NULL)) < 0) - goto out; - if ((did = H5Dcreate2(loc_id, "arrayd", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; -#if defined(WRITE_ARRAY) - H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dbuf); -#endif - - /* close */ - H5Dclose(did); - H5Tclose(tid); - H5Sclose(sid); - HDfree( dbuf ); - } - - /*------------------------------------------------------------------------- - * H5T_INTEGER and H5T_FLOAT - *------------------------------------------------------------------------- - */ - - if(make_diffs) { - for(i = 0; i < 2; i++) { - buf7[i] = 0; - buf8[i] = 0; - } - } - - if (write_dset(loc_id,1,dims,"integer",H5T_NATIVE_INT,buf7) < 0) - goto out; - if (write_dset(loc_id,1,dims,"float",H5T_NATIVE_FLOAT,buf8) < 0) - goto out; - - - /*------------------------------------------------------------------------- - * 2D - *------------------------------------------------------------------------- - */ - - /*------------------------------------------------------------------------- - * H5T_STRING - *------------------------------------------------------------------------- - */ - - if (make_diffs) - { - HDmemset(buf12, 'z', sizeof buf12); - } - - - if ((tid = H5Tcopy(H5T_C_S1)) < 0) - goto out; - if (H5Tset_size(tid, (size_t)2) < 0) - goto out; - if (write_dset(loc_id,2,dims2,"string2D",tid,buf12) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - - /*------------------------------------------------------------------------- - * H5T_BITFIELD - *------------------------------------------------------------------------- - */ - - - if (make_diffs) - { - HDmemset(buf22,0,sizeof buf22); - } - - if ((tid = H5Tcopy(H5T_STD_B8LE)) < 0) - goto out; - if (write_dset(loc_id,2,dims2,"bitfield2D",tid,buf22) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - - /*------------------------------------------------------------------------- - * H5T_OPAQUE - *------------------------------------------------------------------------- - */ - if ((tid = H5Tcreate(H5T_OPAQUE, (size_t)1)) < 0) - goto out; - if (H5Tset_tag(tid, "1-byte opaque type") < 0) - goto out; - if (write_dset(loc_id,2,dims2,"opaque2D",tid,buf22) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - - /*------------------------------------------------------------------------- - * H5T_COMPOUND - *------------------------------------------------------------------------- - */ - - if (make_diffs) - { - HDmemset(buf32,0,sizeof buf32); - } - - if ((tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t))) < 0) - goto out; - if (H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR) < 0) - goto out; - if (H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE) < 0) - goto out; - if (write_dset(loc_id,2,dims2,"compound2D",tid,buf32) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - - /*------------------------------------------------------------------------- - * H5T_REFERENCE - *------------------------------------------------------------------------- - */ - /* Create references to dataset */ - if (dset_name) - { - if (H5Rcreate(&buf42[0][0], file_id, dset_name, H5R_OBJECT, (hid_t)-1) < 0) - goto out; - if (write_dset(loc_id, 2, dims2r, "refobj2D", H5T_STD_REF_OBJ, buf42) < 0) - goto out; - } - - /*------------------------------------------------------------------------- - * H5T_ENUM - *------------------------------------------------------------------------- - */ - - if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0) - goto out; - if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0) - goto out; - if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0) - goto out; - if (write_dset(loc_id,2,dims2,"enum2D",tid,0) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - - /*------------------------------------------------------------------------- - * H5T_VLEN - *------------------------------------------------------------------------- - */ - - /* Allocate and initialize VL dataset to write */ - n = 0; - for(i = 0; i < 3; i++) { - for(j = 0; j < 2; j++) { - unsigned l; - - buf52[i][j].p = HDmalloc((i + 1) * sizeof(int)); - buf52[i][j].len = (size_t)(i + 1); - for(l = 0; l < i + 1; l++) { - if(make_diffs) - ((int *)buf52[i][j].p)[l] = 0; - else - ((int *)buf52[i][j].p)[l] = n++; - } - } - } - - if ((sid = H5Screate_simple(2, dims2, NULL)) < 0) - goto out; - if ((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) - goto out; - if ((did = H5Dcreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; - if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf52) < 0) - goto out; - if (H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52) < 0) - goto out; - if (H5Dclose(did) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - if (H5Sclose(sid) < 0) - goto out; - - /*------------------------------------------------------------------------- - * H5T_ARRAY - *------------------------------------------------------------------------- - */ - - if (make_diffs) - { - HDmemset(buf62,0,sizeof buf62); - } - - - if ((tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray)) < 0) - goto out; - if (write_dset(loc_id, 2, dims2, "array2D", tid, buf62) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - - /*------------------------------------------------------------------------- - * H5T_INTEGER, write a fill value - *------------------------------------------------------------------------- - */ - - - if(make_diffs) { - HDmemset(buf72, 0, sizeof buf72); - HDmemset(buf82, 0, sizeof buf82); - } - - - if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto out; - if ((sid = H5Screate_simple(2, dims2, NULL)) < 0) - goto out; - if ((did = H5Dcreate2(loc_id, "integer2D", H5T_NATIVE_INT, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) - goto out; - if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf72) < 0) - goto out; - if (H5Pclose(pid) < 0) - goto out; - if (H5Dclose(did) < 0) - goto out; - if (H5Sclose(sid) < 0) - goto out; - - /*------------------------------------------------------------------------- - * H5T_FLOAT - *------------------------------------------------------------------------- - */ - - if (write_dset(loc_id,2,dims2,"float2D",H5T_NATIVE_FLOAT,buf82) < 0) - goto out; - - - /*------------------------------------------------------------------------- - * 3D - *------------------------------------------------------------------------- - */ - - /*------------------------------------------------------------------------- - * H5T_STRING - *------------------------------------------------------------------------- - */ - - if (make_diffs) - { - HDmemset(buf13,'z',sizeof buf13); - } - - if ((tid = H5Tcopy(H5T_C_S1)) < 0) - goto out; - if (H5Tset_size(tid, (size_t)2) < 0) - goto out; - if (write_dset(loc_id,3,dims3,"string3D",tid,buf13) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - - /*------------------------------------------------------------------------- - * H5T_BITFIELD - *------------------------------------------------------------------------- - */ - - - n=1; - for(i = 0; i < 4; i++) { - for(j = 0; j < 3; j++) { - for(k = 0; k < 2; k++) { - if(make_diffs) - buf23[i][j][k] = 0; - else - buf23[i][j][k] = (char)(n++); - } - } - } - - - if ((tid = H5Tcopy(H5T_STD_B8LE)) < 0) - goto out; - if (write_dset(loc_id,3,dims3,"bitfield3D",tid,buf23) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - - /*------------------------------------------------------------------------- - * H5T_OPAQUE - *------------------------------------------------------------------------- - */ - if ((tid = H5Tcreate(H5T_OPAQUE, (size_t)1)) < 0) - goto out; - if (H5Tset_tag(tid, "1-byte opaque type") < 0) - goto out; - if (write_dset(loc_id,3,dims3,"opaque3D",tid,buf23) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - - /*------------------------------------------------------------------------- - * H5T_COMPOUND - *------------------------------------------------------------------------- - */ - - n=1; - for(i = 0; i < 4; i++) { - for(j = 0; j < 3; j++) { - for(k = 0; k < 2; k++) { - if(make_diffs) { - buf33[i][j][k].a = 0; - buf33[i][j][k].b = 0; - } - else { - buf33[i][j][k].a = (char)(n++); - buf33[i][j][k].b = n++; - } - } - } - } - - - if ((tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t))) < 0) - goto out; - if (H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR) < 0) - goto out; - if (H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE) < 0) - goto out; - if (write_dset(loc_id,3,dims3,"compound3D",tid,buf33) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - - /*------------------------------------------------------------------------- - * H5T_REFERENCE - *------------------------------------------------------------------------- - */ - /* Create references to dataset */ - if (dset_name) - { - if (H5Rcreate(&buf43[0][0][0], file_id, dset_name, H5R_OBJECT, (hid_t)-1) < 0) - goto out; - if (write_dset(loc_id, 3, dims3r, "refobj3D", H5T_STD_REF_OBJ, buf43) < 0) - goto out; - } - - /*------------------------------------------------------------------------- - * H5T_ENUM - *------------------------------------------------------------------------- - */ - - if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0) - goto out; - if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0) - goto out; - if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0) - goto out; - if (write_dset(loc_id,3,dims3,"enum3D",tid,0) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - - /*------------------------------------------------------------------------- - * H5T_VLEN - *------------------------------------------------------------------------- - */ - - /* Allocate and initialize VL dataset to write */ - n = 0; - for(i = 0; i < 4; i++) { - for(j = 0; j < 3; j++) { - for(k = 0; k < 2; k++) { - unsigned l; - - buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int)); - buf53[i][j][k].len = (size_t)(i + 1); - for(l = 0; l < i + 1; l++) { - if(make_diffs) - ((int *)buf53[i][j][k].p)[l] = 0; - else - ((int *)buf53[i][j][k].p)[l] = n++; - } - } - } - } - - if ((sid = H5Screate_simple(3, dims3, NULL)) < 0) - goto out; - if ((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) - goto out; - if ((did = H5Dcreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; - if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf53) < 0) - goto out; - - if (H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53) < 0) - goto out; - - if (H5Dclose(did) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - if (H5Sclose(sid) < 0) - goto out; - - /*------------------------------------------------------------------------- - * H5T_ARRAY - *------------------------------------------------------------------------- - */ - - - n = 1; - for(i = 0; i < 24; i++) { - for(j = 0; j < dimarray[0]; j++) { - if(make_diffs) - buf63[i][j] = 0; - else - buf63[i][j] = n++; - } - } - - if ((tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray)) < 0) - goto out; - if (write_dset(loc_id, 3, dims3, "array3D", tid, buf63) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - - /*------------------------------------------------------------------------- - * H5T_INTEGER and H5T_FLOAT - *------------------------------------------------------------------------- - */ - n=1; f=1; - for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) { - for (k = 0; k < 2; k++) { - if (make_diffs) { - buf73[i][j][k]=0; - buf83[i][j][k]=0; - } - else { - buf73[i][j][k]=n++; - buf83[i][j][k]=f++; - } - } - } - } - if (write_dset(loc_id,3,dims3,"integer3D",H5T_NATIVE_INT,buf73) < 0) - goto out; - if (write_dset(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83) < 0) - goto out; - - return 0; - -out: - H5E_BEGIN_TRY { - H5Pclose(pid); - H5Sclose(sid); - H5Dclose(did); - H5Tclose(tid); - } H5E_END_TRY; - return -1; -} - - - -/*------------------------------------------------------------------------- -* Function: make_dset_reg_ref -* -* Purpose: write dataset region references -* -*------------------------------------------------------------------------- -*/ - -#define SPACE1_RANK 1 -#define SPACE1_DIM1 1 -#define SPACE2_RANK 2 -#define SPACE2_DIM1 10 -#define SPACE2_DIM2 10 -static -int make_dset_reg_ref(hid_t loc_id) -{ - hid_t did1=-1; /* Dataset ID */ - hid_t did2=-1; /* Dereferenced dataset ID */ - hid_t sid1=-1; /* Dataspace ID #1 */ - hid_t sid2=-1; /* Dataspace ID #2 */ - hsize_t dims1[] = {SPACE1_DIM1}; - hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; - hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ - hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ - hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ - hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ - hdset_reg_ref_t *wbuf=NULL; /* buffer to write to disk */ - int *dwbuf=NULL; /* Buffer for writing numeric data to disk */ - int i; /* counting variables */ - int retval = -1; /* return value */ - - /* Allocate write & read buffers */ - wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1); - dwbuf = (int *)HDmalloc(sizeof(int) * SPACE2_DIM1 * SPACE2_DIM2); - - /* Create dataspace for datasets */ - if ((sid2 = H5Screate_simple(SPACE2_RANK, dims2, NULL)) < 0) - goto out; - - /* Create a dataset */ - if ((did2 = H5Dcreate2(loc_id, "dsetreg", H5T_NATIVE_UCHAR, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; - - for (i = 0; i < SPACE2_DIM1 * SPACE2_DIM2; i++) - dwbuf[i] = i * 3; - - /* Write selection to disk */ - if (H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dwbuf) < 0) - goto out; - - /* Create dataspace for the reference dataset */ - if ((sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL)) < 0) - goto out; - - /* Create a dataset */ - if ((did1 = H5Dcreate2(loc_id, "refreg", H5T_STD_REF_DSETREG, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; - - /* Select 6x6 hyperslab for first reference */ - start[0] = 2; start[1] = 2; - stride[0] = 1; stride[1] = 1; - count[0] = 6; count[1] = 6; - block[0] = 1; block[1] = 1; - if (H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block) < 0) - goto out; - - - /* Store dataset region */ - if (H5Rcreate(&wbuf[0], loc_id, "dsetreg", H5R_DATASET_REGION, sid2) < 0) - goto out; - - /* Write selection to disk */ - if (H5Dwrite(did1,H5T_STD_REF_DSETREG,H5S_ALL,H5S_ALL,H5P_DEFAULT,wbuf) < 0) - goto out; - - /* Close all objects */ - if (H5Sclose(sid1) < 0) - goto out; - if (H5Dclose(did1) < 0) - goto out; - if (H5Sclose(sid2) < 0) - goto out; - if (H5Dclose(did2) < 0) - goto out; - - retval = 0; - -out: - if(wbuf) - HDfree(wbuf); - if(dwbuf) - HDfree(dwbuf); - - H5E_BEGIN_TRY - { - H5Sclose(sid1); - H5Sclose(sid2); - H5Dclose(did1); - H5Dclose(did2); - } H5E_END_TRY; - - return retval; -} - -/*------------------------------------------------------------------------- -* Function: write_attr_in -* -* Purpose: write attributes in LOC_ID (dataset, group, named datatype) -* -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu -* -* Date: November 12, 2003 -* -*------------------------------------------------------------------------- -*/ - -static -int write_attr_in(hid_t loc_id, - const char* dset_name, /* for saving reference to dataset*/ - hid_t fid, /* for reference create */ - int make_diffs /* flag to modify data buffers */) -{ - /* Compound datatype */ - typedef struct s_t - { - char a; - double b; - } s_t; - - typedef enum - { - RED, - GREEN - } e_t; - - hid_t aid = -1; - hid_t sid = -1; - hid_t tid = -1; - int val, j, k, n; - unsigned i; - float f; - - /* create 1D attributes with dimension [2], 2 elements */ - hsize_t dims[1]={2}; - char buf1[2][3]= {"ab","de"}; /* string */ - char buf2[2]= {1,2}; /* bitfield, opaque */ - s_t buf3[2]= {{1,2},{3,4}}; /* compound */ - hobj_ref_t buf4[2]; /* reference */ - e_t buf45[2]= {RED,RED}; /* enum */ - hvl_t buf5[2]; /* vlen */ - hsize_t dimarray[1]={3}; /* array dimension */ - int buf6[2][3]= {{1,2,3},{4,5,6}}; /* array */ - int buf7[2]= {1,2}; /* integer */ - float buf8[2]= {1,2}; /* float */ - - /* create 2D attributes with dimension [3][2], 6 elements */ - hsize_t dims2[2]={3,2}; - char buf12[6][3]= {"ab","cd","ef","gh","ij","kl"}; /* 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 */ - e_t buf452[3][2]; /* enum */ - hvl_t buf52[3][2]; /* vlen */ - int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */ - int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */ - float buf82[3][2]= {{1,2},{3,4},{5,6}}; /* float */ - - /* create 3D attributes with dimension [4][3][2], 24 elements */ - hsize_t dims3[3]={4,3,2}; - char buf13[24][3]= {"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 buf23[4][3][2]; /* bitfield, opaque */ - s_t buf33[4][3][2]; /* compound */ - hobj_ref_t buf43[4][3][2]; /* reference */ - e_t buf453[4][3][2]; /* enum */ - hvl_t buf53[4][3][2]; /* vlen */ - int buf63[24][3]; /* array */ - int buf73[4][3][2]; /* integer */ - float buf83[4][3][2]; /* float */ - - - /*------------------------------------------------------------------------- - * 1D attributes - *------------------------------------------------------------------------- - */ - - /*------------------------------------------------------------------------- - * H5T_STRING - *------------------------------------------------------------------------- - */ - - if (make_diffs) - { - for (i=0; i<2; i++) - for (j=0; j<2; j++) - { - buf1[i][j]='z'; - } - } - /* - buf1[2][2]= {"ab","de"}; - $h5diff file7.h5 file6.h5 g1 g1 -v - Group: </g1> and </g1> - Attribute: <string> and <string> - position string of </g1> string of </g1> difference - ------------------------------------------------------------ - [ 0 ] a z - [ 0 ] b z - [ 1 ] d z - [ 1 ] e z - */ - if ((tid = H5Tcopy(H5T_C_S1)) < 0) - goto out; - if (H5Tset_size(tid, (size_t)2) < 0) - goto out; - if (make_attr(loc_id,1,dims,"string",tid,buf1) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - tid = -1; - - /*------------------------------------------------------------------------- - * H5T_BITFIELD - *------------------------------------------------------------------------- - */ - - if (make_diffs) - { - for (i=0; i<2; i++) - buf2[i]=buf2[1]=0; - } - /* - buf2[2]= {1,2}; - $h5diff file7.h5 file6.h5 g1 g1 -v - Group: </g1> and </g1> - Attribute: <bitfield> and <bitfield> - position bitfield of </g1> bitfield of </g1> difference - position opaque of </g1> opaque of </g1> difference - ------------------------------------------------------------ - [ 0 ] 1 0 1 - [ 1 ] 2 0 2 - */ - - if ((tid = H5Tcopy(H5T_STD_B8LE)) < 0) - goto out; - if (make_attr(loc_id,1,dims,"bitfield",tid,buf2) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - tid = -1; - - /*------------------------------------------------------------------------- - * H5T_OPAQUE - *------------------------------------------------------------------------- - */ - - /* - buf2[2]= {1,2}; - $h5diff file7.h5 file6.h5 g1 g1 -v - Group: </g1> and </g1> - Attribute: <opaque> and <opaque> - position opaque of </g1> opaque of </g1> difference - position opaque of </g1> opaque of </g1> difference - ------------------------------------------------------------ - [ 0 ] 1 0 1 - [ 1 ] 2 0 2 - */ - - if ((tid = H5Tcreate(H5T_OPAQUE, (size_t)1)) < 0) - goto out; - if (H5Tset_tag(tid, "1-byte opaque type") < 0) - goto out; - if (make_attr(loc_id,1,dims,"opaque",tid,buf2) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - tid = -1; - - /*------------------------------------------------------------------------- - * H5T_COMPOUND - *------------------------------------------------------------------------- - */ - - if (make_diffs) - { - for (i=0; i<2; i++) - { - buf3[i].a=0; buf3[i].b=0; - } - } - - /* - buf3[2]= {{1,2},{3,4}}; - $h5diff file7.h5 file6.h5 g1 g1 -v - Group: </g1> and </g1> - Attribute: <compound> and <compound> - position compound of </g1> compound of </g1> difference - ------------------------------------------------------------ - [ 0 ] 1 5 4 - [ 0 ] 2 5 3 - [ 1 ] 3 5 2 - [ 1 ] 4 5 1 - */ - - if ((tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t))) < 0) - goto out; - if (H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR) < 0) - goto out; - if (H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE) < 0) - goto out; - if (make_attr(loc_id,1,dims,"compound",tid,buf3) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - tid = -1; - - /*------------------------------------------------------------------------- - * H5T_REFERENCE - *------------------------------------------------------------------------- - */ - /* object references ( H5R_OBJECT */ - if (dset_name) - { - if (H5Rcreate(&buf4[0],fid,dset_name,H5R_OBJECT,(hid_t)-1) < 0) - goto out; - if (H5Rcreate(&buf4[1],fid,dset_name,H5R_OBJECT,(hid_t)-1) < 0) - goto out; - if (make_attr(loc_id,1,dims,"reference",H5T_STD_REF_OBJ,buf4) < 0) - goto out; - } - - - /*------------------------------------------------------------------------- - * H5T_ENUM - *------------------------------------------------------------------------- - */ - if (make_diffs) - { - for (i=0; i<2; i++) - { - buf45[i]=GREEN; - } - } - /* - buf45[2]= {RED,RED}; - $h5diff file7.h5 file6.h5 g1 g1 -v - Group: </g1> and </g1> - Attribute: <enum> and <enum> - position enum of </g1> enum of </g1> difference - ------------------------------------------------------------ - [ 0 ] RED GREEN - [ 1 ] RED GREEN - */ - if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0) - goto out; - if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0) - goto out; - if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0) - goto out; - if (make_attr(loc_id,1,dims,"enum",tid,buf45) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - tid = -1; - - /*------------------------------------------------------------------------- - * H5T_VLEN - *------------------------------------------------------------------------- - */ - - /* Allocate and initialize VL dataset to write */ - - buf5[0].len = 1; - buf5[0].p = HDmalloc( 1 * sizeof(int)); - ((int *)buf5[0].p)[0]=1; - buf5[1].len = 2; - buf5[1].p = HDmalloc(2 * sizeof(int)); - ((int *)buf5[1].p)[0] = 2; - ((int *)buf5[1].p)[1] = 3; - - if(make_diffs) - { - ((int *)buf5[0].p)[0] = 0; - ((int *)buf5[1].p)[0] = 0; - ((int *)buf5[1].p)[1] = 0; - } - /* - $h5diff file7.h5 file6.h5 g1 g1 -v - Group: </g1> and </g1> - position vlen of </g1> vlen of </g1> difference - ------------------------------------------------------------ - [ 0 ] 1 0 1 - [ 1 ] 2 0 2 - [ 1 ] 3 0 3 - */ - - if ((sid = H5Screate_simple(1, dims, NULL)) < 0) - goto out; - if ((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) - goto out; - if ((aid = H5Acreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; - if (H5Awrite(aid, tid, buf5) < 0) - goto out; - if (H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5) < 0) - goto out; - if (H5Aclose(aid) < 0) - goto out; - aid = -1; - if (H5Tclose(tid) < 0) - goto out; - tid = -1; - if (H5Sclose(sid) < 0) - goto out; - sid = -1; - - /*------------------------------------------------------------------------- - * H5T_ARRAY - *------------------------------------------------------------------------- - */ - - if (make_diffs) - { - for (i=0; i<2; i++) - for (j=0; j<3; j++) - { - buf6[i][j]=0; - } - } - /* - buf6[2][3]= {{1,2,3},{4,5,6}}; - $h5diff file7.h5 file6.h5 g1 g1 -v - Group: </g1> and </g1> - Attribute: <array> and <array> - position array of </g1> array of </g1> difference - ------------------------------------------------------------ - [ 0 ] 1 0 1 - [ 0 ] 2 0 2 - [ 0 ] 3 0 3 - [ 1 ] 4 0 4 - [ 1 ] 5 0 5 - [ 1 ] 6 0 6 - */ - if ((tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray)) < 0) - goto out; - if (make_attr(loc_id, 1, dims, "array", tid, buf6) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - tid = -1; - - /*------------------------------------------------------------------------- - * H5T_INTEGER and H5T_FLOAT - *------------------------------------------------------------------------- - */ - - if(make_diffs) - { - for(i = 0; i < 2; i++) - { - buf7[i]=0; - buf8[i]=0; - } - } - - /* - buf7[2]= {1,2}; - buf8[2]= {1,2}; - $h5diff file7.h5 file6.h5 g1 g1 -v - Group: </g1> and </g1> - position integer of </g1> integer of </g1> difference - ------------------------------------------------------------ - [ 0 ] 1 0 1 - [ 1 ] 2 0 2 - position float of </g1> float of </g1> difference - ------------------------------------------------------------ - [ 0 ] 1 0 1 - [ 1 ] 2 0 2 - */ - if (make_attr(loc_id,1,dims,"integer",H5T_NATIVE_INT,buf7) < 0) - goto out; - if (make_attr(loc_id,1,dims,"float",H5T_NATIVE_FLOAT,buf8) < 0) - goto out; - - - /*------------------------------------------------------------------------- - * 2D attributes - *------------------------------------------------------------------------- - */ - - /*------------------------------------------------------------------------- - * H5T_STRING - *------------------------------------------------------------------------- - */ - if (make_diffs) - { - HDmemset(buf12, 'z', sizeof buf12); - } - - /* - buf12[6][2]= {"ab","cd","ef","gh","ij","kl"}; - $h5diff file7.h5 file6.h5 g1 g1 -v - Attribute: <string2D> and <string2D> - position string2D of </g1> string2D 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 - */ - - if ((tid = H5Tcopy(H5T_C_S1)) < 0) - goto out; - if (H5Tset_size(tid, (size_t)2) < 0) - goto out; - if (make_attr(loc_id,2,dims2,"string2D",tid,buf12) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - tid = -1; - - /*------------------------------------------------------------------------- - * H5T_BITFIELD - *------------------------------------------------------------------------- - */ - - if (make_diffs) - { - HDmemset(buf22,0,sizeof buf22); - } - - /* - buf22[3][2]= {{1,2},{3,4},{5,6}}; - $h5diff file7.h5 file6.h5 g1 g1 -v - Attribute: <bitfield2D> and <bitfield2D> - position bitfield2D of </g1> bitfield2D of </g1> difference - ------------------------------------------------------------ - [ 0 0 ] 1 0 1 - [ 0 1 ] 2 0 2 - [ 1 0 ] 3 0 3 - [ 1 1 ] 4 0 4 - [ 2 0 ] 5 0 5 - [ 2 1 ] 6 0 6 - */ - - - if ((tid = H5Tcopy(H5T_STD_B8LE)) < 0) - goto out; - if (make_attr(loc_id,2,dims2,"bitfield2D",tid,buf22) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - tid = -1; - - /*------------------------------------------------------------------------- - * H5T_OPAQUE - *------------------------------------------------------------------------- - */ - - /* - buf22[3][2]= {{1,2},{3,4},{5,6}}; - $h5diff file7.h5 file6.h5 g1 g1 -v - Attribute: <opaque2D> and <opaque2D> - position opaque2D of </g1> opaque2D of </g1> difference - ------------------------------------------------------------ - [ 0 0 ] 1 0 1 - [ 0 1 ] 2 0 2 - [ 1 0 ] 3 0 3 - [ 1 1 ] 4 0 4 - [ 2 0 ] 5 0 5 - [ 2 1 ] 6 0 6 - */ - if ((tid = H5Tcreate(H5T_OPAQUE, (size_t)1)) < 0) - goto out; - if (H5Tset_tag(tid, "1-byte opaque type") < 0) - goto out; - if (make_attr(loc_id,2,dims2,"opaque2D",tid,buf22) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - tid = -1; - - /*------------------------------------------------------------------------- - * H5T_COMPOUND - *------------------------------------------------------------------------- - */ - if (make_diffs) - { - HDmemset(buf32,0,sizeof buf32); - } - - /* - buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; - $h5diff file7.h5 file6.h5 g1 g1 -v - Attribute: <opaque2D> and <opaque2D> - position opaque2D of </g1> opaque2D of </g1> difference - ------------------------------------------------------------ - [ 0 0 ] 1 0 1 - [ 0 1 ] 2 0 2 - [ 1 0 ] 3 0 3 - [ 1 1 ] 4 0 4 - [ 2 0 ] 5 0 5 - [ 2 1 ] 6 0 6 - */ - - - if ((tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t))) < 0) - goto out; - if (H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR) < 0) - goto out; - if (H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE) < 0) - goto out; - if (make_attr(loc_id,2,dims2,"compound2D",tid,buf32) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - tid = -1; - - /*------------------------------------------------------------------------- - * H5T_REFERENCE - *------------------------------------------------------------------------- - */ - /* Create references to dataset */ - if (dset_name) - { - for (i = 0; i < 3; i++) - { - for (j = 0; j < 2; j++) - { - if (H5Rcreate(&buf42[i][j],fid,dset_name,H5R_OBJECT,(hid_t)-1) < 0) - goto out; - } - } - if (make_attr(loc_id,2,dims2,"reference2D",H5T_STD_REF_OBJ,buf42) < 0) - goto out; - } - - /*------------------------------------------------------------------------- - * H5T_ENUM - *------------------------------------------------------------------------- - */ - for (i=0; i<3; i++) - { - for (j=0; j<2; j++) - { - if (make_diffs) buf452[i][j]=GREEN; else buf452[i][j]=RED; - } - } - - /* - Attribute: <enum2D> and <enum2D> - position enum2D of </g1> enum2D of </g1> difference - ------------------------------------------------------------ - [ 0 0 ] RED GREEN - [ 0 1 ] RED GREEN - [ 1 0 ] RED GREEN - [ 1 1 ] RED GREEN - [ 2 0 ] RED GREEN - [ 2 1 ] RED GREEN - */ - - if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0) - goto out; - if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0) - goto out; - if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0) - goto out; - if (make_attr(loc_id,2,dims2,"enum2D",tid,buf452) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - tid = -1; - - /*------------------------------------------------------------------------- - * H5T_VLEN - *------------------------------------------------------------------------- - */ - - /* Allocate and initialize VL dataset to write */ - n=0; - for(i = 0; i < 3; i++) { - for(j = 0; j < 2; j++) { - unsigned l; - - buf52[i][j].p = HDmalloc((i + 1) * sizeof(int)); - buf52[i][j].len = (size_t)(i + 1); - for(l = 0; l < i + 1; l++) - if(make_diffs) - ((int *)buf52[i][j].p)[l] = 0; - else - ((int *)buf52[i][j].p)[l] = n++; - } - } - - /* - position vlen2D of </g1> vlen2D of </g1> difference - ------------------------------------------------------------ - [ 0 1 ] 1 0 1 - [ 1 0 ] 2 0 2 - [ 1 0 ] 3 0 3 - [ 1 1 ] 4 0 4 - [ 1 1 ] 5 0 5 - [ 2 0 ] 6 0 6 - [ 2 0 ] 7 0 7 - [ 2 0 ] 8 0 8 - [ 2 1 ] 9 0 9 - [ 2 1 ] 10 0 10 - [ 2 1 ] 11 0 11 - */ - - if ((sid = H5Screate_simple(2, dims2, NULL)) < 0) - goto out; - if ((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) - goto out; - if ((aid = H5Acreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; - if (H5Awrite(aid, tid, buf52) < 0) - goto out; - if (H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52) < 0) - goto out; - if (H5Aclose(aid) < 0) - goto out; - aid = -1; - if (H5Tclose(tid) < 0) - goto out; - tid = -1; - if (H5Sclose(sid) < 0) - goto out; - sid = -1; - - /*------------------------------------------------------------------------- - * H5T_ARRAY - *------------------------------------------------------------------------- - */ - - if (make_diffs) - { - HDmemset(buf62,0,sizeof buf62); - } - /* - buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; - $h5diff file7.h5 file6.h5 g1 g1 -v - Group: </g1> and </g1> - Attribute: <array2D> and <array2D> - position array2D of </g1> array2D of </g1> difference - ------------------------------------------------------------ - [ 0 0 ] 1 0 1 - [ 0 0 ] 2 0 2 - [ 0 0 ] 3 0 3 - [ 0 1 ] 4 0 4 - [ 0 1 ] 5 0 5 - [ 0 1 ] 6 0 6 - [ 1 0 ] 7 0 7 - [ 1 0 ] 8 0 8 - [ 1 0 ] 9 0 9 - [ 1 1 ] 10 0 10 - [ 1 1 ] 11 0 11 - [ 1 1 ] 12 0 12 - [ 2 0 ] 13 0 13 - [ 2 0 ] 14 0 14 - [ 2 0 ] 15 0 15 - [ 2 1 ] 16 0 16 - [ 2 1 ] 17 0 17 - [ 2 1 ] 18 0 18 - */ - if ((tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray)) < 0) - goto out; - if (make_attr(loc_id, 2, dims2, "array2D", tid, buf62) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - tid = -1; - - /*------------------------------------------------------------------------- - * H5T_INTEGER and H5T_FLOAT - *------------------------------------------------------------------------- - */ - - if(make_diffs) - { - HDmemset(buf72, 0, sizeof buf72); - HDmemset(buf82, 0, sizeof buf82); - } - /* - Attribute: <integer2D> and <integer2D> - position integer2D of </g1> integer2D of </g1> difference - ------------------------------------------------------------ - [ 0 0 ] 1 0 1 - [ 0 1 ] 2 0 2 - [ 1 0 ] 3 0 3 - [ 1 1 ] 4 0 4 - [ 2 0 ] 5 0 5 - [ 2 1 ] 6 0 6 - 6 differences found - Attribute: <float2D> and <float2D> - position float2D of </g1> float2D of </g1> difference - ------------------------------------------------------------ - [ 0 0 ] 1 0 1 - [ 0 1 ] 2 0 2 - [ 1 0 ] 3 0 3 - [ 1 1 ] 4 0 4 - [ 2 0 ] 5 0 5 - [ 2 1 ] 6 0 6 - */ - - if (make_attr(loc_id,2,dims2,"integer2D",H5T_NATIVE_INT,buf72) < 0) - goto out; - if (make_attr(loc_id,2,dims2,"float2D",H5T_NATIVE_FLOAT,buf82) < 0) - goto out; - - - /*------------------------------------------------------------------------- - * 3D attributes - *------------------------------------------------------------------------- - */ - - /*------------------------------------------------------------------------- - * H5T_STRING - *------------------------------------------------------------------------- - */ - - if (make_diffs) - { - HDmemset(buf13,'z',sizeof buf13); - } - - /* - 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"}; - - Attribute: <string3D> and <string3D> - position string3D of </g1> string3D 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 - */ - - if ((tid = H5Tcopy(H5T_C_S1)) < 0) - goto out; - if (H5Tset_size(tid, (size_t)2) < 0) - goto out; - if (make_attr(loc_id,3,dims3,"string3D",tid,buf13) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - tid = -1; - - /*------------------------------------------------------------------------- - * H5T_BITFIELD - *------------------------------------------------------------------------- - */ - - n=1; - for(i = 0; i < 4; i++) { - for(j = 0; j < 3; j++) { - for(k = 0; k < 2; k++) { - if(make_diffs) - buf23[i][j][k] = 0; - else - buf23[i][j][k] = (char)(n++); - } - } - } - - /* - position bitfield3D of </g1> bitfield3D of </g1> difference - ------------------------------------------------------------ - [ 0 0 0 ] 1 0 1 - [ 0 0 1 ] 2 0 2 - [ 0 1 0 ] 3 0 3 - [ 0 1 1 ] 4 0 4 - [ 0 2 0 ] 5 0 5 - [ 0 2 1 ] 6 0 6 - [ 1 0 0 ] 7 0 7 - [ 1 0 1 ] 8 0 8 - [ 1 1 0 ] 9 0 9 - [ 1 1 1 ] 10 0 10 - [ 1 2 0 ] 11 0 11 - [ 1 2 1 ] 12 0 12 - [ 2 0 0 ] 13 0 13 - [ 2 0 1 ] 14 0 14 - [ 2 1 0 ] 15 0 15 - [ 2 1 1 ] 16 0 16 - [ 2 2 0 ] 17 0 17 - [ 2 2 1 ] 18 0 18 - [ 3 0 0 ] 19 0 19 - [ 3 0 1 ] 20 0 20 - [ 3 1 0 ] 21 0 21 - [ 3 1 1 ] 22 0 22 - [ 3 2 0 ] 23 0 23 - [ 3 2 1 ] 24 0 24 - */ - - if ((tid = H5Tcopy(H5T_STD_B8LE)) < 0) - goto out; - if (make_attr(loc_id,3,dims3,"bitfield3D",tid,buf23) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - tid = -1; - - /*------------------------------------------------------------------------- - * H5T_OPAQUE - *------------------------------------------------------------------------- - */ - if ((tid = H5Tcreate(H5T_OPAQUE, (size_t)1)) < 0) - goto out; - if (H5Tset_tag(tid, "1-byte opaque type") < 0) - goto out; - if (make_attr(loc_id,3,dims3,"opaque3D",tid,buf23) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - tid = -1; - - /*------------------------------------------------------------------------- - * H5T_COMPOUND - *------------------------------------------------------------------------- - */ - - n=1; - for(i = 0; i < 4; i++) { - for(j = 0; j < 3; j++) { - for(k = 0; k < 2; k++) { - if(make_diffs) { - buf33[i][j][k].a = 0; - buf33[i][j][k].b = 0; - } - else { - buf33[i][j][k].a = (char)(n++); - buf33[i][j][k].b = n++; - } - } - } - } - /*position compound3D of </g1> compound3D of </g1> difference - ------------------------------------------------------------ - [ 0 0 0 ] 1 0 1 - [ 0 0 0 ] 2 0 2 - [ 0 0 1 ] 3 0 3 - [ 0 0 1 ] 4 0 4 - [ 0 1 0 ] 5 0 5 - [ 0 1 0 ] 6 0 6 - [ 0 1 1 ] 7 0 7 - [ 0 1 1 ] 8 0 8 - [ 0 2 0 ] 9 0 9 - [ 0 2 0 ] 10 0 10 - [ 0 2 1 ] 11 0 11 - [ 0 2 1 ] 12 0 12 - [ 1 0 0 ] 13 0 13 - [ 1 0 0 ] 14 0 14 - [ 1 0 1 ] 15 0 15 - [ 1 0 1 ] 16 0 16 - [ 1 1 0 ] 17 0 17 - [ 1 1 0 ] 18 0 18 - [ 1 1 1 ] 19 0 19 - [ 1 1 1 ] 20 0 20 - [ 1 2 0 ] 21 0 21 - [ 1 2 0 ] 22 0 22 - [ 1 2 1 ] 23 0 23 - [ 1 2 1 ] 24 0 24 - [ 2 0 0 ] 25 0 25 - [ 2 0 0 ] 26 0 26 - [ 2 0 1 ] 27 0 27 - [ 2 0 1 ] 28 0 28 - [ 2 1 0 ] 29 0 29 - [ 2 1 0 ] 30 0 30 - [ 2 1 1 ] 31 0 31 - [ 2 1 1 ] 32 0 32 - [ 2 2 0 ] 33 0 33 - [ 2 2 0 ] 34 0 34 - [ 2 2 1 ] 35 0 35 - [ 2 2 1 ] 36 0 36 - [ 3 0 0 ] 37 0 37 - [ 3 0 0 ] 38 0 38 - [ 3 0 1 ] 39 0 39 - [ 3 0 1 ] 40 0 40 - [ 3 1 0 ] 41 0 41 - [ 3 1 0 ] 42 0 42 - [ 3 1 1 ] 43 0 43 - [ 3 1 1 ] 44 0 44 - [ 3 2 0 ] 45 0 45 - [ 3 2 0 ] 46 0 46 - [ 3 2 1 ] 47 0 47 - [ 3 2 1 ] 48 0 48 - */ - - - - if ((tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t))) < 0) - goto out; - if (H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR) < 0) - goto out; - if (H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE) < 0) - goto out; - if (make_attr(loc_id,3,dims3,"compound3D",tid,buf33) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - tid = -1; - - /*------------------------------------------------------------------------- - * H5T_REFERENCE - *------------------------------------------------------------------------- - */ - /* Create references to dataset */ - if (dset_name) - { - for (i = 0; i < 4; i++) - { - for (j = 0; j < 3; j++) - { - for (k = 0; k < 2; k++) - if (H5Rcreate(&buf43[i][j][k],fid,dset_name,H5R_OBJECT,(hid_t)-1) < 0) - goto out; - } - } - if (make_attr(loc_id,3,dims3,"reference3D",H5T_STD_REF_OBJ,buf43) < 0) - goto out; - } - - /*------------------------------------------------------------------------- - * H5T_ENUM - *------------------------------------------------------------------------- - */ - - for (i = 0; i < 4; i++) - { - for (j = 0; j < 3; j++) - { - for (k = 0; k < 2; k++) - { - if (make_diffs) - { - buf453[i][j][k]=RED; - } - else - { - buf453[i][j][k]=GREEN; - } - } - } - } - - /* - position enum3D of </g1> enum3D of </g1> difference - ------------------------------------------------------------ - [ 0 0 0 ] GREEN RED - [ 0 0 1 ] GREEN RED - [ 0 1 0 ] GREEN RED - [ 0 1 1 ] GREEN RED - [ 0 2 0 ] GREEN RED - [ 0 2 1 ] GREEN RED - [ 1 0 0 ] GREEN RED - [ 1 0 1 ] GREEN RED - [ 1 1 0 ] GREEN RED - [ 1 1 1 ] GREEN RED - [ 1 2 0 ] GREEN RED - [ 1 2 1 ] GREEN RED - [ 2 0 0 ] GREEN RED - [ 2 0 1 ] GREEN RED - [ 2 1 0 ] GREEN RED - [ 2 1 1 ] GREEN RED - [ 2 2 0 ] GREEN RED - [ 2 2 1 ] GREEN RED - [ 3 0 0 ] GREEN RED - [ 3 0 1 ] GREEN RED - [ 3 1 0 ] GREEN RED - [ 3 1 1 ] GREEN RED - [ 3 2 0 ] GREEN RED - [ 3 2 1 ] GREEN RED - */ - - - if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0) - goto out; - if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0) - goto out; - if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0) - goto out; - if (make_attr(loc_id,3,dims3,"enum3D",tid,buf453) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - tid = -1; - - /*------------------------------------------------------------------------- - * H5T_VLEN - *------------------------------------------------------------------------- - */ - - /* Allocate and initialize VL dataset to write */ - n=0; - for (i = 0; i < 4; i++) - { - for (j = 0; j < 3; j++) - { - for (k = 0; k < 2; k++) - { - unsigned l; - - buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int)); - buf53[i][j][k].len = (size_t)i + 1; - for (l = 0; l < i + 1; l++) - if (make_diffs) - ((int *)buf53[i][j][k].p)[l] = 0; - else - ((int *)buf53[i][j][k].p)[l] = n++; - } - } - } - /* - position vlen3D of </g1> vlen3D of </g1> difference - ------------------------------------------------------------ - [ 0 0 1 ] 1 0 1 - [ 0 1 0 ] 2 0 2 - [ 0 1 1 ] 3 0 3 - [ 0 2 0 ] 4 0 4 - [ 0 2 1 ] 5 0 5 - [ 1 0 0 ] 6 0 6 - [ 1 0 0 ] 7 0 7 - [ 1 0 1 ] 8 0 8 - [ 1 0 1 ] 9 0 9 - [ 1 1 0 ] 10 0 10 - etc - */ - if ((sid = H5Screate_simple(3, dims3, NULL)) < 0) - goto out; - if ((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) - goto out; - if ((aid = H5Acreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; - if (H5Awrite(aid, tid, buf53) < 0) - goto out; - if (H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53) < 0) - goto out; - if (H5Aclose(aid) < 0) - goto out; - aid = -1; - if (H5Tclose(tid) < 0) - goto out; - tid = -1; - if (H5Sclose(sid) < 0) - goto out; - sid = -1; - - /*------------------------------------------------------------------------- - * H5T_ARRAY - *------------------------------------------------------------------------- - */ - n=1; - for (i = 0; i < 24; i++) - { - for (j = 0; j < (int)dimarray[0]; j++) - { - if (make_diffs) buf63[i][j]=0; - else buf63[i][j]=n++; - } - } - /* - position array3D of </g1> array3D of </g1> difference - ------------------------------------------------------------ - [ 0 0 0 ] 1 0 1 - [ 0 0 0 ] 2 0 2 - [ 0 0 0 ] 3 0 3 - [ 0 0 1 ] 4 0 4 - [ 0 0 1 ] 5 0 5 - [ 0 0 1 ] 6 0 6 - [ 0 1 0 ] 7 0 7 - etc - */ - - if ((tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray)) < 0) - goto out; - if (make_attr(loc_id, 3, dims3, "array3D", tid, buf63) < 0) - goto out; - if (H5Tclose(tid) < 0) - goto out; - tid = -1; - - /*------------------------------------------------------------------------- - * H5T_INTEGER and H5T_FLOAT - *------------------------------------------------------------------------- - */ - n = 1; f = 1; - for(i = 0; i < 4; i++) - { - for(j = 0; j < 3; j++) - { - for(k = 0; k < 2; k++) - { - if(make_diffs) - { - buf73[i][j][k] = 0; - buf83[i][j][k] = 0; - } - else - { - buf73[i][j][k] = n++; - buf83[i][j][k] = f++; - } - } - } - } - - /* - position integer3D of </g1> integer3D of </g1> difference - ------------------------------------------------------------ - [ 0 0 0 ] 1 0 1 - [ 0 0 1 ] 2 0 2 - [ 0 1 0 ] 3 0 3 - [ 0 1 1 ] 4 0 4 - [ 0 2 0 ] 5 0 5 - [ 0 2 1 ] 6 0 6 - [ 1 0 0 ] 7 0 7 - [ 1 0 1 ] 8 0 8 - [ 1 1 0 ] 9 0 9 - [ 1 1 1 ] 10 0 10 - etc - */ - if (make_attr(loc_id,3,dims3,"integer3D",H5T_NATIVE_INT,buf73) < 0) - goto out; - if (make_attr(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83) < 0) - goto out; - - - return 0; - -out: - H5E_BEGIN_TRY { - H5Aclose(aid); - H5Sclose(sid); - H5Tclose(tid); - } H5E_END_TRY; - return -1; -} - - - - -/*------------------------------------------------------------------------- -* Function: make_dset -* -* Purpose: utility function to create and write a dataset in LOC_ID -* -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu -* -* Date: November 12, 2003 -* -*------------------------------------------------------------------------- -*/ -static -int make_dset(hid_t loc_id, - const char *name, - hid_t sid, - hid_t dcpl, - void *buf) -{ - hid_t did=-1; - - if ((did = H5Dcreate2(loc_id, name, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - return -1; - if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - goto out; - if (H5Dclose(did) < 0) - return -1; - return 0; - -out: - H5E_BEGIN_TRY { - H5Dclose(did); - } H5E_END_TRY; - return -1; -} - - -/*------------------------------------------------------------------------- -* Function: write_dset -* -* Purpose: utility function to create and write a dataset in LOC_ID -* -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu -* -* Date: November 12, 2003 -* -*------------------------------------------------------------------------- -*/ -static -int write_dset( hid_t loc_id, - int rank, - hsize_t *dims, - const char *dset_name, - hid_t tid, - void *buf ) -{ - hid_t did=-1; - hid_t sid=-1; - - if ((sid = H5Screate_simple(rank, dims, NULL)) < 0) - return -1; - if ((did = H5Dcreate2(loc_id, dset_name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; - if (buf) - { - if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - goto out; - } - if (H5Dclose(did) < 0) - goto out; - if (H5Sclose(sid) < 0) - goto out; - - return 0; - -out: - H5E_BEGIN_TRY { - H5Dclose(did); - H5Sclose(sid); - } H5E_END_TRY; - return -1; -} - - - -/*------------------------------------------------------------------------- -* Function: make_attr -* -* Purpose: utility function to write an attribute in LOC_ID -* -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu -* -* Date: November 12, 2003 -* -*------------------------------------------------------------------------- -*/ -static -int make_attr(hid_t loc_id, - int rank, - hsize_t *dims, - const char *attr_name, - hid_t tid, - void *buf) -{ - hid_t aid; - hid_t sid; - - if ((sid = H5Screate_simple(rank, dims, NULL)) < 0) - return -1; - if ((aid = H5Acreate2(loc_id, attr_name, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; - if(buf) - { - if(H5Awrite(aid, tid, buf) < 0) - goto out; - } - if (H5Aclose(aid) < 0) - goto out; - if (H5Sclose(sid) < 0) - goto out; - return 0; - -out: - H5E_BEGIN_TRY { - H5Aclose(aid); - H5Sclose(sid); - } H5E_END_TRY; - return -1; -} - - -/*------------------------------------------------------------------------- -* Function: make_named_dtype -* -* Purpose: create a file with named datatypes in various configurations -* -*------------------------------------------------------------------------- -*/ -static -int make_named_dtype(hid_t loc_id) -{ - hsize_t dims[1] ={3}; - hid_t did=-1; - hid_t aid=-1; - hid_t sid=-1; - hid_t tid=-1; - hid_t gid=-1; - - if ((sid = H5Screate_simple(1, dims, NULL)) < 0) - goto out; - - /* Create a dataset with an anonymous committed datatype as the first thing - * h5repack sees */ - if((tid = H5Tcopy(H5T_STD_I16LE)) < 0) - goto out; - if(H5Tcommit_anon(loc_id, tid, H5P_DEFAULT, H5P_DEFAULT) < 0) - goto out; - if ((did = H5Dcreate2(loc_id, "A", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; - if(H5Tclose(tid) < 0) - goto out; - - /* Create an attribute on that dataset that uses a committed datatype in - * a remote group */ - if((gid = H5Gcreate2(loc_id, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; - if(H5Gclose(gid) < 0) - goto out; - if((gid = H5Gcreate2(loc_id, "M/M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; - if(H5Gclose(gid) < 0) - goto out; - if((tid = H5Tcopy(H5T_STD_I16BE)) < 0) - goto out; - if(H5Tcommit2(loc_id, "/M/M/A", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) - goto out; - if((aid = H5Acreate2(did, "A", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; - if(H5Aclose(aid) < 0) - goto out; - if(H5Tclose(tid) < 0) - goto out; - if(H5Dclose(did) < 0) - goto out; - - /* Create a dataset in the remote group that uses a committed datatype in - * the root group */ - if((tid = H5Tcopy(H5T_STD_I32LE)) < 0) - goto out; - if(H5Tcommit2(loc_id, "N", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) - goto out; - if((did = H5Dcreate2(loc_id, "M/M/B", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; - if(H5Tclose(tid) < 0) - goto out; - - /* Create an attribute on the remote dataset that uses an anonymous - * committed datatype */ - if((tid = H5Tcopy(H5T_STD_I32BE)) < 0) - goto out; - if(H5Tcommit_anon(loc_id, tid, H5P_DEFAULT, H5P_DEFAULT) < 0) - goto out; - if((aid = H5Acreate2(did, "A", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; - if(H5Aclose(aid) < 0) - goto out; - - /* Create another attribute that uses the same anonymous datatype */ - if((aid = H5Acreate2(did, "B", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; - if(H5Aclose(aid) < 0) - goto out; - if(H5Tclose(tid) < 0) - goto out; - if(H5Dclose(did) < 0) - goto out; - - /* Create a dataset in the root group that uses the committed datatype in - * the root group */ - if((tid = H5Topen2(loc_id, "N", H5P_DEFAULT)) < 0) - goto out; - if((did = H5Dcreate2(loc_id, "O", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; - if(H5Dclose(did) < 0) - goto out; - - /* Create 2 attributes on the committed datatype that use that datatype */ - if((aid = H5Acreate2(tid, "A", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; - if(H5Aclose(aid) < 0) - goto out; - if((aid = H5Acreate2(tid, "B", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; - if(H5Aclose(aid) < 0) - goto out; - if(H5Tclose(tid) < 0) - goto out; - - /* Close */ - if (H5Sclose(sid) < 0) - goto out; - - return 0; - -out: - H5E_BEGIN_TRY - { - H5Tclose(tid); - H5Aclose(aid); - H5Sclose(sid); - H5Dclose(did); - H5Gclose(gid); - } H5E_END_TRY; - return -1; -} /* end make_named_dtype() */ - -/*------------------------------------------------------------------------- - * Function: add_attr_with_objref - * - * Purpose: - * Create attributes with object reference to objects (dset, - * group, datatype). - * - * Note: - * this function depends on locally created objects, however can be modified - * to be independent as necessary - * - * Programmer: Jonathan Kim (March 23, 2010) - *------------------------------------------------------------------------*/ -static herr_t add_attr_with_objref(hid_t file_id, hid_t obj_id) -{ - int ret = SUCCEED; - int status; - /* attr obj ref */ - hsize_t dim_attr_objref[1]={3}; - hobj_ref_t data_attr_objref[3]; - - /* -------------------------------- - * add attribute with obj ref type - */ - /* ref to dset */ - status = H5Rcreate(&data_attr_objref[0],file_id,NAME_OBJ_DS1,H5R_OBJECT,(hid_t)-1); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - /* ref to group */ - status = H5Rcreate(&data_attr_objref[1],file_id,NAME_OBJ_GRP,H5R_OBJECT,(hid_t)-1); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - /* ref to datatype */ - status = H5Rcreate(&data_attr_objref[2],file_id,NAME_OBJ_NDTYPE,H5R_OBJECT,(hid_t)-1); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - /* create attr with obj ref type */ - status = make_attr(obj_id,1,dim_attr_objref,"Attr_OBJREF",H5T_STD_REF_OBJ,data_attr_objref); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> make_attr failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - -out: - - return ret; - -} - -/*------------------------------------------------------------------------- - * Function: add_attr_with_regref - * - * Purpose: - * Create attributes with region reference to dset - * - * Note: - * this function depends on locally created objects, however can be modified - * to be independent as necessary - * - * Programmer: Jonathan Kim (March 23, 2010) - *------------------------------------------------------------------------*/ -static herr_t add_attr_with_regref(hid_t file_id, hid_t obj_id) -{ - int ret = SUCCEED; - int status; - - /* attr region ref */ - hid_t sid_regrefed_dset=0; - hsize_t dim_regrefed_dset[2]={3,6}; - hsize_t coords_regrefed_dset[3][2] = {{0,1},{1,2},{2,3}}; - hsize_t dim_attr_regref[1]= {1}; /* dim of */ - hdset_reg_ref_t data_attr_regref[1]; - - - /* ----------------------------------- - * add attribute with region ref type - */ - sid_regrefed_dset = H5Screate_simple (2, dim_regrefed_dset, NULL); - if (sid_regrefed_dset < 0) - { - fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - /* select elements space for reference */ - status = H5Sselect_elements (sid_regrefed_dset, H5S_SELECT_SET, (size_t)3, coords_regrefed_dset[0]); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - /* create region reference from elements space */ - status = H5Rcreate (&data_attr_regref[0], file_id, NAME_OBJ_DS2, H5R_DATASET_REGION, sid_regrefed_dset); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - /* create attr with region ref type */ - status = make_attr(obj_id,1,dim_attr_regref,"Attr_REGREF",H5T_STD_REF_DSETREG,data_attr_regref); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> make_attr failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - -out: - if (sid_regrefed_dset > 0) - H5Sclose (sid_regrefed_dset); - - return ret; - -} - -/*------------------------------------------------------------------------- - * Function: gen_refered_objs - * - * Purpose: - * Create objects (dataset, group, datatype) to be referenced - * - * Note: - * This function is to use along with gen_obj_ref() gen_region_ref() - * - * Programmer: Jonathan Kim (March 23, 2010) - *------------------------------------------------------------------------*/ -static herr_t gen_refered_objs(hid_t loc_id) -{ - int status; - herr_t ret = SUCCEED; - - /* objects (dset, group, datatype) */ - hid_t sid=0, did1=0, gid=0, tid=0; - hsize_t dims1[1]={3}; - int data[3] = {10,20,30}; - - /* Dset2 */ - hid_t sid2=0, did2=0; - hsize_t dims2[2] = {3,16}; - char data2[3][16] = {"The quick brown", "fox jumps over ", "the 5 lazy dogs"}; - - /*----------------------- - * add short dataset - * (define NAME_OBJ_DS1) - */ - sid = H5Screate_simple(1, dims1, NULL); - if (sid < 0) - { - fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - did1 = H5Dcreate2 (loc_id, NAME_OBJ_DS1, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (did1 < 0) - { - fprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - status = H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - /*-------------- - * add group - * (define NAME_OBJ_GRP) - */ - gid = H5Gcreate2 (loc_id, NAME_OBJ_GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid < 0) - { - fprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - /*---------------------- - * add named datatype - * (define NAME_OBJ_NDTYPE) - */ - tid = H5Tcopy(H5T_NATIVE_INT); - status = H5Tcommit2(loc_id, NAME_OBJ_NDTYPE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> H5Tcommit2 failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - - /*-------------------------- - * create long dataset - * (define NAME_OBJ_DS2) - */ - sid2 = H5Screate_simple (2, dims2, NULL); - if (sid2 < 0) - { - fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - /* create normal dataset which is refered */ - did2 = H5Dcreate2 (loc_id, NAME_OBJ_DS2, H5T_STD_I8LE, sid2, H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT); - if (did2 < 0) - { - fprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - /* write values to dataset */ - status = H5Dwrite (did2, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, data2); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - -out: - if(did1 > 0) - H5Dclose(did1); - if(gid > 0) - H5Gclose(gid); - if(tid > 0) - H5Tclose(tid); - if(sid > 0) - H5Sclose(sid); - - if(did2 > 0) - H5Dclose(did2); - if(sid2 > 0) - H5Sclose(sid2); - return ret; - -} - -/*------------------------------------------------------------------------- - * Function: gen_obj_ref - * - * Purpose: - * Generate object references to objects (dataset,group and named datatype) - * - * Note: - * copied from h5copygentest.c and upate to create named datatype - * - * Programmer: Jonathan Kim (March 18, 2010) - *------------------------------------------------------------------------*/ -static herr_t gen_obj_ref(hid_t loc_id) -{ - int status; - herr_t ret = SUCCEED; - - hid_t sid=0, oid=0; - hsize_t dims_dset_objref[1]={3}; - - /* attr with int type */ - hsize_t dim_attr_int[1]={2}; - int data_attr_int[2] = {10,20}; - - /* write buffer for obj reference */ - hobj_ref_t objref_buf[3]; - - /*--------------------------------------------------------- - * create obj references to the previously created objects. - * Passing -1 as reference is an object.*/ - - /* obj ref to dataset */ - status = H5Rcreate (&objref_buf[0], loc_id, NAME_OBJ_DS1, H5R_OBJECT, (hid_t)-1); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - /* obj ref to group */ - status = H5Rcreate (&objref_buf[1], loc_id, NAME_OBJ_GRP, H5R_OBJECT, (hid_t)-1); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - /* obj ref to named-datatype */ - status = H5Rcreate (&objref_buf[2], loc_id, NAME_OBJ_NDTYPE, H5R_OBJECT, (hid_t)-1); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - /*--------------------------------------------------------- - * create dataset contain references - */ - sid = H5Screate_simple (1, dims_dset_objref, NULL); - if (sid < 0) - { - fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - oid = H5Dcreate2 (loc_id, "Dset_OBJREF", H5T_STD_REF_OBJ, sid, H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT); - if (oid < 0) - { - fprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - status = H5Dwrite(oid, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, objref_buf); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - /* add attribute with int type */ - if (make_attr(oid,1,dim_attr_int,"integer",H5T_NATIVE_INT,data_attr_int) < 0) - goto out; - - /* add attribute with obj ref */ - status = add_attr_with_objref(loc_id, oid); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> add_attr_with_objref failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - /* add attribute with region ref */ - status = add_attr_with_regref(loc_id, oid); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> add_attr_with_regref failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - -out: - if(oid > 0) - H5Dclose(oid); - if(sid > 0) - H5Sclose(sid); - - return ret; -} - - -/*------------------------------------------------------------------------- - * Function: gen_region_ref - * - * Purpose: Generate dataset region references - * - * Note: - * copied from h5copygentest.c - * - * Programmer: Jonathan Kim (March 18, 2010) - *------------------------------------------------------------------------*/ -static herr_t gen_region_ref(hid_t loc_id) -{ - int status; - herr_t ret = SUCCEED; - - /* target dataset */ - hid_t sid_trg=0; - hsize_t dims_trg[2] = {3,16}; - - /* dset with region ref type */ - hid_t sid_ref=0, oid_ref=0; - - /* region ref to target dataset */ - hsize_t coords[4][2] = { {0,1}, {2,11}, {1,0}, {2,4} }; - hdset_reg_ref_t rr_data[2]; - hsize_t start[2] = {0,0}; - hsize_t stride[2] = {2,11}; - hsize_t count[2] = {2,2}; - hsize_t block[2] = {1,3}; - hsize_t dims1[1] = {2}; - - /* attr with int type */ - hsize_t dim_attr_int[1]={2}; - int data_attr_int[2] = {10,20}; - - sid_trg = H5Screate_simple (2, dims_trg, NULL); - if (sid_trg < 0) - { - fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - /* select elements space for reference */ - status = H5Sselect_elements (sid_trg, H5S_SELECT_SET, (size_t)4, coords[0]); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - /* create region reference from elements space */ - status = H5Rcreate (&rr_data[0], loc_id, NAME_OBJ_DS2, H5R_DATASET_REGION, sid_trg); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - /* select hyperslab space for reference */ - status = H5Sselect_hyperslab (sid_trg, H5S_SELECT_SET, start, stride, count, block); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> H5Sselect_hyperslab failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - /* create region reference from hyperslab space */ - status = H5Rcreate (&rr_data[1], loc_id, NAME_OBJ_DS2, H5R_DATASET_REGION, sid_trg); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - /* Create dataspace. */ - sid_ref = H5Screate_simple (1, dims1, NULL); - if (sid_ref < 0) - { - fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - /* create region reference dataset */ - oid_ref = H5Dcreate2 (loc_id, REG_REF_DS1, H5T_STD_REF_DSETREG, sid_ref, H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT); - if (oid_ref < 0) - { - fprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - /* write data as region references */ - status = H5Dwrite (oid_ref, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rr_data); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - /* add attribute with int type */ - if (make_attr(oid_ref,1,dim_attr_int,"integer",H5T_NATIVE_INT,data_attr_int) < 0) - goto out; - - /* add attribute with obj ref */ - status = add_attr_with_objref(loc_id, oid_ref); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> add_attr_with_objref failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - /* add attribute with region ref */ - status = add_attr_with_regref(loc_id, oid_ref); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> add_attr_with_regref failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - -out: - if (oid_ref > 0) - H5Dclose (oid_ref); - if (sid_ref > 0) - H5Sclose (sid_ref); - if (sid_trg > 0) - H5Sclose (sid_trg); - - return ret; -} - -/*------------------------------------------------------------------------- -* Function: make_references -* -* Purpose: create a file with obj and region references -* -* Programmer: Jonathan Kim (March 18, 2010) -*------------------------------------------------------------------------- -*/ -static herr_t make_references(hid_t loc_id) -{ - herr_t ret = SUCCEED; - herr_t status; - - /* add target objects */ - status = gen_refered_objs(loc_id); - if (status == FAIL) - { - fprintf(stderr, "Failed to generate referenced object.\n"); - ret = FAIL; - } - - /* add object reference */ - status = gen_obj_ref(loc_id); - if (status == FAIL) - { - fprintf(stderr, "Failed to generate object reference.\n"); - ret = FAIL; - } - - /* add region reference */ - status = gen_region_ref(loc_id); - if (status == FAIL) - { - fprintf(stderr, "Failed to generate region reference.\n"); - ret = FAIL; - } - - return ret; -} - -/*------------------------------------------------------------------------- -* Function: make_complex_attr_references -* -* Purpose: -* create a file with : -* 1. obj ref in attribute of compound type -* 2. region ref in attribute of compound type -* 3. obj ref in attribute of vlen type -* 4. region ref in attribute of vlen type -* -* Programmer: Jonathan (March 25, 2010) -*------------------------------------------------------------------------- -*/ -/* obj dset */ -#define RANK_OBJ 2 -#define DIM0_OBJ 6 -#define DIM1_OBJ 10 -/* container dset */ -#define RANK_DSET 1 -#define DIM_DSET 4 -/* 1. obj references in compound attr */ -#define RANK_COMP_OBJREF 1 -#define DIM_COMP_OBJREF 3 /* for dataset, group, datatype */ -/* 2. region references in compound attr */ -#define RANK_COMP_REGREF 1 -#define DIM_COMP_REGREF 1 /* for element region */ -/* 3. obj references in vlen attr */ -#define RANK_VLEN_OBJREF 1 -#define DIM_VLEN_OBJREF 3 /* for dataset, group, datatype */ -#define LEN0_VLEN_OBJREF 1 /* dataset */ -#define LEN1_VLEN_OBJREF 1 /* group */ -#define LEN2_VLEN_OBJREF 1 /* datatype */ -/* 4. region references in vlen attr */ -#define RANK_VLEN_REGREF 1 -#define DIM_VLEN_REGREF 1 /* for element region */ -#define LEN0_VLEN_REGREF 1 /* element region */ - -static herr_t make_complex_attr_references(hid_t loc_id) -{ - herr_t ret = SUCCEED; - herr_t status; - /* - * for objects - */ - hid_t objgid=0, objdid=0, objtid=0, objsid=0; - hsize_t obj_dims[RANK_OBJ] = {DIM0_OBJ, DIM1_OBJ}; - int obj_data[DIM0_OBJ][DIM1_OBJ]= - {{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, - {10,11,12,13,14,15,16,17,18,19}, - {20,21,22,23,24,25,26,27,28,29}, - {30,31,32,33,34,35,36,37,38,39}, - {40,41,42,43,44,45,46,47,48,49}, - {50,51,52,53,54,55,56,57,58,59}}; - - /* - * group main - */ - hid_t main_gid=0; - /* - * dataset which the attribute will be attached to - */ - hsize_t main_dset_dims[RANK_DSET] = {DIM_DSET}; - hid_t main_sid=0, main_did=0; - /* - * 1. obj references in compound attr - */ - hid_t comp_objref_tid=0, comp_objref_aid=0; - typedef struct comp_objref_t { - hobj_ref_t val_objref; - int val_int; - } comp_objref_t; - comp_objref_t comp_objref_data[DIM_COMP_OBJREF]; - hid_t comp_objref_attr_sid=0; - hsize_t comp_objref_dim[RANK_COMP_OBJREF] = {DIM_COMP_OBJREF}; - - /* - * 2. region references in compound attr - */ - hid_t comp_regref_tid=0, comp_regref_aid=0; - typedef struct comp_regref_t { - hdset_reg_ref_t val_regref; - int val_int; - } comp_regref_t; - comp_regref_t comp_regref_data[DIM_COMP_REGREF]; - hid_t comp_regref_attr_sid=0; - hsize_t comp_regref_dim[RANK_COMP_REGREF] = {DIM_COMP_REGREF}; - hsize_t coords[4][2] = { {0,1}, {2,3}, {3,4}, {4,5} }; - - /* - * 3. obj references in vlen attr - */ - hid_t vlen_objref_attr_tid=0, vlen_objref_attr_sid=0; - hid_t vlen_objref_attr_id=0; - hvl_t vlen_objref_data[DIM_VLEN_OBJREF]; - hsize_t vlen_objref_dims[RANK_VLEN_OBJREF] = {DIM_VLEN_OBJREF}; - - /* - * 4. region references in vlen attr - */ - hid_t vlen_regref_attr_tid=0, vlen_regref_attr_sid=0; - hid_t vlen_regref_attr_id=0; - hvl_t vlen_regref_data[DIM_VLEN_REGREF]; - hsize_t vlen_regref_dim[RANK_VLEN_REGREF] = {DIM_VLEN_REGREF}; - - - /* --------------------------------------- - * create objects which to be referenced - */ - /* object1 group */ - objgid = H5Gcreate2(loc_id, NAME_OBJ_GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - - /* object2 dataset */ - objsid = H5Screate_simple(RANK_OBJ, obj_dims, NULL); - objdid = H5Dcreate2(loc_id, NAME_OBJ_DS1, H5T_NATIVE_INT, objsid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - status = H5Dwrite(objdid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, obj_data[0]); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - /* object3 named datatype */ - objtid = H5Tcopy(H5T_NATIVE_INT); - status = H5Tcommit2(loc_id, NAME_OBJ_NDTYPE, objtid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> H5Tcommit2 failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - - /* --------------------------------------------- - * Put testing objs in this group - * create group contain dataset with attribute and the attribute has - * compound type which contain obj and region reference */ - main_gid = H5Gcreate2(loc_id, "group_main", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (main_gid < 0) - { - fprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - /*---------------------------------------------------------- - * create dataset which the attribute will be attached to - */ - main_sid = H5Screate_simple(RANK_DSET, main_dset_dims, NULL); - - main_did = H5Dcreate2(main_gid, "dset_main", H5T_NATIVE_INT, main_sid, H5P_DEFAULT,H5P_DEFAULT, H5P_DEFAULT); - - status = H5Dwrite(main_did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, obj_data[0]); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - /*------------------------------------------------------------------- - * 1. create obj references in a attribute of compound type - */ - - /* - * create compound type for attribute - */ - comp_objref_tid = H5Tcreate (H5T_COMPOUND, sizeof(comp_objref_t)); - - H5Tinsert(comp_objref_tid, "value_objref", HOFFSET(comp_objref_t, val_objref), H5T_STD_REF_OBJ); - H5Tinsert(comp_objref_tid, "value_int", HOFFSET(comp_objref_t, val_int), H5T_NATIVE_INT); - - /* - * Create the object references into compound type - */ - /* references to dataset */ - status = H5Rcreate (&(comp_objref_data[0].val_objref), loc_id, NAME_OBJ_DS1, H5R_OBJECT,(hid_t)-1); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - comp_objref_data[0].val_int = 0; - - /* references to group */ - status = H5Rcreate (&(comp_objref_data[1].val_objref), loc_id, NAME_OBJ_GRP, H5R_OBJECT,(hid_t)-1); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - comp_objref_data[1].val_int = 10; - - /* references to datatype */ - status = H5Rcreate (&(comp_objref_data[2].val_objref), loc_id, NAME_OBJ_NDTYPE, H5R_OBJECT,(hid_t)-1); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - comp_objref_data[2].val_int = 20; - - /* - * create attribute and write the object ref - */ - comp_objref_attr_sid = H5Screate_simple (RANK_COMP_OBJREF, comp_objref_dim, NULL); - comp_objref_aid = H5Acreate2 (main_did, "Comp_OBJREF", comp_objref_tid, comp_objref_attr_sid, H5P_DEFAULT, H5P_DEFAULT); - status = H5Awrite (comp_objref_aid, comp_objref_tid, comp_objref_data); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> H5Awrite failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - /*------------------------------------------------------------------- - * 2. create region references in attribute of compound type - */ - /* - * create compound type for attribute - */ - comp_regref_tid = H5Tcreate (H5T_COMPOUND, sizeof(comp_regref_t)); - - H5Tinsert(comp_regref_tid, "value_regref", HOFFSET(comp_regref_t, val_regref), H5T_STD_REF_DSETREG); - H5Tinsert(comp_regref_tid, "value_int", HOFFSET(comp_regref_t, val_int), H5T_NATIVE_INT); - - /* - * create the region reference - */ - status = H5Sselect_elements (objsid, H5S_SELECT_SET, (size_t)4, coords[0]); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - status = H5Rcreate (&(comp_regref_data[0].val_regref), loc_id, NAME_OBJ_DS1, H5R_DATASET_REGION, objsid); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - comp_regref_data[0].val_int = 10; - - /* - * create attribute and write the region ref - */ - comp_regref_attr_sid = H5Screate_simple (RANK_COMP_REGREF, comp_regref_dim, NULL); - comp_regref_aid = H5Acreate2 (main_did, "Comp_REGREF", comp_regref_tid, comp_regref_attr_sid, H5P_DEFAULT, H5P_DEFAULT); - status = H5Awrite (comp_regref_aid, comp_regref_tid, comp_regref_data); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> H5Awrite failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - - /*------------------------------------------------------------------- - * 3. create obj references in attribute of vlen type - */ - /* - * prepare vlen data - */ - vlen_objref_data[0].len = LEN0_VLEN_OBJREF; - vlen_objref_data[0].p = HDmalloc (vlen_objref_data[0].len * sizeof(hobj_ref_t)); - vlen_objref_data[1].len = LEN1_VLEN_OBJREF; - vlen_objref_data[1].p = HDmalloc (vlen_objref_data[1].len * sizeof(hobj_ref_t)); - vlen_objref_data[2].len = LEN2_VLEN_OBJREF; - vlen_objref_data[2].p = HDmalloc (vlen_objref_data[2].len * sizeof(hobj_ref_t)); - - /* - * create obj references - */ - /* reference to dataset */ - status = H5Rcreate (&((hobj_ref_t*)vlen_objref_data[0].p)[0], loc_id, NAME_OBJ_DS1, H5R_OBJECT, (hid_t)-1); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - /* reference to group */ - status = H5Rcreate (&((hobj_ref_t*)vlen_objref_data[1].p)[0], loc_id, NAME_OBJ_GRP, H5R_OBJECT, (hid_t)-1); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - /* reference to datatype */ - status = H5Rcreate (&((hobj_ref_t*)vlen_objref_data[2].p)[0], loc_id, NAME_OBJ_NDTYPE, H5R_OBJECT, (hid_t)-1); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - /* - * create vlen type with obj reference - */ - vlen_objref_attr_tid = H5Tvlen_create (H5T_STD_REF_OBJ); - vlen_objref_attr_sid = H5Screate_simple (RANK_VLEN_OBJREF, vlen_objref_dims, NULL); - - /* - * create attribute and write the object reference - */ - vlen_objref_attr_id = H5Acreate2(main_did, "Vlen_OBJREF", vlen_objref_attr_tid, vlen_objref_attr_sid, H5P_DEFAULT, H5P_DEFAULT); - status = H5Awrite (vlen_objref_attr_id, vlen_objref_attr_tid, vlen_objref_data); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> H5Awrite failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - /* close resource for vlen data */ - status = H5Dvlen_reclaim (vlen_objref_attr_tid, vlen_objref_attr_sid, H5P_DEFAULT, vlen_objref_data); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> H5Dvlen_reclaim failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - /*------------------------------------------------------------------- - * 4. create region references in a attribute of vlen type - */ - - /* - * prepare vlen data - */ - vlen_regref_data[0].len = LEN0_VLEN_REGREF; - vlen_regref_data[0].p = HDmalloc (vlen_regref_data[0].len * sizeof(hdset_reg_ref_t)); - - /* - * create region reference - */ - status = H5Sselect_elements(objsid, H5S_SELECT_SET, (size_t)4, coords[0]); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - status = H5Rcreate (&((hdset_reg_ref_t*)vlen_regref_data[0].p)[0], loc_id, NAME_OBJ_DS1, H5R_DATASET_REGION, objsid); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - /* - * create vlen type with region reference - */ - vlen_regref_attr_tid = H5Tvlen_create(H5T_STD_REF_DSETREG); - vlen_regref_attr_sid = H5Screate_simple(RANK_VLEN_REGREF, vlen_regref_dim, NULL); - - /* - * create attribute and write the region reference - */ - vlen_regref_attr_id = H5Acreate2(main_did, "Vlen_REGREF", vlen_regref_attr_tid, vlen_regref_attr_sid, H5P_DEFAULT, H5P_DEFAULT); - status = H5Awrite(vlen_regref_attr_id, vlen_regref_attr_tid, vlen_regref_data); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> H5Awrite failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - - /* close resource for vlen data */ - status = H5Dvlen_reclaim (vlen_regref_attr_tid, vlen_regref_attr_sid, H5P_DEFAULT, vlen_regref_data); - if (status < 0) - { - fprintf(stderr, "Error: %s %d> H5Dvlen_reclaim failed.\n", FUNC, __LINE__); - ret = FAIL; - goto out; - } - -out: - /* release resources */ - if (objgid > 0) - H5Gclose(objgid); - if (objsid > 0) - H5Sclose(objsid); - if (objdid > 0) - H5Dclose(objdid); - if (objtid > 0) - H5Tclose(objtid); - - if (main_gid > 0) - H5Gclose(main_gid); - if (main_sid > 0) - H5Sclose(main_sid); - if (main_did > 0) - H5Dclose(main_did); - /* comp obj ref */ - if (comp_objref_tid > 0) - H5Tclose(comp_objref_tid); - if (comp_objref_aid > 0) - H5Aclose(comp_objref_aid); - if (comp_objref_attr_sid > 0) - H5Sclose(comp_objref_attr_sid); - /* comp region ref */ - if (comp_regref_tid > 0) - H5Tclose(comp_regref_tid); - if (comp_regref_aid > 0) - H5Aclose(comp_regref_aid); - if (comp_regref_attr_sid > 0) - H5Sclose(comp_regref_attr_sid); - /* vlen obj ref */ - if (vlen_objref_attr_id > 0) - H5Aclose(vlen_objref_attr_id); - if (vlen_objref_attr_sid > 0) - H5Sclose(vlen_objref_attr_sid); - if (vlen_objref_attr_tid > 0) - H5Tclose(vlen_objref_attr_tid); - /* vlen region ref */ - if (vlen_regref_attr_id > 0) - H5Aclose(vlen_regref_attr_id); - if (vlen_regref_attr_sid > 0) - H5Sclose(vlen_regref_attr_sid); - if (vlen_regref_attr_tid > 0) - H5Tclose(vlen_regref_attr_tid); - - return ret; -} diff --git a/tools/h5repack/testfiles/1_vds.h5-vds_dset_chunk20x10x5-v.ddl b/tools/h5repack/testfiles/1_vds.h5-vds_dset_chunk20x10x5-v.ddl deleted file mode 100644 index fab9494..0000000 --- a/tools/h5repack/testfiles/1_vds.h5-vds_dset_chunk20x10x5-v.ddl +++ /dev/null @@ -1,112 +0,0 @@ -HDF5 "out-vds_dset_chunk20x10x5.1_vds.h5" { -DATASET "vds_dset" { - DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 5, 18, 8 ) / ( H5S_UNLIMITED, 18, 8 ) } - STORAGE_LAYOUT { - CHUNKED ( 20, 10, 5 ) - SIZE 16000 - } - FILTERS { - NONE - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE -9 - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR - } - DATA { - (0,0,0): 10, 10, 10, 10, 10, 10, 10, 10, - (0,1,0): 10, 10, 10, 10, 10, 10, 10, 10, - (0,2,0): 20, 20, 20, 20, 20, 20, 20, 20, - (0,3,0): 20, 20, 20, 20, 20, 20, 20, 20, - (0,4,0): 20, 20, 20, 20, 20, 20, 20, 20, - (0,5,0): 20, 20, 20, 20, 20, 20, 20, 20, - (0,6,0): 30, 30, 30, 30, 30, 30, 30, 30, - (0,7,0): 30, 30, 30, 30, 30, 30, 30, 30, - (0,8,0): 40, 40, 40, 40, 40, 40, 40, 40, - (0,9,0): 40, 40, 40, 40, 40, 40, 40, 40, - (0,10,0): 40, 40, 40, 40, 40, 40, 40, 40, - (0,11,0): 40, 40, 40, 40, 40, 40, 40, 40, - (0,12,0): 50, 50, 50, 50, 50, 50, 50, 50, - (0,13,0): 50, 50, 50, 50, 50, 50, 50, 50, - (0,14,0): 60, 60, 60, 60, 60, 60, 60, 60, - (0,15,0): 60, 60, 60, 60, 60, 60, 60, 60, - (0,16,0): 60, 60, 60, 60, 60, 60, 60, 60, - (0,17,0): 60, 60, 60, 60, 60, 60, 60, 60, - (1,0,0): 11, 11, 11, 11, 11, 11, 11, 11, - (1,1,0): 11, 11, 11, 11, 11, 11, 11, 11, - (1,2,0): 21, 21, 21, 21, 21, 21, 21, 21, - (1,3,0): 21, 21, 21, 21, 21, 21, 21, 21, - (1,4,0): 21, 21, 21, 21, 21, 21, 21, 21, - (1,5,0): 21, 21, 21, 21, 21, 21, 21, 21, - (1,6,0): 31, 31, 31, 31, 31, 31, 31, 31, - (1,7,0): 31, 31, 31, 31, 31, 31, 31, 31, - (1,8,0): 41, 41, 41, 41, 41, 41, 41, 41, - (1,9,0): 41, 41, 41, 41, 41, 41, 41, 41, - (1,10,0): 41, 41, 41, 41, 41, 41, 41, 41, - (1,11,0): 41, 41, 41, 41, 41, 41, 41, 41, - (1,12,0): 51, 51, 51, 51, 51, 51, 51, 51, - (1,13,0): 51, 51, 51, 51, 51, 51, 51, 51, - (1,14,0): 61, 61, 61, 61, 61, 61, 61, 61, - (1,15,0): 61, 61, 61, 61, 61, 61, 61, 61, - (1,16,0): 61, 61, 61, 61, 61, 61, 61, 61, - (1,17,0): 61, 61, 61, 61, 61, 61, 61, 61, - (2,0,0): 12, 12, 12, 12, 12, 12, 12, 12, - (2,1,0): 12, 12, 12, 12, 12, 12, 12, 12, - (2,2,0): 22, 22, 22, 22, 22, 22, 22, 22, - (2,3,0): 22, 22, 22, 22, 22, 22, 22, 22, - (2,4,0): 22, 22, 22, 22, 22, 22, 22, 22, - (2,5,0): 22, 22, 22, 22, 22, 22, 22, 22, - (2,6,0): 32, 32, 32, 32, 32, 32, 32, 32, - (2,7,0): 32, 32, 32, 32, 32, 32, 32, 32, - (2,8,0): 42, 42, 42, 42, 42, 42, 42, 42, - (2,9,0): 42, 42, 42, 42, 42, 42, 42, 42, - (2,10,0): 42, 42, 42, 42, 42, 42, 42, 42, - (2,11,0): 42, 42, 42, 42, 42, 42, 42, 42, - (2,12,0): 52, 52, 52, 52, 52, 52, 52, 52, - (2,13,0): 52, 52, 52, 52, 52, 52, 52, 52, - (2,14,0): 62, 62, 62, 62, 62, 62, 62, 62, - (2,15,0): 62, 62, 62, 62, 62, 62, 62, 62, - (2,16,0): 62, 62, 62, 62, 62, 62, 62, 62, - (2,17,0): 62, 62, 62, 62, 62, 62, 62, 62, - (3,0,0): 13, 13, 13, 13, 13, 13, 13, 13, - (3,1,0): 13, 13, 13, 13, 13, 13, 13, 13, - (3,2,0): 23, 23, 23, 23, 23, 23, 23, 23, - (3,3,0): 23, 23, 23, 23, 23, 23, 23, 23, - (3,4,0): 23, 23, 23, 23, 23, 23, 23, 23, - (3,5,0): 23, 23, 23, 23, 23, 23, 23, 23, - (3,6,0): 33, 33, 33, 33, 33, 33, 33, 33, - (3,7,0): 33, 33, 33, 33, 33, 33, 33, 33, - (3,8,0): 43, 43, 43, 43, 43, 43, 43, 43, - (3,9,0): 43, 43, 43, 43, 43, 43, 43, 43, - (3,10,0): 43, 43, 43, 43, 43, 43, 43, 43, - (3,11,0): 43, 43, 43, 43, 43, 43, 43, 43, - (3,12,0): 53, 53, 53, 53, 53, 53, 53, 53, - (3,13,0): 53, 53, 53, 53, 53, 53, 53, 53, - (3,14,0): 63, 63, 63, 63, 63, 63, 63, 63, - (3,15,0): 63, 63, 63, 63, 63, 63, 63, 63, - (3,16,0): 63, 63, 63, 63, 63, 63, 63, 63, - (3,17,0): 63, 63, 63, 63, 63, 63, 63, 63, - (4,0,0): 14, 14, 14, 14, 14, 14, 14, 14, - (4,1,0): 14, 14, 14, 14, 14, 14, 14, 14, - (4,2,0): 24, 24, 24, 24, 24, 24, 24, 24, - (4,3,0): 24, 24, 24, 24, 24, 24, 24, 24, - (4,4,0): 24, 24, 24, 24, 24, 24, 24, 24, - (4,5,0): 24, 24, 24, 24, 24, 24, 24, 24, - (4,6,0): 34, 34, 34, 34, 34, 34, 34, 34, - (4,7,0): 34, 34, 34, 34, 34, 34, 34, 34, - (4,8,0): 44, 44, 44, 44, 44, 44, 44, 44, - (4,9,0): 44, 44, 44, 44, 44, 44, 44, 44, - (4,10,0): 44, 44, 44, 44, 44, 44, 44, 44, - (4,11,0): 44, 44, 44, 44, 44, 44, 44, 44, - (4,12,0): 54, 54, 54, 54, 54, 54, 54, 54, - (4,13,0): 54, 54, 54, 54, 54, 54, 54, 54, - (4,14,0): 64, 64, 64, 64, 64, 64, 64, 64, - (4,15,0): 64, 64, 64, 64, 64, 64, 64, 64, - (4,16,0): 64, 64, 64, 64, 64, 64, 64, 64, - (4,17,0): 64, 64, 64, 64, 64, 64, 64, 64 - } -} -} diff --git a/tools/h5repack/testfiles/2_vds.h5-vds_chunk3x6x9-v.ddl b/tools/h5repack/testfiles/2_vds.h5-vds_chunk3x6x9-v.ddl deleted file mode 100644 index 51df9dd..0000000 --- a/tools/h5repack/testfiles/2_vds.h5-vds_chunk3x6x9-v.ddl +++ /dev/null @@ -1,70 +0,0 @@ -HDF5 "out-vds_chunk3x6x9.2_vds.h5" { -DATASET "vds_dset" { - DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 6, 8, 14 ) / ( H5S_UNLIMITED, 8, 14 ) } - STORAGE_LAYOUT { - CHUNKED ( 3, 6, 9 ) - SIZE 5184 - } - FILTERS { - NONE - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE -9 - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR - } - DATA { - (0,0,0): 10, 10, 10, 10, 10, 10, 10, 40, 40, 40, 40, 40, 40, 40, - (0,1,0): 10, 10, 10, 10, 10, 10, 10, 40, 40, 40, 40, 40, 40, 40, - (0,2,0): 20, 20, 20, 20, 20, 20, 20, 40, 40, 40, 40, 40, 40, 40, - (0,3,0): 20, 20, 20, 20, 20, 20, 20, 40, 40, 40, 40, 40, 40, 40, - (0,4,0): 20, 20, 20, 20, 20, 20, 20, 40, 40, 40, 40, 40, 40, 40, - (0,5,0): 20, 20, 20, 20, 20, 20, 20, 50, 50, 50, 50, 50, 50, 50, - (0,6,0): 30, 30, 30, 30, 30, 30, 30, 50, 50, 50, 50, 50, 50, 50, - (0,7,0): 30, 30, 30, 30, 30, 30, 30, 50, 50, 50, 50, 50, 50, 50, - (1,0,0): 11, 11, 11, 11, 11, 11, 11, 41, 41, 41, 41, 41, 41, 41, - (1,1,0): 11, 11, 11, 11, 11, 11, 11, 41, 41, 41, 41, 41, 41, 41, - (1,2,0): 21, 21, 21, 21, 21, 21, 21, 41, 41, 41, 41, 41, 41, 41, - (1,3,0): 21, 21, 21, 21, 21, 21, 21, 41, 41, 41, 41, 41, 41, 41, - (1,4,0): 21, 21, 21, 21, 21, 21, 21, 41, 41, 41, 41, 41, 41, 41, - (1,5,0): 21, 21, 21, 21, 21, 21, 21, 51, 51, 51, 51, 51, 51, 51, - (1,6,0): 31, 31, 31, 31, 31, 31, 31, 51, 51, 51, 51, 51, 51, 51, - (1,7,0): 31, 31, 31, 31, 31, 31, 31, 51, 51, 51, 51, 51, 51, 51, - (2,0,0): 12, 12, 12, 12, 12, 12, 12, 42, 42, 42, 42, 42, 42, 42, - (2,1,0): 12, 12, 12, 12, 12, 12, 12, 42, 42, 42, 42, 42, 42, 42, - (2,2,0): 22, 22, 22, 22, 22, 22, 22, 42, 42, 42, 42, 42, 42, 42, - (2,3,0): 22, 22, 22, 22, 22, 22, 22, 42, 42, 42, 42, 42, 42, 42, - (2,4,0): 22, 22, 22, 22, 22, 22, 22, 42, 42, 42, 42, 42, 42, 42, - (2,5,0): 22, 22, 22, 22, 22, 22, 22, 52, 52, 52, 52, 52, 52, 52, - (2,6,0): 32, 32, 32, 32, 32, 32, 32, 52, 52, 52, 52, 52, 52, 52, - (2,7,0): 32, 32, 32, 32, 32, 32, 32, 52, 52, 52, 52, 52, 52, 52, - (3,0,0): 13, 13, 13, 13, 13, 13, 13, 43, 43, 43, 43, 43, 43, 43, - (3,1,0): 13, 13, 13, 13, 13, 13, 13, 43, 43, 43, 43, 43, 43, 43, - (3,2,0): 23, 23, 23, 23, 23, 23, 23, 43, 43, 43, 43, 43, 43, 43, - (3,3,0): 23, 23, 23, 23, 23, 23, 23, 43, 43, 43, 43, 43, 43, 43, - (3,4,0): 23, 23, 23, 23, 23, 23, 23, 43, 43, 43, 43, 43, 43, 43, - (3,5,0): 23, 23, 23, 23, 23, 23, 23, 53, 53, 53, 53, 53, 53, 53, - (3,6,0): 33, 33, 33, 33, 33, 33, 33, 53, 53, 53, 53, 53, 53, 53, - (3,7,0): 33, 33, 33, 33, 33, 33, 33, 53, 53, 53, 53, 53, 53, 53, - (4,0,0): 14, 14, 14, 14, 14, 14, 14, 44, 44, 44, 44, 44, 44, 44, - (4,1,0): 14, 14, 14, 14, 14, 14, 14, 44, 44, 44, 44, 44, 44, 44, - (4,2,0): 24, 24, 24, 24, 24, 24, 24, 44, 44, 44, 44, 44, 44, 44, - (4,3,0): 24, 24, 24, 24, 24, 24, 24, 44, 44, 44, 44, 44, 44, 44, - (4,4,0): 24, 24, 24, 24, 24, 24, 24, 44, 44, 44, 44, 44, 44, 44, - (4,5,0): 24, 24, 24, 24, 24, 24, 24, 54, 54, 54, 54, 54, 54, 54, - (4,6,0): 34, 34, 34, 34, 34, 34, 34, 54, 54, 54, 54, 54, 54, 54, - (4,7,0): 34, 34, 34, 34, 34, 34, 34, 54, 54, 54, 54, 54, 54, 54, - (5,0,0): 15, 15, 15, 15, 15, 15, 15, 45, 45, 45, 45, 45, 45, 45, - (5,1,0): 15, 15, 15, 15, 15, 15, 15, 45, 45, 45, 45, 45, 45, 45, - (5,2,0): 25, 25, 25, 25, 25, 25, 25, 45, 45, 45, 45, 45, 45, 45, - (5,3,0): 25, 25, 25, 25, 25, 25, 25, 45, 45, 45, 45, 45, 45, 45, - (5,4,0): 25, 25, 25, 25, 25, 25, 25, 45, 45, 45, 45, 45, 45, 45, - (5,5,0): 25, 25, 25, 25, 25, 25, 25, 55, 55, 55, 55, 55, 55, 55, - (5,6,0): 35, 35, 35, 35, 35, 35, 35, 55, 55, 55, 55, 55, 55, 55, - (5,7,0): 35, 35, 35, 35, 35, 35, 35, 55, 55, 55, 55, 55, 55, 55 - } -} -} diff --git a/tools/h5repack/testfiles/3_1_vds.h5-vds_chunk2x5x8-v.ddl b/tools/h5repack/testfiles/3_1_vds.h5-vds_chunk2x5x8-v.ddl deleted file mode 100644 index dcd172c..0000000 --- a/tools/h5repack/testfiles/3_1_vds.h5-vds_chunk2x5x8-v.ddl +++ /dev/null @@ -1,147 +0,0 @@ -HDF5 "out-vds_chunk2x5x8.3_1_vds.h5" { -DATASET "vds_dset" { - DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 5, 25, 8 ) / ( H5S_UNLIMITED, 25, 8 ) } - STORAGE_LAYOUT { - CHUNKED ( 2, 5, 8 ) - SIZE 4800 - } - FILTERS { - NONE - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE -9 - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR - } - DATA { - (0,0,0): -9, -9, -9, -9, -9, -9, -9, -9, - (0,1,0): 10, 10, 10, 10, 10, 10, 10, 10, - (0,2,0): 10, 10, 10, 10, 10, 10, 10, 10, - (0,3,0): -9, -9, -9, -9, -9, -9, -9, -9, - (0,4,0): 20, 20, 20, 20, 20, 20, 20, 20, - (0,5,0): 20, 20, 20, 20, 20, 20, 20, 20, - (0,6,0): 20, 20, 20, 20, 20, 20, 20, 20, - (0,7,0): 20, 20, 20, 20, 20, 20, 20, 20, - (0,8,0): -9, -9, -9, -9, -9, -9, -9, -9, - (0,9,0): 30, 30, 30, 30, 30, 30, 30, 30, - (0,10,0): 30, 30, 30, 30, 30, 30, 30, 30, - (0,11,0): -9, -9, -9, -9, -9, -9, -9, -9, - (0,12,0): 40, 40, 40, 40, 40, 40, 40, 40, - (0,13,0): 40, 40, 40, 40, 40, 40, 40, 40, - (0,14,0): 40, 40, 40, 40, 40, 40, 40, 40, - (0,15,0): 40, 40, 40, 40, 40, 40, 40, 40, - (0,16,0): -9, -9, -9, -9, -9, -9, -9, -9, - (0,17,0): 50, 50, 50, 50, 50, 50, 50, 50, - (0,18,0): 50, 50, 50, 50, 50, 50, 50, 50, - (0,19,0): -9, -9, -9, -9, -9, -9, -9, -9, - (0,20,0): 60, 60, 60, 60, 60, 60, 60, 60, - (0,21,0): 60, 60, 60, 60, 60, 60, 60, 60, - (0,22,0): 60, 60, 60, 60, 60, 60, 60, 60, - (0,23,0): 60, 60, 60, 60, 60, 60, 60, 60, - (0,24,0): -9, -9, -9, -9, -9, -9, -9, -9, - (1,0,0): -9, -9, -9, -9, -9, -9, -9, -9, - (1,1,0): 11, 11, 11, 11, 11, 11, 11, 11, - (1,2,0): 11, 11, 11, 11, 11, 11, 11, 11, - (1,3,0): -9, -9, -9, -9, -9, -9, -9, -9, - (1,4,0): 21, 21, 21, 21, 21, 21, 21, 21, - (1,5,0): 21, 21, 21, 21, 21, 21, 21, 21, - (1,6,0): 21, 21, 21, 21, 21, 21, 21, 21, - (1,7,0): 21, 21, 21, 21, 21, 21, 21, 21, - (1,8,0): -9, -9, -9, -9, -9, -9, -9, -9, - (1,9,0): 31, 31, 31, 31, 31, 31, 31, 31, - (1,10,0): 31, 31, 31, 31, 31, 31, 31, 31, - (1,11,0): -9, -9, -9, -9, -9, -9, -9, -9, - (1,12,0): 41, 41, 41, 41, 41, 41, 41, 41, - (1,13,0): 41, 41, 41, 41, 41, 41, 41, 41, - (1,14,0): 41, 41, 41, 41, 41, 41, 41, 41, - (1,15,0): 41, 41, 41, 41, 41, 41, 41, 41, - (1,16,0): -9, -9, -9, -9, -9, -9, -9, -9, - (1,17,0): 51, 51, 51, 51, 51, 51, 51, 51, - (1,18,0): 51, 51, 51, 51, 51, 51, 51, 51, - (1,19,0): -9, -9, -9, -9, -9, -9, -9, -9, - (1,20,0): 61, 61, 61, 61, 61, 61, 61, 61, - (1,21,0): 61, 61, 61, 61, 61, 61, 61, 61, - (1,22,0): 61, 61, 61, 61, 61, 61, 61, 61, - (1,23,0): 61, 61, 61, 61, 61, 61, 61, 61, - (1,24,0): -9, -9, -9, -9, -9, -9, -9, -9, - (2,0,0): -9, -9, -9, -9, -9, -9, -9, -9, - (2,1,0): 12, 12, 12, 12, 12, 12, 12, 12, - (2,2,0): 12, 12, 12, 12, 12, 12, 12, 12, - (2,3,0): -9, -9, -9, -9, -9, -9, -9, -9, - (2,4,0): 22, 22, 22, 22, 22, 22, 22, 22, - (2,5,0): 22, 22, 22, 22, 22, 22, 22, 22, - (2,6,0): 22, 22, 22, 22, 22, 22, 22, 22, - (2,7,0): 22, 22, 22, 22, 22, 22, 22, 22, - (2,8,0): -9, -9, -9, -9, -9, -9, -9, -9, - (2,9,0): 32, 32, 32, 32, 32, 32, 32, 32, - (2,10,0): 32, 32, 32, 32, 32, 32, 32, 32, - (2,11,0): -9, -9, -9, -9, -9, -9, -9, -9, - (2,12,0): 42, 42, 42, 42, 42, 42, 42, 42, - (2,13,0): 42, 42, 42, 42, 42, 42, 42, 42, - (2,14,0): 42, 42, 42, 42, 42, 42, 42, 42, - (2,15,0): 42, 42, 42, 42, 42, 42, 42, 42, - (2,16,0): -9, -9, -9, -9, -9, -9, -9, -9, - (2,17,0): 52, 52, 52, 52, 52, 52, 52, 52, - (2,18,0): 52, 52, 52, 52, 52, 52, 52, 52, - (2,19,0): -9, -9, -9, -9, -9, -9, -9, -9, - (2,20,0): 62, 62, 62, 62, 62, 62, 62, 62, - (2,21,0): 62, 62, 62, 62, 62, 62, 62, 62, - (2,22,0): 62, 62, 62, 62, 62, 62, 62, 62, - (2,23,0): 62, 62, 62, 62, 62, 62, 62, 62, - (2,24,0): -9, -9, -9, -9, -9, -9, -9, -9, - (3,0,0): -9, -9, -9, -9, -9, -9, -9, -9, - (3,1,0): 13, 13, 13, 13, 13, 13, 13, 13, - (3,2,0): 13, 13, 13, 13, 13, 13, 13, 13, - (3,3,0): -9, -9, -9, -9, -9, -9, -9, -9, - (3,4,0): 23, 23, 23, 23, 23, 23, 23, 23, - (3,5,0): 23, 23, 23, 23, 23, 23, 23, 23, - (3,6,0): 23, 23, 23, 23, 23, 23, 23, 23, - (3,7,0): 23, 23, 23, 23, 23, 23, 23, 23, - (3,8,0): -9, -9, -9, -9, -9, -9, -9, -9, - (3,9,0): 33, 33, 33, 33, 33, 33, 33, 33, - (3,10,0): 33, 33, 33, 33, 33, 33, 33, 33, - (3,11,0): -9, -9, -9, -9, -9, -9, -9, -9, - (3,12,0): 43, 43, 43, 43, 43, 43, 43, 43, - (3,13,0): 43, 43, 43, 43, 43, 43, 43, 43, - (3,14,0): 43, 43, 43, 43, 43, 43, 43, 43, - (3,15,0): 43, 43, 43, 43, 43, 43, 43, 43, - (3,16,0): -9, -9, -9, -9, -9, -9, -9, -9, - (3,17,0): 53, 53, 53, 53, 53, 53, 53, 53, - (3,18,0): 53, 53, 53, 53, 53, 53, 53, 53, - (3,19,0): -9, -9, -9, -9, -9, -9, -9, -9, - (3,20,0): 63, 63, 63, 63, 63, 63, 63, 63, - (3,21,0): 63, 63, 63, 63, 63, 63, 63, 63, - (3,22,0): 63, 63, 63, 63, 63, 63, 63, 63, - (3,23,0): 63, 63, 63, 63, 63, 63, 63, 63, - (3,24,0): -9, -9, -9, -9, -9, -9, -9, -9, - (4,0,0): -9, -9, -9, -9, -9, -9, -9, -9, - (4,1,0): 14, 14, 14, 14, 14, 14, 14, 14, - (4,2,0): 14, 14, 14, 14, 14, 14, 14, 14, - (4,3,0): -9, -9, -9, -9, -9, -9, -9, -9, - (4,4,0): 24, 24, 24, 24, 24, 24, 24, 24, - (4,5,0): 24, 24, 24, 24, 24, 24, 24, 24, - (4,6,0): 24, 24, 24, 24, 24, 24, 24, 24, - (4,7,0): 24, 24, 24, 24, 24, 24, 24, 24, - (4,8,0): -9, -9, -9, -9, -9, -9, -9, -9, - (4,9,0): 34, 34, 34, 34, 34, 34, 34, 34, - (4,10,0): 34, 34, 34, 34, 34, 34, 34, 34, - (4,11,0): -9, -9, -9, -9, -9, -9, -9, -9, - (4,12,0): 44, 44, 44, 44, 44, 44, 44, 44, - (4,13,0): 44, 44, 44, 44, 44, 44, 44, 44, - (4,14,0): 44, 44, 44, 44, 44, 44, 44, 44, - (4,15,0): 44, 44, 44, 44, 44, 44, 44, 44, - (4,16,0): -9, -9, -9, -9, -9, -9, -9, -9, - (4,17,0): 54, 54, 54, 54, 54, 54, 54, 54, - (4,18,0): 54, 54, 54, 54, 54, 54, 54, 54, - (4,19,0): -9, -9, -9, -9, -9, -9, -9, -9, - (4,20,0): 64, 64, 64, 64, 64, 64, 64, 64, - (4,21,0): 64, 64, 64, 64, 64, 64, 64, 64, - (4,22,0): 64, 64, 64, 64, 64, 64, 64, 64, - (4,23,0): 64, 64, 64, 64, 64, 64, 64, 64, - (4,24,0): -9, -9, -9, -9, -9, -9, -9, -9 - } -} -} diff --git a/tools/h5repack/testfiles/4_vds.h5-vds_compa-v.ddl b/tools/h5repack/testfiles/4_vds.h5-vds_compa-v.ddl deleted file mode 100644 index 1e8927c..0000000 --- a/tools/h5repack/testfiles/4_vds.h5-vds_compa-v.ddl +++ /dev/null @@ -1,58 +0,0 @@ -HDF5 "out-vds_compa.4_vds.h5" { -DATASET "vds_dset" { - DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 9, 4, 4 ) / ( 9, 4, 4 ) } - STORAGE_LAYOUT { - COMPACT - SIZE 576 - } - FILTERS { - NONE - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE -9 - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_EARLY - } - DATA { - (0,0,0): 10, 10, 10, 10, - (0,1,0): 10, 10, 10, 10, - (0,2,0): 10, 10, 10, 10, - (0,3,0): 10, 10, 10, 10, - (1,0,0): 11, 11, 11, 11, - (1,1,0): 11, 11, 11, 11, - (1,2,0): 11, 11, 11, 11, - (1,3,0): 11, 11, 11, 11, - (2,0,0): 12, 12, 12, 12, - (2,1,0): 12, 12, 12, 12, - (2,2,0): 12, 12, 12, 12, - (2,3,0): 12, 12, 12, 12, - (3,0,0): 20, 20, 20, 20, - (3,1,0): 20, 20, 20, 20, - (3,2,0): 20, 20, 20, 20, - (3,3,0): 20, 20, 20, 20, - (4,0,0): 21, 21, 21, 21, - (4,1,0): 21, 21, 21, 21, - (4,2,0): 21, 21, 21, 21, - (4,3,0): 21, 21, 21, 21, - (5,0,0): 22, 22, 22, 22, - (5,1,0): 22, 22, 22, 22, - (5,2,0): 22, 22, 22, 22, - (5,3,0): 22, 22, 22, 22, - (6,0,0): 30, 30, 30, 30, - (6,1,0): 30, 30, 30, 30, - (6,2,0): 30, 30, 30, 30, - (6,3,0): 30, 30, 30, 30, - (7,0,0): 31, 31, 31, 31, - (7,1,0): 31, 31, 31, 31, - (7,2,0): 31, 31, 31, 31, - (7,3,0): 31, 31, 31, 31, - (8,0,0): 32, 32, 32, 32, - (8,1,0): 32, 32, 32, 32, - (8,2,0): 32, 32, 32, 32, - (8,3,0): 32, 32, 32, 32 - } -} -} diff --git a/tools/h5repack/testfiles/4_vds.h5-vds_conti-v.ddl b/tools/h5repack/testfiles/4_vds.h5-vds_conti-v.ddl deleted file mode 100644 index c499b35..0000000 --- a/tools/h5repack/testfiles/4_vds.h5-vds_conti-v.ddl +++ /dev/null @@ -1,59 +0,0 @@ -HDF5 "out-vds_conti.4_vds.h5" { -DATASET "vds_dset" { - DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 9, 4, 4 ) / ( 9, 4, 4 ) } - STORAGE_LAYOUT { - CONTIGUOUS - SIZE 576 - OFFSET 2144 - } - FILTERS { - NONE - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE -9 - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_LATE - } - DATA { - (0,0,0): 10, 10, 10, 10, - (0,1,0): 10, 10, 10, 10, - (0,2,0): 10, 10, 10, 10, - (0,3,0): 10, 10, 10, 10, - (1,0,0): 11, 11, 11, 11, - (1,1,0): 11, 11, 11, 11, - (1,2,0): 11, 11, 11, 11, - (1,3,0): 11, 11, 11, 11, - (2,0,0): 12, 12, 12, 12, - (2,1,0): 12, 12, 12, 12, - (2,2,0): 12, 12, 12, 12, - (2,3,0): 12, 12, 12, 12, - (3,0,0): 20, 20, 20, 20, - (3,1,0): 20, 20, 20, 20, - (3,2,0): 20, 20, 20, 20, - (3,3,0): 20, 20, 20, 20, - (4,0,0): 21, 21, 21, 21, - (4,1,0): 21, 21, 21, 21, - (4,2,0): 21, 21, 21, 21, - (4,3,0): 21, 21, 21, 21, - (5,0,0): 22, 22, 22, 22, - (5,1,0): 22, 22, 22, 22, - (5,2,0): 22, 22, 22, 22, - (5,3,0): 22, 22, 22, 22, - (6,0,0): 30, 30, 30, 30, - (6,1,0): 30, 30, 30, 30, - (6,2,0): 30, 30, 30, 30, - (6,3,0): 30, 30, 30, 30, - (7,0,0): 31, 31, 31, 31, - (7,1,0): 31, 31, 31, 31, - (7,2,0): 31, 31, 31, 31, - (7,3,0): 31, 31, 31, 31, - (8,0,0): 32, 32, 32, 32, - (8,1,0): 32, 32, 32, 32, - (8,2,0): 32, 32, 32, 32, - (8,3,0): 32, 32, 32, 32 - } -} -} diff --git a/tools/h5repack/testfiles/README b/tools/h5repack/testfiles/README deleted file mode 100644 index 4096dee..0000000 --- a/tools/h5repack/testfiles/README +++ /dev/null @@ -1,5 +0,0 @@ -h5repack_nested_8bit_enum_deflated.h5: -h5repack_nested_8bit_enum.h5: - enuberated 8bit type nested in compount type. Original file provided - by a user (HDFFV-8667) as a test file. Used h5copy to extract only the - Compound type dataset. The non-deflated version is produced by h5repack. diff --git a/tools/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl b/tools/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl deleted file mode 100644 index 75f54fa..0000000 --- a/tools/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl +++ /dev/null @@ -1,130 +0,0 @@ -HDF5 "out-deflate_limit.h5repack_layout.h5" { -GROUP "/" { - DATASET "dset1" { - DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - STORAGE_LAYOUT { - CHUNKED ( 40, 20 ) - SIZE 1150 (2.783:1 COMPRESSION) - } - FILTERS { - COMPRESSION DEFLATE { LEVEL 1 } - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE H5D_FILL_VALUE_DEFAULT - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR - } - } - DATASET "dset2" { - DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - STORAGE_LAYOUT { - CHUNKED ( 40, 20 ) - SIZE 1150 (2.783:1 COMPRESSION) - } - FILTERS { - COMPRESSION DEFLATE { LEVEL 1 } - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE H5D_FILL_VALUE_DEFAULT - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR - } - } - DATASET "dset3" { - DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - STORAGE_LAYOUT { - CHUNKED ( 40, 20 ) - SIZE 1150 (2.783:1 COMPRESSION) - } - FILTERS { - COMPRESSION DEFLATE { LEVEL 1 } - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE H5D_FILL_VALUE_DEFAULT - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR - } - } - DATASET "dset4" { - DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - STORAGE_LAYOUT { - CHUNKED ( 40, 20 ) - SIZE 1150 (2.783:1 COMPRESSION) - } - FILTERS { - COMPRESSION DEFLATE { LEVEL 1 } - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE H5D_FILL_VALUE_DEFAULT - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR - } - } - DATASET "dset_chunk" { - DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - STORAGE_LAYOUT { - CHUNKED ( 20, 10 ) - SIZE 1283 (2.494:1 COMPRESSION) - } - FILTERS { - COMPRESSION DEFLATE { LEVEL 1 } - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE H5D_FILL_VALUE_DEFAULT - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR - } - } - DATASET "dset_compact" { - DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - STORAGE_LAYOUT { - CHUNKED ( 40, 20 ) - SIZE 1150 (2.783:1 COMPRESSION) - } - FILTERS { - COMPRESSION DEFLATE { LEVEL 1 } - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE H5D_FILL_VALUE_DEFAULT - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR - } - } - DATASET "dset_contiguous" { - DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - STORAGE_LAYOUT { - CHUNKED ( 40, 20 ) - SIZE 1150 (2.783:1 COMPRESSION) - } - FILTERS { - COMPRESSION DEFLATE { LEVEL 1 } - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE H5D_FILL_VALUE_DEFAULT - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR - } - } -} -} diff --git a/tools/h5repack/testfiles/h5repack-help.txt b/tools/h5repack/testfiles/h5repack-help.txt deleted file mode 100644 index 049e27d..0000000 --- a/tools/h5repack/testfiles/h5repack-help.txt +++ /dev/null @@ -1,125 +0,0 @@ -usage: h5repack [OPTIONS] file1 file2 - file1 Input HDF5 File - file2 Output HDF5 File - OPTIONS - -h, --help Print a usage message and exit - -v, --verbose Verbose mode, print object information - -V, --version Print version number and exit - -n, --native Use a native HDF5 type when repacking - -L, --latest Use latest version of file format - -c L1, --compact=L1 Maximum number of links in header messages - -d L2, --indexed=L2 Minimum number of links in the indexed format - -s S[:F], --ssize=S[:F] Shared object header message minimum size - -m M, --minimum=M Do not apply the filter to datasets smaller than M - -e E, --file=E Name of file E with the -f and -l options - -u U, --ublock=U Name of file U with user block data to be added - -b B, --block=B Size of user block to be added - -M A, --metadata_block_size=A Metadata block size for H5Pset_meta_block_size - -t T, --threshold=T Threshold value for H5Pset_alignment - -a A, --alignment=A Alignment value for H5Pset_alignment - -f FILT, --filter=FILT Filter type - -l LAYT, --layout=LAYT Layout type - -S FS_STRGY, --fs_strategy=FS_STRGY File space management strategy - -T FS_THRD, --fs_threshold=FS_THRD Free-space section threshold - - M - is an integer greater than 1, size of dataset in bytes (default is 0) - E - is a filename. - S - is an integer - U - is a filename. - T - is an integer - A - is an integer greater than zero - B - is the user block size, any value that is 512 or greater and is - a power of 2 (1024 default) - F - is the shared object header message type, any of <dspace|dtype|fill| - pline|attr>. If F is not specified, S applies to all messages - - --enable-error-stack Prints messages from the HDF5 error stack as they - occur. - - FS_STRGY is the file space management strategy to use for the output file. - It is a string as listed below: - ALL_PERSIST - Use persistent free-space managers, aggregators and virtual file driver - for file space allocation - ALL - Use non-persistent free-space managers, aggregators and virtual file driver - for file space allocation - AGGR_VFD - Use aggregators and virtual file driver for file space allocation - VFD - Use virtual file driver for file space allocation - - FS_THRD is the free-space section threshold to use for the output file. - It is the minimum size (in bytes) of free-space sections to be tracked - by the the library's free-space managers. - - FILT - is a string with the format: - - <list of objects>:<name of filter>=<filter parameters> - - <list of objects> is a comma separated list of object names, meaning apply - compression only to those objects. If no names are specified, the filter - is applied to all objects - <name of filter> can be: - GZIP, to apply the HDF5 GZIP filter (GZIP compression) - SZIP, to apply the HDF5 SZIP filter (SZIP compression) - SHUF, to apply the HDF5 shuffle filter - FLET, to apply the HDF5 checksum filter - NBIT, to apply the HDF5 NBIT filter (NBIT compression) - SOFF, to apply the HDF5 Scale/Offset filter - UD, to apply a user defined filter - NONE, to remove all filters - <filter parameters> is optional filter parameter information - GZIP=<deflation level> from 1-9 - SZIP=<pixels per block,coding> pixels per block is a even number in - 2-32 and coding method is either EC or NN - SHUF (no parameter) - FLET (no parameter) - NBIT (no parameter) - SOFF=<scale_factor,scale_type> scale_factor is an integer and scale_type - is either IN or DS - UD=<filter_number,cd_value_count,value_1[,value_2,...,value_N]> - required values for filter_number,cd_value_count,value_1 - optional values for value_2 to value_N - NONE (no parameter) - - LAYT - is a string with the format: - - <list of objects>:<layout type>=<layout parameters> - - <list of objects> is a comma separated list of object names, meaning that - layout information is supplied for those objects. If no names are - specified, the layout type is applied to all objects - <layout type> can be: - CHUNK, to apply chunking layout - COMPA, to apply compact layout - CONTI, to apply contiguous layout - <layout parameters> is optional layout information - CHUNK=DIM[xDIM...xDIM], the chunk size of each dimension - COMPA (no parameter) - CONTI (no parameter) - -Examples of use: - -1) h5repack -v -f GZIP=1 file1 file2 - - GZIP compression with level 1 to all objects - -2) h5repack -v -f dset1:SZIP=8,NN file1 file2 - - SZIP compression with 8 pixels per block and NN coding method to object dset1 - -3) h5repack -v -l dset1,dset2:CHUNK=20x10 -f dset3,dset4,dset5:NONE file1 file2 - - Chunked layout, with a layout size of 20x10, to objects dset1 and dset2 - and remove filters to objects dset3, dset4, dset5 - -4) h5repack -L -c 10 -s 20:dtype file1 file2 - - Using latest file format with maximum compact group size of 10 and - and minimum shared datatype size of 20 - -5) h5repack -f SHUF -f GZIP=1 file1 file2 - - Add both filters SHUF and GZIP in this order to all datasets - -6) h5repack -f UD=307,1,9 file1 file2 - - Add bzip2 filter to all datasets - diff --git a/tools/h5repack/testfiles/h5repack.info b/tools/h5repack/testfiles/h5repack.info deleted file mode 100644 index 216948d..0000000 --- a/tools/h5repack/testfiles/h5repack.info +++ /dev/null @@ -1 +0,0 @@ --l dset1:CHUNK=20x20 -f dset1,dset2:GZIP=1 diff --git a/tools/h5repack/testfiles/h5repack_attr.h5 b/tools/h5repack/testfiles/h5repack_attr.h5 Binary files differdeleted file mode 100644 index 80df0be..0000000 --- a/tools/h5repack/testfiles/h5repack_attr.h5 +++ /dev/null diff --git a/tools/h5repack/testfiles/h5repack_attr_refs.h5 b/tools/h5repack/testfiles/h5repack_attr_refs.h5 Binary files differdeleted file mode 100644 index 1b0ca34..0000000 --- a/tools/h5repack/testfiles/h5repack_attr_refs.h5 +++ /dev/null diff --git a/tools/h5repack/testfiles/h5repack_deflate.h5 b/tools/h5repack/testfiles/h5repack_deflate.h5 Binary files differdeleted file mode 100644 index 4988491..0000000 --- a/tools/h5repack/testfiles/h5repack_deflate.h5 +++ /dev/null diff --git a/tools/h5repack/testfiles/h5repack_early.h5 b/tools/h5repack/testfiles/h5repack_early.h5 Binary files differdeleted file mode 100644 index d9a7ece..0000000 --- a/tools/h5repack/testfiles/h5repack_early.h5 +++ /dev/null diff --git a/tools/h5repack/testfiles/h5repack_ext.bin b/tools/h5repack/testfiles/h5repack_ext.bin Binary files differdeleted file mode 100644 index f858094..0000000 --- a/tools/h5repack/testfiles/h5repack_ext.bin +++ /dev/null diff --git a/tools/h5repack/testfiles/h5repack_ext.h5 b/tools/h5repack/testfiles/h5repack_ext.h5 Binary files differdeleted file mode 100644 index 8518b5b..0000000 --- a/tools/h5repack/testfiles/h5repack_ext.h5 +++ /dev/null diff --git a/tools/h5repack/testfiles/h5repack_fill.h5 b/tools/h5repack/testfiles/h5repack_fill.h5 Binary files differdeleted file mode 100644 index ac40089..0000000 --- a/tools/h5repack/testfiles/h5repack_fill.h5 +++ /dev/null diff --git a/tools/h5repack/testfiles/h5repack_filters.h5 b/tools/h5repack/testfiles/h5repack_filters.h5 Binary files differdeleted file mode 100644 index eabade8..0000000 --- a/tools/h5repack/testfiles/h5repack_filters.h5 +++ /dev/null diff --git a/tools/h5repack/testfiles/h5repack_filters.h5-gzip_verbose_filters.tst b/tools/h5repack/testfiles/h5repack_filters.h5-gzip_verbose_filters.tst deleted file mode 100644 index 36e65b9..0000000 --- a/tools/h5repack/testfiles/h5repack_filters.h5-gzip_verbose_filters.tst +++ /dev/null @@ -1,13 +0,0 @@ -Objects to modify layout are... -Objects to apply filter are... - </dset_deflate> with GZIP filter - </dset_deflate>...Found ------------------------------------------ - Type Filter (Compression) Name ------------------------------------------ - group / - dset /dset_all - dset GZIP (0.995:1) /dset_deflate - dset /dset_fletcher32 - dset /dset_nbit - dset /dset_shuffle diff --git a/tools/h5repack/testfiles/h5repack_fletcher.h5 b/tools/h5repack/testfiles/h5repack_fletcher.h5 Binary files differdeleted file mode 100644 index 16ca4ef..0000000 --- a/tools/h5repack/testfiles/h5repack_fletcher.h5 +++ /dev/null diff --git a/tools/h5repack/testfiles/h5repack_hlink.h5 b/tools/h5repack/testfiles/h5repack_hlink.h5 Binary files differdeleted file mode 100644 index 80c0fcc..0000000 --- a/tools/h5repack/testfiles/h5repack_hlink.h5 +++ /dev/null diff --git a/tools/h5repack/testfiles/h5repack_layout.UD.h5 b/tools/h5repack/testfiles/h5repack_layout.UD.h5 Binary files differdeleted file mode 100644 index caf2024..0000000 --- a/tools/h5repack/testfiles/h5repack_layout.UD.h5 +++ /dev/null diff --git a/tools/h5repack/testfiles/h5repack_layout.UD.h5-plugin_none.ddl b/tools/h5repack/testfiles/h5repack_layout.UD.h5-plugin_none.ddl deleted file mode 100644 index 66c4c69..0000000 --- a/tools/h5repack/testfiles/h5repack_layout.UD.h5-plugin_none.ddl +++ /dev/null @@ -1,130 +0,0 @@ -HDF5 "out-plugin_none.h5repack_layout.UD.h5" { -GROUP "/" { - DATASET "dset1" { - DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - STORAGE_LAYOUT { - CHUNKED ( 40, 20 ) - SIZE 3200 - } - FILTERS { - NONE - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE H5D_FILL_VALUE_DEFAULT - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR - } - } - DATASET "dset2" { - DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - STORAGE_LAYOUT { - CHUNKED ( 40, 20 ) - SIZE 3200 - } - FILTERS { - NONE - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE H5D_FILL_VALUE_DEFAULT - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR - } - } - DATASET "dset3" { - DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - STORAGE_LAYOUT { - CHUNKED ( 40, 20 ) - SIZE 3200 - } - FILTERS { - NONE - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE H5D_FILL_VALUE_DEFAULT - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR - } - } - DATASET "dset4" { - DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - STORAGE_LAYOUT { - CHUNKED ( 40, 20 ) - SIZE 3200 - } - FILTERS { - NONE - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE H5D_FILL_VALUE_DEFAULT - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR - } - } - DATASET "dset_chunk" { - DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 40, 20 ) / ( 40, H5S_UNLIMITED ) } - STORAGE_LAYOUT { - CHUNKED ( 20, 10 ) - SIZE 3200 - } - FILTERS { - NONE - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE H5D_FILL_VALUE_DEFAULT - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR - } - } - DATASET "dset_compact" { - DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - STORAGE_LAYOUT { - CHUNKED ( 40, 20 ) - SIZE 3200 - } - FILTERS { - NONE - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE H5D_FILL_VALUE_DEFAULT - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR - } - } - DATASET "dset_contiguous" { - DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - STORAGE_LAYOUT { - CHUNKED ( 40, 20 ) - SIZE 3200 - } - FILTERS { - NONE - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE H5D_FILL_VALUE_DEFAULT - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR - } - } -} -} diff --git a/tools/h5repack/testfiles/h5repack_layout.h5 b/tools/h5repack/testfiles/h5repack_layout.h5 Binary files differdeleted file mode 100644 index 4e53766..0000000 --- a/tools/h5repack/testfiles/h5repack_layout.h5 +++ /dev/null diff --git a/tools/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst b/tools/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst deleted file mode 100644 index 95cc4c6..0000000 --- a/tools/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst +++ /dev/null @@ -1,38 +0,0 @@ -HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): - #000: (file name) line (number) in H5Dcreate2(): unable to create dataset - major: Dataset - minor: Unable to initialize object - #001: (file name) line (number) in H5D__create_named(): unable to create and link to dataset - major: Dataset - minor: Unable to initialize object - #002: (file name) line (number) in H5L_link_object(): unable to create new link to object - major: Links - minor: Unable to initialize object - #003: (file name) line (number) in H5L_create_real(): can't insert link - major: Symbol table - minor: Unable to insert object - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed - major: Symbol table - minor: Object not found - #005: (file name) line (number) in H5G_traverse_real(): traversal operator failed - major: Symbol table - minor: Callback failed - #006: (file name) line (number) in H5L_link_cb(): unable to create object - major: Object header - minor: Unable to initialize object - #007: (file name) line (number) in H5O_obj_create(): unable to open object - major: Object header - minor: Can't open object - #008: (file name) line (number) in H5O__dset_create(): unable to create dataset - major: Dataset - minor: Unable to initialize object - #009: (file name) line (number) in H5D__create(): unable to construct layout information - major: Dataset - minor: Unable to initialize object - #010: (file name) line (number) in H5D__chunk_construct(): dimensionality of chunks doesn't match the dataspace - major: Dataset - minor: Bad value -H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): - #000: (file name) line (number) in do_copy_objects(): H5Dcreate2 failed - major: Failure in tools library - minor: error in function diff --git a/tools/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl b/tools/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl deleted file mode 100644 index a8b4562..0000000 --- a/tools/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl +++ /dev/null @@ -1,158 +0,0 @@ -HDF5 "out-plugin_test.h5repack_layout.h5" { -GROUP "/" { - DATASET "dset1" { - DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - STORAGE_LAYOUT { - CHUNKED ( 40, 20 ) - SIZE 3200 (1.000:1 COMPRESSION) - } - FILTERS { - USER_DEFINED_FILTER { - FILTER_ID 257 - COMMENT dynlib1 - PARAMS { 9 } - } - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE H5D_FILL_VALUE_DEFAULT - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR - } - } - DATASET "dset2" { - DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - STORAGE_LAYOUT { - CHUNKED ( 40, 20 ) - SIZE 3200 (1.000:1 COMPRESSION) - } - FILTERS { - USER_DEFINED_FILTER { - FILTER_ID 257 - COMMENT dynlib1 - PARAMS { 9 } - } - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE H5D_FILL_VALUE_DEFAULT - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR - } - } - DATASET "dset3" { - DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - STORAGE_LAYOUT { - CHUNKED ( 40, 20 ) - SIZE 3200 (1.000:1 COMPRESSION) - } - FILTERS { - USER_DEFINED_FILTER { - FILTER_ID 257 - COMMENT dynlib1 - PARAMS { 9 } - } - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE H5D_FILL_VALUE_DEFAULT - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR - } - } - DATASET "dset4" { - DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - STORAGE_LAYOUT { - CHUNKED ( 40, 20 ) - SIZE 3200 (1.000:1 COMPRESSION) - } - FILTERS { - USER_DEFINED_FILTER { - FILTER_ID 257 - COMMENT dynlib1 - PARAMS { 9 } - } - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE H5D_FILL_VALUE_DEFAULT - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR - } - } - DATASET "dset_chunk" { - DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - STORAGE_LAYOUT { - CHUNKED ( 20, 10 ) - SIZE 3200 (1.000:1 COMPRESSION) - } - FILTERS { - USER_DEFINED_FILTER { - FILTER_ID 257 - COMMENT dynlib1 - PARAMS { 9 } - } - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE H5D_FILL_VALUE_DEFAULT - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR - } - } - DATASET "dset_compact" { - DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - STORAGE_LAYOUT { - CHUNKED ( 40, 20 ) - SIZE 3200 (1.000:1 COMPRESSION) - } - FILTERS { - USER_DEFINED_FILTER { - FILTER_ID 257 - COMMENT dynlib1 - PARAMS { 9 } - } - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE H5D_FILL_VALUE_DEFAULT - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR - } - } - DATASET "dset_contiguous" { - DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - STORAGE_LAYOUT { - CHUNKED ( 40, 20 ) - SIZE 3200 (1.000:1 COMPRESSION) - } - FILTERS { - USER_DEFINED_FILTER { - FILTER_ID 257 - COMMENT dynlib1 - PARAMS { 9 } - } - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE H5D_FILL_VALUE_DEFAULT - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR - } - } -} -} diff --git a/tools/h5repack/testfiles/h5repack_layout.h5-plugin_zero.tst b/tools/h5repack/testfiles/h5repack_layout.h5-plugin_zero.tst deleted file mode 100644 index 0993d5b..0000000 --- a/tools/h5repack/testfiles/h5repack_layout.h5-plugin_zero.tst +++ /dev/null @@ -1,9 +0,0 @@ -Objects to modify layout are... -Objects to apply filter are... - User Defined 250 -Making file <out-plugin_zero.h5repack_layout.h5>... ------------------------------------------ - Type Filter (Compression) Name ------------------------------------------ - group / -h5repack error: <h5repack_layout.h5>: Could not copy data to: out-plugin_zero.h5repack_layout.h5 diff --git a/tools/h5repack/testfiles/h5repack_layout.h5.ddl b/tools/h5repack/testfiles/h5repack_layout.h5.ddl deleted file mode 100644 index 00c74f4..0000000 --- a/tools/h5repack/testfiles/h5repack_layout.h5.ddl +++ /dev/null @@ -1,606 +0,0 @@ -HDF5 "h5repack_layout.h5" { -GROUP "/" { - DATASET "dset1" { - DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - DATA { - (0,0): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - (0,18): 18, 19, - (1,0): 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - (1,16): 36, 37, 38, 39, - (2,0): 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - (2,16): 56, 57, 58, 59, - (3,0): 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - (3,16): 76, 77, 78, 79, - (4,0): 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - (4,16): 96, 97, 98, 99, - (5,0): 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - (5,13): 113, 114, 115, 116, 117, 118, 119, - (6,0): 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - (6,13): 133, 134, 135, 136, 137, 138, 139, - (7,0): 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - (7,13): 153, 154, 155, 156, 157, 158, 159, - (8,0): 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - (8,13): 173, 174, 175, 176, 177, 178, 179, - (9,0): 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - (9,13): 193, 194, 195, 196, 197, 198, 199, - (10,0): 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, - (10,12): 212, 213, 214, 215, 216, 217, 218, 219, - (11,0): 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, - (11,12): 232, 233, 234, 235, 236, 237, 238, 239, - (12,0): 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, - (12,12): 252, 253, 254, 255, 256, 257, 258, 259, - (13,0): 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, - (13,12): 272, 273, 274, 275, 276, 277, 278, 279, - (14,0): 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, - (14,12): 292, 293, 294, 295, 296, 297, 298, 299, - (15,0): 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, - (15,12): 312, 313, 314, 315, 316, 317, 318, 319, - (16,0): 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, - (16,12): 332, 333, 334, 335, 336, 337, 338, 339, - (17,0): 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, - (17,12): 352, 353, 354, 355, 356, 357, 358, 359, - (18,0): 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, - (18,12): 372, 373, 374, 375, 376, 377, 378, 379, - (19,0): 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, - (19,12): 392, 393, 394, 395, 396, 397, 398, 399, - (20,0): 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, - (20,12): 412, 413, 414, 415, 416, 417, 418, 419, - (21,0): 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, - (21,12): 432, 433, 434, 435, 436, 437, 438, 439, - (22,0): 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, - (22,12): 452, 453, 454, 455, 456, 457, 458, 459, - (23,0): 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, - (23,12): 472, 473, 474, 475, 476, 477, 478, 479, - (24,0): 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, - (24,12): 492, 493, 494, 495, 496, 497, 498, 499, - (25,0): 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, - (25,12): 512, 513, 514, 515, 516, 517, 518, 519, - (26,0): 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, - (26,12): 532, 533, 534, 535, 536, 537, 538, 539, - (27,0): 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, - (27,12): 552, 553, 554, 555, 556, 557, 558, 559, - (28,0): 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, - (28,12): 572, 573, 574, 575, 576, 577, 578, 579, - (29,0): 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, - (29,12): 592, 593, 594, 595, 596, 597, 598, 599, - (30,0): 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, - (30,12): 612, 613, 614, 615, 616, 617, 618, 619, - (31,0): 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, - (31,12): 632, 633, 634, 635, 636, 637, 638, 639, - (32,0): 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, - (32,12): 652, 653, 654, 655, 656, 657, 658, 659, - (33,0): 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, - (33,12): 672, 673, 674, 675, 676, 677, 678, 679, - (34,0): 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, - (34,12): 692, 693, 694, 695, 696, 697, 698, 699, - (35,0): 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, - (35,12): 712, 713, 714, 715, 716, 717, 718, 719, - (36,0): 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, - (36,12): 732, 733, 734, 735, 736, 737, 738, 739, - (37,0): 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, - (37,12): 752, 753, 754, 755, 756, 757, 758, 759, - (38,0): 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, - (38,12): 772, 773, 774, 775, 776, 777, 778, 779, - (39,0): 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, - (39,12): 792, 793, 794, 795, 796, 797, 798, 799 - } - } - DATASET "dset2" { - DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - DATA { - (0,0): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - (0,18): 18, 19, - (1,0): 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - (1,16): 36, 37, 38, 39, - (2,0): 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - (2,16): 56, 57, 58, 59, - (3,0): 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - (3,16): 76, 77, 78, 79, - (4,0): 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - (4,16): 96, 97, 98, 99, - (5,0): 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - (5,13): 113, 114, 115, 116, 117, 118, 119, - (6,0): 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - (6,13): 133, 134, 135, 136, 137, 138, 139, - (7,0): 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - (7,13): 153, 154, 155, 156, 157, 158, 159, - (8,0): 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - (8,13): 173, 174, 175, 176, 177, 178, 179, - (9,0): 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - (9,13): 193, 194, 195, 196, 197, 198, 199, - (10,0): 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, - (10,12): 212, 213, 214, 215, 216, 217, 218, 219, - (11,0): 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, - (11,12): 232, 233, 234, 235, 236, 237, 238, 239, - (12,0): 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, - (12,12): 252, 253, 254, 255, 256, 257, 258, 259, - (13,0): 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, - (13,12): 272, 273, 274, 275, 276, 277, 278, 279, - (14,0): 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, - (14,12): 292, 293, 294, 295, 296, 297, 298, 299, - (15,0): 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, - (15,12): 312, 313, 314, 315, 316, 317, 318, 319, - (16,0): 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, - (16,12): 332, 333, 334, 335, 336, 337, 338, 339, - (17,0): 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, - (17,12): 352, 353, 354, 355, 356, 357, 358, 359, - (18,0): 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, - (18,12): 372, 373, 374, 375, 376, 377, 378, 379, - (19,0): 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, - (19,12): 392, 393, 394, 395, 396, 397, 398, 399, - (20,0): 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, - (20,12): 412, 413, 414, 415, 416, 417, 418, 419, - (21,0): 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, - (21,12): 432, 433, 434, 435, 436, 437, 438, 439, - (22,0): 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, - (22,12): 452, 453, 454, 455, 456, 457, 458, 459, - (23,0): 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, - (23,12): 472, 473, 474, 475, 476, 477, 478, 479, - (24,0): 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, - (24,12): 492, 493, 494, 495, 496, 497, 498, 499, - (25,0): 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, - (25,12): 512, 513, 514, 515, 516, 517, 518, 519, - (26,0): 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, - (26,12): 532, 533, 534, 535, 536, 537, 538, 539, - (27,0): 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, - (27,12): 552, 553, 554, 555, 556, 557, 558, 559, - (28,0): 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, - (28,12): 572, 573, 574, 575, 576, 577, 578, 579, - (29,0): 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, - (29,12): 592, 593, 594, 595, 596, 597, 598, 599, - (30,0): 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, - (30,12): 612, 613, 614, 615, 616, 617, 618, 619, - (31,0): 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, - (31,12): 632, 633, 634, 635, 636, 637, 638, 639, - (32,0): 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, - (32,12): 652, 653, 654, 655, 656, 657, 658, 659, - (33,0): 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, - (33,12): 672, 673, 674, 675, 676, 677, 678, 679, - (34,0): 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, - (34,12): 692, 693, 694, 695, 696, 697, 698, 699, - (35,0): 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, - (35,12): 712, 713, 714, 715, 716, 717, 718, 719, - (36,0): 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, - (36,12): 732, 733, 734, 735, 736, 737, 738, 739, - (37,0): 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, - (37,12): 752, 753, 754, 755, 756, 757, 758, 759, - (38,0): 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, - (38,12): 772, 773, 774, 775, 776, 777, 778, 779, - (39,0): 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, - (39,12): 792, 793, 794, 795, 796, 797, 798, 799 - } - } - DATASET "dset3" { - DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - DATA { - (0,0): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - (0,18): 18, 19, - (1,0): 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - (1,16): 36, 37, 38, 39, - (2,0): 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - (2,16): 56, 57, 58, 59, - (3,0): 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - (3,16): 76, 77, 78, 79, - (4,0): 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - (4,16): 96, 97, 98, 99, - (5,0): 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - (5,13): 113, 114, 115, 116, 117, 118, 119, - (6,0): 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - (6,13): 133, 134, 135, 136, 137, 138, 139, - (7,0): 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - (7,13): 153, 154, 155, 156, 157, 158, 159, - (8,0): 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - (8,13): 173, 174, 175, 176, 177, 178, 179, - (9,0): 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - (9,13): 193, 194, 195, 196, 197, 198, 199, - (10,0): 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, - (10,12): 212, 213, 214, 215, 216, 217, 218, 219, - (11,0): 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, - (11,12): 232, 233, 234, 235, 236, 237, 238, 239, - (12,0): 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, - (12,12): 252, 253, 254, 255, 256, 257, 258, 259, - (13,0): 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, - (13,12): 272, 273, 274, 275, 276, 277, 278, 279, - (14,0): 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, - (14,12): 292, 293, 294, 295, 296, 297, 298, 299, - (15,0): 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, - (15,12): 312, 313, 314, 315, 316, 317, 318, 319, - (16,0): 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, - (16,12): 332, 333, 334, 335, 336, 337, 338, 339, - (17,0): 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, - (17,12): 352, 353, 354, 355, 356, 357, 358, 359, - (18,0): 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, - (18,12): 372, 373, 374, 375, 376, 377, 378, 379, - (19,0): 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, - (19,12): 392, 393, 394, 395, 396, 397, 398, 399, - (20,0): 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, - (20,12): 412, 413, 414, 415, 416, 417, 418, 419, - (21,0): 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, - (21,12): 432, 433, 434, 435, 436, 437, 438, 439, - (22,0): 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, - (22,12): 452, 453, 454, 455, 456, 457, 458, 459, - (23,0): 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, - (23,12): 472, 473, 474, 475, 476, 477, 478, 479, - (24,0): 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, - (24,12): 492, 493, 494, 495, 496, 497, 498, 499, - (25,0): 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, - (25,12): 512, 513, 514, 515, 516, 517, 518, 519, - (26,0): 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, - (26,12): 532, 533, 534, 535, 536, 537, 538, 539, - (27,0): 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, - (27,12): 552, 553, 554, 555, 556, 557, 558, 559, - (28,0): 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, - (28,12): 572, 573, 574, 575, 576, 577, 578, 579, - (29,0): 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, - (29,12): 592, 593, 594, 595, 596, 597, 598, 599, - (30,0): 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, - (30,12): 612, 613, 614, 615, 616, 617, 618, 619, - (31,0): 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, - (31,12): 632, 633, 634, 635, 636, 637, 638, 639, - (32,0): 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, - (32,12): 652, 653, 654, 655, 656, 657, 658, 659, - (33,0): 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, - (33,12): 672, 673, 674, 675, 676, 677, 678, 679, - (34,0): 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, - (34,12): 692, 693, 694, 695, 696, 697, 698, 699, - (35,0): 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, - (35,12): 712, 713, 714, 715, 716, 717, 718, 719, - (36,0): 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, - (36,12): 732, 733, 734, 735, 736, 737, 738, 739, - (37,0): 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, - (37,12): 752, 753, 754, 755, 756, 757, 758, 759, - (38,0): 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, - (38,12): 772, 773, 774, 775, 776, 777, 778, 779, - (39,0): 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, - (39,12): 792, 793, 794, 795, 796, 797, 798, 799 - } - } - DATASET "dset4" { - DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - DATA { - (0,0): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - (0,18): 18, 19, - (1,0): 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - (1,16): 36, 37, 38, 39, - (2,0): 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - (2,16): 56, 57, 58, 59, - (3,0): 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - (3,16): 76, 77, 78, 79, - (4,0): 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - (4,16): 96, 97, 98, 99, - (5,0): 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - (5,13): 113, 114, 115, 116, 117, 118, 119, - (6,0): 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - (6,13): 133, 134, 135, 136, 137, 138, 139, - (7,0): 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - (7,13): 153, 154, 155, 156, 157, 158, 159, - (8,0): 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - (8,13): 173, 174, 175, 176, 177, 178, 179, - (9,0): 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - (9,13): 193, 194, 195, 196, 197, 198, 199, - (10,0): 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, - (10,12): 212, 213, 214, 215, 216, 217, 218, 219, - (11,0): 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, - (11,12): 232, 233, 234, 235, 236, 237, 238, 239, - (12,0): 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, - (12,12): 252, 253, 254, 255, 256, 257, 258, 259, - (13,0): 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, - (13,12): 272, 273, 274, 275, 276, 277, 278, 279, - (14,0): 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, - (14,12): 292, 293, 294, 295, 296, 297, 298, 299, - (15,0): 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, - (15,12): 312, 313, 314, 315, 316, 317, 318, 319, - (16,0): 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, - (16,12): 332, 333, 334, 335, 336, 337, 338, 339, - (17,0): 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, - (17,12): 352, 353, 354, 355, 356, 357, 358, 359, - (18,0): 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, - (18,12): 372, 373, 374, 375, 376, 377, 378, 379, - (19,0): 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, - (19,12): 392, 393, 394, 395, 396, 397, 398, 399, - (20,0): 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, - (20,12): 412, 413, 414, 415, 416, 417, 418, 419, - (21,0): 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, - (21,12): 432, 433, 434, 435, 436, 437, 438, 439, - (22,0): 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, - (22,12): 452, 453, 454, 455, 456, 457, 458, 459, - (23,0): 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, - (23,12): 472, 473, 474, 475, 476, 477, 478, 479, - (24,0): 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, - (24,12): 492, 493, 494, 495, 496, 497, 498, 499, - (25,0): 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, - (25,12): 512, 513, 514, 515, 516, 517, 518, 519, - (26,0): 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, - (26,12): 532, 533, 534, 535, 536, 537, 538, 539, - (27,0): 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, - (27,12): 552, 553, 554, 555, 556, 557, 558, 559, - (28,0): 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, - (28,12): 572, 573, 574, 575, 576, 577, 578, 579, - (29,0): 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, - (29,12): 592, 593, 594, 595, 596, 597, 598, 599, - (30,0): 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, - (30,12): 612, 613, 614, 615, 616, 617, 618, 619, - (31,0): 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, - (31,12): 632, 633, 634, 635, 636, 637, 638, 639, - (32,0): 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, - (32,12): 652, 653, 654, 655, 656, 657, 658, 659, - (33,0): 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, - (33,12): 672, 673, 674, 675, 676, 677, 678, 679, - (34,0): 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, - (34,12): 692, 693, 694, 695, 696, 697, 698, 699, - (35,0): 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, - (35,12): 712, 713, 714, 715, 716, 717, 718, 719, - (36,0): 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, - (36,12): 732, 733, 734, 735, 736, 737, 738, 739, - (37,0): 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, - (37,12): 752, 753, 754, 755, 756, 757, 758, 759, - (38,0): 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, - (38,12): 772, 773, 774, 775, 776, 777, 778, 779, - (39,0): 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, - (39,12): 792, 793, 794, 795, 796, 797, 798, 799 - } - } - DATASET "dset_chunk" { - DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 40, 20 ) / ( 40, H5S_UNLIMITED ) } - DATA { - (0,0): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - (0,18): 18, 19, - (1,0): 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - (1,16): 36, 37, 38, 39, - (2,0): 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - (2,16): 56, 57, 58, 59, - (3,0): 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - (3,16): 76, 77, 78, 79, - (4,0): 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - (4,16): 96, 97, 98, 99, - (5,0): 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - (5,13): 113, 114, 115, 116, 117, 118, 119, - (6,0): 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - (6,13): 133, 134, 135, 136, 137, 138, 139, - (7,0): 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - (7,13): 153, 154, 155, 156, 157, 158, 159, - (8,0): 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - (8,13): 173, 174, 175, 176, 177, 178, 179, - (9,0): 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - (9,13): 193, 194, 195, 196, 197, 198, 199, - (10,0): 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, - (10,12): 212, 213, 214, 215, 216, 217, 218, 219, - (11,0): 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, - (11,12): 232, 233, 234, 235, 236, 237, 238, 239, - (12,0): 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, - (12,12): 252, 253, 254, 255, 256, 257, 258, 259, - (13,0): 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, - (13,12): 272, 273, 274, 275, 276, 277, 278, 279, - (14,0): 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, - (14,12): 292, 293, 294, 295, 296, 297, 298, 299, - (15,0): 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, - (15,12): 312, 313, 314, 315, 316, 317, 318, 319, - (16,0): 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, - (16,12): 332, 333, 334, 335, 336, 337, 338, 339, - (17,0): 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, - (17,12): 352, 353, 354, 355, 356, 357, 358, 359, - (18,0): 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, - (18,12): 372, 373, 374, 375, 376, 377, 378, 379, - (19,0): 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, - (19,12): 392, 393, 394, 395, 396, 397, 398, 399, - (20,0): 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, - (20,12): 412, 413, 414, 415, 416, 417, 418, 419, - (21,0): 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, - (21,12): 432, 433, 434, 435, 436, 437, 438, 439, - (22,0): 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, - (22,12): 452, 453, 454, 455, 456, 457, 458, 459, - (23,0): 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, - (23,12): 472, 473, 474, 475, 476, 477, 478, 479, - (24,0): 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, - (24,12): 492, 493, 494, 495, 496, 497, 498, 499, - (25,0): 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, - (25,12): 512, 513, 514, 515, 516, 517, 518, 519, - (26,0): 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, - (26,12): 532, 533, 534, 535, 536, 537, 538, 539, - (27,0): 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, - (27,12): 552, 553, 554, 555, 556, 557, 558, 559, - (28,0): 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, - (28,12): 572, 573, 574, 575, 576, 577, 578, 579, - (29,0): 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, - (29,12): 592, 593, 594, 595, 596, 597, 598, 599, - (30,0): 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, - (30,12): 612, 613, 614, 615, 616, 617, 618, 619, - (31,0): 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, - (31,12): 632, 633, 634, 635, 636, 637, 638, 639, - (32,0): 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, - (32,12): 652, 653, 654, 655, 656, 657, 658, 659, - (33,0): 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, - (33,12): 672, 673, 674, 675, 676, 677, 678, 679, - (34,0): 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, - (34,12): 692, 693, 694, 695, 696, 697, 698, 699, - (35,0): 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, - (35,12): 712, 713, 714, 715, 716, 717, 718, 719, - (36,0): 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, - (36,12): 732, 733, 734, 735, 736, 737, 738, 739, - (37,0): 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, - (37,12): 752, 753, 754, 755, 756, 757, 758, 759, - (38,0): 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, - (38,12): 772, 773, 774, 775, 776, 777, 778, 779, - (39,0): 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, - (39,12): 792, 793, 794, 795, 796, 797, 798, 799 - } - } - DATASET "dset_compact" { - DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - DATA { - (0,0): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - (0,18): 18, 19, - (1,0): 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - (1,16): 36, 37, 38, 39, - (2,0): 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - (2,16): 56, 57, 58, 59, - (3,0): 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - (3,16): 76, 77, 78, 79, - (4,0): 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - (4,16): 96, 97, 98, 99, - (5,0): 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - (5,13): 113, 114, 115, 116, 117, 118, 119, - (6,0): 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - (6,13): 133, 134, 135, 136, 137, 138, 139, - (7,0): 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - (7,13): 153, 154, 155, 156, 157, 158, 159, - (8,0): 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - (8,13): 173, 174, 175, 176, 177, 178, 179, - (9,0): 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - (9,13): 193, 194, 195, 196, 197, 198, 199, - (10,0): 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, - (10,12): 212, 213, 214, 215, 216, 217, 218, 219, - (11,0): 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, - (11,12): 232, 233, 234, 235, 236, 237, 238, 239, - (12,0): 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, - (12,12): 252, 253, 254, 255, 256, 257, 258, 259, - (13,0): 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, - (13,12): 272, 273, 274, 275, 276, 277, 278, 279, - (14,0): 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, - (14,12): 292, 293, 294, 295, 296, 297, 298, 299, - (15,0): 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, - (15,12): 312, 313, 314, 315, 316, 317, 318, 319, - (16,0): 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, - (16,12): 332, 333, 334, 335, 336, 337, 338, 339, - (17,0): 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, - (17,12): 352, 353, 354, 355, 356, 357, 358, 359, - (18,0): 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, - (18,12): 372, 373, 374, 375, 376, 377, 378, 379, - (19,0): 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, - (19,12): 392, 393, 394, 395, 396, 397, 398, 399, - (20,0): 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, - (20,12): 412, 413, 414, 415, 416, 417, 418, 419, - (21,0): 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, - (21,12): 432, 433, 434, 435, 436, 437, 438, 439, - (22,0): 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, - (22,12): 452, 453, 454, 455, 456, 457, 458, 459, - (23,0): 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, - (23,12): 472, 473, 474, 475, 476, 477, 478, 479, - (24,0): 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, - (24,12): 492, 493, 494, 495, 496, 497, 498, 499, - (25,0): 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, - (25,12): 512, 513, 514, 515, 516, 517, 518, 519, - (26,0): 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, - (26,12): 532, 533, 534, 535, 536, 537, 538, 539, - (27,0): 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, - (27,12): 552, 553, 554, 555, 556, 557, 558, 559, - (28,0): 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, - (28,12): 572, 573, 574, 575, 576, 577, 578, 579, - (29,0): 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, - (29,12): 592, 593, 594, 595, 596, 597, 598, 599, - (30,0): 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, - (30,12): 612, 613, 614, 615, 616, 617, 618, 619, - (31,0): 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, - (31,12): 632, 633, 634, 635, 636, 637, 638, 639, - (32,0): 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, - (32,12): 652, 653, 654, 655, 656, 657, 658, 659, - (33,0): 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, - (33,12): 672, 673, 674, 675, 676, 677, 678, 679, - (34,0): 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, - (34,12): 692, 693, 694, 695, 696, 697, 698, 699, - (35,0): 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, - (35,12): 712, 713, 714, 715, 716, 717, 718, 719, - (36,0): 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, - (36,12): 732, 733, 734, 735, 736, 737, 738, 739, - (37,0): 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, - (37,12): 752, 753, 754, 755, 756, 757, 758, 759, - (38,0): 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, - (38,12): 772, 773, 774, 775, 776, 777, 778, 779, - (39,0): 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, - (39,12): 792, 793, 794, 795, 796, 797, 798, 799 - } - } - DATASET "dset_contiguous" { - DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - DATA { - (0,0): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - (0,18): 18, 19, - (1,0): 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - (1,16): 36, 37, 38, 39, - (2,0): 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - (2,16): 56, 57, 58, 59, - (3,0): 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - (3,16): 76, 77, 78, 79, - (4,0): 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - (4,16): 96, 97, 98, 99, - (5,0): 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - (5,13): 113, 114, 115, 116, 117, 118, 119, - (6,0): 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - (6,13): 133, 134, 135, 136, 137, 138, 139, - (7,0): 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - (7,13): 153, 154, 155, 156, 157, 158, 159, - (8,0): 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - (8,13): 173, 174, 175, 176, 177, 178, 179, - (9,0): 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - (9,13): 193, 194, 195, 196, 197, 198, 199, - (10,0): 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, - (10,12): 212, 213, 214, 215, 216, 217, 218, 219, - (11,0): 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, - (11,12): 232, 233, 234, 235, 236, 237, 238, 239, - (12,0): 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, - (12,12): 252, 253, 254, 255, 256, 257, 258, 259, - (13,0): 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, - (13,12): 272, 273, 274, 275, 276, 277, 278, 279, - (14,0): 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, - (14,12): 292, 293, 294, 295, 296, 297, 298, 299, - (15,0): 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, - (15,12): 312, 313, 314, 315, 316, 317, 318, 319, - (16,0): 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, - (16,12): 332, 333, 334, 335, 336, 337, 338, 339, - (17,0): 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, - (17,12): 352, 353, 354, 355, 356, 357, 358, 359, - (18,0): 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, - (18,12): 372, 373, 374, 375, 376, 377, 378, 379, - (19,0): 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, - (19,12): 392, 393, 394, 395, 396, 397, 398, 399, - (20,0): 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, - (20,12): 412, 413, 414, 415, 416, 417, 418, 419, - (21,0): 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, - (21,12): 432, 433, 434, 435, 436, 437, 438, 439, - (22,0): 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, - (22,12): 452, 453, 454, 455, 456, 457, 458, 459, - (23,0): 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, - (23,12): 472, 473, 474, 475, 476, 477, 478, 479, - (24,0): 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, - (24,12): 492, 493, 494, 495, 496, 497, 498, 499, - (25,0): 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, - (25,12): 512, 513, 514, 515, 516, 517, 518, 519, - (26,0): 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, - (26,12): 532, 533, 534, 535, 536, 537, 538, 539, - (27,0): 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, - (27,12): 552, 553, 554, 555, 556, 557, 558, 559, - (28,0): 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, - (28,12): 572, 573, 574, 575, 576, 577, 578, 579, - (29,0): 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, - (29,12): 592, 593, 594, 595, 596, 597, 598, 599, - (30,0): 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, - (30,12): 612, 613, 614, 615, 616, 617, 618, 619, - (31,0): 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, - (31,12): 632, 633, 634, 635, 636, 637, 638, 639, - (32,0): 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, - (32,12): 652, 653, 654, 655, 656, 657, 658, 659, - (33,0): 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, - (33,12): 672, 673, 674, 675, 676, 677, 678, 679, - (34,0): 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, - (34,12): 692, 693, 694, 695, 696, 697, 698, 699, - (35,0): 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, - (35,12): 712, 713, 714, 715, 716, 717, 718, 719, - (36,0): 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, - (36,12): 732, 733, 734, 735, 736, 737, 738, 739, - (37,0): 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, - (37,12): 752, 753, 754, 755, 756, 757, 758, 759, - (38,0): 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, - (38,12): 772, 773, 774, 775, 776, 777, 778, 779, - (39,0): 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, - (39,12): 792, 793, 794, 795, 796, 797, 798, 799 - } - } -} -} diff --git a/tools/h5repack/testfiles/h5repack_layout2.h5 b/tools/h5repack/testfiles/h5repack_layout2.h5 Binary files differdeleted file mode 100644 index f6821e5..0000000 --- a/tools/h5repack/testfiles/h5repack_layout2.h5 +++ /dev/null diff --git a/tools/h5repack/testfiles/h5repack_layout3.h5 b/tools/h5repack/testfiles/h5repack_layout3.h5 Binary files differdeleted file mode 100644 index 6d2de41..0000000 --- a/tools/h5repack/testfiles/h5repack_layout3.h5 +++ /dev/null diff --git a/tools/h5repack/testfiles/h5repack_layouto.h5 b/tools/h5repack/testfiles/h5repack_layouto.h5 Binary files differdeleted file mode 100644 index a038e68..0000000 --- a/tools/h5repack/testfiles/h5repack_layouto.h5 +++ /dev/null diff --git a/tools/h5repack/testfiles/h5repack_named_dtypes.h5 b/tools/h5repack/testfiles/h5repack_named_dtypes.h5 Binary files differdeleted file mode 100644 index 85c1352..0000000 --- a/tools/h5repack/testfiles/h5repack_named_dtypes.h5 +++ /dev/null diff --git a/tools/h5repack/testfiles/h5repack_nbit.h5 b/tools/h5repack/testfiles/h5repack_nbit.h5 Binary files differdeleted file mode 100644 index ac71bee..0000000 --- a/tools/h5repack/testfiles/h5repack_nbit.h5 +++ /dev/null diff --git a/tools/h5repack/testfiles/h5repack_nested_8bit_enum.h5 b/tools/h5repack/testfiles/h5repack_nested_8bit_enum.h5 Binary files differdeleted file mode 100644 index f1bd8e9..0000000 --- a/tools/h5repack/testfiles/h5repack_nested_8bit_enum.h5 +++ /dev/null diff --git a/tools/h5repack/testfiles/h5repack_nested_8bit_enum_deflated.h5 b/tools/h5repack/testfiles/h5repack_nested_8bit_enum_deflated.h5 Binary files differdeleted file mode 100644 index 2e66da2..0000000 --- a/tools/h5repack/testfiles/h5repack_nested_8bit_enum_deflated.h5 +++ /dev/null diff --git a/tools/h5repack/testfiles/h5repack_objs.h5 b/tools/h5repack/testfiles/h5repack_objs.h5 Binary files differdeleted file mode 100644 index 284b0ac..0000000 --- a/tools/h5repack/testfiles/h5repack_objs.h5 +++ /dev/null diff --git a/tools/h5repack/testfiles/h5repack_refs.h5 b/tools/h5repack/testfiles/h5repack_refs.h5 Binary files differdeleted file mode 100644 index 2a1ec9b..0000000 --- a/tools/h5repack/testfiles/h5repack_refs.h5 +++ /dev/null diff --git a/tools/h5repack/testfiles/h5repack_shuffle.h5 b/tools/h5repack/testfiles/h5repack_shuffle.h5 Binary files differdeleted file mode 100644 index c14e2cb..0000000 --- a/tools/h5repack/testfiles/h5repack_shuffle.h5 +++ /dev/null diff --git a/tools/h5repack/testfiles/h5repack_soffset.h5 b/tools/h5repack/testfiles/h5repack_soffset.h5 Binary files differdeleted file mode 100644 index 2acd867..0000000 --- a/tools/h5repack/testfiles/h5repack_soffset.h5 +++ /dev/null diff --git a/tools/h5repack/testfiles/h5repack_szip.h5 b/tools/h5repack/testfiles/h5repack_szip.h5 Binary files differdeleted file mode 100644 index b16d169..0000000 --- a/tools/h5repack/testfiles/h5repack_szip.h5 +++ /dev/null diff --git a/tools/h5repack/testfiles/plugin_none.h5repack_layout.UD.h5.tst b/tools/h5repack/testfiles/plugin_none.h5repack_layout.UD.h5.tst deleted file mode 100644 index 4fb6906..0000000 --- a/tools/h5repack/testfiles/plugin_none.h5repack_layout.UD.h5.tst +++ /dev/null @@ -1,14 +0,0 @@ -Objects to modify layout are... -Objects to apply filter are... - Uncompress all ------------------------------------------ - Type Filter (Compression) Name ------------------------------------------ - group / - dset (1.000:1) /dset1 - dset (1.000:1) /dset2 - dset (1.000:1) /dset3 - dset (1.000:1) /dset4 - dset (1.000:1) /dset_chunk - dset (1.000:1) /dset_compact - dset (1.000:1) /dset_contiguous diff --git a/tools/h5repack/testfiles/plugin_test.h5repack_layout.h5.tst b/tools/h5repack/testfiles/plugin_test.h5repack_layout.h5.tst deleted file mode 100644 index 7f9bd6e..0000000 --- a/tools/h5repack/testfiles/plugin_test.h5repack_layout.h5.tst +++ /dev/null @@ -1,14 +0,0 @@ -Objects to modify layout are... -Objects to apply filter are... - User Defined 257 ------------------------------------------ - Type Filter (Compression) Name ------------------------------------------ - group / - dset UD (1.000:1) /dset1 - dset UD (1.000:1) /dset2 - dset UD (1.000:1) /dset3 - dset UD (1.000:1) /dset4 - dset UD (1.000:1) /dset_chunk - dset UD (1.000:1) /dset_compact - dset UD (1.000:1) /dset_contiguous diff --git a/tools/h5repack/testfiles/ublock.bin b/tools/h5repack/testfiles/ublock.bin deleted file mode 100644 index b2d03f3..0000000 --- a/tools/h5repack/testfiles/ublock.bin +++ /dev/null @@ -1 +0,0 @@ -abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrst
\ No newline at end of file diff --git a/tools/h5repack/testh5repack_detect_szip.c b/tools/h5repack/testh5repack_detect_szip.c deleted file mode 100644 index e91b2f7..0000000 --- a/tools/h5repack/testh5repack_detect_szip.c +++ /dev/null @@ -1,62 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include <stdio.h> -#include "h5repack.h" -#include "h5tools.h" -#include "h5tools_utils.h" -#include "h5test.h" - - -/* Name of tool */ -#define PROGRAMNAME "h5repack_detect_szip" - -/*------------------------------------------------------------------------- - * Function: main - * - * Purpose: detects szip encoder, prints "yes" or "no" to stdout. - * Intended to be used in test scripts. - * - * Return: - * - * Programmer: - * - * Date: - * - * Comments: - * - * Modifications: - * - *------------------------------------------------------------------------- - */ - - -int main(void) -{ - h5tools_setprogname(PROGRAMNAME); - h5tools_setstatus(EXIT_SUCCESS); - - /* Initialize h5tools lib */ - h5tools_init(); - -#ifdef H5_HAVE_FILTER_SZIP - if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) { - printf("yes\n"); - return(1); - } -#endif /* H5_HAVE_FILTER_SZIP */ - printf("no\n"); - return(0); -} |