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/misc | |
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/misc')
29 files changed, 0 insertions, 6003 deletions
diff --git a/tools/misc/CMakeLists.txt b/tools/misc/CMakeLists.txt deleted file mode 100644 index f7ca039..0000000 --- a/tools/misc/CMakeLists.txt +++ /dev/null @@ -1,92 +0,0 @@ -cmake_minimum_required (VERSION 3.1.0) -PROJECT (HDF5_TOOLS_MISC) - -#----------------------------------------------------------------------------- -# Setup include Directories -#----------------------------------------------------------------------------- -INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib) - -# -------------------------------------------------------------------- -# Add the misc executables -# -------------------------------------------------------------------- -#-- Misc Executables -add_executable (h5debug ${HDF5_TOOLS_MISC_SOURCE_DIR}/h5debug.c) -TARGET_NAMING (h5debug STATIC) -TARGET_C_PROPERTIES (h5debug STATIC " " " ") -target_link_libraries (h5debug ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) -set_target_properties (h5debug PROPERTIES FOLDER tools) -set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5debug") - -add_executable (h5repart ${HDF5_TOOLS_MISC_SOURCE_DIR}/h5repart.c) -TARGET_NAMING (h5repart STATIC) -TARGET_C_PROPERTIES (h5repart STATIC " " " ") -target_link_libraries (h5repart ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) -set_target_properties (h5repart PROPERTIES FOLDER tools) -set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repart") - -add_executable (h5mkgrp ${HDF5_TOOLS_MISC_SOURCE_DIR}/h5mkgrp.c) -TARGET_NAMING (h5mkgrp STATIC) -TARGET_C_PROPERTIES (h5mkgrp STATIC " " " ") -target_link_libraries (h5mkgrp ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) -set_target_properties (h5mkgrp PROPERTIES FOLDER tools) -set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5mkgrp") - -set (H5_DEP_EXECUTABLES - h5debug - h5repart - h5mkgrp -) - -#----------------------------------------------------------------------------- -# Generate the h5cc file containing settings needed to compile programs -#----------------------------------------------------------------------------- -#if (NOT WIN32) -# configure_file (${HDF5_TOOLS_MISC_SOURCE_DIR}/h5cc.in ${HDF5_BINARY_DIR}/h5cc @ONLY) -#endif (NOT WIN32) - -if (BUILD_TESTING) - # -------------------------------------------------------------------- - # Add the misc test executables - # -------------------------------------------------------------------- - if (HDF5_BUILD_GENERATORS) - add_executable (h5repart_gentest ${HDF5_TOOLS_MISC_SOURCE_DIR}/h5repart_gentest.c) - TARGET_NAMING (h5repart_gentest STATIC) - TARGET_C_PROPERTIES (h5repart_gentest STATIC " " " ") - target_link_libraries (h5repart_gentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) - set_target_properties (h5repart_gentest PROPERTIES FOLDER generator/tools) - #add_test (NAME h5repart_gentest COMMAND $<TARGET_FILE:h5repart_gentest>) - - add_subdirectory (${HDF5_TOOLS_MISC_SOURCE_DIR}/vds) - - endif (HDF5_BUILD_GENERATORS) - - add_executable (h5repart_test ${HDF5_TOOLS_MISC_SOURCE_DIR}/repart_test.c) - TARGET_NAMING (h5repart_test STATIC) - TARGET_C_PROPERTIES (h5repart_test STATIC " " " ") - target_link_libraries (h5repart_test ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) - set_target_properties (h5repart_test PROPERTIES FOLDER tools) - - 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 (h5debug ${HDF5_INSTALL_BIN_DIR} toolsapplications) -#INSTALL_PROGRAM_PDB (h5repart ${HDF5_INSTALL_BIN_DIR} toolsapplications) -#INSTALL_PROGRAM_PDB (h5mkgrp ${HDF5_INSTALL_BIN_DIR} toolsapplications) - -install ( - TARGETS - h5debug h5repart h5mkgrp - EXPORT - ${HDF5_EXPORTED_TARGETS} - RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications -) diff --git a/tools/misc/CMakeTests.cmake b/tools/misc/CMakeTests.cmake deleted file mode 100644 index bc2760b..0000000 --- a/tools/misc/CMakeTests.cmake +++ /dev/null @@ -1,253 +0,0 @@ - -############################################################################## -############################################################################## -### T E S T I N G ### -############################################################################## -############################################################################## - - # -------------------------------------------------------------------- - # Copy all the HDF5 files from the source directory into the test directory - # -------------------------------------------------------------------- - set (HDF5_REFERENCE_TEST_FILES - family_file00000.h5 - family_file00001.h5 - family_file00002.h5 - family_file00003.h5 - family_file00004.h5 - family_file00005.h5 - family_file00006.h5 - family_file00007.h5 - family_file00008.h5 - family_file00009.h5 - family_file00010.h5 - family_file00011.h5 - family_file00012.h5 - family_file00013.h5 - family_file00014.h5 - family_file00015.h5 - family_file00016.h5 - family_file00017.h5 - ) - - foreach (h5_file ${HDF5_REFERENCE_TEST_FILES}) - HDFTEST_COPY_FILE("${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/${h5_file}" "h5repart_files") - endforeach (h5_file ${HDF5_REFERENCE_TEST_FILES}) - add_custom_target(h5repart_files ALL COMMENT "Copying files needed by h5repart tests" DEPENDS ${h5repart_files_list}) - - set (HDF5_MKGRP_TEST_FILES - #h5mkgrp_help.txt - #h5mkgrp_version - h5mkgrp_single.ls - h5mkgrp_single_v.ls - h5mkgrp_single_p.ls - h5mkgrp_single_l.ls - h5mkgrp_several.ls - h5mkgrp_several_v.ls - h5mkgrp_several_p.ls - h5mkgrp_several_l.ls - h5mkgrp_nested_p.ls - h5mkgrp_nested_lp.ls - h5mkgrp_nested_mult_p.ls - h5mkgrp_nested_mult_lp.ls - ) - - # make test dir - file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - - foreach (h5_mkgrp_file ${HDF5_MKGRP_TEST_FILES}) - HDFTEST_COPY_FILE("${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_mkgrp_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_mkgrp_file}" "h5mkgrp_files") - endforeach (h5_mkgrp_file ${HDF5_MKGRP_TEST_FILES}) - - HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/testfiles/h5mkgrp_help.txt" "${PROJECT_BINARY_DIR}/testfiles/h5mkgrp_help.txt" "h5mkgrp_files") - add_custom_target(h5mkgrp_files ALL COMMENT "Copying files needed by h5mkgrp tests" DEPENDS ${h5mkgrp_files_list}) - - configure_file (${PROJECT_SOURCE_DIR}/testfiles/h5mkgrp_version.txt.in ${PROJECT_BINARY_DIR}/testfiles/h5mkgrp_version.txt @ONLY) - -############################################################################## -############################################################################## -### T H E T E S T S M A C R O S ### -############################################################################## -############################################################################## - - MACRO (ADD_H5_TEST resultfile resultcode resultoption) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) - add_test ( - NAME H5MKGRP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.h5 - ) - set_tests_properties (H5MKGRP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - - add_test ( - NAME H5MKGRP-${resultfile} - COMMAND $<TARGET_FILE:h5mkgrp> ${resultoption} ${resultfile}.h5 ${ARGN} - ) - set_tests_properties (H5MKGRP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (HDF5_ENABLE_USING_MEMCHECKER) - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5MKGRP-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") - else (HDF5_ENABLE_USING_MEMCHECKER) - set_tests_properties (H5MKGRP-${resultfile} PROPERTIES DEPENDS H5MKGRP-${resultfile}-clear-objects) - add_test ( - NAME H5MKGRP-${resultfile}-h5ls - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:h5ls>" - -D "TEST_ARGS:STRING=-v;-r;${resultfile}.h5" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" - -D "TEST_OUTPUT=${resultfile}.out" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_MASK_MOD=true" - -D "TEST_REFERENCE=${resultfile}.ls" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - set_tests_properties (H5MKGRP-${resultfile}-h5ls PROPERTIES DEPENDS H5MKGRP-${resultfile}) - endif (HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_TEST resultfile resultcode resultoption) - - MACRO (ADD_H5_CMP resultfile resultcode) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5MKGRP_CMP-${resultfile} COMMAND $<TARGET_FILE:h5mkgrp> ${ARGN}) - else (HDF5_ENABLE_USING_MEMCHECKER) - add_test ( - NAME H5MKGRP_CMP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.h5 - ) - set_tests_properties (H5MKGRP_CMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - add_test ( - NAME H5MKGRP_CMP-${resultfile} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:h5mkgrp>" - -D "TEST_ARGS:STRING=${ARGN}" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" - -D "TEST_OUTPUT=${resultfile}.out" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_REFERENCE=${resultfile}.txt" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - set_tests_properties (H5MKGRP_CMP-${resultfile} PROPERTIES DEPENDS H5MKGRP_CMP-${resultfile}-clear-objects) - endif (HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_CMP resultfile resultcode) - -############################################################################## -############################################################################## -### T H E T E S T S ### -############################################################################## -############################################################################## - - ###################### H5REPART ######################### - # Remove any output file left over from previous test run - add_test ( - NAME H5REPART-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove - fst_family00000.h5 - scd_family00000.h5 - scd_family00001.h5 - scd_family00002.h5 - scd_family00003.h5 - family_to_sec2.h5 - ) - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5REPART-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") - set (last_test "H5REPART-clearall-objects") - - # repartition family member size to 20,000 bytes. - add_test (NAME H5REPART-h5repart_20K COMMAND $<TARGET_FILE:h5repart> -m 20000 family_file%05d.h5 fst_family%05d.h5) - set_tests_properties (H5REPART-h5repart_20K PROPERTIES DEPENDS H5REPART-clearall-objects) - - # repartition family member size to 5 KB. - add_test (NAME H5REPART-h5repart_5K COMMAND $<TARGET_FILE:h5repart> -m 5k family_file%05d.h5 scd_family%05d.h5) - set_tests_properties (H5REPART-h5repart_5K PROPERTIES DEPENDS H5REPART-clearall-objects) - - # convert family file to sec2 file of 20,000 bytes - add_test (NAME H5REPART-h5repart_sec2 COMMAND $<TARGET_FILE:h5repart> -m 20000 -family_to_sec2 family_file%05d.h5 family_to_sec2.h5) - set_tests_properties (H5REPART-h5repart_sec2 PROPERTIES DEPENDS H5REPART-clearall-objects) - - # test the output files repartitioned above. - add_test (NAME H5REPART-h5repart_test COMMAND $<TARGET_FILE:h5repart_test>) - set_tests_properties (H5REPART-h5repart_test PROPERTIES DEPENDS "H5REPART-clearall-objects;H5REPART-h5repart_20K;H5REPART-h5repart_5K;H5REPART-h5repart_sec2") - - set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} - h5repart_test - ) - - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test ( - NAME H5MKGRP-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove - h5mkgrp_help.out - h5mkgrp_help.out.err - h5mkgrp_version.out - h5mkgrp_version.out.err - h5mkgrp_single.h5 - h5mkgrp_single.out - h5mkgrp_single.out.err - h5mkgrp_single_v.h5 - h5mkgrp_single_v.out - h5mkgrp_single_v.out.err - h5mkgrp_single_p.h5 - h5mkgrp_single_p.out - h5mkgrp_single_p.out.err - h5mkgrp_single_l.h5 - h5mkgrp_single_l.out - h5mkgrp_single_l.out.err - h5mkgrp_several.h5 - h5mkgrp_several.out - h5mkgrp_several.out.err - h5mkgrp_several_v.h5 - h5mkgrp_several_v.out - h5mkgrp_several_v.out.err - h5mkgrp_several_p.h5 - h5mkgrp_several_p.out - h5mkgrp_several_p.out.err - h5mkgrp_several_l.h5 - h5mkgrp_several_l.out - h5mkgrp_several_l.out.err - h5mkgrp_nested_p.h5 - h5mkgrp_nested_p.out - h5mkgrp_nested_p.out.err - h5mkgrp_nested_lp.h5 - h5mkgrp_nested_lp.out - h5mkgrp_nested_lp.out.err - h5mkgrp_nested_mult_p.h5 - h5mkgrp_nested_mult_p.out - h5mkgrp_nested_mult_p.out.err - h5mkgrp_nested_mult_lp.h5 - h5mkgrp_nested_mult_lp.out - h5mkgrp_nested_mult_lp.out.err - ) - set_tests_properties (H5MKGRP-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5MKGRP-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") - set (last_test "H5MKGRP-clearall-objects") - endif (HDF5_ENABLE_USING_MEMCHECKER) - - # Check that help & version is displayed properly - ADD_H5_CMP (h5mkgrp_help 0 "-h") - ADD_H5_CMP (h5mkgrp_version 0 "-V") - - # Create single group at root level - ADD_H5_TEST (h5mkgrp_single 0 "" single) - ADD_H5_TEST (h5mkgrp_single_v 0 "-v" single) - ADD_H5_TEST (h5mkgrp_single_p 0 "-p" single) - ADD_H5_TEST (h5mkgrp_single_l 0 "-l" latest) - - # Create several groups at root level - ADD_H5_TEST (h5mkgrp_several 0 "" one two) - ADD_H5_TEST (h5mkgrp_several_v 0 "-v" one two) - ADD_H5_TEST (h5mkgrp_several_p 0 "-p" one two) - ADD_H5_TEST (h5mkgrp_several_l 0 "-l" one two) - - # Create various nested groups - ADD_H5_TEST (h5mkgrp_nested_p 0 "-p" /one/two) - ADD_H5_TEST (h5mkgrp_nested_lp 0 "-lp" /one/two) - ADD_H5_TEST (h5mkgrp_nested_mult_p 0 "-p" /one/two /three/four) - ADD_H5_TEST (h5mkgrp_nested_mult_lp 0 "-lp" /one/two /three/four) diff --git a/tools/misc/Makefile.am b/tools/misc/Makefile.am deleted file mode 100644 index fdfe8f7..0000000 --- a/tools/misc/Makefile.am +++ /dev/null @@ -1,76 +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 - -SUBDIRS=vds - -# Include src directory -AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib - -#test scripts and programs -TEST_PROG=h5repart_gentest talign -TEST_SCRIPT=testh5repart.sh testh5mkgrp.sh - -check_PROGRAMS=$(TEST_PROG) repart_test -check_SCRIPTS=$(TEST_SCRIPT) -SCRIPT_DEPEND=h5repart$(EXEEXT) h5mkgrp$(EXEEXT) - -# These are our main targets, the tools -bin_PROGRAMS=h5debug h5repart h5mkgrp -bin_SCRIPTS=h5redeploy - -# Add h5debug, h5repart, and h5mkgrp specific linker flags here -h5debug_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) -h5repart_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) -h5mkgrp_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) - -# Tell automake to clean h5redeploy script -CLEANFILES=h5redeploy - -# Temporary files. *.h5 are generated by h5repart_gentest. They should -# copied to the testfiles/ directory if update is required. fst_family*.h5 -# and scd_family*.h5 were created by setting the HDF5_NOCLEANUP variable. -CHECK_CLEANFILES+=*.h5 ../testfiles/fst_family*.h5 ../testfiles/scd_family*.h5 - -# These were generated by configure. Remove them only when distclean. -DISTCLEANFILES=h5cc testh5repart.sh - -# All programs rely on hdf5 library and h5tools library -LDADD=$(LIBH5TOOLS) $(LIBHDF5) - -# h5cc needs custom install and uninstall rules, since it may be -# named h5pcc if hdf5 is being built in parallel mode. -if BUILD_PARALLEL_CONDITIONAL - H5CC_NAME=h5pcc -else - H5CC_NAME=h5cc -endif - -install-exec-local: - @$(INSTALL) h5cc $(DESTDIR)$(bindir)/$(H5CC_NAME) -uninstall-local: - @$(RM) $(DESTDIR)$(bindir)/$(H5CC_NAME) - -# How to build h5redeploy script -h5redeploy: h5redeploy.in - @cp $(srcdir)/$@.in $@ - -include $(top_srcdir)/config/conclude.am diff --git a/tools/misc/h5cc.in b/tools/misc/h5cc.in deleted file mode 100644 index 1645855..0000000 --- a/tools/misc/h5cc.in +++ /dev/null @@ -1,401 +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. -## - -# This tool is adapted from the mpicc command of the MPICH Software. - -############################################################################ -## ## -## Things You May Have to Modify: ## -## ## -## If the following paths don't point to the place were HDF5 is installed ## -## on your system (i.e., you received a binary distribution or moved the ## -## files from the originally installed directory to another directory) ## -## then modify them accordingly to represent the new paths. ## -## ## -############################################################################ -prefix="@prefix@" -exec_prefix="@exec_prefix@" -libdir="@libdir@" -includedir="@includedir@" -HL="@HL@" - -############################################################################ -## ## -## Things You Can Modify to Override HDF5 Library Build Components: ## -## ## -## (Advanced usage - know what you're doing - you're on your own here.) ## -## The four variables below can be used to insert paths and flags in ## -## CPPFLAGS, CFLAGS, LDFLAGS, or LIBS in the h5cc compile line: ## -## $CLINKER $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CFLAGS $CFLAGS $LDFLAGS ## -## $LIBS $clibpath $link_objs $link_args $shared_link ## -## ## -## These settings can be overriden by setting HDF5_CFLAGS, ## -## HDF5_CPPFLAGS, HDF5_LDFLAGS, or HDF5_LIBS in the environment. ## -## ## -############################################################################ -CFLAGSBASE="" -CPPFLAGSBASE="" -LDFLAGSBASE="" -LIBSBASE="" - -############################################################################ -## ## -## You shouldn't have to modify anything below this line. ## -## ## -############################################################################ - -# Constants definitions -EXIT_SUCCESS=0 -EXIT_FAILURE=1 - -host_os="@host_os@" - -prog_name="`basename $0`" - -allargs="" -compile_args="" -libraries="" -link_args="" -link_objs="" -clibpath="" - -do_link="yes" -do_compile="no" -dash_o="no" -dash_c="no" -get_output_file="no" - -SHOW="eval" -CCBASE="@CC@" -CLINKERBASE="@CC@" - -# CFLAGS, CPPFLAGS and LDFLAGS are reserved for use by the script user. -# FLAGS brought from the hdf5 build are put in H5BLD_*FLAGS. - -# User's CPPFLAGS and CFLAGS come after their H5BLD counterparts. User's -# LDFLAGS come just before clibpath, user's LIBS come after $link_objs and -# before the hdf5 libraries in $link_args, followed by any external library -# paths and libraries from AM_LDFLAGS, LDFLAGS, AM_LIBS or LIBS carried in -# from the hdf5 build. The order of the flags is intended to give precedence -# to the user's flags. -H5BLD_CFLAGS="@AM_CFLAGS@ @CFLAGS@" -H5BLD_CPPFLAGS="@AM_CPPFLAGS@ @CPPFLAGS@" -H5BLD_LDFLAGS="@AM_LDFLAGS@ @LDFLAGS@" -H5BLD_LIBS="@LIBS@" - -CC="${HDF5_CC:-$CCBASE}" -CLINKER="${HDF5_CLINKER:-$CLINKERBASE}" -CFLAGS="${HDF5_CFLAGS:-$CFLAGSBASE}" -CPPFLAGS="${HDF5_CPPFLAGS:-$CPPFLAGSBASE}" -LDFLAGS="${HDF5_LDFLAGS:-$LDFLAGSBASE}" -LIBS="${HDF5_LIBS:-$LIBSBASE}" - -# If a static library is available, the default will be to use it. If the only -# available library is shared, it will be used by default. The user can -# override either default, although choosing an unavailable library will result -# in link errors. -STATIC_AVAILABLE="@enable_static@" -if test "${STATIC_AVAILABLE}" = "yes"; then - USE_SHARED_LIB="${HDF5_USE_SHLIB:-no}" -else - USE_SHARED_LIB="${HDF5_USE_SHLIB:-yes}" -fi - - -usage() { - # A wonderfully informative "usage" message. - echo "usage: $prog_name [OPTIONS] <compile line>" - echo " OPTIONS:" - echo " -help This help message." - echo " -echo Show all the shell commands executed" - echo " -prefix=DIR Prefix directory to find HDF5 lib/ and include/" - echo " subdirectories [default: $prefix]" - # A wonderfully informative "usage" message. - echo "usage: $prog_name [OPTIONS] <compile line>" - echo " OPTIONS:" - echo " -help This help message." - echo " -echo Show all the shell commands executed" - echo " -prefix=DIR Prefix directory to find HDF5 lib/ and include/" - echo " subdirectories [default: $prefix]" - echo " -show Show the commands without executing them" - echo " -showconfig Show the HDF5 library configuration summary" - echo " -shlib Compile with shared HDF5 libraries [default for hdf5 built" - echo " without static libraries]" - echo " -noshlib Compile with static HDF5 libraries [default for hdf5 built" - echo " with static libraries]" - echo " " - echo " <compile line> - the normal compile line options for your compiler." - echo " $prog_name uses the same compiler you used to compile" - echo " HDF5. Check with your compiler's man pages for more" - echo " information on which options are needed." - echo " " - echo " You can override the compiler, linker, and whether or not to use static" - echo " or shared libraries to compile your program by setting the following" - echo " environment variables accordingly:" - echo " " - echo " HDF5_CC - use a different C compiler" - echo " HDF5_CLINKER - use a different linker" - echo " HDF5_USE_SHLIB=[yes|no] - use shared or static version of the HDF5 library" - echo " [default: no except when built with only" - echo " shared libraries]" - echo " " - echo " You can also add or change paths and flags to the compile line using" - echo " the following environment varibles or by assigning them to their counterparts" - echo " in the 'Things You Can Modify to Override...'" section of $prog_name - echo " " - echo " Variable Current value to be replaced" - echo " HDF5_CPPFLAGS \"$CPPFLAGSBASE\"" - echo " HDF5_CFLAGS \"$CFLAGSBASE\"" - echo " HDF5_LDFLAGS \"$LDFLAGSBASE\"" - echo " HDF5_LIBS \"$LIBSBASE\"" - echo " " - echo " Note that adding library paths to HDF5_LDFLAGS where another hdf5 version" - echo " is located may link your program with that other hdf5 library version." - echo " " - exit $EXIT_FAILURE -} - -# Show the configuration summary of the library recorded in the -# libhdf5.settings file reside in the lib directory. -showconfigure() -{ - cat ${libdir}/libhdf5.settings - status=$? -} - -# Main -status=$EXIT_SUCCESS - -if test "$#" = "0"; then - # No parameters specified, issue usage statement and exit. - usage -fi - -case "$CC" in - gcc) - kind="gcc" - ;; - mpicc|mpcc|mpicc_r) - # Is this gcc masquarading as an MPI compiler? - if test "`${CC} -v 2>&1 | sed -n 2p | cut -c1-3`" = "gcc"; then - kind="gcc" - else - # Nope - kind="$host_os" - fi - ;; - *) - kind="$host_os" - ;; -esac - -for arg in $@ ; do - if test "x$get_output_file" = "xyes"; then - link_args="$link_args $arg" - output_file="$arg" - get_output_file="no" - continue - fi - - case "$arg" in - -c) - allargs="$allargs $arg" - compile_args="$compile_args $arg" - - if test "x$do_link" = "xyes" -a -n "$output_file"; then - compile_args="$compile_args -o $output_file" - fi - - do_link="no" - dash_c="yes" - ;; - -o) - allargs="$allargs $arg" - dash_o="yes" - - if test "x$dash_c" = "xyes"; then - compile_args="$compile_args $arg" - else - link_args="$link_args $arg" - do_link="yes" - get_output_file="yes" - fi - ;; - -E|-M|-MT) - allargs="$allargs $arg" - compile_args="$compile_args $arg" - dash_c="yes" - do_link="no" - ;; - -l*) - libraries=" $libraries $arg " - allargs="$allargs $arg" - ;; - -prefix=*) - prefix="`expr "$arg" : '-prefix=\(.*\)'`" - ;; - -echo) - set -x - ;; - -show) - SHOW="echo" - ;; - -showconfig) - showconfigure - exit $status - ;; - -shlib) - USE_SHARED_LIB="yes" - ;; - -noshlib) - USE_SHARED_LIB="no" - ;; - -help) - usage - ;; - *\"*) - qarg="'"$arg"'" - allargs="$allargs $qarg" - ;; - *\'*) - qarg='\"'"$arg"'\"' - allargs="$allargs $qarg" - ;; - *) - allargs="$allargs $qarg" - - if test -s "$arg"; then - ext=`expr "$arg" : '.*\(\..*\)'` - - if test "x$ext" = "x.c"; then - do_compile="yes" - compile_args="$compile_args $arg" - fname=`basename $arg .c` - link_objs="$link_objs $fname.o" - elif test "x$ext" = "x.o"; then - if test "x$dash_c" = "xyes"; then - compile_args="$compile_args $arg" - else - do_link="yes" - link_objs="$link_objs $arg" - fi - elif test "x$ext" = "x.a"; then - # This is an archive that we're linking in - libraries=" $libraries $arg " - else - compile_args="$compile_args $arg" - link_args="$link_args $arg" - fi - else - compile_args="$compile_args $arg" - link_args="$link_args $arg" - fi - ;; - esac -done - -if test "$dash_c" = "yes" -a "$do_compile" = no -a "$do_link" = no ; then - # -c was specified. Force do_compile on. - do_compile=yes -fi - -if test "x$do_compile" = "xyes"; then - if test "x$dash_c" != "xyes"; then - compile_args="-c $compile_args" - fi - - $SHOW $CC -I$includedir $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CFLAGS $CFLAGS $compile_args - status=$? - - if test "$status" != "0"; then - exit $status - fi -fi - -if test "x$do_link" = "xyes"; then - shared_link="" -# conditionnaly link with the hl library - if test "X$HL" = "Xhl"; then - libraries=" $libraries -lhdf5_hl -lhdf5 " - else - libraries=" $libraries -lhdf5 " - fi - link_args="$link_args -L${libdir}" - - case "$kind" in - gcc|linux*) - # MacOS X doesn't support the "-Wl,-rpath -Wl," style of linker flags. - # It appears to want none of them specified. - case "$host_os" in - darwin*) flag="" ;; - *) flag="-Wl,-rpath -Wl," ;; - esac - ;; - hpux*) flag="-Wl,+b -Wl," ;; - freebsd*|solaris*) flag="-R" ;; - rs6000*|aix*) flag="-L" ;; - sgi) flag="-rpath " ;; - *) flag="" ;; - esac - - if test -n "$flag"; then - shared_link="${flag}${libdir}" - fi - - if test "x$USE_SHARED_LIB" != "xyes"; then - # The "-lhdf5" & "-lhdf5_hl" flags are in here already...This is a static - # compile though, so change it to the static version (.a) of the library. - new_libraries="" - for lib in $libraries; do - case "$lib" in - -lhdf5) - new_libraries="$new_libraries ${libdir}/libhdf5.a" - ;; - -lhdf5_hl) - new_libraries="$new_libraries ${libdir}/libhdf5_hl.a" - ;; - *) - new_libraries="$new_libraries $lib" - ;; - esac - done - libraries="$new_libraries" - fi - - for lib in $libraries; do - if echo $link_args | grep " $lib " > /dev/null || - echo $link_args | grep " $lib$" > /dev/null; then - : - else - link_args="$link_args $lib " - fi - done - - # The LIBS are just a bunch of -l* libraries necessary for the HDF5 - # module. It's okay if they're included twice in the compile line. - link_args="$link_args $H5BLD_LDFLAGS $H5BLD_LIBS" - - # User's CPPFLAGS and CFLAGS come after their H5BLD counterparts. User's - # LDFLAGS come just before clibpath, user's LIBS come after $link_objs and - # before the hdf5 libraries in $link_args, followed by any external library - # paths and libraries from AM_LDFLAGS, LDFLAGS, AM_LIBS or LIBS carried in - # from the hdf5 build. The order of the flags is intended to give precedence - # to the user's flags. - $SHOW $CLINKER $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CFLAGS $CFLAGS $LDFLAGS $clibpath $link_objs $LIBS $link_args $shared_link - status=$? -fi - -exit $status diff --git a/tools/misc/h5debug.c b/tools/misc/h5debug.c deleted file mode 100644 index ae64952..0000000 --- a/tools/misc/h5debug.c +++ /dev/null @@ -1,723 +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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/*------------------------------------------------------------------------- - * - * Created: debug.c - * Jul 18 1997 - * Robb Matzke <matzke@llnl.gov> - * - * Purpose: Debugs an existing HDF5 file at a low level. - * - *------------------------------------------------------------------------- - */ -#define H5A_FRIEND /*suppress error about including H5Apkg */ -#define H5B2_FRIEND /*suppress error about including H5B2pkg */ -#define H5B2_TESTING /*suppress warning about H5B2 testing funcs*/ -#define H5D_FRIEND /*suppress error about including H5Dpkg */ -#define H5EA_FRIEND /*suppress error about including H5EApkg */ -#define H5EA_TESTING /*suppress warning about H5EA testing funcs*/ -#define H5FA_FRIEND /*suppress error about including H5FApkg */ -#define H5FA_TESTING /*suppress warning about H5FA testing funcs*/ -#define H5F_FRIEND /*suppress error about including H5Fpkg */ -#define H5G_FRIEND /*suppress error about including H5Gpkg */ -#define H5HF_FRIEND /*suppress error about including H5HFpkg */ -#define H5O_FRIEND /*suppress error about including H5Opkg */ -#define H5SM_FRIEND /*suppress error about including H5SMpkg */ - -#include "H5private.h" /* Generic Functions */ -#include "H5Apkg.h" /* Attributes */ -#include "H5B2pkg.h" /* v2 B-trees */ -#include "H5Dpkg.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5EApkg.h" /* Extensible Arrays */ -#include "H5FApkg.h" /* Fixed Arrays */ -#include "H5Fpkg.h" /* File access */ -#include "H5FSprivate.h" /* Free space manager */ -#include "H5Gpkg.h" /* Groups */ -#include "H5HFpkg.h" /* Fractal heaps */ -#include "H5HGprivate.h" /* Global Heaps */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Opkg.h" /* Object headers */ -#include "H5SMpkg.h" /* Implicitly shared messages */ - -/* File drivers */ -#include "H5FDfamily.h" - -#define VCOL 50 - - -/*------------------------------------------------------------------------- - * Function: get_H5B2_class - * - * Purpose: Determine the v2 B-tree class from the buffer read in. - * B-trees are debugged through the B-tree subclass. The subclass - * identifier is two bytes after the B-tree signature. - * - * Return: Non-NULL on success/NULL on failure - * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Sep 11 2008 - * - *------------------------------------------------------------------------- - */ -static const H5B2_class_t * -get_H5B2_class(const uint8_t *sig) -{ - H5B2_subid_t subtype = (H5B2_subid_t)sig[H5_SIZEOF_MAGIC + 1]; - const H5B2_class_t *cls; - - switch(subtype) { - case H5B2_TEST_ID: - cls = H5B2_TEST; - break; - - case H5B2_FHEAP_HUGE_INDIR_ID: - cls = H5HF_HUGE_BT2_INDIR; - break; - - case H5B2_FHEAP_HUGE_FILT_INDIR_ID: - cls = H5HF_HUGE_BT2_FILT_INDIR; - break; - - case H5B2_FHEAP_HUGE_DIR_ID: - cls = H5HF_HUGE_BT2_DIR; - break; - - case H5B2_FHEAP_HUGE_FILT_DIR_ID: - cls = H5HF_HUGE_BT2_FILT_DIR; - break; - - case H5B2_GRP_DENSE_NAME_ID: - cls = H5G_BT2_NAME; - break; - - case H5B2_GRP_DENSE_CORDER_ID: - cls = H5G_BT2_CORDER; - break; - - case H5B2_SOHM_INDEX_ID: - cls = H5SM_INDEX; - break; - - case H5B2_ATTR_DENSE_NAME_ID: - cls = H5A_BT2_NAME; - break; - - case H5B2_ATTR_DENSE_CORDER_ID: - cls = H5A_BT2_CORDER; - break; - - case H5B2_CDSET_ID: - cls = H5D_BT2; - break; - - case H5B2_CDSET_FILT_ID: - cls = H5D_BT2_FILT; - break; - - case H5B2_TEST2_ID: - cls = H5B2_TEST2; - break; - - case H5B2_NUM_BTREE_ID: - default: - HDfprintf(stderr, "Unknown v2 B-tree subtype %u\n", (unsigned)(subtype)); - HDexit(4); - } /* end switch */ - - return(cls); -} /* end get_H5B2_class() */ - - -/*------------------------------------------------------------------------- - * Function: get_H5EA_class - * - * Purpose: Determine the extensible array class from the buffer read in. - * Extensible arrays are debugged through the array subclass. - * The subclass identifier is two bytes after the signature. - * - * Return: Non-NULL on success/NULL on failure - * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Sep 11 2008 - * - *------------------------------------------------------------------------- - */ -static const H5EA_class_t * -get_H5EA_class(const uint8_t *sig) -{ - H5EA_cls_id_t clsid = (H5EA_cls_id_t)sig[H5_SIZEOF_MAGIC + 1]; - const H5EA_class_t *cls; - - switch(clsid) { - case H5EA_CLS_TEST_ID: - cls = H5EA_CLS_TEST; - break; - - case H5EA_CLS_CHUNK_ID: - cls = H5EA_CLS_CHUNK; - break; - - case H5EA_CLS_FILT_CHUNK_ID: - cls = H5EA_CLS_FILT_CHUNK; - break; - - case H5EA_NUM_CLS_ID: - default: - HDfprintf(stderr, "Unknown extensible array class %u\n", (unsigned)(clsid)); - HDexit(4); - } /* end switch */ - - return(cls); -} /* end get_H5EA_class() */ - - -/*------------------------------------------------------------------------- - * Function: get_H5FA_class - * - * Purpose: Determine the fixed array class from the buffer read in. - * Extensible arrays are debugged through the array subclass. - * The subclass identifier is two bytes after the signature. - * - * Return: Non-NULL on success/NULL on failure - * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Sep 11 2008 - * - *------------------------------------------------------------------------- - */ -static const H5FA_class_t * -get_H5FA_class(const uint8_t *sig) -{ - H5FA_cls_id_t clsid = (H5FA_cls_id_t)sig[H5_SIZEOF_MAGIC + 1]; - const H5FA_class_t *cls; - - switch(clsid) { - case H5FA_CLS_TEST_ID: - cls = H5FA_CLS_TEST; - break; - - case H5FA_CLS_CHUNK_ID: - cls = H5FA_CLS_CHUNK; - break; - - case H5FA_CLS_FILT_CHUNK_ID: - cls = H5FA_CLS_FILT_CHUNK; - break; - - case H5FA_NUM_CLS_ID: - default: - HDfprintf(stderr, "Unknown fixed array class %u\n", (unsigned)(clsid)); - HDexit(4); - } /* end switch */ - - return(cls); -} /* end get_H5FA_class() */ - - -/*------------------------------------------------------------------------- - * Function: main - * - * Usage: debug FILENAME [OFFSET] - * - * Return: Success: exit (0) - * - * Failure: exit (non-zero) - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jul 18 1997 - * - *------------------------------------------------------------------------- - */ -int -main(int argc, char *argv[]) -{ - hid_t fid, fapl, dxpl; - H5F_t *f; - haddr_t addr = 0, extra = 0, extra2 = 0, extra3 = 0, extra4 = 0; - uint8_t sig[H5F_SIGNATURE_LEN]; - size_t u; - H5E_auto2_t func; - void *edata; - herr_t status = SUCCEED; - - if(argc == 1) { - HDfprintf(stderr, "Usage: %s filename [signature-addr [extra]]\n", argv[0]); - HDexit(1); - } /* end if */ - - /* Initialize the library */ - if(H5open() < 0) { - HDfprintf(stderr, "cannot initialize the library\n"); - HDexit(1); - } /* end if */ - - /* Disable error reporting */ - H5Eget_auto2(H5E_DEFAULT, &func, &edata); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - - /* - * Open the file and get the file descriptor. - */ - dxpl = H5AC_ind_read_dxpl_id; - if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { - HDfprintf(stderr, "cannot create file access property list\n"); - HDexit(1); - } /* end if */ - if(HDstrchr(argv[1], '%')) - if(H5Pset_fapl_family (fapl, (hsize_t)0, H5P_DEFAULT) < 0) { - fprintf(stderr, "cannot set file access property list\n"); - HDexit(1); - } - if((fid = H5Fopen(argv[1], H5F_ACC_RDONLY, fapl)) < 0) { - HDfprintf(stderr, "cannot open file\n"); - HDexit(1); - } /* end if */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) { - HDfprintf(stderr, "cannot obtain H5F_t pointer\n"); - HDexit(2); - } /* end if */ - - /* Ignore metadata tags while using h5debug */ - if(H5AC_ignore_tags(f) < 0) { - HDfprintf(stderr, "cannot ignore metadata tags\n"); - HDexit(1); - } - - /* - * Parse command arguments. - */ - if(argc > 2) - addr = (haddr_t)HDstrtoll(argv[2], NULL, 0); - if(argc > 3) - extra = (haddr_t)HDstrtoll(argv[3], NULL, 0); - if(argc > 4) - extra2 = (haddr_t)HDstrtoll(argv[4], NULL, 0); - if(argc > 5) - extra3 = (haddr_t)HDstrtoll(argv[5], NULL, 0); - if(argc > 6) - extra4 = (haddr_t)HDstrtoll(argv[6], NULL, 0); - - /* - * Read the signature at the specified file position. - */ - HDfprintf(stdout, "Reading signature at address %a (rel)\n", addr); - if(H5F_block_read(f, H5FD_MEM_SUPER, addr, sizeof(sig), dxpl, sig) < 0) { - HDfprintf(stderr, "cannot read signature\n"); - HDexit(3); - } - if(!HDmemcmp(sig, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN)) { - /* - * Debug the file's super block. - */ - status = H5F_debug(f, stdout, 0, VCOL); - - } else if(!HDmemcmp(sig, H5HL_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { - /* - * Debug a local heap. - */ - status = H5HL_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL); - - } else if(!HDmemcmp (sig, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { - /* - * Debug a global heap collection. - */ - status = H5HG_debug (f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL); - - } else if(!HDmemcmp(sig, H5G_NODE_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { - /* - * Debug a symbol table node. - */ - - /* Check for extra parameters */ - if(extra == 0) { - HDfprintf(stderr, "\nWarning: Providing the group's local heap address will give more information\n"); - HDfprintf(stderr, "Symbol table node usage:\n"); - HDfprintf(stderr, "\th5debug <filename> <Symbol table node address> <address of local heap>\n\n"); - } /* end if */ - - status = H5G_node_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, extra); - - } else if(!HDmemcmp(sig, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { - /* - * Debug a B-tree. B-trees are debugged through the B-tree - * subclass. The subclass identifier is the byte immediately - * after the B-tree signature. - */ - H5B_subid_t subtype = (H5B_subid_t)sig[H5_SIZEOF_MAGIC]; - unsigned ndims; - uint32_t dim[H5O_LAYOUT_NDIMS]; - - switch(subtype) { - case H5B_SNODE_ID: - /* Check for extra parameters */ - if(extra == 0) { - HDfprintf(stderr, "\nWarning: Providing the group's local heap address will give more information\n"); - HDfprintf(stderr, "B-tree symbol table node usage:\n"); - HDfprintf(stderr, "\th5debug <filename> <B-tree node address> <address of local heap>\n\n"); - HDexit(4); - } /* end if */ - - status = H5G_node_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, extra); - break; - - case H5B_CHUNK_ID: - /* Check for extra parameters */ - if(extra == 0) { - HDfprintf(stderr, "ERROR: Need number of dimensions of chunk in order to dump chunk B-tree node\n"); - HDfprintf(stderr, "B-tree chunked storage node usage:\n"); - HDfprintf(stderr, "\th5debug <filename> <B-tree node address> <# of dimensions> <slowest chunk dim>...<fastest chunk dim>\n"); - HDexit(4); - } /* end if */ - - /* Build array of chunk dimensions */ - ndims = (unsigned)extra; - dim[0] = (uint32_t)extra2; - if(ndims > 1) - dim[1] = (uint32_t)extra3; - if(ndims > 2) - dim[2] = (uint32_t)extra4; - - /* Check for dimension error */ - if(ndims > 3) { - HDfprintf(stderr, "ERROR: Only 3 dimensions support currently (fix h5debug)\n"); - HDfprintf(stderr, "B-tree chunked storage node usage:\n"); - HDfprintf(stderr, "\th5debug <filename> <B-tree node address> <# of dimensions> <slowest chunk dim>...<fastest chunk dim>\n"); - HDexit(4); - } /* end for */ - for(u = 0; u < ndims; u++) - if(0 == dim[u]) { - HDfprintf(stderr, "ERROR: Chunk dimensions should be >0\n"); - HDfprintf(stderr, "B-tree chunked storage node usage:\n"); - HDfprintf(stderr, "\th5debug <filename> <B-tree node address> <# of dimensions> <slowest chunk dim>...<fastest chunk dim>\n"); - HDexit(4); - } /* end if */ - - /* Set the last dimension (the element size) to zero */ - dim[ndims] = 0; - - status = H5D_btree_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, ndims, dim); - break; - - case H5B_NUM_BTREE_ID: - default: - HDfprintf(stderr, "Unknown v1 B-tree subtype %u\n", (unsigned)(subtype)); - HDexit(4); - } - - } else if(!HDmemcmp(sig, H5B2_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { - /* - * Debug a v2 B-tree header. - */ - const H5B2_class_t *cls = get_H5B2_class(sig); - HDassert(cls); - - if((cls == H5D_BT2 || cls == H5D_BT2_FILT) && extra == 0) { - HDfprintf(stderr, "ERROR: Need v2 B-tree header address and object header address containing the layout message in order to dump header\n"); - HDfprintf(stderr, "v2 B-tree hdr usage:\n"); - HDfprintf(stderr, "\th5debug <filename> <v2 B-tree header address> <object header address>\n"); - HDexit(4); - } /* end if */ - - status = H5B2__hdr_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, cls, (haddr_t)extra); - - } else if(!HDmemcmp(sig, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { - /* - * Debug a v2 B-tree internal node. - */ - const H5B2_class_t *cls = get_H5B2_class(sig); - HDassert(cls); - - /* Check for enough valid parameters */ - if((cls == H5D_BT2 || cls == H5D_BT2_FILT) && - (extra == 0 || extra2 == 0 || extra3 == 0 || extra4 == 0)) { - - fprintf(stderr, "ERROR: Need v2 B-tree header address, the node's number of records, depth, and object header address containing the layout message in order to dump internal node\n"); - fprintf(stderr, "NOTE: Leaf nodes are depth 0, the internal nodes above them are depth 1, etc.\n"); - fprintf(stderr, "v2 B-tree internal node usage:\n"); - fprintf(stderr, "\th5debug <filename> <internal node address> <v2 B-tree header address> <number of records> <depth> <object header address>\n"); - HDexit(4); - - } else if(extra == 0 || extra2 == 0 || extra3 == 0) { - HDfprintf(stderr, "ERROR: Need v2 B-tree header address and the node's number of records and depth in order to dump internal node\n"); - HDfprintf(stderr, "NOTE: Leaf nodes are depth 0, the internal nodes above them are depth 1, etc.\n"); - HDfprintf(stderr, "v2 B-tree internal node usage:\n"); - HDfprintf(stderr, "\th5debug <filename> <internal node address> <v2 B-tree header address> <number of records> <depth>\n"); - HDexit(4); - } /* end if */ - - status = H5B2__int_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, cls, extra, (unsigned)extra2, (unsigned)extra3, (haddr_t)extra4); - - } else if(!HDmemcmp(sig, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { - /* - * Debug a v2 B-tree leaf node. - */ - const H5B2_class_t *cls = get_H5B2_class(sig); - HDassert(cls); - - /* Check for enough valid parameters */ - if((cls == H5D_BT2 || cls == H5D_BT2_FILT) && - (extra == 0 || extra2 == 0 || extra3 == 0 )) { - - fprintf(stderr, "ERROR: Need v2 B-tree header address, number of records, and object header address containing the layout message in order to dump leaf node\n"); - fprintf(stderr, "v2 B-tree leaf node usage:\n"); - fprintf(stderr, "\th5debug <filename> <leaf node address> <v2 B-tree header address> <number of records> <object header address>\n"); - HDexit(4); - - } else if(extra == 0 || extra2 == 0) { - HDfprintf(stderr, "ERROR: Need v2 B-tree header address and number of records in order to dump leaf node\n"); - HDfprintf(stderr, "v2 B-tree leaf node usage:\n"); - HDfprintf(stderr, "\th5debug <filename> <leaf node address> <v2 B-tree header address> <number of records>\n"); - HDexit(4); - } /* end if */ - - status = H5B2__leaf_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, cls, extra, (unsigned)extra2, (haddr_t)extra3); - - } else if(!HDmemcmp(sig, H5HF_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { - /* - * Debug a fractal heap header. - */ - status = H5HF_hdr_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL); - - } else if(!HDmemcmp(sig, H5HF_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { - /* - * Debug a fractal heap direct block. - */ - - /* Check for enough valid parameters */ - if(extra == 0 || extra2 == 0) { - HDfprintf(stderr, "ERROR: Need fractal heap header address and size of direct block in order to dump direct block\n"); - HDfprintf(stderr, "Fractal heap direct block usage:\n"); - HDfprintf(stderr, "\th5debug <filename> <direct block address> <heap header address> <size of direct block>\n"); - HDexit(4); - } /* end if */ - - status = H5HF_dblock_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, extra, (size_t)extra2); - - } else if(!HDmemcmp(sig, H5HF_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { - /* - * Debug a fractal heap indirect block. - */ - - /* Check for enough valid parameters */ - if(extra == 0 || extra2 == 0) { - HDfprintf(stderr, "ERROR: Need fractal heap header address and number of rows in order to dump indirect block\n"); - HDfprintf(stderr, "Fractal heap indirect block usage:\n"); - HDfprintf(stderr, "\th5debug <filename> <indirect block address> <heap header address> <number of rows>\n"); - HDexit(4); - } /* end if */ - - status = H5HF_iblock_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, extra, (unsigned)extra2); - - } else if(!HDmemcmp(sig, H5FS_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { - /* - * Debug a free space header. - */ - - status = H5FS_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL); - - } else if(!HDmemcmp(sig, H5FS_SINFO_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { - /* - * Debug free space serialized sections. - */ - - /* Check for enough valid parameters */ - if(extra == 0 || extra2 == 0) { - HDfprintf(stderr, "ERROR: Need free space header address and client address in order to dump serialized sections\n"); - HDfprintf(stderr, "Free space serialized sections usage:\n"); - HDfprintf(stderr, "\th5debug <filename> <serialized sections address> <free space header address> <client address>\n"); - HDexit(4); - } /* end if */ - - status = H5FS_sects_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, extra, extra2); - - } else if(!HDmemcmp(sig, H5SM_TABLE_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { - /* - * Debug shared message master table. - */ - - status = H5SM_table_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, (unsigned) UFAIL, (unsigned) UFAIL); - - } else if(!HDmemcmp(sig, H5SM_LIST_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { - /* - * Debug shared message list index. - */ - - /* Check for enough valid parameters */ - if(extra == 0) { - HDfprintf(stderr, "ERROR: Need shared message header address in order to shared message list\n"); - HDfprintf(stderr, "Shared message list usage:\n"); - HDfprintf(stderr, "\th5debug <filename> <shared message list address> <shared message header address>\n"); - HDexit(4); - } /* end if */ - - status = H5SM_list_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, (haddr_t)extra); - - } else if(!HDmemcmp(sig, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { - /* - * Debug an extensible aray header. - */ - const H5EA_class_t *cls = get_H5EA_class(sig); - HDassert(cls); - - /* Check for enough valid parameters */ - if(extra == 0) { - HDfprintf(stderr, "ERROR: Need object header address containing the layout message in order to dump header\n"); - HDfprintf(stderr, "Extensible array header block usage:\n"); - HDfprintf(stderr, "\th5debug <filename> <Extensible Array header address> <object header address>\n"); - HDexit(4); - } /* end if */ - - status = H5EA__hdr_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, cls, extra); - - } else if(!HDmemcmp(sig, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { - /* - * Debug an extensible aray index block. - */ - const H5EA_class_t *cls = get_H5EA_class(sig); - HDassert(cls); - - /* Check for enough valid parameters */ - if(extra == 0 || extra2 == 0) { - HDfprintf(stderr, "ERROR: Need extensible array header address and object header address containing the layout message in order to dump index block\n"); - HDfprintf(stderr, "Extensible array index block usage:\n"); - HDfprintf(stderr, "\th5debug <filename> <index block address> <array header address> <object header address\n"); - HDexit(4); - } /* end if */ - - status = H5EA__iblock_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, cls, extra, extra2); - - } else if(!HDmemcmp(sig, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { - /* - * Debug an extensible aray super block. - */ - const H5EA_class_t *cls = get_H5EA_class(sig); - HDassert(cls); - - /* Check for enough valid parameters */ - if(extra == 0 || extra2 == 0 || extra3 == 0) { - HDfprintf(stderr, "ERROR: Need extensible array header address, super block index and object header address containing the layout message in order to dump super block\n"); - HDfprintf(stderr, "Extensible array super block usage:\n"); - HDfprintf(stderr, "\th5debug <filename> <super block address> <array header address> <super block index> <object header address>\n"); - HDexit(4); - } /* end if */ - - status = H5EA__sblock_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, cls, extra, (unsigned)extra2, extra3); - - } else if(!HDmemcmp(sig, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { - /* - * Debug an extensible aray data block. - */ - const H5EA_class_t *cls = get_H5EA_class(sig); - HDassert(cls); - - /* Check for enough valid parameters */ - if(extra == 0 || extra2 == 0 || extra3 == 0) { - HDfprintf(stderr, "ERROR: Need extensible array header address, # of elements in data block and object header address containing the layout message in order to dump data block\n"); - HDfprintf(stderr, "Extensible array data block usage:\n"); - HDfprintf(stderr, "\th5debug <filename> <data block address> <array header address> <# of elements in data block> <object header address\n"); - HDexit(4); - } /* end if */ - - status = H5EA__dblock_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, cls, extra, (size_t)extra2, extra3); - - } else if(!HDmemcmp(sig, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { - /* - * Debug a fixed array header. - */ - const H5FA_class_t *cls = get_H5FA_class(sig); - HDassert(cls); - - /* Check for enough valid parameters */ - if(extra == 0) { - HDfprintf(stderr, "ERROR: Need object header address containing the layout message in order to dump header\n"); - HDfprintf(stderr, "Fixed array header block usage:\n"); - HDfprintf(stderr, "\th5debug <filename> <Fixed Array header address> <object header address>\n"); - HDexit(4); - } /* end if */ - - status = H5FA__hdr_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, cls, extra); - - } else if(!HDmemcmp(sig, H5FA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { - /* - * Debug a fixed array data block. - */ - const H5FA_class_t *cls = get_H5FA_class(sig); - HDassert(cls); - - /* Check for enough valid parameters */ - if(extra == 0 || extra2 == 0) { - HDfprintf(stderr, "ERROR: Need fixed array header address and object header address containing the layout message in order to dump data block\n"); - HDfprintf(stderr, "fixed array data block usage:\n"); - HDfprintf(stderr, "\th5debug <filename> <data block address> <array header address> <object header address>\n"); - HDexit(4); - } /* end if */ - - status = H5FA__dblock_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, cls, extra, extra2); - - } else if(!HDmemcmp(sig, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { - /* - * Debug v2 object header (which have signatures). - */ - - status = H5O_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL); - - } else if(sig[0] == H5O_VERSION_1) { - /* - * This could be a v1 object header. Since they don't have a signature - * it's a somewhat "ify" detection. - */ - status = H5O_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL); - - } else { - /* - * Got some other unrecognized signature. - */ - printf("%-*s ", VCOL, "Signature:"); - for (u = 0; u < sizeof(sig); u++) { - if (sig[u] > ' ' && sig[u] <= '~' && '\\' != sig[u]) - HDputchar(sig[u]); - else if ('\\' == sig[u]) { - HDputchar('\\'); - HDputchar('\\'); - } else - printf("\\%03o", sig[u]); - } - HDputchar('\n'); - - HDfprintf(stderr, "unknown signature\n"); - HDexit(4); - } /* end else */ - - /* Check for an error when dumping information */ - if(status < 0) { - HDfprintf(stderr, "An error occurred!\n"); - H5Eprint2(H5E_DEFAULT, stderr); - HDexit(5); - } /* end if */ - - H5Pclose(fapl); - H5Fclose(fid); - - H5Eset_auto2(H5E_DEFAULT, func, edata); - - return 0; -} /* main() */ - diff --git a/tools/misc/h5mkgrp.c b/tools/misc/h5mkgrp.c deleted file mode 100644 index ad2d306..0000000 --- a/tools/misc/h5mkgrp.c +++ /dev/null @@ -1,336 +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 "H5private.h" -#include "h5tools.h" -#include "h5tools_utils.h" -#include <string.h> -#include <stdlib.h> - -/* Name of tool */ -#define PROGRAMNAME "h5mkgrp" - -/* Exit status for tools library routines */ -int d_status = EXIT_SUCCESS; - -/* command-line options: short and long-named parameters */ -static const char *s_opts = "hlpvV"; -static struct long_options l_opts[] = { - { "help", no_arg, 'h' }, - { "latest", no_arg, 'l' }, - { "parents", no_arg, 'p' }, - { "verbose", no_arg, 'v' }, - { "version", no_arg, 'V' }, - { NULL, 0, '\0' } -}; - -/* Command line parameter settings */ -typedef struct { - char *fname; /* File name to operate on */ - hbool_t latest; /* Whether file should use latest format versions */ - hbool_t verbose; /* Whether output should be verbose */ - hbool_t parents; /* Whether to create intermediate groups */ - size_t ngroups; /* Number of groups to create */ - char **groups; /* Pointer to array of group names */ -} param_t; -param_t params; /* Command line parameter settings */ - - -/*------------------------------------------------------------------------- - * Function: leave - * - * Purpose: Shutdown MPI and/or HDF5 and call exit() - * - * Return: Does not return - * - * Programmer: Quincey Koziol, 2/13/2007 - * - *------------------------------------------------------------------------- - */ -static void -leave(int ret) -{ - size_t curr_group; - - if (params.fname) - HDfree (params.fname); - if (params.ngroups) { - for(curr_group = 0; curr_group < params.ngroups; curr_group++) - HDfree (params.groups[curr_group]); - HDfree (params.groups); - } - h5tools_close(); - HDexit(ret); -} /* end leave() */ - - -/*------------------------------------------------------------------------- - * Function: usage - * - * Purpose: Prints a usage message on stderr and then returns. - * - * Return: void - * - * Programmer: Quincey Koziol, 2/13/2007 - * - *------------------------------------------------------------------------- - */ -static void -usage(void) -{ - HDfprintf(stdout, "\ -usage: h5mkgrp [OPTIONS] FILE GROUP...\n\ - OPTIONS\n\ - -h, --help Print a usage message and exit\n\ - -l, --latest Use latest version of file format to create groups\n\ - -p, --parents No error if existing, make parent groups as needed\n\ - -v, --verbose Print information about OBJECTS and OPTIONS\n\ - -V, --version Print version number and exit\n"); -} /* end usage() */ - - -/*------------------------------------------------------------------------- - * Function: parse_command_line - * - * Purpose: Parses command line and sets up global variable to control output - * - * Return: Success: 0 - * Failure: -1 - * - * Programmer: Quincey Koziol, 2/13/2007 - * - *------------------------------------------------------------------------- - */ -static int -parse_command_line(int argc, const char *argv[], param_t *parms) -{ - int opt; /* Option from command line */ - size_t curr_group; /* Current group name to copy */ - - /* Check for empty command line */ - if(argc == 1) { - usage(); - leave(EXIT_SUCCESS); - } /* end if */ - - /* Parse command line options */ - while((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { - switch((char)opt) { - /* Display 'help' */ - case 'h': - usage(); - leave(EXIT_SUCCESS); - - /* Create objects with the latest version of the format */ - case 'l': - parms->latest = TRUE; - break; - - /* Create parent groups */ - case 'p': - parms->parents = TRUE; - break; - - /* Verbose output */ - case 'v': - parms->verbose = TRUE; - break; - - /* Display version */ - case 'V': - print_version(h5tools_getprogname()); - leave(EXIT_SUCCESS); - - /* Bad command line argument */ - default: - usage(); - leave(EXIT_FAILURE); - } /* end switch */ - } /* end while */ - - /* Check for file name to be processed */ - if(argc <= opt_ind) { - error_msg("missing file name\n"); - usage(); - leave(EXIT_FAILURE); - } /* end if */ - - /* Retrieve file name */ - parms->fname = HDstrdup(argv[opt_ind]); - opt_ind++; - - /* Check for group(s) to be created */ - if(argc <= opt_ind) { - error_msg("missing group name(s)\n"); - usage(); - leave(EXIT_FAILURE); - } /* end if */ - - /* Allocate space for the group name pointers */ - parms->ngroups = (size_t)(argc - opt_ind); - parms->groups = (char **)HDmalloc(parms->ngroups * sizeof(char *)); - - /* Retrieve the group names */ - curr_group = 0; - while(opt_ind < argc) { - parms->groups[curr_group] = HDstrdup(argv[opt_ind]); - curr_group++; - opt_ind++; - } /* end while */ - -#ifdef QAK -HDfprintf(stderr, "parms->parents = %t\n", parms->parents); -HDfprintf(stderr, "parms->verbose = %t\n", parms->verbose); -HDfprintf(stderr, "parms->fname = '%s'\n", parms->fname); -HDfprintf(stderr, "parms->ngroups = %Zu\n", parms->ngroups); -for(curr_group = 0; curr_group < parms->ngroups; curr_group++) - HDfprintf(stderr, "parms->group[%Zu] = '%s'\n", curr_group, parms->groups[curr_group]); -#endif /* QAK */ - - return(0); -} /* parse_command_line() */ - - -/*------------------------------------------------------------------------- - * Function: main - * - * Purpose: Create group(s) in an HDF5 file - * - * Programmer: Quincey Koziol, 2/13/2007 - * - *------------------------------------------------------------------------- - */ -int -main(int argc, const char *argv[]) -{ - hid_t fid; /* HDF5 file ID */ - hid_t fapl_id; /* File access property list ID */ - hid_t lcpl_id; /* Link creation property list ID */ - size_t curr_group; /* Current group to create */ - - h5tools_setprogname(PROGRAMNAME); - h5tools_setstatus(EXIT_SUCCESS); - - /* Disable the HDF5 library's error reporting */ - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - - /* Initialize h5tools lib */ - h5tools_init(); - - /* Parse command line */ - HDmemset(¶ms, 0, sizeof(params)); - if(parse_command_line(argc, argv, ¶ms) < 0) { - error_msg("unable to parse command line arguments\n"); - leave(EXIT_FAILURE); - } /* end if */ - - /* Create file access property list */ - if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) { - error_msg("Could not create file access property list\n"); - leave(EXIT_FAILURE); - } /* end if */ - - /* Check for creating groups with new format version */ - if(params.latest) { - /* Set the "use the latest version of the format" bounds */ - if(H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) { - error_msg("Could not set property for using latest version of the format\n"); - leave(EXIT_FAILURE); - } /* end if */ - - /* Display some output if requested */ - if(params.verbose) - printf("%s: Creating groups with latest version of the format\n", h5tools_getprogname()); - } /* end if */ - - /* Attempt to open an existing HDF5 file first */ - fid = h5tools_fopen(params.fname, H5F_ACC_RDWR, fapl_id, NULL, NULL, 0); - - /* If we couldn't open an existing file, try creating file */ - /* (use "EXCL" instead of "TRUNC", so we don't blow away existing non-HDF5 file) */ - if(fid < 0) - fid = H5Fcreate(params.fname, H5F_ACC_EXCL, H5P_DEFAULT, fapl_id); - - /* Test for error in opening file */ - if(fid < 0) { - error_msg("Could not open output file '%s'\n", params.fname); - leave(EXIT_FAILURE); - } /* end if */ - - /* Create link creation property list */ - if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) { - error_msg("Could not create link creation property list\n"); - leave(EXIT_FAILURE); - } /* end if */ - - /* Check for creating intermediate groups */ - if(params.parents) { - /* Set the intermediate group creation property */ - if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) { - error_msg("Could not set property for creating parent groups\n"); - leave(EXIT_FAILURE); - } /* end if */ - - /* Display some output if requested */ - if(params.verbose) - printf("%s: Creating parent groups\n", h5tools_getprogname()); - } /* end if */ - - /* Loop over creating requested groups */ - for(curr_group = 0; curr_group < params.ngroups; curr_group++) { - hid_t gid; /* Group ID */ - - /* Attempt to create a group */ - if((gid = H5Gcreate2(fid, params.groups[curr_group], lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) { - error_msg("Could not create group '%s'\n", params.groups[curr_group]); - leave(EXIT_FAILURE); - } /* end if */ - - /* Close the group */ - if(H5Gclose(gid) < 0) { - error_msg("Could not close group '%s'??\n", params.groups[curr_group]); - leave(EXIT_FAILURE); - } /* end if */ - - /* Display some output if requested */ - if(params.verbose) - printf("%s: created group '%s'\n", h5tools_getprogname(), params.groups[curr_group]); - } /* end for */ - - /* Close link creation property list */ - if(H5Pclose(lcpl_id) < 0) { - error_msg("Could not close link creation property list\n"); - leave(EXIT_FAILURE); - } /* end if */ - - /* Close file */ - if(H5Fclose(fid) < 0) { - error_msg("Could not close output file '%s'??\n", params.fname); - leave(EXIT_FAILURE); - } /* end if */ - - /* Close file access property list */ - if(H5Pclose(fapl_id) < 0) { - error_msg("Could not close file access property list\n"); - leave(EXIT_FAILURE); - } /* end if */ - - /* Shut down h5tools lib */ - h5tools_close(); - - leave(EXIT_SUCCESS); -} /* end main() */ - diff --git a/tools/misc/h5perf_gentest.c b/tools/misc/h5perf_gentest.c deleted file mode 100644 index 50c18c1..0000000 --- a/tools/misc/h5perf_gentest.c +++ /dev/null @@ -1,598 +0,0 @@ -/***************************************************************************** - This test generates attributes, groups, and datasets of many types. It - creates a large number of attributes, groups, and datasets by specifying - -a, -g, -d options respectively. Using "-h" option to see details. - - Programmer: Peter Cao <xcao@hdfgroup.org>, Jan. 2013 - ****************************************************************************/ - -#include "hdf5.h" -#include <stdio.h> -#include <stdlib.h> - -#define FNAME "test_perf.h5" -#define NGROUPS 20 -#define NDSETS 20 -#define NATTRS 20 -#define DIM0 40 -#define NROWS 100 -#define NTYPES 9 -#define MAXVLEN 10 -#define FIXED_LEN 8 - -typedef enum { SOLID=0, LIQUID, GAS, PLASMA } phase_t; - -typedef struct { - int i; - unsigned long long l; - float f; - double d; - char s[FIXED_LEN]; - phase_t e; - float f_array[FIXED_LEN]; - hvl_t i_vlen; - char *s_vlen; -} test_comp_t; - -typedef struct { - int zipcode; - char *city; -} zipcode_t; - -int add_attrs(hid_t oid, int idx); -int add_attr(hid_t oid, const char *name, hid_t tid, hid_t sid, void *buf) ; -herr_t create_perf_test_file(const char *fname, int ngrps, int ndsets, - int nattrs, hsize_t nrows, hsize_t dim0, hsize_t chunk, int vlen, - int compressed, int latest); - -int main (int argc, char *argv[]) -{ - char fname[32]; - int i, ngrps=NGROUPS, ndsets=NDSETS, nattrs=NATTRS, dim0=DIM0, - chunk=DIM0/10+1, nrows=NROWS, vlen=MAXVLEN, l=0, z=0; - - memset(fname, 0, 32); - for (i=1; i<argc; i++) { - if (strcmp(argv[i], "-f")==0) - strcpy(fname, argv[i+1]); - else if (strcmp(argv[i], "-g")==0) - ngrps = atoi(argv[i+1]); - else if (strcmp(argv[i], "-d")==0) - ndsets = atoi(argv[i+1]); - else if (strcmp(argv[i], "-a")==0) - nattrs = atoi(argv[i+1]); - else if (strcmp(argv[i], "-r")==0) - nrows = atoi(argv[i+1]); - else if (strcmp(argv[i], "-s")==0) - dim0 = atoi(argv[i+1]); - else if (strcmp(argv[i], "-c")==0) - chunk = atoi(argv[i+1]); - else if (strcmp(argv[i], "-v")==0) - vlen = atoi(argv[i+1]); - else if (strcmp(argv[i], "-l")==0) - l = 1; - else if (strcmp(argv[i], "-z")==0) - z = 1; - else if (strcmp(argv[i], "-h")==0) { - printf("\nOPTONS:\n"); - printf("\t-f F:\tname of the test file (default: %s).\n", FNAME); - printf("\t-g N:\tnumber of top level groups (default: %d).\n", NGROUPS); - printf("\t-d N:\tnumber of datasets (default: %d).\n", NDSETS); - printf("\t-a N:\tnumber of attributes (default: %d).\n", NATTRS); - printf("\t-r N:\tnumber of rows in the large compound dataset (default: %d).\n", NROWS); - printf("\t-s N:\tsize of dim0 in datasets (default: %d).\n", DIM0); - printf("\t-c N:\tchunk size of dim0 (default: %d).\n", (DIM0/10+1)); - printf("\t-v N:\tmax vlen size (default: %d).\n", MAXVLEN); - printf("\t-l:\tuse latest format (default: no).\n"); - printf("\t-z:\tuse gzip compression (default: no).\n"); - printf("\t-h:\tthis help information.\n"); - printf("Example:\n"); - printf("\t./a.out -f test.h5 -g 10000 -d 5000 -a 500 -r 10000 -s 200 -c 20 -v 40 -l -z\n\n"); - exit(0); - } - } - - if (strlen(fname)<=0) - sprintf(fname, FNAME); - - create_perf_test_file(fname, ngrps, ndsets, nattrs, (hsize_t)nrows, - (hsize_t)dim0, (hsize_t)chunk, vlen, z, l); - - return 0; -} - -/***************************************************************************** - This function generates attributes, groups, and datasets of many types. - - Parameters: - fname: file_name. - ngrps: number of top level groups. - ndsets: number of datasets. - attrs: number of attributes. - nrow: number of rows in a dataset. - chunk: chunk size (single number). - vlen: max vlen size. - comp: use latest format. - latest: use gzip comnpression. - - Return: Non-negative on success/Negative on failure - - Programmer: Peter Cao <xcao@hdfgroup.org>, Jan. 2013 - ****************************************************************************/ -herr_t create_perf_test_file(const char *fname, int ngrps, int ndsets, - int nattrs, hsize_t nrows, hsize_t dim0, hsize_t chunk, int vlen, - int compressed, int latest) -{ - int i, j, k; - hid_t fid, sid_null, sid_scalar, sid_1d, sid_2d, did, aid, sid_2, sid_large, - fapl=H5P_DEFAULT, dcpl=H5P_DEFAULT, gid1, gid2, cmp_tid, tid_str, - tid_enum, tid_array_f, tid_vlen_i, tid_vlen_s; - char name[32], tmp_name1[32], tmp_name2[32], tmp_name3[32]; - hsize_t dims[1]={dim0}, dims2d[2]={dim0, (dim0/4+1)}, dims_array[1]={FIXED_LEN}, - dim1[1]={2}; - char *enum_names[4] = {"SOLID", "LIQUID", "GAS", "PLASMA"}; - test_comp_t *buf_comp=NULL, *buf_comp_large=NULL; - int *buf_int=NULL; - float (*buf_float_a)[FIXED_LEN]=NULL; - double **buf_double2d=NULL; - hvl_t *buf_vlen_i=NULL; - char (*buf_str)[FIXED_LEN]; - char **buf_vlen_s=NULL; - hobj_ref_t buf_ref[2]; - hdset_reg_ref_t buf_reg_ref[2]; - size_t offset, len; - herr_t status; - char *names[NTYPES] = { "int", "ulong", "float", "double", "fixed string", - "enum", "fixed float array", "vlen int array", "vlen strings"}; - hid_t types[NTYPES] = { H5T_NATIVE_INT, H5T_NATIVE_UINT64, H5T_NATIVE_FLOAT, - H5T_NATIVE_DOUBLE, tid_str, tid_enum, tid_array_f, tid_vlen_i, tid_vlen_s}; - hsize_t coords[4][2] = { {0, 1}, {3, 5}, {1, 0}, {2, 4}}, start=0, stride=1, count=1; - - if (nrows < NROWS) nrows = NROWS; - if (ngrps<NGROUPS) ngrps=NGROUPS; - if (ndsets<NDSETS) ndsets=NDSETS; - if (nattrs<NATTRS) nattrs=NATTRS; - if (dim0<DIM0) dim0=DIM0; - if (chunk>dim0) chunk=dim0/4; - if (chunk<1) chunk = 1; - if (vlen<1) vlen = MAXVLEN; - - /* create fixed string datatype */ - types[4] = tid_str = H5Tcopy (H5T_C_S1); - H5Tset_size (tid_str, FIXED_LEN); - - /* create enum datatype */ - types[5] = tid_enum = H5Tenum_create(H5T_NATIVE_INT); - for (i = (int) SOLID; i <= (int) PLASMA; i++) { - phase_t val = (phase_t) i; - status = H5Tenum_insert (tid_enum, enum_names[i], &val); - } - - /* create float array datatype */ - types[6] = tid_array_f = H5Tarray_create (H5T_NATIVE_FLOAT, 1, dims_array); - - /* create variable length integer datatypes */ - types[7] = tid_vlen_i = H5Tvlen_create (H5T_NATIVE_INT); - - /* create variable length string datatype */ - types[8] = tid_vlen_s = H5Tcopy (H5T_C_S1); - H5Tset_size (tid_vlen_s, H5T_VARIABLE); - - /* create compound datatypes */ - cmp_tid = H5Tcreate (H5T_COMPOUND, sizeof (test_comp_t)); - offset = 0; - for (i=0; i<NTYPES-2; i++) { - H5Tinsert(cmp_tid, names[i], offset, types[i]); - offset += H5Tget_size(types[i]); - } - - H5Tinsert(cmp_tid, names[7], offset, types[7]); - offset += sizeof (hvl_t); - H5Tinsert(cmp_tid, names[8], offset, types[8]); - - /* create dataspace */ - sid_1d = H5Screate_simple (1, dims, NULL); - sid_2d = H5Screate_simple (2, dims2d, NULL); - sid_2 = H5Screate_simple (1, dim1, NULL); - sid_large = H5Screate_simple (1, &nrows, NULL); - sid_null = H5Screate (H5S_NULL); - sid_scalar = H5Screate (H5S_SCALAR); - - /* create fid access property */ - fapl = H5Pcreate (H5P_FILE_ACCESS); - H5Pset_libver_bounds (fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); - - /* create dataset creation property */ - dcpl = H5Pcreate (H5P_DATASET_CREATE); - - /* set dataset chunk */ - if (chunk>0) { - H5Pset_chunk (dcpl, 1, &chunk); - } - - /* set dataset compression */ - if (compressed) { - if (chunk<=0) { - chunk = dim0/10+1;; - H5Pset_chunk (dcpl, 1, &chunk); - } - H5Pset_shuffle (dcpl); - H5Pset_deflate (dcpl, 6); - } - - /* allocate buffers */ - buf_comp = (test_comp_t *)calloc(dim0, sizeof(test_comp_t)); - buf_comp_large = (test_comp_t *)calloc(nrows, sizeof(test_comp_t)); - buf_int = (int *)calloc(dim0, sizeof(int)); - buf_float_a = malloc(dim0*sizeof(*buf_float_a)); - buf_vlen_i = (hvl_t *)calloc(dim0, sizeof (hvl_t)); - buf_vlen_s = (char **)calloc(dim0, sizeof(char *)); - buf_str = malloc(dim0*sizeof (*buf_str)); - - /* allocate array of doulbe pointers */ - buf_double2d = (double **)calloc(dims2d[0],sizeof(double *)); - /* allocate a contigous chunk of memory for the data */ - buf_double2d[0] = (double *)calloc( dims2d[0]*dims2d[1],sizeof(double) ); - /* assign memory city to pointer array */ - for (i=1; i <dims2d[0]; i++) buf_double2d[i] = buf_double2d[0]+i*dims2d[1]; - - /* fill buffer values */ - len = 1; - for (i=0; i<dims[0]; i++) { - buf_comp[i].i = buf_int[i] = i-2147483648; - buf_comp[i].l = 0xffffffffffffffff-i; - buf_comp[i].f = 1.0/(i+1.0); - buf_comp[i].d = 987654321.0*i+1.0/(i+1.0); - buf_comp[i].e = (phase_t) (i % (int) (PLASMA + 1)); - - for (j=0; j<FIXED_LEN; j++) { - buf_comp[i].f_array[j] = buf_float_a[i][j] = i*100+j; - buf_str[i][j] = 'a' + (i%26); - } - buf_str[i][FIXED_LEN-1] = 0; - strcpy(buf_comp[i].s, buf_str[i]); - - len = (1-cos(i/8.0))/2*vlen+1; - if (!i) len = vlen; - buf_vlen_i[i].len = len; - buf_vlen_i[i].p = (int *)calloc(len, sizeof(int)); - for (j=0; j<len; j++) ((int*)(buf_vlen_i[i].p))[j] = i*100+j; - buf_comp[i].i_vlen = buf_vlen_i[i]; - - buf_vlen_s[i] = (char *)calloc(len, sizeof(char)); - for (j=0; j<len-1; j++) - buf_vlen_s[i][j] = j%26+'A'; - buf_comp[i].s_vlen = buf_vlen_s[i]; - - for (j=0; j<dims2d[1]; j++) - buf_double2d[i][j] = i+j/10000.0; - } - - for (i=0; i<nrows; i++) { - buf_comp_large[i].i = i-2147483648; - buf_comp_large[i].l = 0xffffffffffffffff-i; - buf_comp_large[i].f = 1.0/(i+1.0); - buf_comp_large[i].d = 987654321.0*i+1.0/(i+1.0); - buf_comp_large[i].e = (phase_t) (i % (int) (PLASMA + 1)); - for (j=0; j<FIXED_LEN-1; j++) { - buf_comp_large[i].f_array[j] = i*100+j; - buf_comp_large[i].s[j] = 'a' + (i%26); - } - len = i%vlen+1; - buf_comp_large[i].i_vlen.len = len; - buf_comp_large[i].i_vlen.p = (int *)calloc(len, sizeof(int)); - for (j=0; j<len; j++) ((int*)(buf_comp_large[i].i_vlen.p))[j] = i*100+j; - buf_comp_large[i].s_vlen = (char *)calloc(i+2, sizeof(char)); - for (j=0; j<i+1; j++) (buf_comp_large[i].s_vlen)[j] = j%26+'A'; - } - - /* create file */ - if (latest) - fid = H5Fcreate (fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); - else - fid = H5Fcreate (fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - add_attrs(fid, 0); - - sprintf(name, "a cmp ds of %d rows", nrows); - did = H5Dcreate (fid, name, cmp_tid, sid_large, H5P_DEFAULT, dcpl, H5P_DEFAULT); - H5Dwrite (did, cmp_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_comp_large); - add_attrs(did, 0); - H5Dclose(did); - - // /* add attributes*/ - gid1 = H5Gcreate (fid, "attributes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (nattrs<1) nattrs = 1; - i=0; - while (i<nattrs) i += add_attrs(gid1, i); - H5Gclose(gid1); - - /* add many sub groups to a group*/ - gid1 = H5Gcreate (fid, "groups", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - add_attrs(gid1, 0); - for (i=0; i<ngrps; i++) { - /* create sub groups */ - sprintf(name, "g%02d", i); - gid2 = H5Gcreate (gid1, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (i<10) add_attrs(gid2, 0); - H5Gclose(gid2); - } - H5Gclose(gid1); - - /* add many datasets to a group */ - gid1 = H5Gcreate (fid, "datasets", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - add_attrs(gid1, 0); - for (j=0; j<ndsets; j+=12) { - /* 1 add a null dataset */ - sprintf(name, "%05d null dataset", j); - did = H5Dcreate (gid1, name, H5T_STD_I32LE, sid_null, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (!j) add_attrs(did, j); - H5Dclose(did); - - /* 2 add scalar int point */ - sprintf(name, "%05d scalar int point", j); - did = H5Dcreate (gid1, name, H5T_NATIVE_INT, sid_scalar, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Dwrite (did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &j); - if (!j) add_attrs(did, j); - H5Dclose(did); - - /* 3 scalar vlen string */ - sprintf(name, "%05d scalar vlen string", j); - did = H5Dcreate (gid1, name, tid_vlen_s, sid_scalar, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Dwrite (did, tid_vlen_s, H5S_ALL, H5S_ALL, H5P_DEFAULT, &buf_vlen_s[0]); - if (!j) add_attrs(did, j); - H5Dclose(did); - - /* 4 add fixed-length float array */ - sprintf(name, "%05d fixed-length float array", j); - did = H5Dcreate (gid1, name, tid_array_f, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT); - H5Dwrite (did, tid_array_f, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_float_a); - if (!j) add_attrs(did, j); - H5Dclose(did); - - /* 5 add fixed-length strings */ - sprintf(name, "%05d fixed-length strings", j); - did = H5Dcreate (gid1, name, tid_str, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT); - H5Dwrite (did, tid_str, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_str); - if (!j) add_attrs(did, j); - H5Dclose(did); - - /* 6 add compound data */ - sprintf(name, "%05d compund data", j); - did = H5Dcreate (gid1, name, cmp_tid, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT); - H5Dwrite (did, cmp_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_comp); - if (!j) add_attrs(did, j); - H5Dclose(did); - - /* 7 add 2D double */ - sprintf(name, "%05d 2D double", j); - strcpy (tmp_name1, name); - did = H5Dcreate (gid1, name, H5T_NATIVE_DOUBLE, sid_2d, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Dwrite (did, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_double2d[0]); - if (!j) add_attrs(did, j); - H5Dclose(did); - - /* 8 add 1D int array */ - sprintf(name, "%05d 1D int array", j); - did = H5Dcreate (gid1, name, H5T_NATIVE_INT, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT); - H5Dwrite (did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_int); - if (!j) add_attrs(did, j); - H5Dclose(did); - - /* 9 add vlen int array */ - sprintf(name, "%05d vlen int array", j); - strcpy (tmp_name2, name); - did = H5Dcreate (gid1, name, tid_vlen_i, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT); - H5Dwrite (did, tid_vlen_i, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_vlen_i); - if (!j) add_attrs(did, j); - H5Dclose(did); - - /* 10 add vlen strings */ - sprintf(name, "%05d vlen strings", j); - strcpy (tmp_name3, name); - did = H5Dcreate (gid1, name, tid_vlen_s, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT); - H5Dwrite (did, tid_vlen_s, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_vlen_s); - if (!j) add_attrs(did, j); - H5Dclose(did); - - /* 11 add object refs */ - H5Rcreate(&buf_ref[0],gid1, ".", H5R_OBJECT, (hid_t)-1); - H5Rcreate(&buf_ref[1],gid1, tmp_name3, H5R_OBJECT, (hid_t)-1); - sprintf(name, "%05d obj refs", j); - did = H5Dcreate (gid1, name, H5T_STD_REF_OBJ, sid_2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Dwrite (did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_ref); - if (!j) add_attrs(did, j); - H5Dclose(did); - - /* 12 add region refs */ - H5Sselect_elements (sid_2d, H5S_SELECT_SET, 4, coords[0]); - H5Rcreate(&buf_reg_ref[0],gid1, tmp_name1, H5R_DATASET_REGION, sid_2d); - H5Sselect_none(sid_2d); - count = dims[0]/2+1; - H5Sselect_hyperslab (sid_1d, H5S_SELECT_SET, &start, &stride, &count,NULL); - H5Rcreate(&buf_reg_ref[1],gid1, tmp_name2, H5R_DATASET_REGION, sid_1d); - H5Sselect_none(sid_1d); - sprintf(name, "%05d region refs", j); - did = H5Dcreate (gid1, name, H5T_STD_REF_DSETREG, sid_2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Dwrite (did, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_reg_ref); - if (!j) add_attrs(did, j); - H5Dclose(did); - } - H5Gclose(gid1); - - H5Tclose (tid_array_f); - H5Tclose (tid_vlen_i); - H5Tclose (tid_vlen_s); - H5Tclose (tid_enum); - H5Tclose (tid_str); - H5Tclose (cmp_tid); - H5Pclose (dcpl); - H5Pclose (fapl); - H5Sclose (sid_1d); - H5Sclose (sid_2d); - H5Sclose (sid_2); - H5Sclose (sid_large); - H5Sclose (sid_null); - H5Sclose (sid_scalar); - H5Fclose (fid); - - for (i=0; i<dims[0]; i++) { - if (buf_vlen_i[i].p) free(buf_vlen_i[i].p); - if (buf_vlen_s[i]) free(buf_vlen_s[i]); - } - - for (i=0; i<nrows; i++) { - if (buf_comp_large[i].i_vlen.p) free(buf_comp_large[i].i_vlen.p); - if (buf_comp_large[i].s_vlen) free(buf_comp_large[i].s_vlen); - } - - free (buf_comp); - free (buf_comp_large); - free (buf_int); - free (buf_float_a); - free (buf_double2d[0]); - free (buf_double2d); - free (buf_str); - free(buf_vlen_i); - free(buf_vlen_s); - - return 0; -} - -/* add a single attribute */ -int add_attr(hid_t oid, const char *name, hid_t tid, hid_t sid, void *buf) -{ - hid_t aid; - - aid = H5Acreate (oid, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT); - if (aid <0) - return 0; - - H5Awrite(aid, tid, buf); - - H5Aclose(aid); - - return 1; -} - -/* - adds different types of attributes to an object. - - returns the number of attributes added to the objects. - */ -int add_attrs(hid_t oid, int idx) -{ - char name[32]; - int i0, i1, i2, j, nattrs=0; - hid_t aid, tid, tid1, sid; - hvl_t i_vlen[4]; - hobj_ref_t ref; - zipcode_t cmp_data[4]; - unsigned int i = 0xffffffff; - long long l = -2147483647; - float f = 123456789.987654321; - double d = 987654321.123456789; - char *s[7] = {"Parting", "is such", "sweeter", "sorrow."}; - float f_array[4] = {1.0, 2.22, 3.333, 4.444}; - char *s_vlen[4] = {"Parting", "is such", "sweet", "sorrow."}; - hsize_t dims1[1]={1}, dims2[1]={4}, dims3[2]={3,5}; - int int3d[4][3][5]; - size_t offset = 0; - - for (i0=0; i0<4; i0++) { - i_vlen[i0].len = (i0+1); - i_vlen[i0].p = (int *)calloc(i_vlen[i0].len, sizeof(int)); - for (j=0; j<i_vlen[i0].len; j++) - ((int *)i_vlen[i0].p)[j] = i0*100+j; - for (i1=0; i1<3; i1++) { - for (i2=0; i2<5; i2++) - int3d[i0][i1][i2] = i0*i1-i1*i2+i0*i2; - } - } - - cmp_data[0].zipcode = 01001; - cmp_data[0].city = "Agawam, Massachusetts"; - cmp_data[1].zipcode = 99950; - cmp_data[1].city = "Ketchikan, Alaska"; - cmp_data[2].zipcode = 00501; - cmp_data[2].city = "Holtsville, New York"; - cmp_data[3].zipcode = 61820; - cmp_data[3].city = "Champaign, Illinois"; - - /* 1 scalar point */ - sid = H5Screate (H5S_SCALAR); - sprintf(name, "%05d scalar int", idx); - nattrs += add_attr(oid, name, H5T_NATIVE_UINT, sid, &i); - sprintf(name, "%05d scalar ulong", idx); - nattrs += add_attr(oid, name, H5T_NATIVE_INT64, sid, &l); - sprintf(name, "%05d scalar str", idx); - tid = H5Tcopy (H5T_C_S1); - H5Tset_size (tid, H5T_VARIABLE); - nattrs += add_attr(oid, name, tid, sid, &s[2]); - H5Tclose(tid); - H5Sclose(sid); - - /* 4 single point */ - sid = H5Screate_simple (1, dims1, NULL); - H5Rcreate(&ref, oid, ".", H5R_OBJECT, (hid_t)-1); - sprintf(name, "%05d single float", idx); - nattrs += add_attr(oid, name, H5T_NATIVE_FLOAT, sid, &f); - sprintf(name, "%05d single double", idx); - nattrs += add_attr(oid, name, H5T_NATIVE_DOUBLE, sid, &d); - sprintf(name, "%05d single obj_ref", idx); - nattrs += add_attr(oid, name, H5T_STD_REF_OBJ, sid, &ref); - H5Sclose(sid); - - /* 7 fixed length 1D array */ - sid = H5Screate_simple (1, dims1, NULL); - tid = H5Tarray_create (H5T_NATIVE_FLOAT, 1, dims2); - sprintf(name, "%05d array float", idx); - nattrs += add_attr(oid, name, tid, sid, &f_array[0]); - H5Tclose(tid); - tid = H5Tcopy (H5T_C_S1); - H5Tset_size (tid, strlen(s[0])+1); - tid1 = H5Tarray_create (tid, 1, dims2); - sprintf(name, "%05d array str", idx); - nattrs += add_attr(oid, name, tid1, sid, s); - H5Tclose(tid1); - H5Tclose(tid); - H5Sclose(sid); - - /* 9 fixed length 2D int arrays */ - sid = H5Screate_simple (1, dims2, NULL); - tid = H5Tarray_create (H5T_NATIVE_INT, 2, dims3); - sprintf(name, "%05d array int 2D", idx); - nattrs += add_attr(oid, name, tid, sid, int3d[0][0]); - H5Tclose(tid); - H5Sclose(sid); - - /* 10 variable length arrays */ - sid = H5Screate_simple (1, dims2, NULL); - tid = H5Tcopy (H5T_C_S1); - H5Tset_size (tid, H5T_VARIABLE); - sprintf(name, "%05d vlen strings", idx); - nattrs += add_attr(oid, name, tid, sid, s_vlen); - H5Tclose(tid); - tid = H5Tvlen_create (H5T_NATIVE_INT);; - sprintf(name, "%05d vlen int array", idx); - nattrs += add_attr(oid, name, tid, sid, i_vlen); - H5Tclose(tid); - H5Sclose(sid); - - /* 12 compound data */ - sid = H5Screate_simple (1, dims2, NULL); - tid = H5Tcreate (H5T_COMPOUND, sizeof (zipcode_t)); - tid1 = H5Tcopy (H5T_C_S1); - H5Tset_size (tid1, H5T_VARIABLE); - H5Tinsert (tid, "zip code", 0, H5T_NATIVE_INT); offset += sizeof(H5T_NATIVE_INT); - H5Tinsert (tid, "City", offset, tid1); offset += sizeof(char *); - sprintf(name, "%05d compound data", idx); - nattrs += add_attr(oid, name, tid, sid, cmp_data); - H5Tclose(tid1); - H5Tclose(tid); - H5Sclose(sid); - - for (i0=0; i0<4; i0++) - free(i_vlen[i0].p); - - return nattrs; -} diff --git a/tools/misc/h5redeploy.in b/tools/misc/h5redeploy.in deleted file mode 100644 index 6b6ef87..0000000 --- a/tools/misc/h5redeploy.in +++ /dev/null @@ -1,218 +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. -# - -## Update HDF5 compiler tools after the HDF5 software has been installed ## -## in a new location. ## -## For help page, use "h5redeploy -help" ## -## ## - -# Constants definitions -EXIT_SUCCESS=0 -EXIT_FAILURE=1 - -# Function definitions - -# show help page -usage() { - # A wonderfully informative "usage" message. - echo "usage: $prog_name [OPTIONS]" - echo " OPTIONS:" - echo " -help|help This help message" - echo " -echo Show all the shell commands executed" - echo " -force No prompt, just do it" - echo " -prefix=DIR New directory to find HDF5 lib/ and include/" - echo " subdirectories [default: current directory]" - echo " -exec-prefix=DIR New directory to find HDF5 lib/" - echo " subdirectory [default: <prefix>]" - echo " -libdir=DIR New directory for the HDF5 lib directory" - echo " [default: <exec-prefix>/lib]" - echo " -includedir=DIR New directory for the HDF5 header files" - echo " [default: <prefix>/include]" - echo " -tool=TOOL Tool to update. TOOL must be in the current" - echo " directory and writable. [default: $h5tools]" - echo " -show Show the commands without executing them" - echo " " - exit $EXIT_FAILURE -} - -# display variable values -dump_vars(){ - echo "====Showing all variable values=====" - echo prefix=$prefix - echo h5tools=$h5tools - echo "====End Showing=====" -} - -# show actions to be taken -show_action() -{ - echo "Update the following tools because they are now installed at a new directory" - for t in $foundtools; do - echo "${t}:" - echo " current setting=`sed -e '/^prefix=/s/prefix=//p' -e d $t`" - echo " new setting="\""$prefix"\" - done -} - - -# Report Error message -ERROR() -{ - echo "***ERROR***" - echo "$1" -} - -# Main -# -############################################################################ -## Installation directories: ## -## prefix architecture-independent files. ## -## exec_prefix architecture-dependent files, default is <prefix>. ## -## libdir libraries, default is <exec_prefix>/lib. ## -## includedir header files, default is <prefix/include>. ## -## Not used here: ## -## bindir executables, <exec_prefix/bin>. ## -############################################################################ -# Initialization -h5tools="h5cc h5pcc h5fc h5pfc h5c++" # possible hdf5 tools -foundtools= # tools found and will be modified -fmode= # force mode, default is off -prefix= -exec_prefix= -libdir= -includedir= - -# Parse options -for arg in $@ ; do - case "$arg" in - -prefix=*) - prefix="`echo $arg | cut -f2 -d=`" - ;; - -exec-prefix=*) - exec_prefix="`echo $arg | cut -f2 -d=`" - ;; - -libdir=*) - libdir="`echo $arg | cut -f2 -d=`" - ;; - -includedir=*) - includedir="`echo $arg | cut -f2 -d=`" - ;; - -echo) - set -x - ;; - -show) - SHOW="echo" - ;; - -tool=*) - h5tools="`echo $arg | cut -f2 -d=`" - ;; - -help|help) - usage - ;; - -force) - fmode=yes - ;; - *) - ERROR "Unknown Option($arg)" - usage - exit $EXIT_FAILURE - ;; - esac -done - -# Set to default value, one above where i am, if not given by user -if [ -z "$prefix" ]; then - prefix=`(cd ..;pwd)` -fi -if [ -z "$exec_prefix" ]; then - exec_prefix='${prefix}' # use single quotes to prevent expansion of $ -fi -if [ -z "$libdir" ]; then - libdir='${exec_prefix}'/lib # use single quotes to prevent expansion of $ -fi -if [ -z "$includedir" ]; then - includedir='${prefix}'/include # use single quotes to prevent expansion of $ -fi - -for x in $h5tools; do - if [ -f $x ]; then - foundtools="$foundtools $x" - if [ ! -w $x ]; then - ERROR "h5tool($x) is not writable" - exit $EXIT_FAILURE - fi - fi -done - -if [ -z "$foundtools" ]; then - ERROR "found no tools to modify" - exit $EXIT_FAILURE -fi - -# Show actions to be taken and get consent -show_action -# Ask confirmation unless fmode is on -if [ x-$fmode = x- ]; then - echo "Continue? (yes/no)" - read ansx - ans=`echo $ansx | tr "[A-Z]" "[a-z]"` - if [ x-$ans != x-yes ]; then - echo ABORT. No tools changed. - exit $EXIT_FAILURE - fi -fi - - -# Create the update commands -CMDFILE=/tmp/h5redeploy.$$ -touch $CMDFILE -chmod 0600 $CMDFILE -echo "/^prefix=/c" >> $CMDFILE -echo prefix=\""$prefix"\" >> $CMDFILE -echo . >> $CMDFILE -echo "/^exec_prefix=/c" >> $CMDFILE -echo exec_prefix=\""$exec_prefix"\" >> $CMDFILE -echo . >> $CMDFILE -echo "/^libdir=/c" >> $CMDFILE -echo libdir=\""$libdir"\" >> $CMDFILE -echo . >> $CMDFILE -echo "/^includedir=/c" >> $CMDFILE -echo includedir=\""$includedir"\" >> $CMDFILE -echo . >> $CMDFILE -(echo w; echo q) >> $CMDFILE - - -# Update them -if [ "$SHOW" = "echo" ]; then - echo "===Update commands are:====" - cat $CMDFILE - echo "===End Update commands=====" -fi - -for t in $foundtools; do - echo Update $t ... - COMMAND="ed - $t" - if [ "$SHOW" = "echo" ]; then - echo $COMMAND - else - $COMMAND < $CMDFILE - fi -done - - -# Cleanup -rm -f $CMDFILE -exit $EXIT_SUCCESS diff --git a/tools/misc/h5repart.c b/tools/misc/h5repart.c deleted file mode 100644 index e44c957..0000000 --- a/tools/misc/h5repart.c +++ /dev/null @@ -1,510 +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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * Programmer: Robb Matzke <matzke@llnl.gov> - * Wednesday, May 13, 1998 - * - * Purpose: Repartitions a file family. This program can be used to - * split a single file into a family of files, join a family of - * files into a single file, or copy one family to another while - * changing the size of the family members. It can also be used - * to copy a single file to a single file with holes. - */ - -/* See H5private.h for how to include system headers */ -#include "hdf5.h" -#include "H5private.h" -#ifdef H5_STDC_HEADERS -# include <ctype.h> -# include <errno.h> -# include <fcntl.h> -# include <stdio.h> -# include <stdlib.h> -# include <string.h> -#endif - -#ifdef H5_HAVE_UNISTD_H -# include <sys/types.h> -# include <unistd.h> -#endif - -#ifdef H5_HAVE_SYS_STAT_H -# include <sys/stat.h> -#endif - -#ifndef FALSE -# define FALSE 0 -#endif -#ifndef TRUE -# define TRUE 1 -#endif -# define NAMELEN 4096 -#define GB *1024*1024*1024 - -#ifndef MIN -# define MIN(X,Y) ((X)<(Y)?(X):(Y)) -#endif -#ifndef MIN3 -# define MIN3(X,Y,Z) MIN(MIN(X,Y),Z) -#endif - -/*Make these 2 private properties(defined in H5Fprivate.h) available to h5repart. - *The first one updates the member file size in the superblock. The second one - *change file driver from family to sec2. */ -#define H5F_ACS_FAMILY_NEWSIZE_NAME "family_newsize" -#define H5F_ACS_FAMILY_TO_SEC2_NAME "family_to_sec2" - - -/*------------------------------------------------------------------------- - * Function: usage - * - * Purpose: Prints a usage message. - * - * Return: void - * - * Programmer: Robb Matzke - * Wednesday, May 13, 1998 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static void -usage (const char *progname) -{ - fprintf(stderr, "usage: %s [-v] [-V] [-[b|m] N[g|m|k]] [-family_to_sec2] SRC DST\n", - progname); - fprintf(stderr, " -v Produce verbose output\n"); - fprintf(stderr, " -V Print a version number and exit\n"); - fprintf(stderr, " -b N The I/O block size, defaults to 1kB\n"); - fprintf(stderr, " -m N The destination member size or 1GB\n"); - fprintf(stderr, " -family_to_sec2 Change file driver from family to sec2\n"); - fprintf(stderr, " SRC The name of the source file\n"); - fprintf(stderr, " DST The name of the destination files\n"); - fprintf(stderr, "Sizes may be suffixed with `g' for GB, `m' for MB or " - "`k' for kB.\n"); - fprintf(stderr, "File family names include an integer printf " - "format such as `%%d'\n"); - exit (EXIT_FAILURE); -} - - -/*------------------------------------------------------------------------- - * Function: get_size - * - * Purpose: Reads a size option of the form `-XNS' where `X' is any - * letter, `N' is a multi-character positive decimal number, and - * `S' is an optional suffix letter in the set [GgMmk]. The - * option may also be split among two arguments as: `-X NS'. - * The input value of ARGNO is the argument number for the - * switch in the ARGV vector and ARGC is the number of entries - * in that vector. - * - * Return: Success: The value N multiplied according to the - * suffix S. On return ARGNO will be the number - * of the next argument to process. - * - * Failure: Calls usage() which exits with a non-zero - * status. - * - * Programmer: Robb Matzke - * Wednesday, May 13, 1998 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static off_t -get_size (const char *progname, int *argno, int argc, char *argv[]) -{ - off_t retval=-1; - char *suffix; - - if (isdigit ((int)(argv[*argno][2]))) { - retval = strtol (argv[*argno]+2, &suffix, 10); - (*argno)++; - } else if (argv[*argno][2] || *argno+1>=argc) { - usage (progname); - } else { - retval = strtol (argv[*argno+1], &suffix, 0); - if (suffix==argv[*argno+1]) usage (progname); - *argno += 2; - } - if (suffix && suffix[0] && !suffix[1]) { - switch (*suffix) { - case 'G': - case 'g': - retval *= 1024 * 1024 * 1024; - break; - case 'M': - case 'm': - retval *= 1024 * 1024; - break; - case 'k': - retval *= 1024; - break; - default: - usage (progname); - } - } else if (suffix && suffix[0]) { - usage (progname); - } - return retval; -} - - -/*------------------------------------------------------------------------- - * Function: main - * - * Purpose: Split an hdf5 file - * - * Return: Success: - * - * Failure: - * - * Programmer: Robb Matzke - * Wednesday, May 13, 1998 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -int -main (int argc, char *argv[]) -{ - const char *prog_name; /*program name */ - size_t blk_size=1024; /*size of each I/O block */ - char *buf=NULL; /*I/O block buffer */ - size_t n, i; /*counters */ - ssize_t nio; /*I/O return value */ - int argno=1; /*program argument number */ - int src, dst=-1; /*source & destination files */ - int need_seek=FALSE; /*destination needs to seek? */ - int need_write; /*data needs to be written? */ - h5_stat_t sb; /*temporary file stat buffer */ - - int verbose=FALSE; /*display file names? */ - - const char *src_gen_name; /*general source name */ - char *src_name=NULL; /*source member name */ - - int src_is_family; /*is source name a family name? */ - int src_membno=0; /*source member number */ - - const char *dst_gen_name; /*general destination name */ - char *dst_name=NULL; /*destination member name */ - int dst_is_family; /*is dst name a family name? */ - int dst_membno=0; /*destination member number */ - - off_t left_overs=0; /*amount of zeros left over */ - off_t src_offset=0; /*offset in source member */ - off_t dst_offset=0; /*offset in destination member */ - off_t src_size; /*source logical member size */ - off_t src_act_size; /*source actual member size */ - off_t dst_size=1 GB; /*destination logical memb size */ - hid_t fapl; /*file access property list */ - hid_t file; - hsize_t hdsize; /*destination logical memb size */ - hbool_t family_to_sec2=FALSE; /*change family to sec2 driver? */ - - /* - * Get the program name from argv[0]. Use only the last component. - */ - if ((prog_name=strrchr (argv[0], '/'))) prog_name++; - else prog_name = argv[0]; - - /* - * Parse switches. - */ - while (argno<argc && '-'==argv[argno][0]) { - if (!strcmp (argv[argno], "-v")) { - verbose = TRUE; - argno++; - } else if (!strcmp(argv[argno], "-V")) { - printf("This is %s version %u.%u release %u\n", - prog_name, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE); - exit(EXIT_SUCCESS); - } else if (!strcmp (argv[argno], "-family_to_sec2")) { - family_to_sec2 = TRUE; - argno++; - } else if ('b'==argv[argno][1]) { - blk_size = (size_t)get_size (prog_name, &argno, argc, argv); - } else if ('m'==argv[argno][1]) { - dst_size = get_size (prog_name, &argno, argc, argv); - } else { - usage (prog_name); - } /* end if */ - } /* end while */ - - /* allocate names */ - if(NULL == (src_name = (char *)HDcalloc((size_t)NAMELEN, sizeof(char)))) - exit(EXIT_FAILURE); - if(NULL == (dst_name = (char *)HDcalloc((size_t)NAMELEN, sizeof(char)))) - exit(EXIT_FAILURE); - - /* - * Get the name for the source file and open the first member. The size - * of the first member determines the logical size of all the members. - */ - if (argno>=argc) usage (prog_name); - src_gen_name = argv[argno++]; - sprintf (src_name, src_gen_name, src_membno); - src_is_family = strcmp (src_name, src_gen_name); - - if ((src=HDopen(src_name, O_RDONLY,0))<0) { - perror (src_name); - exit (EXIT_FAILURE); - } - - if (HDfstat(src, &sb)<0) { - perror ("fstat"); - exit (EXIT_FAILURE); - } - src_size = src_act_size = sb.st_size; - if (verbose) fprintf (stderr, "< %s\n", src_name); - - /* - * Get the name for the destination file and open the first member. - */ - if (argno>=argc) usage (prog_name); - dst_gen_name = argv[argno++]; - sprintf (dst_name, dst_gen_name, dst_membno); - dst_is_family = strcmp (dst_name, dst_gen_name); - - if ((dst=HDopen (dst_name, O_RDWR|O_CREAT|O_TRUNC, 0666))<0) { - perror (dst_name); - exit (EXIT_FAILURE); - } - if (verbose) fprintf (stderr, "> %s\n", dst_name); - - /* No more arguments */ - if (argno<argc) usage (prog_name); - - /* Now the real work, split the file */ - buf = (char *)HDmalloc(blk_size); - while (src_offset<src_size) { - - /* Read a block. The amount to read is the minimum of: - * 1. The I/O block size - * 2. What's left to write in the destination member - * 3. Left over zeros or what's left in the source member. - */ - n = blk_size; - if (dst_is_family) n = (size_t)MIN((off_t)n, dst_size-dst_offset); - if (left_overs) { - n = (size_t)MIN ((off_t)n, left_overs); - left_overs = left_overs - (off_t)n; - need_write = FALSE; - } else if (src_offset<src_act_size) { - n = (size_t)MIN ((off_t)n, src_act_size-src_offset); - if ((nio=HDread (src, buf, n))<0) { - perror ("read"); - exit (EXIT_FAILURE); - } else if ((size_t)nio!=n) { - fprintf (stderr, "%s: short read\n", src_name); - exit (EXIT_FAILURE); - } - for (i=0; i<n; i++) { - if (buf[i]) break; - } - need_write = (i<n); - } else { - n = 0; - left_overs = src_size - src_act_size; - need_write = FALSE; - } - - /* - * If the block contains non-zero data then write it to the - * destination, otherwise just remember that we'll have to do a seek - * later in the destination when we finally get non-zero data. - */ - if (need_write) { - if (need_seek && HDlseek (dst, dst_offset, SEEK_SET)<0) { - perror ("HDlseek"); - exit (EXIT_FAILURE); - } - if ((nio=HDwrite (dst, buf, n))<0) { - perror ("write"); - exit (EXIT_FAILURE); - } else if ((size_t)nio!=n) { - fprintf (stderr, "%s: short write\n", dst_name); - exit (EXIT_FAILURE); - } - need_seek = FALSE; - } else { - need_seek = TRUE; - } - - /* - * Update the source offset and open the next source family member if - * necessary. The source stream ends at the first member which - * cannot be opened because it doesn't exist. At the end of the - * source stream, update the destination offset and break out of the - * loop. The destination offset must be updated so we can fix - * trailing holes. - */ - src_offset = src_offset + (off_t)n; - if (src_offset==src_act_size) { - HDclose (src); - if (!src_is_family) { - dst_offset = dst_offset + (off_t)n; - break; - } - sprintf (src_name, src_gen_name, ++src_membno); - if ((src=HDopen (src_name, O_RDONLY,0))<0 && ENOENT==errno) { - dst_offset = dst_offset + (off_t)n; - break; - } else if (src<0) { - perror (src_name); - exit (EXIT_FAILURE); - } - if (HDfstat (src, &sb)<0) { - perror ("fstat"); - exit (EXIT_FAILURE); - } - src_act_size = sb.st_size; - if (src_act_size>src_size) { - fprintf (stderr, "%s: member truncated to %lu bytes\n", - src_name, (unsigned long)src_size); - } - src_offset = 0; - if (verbose) fprintf (stderr, "< %s\n", src_name); - } - - /* - * Update the destination offset, opening a new member if one will be - * needed. The first member is extended to the logical member size - * but other members might be smaller if they end with a hole. - */ - dst_offset = dst_offset + (off_t)n; - if (dst_is_family && dst_offset==dst_size) { - if (0==dst_membno) { - if (HDlseek (dst, dst_size-1, SEEK_SET)<0) { - perror ("HDHDlseek"); - exit (EXIT_FAILURE); - } - if (HDread (dst, buf, 1)<0) { - perror ("read"); - exit (EXIT_FAILURE); - } - if (HDlseek (dst, dst_size-1, SEEK_SET)<0) { - perror ("HDlseek"); - exit (EXIT_FAILURE); - } - if (HDwrite (dst, buf, 1)<0) { - perror ("write"); - exit (EXIT_FAILURE); - } - } - HDclose (dst); - sprintf (dst_name, dst_gen_name, ++dst_membno); - if ((dst=HDopen (dst_name, O_RDWR|O_CREAT|O_TRUNC, 0666))<0) { - perror (dst_name); - exit (EXIT_FAILURE); - } - dst_offset = 0; - need_seek = FALSE; - if (verbose) fprintf (stderr, "> %s\n", dst_name); - } - } - - /* - * Make sure the last family member is the right size and then close it. - * The last member can't end with a hole or hdf5 will think that the - * family has been truncated. - */ - if (need_seek) { - if (HDlseek (dst, dst_offset-1, SEEK_SET)<0) { - perror ("HDlseek"); - exit (EXIT_FAILURE); - } - if (HDread (dst, buf, 1)<0) { - perror ("read"); - exit (EXIT_FAILURE); - } - if (HDlseek (dst, dst_offset-1, SEEK_SET)<0) { - perror ("HDlseek"); - exit (EXIT_FAILURE); - } - if (HDwrite (dst, buf, 1)<0) { - perror ("write"); - exit (EXIT_FAILURE); - } - } - HDclose (dst); - - /* Modify family driver information saved in superblock through private property. - * These private properties are for this tool only. */ - if ((fapl=H5Pcreate(H5P_FILE_ACCESS))<0) { - perror ("H5Pcreate"); - exit (EXIT_FAILURE); - } - - if(family_to_sec2) { - /* The user wants to change file driver from family to sec2. Open the file - * with sec2 driver. This property signals the library to ignore the family - * driver information saved in the superblock. */ - if(H5Pset(fapl, H5F_ACS_FAMILY_TO_SEC2_NAME, &family_to_sec2) < 0) { - perror ("H5Pset"); - exit (EXIT_FAILURE); - } - } else { - /* Modify family size saved in superblock through private property. It signals - * library to save the new member size(specified in command line) in superblock. - * This private property is for this tool only. */ - if(H5Pset_fapl_family(fapl, H5F_FAMILY_DEFAULT, H5P_DEFAULT) < 0) { - perror ("H5Pset_fapl_family"); - exit (EXIT_FAILURE); - } - - /* Set the property of the new member size as hsize_t */ - hdsize = (hsize_t)dst_size; - if(H5Pset(fapl, H5F_ACS_FAMILY_NEWSIZE_NAME, &hdsize) < 0) { - perror ("H5Pset"); - exit (EXIT_FAILURE); - } - } - - /* If the new file is a family file, try to open file for "read and write" to - * flush metadata. Flushing metadata will update the superblock to the new - * member size. If the original file is a family file and the new file is a sec2 - * file, the property FAMILY_TO_SEC2 will signal the library to switch to sec2 - * driver when the new file is opened. If the original file is a sec2 file and the - * new file can only be a sec2 file, reopen the new file should fail. There's - * nothing to do in this case. */ - H5E_BEGIN_TRY { - file=H5Fopen(dst_gen_name, H5F_ACC_RDWR, fapl); - } H5E_END_TRY; - - if(file>=0) { - if(H5Fclose(file)<0) { - perror ("H5Fclose"); - exit (EXIT_FAILURE); - } /* end if */ - } /* end if */ - - if(H5Pclose(fapl)<0) { - perror ("H5Pclose"); - exit (EXIT_FAILURE); - } /* end if */ - - /* Free resources and return */ - HDfree(src_name); - HDfree(dst_name); - HDfree(buf); - return EXIT_SUCCESS; -} /* end main */ diff --git a/tools/misc/h5repart_gentest.c b/tools/misc/h5repart_gentest.c deleted file mode 100644 index 8a34694..0000000 --- a/tools/misc/h5repart_gentest.c +++ /dev/null @@ -1,101 +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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * Programmer: Raymond Lu<slu@ncsa.uiuc.edu> - * June 1, 2005 - * - * Purpose: Generate a family file of 1024 bytes for each member - * for h5repart test. - */ -#include "hdf5.h" -#include "H5private.h" - -#define FAMILY_NUMBER 4 -#define FAMILY_SIZE 1024 -#define FILENAME "family_file%05d.h5" - -static int buf[FAMILY_NUMBER][FAMILY_SIZE]; - -int main(void) -{ - hid_t file=(-1), fapl, space=(-1), dset=(-1); - char dname[]="dataset"; - int i, j; - hsize_t dims[2]={FAMILY_NUMBER, FAMILY_SIZE}; - - /* Set property list and file name for FAMILY driver */ - if ((fapl=H5Pcreate(H5P_FILE_ACCESS)) < 0) { - perror ("H5Pcreate"); - exit (EXIT_FAILURE); - } - - if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0) { - perror ("H5Pset_fapl_family"); - exit (EXIT_FAILURE); - } - - if((file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) { - perror("H5Fcreate"); - exit(EXIT_FAILURE); - } - - /* Create and write dataset */ - if((space = H5Screate_simple(2, dims, NULL)) < 0) { - perror("H5Screate_simple"); - exit(EXIT_FAILURE); - } - - - if((dset = H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { - perror("H5Dcreate2"); - exit(EXIT_FAILURE); - } - - - for(i = 0; i<FAMILY_NUMBER; i++) - for(j = 0; j<FAMILY_SIZE; j++) - buf[i][j] = i * 10000 + j; - - if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) { - perror("H5Dwrite"); - exit(EXIT_FAILURE); - } - - - if(H5Sclose(space) < 0) { - perror ("H5Sclose"); - exit (EXIT_FAILURE); - } - - if(H5Dclose(dset) < 0) { - perror ("H5Dclose"); - exit (EXIT_FAILURE); - } - - if(H5Pclose(fapl) < 0) { - perror ("H5Pclose"); - exit (EXIT_FAILURE); - } - - if(H5Fclose(file) < 0) { - perror ("H5Fclose"); - exit (EXIT_FAILURE); - } - - puts(" PASSED"); fflush(stdout); - - return 0; -} diff --git a/tools/misc/repart_test.c b/tools/misc/repart_test.c deleted file mode 100644 index e6da779..0000000 --- a/tools/misc/repart_test.c +++ /dev/null @@ -1,165 +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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * Programmer: Raymond Lu <slu@ncsa.uiuc.edu> - * June 1, 2005 - * - * Purpose: This program tests family files after being repartitioned - * by h5repart. It simply tries to reopen the files with - * correct family driver and member size. - */ -#include "hdf5.h" - -#define KB 1024 -#define FAMILY_H5REPART_SIZE1 20000 -#define FAMILY_H5REPART_SIZE2 (5*KB) -#define MAX(a,b) (a>b ? a:b) - -const char *FILENAME[] = { - "fst_family%05d.h5", - "scd_family%05d.h5", - "family_to_sec2.h5", - NULL -}; - -herr_t test_family_h5repart_opens(void); -herr_t test_sec2_h5repart_opens(void); - - -/*------------------------------------------------------------------------- - * Function: test_family_h5repart_opens - * - * Purpose: Tries to reopen family files. - * - * Return: Success: exit(0) - * - * Failure: exit(1) - * - * Programmer: Raymond Lu - * June 1, 2005 - * - * Modifications: - *------------------------------------------------------------------------- - */ -herr_t -test_family_h5repart_opens(void) -{ - hid_t file=(-1), fapl=(-1); - - /* open 1st file(single member file) with correct family size(20000 byte) */ - if ((fapl=H5Pcreate(H5P_FILE_ACCESS))<0) - goto error; - - if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_H5REPART_SIZE1, H5P_DEFAULT)<0) - goto error; - - if((file=H5Fopen(FILENAME[0], H5F_ACC_RDWR, fapl))<0) - goto error; - - if(H5Fclose(file)<0) - goto error; - - /* open 2nd file(multiple member files) with correct family size(5KB) */ - if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_H5REPART_SIZE2, H5P_DEFAULT)<0) - goto error; - - if((file=H5Fopen(FILENAME[1], H5F_ACC_RDWR, fapl))<0) - goto error; - - if(H5Fclose(file)<0) - goto error; - - return 0; - -error: - H5E_BEGIN_TRY { - H5Fclose(file); - } H5E_END_TRY; - return -1; -} - - -/*------------------------------------------------------------------------- - * Function: test_sec2_h5repart_opens - * - * Purpose: Tries to reopen a sec2 file. - * - * Return: Success: exit(0) - * - * Failure: exit(1) - * - * Programmer: Raymond Lu - * June 21, 2005 - * - * Modifications: - *------------------------------------------------------------------------- - */ -herr_t -test_sec2_h5repart_opens(void) -{ - hid_t file=(-1); - - /* open the sec2 file */ - if((file=H5Fopen(FILENAME[2], H5F_ACC_RDWR, H5P_DEFAULT))<0) - goto error; - - if(H5Fclose(file)<0) - goto error; - - return 0; - -error: - H5E_BEGIN_TRY { - H5Fclose(file); - } H5E_END_TRY; - return -1; -} - - -/*------------------------------------------------------------------------- - * Function: main - * - * Purpose: Tests h5repart-ed family files - * - * Return: Success: exit(0) - * - * Failure: exit(1) - * - * Programmer: Raymond Lu - * June 1, 2005 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -int -main(void) -{ - int nerrors=0; - - nerrors += test_family_h5repart_opens()<0 ?1:0; - nerrors += test_sec2_h5repart_opens()<0 ?1:0; - - if (nerrors) goto error; - - return 0; - -error: - nerrors = MAX(1, nerrors); - printf("***** %d FAMILY FILE TEST%s FAILED! *****\n", - nerrors, 1 == nerrors ? "" : "S"); - return 1; -} diff --git a/tools/misc/talign.c b/tools/misc/talign.c deleted file mode 100644 index be373e7..0000000 --- a/tools/misc/talign.c +++ /dev/null @@ -1,244 +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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * Small program to illustrate the "misalignment" of members within a compound - * datatype, in a datatype fixed by H5Tget_native_type(). - */ -#include <string.h> -#include <stdlib.h> -/*#include <unistd.h> *//* Required for unlink() */ - -#include "hdf5.h" -#include "H5private.h" -#include "h5tools.h" - -const char *fname = "talign.h5"; -const char *setname = "align"; - -/* - * This program assumes that there is no extra space between the members 'Ok' - * and 'Not Ok', (there shouldn't be because they are of the same atomic type - * H5T_NATIVE_FLOAT, and they are placed within the compound next to one - * another per construction) - */ - -int main(void) -{ - hid_t fil=-1, spc=-1, set=-1; - hid_t cs6=-1, cmp=-1, fix=-1; - hid_t cmp1=-1, cmp2=-1, cmp3=-1; - hid_t plist=-1; - hid_t array_dt=-1; - - hsize_t dim[2]; - hsize_t cdim[4]; - - char string5[5]; - float fok[2] = {1234.0f, 2341.0f}; - float fnok[2] = {5678.0f, 6785.0f}; - float *fptr = NULL; - - char *data = NULL; - - int result = 0; - herr_t error = 1; - - printf("%-70s", "Testing alignment in compound datatypes"); - - strcpy(string5, "Hi!"); - HDunlink(fname); - fil = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - - if (fil < 0) { - puts("*FAILED*"); - return 1; - } - - H5E_BEGIN_TRY { - (void)H5Ldelete(fil, setname, H5P_DEFAULT); - } H5E_END_TRY; - - cs6 = H5Tcopy(H5T_C_S1); - H5Tset_size(cs6, sizeof(string5)); - H5Tset_strpad(cs6, H5T_STR_NULLPAD); - - cmp = H5Tcreate(H5T_COMPOUND, sizeof(fok) + sizeof(string5) + sizeof(fnok)); - H5Tinsert(cmp, "Awkward length", 0, cs6); - - cdim[0] = sizeof(fok) / sizeof(float); - array_dt = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, cdim); - H5Tinsert(cmp, "Ok", sizeof(string5), array_dt); - H5Tclose(array_dt); - - cdim[0] = sizeof(fnok) / sizeof(float); - array_dt = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, cdim); - H5Tinsert(cmp, "Not Ok", sizeof(fok) + sizeof(string5), array_dt); - H5Tclose(array_dt); - - fix = h5tools_get_native_type(cmp); - - cmp1 = H5Tcreate(H5T_COMPOUND, sizeof(fok)); - - cdim[0] = sizeof(fok) / sizeof(float); - array_dt = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, cdim); - H5Tinsert(cmp1, "Ok", 0, array_dt); - H5Tclose(array_dt); - - cmp2 = H5Tcreate(H5T_COMPOUND, sizeof(string5)); - H5Tinsert(cmp2, "Awkward length", 0, cs6); - - cmp3 = H5Tcreate(H5T_COMPOUND, sizeof(fnok)); - - cdim[0] = sizeof(fnok) / sizeof(float); - array_dt = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, cdim); - H5Tinsert(cmp3, "Not Ok", 0, array_dt); - H5Tclose(array_dt); - - plist = H5Pcreate(H5P_DATASET_XFER); - if((error = H5Pset_preserve(plist, 1)) < 0) - goto out; - - /* - * Create a small dataset, and write data into it we write each field - * in turn so that we are avoid alignment issues at this point - */ - dim[0] = 1; - spc = H5Screate_simple(1, dim, NULL); - set = H5Dcreate2(fil, setname, cmp, spc, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - - H5Dwrite(set, cmp1, spc, H5S_ALL, plist, fok); - H5Dwrite(set, cmp2, spc, H5S_ALL, plist, string5); - H5Dwrite(set, cmp3, spc, H5S_ALL, plist, fnok); - - H5Dclose(set); - - /* Now open the set, and read it back in */ - data = (char *)HDmalloc(H5Tget_size(fix)); - - if(!data) { - perror("malloc() failed"); - abort(); - } - - set = H5Dopen2(fil, setname, H5P_DEFAULT); - - H5Dread(set, fix, spc, H5S_ALL, H5P_DEFAULT, data); - fptr = (float *)(data + H5Tget_member_offset(fix, 1)); - H5Dclose(set); - -out: - if(error < 0) { - result = 1; - puts("*FAILED - HDF5 library error*"); - } else if(!(H5_FLT_ABS_EQUAL(fok[0], fptr[0])) - || !(H5_FLT_ABS_EQUAL(fok[1], fptr[1])) - || !(H5_FLT_ABS_EQUAL(fnok[0], fptr[2])) - || !(H5_FLT_ABS_EQUAL(fnok[1], fptr[3]))) { - char *mname; - - result = 1; - mname = H5Tget_member_name(fix, 0); - printf("%14s (%2d) %6s = %s\n", - mname ? mname : "(null)", (int)H5Tget_member_offset(fix,0), - string5, (char *)(data + H5Tget_member_offset(fix, 0))); - if(mname) - H5free_memory(mname); - - fptr = (float *)(data + H5Tget_member_offset(fix, 1)); - mname = H5Tget_member_name(fix, 1); - printf("Data comparison:\n" - "%14s (%2d) %6f = %f\n" - " %6f = %f\n", - mname ? mname : "(null)", (int)H5Tget_member_offset(fix,1), - (double)fok[0], (double)fptr[0], - (double)fok[1], (double)fptr[1]); - if(mname) - H5free_memory(mname); - - fptr = (float *)(data + H5Tget_member_offset(fix, 2)); - mname = H5Tget_member_name(fix, 2); - printf("%14s (%2d) %6f = %f\n" - " %6f = %6f\n", - mname ? mname : "(null)", (int)H5Tget_member_offset(fix,2), - (double)fnok[0], (double)fptr[0], - (double)fnok[1], (double)fptr[1]); - if(mname) - H5free_memory(mname); - - fptr = (float *)(data + H5Tget_member_offset(fix, 1)); - printf("\n" - "Short circuit\n" - " %6f = %f\n" - " %6f = %f\n" - " %6f = %f\n" - " %6f = %f\n", - (double)fok[0], (double)fptr[0], - (double)fok[1], (double)fptr[1], - (double)fnok[0], (double)fptr[2], - (double)fnok[1], (double)fptr[3]); - puts("*FAILED - compound type alignmnent problem*"); - } else { - puts(" PASSED"); - } - - if(data) - HDfree(data); - H5Sclose(spc); - H5Tclose(cs6); - H5Tclose(cmp); - H5Tclose(fix); - H5Tclose(cmp1); - H5Tclose(cmp2); - H5Tclose(cmp3); - H5Pclose(plist); - H5Fclose(fil); - HDunlink(fname); - fflush(stdout); - return result; -} - -/*------------------------------------------------------------------------- - * Function: h5tools_get_native_type - * - * Purpose: Wrapper around H5Tget_native_type() to work around - * Problems with bitfields. - * - * Return: Success: datatype ID - * - * Failure: FAIL - * - * Programmer: Quincey Koziol - * Tuesday, October 5, 2004 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -hid_t -h5tools_get_native_type(hid_t type) -{ - hid_t p_type; - H5T_class_t type_class; - - type_class = H5Tget_class(type); - if(type_class==H5T_BITFIELD) - p_type=H5Tcopy(type); - else - p_type = H5Tget_native_type(type,H5T_DIR_DEFAULT); - - return(p_type); -} - diff --git a/tools/misc/testfiles/h5mkgrp_help.txt b/tools/misc/testfiles/h5mkgrp_help.txt deleted file mode 100644 index ba130f6..0000000 --- a/tools/misc/testfiles/h5mkgrp_help.txt +++ /dev/null @@ -1,7 +0,0 @@ -usage: h5mkgrp [OPTIONS] FILE GROUP... - OPTIONS - -h, --help Print a usage message and exit - -l, --latest Use latest version of file format to create groups - -p, --parents No error if existing, make parent groups as needed - -v, --verbose Print information about OBJECTS and OPTIONS - -V, --version Print version number and exit diff --git a/tools/misc/testfiles/h5mkgrp_version.txt.in b/tools/misc/testfiles/h5mkgrp_version.txt.in deleted file mode 100644 index 75c13a5..0000000 --- a/tools/misc/testfiles/h5mkgrp_version.txt.in +++ /dev/null @@ -1 +0,0 @@ -h5mkgrp: Version @HDF5_PACKAGE_VERSION_STRING@ diff --git a/tools/misc/testh5mkgrp.sh.in b/tools/misc/testh5mkgrp.sh.in deleted file mode 100644 index a0413e1..0000000 --- a/tools/misc/testh5mkgrp.sh.in +++ /dev/null @@ -1,325 +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 h5mkgrp tool -# -# Quincey Koziol (koziol@hdfgroup.org) -# Tuesday, February 13, 2007 -# - -srcdir=@srcdir@ - -TESTNAME=h5mkgrp -EXIT_SUCCESS=0 -EXIT_FAILURE=1 - -H5MKGRP=h5mkgrp # The tool name -H5MKGRP_BIN=`pwd`/$H5MKGRP # The path of the tool binary -H5LS=h5ls # The h5ls tool name -H5LS_ARGS=-vr # Arguments to the h5ls tool -H5LS_BIN=`pwd`/../h5ls/$H5LS # The path of the h5ls tool binary - -RM='rm -rf' -CMP='cmp' -DIFF='diff -c' -CP='cp' -DIRNAME='dirname' -LS='ls' -AWK='awk' - -nerrors=0 -verbose=yes - -# source dirs -SRC_TOOLS="$srcdir/../" - -SRC_TOOLS_TESTFILES="$SRC_TOOLS/testfiles" -# testfiles source dirs for tools -SRC_H5MKGRP_TESTFILES="$SRC_TOOLS/misc/testfiles" - -TESTDIR=./testgrp -test -d $TESTDIR || mkdir -p $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. -# -------------------------------------------------------------------- - -CMP='cmp -s' -DIFF='diff -c' - -# -# copy test files and expected output files from source dirs to test dir -# -COPY_TESTFILES=" -$SRC_H5MKGRP_TESTFILES/h5mkgrp_help.txt -$SRC_TOOLS_TESTFILES/h5mkgrp_single.ls -$SRC_TOOLS_TESTFILES/h5mkgrp_single_v.ls -$SRC_TOOLS_TESTFILES/h5mkgrp_single_p.ls -$SRC_TOOLS_TESTFILES/h5mkgrp_single_l.ls -$SRC_TOOLS_TESTFILES/h5mkgrp_several.ls -$SRC_TOOLS_TESTFILES/h5mkgrp_several_v.ls -$SRC_TOOLS_TESTFILES/h5mkgrp_several_p.ls -$SRC_TOOLS_TESTFILES/h5mkgrp_several_l.ls -$SRC_TOOLS_TESTFILES/h5mkgrp_nested_p.ls -$SRC_TOOLS_TESTFILES/h5mkgrp_nested_lp.ls -$SRC_TOOLS_TESTFILES/h5mkgrp_nested_mult_p.ls -$SRC_TOOLS_TESTFILES/h5mkgrp_nested_mult_lp.ls -" - -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_H5MKGRP_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 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' -} - -# Source in the output filter function definitions. -. $srcdir/../../bin/output_filter.sh - -# Print a line-line message left justified in a field of 70 characters -# beginning with the word "Verifying". -# -VERIFY_H5LS() -{ - SPACES=" " - echo "Verifying h5ls file structure $* $SPACES" | cut -c1-70 | tr -d '\012' -} - -# Run a test and print PASS or *FAIL*. If h5mkgrp can complete -# with exit status 0, consider it pass. If a test fails then increment -# the `nerrors' global variable. -# Assumed arguments: -# $* arguments for h5mkgrp. - -TOOLTEST() -{ - TESTING $H5MKGRP $@ - ( - cd $TESTDIR - $RUNSERIAL $H5MKGRP_BIN $@ - ) > output.out - RET=$? - if [ $RET != 0 ]; then - echo "*FAILED*" - echo "failed result is:" - cat output.out - nerrors="`expr $nerrors + 1`" - else - echo " PASSED" - - # Clean up output file - if test -z "$HDF5_NOCLEANUP"; then - rm -f output.out - fi - fi -} - -# Call the h5ls tool to verify the correct output data in the destination file -# -H5LSTEST() -{ - expect="$TESTDIR/`basename $1 .h5`.ls" - actual="$TESTDIR/`basename $1 .h5`.out" - actual_sav=${actual}-sav - - # Stderr is included in stdout so that the diff can detect - # any unexpected output from that stream too. - VERIFY_H5LS $@ - ( - cd $TESTDIR - $RUNSERIAL $H5LS_BIN $H5LS_ARGS $@ - ) 2>&1 |sed 's/Modified:.*/Modified: XXXX-XX-XX XX:XX:XX XXX/' >$actual - - # save actual in case it is needed later. - cp $actual $actual_sav - STDOUT_FILTER $actual - STDERR_FILTER $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 (*.ls) 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_sav - fi -} - -# Single run of tool -# -# Assumed arguments: -# $1 is test file name -# $2 is h5mkgrp options -# $* are groups to create -RUNTEST() -{ - FILEOUT=$1 - shift - H5MKGRP_ARGS=$1 - shift - - # Remove any output file left over from previous test run - rm -f $FILEOUT - - # Run test - TOOLTEST $H5MKGRP_ARGS $FILEOUT $@ - - # Verify that the file created above is correct - H5LSTEST $FILEOUT - - # Remove output file created, if the "no cleanup" environment variable is - # not defined - if test -z "$HDF5_NOCLEANUP"; then - rm -f $TESTDIR/$FILEOUT - fi -} - -# Single run of tool -# -# Assumed arguments: -# $1 is test expected output file -# $2 is h5mkgrp options -# $* are groups to create -CMPTEST() -{ - FILEOUT=$1 - expect="$TESTDIR/`basename $1 .h5`.txt" - actual="$TESTDIR/`basename $1 .h5`.out" - actual_err="$TESTDIR/`basename $1 .h5`.err" - shift - - # Stderr is included in stdout so that the diff can detect - # any unexpected output from that stream too. - TESTING $H5MKGRP $@ - ( - cd $TESTDIR - $RUNSERIAL $H5MKGRP_BIN $@ - ) >$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; then - echo " PASSED" - else - echo "*FAILED*" - echo " Expected result (*.txt) 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 - fi -} - -############################################################################## -### T H E T E S T S ### -############################################################################## -# prepare for test -COPY_TESTFILES_TO_TESTDIR - -# Check that help & version is displayed properly -CMPTEST h5mkgrp_help.h5 "-h" -#CMPTEST h5mkgrp_version.h5 "-V" - -# Create single group at root level -RUNTEST h5mkgrp_single.h5 " " single -RUNTEST h5mkgrp_single_v.h5 "-v" single -RUNTEST h5mkgrp_single_p.h5 "-p" single -RUNTEST h5mkgrp_single_l.h5 "-l" latest - -# Create several groups at root level -RUNTEST h5mkgrp_several.h5 " " one two -RUNTEST h5mkgrp_several_v.h5 "-v" one two -RUNTEST h5mkgrp_several_p.h5 "-p" one two -RUNTEST h5mkgrp_several_l.h5 "-l" one two - -# Create various nested groups -RUNTEST h5mkgrp_nested_p.h5 "-p" /one/two -RUNTEST h5mkgrp_nested_lp.h5 "-lp" /one/two -RUNTEST h5mkgrp_nested_mult_p.h5 "-p" /one/two /three/four -RUNTEST h5mkgrp_nested_mult_lp.h5 "-lp" /one/two /three/four - -# 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/misc/testh5repart.sh.in b/tools/misc/testh5repart.sh.in deleted file mode 100644 index fc33e0e..0000000 --- a/tools/misc/testh5repart.sh.in +++ /dev/null @@ -1,116 +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 h5repart tool - -srcdir=@srcdir@ - -TESTNAME=h5repart -EXIT_SUCCESS=0 -EXIT_FAILURE=1 - -REPART=h5repart # The tool name -REPART_BIN=`pwd`/$REPART # The path of the tool binary - -REPARTED_FAM=repart_test # The test name -REPARTED_FAM_BIN=`pwd`/$REPARTED_FAM # The path of the test binary - -nerrors=0 -verbose=yes - -test -d ../testfiles || mkdir ../testfiles - -actual_dir=`pwd`/../testfiles - -# 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' -} - -# Run a test and print PASS or *FAIL*. If a test fails then increment -# the `nerrors' global variable. -# -TOOLTEST() { - # Run tool test. - TESTING $REPART $@ - ( -# echo - cd $srcdir/../testfiles - $RUNSERIAL $REPART_BIN $@ - ) - - if test $? -eq 0; then - echo " PASSED" - else - echo " FAILED" - nerrors=`expr $nerrors + 1` - fi -} - -OUTPUTTEST() { - # Run test program. - TESTING $REPARTED_FAM $@ - ( - cd $actual_dir - $RUNSERIAL $REPARTED_FAM_BIN $@ - ) - - if test $? -eq 0; then - echo " PASSED" - else - echo " FAILED" - nerrors=`expr $nerrors + 1` - fi -} - -# Print a "SKIP" message -SKIP() { - TESTING $REPART $@ - echo " -SKIP-" -} - -############################################################################## -############################################################################## -### T H E T E S T S ### -############################################################################## -############################################################################## - -# repartition family member size to 20,000 bytes. -TOOLTEST -m 20000 family_file%05d.h5 $actual_dir/fst_family%05d.h5 -# repartition family member size to 5 KB. -TOOLTEST -m 5k family_file%05d.h5 $actual_dir/scd_family%05d.h5 -# convert family file to sec2 file of 20,000 bytes -TOOLTEST -m 20000 -family_to_sec2 family_file%05d.h5 $actual_dir/family_to_sec2.h5 - -# test the output files repartitioned above. -OUTPUTTEST -echo - -# Clean up output file -if test -z "$HDF5_NOCLEANUP"; then - cd $actual_dir - rm -f fst_family*.h5 scd_family*.h5 family_to_sec2.h5 -fi - -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/misc/vds/CMakeLists.txt b/tools/misc/vds/CMakeLists.txt deleted file mode 100644 index dcf883c..0000000 --- a/tools/misc/vds/CMakeLists.txt +++ /dev/null @@ -1,28 +0,0 @@ -cmake_minimum_required (VERSION 3.1.0) -PROJECT (HDF5_TOOLS_MISC_VDS) - -#----------------------------------------------------------------------------- -# Setup include Directories -#----------------------------------------------------------------------------- -INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib) - -MACRO (ADD_H5_GENERATOR genfile) - add_executable (${genfile} ${HDF5_TOOLS_MISC_VDS_SOURCE_DIR}/${genfile}.c) - TARGET_NAMING (${genfile} STATIC) - TARGET_C_PROPERTIES (${genfile} STATIC " " " ") - target_link_libraries (${genfile} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) - set_target_properties (${genfile} PROPERTIES FOLDER generator/tools) -ENDMACRO (ADD_H5_GENERATOR genfile) - -# generator executables -set (H5_GENERATORS - UC_1_one_dim_gen - UC_2_two_dims_gen - UC_3_gaps_gen - UC_4_printf_gen - UC_5_stride_gen -) - -foreach (gen ${H5_GENERATORS}) - ADD_H5_GENERATOR (${gen}) -endforeach (gen ${H5_GENERATORS}) diff --git a/tools/misc/vds/Makefile.am b/tools/misc/vds/Makefile.am deleted file mode 100644 index f1ef80c..0000000 --- a/tools/misc/vds/Makefile.am +++ /dev/null @@ -1,38 +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 directory -AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib - -#test scripts and programs -TEST_PROG=UC_1_one_dim_gen UC_2_two_dims_gen UC_3_gaps_gen UC_4_printf_gen \ - UC_5_stride_gen - -check_PROGRAMS=$(TEST_PROG) - -# Temporary files. -CHECK_CLEANFILES+=*.h5 - -# All programs rely on hdf5 library and h5tools library -LDADD=$(LIBH5TOOLS) $(LIBHDF5) - -include $(top_srcdir)/config/conclude.am diff --git a/tools/misc/vds/UC_1.h b/tools/misc/vds/UC_1.h deleted file mode 100644 index 2150cfa..0000000 --- a/tools/misc/vds/UC_1.h +++ /dev/null @@ -1,121 +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 UC_1_H -#define UC_1_H - -#include "hdf5.h" - -#include "UC_common.h" - -/* - * Definitions for VDS use case 1 - * - * Datasets have a single unlimited dimension and two fixed dimensions. They - * are mapped along a single dimension in the VDS with no gaps between them. - */ - -/* virtual dataset <---> source dataset mapping and sizes - - ***************** --+ - * A * K - ***************** --+ - * * | - * B * N - * * | - ***************** --+ - * C * - ***************** - * * - * D * - * * - ***************** - * E * - ***************** - * * - * F * - * * - ***************** - - | | - +-------M-------+ - - - dim[0] - / - / - / - -----> dim[2] - | - | - | - dim[1] - - */ - - -#define UC_1_N_SOURCES 6 - -/* Dataset dimensions */ -#define UC_1_SM_HEIGHT 2 /* K */ -#define UC_1_LG_HEIGHT 4 /* N */ -#define UC_1_SM_LG_HEIGHT 6 /* SM_HEIGHT + LG_HEIGHT */ -#define UC_1_FULL_HEIGHT 18 /* (3 * K) + (3 * N) */ -#define UC_1_HALF_HEIGHT 9 -#define UC_1_WIDTH 8 /* M */ -#define UC_1_HALF_WIDTH 4 - -#define UC_1_N_MAX_PLANES H5S_UNLIMITED /* max number of planes */ -#define UC_1_N_TEST_PLANES 5 /* number of planes we write */ - -/* Dataset datatypes */ -#define UC_1_SOURCE_DATATYPE H5T_STD_I32LE -#define UC_1_VDS_DATATYPE H5T_STD_I32LE - -/* Starting size of datasets, both source and VDS */ -static hsize_t UC_1_DIMS[UC_1_N_SOURCES][RANK] = { - {0, UC_1_SM_HEIGHT, UC_1_WIDTH}, - {0, UC_1_LG_HEIGHT, UC_1_WIDTH}, - {0, UC_1_SM_HEIGHT, UC_1_WIDTH}, - {0, UC_1_LG_HEIGHT, UC_1_WIDTH}, - {0, UC_1_SM_HEIGHT, UC_1_WIDTH}, - {0, UC_1_LG_HEIGHT, UC_1_WIDTH} -}; - -/* Maximum size of datasets, both source and VDS */ -static hsize_t UC_1_MAX_DIMS[UC_1_N_SOURCES][RANK] = { - {UC_1_N_MAX_PLANES, UC_1_SM_HEIGHT, UC_1_WIDTH}, - {UC_1_N_MAX_PLANES, UC_1_LG_HEIGHT, UC_1_WIDTH}, - {UC_1_N_MAX_PLANES, UC_1_SM_HEIGHT, UC_1_WIDTH}, - {UC_1_N_MAX_PLANES, UC_1_LG_HEIGHT, UC_1_WIDTH}, - {UC_1_N_MAX_PLANES, UC_1_SM_HEIGHT, UC_1_WIDTH}, - {UC_1_N_MAX_PLANES, UC_1_LG_HEIGHT, UC_1_WIDTH} -}; - -/* File names for source datasets */ -static char UC_1_FILE_NAMES[UC_1_N_SOURCES][NAME_LEN] = { - {"1_a.h5"}, - {"1_b.h5"}, - {"1_c.h5"}, - {"1_d.h5"}, - {"1_e.h5"}, - {"1_f.h5"} -}; - -/* Dataset names */ -static char UC_1_SOURCE_DSET_PATH[NAME_LEN] = "/source_dset"; - -#endif /* UC_1_H */ - diff --git a/tools/misc/vds/UC_1_one_dim_gen.c b/tools/misc/vds/UC_1_one_dim_gen.c deleted file mode 100644 index f47b982..0000000 --- a/tools/misc/vds/UC_1_one_dim_gen.c +++ /dev/null @@ -1,269 +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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * File/dataset generator for VDS use case 1 - * - * See the header file for a description. - */ - -#include <stdio.h> -#include <stdlib.h> - -#include "hdf5.h" - -#include "UC_common.h" -#include "UC_1.h" - -static hsize_t UC_1_VDS_DIMS[RANK] = {0, UC_1_FULL_HEIGHT, UC_1_WIDTH}; -static hsize_t UC_1_VDS_MAX_DIMS[RANK] = {UC_1_N_MAX_PLANES, UC_1_FULL_HEIGHT, UC_1_WIDTH}; - -/* Planes */ -static hsize_t UC_1_PLANES[UC_1_N_SOURCES][RANK] = { - {1, UC_1_SM_HEIGHT, UC_1_WIDTH}, - {1, UC_1_LG_HEIGHT, UC_1_WIDTH}, - {1, UC_1_SM_HEIGHT, UC_1_WIDTH}, - {1, UC_1_LG_HEIGHT, UC_1_WIDTH}, - {1, UC_1_SM_HEIGHT, UC_1_WIDTH}, - {1, UC_1_LG_HEIGHT, UC_1_WIDTH} -}; - -/* VDS file name */ -static char UC_1_VDS_FILE_NAME[NAME_LEN] = "1_vds.h5"; - -/* Dataset names */ -static char UC_1_SOURCE_DSET_NAME[NAME_LEN] = "source_dset"; -static char UC_1_VDS_DSET_NAME[NAME_LEN] = "vds_dset"; - -/* Fill values */ -static int UC_1_FILL_VALUES[UC_1_N_SOURCES] = { - -1, - -2, - -3, - -4, - -5, - -6 -}; -static int UC_1_VDS_FILL_VALUE = -9; - -int -main(void) -{ - hid_t src_sid = -1; /* source dataset's dataspace ID */ - hid_t src_dcplid = -1; /* source dataset property list ID */ - - hid_t vds_sid = -1; /* VDS dataspace ID */ - hid_t vds_dcplid = -1; /* VDS dataset property list ID */ - - hid_t fid = -1; /* HDF5 file ID */ - hid_t did = -1; /* dataset ID */ - hid_t msid = -1; /* memory dataspace ID */ - hid_t fsid = -1; /* file dataspace ID */ - - hsize_t extent[RANK]; /* dataset extents */ - hsize_t start[RANK]; /* starting point for hyperslab */ - hsize_t map_start = 0; /* starting point in the VDS map */ - - int *buffer = NULL; /* data buffer */ - hsize_t count = 0; /* number of elements in a plane */ - int n_planes = -1; /* number of planes to write */ - int value = -1; /* value written to datasets */ - - int i; /* iterator */ - int j; /* iterator */ - hsize_t k; /* iterator */ - - - /* Start by creating the virtual dataset (VDS) dataspace and creation - * property list. The individual source datasets are then created - * and the VDS map (stored in the VDS property list) is updated. - */ - - /* Create VDS dcpl */ - if((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) - UC_ERROR - if(H5Pset_fill_value(vds_dcplid, UC_1_VDS_DATATYPE, - &UC_1_VDS_FILL_VALUE) < 0) - UC_ERROR - - /* Create VDS dataspace */ - if((vds_sid = H5Screate_simple(RANK, UC_1_VDS_DIMS, - UC_1_VDS_MAX_DIMS)) < 0) - UC_ERROR - - /************************************ - * Create source files and datasets * - ************************************/ - - start[0] = 0; - start[1] = 0; - start[2] = 0; - map_start = 0; - - for(i = 0; i < UC_1_N_SOURCES; i++) { - - /* Create source dataset dcpl */ - if((src_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) - UC_ERROR - if(H5Pset_chunk(src_dcplid, RANK, UC_1_PLANES[i]) < 0) - UC_ERROR - if(H5Pset_fill_value(src_dcplid, UC_1_SOURCE_DATATYPE, - &UC_1_FILL_VALUES[i]) < 0) - UC_ERROR - if(0 != i % 2) - if(H5Pset_deflate(src_dcplid, COMPRESSION_LEVEL) < 0) - UC_ERROR - - /* Create source file, dataspace, and dataset */ - if((fid = H5Fcreate(UC_1_FILE_NAMES[i], H5F_ACC_TRUNC, - H5P_DEFAULT, H5P_DEFAULT)) < 0) - UC_ERROR - if((src_sid = H5Screate_simple(RANK, UC_1_DIMS[i], - UC_1_MAX_DIMS[i])) < 0) - UC_ERROR - if((did = H5Dcreate2(fid, UC_1_SOURCE_DSET_NAME, - UC_1_SOURCE_DATATYPE, src_sid, - H5P_DEFAULT, src_dcplid, H5P_DEFAULT)) < 0) - UC_ERROR - - /* Set the dataset's extent (will eventually vary with i) */ - extent[0] = UC_1_N_TEST_PLANES; - extent[1] = UC_1_PLANES[i][1]; - extent[2] = UC_1_PLANES[i][2]; - if(H5Dset_extent(did, extent) < 0) - UC_ERROR - - /* Create a data buffer that represents a plane */ - count = UC_1_PLANES[i][1] * UC_1_PLANES[i][2]; - if(NULL == (buffer = (int *)malloc(count * sizeof(int)))) - UC_ERROR - - /* Create the memory dataspace */ - if((msid = H5Screate_simple(RANK, UC_1_PLANES[i], NULL)) < 0) - UC_ERROR - - /* Get the file dataspace */ - if((fsid = H5Dget_space(did)) < 0) - UC_ERROR - - /* Write planes to the dataset, number will eventually vary with i */ - n_planes = UC_1_N_TEST_PLANES; - for(j = 0; j < n_planes; j++) { - - value = ((i + 1) * 10) + j; - for(k = 0; k < count; k++) - buffer[k] = value; - - start[0] = (hsize_t)j; - start[1] = 0; - start[2] = 0; - if(H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, UC_1_PLANES[i], NULL) < 0) - UC_ERROR - if(H5Dwrite(did, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, buffer) < 0) - UC_ERROR - - } /* end for */ - - /* set up hyperslabs for source and destination datasets */ - start[0] = 0; - start[1] = 0; - start[2] = 0; - if(H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL, - UC_1_MAX_DIMS[i], NULL) < 0) - UC_ERROR - start[0] = 0; - start[1] = map_start; - start[2] = 0; - if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, start, NULL, - UC_1_MAX_DIMS[i], NULL) < 0) - UC_ERROR - map_start += UC_1_PLANES[i][1]; - - /* Add VDS mapping */ - if(H5Pset_virtual(vds_dcplid, vds_sid, UC_1_FILE_NAMES[i], - UC_1_SOURCE_DSET_PATH, src_sid) < 0) - UC_ERROR - - /* close */ - if(H5Sclose(src_sid) < 0) - UC_ERROR - if(H5Pclose(src_dcplid) < 0) - UC_ERROR - if(H5Sclose(msid) < 0) - UC_ERROR - if(H5Sclose(fsid) < 0) - UC_ERROR - if(H5Dclose(did) < 0) - UC_ERROR - if(H5Fclose(fid) < 0) - UC_ERROR - free(buffer); - - } /* end for */ - - - /******************* - * Create VDS file * - *******************/ - - /* file */ - if((fid = H5Fcreate(UC_1_VDS_FILE_NAME, H5F_ACC_TRUNC, - H5P_DEFAULT, H5P_DEFAULT)) < 0) - UC_ERROR - - /* dataset */ - if((did = H5Dcreate2(fid, UC_1_VDS_DSET_NAME, UC_1_VDS_DATATYPE, vds_sid, - H5P_DEFAULT, vds_dcplid, H5P_DEFAULT)) < 0) - UC_ERROR - - /* close */ - if(H5Pclose(vds_dcplid) < 0) - UC_ERROR - if(H5Sclose(vds_sid) < 0) - UC_ERROR - if(H5Dclose(did) < 0) - UC_ERROR - if(H5Fclose(fid) < 0) - UC_ERROR - - return EXIT_SUCCESS; - -error: - - H5E_BEGIN_TRY { - if(src_sid >= 0) - (void)H5Sclose(src_sid); - if(src_dcplid >= 0) - (void)H5Pclose(src_dcplid); - if(vds_sid >= 0) - (void)H5Sclose(vds_sid); - if(vds_dcplid >= 0) - (void)H5Pclose(vds_dcplid); - if(fid >= 0) - (void)H5Fclose(fid); - if(did >= 0) - (void)H5Dclose(did); - if(msid >= 0) - (void)H5Sclose(msid); - if(fsid >= 0) - (void)H5Sclose(fsid); - if(buffer != NULL) - free(buffer); - } H5E_END_TRY - - return EXIT_FAILURE; - -} /* end main */ - diff --git a/tools/misc/vds/UC_2.h b/tools/misc/vds/UC_2.h deleted file mode 100644 index fe3f350..0000000 --- a/tools/misc/vds/UC_2.h +++ /dev/null @@ -1,110 +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 UC_2_H -#define UC_2_H - -#include "hdf5.h" - -/* - * Definitions for VDS use case 2 - * - * Datasets have a single unlimited dimension and two fixed dimensions. They - * are mapped along two dimensions in the VDS with no gaps between them. - */ - -/* virtual dataset <---> source dataset mapping and sizes - - ********************************** - * A * * - ***************** D * - * * * - * B * * - * ****************** - ***************** E * - * C * * - ********************************** - - - dim[0] - / - / - / - -----> dim[2] - | - | - | - dim[1] - - */ - -#define UC_2_N_SOURCES 5 - -/* Dataset dimensions */ -#define UC_2_A_HEIGHT 2 -#define UC_2_B_HEIGHT 4 -#define UC_2_AB_HEIGHT 6 /* For hyperslab start position */ -#define UC_2_C_HEIGHT 2 -#define UC_2_D_HEIGHT 5 -#define UC_2_E_HEIGHT 3 -#define UC_2_FULL_HEIGHT 8 /* A+B+C and D+E */ -#define UC_2_WIDTH 7 -#define UC_2_FULL_WIDTH 14 /* 2*width */ - -#define UC_2_N_PLANES_IN_SERIES 3 /* number of planes in a series of sub-images */ -#define UC_2_N_MAX_PLANES H5S_UNLIMITED /* max number of planes */ -#define UC_2_N_TEST_PLANES 6 /* number of planes we write */ - -/* Dataset datatypes */ -#define UC_2_SOURCE_DATATYPE H5T_STD_I32LE -#define UC_2_VDS_DATATYPE H5T_STD_I32LE - -/* Starting size of datasets, both source and VDS */ -static hsize_t UC_2_DIMS[UC_2_N_SOURCES][RANK] = { - {0, UC_2_A_HEIGHT, UC_2_WIDTH}, - {0, UC_2_B_HEIGHT, UC_2_WIDTH}, - {0, UC_2_C_HEIGHT, UC_2_WIDTH}, - {0, UC_2_D_HEIGHT, UC_2_WIDTH}, - {0, UC_2_E_HEIGHT, UC_2_WIDTH} -}; - -/* Maximum size of datasets, both source and VDS */ -static hsize_t UC_2_MAX_DIMS[UC_2_N_SOURCES][RANK] = { - {UC_2_N_MAX_PLANES, UC_2_A_HEIGHT, UC_2_WIDTH}, - {UC_2_N_MAX_PLANES, UC_2_B_HEIGHT, UC_2_WIDTH}, - {UC_2_N_MAX_PLANES, UC_2_C_HEIGHT, UC_2_WIDTH}, - {UC_2_N_MAX_PLANES, UC_2_D_HEIGHT, UC_2_WIDTH}, - {UC_2_N_MAX_PLANES, UC_2_E_HEIGHT, UC_2_WIDTH} -}; - -/* File names for source datasets */ -static char UC_2_FILE_NAMES[UC_2_N_SOURCES][NAME_LEN] = { - {"2_a.h5"}, - {"2_b.h5"}, - {"2_c.h5"}, - {"2_d.h5"}, - {"2_e.h5"} -}; - -/* VDS file name */ -#define UC_2_VDS_FILE_NAME "2_vds.h5" - -/* Dataset names */ -#define UC_2_SOURCE_DSET_NAME "source_dset" -#define UC_2_SOURCE_DSET_PATH "/source_dset" -#define UC_2_VDS_DSET_NAME "vds_dset" - -#endif /* UC_2_H */ - diff --git a/tools/misc/vds/UC_2_two_dims_gen.c b/tools/misc/vds/UC_2_two_dims_gen.c deleted file mode 100644 index d08cc5f..0000000 --- a/tools/misc/vds/UC_2_two_dims_gen.c +++ /dev/null @@ -1,270 +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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * File/dataset generator for VDS use case 2 - * - * See the header file for a description. - */ - - -#include <stdlib.h> - -#include "hdf5.h" - -#include "UC_common.h" -#include "UC_2.h" - -static hsize_t UC_2_VDS_DIMS[RANK] = {0, UC_2_FULL_HEIGHT, UC_2_FULL_WIDTH}; -static hsize_t UC_2_VDS_MAX_DIMS[RANK] = {UC_2_N_MAX_PLANES, UC_2_FULL_HEIGHT, UC_2_FULL_WIDTH}; - -/* Positions of source datasets in the VDS */ -static hsize_t UC_2_POSITIONS[UC_2_N_SOURCES][RANK] = { - /* A */ {0, 0, 0}, - /* B */ {0, UC_2_A_HEIGHT, 0}, - /* C */ {0, UC_2_AB_HEIGHT, 0}, - /* D */ {0, 0, UC_2_WIDTH}, - /* E */ {0, UC_2_D_HEIGHT, UC_2_WIDTH} -}; - -/* Planes */ -static hsize_t UC_2_PLANES[UC_2_N_SOURCES][RANK] = { - {1, UC_2_A_HEIGHT, UC_2_WIDTH}, - {1, UC_2_B_HEIGHT, UC_2_WIDTH}, - {1, UC_2_C_HEIGHT, UC_2_WIDTH}, - {1, UC_2_D_HEIGHT, UC_2_WIDTH}, - {1, UC_2_E_HEIGHT, UC_2_WIDTH} -}; - -/* Chunk dimensions */ -static hsize_t UC_2_CHUNK_DIMS[UC_2_N_SOURCES][RANK] = { - {UC_2_N_PLANES_IN_SERIES, UC_2_A_HEIGHT, UC_2_WIDTH}, - {UC_2_N_PLANES_IN_SERIES, UC_2_B_HEIGHT, UC_2_WIDTH}, - {UC_2_N_PLANES_IN_SERIES, UC_2_C_HEIGHT, UC_2_WIDTH}, - {UC_2_N_PLANES_IN_SERIES, UC_2_D_HEIGHT, UC_2_WIDTH}, - {UC_2_N_PLANES_IN_SERIES, UC_2_E_HEIGHT, UC_2_WIDTH} -}; - -/* Fill values */ -static int UC_2_FILL_VALUES[UC_2_N_SOURCES] = { - -1, - -2, - -3, - -4, - -5 -}; -static int UC_2_VDS_FILL_VALUE = -9; - -int -main(void) -{ - hid_t src_sid = -1; /* source dataset's dataspace ID */ - hid_t src_dcplid = -1; /* source dataset property list ID */ - - hid_t vds_sid = -1; /* VDS dataspace ID */ - hid_t vds_dcplid = -1; /* VDS dataset property list ID */ - - hid_t fid = -1; /* HDF5 file ID */ - hid_t did = -1; /* dataset ID */ - hid_t msid = -1; /* memory dataspace ID */ - hid_t fsid = -1; /* file dataspace ID */ - - hsize_t start[RANK]; /* starting point for hyperslab */ - hsize_t extent[RANK]; /* dataset extents */ - - int *buffer = NULL; /* data buffer */ - int value = -1; /* value written to datasets */ - hsize_t count = 0; /* number of elements in a plane */ - int n_planes = -1; /* number of planes to write */ - - int i; /* iterator */ - int j; /* iterator */ - hsize_t k; /* iterator */ - - - /* Start by creating the virtual dataset (VDS) dataspace and creation - * property list. The individual source datasets are then created - * and the VDS map (stored in the VDS property list) is updated. - */ - - /* Create VDS dcpl */ - if((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) - UC_ERROR - if(H5Pset_fill_value(vds_dcplid, UC_2_VDS_DATATYPE, - &UC_2_VDS_FILL_VALUE) < 0) - UC_ERROR - - /* Create VDS dataspace */ - if((vds_sid = H5Screate_simple(RANK, UC_2_VDS_DIMS, - UC_2_VDS_MAX_DIMS)) < 0) - UC_ERROR - - /************************************ - * Create source files and datasets * - ************************************/ - - start[0] = 0; - start[1] = 0; - start[2] = 0; - - for(i = 0; i < UC_2_N_SOURCES; i++) { - - /* source dataset dcpl */ - if((src_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) - UC_ERROR - if(H5Pset_chunk(src_dcplid, RANK, UC_2_CHUNK_DIMS[i]) < 0) - UC_ERROR - if(H5Pset_fill_value(src_dcplid, UC_2_SOURCE_DATATYPE, - &UC_2_FILL_VALUES[i]) < 0) - UC_ERROR - if(H5Pset_deflate(src_dcplid, COMPRESSION_LEVEL) < 0) - UC_ERROR - - /* Create source file, dataspace, and dataset */ - if((fid = H5Fcreate(UC_2_FILE_NAMES[i], H5F_ACC_TRUNC, - H5P_DEFAULT, H5P_DEFAULT)) < 0) - UC_ERROR - if((src_sid = H5Screate_simple(RANK, UC_2_DIMS[i], - UC_2_MAX_DIMS[i])) < 0) - UC_ERROR - if((did = H5Dcreate2(fid, UC_2_SOURCE_DSET_NAME, - UC_2_SOURCE_DATATYPE, src_sid, - H5P_DEFAULT, src_dcplid, H5P_DEFAULT)) < 0) - UC_ERROR - - /* Set the dataset's extent (will eventually vary with i) */ - extent[0] = UC_2_N_TEST_PLANES; - extent[1] = UC_2_PLANES[i][1]; - extent[2] = UC_2_PLANES[i][2]; - if(H5Dset_extent(did, extent) < 0) - UC_ERROR - - /* Create a data buffer that represents a plane */ - count = UC_2_PLANES[i][1] * UC_2_PLANES[i][2]; - if(NULL == (buffer = (int *)malloc(count * sizeof(int)))) - UC_ERROR - - /* Create the memory dataspace */ - if((msid = H5Screate_simple(RANK, UC_2_PLANES[i], NULL)) < 0) - UC_ERROR - - /* Get the file dataspace */ - if((fsid = H5Dget_space(did)) < 0) - UC_ERROR - - /* Write planes to the dataset, number will eventually vary with i */ - n_planes = UC_2_N_TEST_PLANES; - for(j = 0; j < n_planes; j++) { - - value = ((i + 1) * 10) + j; - for(k = 0; k < count; k++) - buffer[k] = value; - - start[0] = (hsize_t)j; - start[1] = 0; - start[2] = 0; - if(H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, UC_2_PLANES[i], NULL) < 0) - UC_ERROR - if(H5Dwrite(did, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, buffer) < 0) - UC_ERROR - - } /* end for */ - - /* set up hyperslabs for source and destination datasets */ - start[0] = 0; - start[1] = 0; - start[2] = 0; - if(H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL, - UC_2_MAX_DIMS[i], NULL) < 0) - UC_ERROR - if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, UC_2_POSITIONS[i], NULL, - UC_2_MAX_DIMS[i], NULL) < 0) - UC_ERROR - - /* Add VDS mapping */ - if(H5Pset_virtual(vds_dcplid, vds_sid, UC_2_FILE_NAMES[i], - UC_2_SOURCE_DSET_PATH, src_sid) < 0) - UC_ERROR - - /* close */ - if(H5Sclose(msid) < 0) - UC_ERROR - if(H5Sclose(fsid) < 0) - UC_ERROR - if(H5Sclose(src_sid) < 0) - UC_ERROR - if(H5Pclose(src_dcplid) < 0) - UC_ERROR - if(H5Dclose(did) < 0) - UC_ERROR - if(H5Fclose(fid) < 0) - UC_ERROR - free(buffer); - - } /* end for */ - - /******************************* - * Create VDS file and dataset * - *******************************/ - - /* file */ - if((fid = H5Fcreate(UC_2_VDS_FILE_NAME, H5F_ACC_TRUNC, - H5P_DEFAULT, H5P_DEFAULT)) < 0) - UC_ERROR - - /* dataset */ - if((did = H5Dcreate2(fid, UC_2_VDS_DSET_NAME, UC_2_VDS_DATATYPE, vds_sid, - H5P_DEFAULT, vds_dcplid, H5P_DEFAULT)) < 0) - UC_ERROR - - /* close */ - if(H5Pclose(vds_dcplid) < 0) - UC_ERROR - if(H5Sclose(vds_sid) < 0) - UC_ERROR - if(H5Dclose(did) < 0) - UC_ERROR - if(H5Fclose(fid) < 0) - UC_ERROR - - return EXIT_SUCCESS; - -error: - - H5E_BEGIN_TRY { - if(src_sid >= 0) - (void)H5Sclose(src_sid); - if(src_dcplid >= 0) - (void)H5Pclose(src_dcplid); - if(vds_sid >= 0) - (void)H5Sclose(vds_sid); - if(vds_dcplid >= 0) - (void)H5Pclose(vds_dcplid); - if(fid >= 0) - (void)H5Fclose(fid); - if(did >= 0) - (void)H5Dclose(did); - if(msid >= 0) - (void)H5Sclose(msid); - if(fsid >= 0) - (void)H5Sclose(fsid); - if(buffer != NULL) - free(buffer); - } H5E_END_TRY - - return EXIT_FAILURE; - -} /* end main() */ - diff --git a/tools/misc/vds/UC_3.h b/tools/misc/vds/UC_3.h deleted file mode 100644 index 0654a48..0000000 --- a/tools/misc/vds/UC_3.h +++ /dev/null @@ -1,74 +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 UC_3_H -#define UC_3_H - -#include "hdf5.h" - -#include "UC_1.h" -#include "UC_2.h" - -/* - * Definitions for VDS use case 3 - * - * Datasets have a single unlimited dimension and one or two fixed - * dimensions (they are reused from use cases 1 and 2). In this use case, - * the datasets are mapped in the VDS with gaps between them. - */ - -/* VDS dimensions - * Height and width are large enough to encompass the - * mapped source datasets with gaps. - */ -#define UC_31_VDS_HEIGHT 25 /* full height + 7 (gaps of 1) */ -#define UC_31_VDS_WIDTH 8 /* full width + 0 (no gaps) */ -#define UC_32_VDS_HEIGHT 13 /* full height + 5 */ -#define UC_32_VDS_WIDTH 19 /* full width + 5 */ -#define UC_31_GAP 1 - -/* VDS datatypes */ -#define UC_31_VDS_DATATYPE H5T_STD_I32LE -#define UC_32_VDS_DATATYPE H5T_STD_I32LE - -/* Starting size of virtual datasets */ -static hsize_t UC_31_VDS_DIMS[RANK] = {0, UC_31_VDS_HEIGHT, UC_31_VDS_WIDTH}; -static hsize_t UC_32_VDS_DIMS[RANK] = {0, UC_32_VDS_HEIGHT, UC_32_VDS_WIDTH}; - -/* Maximum size of virtual datasets */ -static hsize_t UC_31_VDS_MAX_DIMS[RANK] = {UC_1_N_MAX_PLANES, UC_31_VDS_HEIGHT, UC_31_VDS_WIDTH}; -static hsize_t UC_32_VDS_MAX_DIMS[RANK] = {UC_2_N_MAX_PLANES, UC_32_VDS_HEIGHT, UC_32_VDS_WIDTH}; - -/* Positions of mapped source datasets */ -static hsize_t UC_32_POSITIONS[UC_2_N_SOURCES][RANK] = { - /* A */ {0, 1, 1}, - /* B */ {0, 4, 0}, - /* C */ {0, 11, 4}, - /* D */ {0, 1, 9}, - /* E */ {0, 8, 12} -}; - -/* VDS file names */ -#define UC_31_VDS_FILE_NAME "3_1_vds.h5" -#define UC_32_VDS_FILE_NAME "3_2_vds.h5" - -/* Dataset name */ -#define UC_3_VDS_DSET_NAME "vds_dset" - -/* Fill value */ -static int UC_3_VDS_FILL_VALUE = -9; - -#endif /* UC_3_H */ - diff --git a/tools/misc/vds/UC_3_gaps_gen.c b/tools/misc/vds/UC_3_gaps_gen.c deleted file mode 100644 index 7cb208b..0000000 --- a/tools/misc/vds/UC_3_gaps_gen.c +++ /dev/null @@ -1,255 +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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * File/dataset generator for VDS use case 3 - * - * See the header file for a description. - */ - -#include <stdlib.h> -#include <string.h> - -#include <hdf5.h> - -#include "UC_common.h" -#include "UC_3.h" - -/* Create the VDS that uses use case 1 files */ -static herr_t -create_3_1_vds(void) -{ - hid_t src_sid = -1; /* source dataset's dataspace ID */ - hid_t vds_sid = -1; /* VDS dataspace ID */ - hid_t vds_dcplid = -1; /* VDS dataset property list ID */ - - hid_t fid = -1; /* HDF5 file ID */ - hid_t did = -1; /* dataset ID */ - - hsize_t start[RANK]; /* source starting point for hyperslab */ - hsize_t position[RANK]; /* vds mapping positions */ - - int i; /* iterator */ - - /* Create VDS dcpl */ - if((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) - UC_ERROR - if(H5Pset_fill_value(vds_dcplid, UC_31_VDS_DATATYPE, - &UC_3_VDS_FILL_VALUE) < 0) - UC_ERROR - - /* Create VDS dataspace */ - if((vds_sid = H5Screate_simple(RANK, UC_31_VDS_DIMS, - UC_31_VDS_MAX_DIMS)) < 0) - UC_ERROR - - /* Set starting positions */ - start[0] = 0; - start[1] = 0; - start[2] = 0; - - position[0] = 0; - position[1] = UC_31_GAP; - position[2] = 0; - - /****************************** - * Create source-VDS mappings * - ******************************/ - for(i = 0; i < UC_1_N_SOURCES; i++) { - - if((src_sid = H5Screate_simple(RANK, UC_1_DIMS[i], - UC_1_MAX_DIMS[i])) < 0) - UC_ERROR - - /* set up hyperslabs for source and destination datasets */ - if(H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL, - UC_1_MAX_DIMS[i], NULL) < 0) - UC_ERROR - if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, position, - NULL, UC_1_MAX_DIMS[i], NULL) < 0) - UC_ERROR - position[1] += UC_1_DIMS[i][1] + UC_31_GAP; - - /* Add VDS mapping */ - if(H5Pset_virtual(vds_dcplid, vds_sid, UC_1_FILE_NAMES[i], - UC_1_SOURCE_DSET_PATH, src_sid) < 0) - UC_ERROR - if(H5Sclose(src_sid) < 0) - UC_ERROR - - } /* end for */ - - /******************************* - * Create VDS file and dataset * - *******************************/ - - /* file */ - if((fid = H5Fcreate(UC_31_VDS_FILE_NAME, H5F_ACC_TRUNC, - H5P_DEFAULT, H5P_DEFAULT)) < 0) - UC_ERROR - - /* dataset */ - if((did = H5Dcreate2(fid, UC_3_VDS_DSET_NAME, UC_31_VDS_DATATYPE, vds_sid, - H5P_DEFAULT, vds_dcplid, H5P_DEFAULT)) < 0) - UC_ERROR - - /* close */ - if(H5Pclose(vds_dcplid) < 0) - UC_ERROR - if(H5Sclose(vds_sid) < 0) - UC_ERROR - if(H5Dclose(did) < 0) - UC_ERROR - if(H5Fclose(fid) < 0) - UC_ERROR - - return 0; - -error: - - H5E_BEGIN_TRY { - if(vds_sid >= 0) - (void)H5Sclose(vds_sid); - if(vds_dcplid >= 0) - (void)H5Pclose(vds_dcplid); - if(fid >= 0) - (void)H5Fclose(fid); - if(did >= 0) - (void)H5Dclose(did); - } H5E_END_TRY - - return -1; - -} /* end create_3_1_vds() */ - -/* Create the VDS that uses use case 2 files */ -static herr_t -create_3_2_vds(void) -{ - hid_t src_sid = -1; /* source dataset's dataspace ID */ - hid_t vds_sid = -1; /* VDS dataspace ID */ - hid_t vds_dcplid = -1; /* VDS dataset property list ID */ - - hid_t fid = -1; /* HDF5 file ID */ - hid_t did = -1; /* dataset ID */ - - hsize_t start[RANK]; /* source starting point for hyperslab */ - - int i; /* iterator */ - - /* Create VDS dcpl */ - if((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) - UC_ERROR - if(H5Pset_fill_value(vds_dcplid, UC_32_VDS_DATATYPE, - &UC_3_VDS_FILL_VALUE) < 0) - UC_ERROR - - /* Create VDS dataspace */ - if((vds_sid = H5Screate_simple(RANK, UC_32_VDS_DIMS, - UC_32_VDS_MAX_DIMS)) < 0) - UC_ERROR - - /* Set starting positions */ - start[0] = 0; - start[1] = 0; - start[2] = 0; - - /****************************** - * Create source-VDS mappings * - ******************************/ - for(i = 0; i < UC_2_N_SOURCES; i++) { - - if((src_sid = H5Screate_simple(RANK, UC_2_DIMS[i], - UC_2_MAX_DIMS[i])) < 0) - UC_ERROR - - /* set up hyperslabs for source and destination datasets */ - if(H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL, - UC_2_MAX_DIMS[i], NULL) < 0) - UC_ERROR - if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, UC_32_POSITIONS[i], - NULL, UC_2_MAX_DIMS[i], NULL) < 0) - UC_ERROR - - /* Add VDS mapping */ - if(H5Pset_virtual(vds_dcplid, vds_sid, UC_2_FILE_NAMES[i], - UC_2_SOURCE_DSET_PATH, src_sid) < 0) - UC_ERROR - if(H5Sclose(src_sid) < 0) - UC_ERROR - - } /* end for */ - - /******************************* - * Create VDS file and dataset * - *******************************/ - - /* file */ - if((fid = H5Fcreate(UC_32_VDS_FILE_NAME, H5F_ACC_TRUNC, - H5P_DEFAULT, H5P_DEFAULT)) < 0) - UC_ERROR - - /* dataset */ - if((did = H5Dcreate2(fid, UC_3_VDS_DSET_NAME, UC_32_VDS_DATATYPE, vds_sid, - H5P_DEFAULT, vds_dcplid, H5P_DEFAULT)) < 0) - UC_ERROR - - /* close */ - if(H5Pclose(vds_dcplid) < 0) - UC_ERROR - if(H5Sclose(vds_sid) < 0) - UC_ERROR - if(H5Dclose(did) < 0) - UC_ERROR - if(H5Fclose(fid) < 0) - UC_ERROR - - return 0; - -error: - - H5E_BEGIN_TRY { - if(vds_sid >= 0) - (void)H5Sclose(vds_sid); - if(vds_dcplid >= 0) - (void)H5Pclose(vds_dcplid); - if(fid >= 0) - (void)H5Fclose(fid); - if(did >= 0) - (void)H5Dclose(did); - } H5E_END_TRY - - return -1; - -} /* end create_3_2_vds() */ - -int -main(void) -{ - - if(create_3_1_vds() < 0) - UC_ERROR - - if(create_3_2_vds() < 0) - UC_ERROR - - return EXIT_SUCCESS; - -error: - - return EXIT_FAILURE; - -} /* end main() */ - diff --git a/tools/misc/vds/UC_4.h b/tools/misc/vds/UC_4.h deleted file mode 100644 index bfcafed..0000000 --- a/tools/misc/vds/UC_4.h +++ /dev/null @@ -1,86 +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 UC_4_H -#define UC_4_H - -#include "hdf5.h" - -#include "UC_common.h" - -/* - * Definitions for VDS use case 4 - * - * Source datasets have three fixed dimensions. In this use case, the - * datasets are mapped consecutively in the VDS along a single dimension with - * no gaps between them. Datasets are automatically loaded using a - * printf-like format string for the file name. - */ - -/* virtual dataset <---> source dataset mapping and sizes */ - -#define UC_4_N_SOURCES 3 - -/* Dataset dimensions */ -#define UC_4_SRC_PLANES 3 -#define UC_4_HEIGHT 4 -#define UC_4_WIDTH 4 - -/* max number of planes for VDS (sources are finite) */ -#define UC_4_VDS_MAX_PLANES H5S_UNLIMITED -#define UC_4_N_TEST_PLANES 9 /* number of planes in the VDS */ - -/* Dataset datatypes */ -#define UC_4_SOURCE_DATATYPE H5T_STD_I32LE -#define UC_4_VDS_DATATYPE H5T_STD_I32LE - -/* Starting size of datasets, both source and VDS */ -static hsize_t UC_4_SOURCE_DIMS[RANK] = {0, UC_4_HEIGHT, UC_4_WIDTH}; -static hsize_t UC_4_VDS_DIMS[RANK] = {0, UC_4_HEIGHT, UC_4_WIDTH}; - -/* Max size of datasets, both source and VDS */ -static hsize_t UC_4_SOURCE_MAX_DIMS[RANK] = {UC_4_SRC_PLANES, UC_4_HEIGHT, UC_4_WIDTH}; -static hsize_t UC_4_VDS_MAX_DIMS[RANK] = {UC_4_VDS_MAX_PLANES, UC_4_HEIGHT, UC_4_WIDTH}; - -/* Planes (both source and VDS) */ -static hsize_t UC_4_PLANE[RANK] = {1, UC_4_HEIGHT, UC_4_WIDTH}; - -/* File names for source datasets */ -static char UC_4_FILE_NAMES[UC_4_N_SOURCES][NAME_LEN] = { - {"4_0.h5"}, - {"4_1.h5"}, - {"4_2.h5"} -}; -static char UC_4_MAPPING_FILE_NAME[NAME_LEN] = "4_%b.h5"; - -/* VDS file name */ -static char UC_4_VDS_FILE_NAME[NAME_LEN] = "4_vds.h5"; - -/* Dataset names */ -static char UC_4_SOURCE_DSET_NAME[NAME_LEN] = "source_dset"; -static char UC_4_SOURCE_DSET_PATH[NAME_LEN] = "/source_dset"; -static char UC_4_VDS_DSET_NAME[NAME_LEN] = "vds_dset"; - -/* Fill values */ -static int UC_4_FILL_VALUES[UC_4_N_SOURCES] = { - -1, - -2, - -3 -}; -static int UC_4_VDS_FILL_VALUE = -9; - -#endif /* UC_4_H */ - - diff --git a/tools/misc/vds/UC_4_printf_gen.c b/tools/misc/vds/UC_4_printf_gen.c deleted file mode 100644 index d067d47..0000000 --- a/tools/misc/vds/UC_4_printf_gen.c +++ /dev/null @@ -1,219 +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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * File/dataset generator for VDS use case 4 - * - * See the header file for a description. - */ - -#include <stdlib.h> - -#include <hdf5.h> - -#include "UC_common.h" -#include "UC_4.h" - -int -main(void) -{ - hid_t src_sid = -1; /* source dataset's dataspace ID */ - hid_t src_dcplid = -1; /* source dataset property list ID */ - - hid_t vds_sid = -1; /* VDS dataspace ID */ - hid_t vds_dcplid = -1; /* VDS dataset property list ID */ - - hid_t fid = -1; /* HDF5 file ID */ - hid_t did = -1; /* dataset ID */ - hid_t msid = -1; /* memory dataspace ID */ - hid_t fsid = -1; /* file dataspace ID */ - - /* Hyperslab arrays */ - hsize_t start[RANK] = {0, 0, 0}; - hsize_t count[RANK] = {H5S_UNLIMITED, 1, 1}; - - int *buffer = NULL; /* data buffer */ - int value = -1; /* value written to datasets */ - - hsize_t n = 0; /* number of elements in a plane */ - - int i; /* iterator */ - int j; /* iterator */ - hsize_t k; /* iterator */ - - /************************************ - * Create source files and datasets * - ************************************/ - - /* Create source dataspace ID */ - if((src_sid = H5Screate_simple(RANK, UC_4_SOURCE_DIMS, - UC_4_SOURCE_MAX_DIMS)) < 0) - UC_ERROR - if(H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL, - UC_4_SOURCE_MAX_DIMS, NULL) < 0) - UC_ERROR - - /* Create source files and datasets */ - for(i = 0; i < UC_4_N_SOURCES; i++) { - - /* source dataset dcpl */ - if((src_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) - UC_ERROR - if(H5Pset_chunk(src_dcplid, RANK, UC_4_PLANE) < 0) - UC_ERROR - if(H5Pset_fill_value(src_dcplid, UC_4_SOURCE_DATATYPE, - &UC_4_FILL_VALUES[i]) < 0) - UC_ERROR - if(H5Pset_deflate(src_dcplid, COMPRESSION_LEVEL) < 0) - UC_ERROR - - /* Create source file and dataset */ - if((fid = H5Fcreate(UC_4_FILE_NAMES[i], H5F_ACC_TRUNC, - H5P_DEFAULT, H5P_DEFAULT)) < 0) - UC_ERROR - if((did = H5Dcreate2(fid, UC_4_SOURCE_DSET_NAME, - UC_4_SOURCE_DATATYPE, src_sid, - H5P_DEFAULT, src_dcplid, H5P_DEFAULT)) < 0) - UC_ERROR - - /* Set the dataset's extent */ - if(H5Dset_extent(did, UC_4_SOURCE_MAX_DIMS) < 0) - UC_ERROR - - /* Create a data buffer that represents a plane */ - n = UC_4_PLANE[1] * UC_4_PLANE[2]; - if(NULL == (buffer = (int *)malloc(n * sizeof(int)))) - UC_ERROR - - /* Create the memory dataspace */ - if((msid = H5Screate_simple(RANK, UC_4_PLANE, NULL)) < 0) - UC_ERROR - - /* Get the file dataspace */ - if((fsid = H5Dget_space(did)) < 0) - UC_ERROR - - /* Write planes to the dataset */ - for(j = 0; j < UC_4_SRC_PLANES; j++) { - - value = ((i + 1) * 10) + j; - for(k = 0; k < n; k++) - buffer[k] = value; - - start[0] = (hsize_t)j; - start[1] = 0; - start[2] = 0; - if(H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, UC_4_PLANE, NULL) < 0) - UC_ERROR - if(H5Dwrite(did, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, buffer) < 0) - UC_ERROR - - } /* end for */ - - /* close */ - if(H5Sclose(msid) < 0) - UC_ERROR - if(H5Sclose(fsid) < 0) - UC_ERROR - if(H5Pclose(src_dcplid) < 0) - UC_ERROR - if(H5Dclose(did) < 0) - UC_ERROR - if(H5Fclose(fid) < 0) - UC_ERROR - free(buffer); - - } /* end for */ - - /******************* - * Create VDS file * - *******************/ - - /* Create file */ - if((fid = H5Fcreate(UC_4_VDS_FILE_NAME, H5F_ACC_TRUNC, - H5P_DEFAULT, H5P_DEFAULT)) < 0) - UC_ERROR - - /* Create VDS dcpl */ - if((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) - UC_ERROR - if(H5Pset_fill_value(vds_dcplid, UC_4_VDS_DATATYPE, - &UC_4_VDS_FILL_VALUE) < 0) - UC_ERROR - - /* Create VDS dataspace */ - if((vds_sid = H5Screate_simple(RANK, UC_4_VDS_DIMS, - UC_4_VDS_MAX_DIMS)) < 0) - UC_ERROR - start[0] = 0; - start[1] = 0; - start[2] = 0; - if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, start, - UC_4_SOURCE_MAX_DIMS, count, UC_4_SOURCE_MAX_DIMS) < 0) - UC_ERROR - - /* Add VDS mapping - The mapped file name uses a printf-like - * naming scheme that automatically maps new files. - */ - if(H5Pset_virtual(vds_dcplid, vds_sid, UC_4_MAPPING_FILE_NAME, - UC_4_SOURCE_DSET_PATH, src_sid) < 0) - UC_ERROR - - /* Create dataset */ - if((did = H5Dcreate2(fid, UC_4_VDS_DSET_NAME, UC_4_VDS_DATATYPE, vds_sid, - H5P_DEFAULT, vds_dcplid, H5P_DEFAULT)) < 0) - UC_ERROR - - /* close */ - if(H5Sclose(src_sid) < 0) - UC_ERROR - if(H5Pclose(vds_dcplid) < 0) - UC_ERROR - if(H5Sclose(vds_sid) < 0) - UC_ERROR - if(H5Dclose(did) < 0) - UC_ERROR - if(H5Fclose(fid) < 0) - UC_ERROR - - return EXIT_SUCCESS; - -error: - - H5E_BEGIN_TRY { - if(src_sid >= 0) - (void)H5Sclose(src_sid); - if(src_dcplid >= 0) - (void)H5Pclose(src_dcplid); - if(vds_sid >= 0) - (void)H5Sclose(vds_sid); - if(vds_dcplid >= 0) - (void)H5Pclose(vds_dcplid); - if(fid >= 0) - (void)H5Fclose(fid); - if(did >= 0) - (void)H5Dclose(did); - if(msid >= 0) - (void)H5Sclose(msid); - if(fsid >= 0) - (void)H5Sclose(fsid); - if(buffer != NULL) - free(buffer); - } H5E_END_TRY - - return EXIT_FAILURE; - -} /* end main() */ - diff --git a/tools/misc/vds/UC_5.h b/tools/misc/vds/UC_5.h deleted file mode 100644 index 96b2af3..0000000 --- a/tools/misc/vds/UC_5.h +++ /dev/null @@ -1,83 +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 UC_5_H -#define UC_5_H - -#include <hdf5.h> - -#include "UC_common.h" - -/* - * Definitions for VDS use case 5 - * - * Source datasets have one unlimited dimension and two fixed dimensions. In - * this use case, the datasets are mapped in the VDS so that alternating - * planes in the source are interleaved in the VDS. - */ - -/* virtual dataset <---> source dataset mapping and sizes */ - -#define UC_5_N_SOURCES 3 - -/* Dataset dimensions */ -#define UC_5_SRC_PLANES 3 -#define UC_5_HEIGHT 4 -#define UC_5_WIDTH 4 - -/* max number of planes for datasets */ -#define UC_5_MAX_PLANES H5S_UNLIMITED -#define UC_5_N_TEST_PLANES 9 /* number of planes in VDS */ - -/* Dataset datatypes */ -#define UC_5_SOURCE_DATATYPE H5T_STD_I32LE -#define UC_5_VDS_DATATYPE H5T_STD_I32LE - -/* Starting size of datasets, both source and VDS */ -static hsize_t UC_5_SOURCE_DIMS[RANK] = {0, UC_5_HEIGHT, UC_5_WIDTH}; -static hsize_t UC_5_VDS_DIMS[RANK] = {0, UC_5_HEIGHT, UC_5_WIDTH}; - -/* Max size of datasets, both source and VDS */ -static hsize_t UC_5_SOURCE_MAX_DIMS[RANK] = {UC_5_MAX_PLANES, UC_5_HEIGHT, UC_5_WIDTH}; -static hsize_t UC_5_VDS_MAX_DIMS[RANK] = {UC_5_MAX_PLANES, UC_5_HEIGHT, UC_5_WIDTH}; - -/* Planes (both source and VDS) */ -static hsize_t UC_5_PLANE[RANK] = {1, UC_5_HEIGHT, UC_5_WIDTH}; - -/* File names for source datasets */ -static char UC_5_FILE_NAMES[UC_5_N_SOURCES][NAME_LEN] = { - {"5_a.h5"}, - {"5_b.h5"}, - {"5_c.h5"} -}; - -/* VDS file name */ -static char UC_5_VDS_FILE_NAME[NAME_LEN] = "5_vds.h5"; - -/* Dataset names */ -static char UC_5_SOURCE_DSET_NAME[NAME_LEN] = "source_dset"; -static char UC_5_SOURCE_DSET_PATH[NAME_LEN] = "/source_dset"; -static char UC_5_VDS_DSET_NAME[NAME_LEN] = "vds_dset"; - -/* Fill values */ -static int UC_5_FILL_VALUES[UC_5_N_SOURCES] = { - -1, - -2, - -3 -}; -static int UC_5_VDS_FILL_VALUE = -9; - -#endif /* UC_5_H */ - diff --git a/tools/misc/vds/UC_5_stride_gen.c b/tools/misc/vds/UC_5_stride_gen.c deleted file mode 100644 index 38d24a6..0000000 --- a/tools/misc/vds/UC_5_stride_gen.c +++ /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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * File/dataset generator for VDS use case 5 - * - * See the header file for a description. - */ - -#include <stdlib.h> - -#include <hdf5.h> - -#include "UC_common.h" -#include "UC_5.h" - -int -main(void) -{ - hid_t src_sid = -1; /* source dataset's dataspace ID */ - hid_t src_dcplid = -1; /* source dataset property list ID */ - - hid_t vds_sid = -1; /* VDS dataspace ID */ - hid_t vds_dcplid = -1; /* VDS dataset property list ID */ - - hid_t fid = -1; /* HDF5 file ID */ - hid_t did = -1; /* dataset ID */ - hid_t msid = -1; /* memory dataspace ID */ - hid_t fsid = -1; /* file dataspace ID */ - - hsize_t extent[RANK]; /* source dataset extents */ - hsize_t start[RANK]; /* starting point for hyperslab */ - hsize_t stride[RANK]; /* hypserslab stride */ - hsize_t count[RANK]; /* hypserslab count */ - hsize_t map_start = 0; /* starting point in the VDS map */ - - int *buffer = NULL; /* data buffer */ - int value = -1; /* value written to datasets */ - - hsize_t n = 0; /* number of elements in a plane */ - - int i; /* iterator */ - int j; /* iterator */ - hsize_t k; /* iterator */ - - /* Start by creating the virtual dataset (VDS) dataspace and creation - * property list. The individual source datasets are then created - * and the VDS map (stored in the VDS property list) is updated. - */ - - /* Create VDS dcpl */ - if((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) - UC_ERROR - if(H5Pset_fill_value(vds_dcplid, UC_5_VDS_DATATYPE, - &UC_5_VDS_FILL_VALUE) < 0) - UC_ERROR - - /* Create VDS dataspace */ - if((vds_sid = H5Screate_simple(RANK, UC_5_VDS_DIMS, - UC_5_VDS_MAX_DIMS)) < 0) - UC_ERROR - - /********************************* - * Map source files and datasets * - *********************************/ - - /* Hyperslab array setup */ - start[0] = 0; - start[1] = 0; - start[2] = 0; - map_start = 0; - - stride[0] = UC_5_N_SOURCES; - stride[1] = 1; - stride[2] = 1; - - count[0] = H5S_UNLIMITED; - count[1] = 1; - count[2] = 1; - - extent[0] = UC_5_SRC_PLANES; - extent[1] = UC_5_HEIGHT; - extent[2] = UC_5_WIDTH; - - for(i = 0; i < UC_5_N_SOURCES; i++) { - - /* source dataset dcpl */ - if((src_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) - UC_ERROR - if(H5Pset_chunk(src_dcplid, RANK, UC_5_PLANE) < 0) - UC_ERROR - if(H5Pset_fill_value(src_dcplid, UC_5_SOURCE_DATATYPE, - &UC_5_FILL_VALUES[i]) < 0) - UC_ERROR - if(H5Pset_deflate(src_dcplid, COMPRESSION_LEVEL) < 0) - UC_ERROR - - /* Create source file, dataspace, and dataset */ - if((fid = H5Fcreate(UC_5_FILE_NAMES[i], H5F_ACC_TRUNC, - H5P_DEFAULT, H5P_DEFAULT)) < 0) - UC_ERROR - if((src_sid = H5Screate_simple(RANK, UC_5_SOURCE_DIMS, - UC_5_SOURCE_MAX_DIMS)) < 0) - UC_ERROR - if((did = H5Dcreate2(fid, UC_5_SOURCE_DSET_NAME, - UC_5_SOURCE_DATATYPE, src_sid, - H5P_DEFAULT, src_dcplid, H5P_DEFAULT)) < 0) - UC_ERROR - - /* Set the dataset's extent */ - if(H5Dset_extent(did, extent) < 0) - UC_ERROR - - /* Create a data buffer that represents a plane */ - n = UC_5_PLANE[1] * UC_5_PLANE[2]; - if(NULL == (buffer = (int *)malloc(n * sizeof(int)))) - UC_ERROR - - /* Create the memory dataspace */ - if((msid = H5Screate_simple(RANK, UC_5_PLANE, NULL)) < 0) - UC_ERROR - - /* Get the file dataspace */ - if((fsid = H5Dget_space(did)) < 0) - UC_ERROR - - /* Write planes to the dataset */ - for(j = 0; j < UC_5_SRC_PLANES; j++) { - - value = ((i + 1) * 10) + j; - for(k = 0; k < n; k++) - buffer[k] = value; - - start[0] = (hsize_t)j; - start[1] = 0; - start[2] = 0; - if(H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, UC_5_PLANE, NULL) < 0) - UC_ERROR - if(H5Dwrite(did, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, buffer) < 0) - UC_ERROR - - } /* end for */ - - /* set up hyperslabs for source and destination datasets */ - start[0] = 0; - start[1] = 0; - start[2] = 0; - if(H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL, - UC_5_SOURCE_MAX_DIMS, NULL) < 0) - UC_ERROR - start[0] = map_start; - if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, start, stride, - count, UC_5_PLANE) < 0) - UC_ERROR - map_start += 1; - - /* Add VDS mapping */ - if(H5Pset_virtual(vds_dcplid, vds_sid, UC_5_FILE_NAMES[i], - UC_5_SOURCE_DSET_PATH, src_sid) < 0) - UC_ERROR - - /* close */ - if(H5Sclose(msid) < 0) - UC_ERROR - if(H5Sclose(fsid) < 0) - UC_ERROR - if(H5Sclose(src_sid) < 0) - UC_ERROR - if(H5Pclose(src_dcplid) < 0) - UC_ERROR - if(H5Dclose(did) < 0) - UC_ERROR - if(H5Fclose(fid) < 0) - UC_ERROR - free(buffer); - - } /* end for */ - - /******************* - * Create VDS file * - *******************/ - - /* file */ - if((fid = H5Fcreate(UC_5_VDS_FILE_NAME, H5F_ACC_TRUNC, - H5P_DEFAULT, H5P_DEFAULT)) < 0) - UC_ERROR - - /* dataset */ - if((did = H5Dcreate2(fid, UC_5_VDS_DSET_NAME, UC_5_VDS_DATATYPE, vds_sid, - H5P_DEFAULT, vds_dcplid, H5P_DEFAULT)) < 0) - UC_ERROR - - /* close */ - if(H5Pclose(vds_dcplid) < 0) - UC_ERROR - if(H5Sclose(vds_sid) < 0) - UC_ERROR - if(H5Dclose(did) < 0) - UC_ERROR - if(H5Fclose(fid) < 0) - UC_ERROR - - return EXIT_SUCCESS; - -error: - - H5E_BEGIN_TRY { - if(src_sid >= 0) - (void)H5Sclose(src_sid); - if(src_dcplid >= 0) - (void)H5Pclose(src_dcplid); - if(vds_sid >= 0) - (void)H5Sclose(vds_sid); - if(vds_dcplid >= 0) - (void)H5Pclose(vds_dcplid); - if(fid >= 0) - (void)H5Fclose(fid); - if(did >= 0) - (void)H5Dclose(did); - if(msid >= 0) - (void)H5Sclose(msid); - if(fsid >= 0) - (void)H5Sclose(fsid); - if(buffer != NULL) - free(buffer); - } H5E_END_TRY - - return EXIT_FAILURE; - -} /* end main() */ - diff --git a/tools/misc/vds/UC_common.h b/tools/misc/vds/UC_common.h deleted file mode 100644 index 0e61016..0000000 --- a/tools/misc/vds/UC_common.h +++ /dev/null @@ -1,41 +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 USE_CASE_COMMON_H -#define USE_CASE_COMMON_H - -/****************************************** - * Symbols used across multiple use cases * - ******************************************/ - -/* All datasets are 3D */ -#define RANK 3 - -/* Lengths of string identifiers (file, dataset names, etc.) */ -#define NAME_LEN 32 - -/* Compression level */ -#define COMPRESSION_LEVEL 7 - -/* Booleans */ -#define TRUE 1 -#define FALSE 0 - -/* Testing macros */ -#define AT() printf (" at %s:%d in %s()...\n", __FILE__, __LINE__, __func__); -#define UC_ERROR {puts("*ERROR*"); fflush(stdout); AT(); goto error;} - -#endif /* USE_CASE_COMMON_H */ - |