summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2014-11-04 16:44:39 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2014-11-04 16:44:39 (GMT)
commit33a18df797719e423543ed8a177d886bc85b275d (patch)
tree80cdc8835e08817d91f99d9a5419de5b18fa8963
parentb1e97e651528704283fa42445120426080e0817f (diff)
parent52bff896a7e57d1c1b19438b8be76b2cb01ae94b (diff)
downloadhdf5-33a18df797719e423543ed8a177d886bc85b275d.zip
hdf5-33a18df797719e423543ed8a177d886bc85b275d.tar.gz
hdf5-33a18df797719e423543ed8a177d886bc85b275d.tar.bz2
[svn-r25778] merge from trunk.
-rw-r--r--MANIFEST2
-rw-r--r--README.txt2
-rwxr-xr-xbin/cmakehdf52
-rw-r--r--c++/src/Makefile.in2
-rw-r--r--config/cmake/cacheinit.cmake4
-rw-r--r--config/cmake/hdf5-config.cmake.in2
-rw-r--r--config/cmake/mccacheinit.cmake4
-rw-r--r--config/gnu-flags2
-rw-r--r--config/lt_vers.am2
-rwxr-xr-xconfigure22
-rw-r--r--configure.ac2
-rw-r--r--fortran/src/H5Sf.c14
-rw-r--r--fortran/src/H5Sff.f9014
-rw-r--r--fortran/src/H5f90proto.h4
-rw-r--r--fortran/src/Makefile.in2
-rw-r--r--hl/c++/src/Makefile.in2
-rw-r--r--hl/fortran/src/Makefile.in2
-rw-r--r--hl/src/H5DS.c6
-rw-r--r--hl/src/Makefile.in2
-rw-r--r--release_docs/INSTALL_CMake.txt15
-rw-r--r--release_docs/RELEASE.txt2
-rw-r--r--release_docs/USING_HDF5_CMake.txt2
-rw-r--r--src/H5Dchunk.c4
-rw-r--r--src/H5Dcontig.c2
-rw-r--r--src/H5Ddeprec.c6
-rw-r--r--src/H5Defl.c2
-rw-r--r--src/H5Dint.c8
-rw-r--r--src/H5Dio.c34
-rw-r--r--src/H5Dmpio.c2
-rw-r--r--src/H5Edefin.h1
-rw-r--r--src/H5Einit.h5
-rw-r--r--src/H5Epubgen.h2
-rw-r--r--src/H5Eterm.h3
-rw-r--r--src/H5Omessage.c2
-rw-r--r--src/H5S.c3
-rw-r--r--src/H5Sall.c19
-rw-r--r--src/H5Sdbg.c2
-rw-r--r--src/H5Shyper.c3996
-rw-r--r--src/H5Smpio.c2
-rw-r--r--src/H5Snone.c4
-rw-r--r--src/H5Spkg.h31
-rw-r--r--src/H5Spoint.c150
-rw-r--r--src/H5Sprivate.h12
-rw-r--r--src/H5Spublic.h7
-rw-r--r--src/H5Sselect.c147
-rw-r--r--src/H5Stest.c273
-rw-r--r--src/H5VLnative.c2
-rw-r--r--src/H5Z.c2
-rw-r--r--src/H5Znbit.c2
-rw-r--r--src/H5Zscaleoffset.c2
-rw-r--r--src/H5Zszip.c2
-rw-r--r--src/H5err.txt1
-rw-r--r--src/H5public.h4
-rw-r--r--src/H5trace.c2
-rw-r--r--src/Makefile.in2
-rw-r--r--test/h5test.c21
-rw-r--r--test/tselect.c1827
-rw-r--r--tools/h5copy/h5copy.c4
-rw-r--r--tools/h5diff/CMakeTests.cmake7
-rw-r--r--tools/h5diff/testh5diff.sh.in7
-rw-r--r--tools/h5dump/CMakeTests.cmake6
-rw-r--r--tools/h5dump/h5dumpgentest.c154
-rw-r--r--tools/lib/h5diff.c14
-rw-r--r--tools/lib/h5tools_ref.c2
-rw-r--r--tools/testfiles/tbitnopaque.ddl293
-rw-r--r--tools/testfiles/tbitnopaque.h5bin0 -> 8240 bytes
-rw-r--r--vms/src/h5pubconf.h6
67 files changed, 2777 insertions, 4411 deletions
diff --git a/MANIFEST b/MANIFEST
index c28d4be..663de3a 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1481,6 +1481,8 @@
./tools/testfiles/tbinregR.exp
./tools/testfiles/tbinregR.ddl
./tools/testfiles/tbitfields.h5
+./tools/testfiles/tbitnopaque.ddl
+./tools/testfiles/tbitnopaque.h5
./tools/testfiles/tboot1.ddl
./tools/testfiles/tboot2.ddl
./tools/testfiles/tboot2A.ddl
diff --git a/README.txt b/README.txt
index dfd5dc3..2ffe230 100644
--- a/README.txt
+++ b/README.txt
@@ -1,4 +1,4 @@
-HDF5 version 1.9.200 currently under development
+HDF5 version 1.9.203 currently under development
Please refer to the release_docs/INSTALL file for installation instructions.
------------------------------------------------------------------------------
diff --git a/bin/cmakehdf5 b/bin/cmakehdf5
index baba3f1..68a550e 100755
--- a/bin/cmakehdf5
+++ b/bin/cmakehdf5
@@ -213,7 +213,7 @@ set (SITE_BUILDNAME_SUFFIX "cmakehdf5")
# -- URL set for internal check, default is to not update
set (LOCAL_SKIP_UPDATE TRUE)
-set (REPOSITORY_URL "http://svn.hdfgroup.uiuc.edu/hdf5/branches/hdf5_1_8")
+set (REPOSITORY_URL "http://svn.${hdfgroup_url}/hdf5/branches/hdf5_1_8")
# -- Standard build options
set (ADD_BUILD_OPTIONS "-DCMAKE_INSTALL_PREFIX:PATH=${CTEST_BINARY_DIRECTORY} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=\"SVN\" -DHDF5_PACKAGE_EXTLIBS:BOOL=ON")
diff --git a/c++/src/Makefile.in b/c++/src/Makefile.in
index 1f0dad7..462925e 100644
--- a/c++/src/Makefile.in
+++ b/c++/src/Makefile.in
@@ -683,7 +683,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog
# After making changes, run bin/reconfigure to update other configure related
# files like Makefile.in.
LT_VERS_INTERFACE = 6
-LT_VERS_REVISION = 190
+LT_VERS_REVISION = 193
LT_VERS_AGE = 0
# This is our main target
diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake
index e8a5029..2c34e69 100644
--- a/config/cmake/cacheinit.cmake
+++ b/config/cmake/cacheinit.cmake
@@ -65,10 +65,6 @@ set (HDF5_NO_PACKAGES OFF CACHE BOOL "CPACK - Disable packaging" FORCE)
set (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building (NO SVN TGZ)" FORCE)
set_property (CACHE HDF5_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO SVN TGZ)
-set (ZLIB_SVN_URL "http://svn.hdfgroup.uiuc.edu/zlib/trunk" CACHE STRING "Use ZLib from HDF repository" FORCE)
-
-set (SZIP_SVN_URL "http://svn.hdfgroup.uiuc.edu/szip/trunk" CACHE STRING "Use SZip from HDF repository" FORCE)
-
set (ZLIB_TGZ_NAME "ZLib.tar.gz" CACHE STRING "Use ZLib from compressed file" FORCE)
set (SZIP_TGZ_NAME "SZip.tar.gz" CACHE STRING "Use SZip from compressed file" FORCE)
diff --git a/config/cmake/hdf5-config.cmake.in b/config/cmake/hdf5-config.cmake.in
index 79223d1..3e74aa7 100644
--- a/config/cmake/hdf5-config.cmake.in
+++ b/config/cmake/hdf5-config.cmake.in
@@ -79,7 +79,7 @@ if (NOT TARGET "@HDF5_PACKAGE@")
if (HDF5_ENABLE_SZIP_SUPPORT AND HDF5_PACKAGE_EXTLIBS AND NOT TARGET "szip")
include (@PACKAGE_SHARE_INSTALL_DIR@/SZIP/@SZIP_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake)
endif (HDF5_ENABLE_SZIP_SUPPORT AND HDF5_PACKAGE_EXTLIBS AND NOT TARGET "szip")
- include (@PACKAGE_SHARE_INSTALL_DIR@/hdf5/@HDF5_PACKAGE@@HDF_PACKAGE_EXT@-targets.cmake)
+ include (@PACKAGE_SHARE_INSTALL_DIR@/@HDF5_PACKAGE@@HDF_PACKAGE_EXT@-targets.cmake)
set (HDF5_LIBRARIES "@HDF5_LIBRARIES_TO_EXPORT@")
endif (NOT TARGET "@HDF5_PACKAGE@")
diff --git a/config/cmake/mccacheinit.cmake b/config/cmake/mccacheinit.cmake
index 2913f32..a07e278 100644
--- a/config/cmake/mccacheinit.cmake
+++ b/config/cmake/mccacheinit.cmake
@@ -65,10 +65,6 @@ set (HDF5_NO_PACKAGES ON CACHE BOOL "CPACK - Disable packaging" FORCE)
set (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building (NO SVN TGZ)" FORCE)
set_property (CACHE HDF5_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO SVN TGZ)
-set (ZLIB_SVN_URL "http://svn.hdfgroup.uiuc.edu/zlib/trunk" CACHE STRING "Use ZLib from HDF repository" FORCE)
-
-set (SZIP_SVN_URL "http://svn.hdfgroup.uiuc.edu/szip/trunk" CACHE STRING "Use SZip from HDF repository" FORCE)
-
set (ZLIB_TGZ_NAME "ZLib.tar.gz" CACHE STRING "Use ZLib from compressed file" FORCE)
set (SZIP_TGZ_NAME "SZip.tar.gz" CACHE STRING "Use SZip from compressed file" FORCE)
diff --git a/config/gnu-flags b/config/gnu-flags
index 5f36eaa..6c33808 100644
--- a/config/gnu-flags
+++ b/config/gnu-flags
@@ -321,7 +321,7 @@ case "$cc_vendor-$cc_version" in
H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat"
# Append more extra warning flags that only gcc 4.5+ know about
- H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants"
+ H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init"
# Append more extra warning flags that only gcc 4.6+ know about
H5_CFLAGS="$H5_CFLAGS -Wdouble-promotion -Wsuggest-attribute=const -Wtrampolines"
diff --git a/config/lt_vers.am b/config/lt_vers.am
index 669f4eb..76bd50a 100644
--- a/config/lt_vers.am
+++ b/config/lt_vers.am
@@ -19,7 +19,7 @@
# After making changes, run bin/reconfigure to update other configure related
# files like Makefile.in.
LT_VERS_INTERFACE = 6
-LT_VERS_REVISION = 190
+LT_VERS_REVISION = 193
LT_VERS_AGE = 0
## If the API changes *at all*, increment LT_VERS_INTERFACE and
diff --git a/configure b/configure
index 2a4a4b8..cb2528a 100755
--- a/configure
+++ b/configure
@@ -1,7 +1,7 @@
#! /bin/sh
# From configure.ac Id: configure.ac 22697 2012-08-19 14:35:47Z hdftest .
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for HDF5 1.9.200.
+# Generated by GNU Autoconf 2.69 for HDF5 1.9.203.
#
# Report bugs to <help@hdfgroup.org>.
#
@@ -591,8 +591,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='HDF5'
PACKAGE_TARNAME='hdf5'
-PACKAGE_VERSION='1.9.200'
-PACKAGE_STRING='HDF5 1.9.200'
+PACKAGE_VERSION='1.9.203'
+PACKAGE_STRING='HDF5 1.9.203'
PACKAGE_BUGREPORT='help@hdfgroup.org'
PACKAGE_URL=''
@@ -1489,7 +1489,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures HDF5 1.9.200 to adapt to many kinds of systems.
+\`configure' configures HDF5 1.9.203 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1559,7 +1559,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of HDF5 1.9.200:";;
+ short | recursive ) echo "Configuration of HDF5 1.9.203:";;
esac
cat <<\_ACEOF
@@ -1752,7 +1752,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-HDF5 configure 1.9.200
+HDF5 configure 1.9.203
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2846,7 +2846,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by HDF5 $as_me 1.9.200, which was
+It was created by HDF5 $as_me 1.9.203, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3717,7 +3717,7 @@ fi
# Define the identity of the package.
PACKAGE='hdf5'
- VERSION='1.9.200'
+ VERSION='1.9.203'
cat >>confdefs.h <<_ACEOF
@@ -31736,7 +31736,7 @@ Usage: $0 [OPTIONS]
Report bugs to <bug-libtool@gnu.org>."
lt_cl_version="\
-HDF5 config.lt 1.9.200
+HDF5 config.lt 1.9.203
configured by $0, generated by GNU Autoconf 2.69.
Copyright (C) 2011 Free Software Foundation, Inc.
@@ -33878,7 +33878,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by HDF5 $as_me 1.9.200, which was
+This file was extended by HDF5 $as_me 1.9.203, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -33944,7 +33944,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-HDF5 config.status 1.9.200
+HDF5 config.status 1.9.203
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index 9fbe6f8..36c9751 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,7 +26,7 @@ AC_PREREQ([2.69])
## NOTE: Do not forget to change the version number here when we do a
## release!!!
##
-AC_INIT([HDF5], [1.9.200], [help@hdfgroup.org])
+AC_INIT([HDF5], [1.9.203], [help@hdfgroup.org])
AC_CONFIG_SRCDIR([src/H5.c])
AC_CONFIG_HEADER([src/H5config.h])
diff --git a/fortran/src/H5Sf.c b/fortran/src/H5Sf.c
index d738fda..f6803ac 100644
--- a/fortran/src/H5Sf.c
+++ b/fortran/src/H5Sf.c
@@ -1002,6 +1002,8 @@ done:
return ret_value;
}
+
+#ifdef NEW_HYPERSLAB_API
/****if* H5Sf/h5scombine_hyperslab_c
* NAME
* h5scombine_hyperslab_c
@@ -1125,11 +1127,11 @@ nh5scombine_select_c ( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id, hid_t
ret_value = 0;
return ret_value;
}
-/****if* H5Sf/h5smodify_select_c
+/****if* H5Sf/h5sselect_select_c
* NAME
- * h5smodify_select_c
+ * h5sselect_select_c
* PURPOSE
- * Call H5Smodify_select
+ * Call H5Sselect_ select
* INPUTS
* space1_id - identifier of the first dataspace to modify
* operator - defines how the new selection is combined
@@ -1145,7 +1147,7 @@ nh5scombine_select_c ( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id, hid_t
*/
int_f
-nh5smodify_select_c ( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id)
+nh5sselect_select_c ( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id)
/******/
{
int ret_value = -1;
@@ -1157,11 +1159,11 @@ nh5smodify_select_c ( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id)
c_space1_id = (hid_t)*space1_id;
c_space2_id = (hid_t)*space2_id;
- if( H5Smodify_select(c_space1_id, c_op, c_space2_id)< 0) return ret_value;
+ if( H5Sselect_select(c_space1_id, c_op, c_space2_id)< 0) return ret_value;
ret_value = 0;
return ret_value;
}
-
+#endif /*NEW_HYPERSLAB_API*/
/****if* H5Sf/h5sget_select_type_c
* NAME
* h5sget_select_type_c
diff --git a/fortran/src/H5Sff.f90 b/fortran/src/H5Sff.f90
index 651c2c0..c493d46 100644
--- a/fortran/src/H5Sff.f90
+++ b/fortran/src/H5Sff.f90
@@ -1611,7 +1611,7 @@ CONTAINS
! !$!****s* H5S/
! !$!
! !$! NAME
-! !$! h5smodify_select_f
+! !$! h5sselect_select_f
! !$!
! !$! PURPOSE
! !$! Refine a hyperslab selection with an operation
@@ -1648,7 +1648,7 @@ CONTAINS
! !$!
! ! SOURCE
-! SUBROUTINE h5smodify_select_f(space1_id, operator, space2_id, &
+! SUBROUTINE h5sselect_select_f(space1_id, operator, space2_id, &
! hdferr)
! IMPLICIT NONE
! INTEGER(HID_T), INTENT(INOUT) :: space1_id ! Dataspace identifier to
@@ -1668,22 +1668,22 @@ CONTAINS
! INTEGER, INTENT(OUT) :: hdferr ! Error code
! INTERFACE
-! INTEGER FUNCTION h5smodify_select_c(space1_id, operator, &
+! INTEGER FUNCTION h5sselect_select_c(space1_id, operator, &
! space2_id)
! USE H5GLOBAL
! !DEC$IF DEFINED(HDF5F90_WINDOWS)
-! !DEC$ATTRIBUTES C,reference,decorate,alias:'H5SMODIFY_SELECT_C'::h5smodify_select_c
+! !DEC$ATTRIBUTES C,reference,decorate,alias:'H5SSELECT_SELECT_C'::h5sselect_select_c
! !DEC$ENDIF
! INTEGER(HID_T), INTENT(INOUT) :: space1_id
! INTEGER(HID_T), INTENT(IN) :: space2_id
! INTEGER, INTENT(IN) :: operator
-! END FUNCTION h5smodify_select_c
+! END FUNCTION h5sselect_select_c
! END INTERFACE
-! hdferr = h5smodify_select_c(space1_id, operator, space2_id)
+! hdferr = h5sselect_select_c(space1_id, operator, space2_id)
! return
-! END SUBROUTINE h5smodify_select_f
+! END SUBROUTINE h5sselect_select_f
!
!****s* H5S/h5sget_select_type_f
diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h
index 7c712d4..08a8f31 100644
--- a/fortran/src/H5f90proto.h
+++ b/fortran/src/H5f90proto.h
@@ -143,7 +143,7 @@ H5_FCDLL int_f nh5fget_filesize_c(hid_t_f *file_id, hsize_t_f *size);
#define nh5sselect_hyperslab_c H5_FC_FUNC_(h5sselect_hyperslab_c, H5SSELECT_HYPERSLAB_C)
#define nh5scombine_hyperslab_c H5_FC_FUNC_(h5scombine_hyperslab_c, H5SCOMBINE_HYPERSLAB_C)
#define nh5scombine_select_c H5_FC_FUNC_(h5scombine_select_c, H5SCOMBINE_SELECT_C)
-#define nh5smodify_select_c H5_FC_FUNC_(h5smodify_select_c, H5SMODIFY_SELECT_C)
+#define nh5sselect_select_c H5_FC_FUNC_(h5sselect_select_c, H5SSELECT_SELECT_C)
#define nh5sget_select_type_c H5_FC_FUNC_(h5sget_select_type_c, H5SGET_SELECT_TYPE_C)
#define nh5sselect_elements_c H5_FC_FUNC_(h5sselect_elements_c, H5SSELECT_ELEMENTS_C)
#define nh5sdecode_c H5_FC_FUNC_(h5sdecode_c, H5SDECODE_C)
@@ -178,7 +178,7 @@ H5_FCDLL int_f nh5sget_select_type_c ( hid_t_f *space_id , int_f *op);
H5_FCDLL int_f nh5sselect_elements_c ( hid_t_f *space_id , int_f *op, size_t_f *nelements, hsize_t_f *coord);
H5_FCDLL int_f nh5scombine_hyperslab_c ( hid_t_f *space_id , int_f *op, hsize_t_f *start, hsize_t_f *count, hsize_t_f *stride, hsize_t_f *block, hid_t_f *hyper_id);
H5_FCDLL int_f nh5scombine_select_c ( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id, hid_t_f *ds_id);
-H5_FCDLL int_f nh5smodify_select_c ( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id);
+H5_FCDLL int_f nh5sselect_select_c ( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id);
H5_FCDLL int_f nh5sdecode_c ( _fcd buf, hid_t_f *obj_id );
H5_FCDLL int_f nh5sencode_c (_fcd buf, hid_t_f *obj_id, size_t_f *nalloc );
H5_FCDLL int_f nh5sextent_equal_c ( hid_t_f * space1_id, hid_t_f *space2_id, hid_t_f *c_equal);
diff --git a/fortran/src/Makefile.in b/fortran/src/Makefile.in
index 615bac7..79f6f42 100644
--- a/fortran/src/Makefile.in
+++ b/fortran/src/Makefile.in
@@ -734,7 +734,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog
# After making changes, run bin/reconfigure to update other configure related
# files like Makefile.in.
LT_VERS_INTERFACE = 6
-LT_VERS_REVISION = 190
+LT_VERS_REVISION = 193
LT_VERS_AGE = 0
AM_FCLIBS = $(LIBHDF5)
diff --git a/hl/c++/src/Makefile.in b/hl/c++/src/Makefile.in
index 2e56780..ec5e670 100644
--- a/hl/c++/src/Makefile.in
+++ b/hl/c++/src/Makefile.in
@@ -675,7 +675,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog
# After making changes, run bin/reconfigure to update other configure related
# files like Makefile.in.
LT_VERS_INTERFACE = 6
-LT_VERS_REVISION = 190
+LT_VERS_REVISION = 193
LT_VERS_AGE = 0
# This is our main target
diff --git a/hl/fortran/src/Makefile.in b/hl/fortran/src/Makefile.in
index 2085cb5..2122d72 100644
--- a/hl/fortran/src/Makefile.in
+++ b/hl/fortran/src/Makefile.in
@@ -690,7 +690,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog
# After making changes, run bin/reconfigure to update other configure related
# files like Makefile.in.
LT_VERS_INTERFACE = 6
-LT_VERS_REVISION = 190
+LT_VERS_REVISION = 193
LT_VERS_AGE = 0
# Our main target, the high-level fortran library
diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c
index 66684d6..f4b754a 100644
--- a/hl/src/H5DS.c
+++ b/hl/src/H5DS.c
@@ -1549,7 +1549,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label)
/* free the ptr that will be replaced by label */
if (buf[idx])
- HDfree((void *)buf[idx]);
+ HDfree(buf[idx]);
/* store the label information in the required index */
buf[idx] = label;
@@ -1565,7 +1565,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label)
for (i = 0; i < (unsigned int) rank; i++)
{
if (buf[i])
- HDfree((void *)buf[i]);
+ HDfree(buf[i]);
}
/* close */
@@ -1592,7 +1592,7 @@ out:
for (i = 0; i < (unsigned int) rank; i++)
{
if (buf[i])
- HDfree((void *)buf[i]);
+ HDfree(buf[i]);
}
HDfree(buf);
}
diff --git a/hl/src/Makefile.in b/hl/src/Makefile.in
index 1ced4f8..76596a0 100644
--- a/hl/src/Makefile.in
+++ b/hl/src/Makefile.in
@@ -671,7 +671,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog
# After making changes, run bin/reconfigure to update other configure related
# files like Makefile.in.
LT_VERS_INTERFACE = 6
-LT_VERS_REVISION = 190
+LT_VERS_REVISION = 193
LT_VERS_AGE = 0
# This library is our main target.
diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt
index 40f8023..b831071 100644
--- a/release_docs/INSTALL_CMake.txt
+++ b/release_docs/INSTALL_CMake.txt
@@ -292,9 +292,8 @@ Notes: CMake and HDF5
how CMake support can be improved on any system. Visit the
KitWare site for more information about CMake.
- 3. Build and test results can be submitted to our CDash server at:
- cdash.hdfgroup.uiuc.edu.
- Please read the HDF and CDash document at:
+ 3. Build and test results can be submitted to our CDash server,
+ please read the HDF and CDash document at:
www.hdfgroup.org/CDash/HowToSubmit.
4. See the appendix at the bottom of this file for examples of using
@@ -404,8 +403,6 @@ These five steps are described in detail below.
set (HDF5_NO_PACKAGES OFF CACHE BOOL "CPACK - Disable packaging" FORCE)
set (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building (NO SVN TGZ)" FORCE)
set_property (CACHE HDF5_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO SVN TGZ)
- set (ZLIB_SVN_URL "http://svn.hdfgroup.uiuc.edu/zlib/trunk" CACHE STRING "Use ZLib from HDF repository" FORCE)
- set (SZIP_SVN_URL "http://svn.hdfgroup.uiuc.edu/szip/trunk" CACHE STRING "Use SZip from HDF repository" FORCE)
set (ZLIB_TGZ_NAME "ZLib.tar.gz" CACHE STRING "Use ZLib from compressed file" FORCE)
set (SZIP_TGZ_NAME "SZip.tar.gz" CACHE STRING "Use SZip from compressed file" FORCE)
set (ZLIB_PACKAGE_NAME "zlib" CACHE STRING "Name of ZLIB package" FORCE)
@@ -468,9 +465,9 @@ These five steps are described in detail below.
-DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING="SVN"
The options to control the SVN URL (config/cmake/cacheinit.cmake file) are:
- ZLIB_SVN_URL:STRING="http://svn.hdfgroup.uiuc.edu/zlib/trunk"
- SZIP_SVN_URL:STRING="http://svn.hdfgroup.uiuc.edu/szip/trunk"
- These should be changed to your location. Also define CMAKE_BUILD_TYPE
+ ZLIB_SVN_URL:STRING="http://${svn_url}/zlib/trunk"
+ SZIP_SVN_URL:STRING="http://${svn_url}/szip/trunk"
+ ${svn_url} should be changed to your location. Also define CMAKE_BUILD_TYPE
to be the configuration type.
3.2.2 Or the external libraries (zlib and szip) can be configured
@@ -693,7 +690,7 @@ set(SITE_BUILDNAME_SUFFIX "SHARED")
######### Following controls source update ##########
#set(LOCAL_UPDATE "TRUE")
######### Following controls source repository ##########
-#set(REPOSITORY_URL "http://svn.hdfgroup.uiuc.edu/hdf5/branches/hdf5_1_8")
+#set(REPOSITORY_URL "http://svn.${hdfgroup_url}/hdf5/branches/hdf5_1_8")
#comment to use a uncompressed source folder
set(CTEST_USE_TAR_SOURCE "hdf5-1.8.13")
###################################################################
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index c0a7a3c..718db26 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -1,4 +1,4 @@
-HDF5 version 1.9.200 currently under development
+HDF5 version 1.9.203 currently under development
================================================================================
diff --git a/release_docs/USING_HDF5_CMake.txt b/release_docs/USING_HDF5_CMake.txt
index 7f99028..6195dc3 100644
--- a/release_docs/USING_HDF5_CMake.txt
+++ b/release_docs/USING_HDF5_CMake.txt
@@ -254,7 +254,7 @@ set(SITE_COMPILER_NAME "compiler name")
set(SITE_COMPILER_VERSION "compiler version")
# needed for source updates, change as required
-set(REPOSITORY_URL "http://svn.hdfgroup.uiuc.edu/hdf5-examples/trunk/1_8")
+set(REPOSITORY_URL "http://svn.${hdfgroup_url}/hdf5-examples/trunk/1_8")
set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_INSTALL_PREFIX:PATH=/usr/local/hdf5Examples-1.8")
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index fdb1e22..46f0a4f 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -17,7 +17,7 @@
* Thursday, April 24, 2008
*
* Purpose: Abstract indexed (chunked) I/O functions. The logical
- * multi-dimensional dataspace is regularly partitioned into
+ * multi-dimensional data space is regularly partitioned into
* same-sized "chunks", the first of which is aligned with the
* logical origin. The chunks are indexed by different methods,
* that map a chunk index to disk address. Each chunk can be
@@ -329,7 +329,7 @@ H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters, hsiz
FUNC_ENTER_STATIC_TAG(dxpl_id, dset->oloc.addr, FAIL)
- /* Allocate dataspace and initialize it if it hasn't been. */
+ /* Allocate data space and initialize it if it hasn't been. */
if(!(*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout.storage)) {
/* Allocate storage */
if(H5D__alloc_storage(dset, dxpl_id, H5D_ALLOC_WRITE, FALSE, NULL) < 0)
diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c
index fc553df..8d4cd02 100644
--- a/src/H5Dcontig.c
+++ b/src/H5Dcontig.c
@@ -410,7 +410,7 @@ H5D__contig_construct(H5F_t *f, H5D_t *dset)
/*
* The maximum size of the dataset cannot exceed the storage size.
- * Also, only the slowest varying dimension of a simple dataspace
+ * Also, only the slowest varying dimension of a simple data space
* can be extendible (currently only for external data storage).
*/
diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c
index cf68652..e87cbdb 100644
--- a/src/H5Ddeprec.c
+++ b/src/H5Ddeprec.c
@@ -143,7 +143,7 @@ H5D__term_deprec_interface(void)
* properties (DCPL_ID).
*
* All arguments are copied into the dataset, so the caller is
- * allowed to derive new types, dataspaces, and creation
+ * allowed to derive new types, data spaces, and creation
* parameters from the old ones and reuse them in calls to
* create other datasets.
*
@@ -356,9 +356,9 @@ H5D__extend(H5D_t *dataset, const hsize_t *size, hid_t dxpl_id)
if((rank = H5S_get_simple_extent_dims(space, curr_dims, NULL)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset dimensions")
- /* Increase the size of the dataspace */
+ /* Increase the size of the data space */
if((changed = H5S_extend(space, size)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to increase size of dataspace")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to increase size of data space")
/* Updated the dataset's info if the dataspace was successfully extended */
if(changed) {
diff --git a/src/H5Defl.c b/src/H5Defl.c
index 2bacff8..38c8ccd 100644
--- a/src/H5Defl.c
+++ b/src/H5Defl.c
@@ -144,7 +144,7 @@ H5D__efl_construct(H5F_t *f, H5D_t *dset)
/*
* The maximum size of the dataset cannot exceed the storage size.
- * Also, only the slowest varying dimension of a simple dataspace
+ * Also, only the slowest varying dimension of a simple data space
* can be extendible (currently only for external data storage).
*/
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 7a7c60c..c35804a 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -464,7 +464,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5D__get_space_status
*
- * Purpose: Returns the status of dataspace allocation.
+ * Purpose: Returns the status of data space allocation.
*
* Return:
* Success: Non-negative
@@ -2190,16 +2190,16 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id)
if(H5D__check_filters(dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't apply filters")
- /* Get the dataspace */
+ /* Get the data space */
space = dset->shared->space;
/* Check if we are shrinking or expanding any of the dimensions */
if((rank = H5S_get_simple_extent_dims(space, curr_dims, NULL)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset dimensions")
- /* Modify the size of the dataspace */
+ /* Modify the size of the data space */
if((changed = H5S_set_extent(space, size)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of dataspace")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of data space")
/* Don't bother updating things, unless they've changed */
if(changed) {
diff --git a/src/H5Dio.c b/src/H5Dio.c
index e9c203f..fb3c5d3 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -97,14 +97,14 @@ H5FL_BLK_DEFINE(type_conv);
* passed to this function with the PLIST_ID argument.
*
* The FILE_SPACE_ID can be the constant H5S_ALL which indicates
- * that the entire file dataspace is to be referenced.
+ * that the entire file data space is to be referenced.
*
* The MEM_SPACE_ID can be the constant H5S_ALL in which case
- * the memory dataspace is the same as the file dataspace
+ * the memory data space is the same as the file data space
* defined when the dataset was created.
*
- * The number of elements in the memory dataspace must match
- * the number of elements in the file dataspace.
+ * The number of elements in the memory data space must match
+ * the number of elements in the file data space.
*
* The PLIST_ID can be the constant H5P_DEFAULT in which
* case the default data transfer properties are used.
@@ -133,11 +133,11 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
if(NULL == (dset = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
if(mem_space_id < 0 || file_space_id < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
if(H5S_ALL != mem_space_id) {
if(NULL == (mem_space = (const H5S_t *)H5I_object_verify(mem_space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
/* Check for valid selection */
if(H5S_SELECT_VALID(mem_space) != TRUE)
@@ -145,7 +145,7 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
} /* end if */
if(H5S_ALL != file_space_id) {
if(NULL == (file_space = (const H5S_t *)H5I_object_verify(file_space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
/* Check for valid selection */
if(H5S_SELECT_VALID(file_space) != TRUE)
@@ -181,14 +181,14 @@ done:
* PLIST_ID argument.
*
* The FILE_SPACE_ID can be the constant H5S_ALL which indicates
- * that the entire file dataspace is to be referenced.
+ * that the entire file data space is to be referenced.
*
* The MEM_SPACE_ID can be the constant H5S_ALL in which case
- * the memory dataspace is the same as the file dataspace
+ * the memory data space is the same as the file data space
* defined when the dataset was created.
*
- * The number of elements in the memory dataspace must match
- * the number of elements in the file dataspace.
+ * The number of elements in the memory data space must match
+ * the number of elements in the file data space.
*
* The PLIST_ID can be the constant H5P_DEFAULT in which
* case the default data transfer properties are used.
@@ -372,7 +372,7 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
hbool_t type_info_init = FALSE; /* Whether the datatype info has been initialized */
H5S_t * projected_mem_space = NULL; /* If not NULL, ptr to dataspace containing a */
/* projection of the supplied mem_space to a new */
- /* dataspace with rank equal to that of */
+ /* data space with rank equal to that of */
/* file_space. */
/* */
/* This field is only used if */
@@ -426,7 +426,7 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
/* Make certain that the number of elements in each selection is the same */
if(nelmts != (hsize_t)H5S_GET_SELECT_NPOINTS(file_space))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src and dest dataspaces have different sizes")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src and dest data spaces have different sizes")
/* Check for a NULL buffer, after the H5S_ALL dataspace selection has been handled */
if(NULL == buf) {
@@ -588,7 +588,7 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
hbool_t type_info_init = FALSE; /* Whether the datatype info has been initialized */
H5S_t * projected_mem_space = NULL; /* If not NULL, ptr to dataspace containing a */
/* projection of the supplied mem_space to a new */
- /* dataspace with rank equal to that of */
+ /* data space with rank equal to that of */
/* file_space. */
/* */
/* This field is only used if */
@@ -680,7 +680,7 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
/* Make certain that the number of elements in each selection is the same */
if(nelmts != (hsize_t)H5S_GET_SELECT_NPOINTS(file_space))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src and dest dataspaces have different sizes")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src and dest data spaces have different sizes")
/* Check for a NULL buffer, after the H5S_ALL dataspace selection has been handled */
if(NULL == buf) {
@@ -734,7 +734,7 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
/* Retrieve dataset properties */
/* <none needed currently> */
- /* Allocate dataspace and initialize it if it hasn't been. */
+ /* Allocate data space and initialize it if it hasn't been. */
if(nelmts > 0 && dataset->shared->dcpl_cache.efl.nused == 0 &&
!(*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage)) {
hssize_t file_nelmts; /* Number of elements in file dataset's dataspace */
@@ -939,7 +939,7 @@ H5D__typeinfo_init(const H5D_t *dset, const H5D_dxpl_cache_t *dxpl_cache,
} /* end else */
/*
- * Locate the type conversion function and dataspace conversion
+ * Locate the type conversion function and data space conversion
* functions, and set up the element numbering information. If a data
* type conversion is necessary then register datatype atoms. Data type
* conversion is necessary if the user has set the `need_bkg' to a high
diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c
index cbb3c4a..88c6075 100644
--- a/src/H5Dmpio.c
+++ b/src/H5Dmpio.c
@@ -1645,7 +1645,7 @@ done:
* 2) Gather all the information to the root process
*
* 3) Root process will do the following:
- * a) Obtain chunk addresses for all chunks in this dataspace
+ * a) Obtain chunk addresses for all chunks in this data space
* b) With the consideration of the user option, calculate IO mode for each chunk
* c) Build MPI derived datatype to combine "chunk address" and "assign_io" information
* in order to do MPI Bcast only once
diff --git a/src/H5Edefin.h b/src/H5Edefin.h
index a2ee62c..4c4b4df 100644
--- a/src/H5Edefin.h
+++ b/src/H5Edefin.h
@@ -195,7 +195,6 @@ hid_t H5E_CANTSELECT_g = FAIL; /* Can't select hyperslab */
hid_t H5E_CANTNEXT_g = FAIL; /* Can't move to next iterator location */
hid_t H5E_BADSELECT_g = FAIL; /* Invalid selection */
hid_t H5E_CANTCOMPARE_g = FAIL; /* Can't compare objects */
-hid_t H5E_INCONSISTENTSTATE_g = FAIL; /* Internal states are inconsistent */
/* Argument errors */
hid_t H5E_UNINITIALIZED_g = FAIL; /* Information is uinitialized */
diff --git a/src/H5Einit.h b/src/H5Einit.h
index b00dc10..75c0b70 100644
--- a/src/H5Einit.h
+++ b/src/H5Einit.h
@@ -745,11 +745,6 @@ if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't compare objects"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
if((H5E_CANTCOMPARE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_INCONSISTENTSTATE_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Internal states are inconsistent"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_INCONSISTENTSTATE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
/* Argument errors */
assert(H5E_UNINITIALIZED_g==(-1));
diff --git a/src/H5Epubgen.h b/src/H5Epubgen.h
index 7f8a935..e5ecd10 100644
--- a/src/H5Epubgen.h
+++ b/src/H5Epubgen.h
@@ -330,14 +330,12 @@ H5_DLLVAR hid_t H5E_CANTRECV_g; /* Can't receive data */
#define H5E_CANTNEXT (H5OPEN H5E_CANTNEXT_g)
#define H5E_BADSELECT (H5OPEN H5E_BADSELECT_g)
#define H5E_CANTCOMPARE (H5OPEN H5E_CANTCOMPARE_g)
-#define H5E_INCONSISTENTSTATE (H5OPEN H5E_INCONSISTENTSTATE_g)
H5_DLLVAR hid_t H5E_CANTCLIP_g; /* Can't clip hyperslab region */
H5_DLLVAR hid_t H5E_CANTCOUNT_g; /* Can't count elements */
H5_DLLVAR hid_t H5E_CANTSELECT_g; /* Can't select hyperslab */
H5_DLLVAR hid_t H5E_CANTNEXT_g; /* Can't move to next iterator location */
H5_DLLVAR hid_t H5E_BADSELECT_g; /* Invalid selection */
H5_DLLVAR hid_t H5E_CANTCOMPARE_g; /* Can't compare objects */
-H5_DLLVAR hid_t H5E_INCONSISTENTSTATE_g; /* Internal states are inconsistent */
/* Argument errors */
#define H5E_UNINITIALIZED (H5OPEN H5E_UNINITIALIZED_g)
diff --git a/src/H5Eterm.h b/src/H5Eterm.h
index d263479..aecef3e 100644
--- a/src/H5Eterm.h
+++ b/src/H5Eterm.h
@@ -196,8 +196,7 @@ H5E_CANTCOUNT_g=
H5E_CANTSELECT_g=
H5E_CANTNEXT_g=
H5E_BADSELECT_g=
-H5E_CANTCOMPARE_g=
-H5E_INCONSISTENTSTATE_g=
+H5E_CANTCOMPARE_g=
/* Argument errors */
H5E_UNINITIALIZED_g=
diff --git a/src/H5Omessage.c b/src/H5Omessage.c
index 9d9f2e0..1369583 100644
--- a/src/H5Omessage.c
+++ b/src/H5Omessage.c
@@ -1753,7 +1753,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5O_msg_encode
*
- * Purpose: Encode an object(data type and simple dataspace only)
+ * Purpose: Encode an object(data type and simple data space only)
* description into a buffer.
*
* Return: Success: Non-negative
diff --git a/src/H5S.c b/src/H5S.c
index eb5430e..1146ab4 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -1304,7 +1304,8 @@ H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims,
/* Selection related cleanup */
/* Set offset to zeros */
- HDmemset(space->select.offset, 0, sizeof(hsize_t) * space->extent.rank);
+ for(u = 0; u < space->extent.rank; u++)
+ space->select.offset[u] = 0;
space->select.offset_changed = FALSE;
/* If the selection is 'all', update the number of elements selected */
diff --git a/src/H5Sall.c b/src/H5Sall.c
index 0b7120c..24caad2 100644
--- a/src/H5Sall.c
+++ b/src/H5Sall.c
@@ -17,7 +17,7 @@
* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
* Tuesday, June 16, 1998
*
- * Purpose: "All" selection dataspace I/O functions.
+ * Purpose: "All" selection data space I/O functions.
*/
#define H5S_PACKAGE /*suppress error about including H5Spkg */
@@ -413,8 +413,6 @@ H5S_all_release(H5S_t *space)
static herr_t
H5S_all_copy(H5S_t *dst, const H5S_t UNUSED *src, hbool_t UNUSED share_selection)
{
- unsigned u; /* Local index variable */
-
FUNC_ENTER_NOAPI_NOINIT_NOERR
HDassert(src);
@@ -423,12 +421,6 @@ H5S_all_copy(H5S_t *dst, const H5S_t UNUSED *src, hbool_t UNUSED share_selection
/* Set number of elements in selection */
dst->select.num_elem = (hsize_t)H5S_GET_EXTENT_NPOINTS(dst);
- /* Update the bound box */
- for(u = 0; u < dst->extent.rank; u++) {
- dst->select.low_bounds[u] = 0;
- dst->select.high_bounds[u] = dst->extent.size[u] - 1;
- } /* end for */
-
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5S_all_copy() */
@@ -860,7 +852,6 @@ done:
herr_t
H5S_select_all(H5S_t *space, hbool_t rel_prev)
{
- unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -876,12 +867,6 @@ H5S_select_all(H5S_t *space, hbool_t rel_prev)
/* Set number of elements in selection */
space->select.num_elem = (hsize_t)H5S_GET_EXTENT_NPOINTS(space);
- /* Update the bound box */
- for(u = 0; u < space->extent.rank; u++) {
- space->select.low_bounds[u] = 0;
- space->select.high_bounds[u] = space->extent.size[u] - 1;
- } /* end for */
-
/* Set selection type */
space->select.type = H5S_sel_all;
@@ -918,7 +903,7 @@ H5Sselect_all(hid_t spaceid)
/* Check args */
if(NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
/* Call internal routine to do the work */
if(H5S_select_all(space, TRUE) < 0)
diff --git a/src/H5Sdbg.c b/src/H5Sdbg.c
index 956c1b2..df033da 100644
--- a/src/H5Sdbg.c
+++ b/src/H5Sdbg.c
@@ -78,7 +78,7 @@
/*-------------------------------------------------------------------------
* Function: H5S_debug
*
- * Purpose: Prints debugging information about a dataspace.
+ * Purpose: Prints debugging information about a data space.
*
* Return: Non-negative on success/Negative on failure
*
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index 889291f..c97c9b6 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -17,7 +17,7 @@
* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
* Thursday, June 18, 1998
*
- * Purpose: Hyperslab selection dataspace I/O functions.
+ * Purpose: Hyperslab selection data space I/O functions.
*/
#define H5S_PACKAGE /*suppress error about including H5Spkg */
@@ -30,86 +30,21 @@
#include "H5Spkg.h" /* Dataspace functions */
#include "H5VMprivate.h" /* Vector functions */
-/* Local Macros */
-
-/* Flags for which hyperslab fragments to compute */
-#define H5S_HYPER_COMPUTE_B_NOT_A 0x01
-#define H5S_HYPER_COMPUTE_A_AND_B 0x02
-#define H5S_HYPER_COMPUTE_A_NOT_B 0x04
-
-/* Macro to advance a span, possibly recycling it first */
-#define H5S_HYPER_ADVANCE_SPAN(recover, curr_span, next_span) \
- do { \
- /* Check if the span should be recovered */ \
- if(recover) { \
- H5S_hyper_free_span(curr_span); \
- recover = FALSE; \
- } /* end if */ \
- \
- /* Set the current span to next span */ \
- curr_span = next_span; \
- } while(0)
-
-
/* Local datatypes */
/* Static function prototypes */
-static H5S_hyper_span_t *H5S_hyper_new_span(hsize_t low, hsize_t high,
- H5S_hyper_span_info_t *down, H5S_hyper_span_t *next);
-static herr_t H5S_hyper_span_precompute(H5S_hyper_span_info_t *spans, size_t elmt_size);
-static void H5S_hyper_span_scratch(H5S_hyper_span_info_t *spans, void *scr_value);
-static H5S_hyper_span_info_t *H5S_hyper_copy_span(H5S_hyper_span_info_t *spans);
-static htri_t H5S_hyper_cmp_spans(const H5S_hyper_span_info_t *span_info1,
- const H5S_hyper_span_info_t *span_info2);
static herr_t H5S_hyper_free_span_info(H5S_hyper_span_info_t *span_info);
static herr_t H5S_hyper_free_span(H5S_hyper_span_t *span);
-static herr_t H5S_hyper_span_blocklist(const H5S_hyper_span_info_t *spans,
- hsize_t start[], hsize_t end[], hsize_t rank, hsize_t *startblock, hsize_t *numblocks,
- hsize_t **buf);
-static herr_t H5S_get_select_hyper_blocklist(H5S_t *space, hbool_t internal,
- hsize_t startblock, hsize_t numblocks, hsize_t *buf);
-static H5S_hyper_span_t *H5S_hyper_coord_to_span(unsigned rank, const hsize_t *coords);
-static herr_t H5S_hyper_append_span(H5S_hyper_span_t **prev_span,
- H5S_hyper_span_info_t **span_tree, hsize_t low, hsize_t high,
- H5S_hyper_span_info_t *down, H5S_hyper_span_t *next);
-static herr_t H5S_hyper_clip_spans(H5S_hyper_span_info_t *a_spans,
- H5S_hyper_span_info_t *b_spans, unsigned int selector,
- unsigned cur_dim, unsigned dim_size, const hsize_t *span_a_b_bounds[4],
- hsize_t *all_clips_bounds, H5S_hyper_span_info_t **a_not_b,
- H5S_hyper_span_info_t **a_and_b, H5S_hyper_span_info_t **b_not_a);
-static herr_t H5S_hyper_merge_spans(H5S_t *space, H5S_hyper_span_info_t *new_spans);
-static hsize_t H5S_hyper_spans_nelem(const H5S_hyper_span_info_t *spans);
-static herr_t H5S_hyper_add_disjoint_spans(H5S_t *space, H5S_hyper_span_info_t *new_spans);
-static H5S_hyper_span_info_t *H5S_hyper_make_spans(unsigned rank,
- const hsize_t *start, const hsize_t *stride,
- const hsize_t *count, const hsize_t *block);
-static herr_t H5S_hyper_update_diminfo(H5S_t *space, H5S_seloper_t op,
- const H5S_hyper_dim_t *new_hyper_diminfo);
-static hbool_t H5S_hyper_rebuild_helper(const H5S_hyper_span_t *span,
- H5S_hyper_dim_t span_slab_info[], unsigned rank);
-static herr_t H5S_hyper_generate_spans(H5S_t *space);
-static herr_t H5S_hyper_update_bound_box(H5S_t *space, H5S_seloper_t op,
- const hsize_t low_bounds[], const hsize_t high_bounds[]);
-static herr_t H5S_fill_in_new_space(H5S_t *space1, H5S_seloper_t op, H5S_hyper_span_info_t *space2_span_lst, const hsize_t *space2_low_bound, const hsize_t *space2_high_bound, hbool_t can_own_span2, hbool_t *span2_owned, hbool_t *updated_spans, H5S_t **result);
+static H5S_hyper_span_info_t *H5S_hyper_copy_span(H5S_hyper_span_info_t *spans);
+static void H5S_hyper_span_scratch(H5S_hyper_span_info_t *spans, void *scr_value);
+static herr_t H5S_hyper_span_precompute(H5S_hyper_span_info_t *spans, size_t elmt_size);
static herr_t H5S_generate_hyperslab(H5S_t *space, H5S_seloper_t op,
- const hsize_t start[], const hsize_t stride[], const hsize_t count[],
- const hsize_t block[]);
-static herr_t H5S_fill_in_hyperslab(H5S_t *old_space, H5S_seloper_t op,
- const hsize_t start[], const hsize_t *stride, const hsize_t count[],
- const hsize_t *block, H5S_t **new_space);
-static herr_t H5S_fill_in_select(H5S_t *space1, H5S_seloper_t op, H5S_t *space2,
- H5S_t **result);
-static H5S_t *H5S_combine_select(H5S_t *space1, H5S_seloper_t op, H5S_t *space2);
-static herr_t H5S_modify_select(H5S_t *space1, H5S_seloper_t op, H5S_t *space2);
-static herr_t H5S_hyper_get_seq_list_gen(const H5S_t *space, H5S_sel_iter_t *iter,
- size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem, hsize_t *off,
- size_t *len);
-static herr_t H5S_hyper_get_seq_list_opt(const H5S_t *space, H5S_sel_iter_t *iter,
- size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem, hsize_t *off,
- size_t *len);
-static herr_t H5S_hyper_get_seq_list_single(const H5S_t *space, H5S_sel_iter_t *iter,
- size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem, hsize_t *off,
- size_t *len);
+ const hsize_t start[], const hsize_t stride[], const hsize_t count[], const hsize_t block[]);
+static herr_t H5S_hyper_generate_spans(H5S_t *space);
+/* Needed for use in hyperslab code (H5Shyper.c) */
+#ifdef NEW_HYPERSLAB_API
+static herr_t H5S_select_select (H5S_t *space1, H5S_seloper_t op, H5S_t *space2);
+#endif /*NEW_HYPERSLAB_API*/
/* Selection callbacks */
static herr_t H5S_hyper_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection);
@@ -140,6 +75,11 @@ static herr_t H5S_hyper_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem);
static herr_t H5S_hyper_iter_next_block(H5S_sel_iter_t *sel_iter);
static herr_t H5S_hyper_iter_release(H5S_sel_iter_t *sel_iter);
+/* Static function for optimizing hyperslab */
+static hbool_t H5S_hyper_rebuild_helper(const H5S_hyper_span_t *span,
+ H5S_hyper_dim_t span_slab_info[], unsigned rank);
+static htri_t H5S_hyper_rebuild(H5S_t *space);
+
/* Selection properties for hyperslab selections */
const H5S_select_class_t H5S_sel_hyper[1] = {{
H5S_SEL_HYPERSLABS,
@@ -274,116 +214,6 @@ H5S_hyper_print_diminfo(FILE *f, const H5S_t *space)
FUNC_LEAVE_NOAPI(SUCCEED)
}
-
-
-/*--------------------------------------------------------------------------
- NAME
- H5S_hyper_print_spans_dfs
- PURPOSE
- Output the span elements for one span list in depth-first order
- USAGE
- herr_t H5S_hyper_print_spans_dfs(f, span_lst, depth)
- FILE *f; IN: the file to output
- const H5S_hyper_span_info_t *span_lst; IN: the span list to output
- unsigned depth; IN: the level of this span list
- RETURNS
- non-negative on success, negative on failure
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static herr_t
-H5S_hyper_print_spans_dfs(FILE *f, const H5S_hyper_span_info_t *span_lst,
- unsigned depth)
-{
- H5S_hyper_span_t *actual_tail = NULL;
- H5S_hyper_span_t *cur_elem;
- unsigned num_elems = 0;
- unsigned i, elem_idx;
-
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_print_spans_dfs)
-
- /* get the actual tail from head */
- cur_elem = span_lst->head;
- HDassert(cur_elem); /* at least 1 element */
- while(cur_elem) {
- actual_tail = cur_elem;
- cur_elem = cur_elem->next;
- num_elems++;
- } /* end while */
-
- for(i = 0; i < depth; i++)
- HDfprintf(f, "\t");
- HDfprintf(f, "DIM[%u]: ref_count=%u, #elems=%u, scratch=%p, head=%p, tail=%p, actual_tail=%p, matched=%t\n", depth,
- span_lst->count, num_elems, span_lst->scratch, span_lst->head,
- span_lst->tail, actual_tail, (span_lst->tail == actual_tail));
-
- cur_elem = span_lst->head;
- elem_idx = 0;
- while(cur_elem) {
- for(i = 0; i < depth; i++)
- HDfprintf(f, "\t");
- HDfprintf(f, "ELEM[%u]: ptr=%p, low=%Hu, high=%Hu, nelem=%Hu, pstride=%Hu, down=%p\n",
- elem_idx++, cur_elem, cur_elem->low, cur_elem->high, cur_elem->nelem,
- cur_elem->pstride, cur_elem->down);
- if(cur_elem->down)
- H5S_hyper_print_spans_dfs(f, cur_elem->down, depth + 1);
- cur_elem = cur_elem->next;
- } /* end while */
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S_hyper_print_spans_dfs() */
-
-
-/*--------------------------------------------------------------------------
- NAME
- H5S_hyper_print_space_dfs
- PURPOSE
- Output the span elements for one hyperslab selection space in depth-first order
- USAGE
- herr_t H5S_hyper_print_space_dfs(f, space)
- FILE *f; IN: the file to output
- const H5S_t *space; IN: the selection space to output
- RETURNS
- non-negative on success, negative on failure
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static herr_t
-H5S_hyper_print_space_dfs(FILE *f, const H5S_t *space)
-{
- const H5S_hyper_sel_t *hslab = space->select.sel_info.hslab;
- const unsigned dims = space->extent.rank;
- unsigned i;
-
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_print_space_dfs)
- HDassert(hslab);
-
- HDfprintf(f, "=======================\n");
- HDfprintf(f, "SPACE: span_lst=%p, #dims=%u, offset_changed=%d\n", hslab->span_lst, dims, space->select.offset_changed);
- HDfprintf(f, " offsets=[");
- for(i = 0; i < dims - 1; i++)
- HDfprintf(f, "%lld,", space->select.offset[i]);
- HDfprintf(f, "%lld]\n", space->select.offset[dims-1]);
- HDfprintf(f, " low_bounds=[");
- for(i = 0; i < dims-1; i++)
- HDfprintf(f, "%llu,", space->select.low_bounds[i]);
- HDfprintf(f, "%llu]\n", space->select.low_bounds[dims-1]);
- HDfprintf(f, " high_bounds=[");
- for(i = 0; i < dims - 1; i++)
- HDfprintf(f, "%llu,", space->select.high_bounds[i]);
- HDfprintf(f, "%llu]\n", space->select.high_bounds[dims-1]);
-
- /* Start print out the highest-order of dimension */
- if(hslab->span_lst)
- H5S_hyper_print_spans_dfs(f, hslab->span_lst, 0);
- HDfprintf(f, "=======================\n\n");
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S_hyper_print_space_dfs() */
#endif /* H5S_HYPER_DEBUG */
@@ -426,17 +256,11 @@ H5S_hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
/* Get the rank of the dataspace */
rank = space->extent.rank;
- /* Rebuild diminfo if it is invalid and has not been confirmed to be
- * impossible */
- if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_NO)
- /* Casting away const OK -NAF */
- (void)H5S_hyper_rebuild((H5S_t *)space);
-
/* Set the temporary pointer to the dimension information */
tdiminfo = space->select.sel_info.hslab->opt_diminfo;
/* Check for the special case of just one H5Sselect_hyperslab call made */
- if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
+ if(space->select.sel_info.hslab->diminfo_valid) {
/* Initialize the information needed for regular hyperslab I/O */
const hsize_t *mem_size; /* Temporary pointer to dataspace extent's dimension sizes */
hsize_t acc; /* Accumulator for "flattened" dimension's sizes */
@@ -583,7 +407,7 @@ H5S_hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
iter->type = H5S_sel_iter_hyper;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S_hyper_iter_init() */
+} /* H5S_hyper_iter_init() */
/*-------------------------------------------------------------------------
@@ -597,10 +421,12 @@ H5S_hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
* Programmer: Quincey Koziol
* Tuesday, April 22, 2003
*
+ * Modifications:
+ *
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_hyper_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords)
+H5S_hyper_iter_coords (const H5S_sel_iter_t *iter, hsize_t *coords)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -668,7 +494,7 @@ H5S_hyper_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords)
HDmemcpy(coords, iter->u.hyp.off, sizeof(hsize_t) * iter->rank);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S_hyper_iter_coords() */
+} /* H5S_hyper_iter_coords() */
/*-------------------------------------------------------------------------
@@ -685,10 +511,12 @@ H5S_hyper_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords)
* Notes: This routine assumes that the iterator is always located at
* the beginning of a block.
*
+ * Modifications:
+ *
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_hyper_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
+H5S_hyper_iter_block (const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
{
unsigned u; /* Local index variable */
@@ -720,7 +548,7 @@ H5S_hyper_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
} /* end else */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S_hyper_iter_block() */
+} /* H5S_hyper_iter_block() */
/*-------------------------------------------------------------------------
@@ -733,10 +561,12 @@ H5S_hyper_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
* Programmer: Quincey Koziol
* Tuesday, June 16, 1998
*
+ * Modifications:
+ *
*-------------------------------------------------------------------------
*/
static hsize_t
-H5S_hyper_iter_nelmts(const H5S_sel_iter_t *iter)
+H5S_hyper_iter_nelmts (const H5S_sel_iter_t *iter)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -744,7 +574,7 @@ H5S_hyper_iter_nelmts(const H5S_sel_iter_t *iter)
HDassert(iter);
FUNC_LEAVE_NOAPI(iter->elmt_left)
-} /* end H5S_hyper_iter_nelmts() */
+} /* H5S_hyper_iter_nelmts() */
/*--------------------------------------------------------------------------
@@ -800,7 +630,7 @@ H5S_hyper_iter_has_next_block(const H5S_sel_iter_t *iter)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_iter_has_next_block() */
+} /* H5S_hyper_iter_has_next_block() */
/*-------------------------------------------------------------------------
@@ -815,6 +645,10 @@ done:
* Programmer: Quincey Koziol
* Friday, September 8, 2000
*
+ * Modifications:
+ * Modified for both general and optimized hyperslab I/O
+ * Quincey Koziol, April 17, 2003
+ *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1013,7 +847,7 @@ H5S_hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
} /* end else */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S_hyper_iter_next() */
+} /* H5S_hyper_iter_next() */
/*-------------------------------------------------------------------------
@@ -1028,6 +862,8 @@ H5S_hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
* Programmer: Quincey Koziol
* Tuesday, June 3, 2003
*
+ * Modifications:
+ *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1196,7 +1032,7 @@ H5S_hyper_iter_next_block(H5S_sel_iter_t *iter)
} /* end else */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S_hyper_iter_next() */
+} /* H5S_hyper_iter_next() */
/*--------------------------------------------------------------------------
@@ -1217,7 +1053,7 @@ H5S_hyper_iter_next_block(H5S_sel_iter_t *iter)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_hyper_iter_release(H5S_sel_iter_t *iter)
+H5S_hyper_iter_release (H5S_sel_iter_t *iter)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -1230,7 +1066,7 @@ H5S_hyper_iter_release(H5S_sel_iter_t *iter)
H5S_hyper_free_span_info(iter->u.hyp.spans);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S_hyper_iter_release() */
+} /* H5S_hyper_iter_release() */
/*--------------------------------------------------------------------------
@@ -1279,7 +1115,7 @@ H5S_hyper_new_span(hsize_t low, hsize_t high, H5S_hyper_span_info_t *down, H5S_h
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_new_span() */
+} /* H5S_hyper_new_span() */
/*--------------------------------------------------------------------------
@@ -1302,17 +1138,17 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_hyper_span_precompute_helper(H5S_hyper_span_info_t *spans, size_t elmt_size)
+H5S_hyper_span_precompute_helper (H5S_hyper_span_info_t *spans, size_t elmt_size)
{
- H5S_hyper_span_t *span; /* Hyperslab span */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5S_hyper_span_t *span; /* Hyperslab span */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
HDassert(spans);
/* Check if we've already set this down span tree */
- if(spans->scratch != (H5S_hyper_span_info_t *)~((size_t)NULL)) {
+ if(spans->scratch!=(H5S_hyper_span_info_t *)~((size_t)NULL)) {
/* Set the tree's scratch pointer */
spans->scratch=(H5S_hyper_span_info_t *)~((size_t)NULL);
@@ -1338,7 +1174,7 @@ H5S_hyper_span_precompute_helper(H5S_hyper_span_info_t *spans, size_t elmt_size)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_span_precompute_helper() */
+} /* H5S_hyper_span_precompute_helper() */
/*--------------------------------------------------------------------------
@@ -1378,7 +1214,7 @@ H5S_hyper_span_precompute(H5S_hyper_span_info_t *spans, size_t elmt_size)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_span_precompute() */
+} /* H5S_hyper_span_precompute() */
/*--------------------------------------------------------------------------
@@ -1425,7 +1261,7 @@ H5S_hyper_span_scratch(H5S_hyper_span_info_t *spans, void *scr_value)
} /* end if */
FUNC_LEAVE_NOAPI_VOID
-} /* end H5S_hyper_span_scratch() */
+} /* H5S_hyper_span_scratch() */
/*--------------------------------------------------------------------------
@@ -1446,7 +1282,7 @@ H5S_hyper_span_scratch(H5S_hyper_span_info_t *spans, void *scr_value)
REVISION LOG
--------------------------------------------------------------------------*/
static H5S_hyper_span_info_t *
-H5S_hyper_copy_span_helper(H5S_hyper_span_info_t *spans)
+H5S_hyper_copy_span_helper (H5S_hyper_span_info_t *spans)
{
H5S_hyper_span_t *span; /* Hyperslab span */
H5S_hyper_span_t *new_span; /* Temporary hyperslab span */
@@ -1468,11 +1304,13 @@ H5S_hyper_copy_span_helper(H5S_hyper_span_info_t *spans)
} /* end if */
else {
/* Allocate a new span_info node */
- if(NULL == (ret_value = H5FL_CALLOC(H5S_hyper_span_info_t)))
+ if(NULL == (ret_value = H5FL_MALLOC(H5S_hyper_span_info_t)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span info")
- /* Set the non-zero span_info information */
+ /* Copy the span_info information */
ret_value->count = 1;
+ ret_value->scratch = NULL;
+ ret_value->head = NULL;
/* Set the scratch pointer in the node being copied to the newly allocated node */
spans->scratch = ret_value;
@@ -1507,14 +1345,11 @@ H5S_hyper_copy_span_helper(H5S_hyper_span_info_t *spans)
/* Advance to next span */
span = span->next;
} /* end while */
-
- /* Retain a pointer to the last span */
- ret_value->tail = prev_span;
} /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_copy_span_helper() */
+} /* H5S_hyper_copy_span_helper() */
/*--------------------------------------------------------------------------
@@ -1554,7 +1389,7 @@ H5S_hyper_copy_span(H5S_hyper_span_info_t *spans)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_copy_span() */
+} /* H5S_hyper_copy_span() */
/*--------------------------------------------------------------------------
@@ -1577,20 +1412,19 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S_hyper_cmp_spans(const H5S_hyper_span_info_t *span_info1, const H5S_hyper_span_info_t *span_info2)
+H5S_hyper_cmp_spans (H5S_hyper_span_info_t *span_info1, H5S_hyper_span_info_t *span_info2)
{
- htri_t ret_value = FAIL; /* Return value */
+ H5S_hyper_span_t *span1;
+ H5S_hyper_span_t *span2;
+ htri_t nest=FAIL;
+ htri_t ret_value=FAIL;
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check for redundant comparison */
- if(span_info1 == span_info2)
- ret_value = TRUE;
+ if(span_info1==span_info2)
+ ret_value=TRUE;
else {
- const H5S_hyper_span_t *span1;
- const H5S_hyper_span_t *span2;
- htri_t nest = FAIL;
-
/* Check for both spans being NULL */
if(span_info1==NULL && span_info2==NULL)
ret_value=TRUE;
@@ -1658,7 +1492,7 @@ H5S_hyper_cmp_spans(const H5S_hyper_span_info_t *span_info1, const H5S_hyper_spa
} /* end else */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_cmp_spans() */
+} /* H5S_hyper_cmp_spans() */
/*--------------------------------------------------------------------------
@@ -1681,7 +1515,7 @@ H5S_hyper_cmp_spans(const H5S_hyper_span_info_t *span_info1, const H5S_hyper_spa
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_hyper_free_span_info(H5S_hyper_span_info_t *span_info)
+H5S_hyper_free_span_info (H5S_hyper_span_info_t *span_info)
{
H5S_hyper_span_t *span, *next_span;
herr_t ret_value=SUCCEED; /* Return value */
@@ -1711,7 +1545,7 @@ H5S_hyper_free_span_info(H5S_hyper_span_info_t *span_info)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_free_span_info() */
+} /* H5S_hyper_free_span_info() */
/*--------------------------------------------------------------------------
@@ -1734,7 +1568,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_hyper_free_span(H5S_hyper_span_t *span)
+H5S_hyper_free_span (H5S_hyper_span_t *span)
{
herr_t ret_value=SUCCEED;
@@ -1753,7 +1587,7 @@ H5S_hyper_free_span(H5S_hyper_span_t *span)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_free_span() */
+} /* H5S_hyper_free_span() */
/*--------------------------------------------------------------------------
@@ -1781,15 +1615,14 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_hyper_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection)
+H5S_hyper_copy (H5S_t *dst, const H5S_t *src, hbool_t share_selection)
{
H5S_hyper_sel_t *dst_hslab; /* Pointer to destination hyperslab info */
const H5S_hyper_sel_t *src_hslab; /* Pointer to source hyperslab info */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value=SUCCEED; /* return value */
FUNC_ENTER_NOAPI(FAIL)
- /* Sanity check */
HDassert(src);
HDassert(dst);
@@ -1798,21 +1631,24 @@ H5S_hyper_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab info")
/* Set temporary pointers */
- dst_hslab = dst->select.sel_info.hslab;
- src_hslab = src->select.sel_info.hslab;
+ dst_hslab=dst->select.sel_info.hslab;
+ src_hslab=src->select.sel_info.hslab;
/* Copy the hyperslab information */
- dst_hslab->diminfo_valid = src_hslab->diminfo_valid;
- if(src_hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
- HDmemcpy(dst_hslab->opt_diminfo, src_hslab->opt_diminfo, sizeof(H5S_hyper_dim_t) * src->extent.rank);
- HDmemcpy(dst_hslab->app_diminfo, src_hslab->app_diminfo, sizeof(H5S_hyper_dim_t) * src->extent.rank);
- } /* end if */
+ dst_hslab->diminfo_valid=src_hslab->diminfo_valid;
+ if(src_hslab->diminfo_valid) {
+ size_t u; /* Local index variable */
- dst->select.sel_info.hslab->span_lst = src->select.sel_info.hslab->span_lst;
+ for(u=0; u<src->extent.rank; u++) {
+ dst_hslab->opt_diminfo[u]=src_hslab->opt_diminfo[u];
+ dst_hslab->app_diminfo[u]=src_hslab->app_diminfo[u];
+ } /* end for */
+ } /* end if */
+ dst->select.sel_info.hslab->span_lst=src->select.sel_info.hslab->span_lst;
/* Check if there is hyperslab span information to copy */
/* (Regular hyperslab information is copied with the selection structure) */
- if(src->select.sel_info.hslab->span_lst != NULL) {
+ if(src->select.sel_info.hslab->span_lst!=NULL) {
if(share_selection) {
/* Share the source's span tree by incrementing the reference count on it */
dst->select.sel_info.hslab->span_lst->count++;
@@ -1829,6 +1665,72 @@ done:
/*--------------------------------------------------------------------------
NAME
+ H5S_hyper_is_valid_helper
+ PURPOSE
+ Check whether the selection fits within the extent, with the current
+ offset defined.
+ USAGE
+ htri_t H5S_hyper_is_valid_helper(spans, offset, rank);
+ const H5S_hyper_span_info_t *spans; IN: Pointer to current hyperslab span tree
+ const hssize_t *offset; IN: Pointer to offset array
+ const hsize_t *size; IN: Pointer to size array
+ hsize_t rank; IN: Current rank looking at
+ RETURNS
+ TRUE if the selection fits within the extent, FALSE if it does not and
+ Negative on an error.
+ DESCRIPTION
+ Determines if the current selection at the current offet fits within the
+ extent for the dataspace.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static htri_t
+H5S_hyper_is_valid_helper (const H5S_hyper_span_info_t *spans, const hssize_t *offset, const hsize_t *size, hsize_t rank)
+{
+ H5S_hyper_span_t *curr; /* Hyperslab information nodes */
+ htri_t tmp; /* temporary return value */
+ htri_t ret_value=TRUE; /* return value */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ HDassert(spans);
+ HDassert(offset);
+ HDassert(size);
+ HDassert(rank < H5O_LAYOUT_NDIMS);
+
+ /* Check each point to determine whether selection+offset is within extent */
+ curr=spans->head;
+ while(curr!=NULL && ret_value==TRUE) {
+ /* Check if an offset has been defined */
+ /* Bounds check the selected point + offset against the extent */
+ if((((hssize_t)curr->low+offset[rank])>=(hssize_t)size[rank])
+ || (((hssize_t)curr->low+offset[rank])<0)
+ || (((hssize_t)curr->high+offset[rank])>=(hssize_t)size[rank])
+ || (((hssize_t)curr->high+offset[rank])<0)) {
+ ret_value=FALSE;
+ break;
+ } /* end if */
+
+ /* Recurse if this node has down spans */
+ if(curr->down!=NULL) {
+ if((tmp=H5S_hyper_is_valid_helper(curr->down,offset,size,rank+1))!=TRUE) {
+ ret_value=tmp;
+ break;
+ } /* end if */
+ } /* end if */
+
+ /* Advance to next node */
+ curr=curr->next;
+ } /* end while */
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S_hyper_is_valid_helper() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
H5S_hyper_is_valid
PURPOSE
Check whether the selection fits within the extent, with the current
@@ -1848,23 +1750,43 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S_hyper_is_valid(const H5S_t *space)
+H5S_hyper_is_valid (const H5S_t *space)
{
- unsigned u; /* Counter */
- htri_t ret_value = TRUE; /* Return value */
+ unsigned u; /* Counter */
+ htri_t ret_value=TRUE; /* return value */
FUNC_ENTER_NOAPI_NOERR
HDassert(space);
- /* Check each dimension */
- for(u = 0; u < space->extent.rank; u++) {
- /* Bounds check the selected point + offset against the extent */
- if(((hssize_t)space->select.low_bounds[u] + space->select.offset[u]) < 0)
- HGOTO_DONE(FALSE)
- if((space->select.high_bounds[u] + (hsize_t)space->select.offset[u]) >= space->extent.size[u])
- HGOTO_DONE(FALSE)
- } /* end for */
+ /* Check for a "regular" hyperslab selection */
+ if(space->select.sel_info.hslab->diminfo_valid) {
+ const H5S_hyper_dim_t *diminfo=space->select.sel_info.hslab->opt_diminfo; /* local alias for diminfo */
+ hssize_t end; /* The high bound of a region in a dimension */
+
+ /* Check each dimension */
+ for(u=0; u<space->extent.rank; u++) {
+ /* if block or count is zero, then can skip the test since */
+ /* no data point is chosen */
+ if (diminfo[u].count && diminfo[u].block) {
+ /* Bounds check the start point in this dimension */
+ if(((hssize_t)diminfo[u].start+space->select.offset[u])<0 ||
+ ((hssize_t)diminfo[u].start+space->select.offset[u])>=(hssize_t)space->extent.size[u])
+ HGOTO_DONE(FALSE)
+
+ /* Compute the largest location in this dimension */
+ end=(hssize_t)(diminfo[u].start+diminfo[u].stride*(diminfo[u].count-1)+(diminfo[u].block-1))+space->select.offset[u];
+
+ /* Bounds check the end point in this dimension */
+ if(end<0 || end>=(hssize_t)space->extent.size[u])
+ HGOTO_DONE(FALSE)
+ } /* end if */
+ } /* end for */
+ } /* end if */
+ else {
+ /* Call the recursive routine to validate the span tree */
+ ret_value=H5S_hyper_is_valid_helper(space->select.sel_info.hslab->span_lst,space->select.offset,space->extent.size,(hsize_t)0);
+ } /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1913,7 +1835,7 @@ H5S_hyper_span_nblocks(H5S_hyper_span_info_t *spans)
} /* end else */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_span_nblocks() */
+} /* H5S_hyper_span_nblocks() */
/*--------------------------------------------------------------------------
@@ -1936,15 +1858,14 @@ H5S_hyper_span_nblocks(H5S_hyper_span_info_t *spans)
static hsize_t
H5S_get_select_hyper_nblocks(H5S_t *space)
{
- hsize_t ret_value; /* Return value */
+ hsize_t ret_value; /* return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
HDassert(space);
/* Check for a "regular" hyperslab selection */
- /* (No need to rebuild the dimension info yet -QAK) */
- if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
+ if(space->select.sel_info.hslab->diminfo_valid) {
unsigned u; /* Local index variable */
/* Check each dimension */
@@ -1955,7 +1876,7 @@ H5S_get_select_hyper_nblocks(H5S_t *space)
ret_value = H5S_hyper_span_nblocks(space->select.sel_info.hslab->span_lst);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_get_select_hyper_nblocks() */
+} /* H5S_get_select_hyper_nblocks() */
/*--------------------------------------------------------------------------
@@ -1986,7 +1907,7 @@ H5Sget_select_hyper_nblocks(hid_t spaceid)
/* Check args */
if(NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
if(H5S_GET_SELECT_TYPE(space) != H5S_SEL_HYPERSLABS)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a hyperslab selection")
@@ -1994,7 +1915,7 @@ H5Sget_select_hyper_nblocks(hid_t spaceid)
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Sget_select_hyper_nblocks() */
+} /* H5Sget_select_hyper_nblocks() */
/*--------------------------------------------------------------------------
@@ -2034,10 +1955,7 @@ H5S_hyper_serial_size(const H5S_t *space)
ret_value = 24;
/* Check for a "regular" hyperslab selection */
- /* (It would be useful to rebuild the regular hyperslab selection, if we
- * encoded it efficiently, which we aren't currently. *sigh* -QAK)
- */
- if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
+ if(space->select.sel_info.hslab->diminfo_valid) {
/* Check each dimension */
for(block_count = 1, u = 0; u < space->extent.rank; u++)
block_count *= space->select.sel_info.hslab->opt_diminfo[u].count;
@@ -2076,7 +1994,7 @@ H5S_hyper_serial_size(const H5S_t *space)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_hyper_serialize_helper(const H5S_hyper_span_info_t *spans, hsize_t *start, hsize_t *end, hsize_t rank, uint8_t **buf)
+H5S_hyper_serialize_helper (const H5S_hyper_span_info_t *spans, hsize_t *start, hsize_t *end, hsize_t rank, uint8_t **buf)
{
H5S_hyper_span_t *curr; /* Pointer to current hyperslab span */
hsize_t u; /* Index variable */
@@ -2128,7 +2046,7 @@ H5S_hyper_serialize_helper(const H5S_hyper_span_info_t *spans, hsize_t *start, h
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_serialize_helper() */
+} /* H5S_hyper_serialize_helper() */
/*--------------------------------------------------------------------------
@@ -2151,7 +2069,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_hyper_serialize(const H5S_t *space, uint8_t *buf)
+H5S_hyper_serialize (const H5S_t *space, uint8_t *buf)
{
const H5S_hyper_dim_t *diminfo; /* Alias for dataspace's diminfo information */
hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary hyperslab counts */
@@ -2182,16 +2100,13 @@ H5S_hyper_serialize(const H5S_t *space, uint8_t *buf)
len += 4;
/* Check for a "regular" hyperslab selection */
- /* (It would be useful to rebuild the regular hyperslab selection, if we
- * encoded it efficiently, which we aren't currently. *sigh* -QAK)
- */
- if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
+ if(space->select.sel_info.hslab->diminfo_valid) {
unsigned u; /* Local counting variable */
- /* Set some convenience values */
+ /* Set some convienence values */
ndims = space->extent.rank;
fast_dim = ndims - 1;
- diminfo = space->select.sel_info.hslab->opt_diminfo;
+ diminfo=space->select.sel_info.hslab->opt_diminfo;
/* Check each dimension */
for(block_count = 1, u = 0; u < ndims; u++)
@@ -2282,7 +2197,7 @@ H5S_hyper_serialize(const H5S_t *space, uint8_t *buf)
/* Add 8 bytes times the rank for each hyperslab selected */
H5_CHECK_OVERFLOW((8 * space->extent.rank * block_count), hsize_t, size_t);
- len += (uint32_t)(8 * space->extent.rank * block_count);
+ len += (size_t)(8 * space->extent.rank * block_count);
/* Encode each hyperslab in selection */
H5S_hyper_serialize_helper(space->select.sel_info.hslab->span_lst, start, end, (hsize_t)0, &buf);
@@ -2292,7 +2207,7 @@ H5S_hyper_serialize(const H5S_t *space, uint8_t *buf)
UINT32ENCODE(lenp, (uint32_t)len); /* Store the length of the extra information */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S_hyper_serialize() */
+} /* H5S_hyper_serialize() */
/*--------------------------------------------------------------------------
@@ -2315,7 +2230,7 @@ H5S_hyper_serialize(const H5S_t *space, uint8_t *buf)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_hyper_deserialize(H5S_t *space, const uint8_t *buf)
+H5S_hyper_deserialize (H5S_t *space, const uint8_t *buf)
{
uint32_t rank; /* rank of points */
size_t num_elem=0; /* number of elements in selection */
@@ -2372,7 +2287,7 @@ H5S_hyper_deserialize(H5S_t *space, const uint8_t *buf)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_deserialize() */
+} /* H5S_hyper_deserialize() */
/*--------------------------------------------------------------------------
@@ -2409,11 +2324,9 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_hyper_span_blocklist(const H5S_hyper_span_info_t *spans, hsize_t start[],
- hsize_t end[], hsize_t rank, hsize_t *startblock, hsize_t *numblocks,
- hsize_t **buf)
+H5S_hyper_span_blocklist(H5S_hyper_span_info_t *spans, hsize_t start[], hsize_t end[], hsize_t rank, hsize_t *startblock, hsize_t *numblocks, hsize_t **buf)
{
- const H5S_hyper_span_t *curr; /* Pointer to current hyperslab span */
+ H5S_hyper_span_t *curr; /* Pointer to current hyperslab span */
hsize_t u; /* Index variable */
herr_t ret_value = SUCCEED; /* return value */
@@ -2478,7 +2391,7 @@ H5S_hyper_span_blocklist(const H5S_hyper_span_info_t *spans, hsize_t start[],
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_span_blocklist() */
+} /* H5S_hyper_span_blocklist() */
/*--------------------------------------------------------------------------
@@ -2521,13 +2434,8 @@ H5S_get_select_hyper_blocklist(H5S_t *space, hbool_t internal, hsize_t startbloc
HDassert(space);
HDassert(buf);
- /* Rebuild diminfo if it is invalid and has not been confirmed to be
- * impossible */
- if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_NO)
- (void)H5S_hyper_rebuild(space);
-
/* Check for a "regular" hyperslab selection */
- if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
+ if(space->select.sel_info.hslab->diminfo_valid) {
const H5S_hyper_dim_t *diminfo; /* Alias for dataspace's diminfo information */
hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary hyperslab counts */
hsize_t offset[H5O_LAYOUT_NDIMS]; /* Offset of element in dataspace */
@@ -2639,7 +2547,7 @@ H5S_get_select_hyper_blocklist(H5S_t *space, hbool_t internal, hsize_t startbloc
} /* end else */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_get_select_hyper_blocklist() */
+} /* H5S_get_select_hyper_blocklist() */
/*--------------------------------------------------------------------------
@@ -2686,7 +2594,7 @@ H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t startblock,
if(buf == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pointer")
if(NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
if(H5S_GET_SELECT_TYPE(space)!=H5S_SEL_HYPERSLABS)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a hyperslab selection")
@@ -2698,7 +2606,77 @@ H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t startblock,
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Sget_select_hyper_blocklist() */
+} /* H5Sget_select_hyper_blocklist() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S_hyper_bounds_helper
+ PURPOSE
+ Gets the bounding box containing the selection.
+ USAGE
+ htri_t H5S_hyper_bounds_helper(spans, offset, rank);
+ const H5S_hyper_span_info_t *spans; IN: Pointer to current hyperslab span tree
+ const hssize_t *offset; IN: Pointer to offset array
+ hsize_t rank; IN: Current rank looking at
+ hsize_t *start; OUT: Start array bounds
+ hsize_t *end; OUT: End array bounds
+ RETURNS
+ Non-negative on success, negative on failure
+ DESCRIPTION
+ Retrieves the bounding box containing the current selection and places
+ it into the user's buffers. The start and end buffers must be large
+ enough to hold the dataspace rank number of coordinates. The bounding box
+ exactly contains the selection, ie. if a 2-D element selection is currently
+ defined with the following points: (4,5), (6,8) (10,7), the bounding box
+ with be (4, 5), (10, 8).
+ The bounding box calculations _does_ include the current offset of the
+ selection within the dataspace extent.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static herr_t
+H5S_hyper_bounds_helper(const H5S_hyper_span_info_t *spans, const hssize_t *offset, hsize_t rank, hsize_t *start, hsize_t *end)
+{
+ H5S_hyper_span_t *curr; /* Hyperslab information nodes */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ HDassert(spans);
+ HDassert(offset);
+ HDassert(rank < H5O_LAYOUT_NDIMS);
+ HDassert(start);
+ HDassert(end);
+
+ /* Check each point to determine whether selection+offset is within extent */
+ curr=spans->head;
+ while(curr!=NULL) {
+ /* Check for offset moving selection negative */
+ if(((hssize_t)curr->low + offset[rank]) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds")
+
+ /* Check if the current span extends the bounding box */
+ if((curr->low + (hsize_t)offset[rank]) < start[rank])
+ start[rank] = curr->low + (hsize_t)offset[rank];
+ if((curr->high + (hsize_t)offset[rank]) > end[rank])
+ end[rank] = curr->high + (hsize_t)offset[rank];
+
+ /* Recurse if this node has down spans */
+ if(curr->down != NULL) {
+ if(H5S_hyper_bounds_helper(curr->down, offset, (rank + 1), start, end) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "failure in lower dimension")
+ } /* end if */
+
+ /* Advance to next node */
+ curr = curr->next;
+ } /* end while */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S_hyper_bounds_helper() */
/*--------------------------------------------------------------------------
@@ -2730,33 +2708,48 @@ done:
static herr_t
H5S_hyper_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
{
- unsigned u; /* Local index variable */
+ unsigned rank; /* Dataspace rank */
+ unsigned i; /* index variable */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI(FAIL)
- /* Sanity check */
HDassert(space);
HDassert(start);
HDassert(end);
- /* Loop over dimensions */
- for(u = 0; u < space->extent.rank; u++) {
- /* Sanity check */
- HDassert(space->select.low_bounds[u] <= space->select.high_bounds[u]);
+ /* Set the start and end arrays up */
+ rank = space->extent.rank;
+ for(i = 0; i < rank; i++) {
+ start[i] = HSIZET_MAX;
+ end[i] = 0;
+ } /* end for */
- /* Check for offset moving selection negative */
- if(((hssize_t)space->select.low_bounds[u] + space->select.offset[u]) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds")
+ /* Check for a "regular" hyperslab selection */
+ if(space->select.sel_info.hslab->diminfo_valid) {
+ const H5S_hyper_dim_t *diminfo = space->select.sel_info.hslab->opt_diminfo; /* local alias for diminfo */
- /* Set the low & high bounds in this dimension */
- start[u] = (hsize_t)((hssize_t)space->select.low_bounds[u] + space->select.offset[u]);
- end[u] = (hsize_t)((hssize_t)space->select.high_bounds[u] + space->select.offset[u]);
- } /* end for */
+ /* Check each dimension */
+ for(i = 0; i < rank; i++) {
+ /* Check for offset moving selection negative */
+ if((space->select.offset[i] + (hssize_t)diminfo[i].start) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds")
+
+ /* Compute the smallest location in this dimension */
+ start[i] = diminfo[i].start + (hsize_t)space->select.offset[i];
+
+ /* Compute the largest location in this dimension */
+ end[i] = diminfo[i].start + diminfo[i].stride * (diminfo[i].count - 1) + (diminfo[i].block - 1) + (hsize_t)space->select.offset[i];
+ } /* end for */
+ } /* end if */
+ else {
+ /* Call the recursive routine to get the bounds for the span tree */
+ ret_value = H5S_hyper_bounds_helper(space->select.sel_info.hslab->span_lst, space->select.offset, (hsize_t)0, start, end);
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_bounds() */
+} /* H5S_hyper_bounds() */
/*--------------------------------------------------------------------------
@@ -2803,8 +2796,7 @@ H5S_hyper_offset(const H5S_t *space, hsize_t *offset)
dim_size = space->extent.size;
/* Check for a "regular" hyperslab selection */
- /* (No need to rebuild the dimension info yet -QAK) */
- if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
+ if(space->select.sel_info.hslab->diminfo_valid) {
const H5S_hyper_dim_t *diminfo = space->select.sel_info.hslab->opt_diminfo; /* Local alias for diminfo */
/* Loop through starting coordinates, calculating the linear offset */
@@ -2865,7 +2857,7 @@ H5S_hyper_offset(const H5S_t *space, hsize_t *offset)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_offset() */
+} /* H5S_hyper_offset() */
/*--------------------------------------------------------------------------
@@ -2899,8 +2891,7 @@ H5S_hyper_is_contiguous(const H5S_t *space)
HDassert(space);
/* Check for a "regular" hyperslab selection */
- /* (No need to rebuild the dimension info yet -QAK) */
- if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
+ if(space->select.sel_info.hslab->diminfo_valid) {
const H5S_hyper_dim_t *diminfo=space->select.sel_info.hslab->opt_diminfo; /* local alias for diminfo */
/*
@@ -3051,7 +3042,7 @@ H5S_hyper_is_contiguous(const H5S_t *space)
} /* end else */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_is_contiguous() */
+} /* H5S_hyper_is_contiguous() */
/*--------------------------------------------------------------------------
@@ -3085,8 +3076,7 @@ H5S_hyper_is_single(const H5S_t *space)
HDassert(space);
/* Check for a "single" hyperslab selection */
- /* (No need to rebuild the dimension info yet -QAK) */
- if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
+ if(space->select.sel_info.hslab->diminfo_valid) {
/*
* For a regular hyperslab to be single, it must have only one
* block (i.e. count==1 in all dimensions)
@@ -3120,7 +3110,7 @@ H5S_hyper_is_single(const H5S_t *space)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_is_single() */
+} /* H5S_hyper_is_single() */
/*--------------------------------------------------------------------------
@@ -3153,20 +3143,14 @@ H5S_hyper_is_regular(const H5S_t *space)
/* Check args */
HDassert(space);
- /* Rebuild diminfo if it is invalid and has not been confirmed to be
- * impossible */
- if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_NO)
- /* Casting away const OK -NAF */
- (void)H5S_hyper_rebuild((H5S_t *)space);
-
/* Only simple check for regular hyperslabs for now... */
- if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES)
- ret_value = TRUE;
+ if(space->select.sel_info.hslab->diminfo_valid)
+ ret_value=TRUE;
else
- ret_value = FALSE;
+ ret_value=FALSE;
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_is_regular() */
+} /* H5S_hyper_is_regular() */
/*--------------------------------------------------------------------------
@@ -3188,8 +3172,8 @@ H5S_hyper_is_regular(const H5S_t *space)
* Robb Matzke, 1998-08-25
* The fields which are freed are set to NULL to prevent them from being
* freed again later. This fixes some allocation problems where
- * changing the hyperslab selection of one dataspace causes a core dump
- * when closing some other dataspace.
+ * changing the hyperslab selection of one data space causes a core dump
+ * when closing some other data space.
--------------------------------------------------------------------------*/
static herr_t
H5S_hyper_release(H5S_t *space)
@@ -3215,7 +3199,48 @@ H5S_hyper_release(H5S_t *space)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_release() */
+} /* H5S_hyper_release() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S_hyper_recover_span
+ PURPOSE
+ Recover a generated span, if appropriate
+ USAGE
+ herr_t H5S_hyper_recover_span(recover, curr_span, next_span)
+ unsigned *recover; IN/OUT: Pointer recover flag
+ H5S_hyper_span_t **curr_span; IN/OUT: Pointer to current span in list
+ H5S_hyper_span_t *next_span; IN: Pointer to next span
+ RETURNS
+ Non-negative on success, negative on failure
+ DESCRIPTION
+ Check if the current span needs to be recovered and free it if so.
+ Set the current span to the next span in any case.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static herr_t
+H5S_hyper_recover_span (unsigned *recover, H5S_hyper_span_t **curr_span, H5S_hyper_span_t *next_span)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ HDassert(recover);
+ HDassert(curr_span);
+
+ /* Check if the span should be recovered */
+ if(*recover) {
+ H5S_hyper_free_span(*curr_span);
+ *recover=0;
+ } /* end if */
+
+ /* Set the current span to next span */
+ *curr_span=next_span;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5S_hyper_recover_span() */
/*--------------------------------------------------------------------------
@@ -3237,11 +3262,11 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static H5S_hyper_span_t *
-H5S_hyper_coord_to_span(unsigned rank, const hsize_t *coords)
+H5S_hyper_coord_to_span(unsigned rank, hsize_t *coords)
{
H5S_hyper_span_t *new_span; /* Pointer to new span tree for coordinate */
- H5S_hyper_span_info_t *down = NULL; /* Pointer to new span tree for next level down */
- H5S_hyper_span_t *ret_value = NULL; /* Return value */
+ H5S_hyper_span_info_t *down=NULL; /* Pointer to new span tree for next level down */
+ H5S_hyper_span_t *ret_value=NULL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -3249,32 +3274,37 @@ H5S_hyper_coord_to_span(unsigned rank, const hsize_t *coords)
HDassert(coords);
/* Search for location to insert new element in tree */
- if(rank > 1) {
+ if(rank>1) {
/* Allocate a span info node */
- if(NULL == (down = H5FL_CALLOC(H5S_hyper_span_info_t)))
+ if((down = H5FL_MALLOC(H5S_hyper_span_info_t))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
+ /* Set the reference count */
+ down->count=0;
+
+ /* Reset the scratch pad space */
+ down->scratch=0;
+
/* Build span tree for coordinates below this one */
- if(NULL == (down->head = H5S_hyper_coord_to_span(rank - 1, &coords[1])))
+ if((down->head=H5S_hyper_coord_to_span(rank-1,&coords[1]))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
-
- /* Update the tail pointer of the down dimension, and it's a single span element */
- down->tail = down->head;
} /* end if */
/* Build span for this coordinate */
- if(NULL == (new_span = H5S_hyper_new_span(coords[0], coords[0], down, NULL)))
+ if((new_span = H5S_hyper_new_span(coords[0],coords[0],down,NULL))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
/* Set return value */
- ret_value = new_span;
+ ret_value=new_span;
done:
- if(ret_value == NULL && down!=NULL)
- H5S_hyper_free_span_info(down);
+ if(ret_value==NULL) {
+ if(down!=NULL)
+ H5S_hyper_free_span_info(down);
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_coord_to_span() */
+} /* H5S_hyper_coord_to_span() */
/*--------------------------------------------------------------------------
@@ -3294,29 +3324,18 @@ done:
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
Assumes that the element is not already covered by the span tree
-
- NOTE: There's an assumption about the context of this function call.
- This function is only called is only being called from
- H5D_chunk_mem_cb in src/H5Dchunk, when the library is
- iterating over a memory selection, so the coordinates passed
- to H5S_hyper_add_span_element will always be in increasing
- order (according to a row-major (i.e. C, not FORTRAN) scan
- over the dataset. Therefore, for every input of coordinates,
- only the last span element (i.e., the tail pointer) in one
- dimension is checked against the input.
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_hyper_add_span_element_helper(H5S_hyper_span_info_t *span_tree,
- unsigned rank, const hsize_t *coords)
+H5S_hyper_add_span_element_helper(H5S_hyper_span_info_t *span_tree, unsigned rank, hsize_t *coords)
{
H5S_hyper_span_info_t *tspan_info; /* Temporary pointer to span info */
H5S_hyper_span_info_t *prev_span_info; /* Pointer to span info for level above current position */
- H5S_hyper_span_t *tail_span; /* Pointer to the tail span of one dimension */
+ H5S_hyper_span_t *tmp_span; /* Temporary pointer to a span */
H5S_hyper_span_t *tmp2_span; /* Another temporary pointer to a span */
H5S_hyper_span_t *new_span; /* New span created for element */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -3325,26 +3344,38 @@ H5S_hyper_add_span_element_helper(H5S_hyper_span_info_t *span_tree,
HDassert(coords);
/* Get pointer to last span in span tree */
- tail_span = span_tree->tail;
+ tspan_info=span_tree;
+ if(span_tree->scratch)
+ tmp_span=(H5S_hyper_span_t *)span_tree->scratch;
+ else {
+ tmp_span=span_tree->head;
+ HDassert(tmp_span);
+ span_tree->scratch=(H5S_hyper_span_info_t *)tmp_span;
+ } /* end else */
/* Find last span tree which includes a portion of the coordinate */
- tspan_info = span_tree;
- prev_span_info = NULL;
- while(coords[0] >= tail_span->low && coords[0] <= tail_span->high) {
+ prev_span_info=NULL;
+ while(coords[0]>=tmp_span->low && coords[0]<=tmp_span->high) {
/* Move rank & coordinate offset down a dimension */
rank--;
coords++;
/* Remember the span tree we are descending into */
- prev_span_info = tspan_info;
- tspan_info = tail_span->down;
- HDassert(tspan_info);
- tail_span = tspan_info->tail;
+ prev_span_info=tspan_info;
+ tspan_info=tmp_span->down;
+
+ /* Get the last span in this span's 'down' tree */
+ if(tspan_info->scratch)
+ tmp_span=(H5S_hyper_span_t *)tspan_info->scratch;
+ else {
+ tmp_span=tspan_info->head;
+ HDassert(tmp_span);
+ tspan_info->scratch=(H5S_hyper_span_info_t *)tmp_span;
+ } /* end else */
} /* end while */
- HDassert(rank > 0);
/* Check if we made it all the way to the bottom span in the tree */
- if(rank > 1) {
+ if(rank>1) {
/* Before we create another span at this level in the tree, check if
* the last span's "down tree" was equal to any other spans in this
* list of spans in the span tree.
@@ -3353,31 +3384,31 @@ H5S_hyper_add_span_element_helper(H5S_hyper_span_info_t *span_tree,
* previous span (if possible), or at least share their "down tree"
* information.
*/
- tmp2_span = tspan_info->head;
- while(tmp2_span != tail_span) {
- if(TRUE == H5S_hyper_cmp_spans(tmp2_span->down, tail_span->down)) {
+ tmp2_span=tspan_info->head;
+ while(tmp2_span!=tmp_span) {
+ if(H5S_hyper_cmp_spans(tmp2_span->down,tmp_span->down)==TRUE) {
/* Check for merging into previous span */
- if(tmp2_span->high + 1 == tail_span->low) {
+ if(tmp2_span->high+1==tmp_span->low) {
/* Release last span created */
- H5S_hyper_free_span(tail_span);
+ H5S_hyper_free_span(tmp_span);
/* Increase size of previous span */
tmp2_span->high++;
tmp2_span->nelem++;
/* Reset the 'tmp_span' for the rest of this block's algorithm */
- tail_span = tmp2_span;
+ tmp_span=tmp2_span;
} /* end if */
/* Span is disjoint, but has the same "down tree" selection */
else {
/* Release "down tree" information */
- H5S_hyper_free_span_info(tail_span->down);
+ H5S_hyper_free_span_info(tmp_span->down);
/* Point at earlier span's "down tree" */
- tail_span->down = tmp2_span->down;
+ tmp_span->down=tmp2_span->down;
/* Increment reference count on shared "down tree" */
- tail_span->down->count++;
+ tmp_span->down->count++;
} /* end else */
/* Found span to merge into, break out now */
@@ -3385,30 +3416,32 @@ H5S_hyper_add_span_element_helper(H5S_hyper_span_info_t *span_tree,
} /* end if */
/* Advance to next span to check */
- tmp2_span = tmp2_span->next;
+ tmp2_span=tmp2_span->next;
} /* end while */
/* Make span tree for current coordinates */
- if(NULL == (new_span = H5S_hyper_coord_to_span(rank, coords)))
+ if((new_span=H5S_hyper_coord_to_span(rank,coords))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Add new span tree as span */
- HDassert(tail_span);
- tail_span->next = new_span;
+ HDassert(tmp_span);
+ tmp_span->next=new_span;
+
+ /* Make scratch pointer point to last span in list */
HDassert(tspan_info);
- tspan_info->tail = new_span;
+ tspan_info->scratch=(H5S_hyper_span_info_t *)new_span;
/* Set the proper 'pstride' for new span */
- new_span->pstride = new_span->low - tail_span->low;
+ new_span->pstride=new_span->low-tmp_span->low;
} /* end if */
else {
/* Does new node adjoin existing node? */
- if(tail_span->high + 1 == coords[0]) {
- tail_span->high++;
- tail_span->nelem++;
+ if(tmp_span->high+1==coords[0]) {
+ tmp_span->high++;
+ tmp_span->nelem++;
/* Check if this span tree should now be merged with a level higher in the tree */
- if(prev_span_info != NULL) {
+ if(prev_span_info!=NULL) {
/* Before we create another span at this level in the tree, check if
* the last span's "down tree" was equal to any other spans in this
* list of spans in the span tree.
@@ -3417,33 +3450,33 @@ H5S_hyper_add_span_element_helper(H5S_hyper_span_info_t *span_tree,
* previous span (if possible), or at least share their "down tree"
* information.
*/
- tmp2_span = prev_span_info->head;
- tail_span = prev_span_info->tail;
- while(tmp2_span != tail_span) {
- if(TRUE == H5S_hyper_cmp_spans(tmp2_span->down, tail_span->down)) {
+ tmp2_span=prev_span_info->head;
+ tmp_span=(H5S_hyper_span_t *)prev_span_info->scratch;
+ while(tmp2_span!=tmp_span) {
+ if(H5S_hyper_cmp_spans(tmp2_span->down,tmp_span->down)==TRUE) {
/* Check for merging into previous span */
- if(tmp2_span->high + 1 == tail_span->low) {
+ if(tmp2_span->high+1==tmp_span->low) {
/* Release last span created */
- H5S_hyper_free_span(tail_span);
+ H5S_hyper_free_span(tmp_span);
/* Increase size of previous span */
tmp2_span->high++;
tmp2_span->nelem++;
/* Update pointers */
- tmp2_span->next = NULL;
- prev_span_info->tail = tmp2_span;
+ tmp2_span->next=NULL;
+ prev_span_info->scratch=(H5S_hyper_span_info_t *)tmp2_span;
} /* end if */
/* Span is disjoint, but has the same "down tree" selection */
else {
/* Release "down tree" information */
- H5S_hyper_free_span_info(tail_span->down);
+ H5S_hyper_free_span_info(tmp_span->down);
/* Point at earlier span's "down tree" */
- tail_span->down = tmp2_span->down;
+ tmp_span->down=tmp2_span->down;
/* Increment reference count on shared "down tree" */
- tail_span->down->count++;
+ tmp_span->down->count++;
} /* end else */
/* Found span to merge into, break out now */
@@ -3451,27 +3484,29 @@ H5S_hyper_add_span_element_helper(H5S_hyper_span_info_t *span_tree,
} /* end if */
/* Advance to next span to check */
- tmp2_span = tmp2_span->next;
+ tmp2_span=tmp2_span->next;
} /* end while */
} /* end if */
} /* end if */
else {
- if(NULL == (new_span = H5S_hyper_new_span(coords[0], coords[0], NULL, NULL)))
+ if((new_span = H5S_hyper_new_span(coords[0],coords[0],NULL,NULL))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Add new span tree as span */
- HDassert(tail_span);
- tail_span->next = new_span;
- tspan_info->tail = new_span;
+ HDassert(tmp_span);
+ tmp_span->next=new_span;
+
+ /* Make scratch pointer point to last span in list */
+ tspan_info->scratch=(H5S_hyper_span_info_t *)new_span;
/* Set the proper 'pstride' for new span */
- new_span->pstride = new_span->low - tail_span->low;
+ new_span->pstride=new_span->low-tmp_span->low;
} /* end else */
} /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_add_span_element_helper() */
+} /* H5S_hyper_add_span_element_helper() */
/*--------------------------------------------------------------------------
@@ -3495,7 +3530,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5S_hyper_add_span_element(H5S_t *space, unsigned rank, const hsize_t *coords)
+H5S_hyper_add_span_element(H5S_t *space, unsigned rank, hsize_t *coords)
{
H5S_hyper_span_info_t *head = NULL; /* Pointer to new head of span tree */
herr_t ret_value = SUCCEED; /* Return value */
@@ -3505,24 +3540,23 @@ H5S_hyper_add_span_element(H5S_t *space, unsigned rank, const hsize_t *coords)
HDassert(space);
HDassert(rank > 0);
HDassert(coords);
- HDassert(space->extent.rank == rank);
/* Check if this is the first element in the selection */
if(NULL == space->select.sel_info.hslab) {
/* Allocate a span info node */
- if(NULL == (head = H5FL_CALLOC(H5S_hyper_span_info_t)))
+ if(NULL == (head = H5FL_MALLOC(H5S_hyper_span_info_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Set the reference count */
head->count = 1;
+ /* Reset the scratch pad space */
+ head->scratch = 0;
+
/* Build span tree for this coordinate */
if(NULL == (head->head = H5S_hyper_coord_to_span(rank, coords)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
- /* Update the tail pointer of this newly created span in dimension "rank" */
- head->tail = head->head;
-
/* Allocate selection info */
if(NULL == (space->select.sel_info.hslab = H5FL_MALLOC(H5S_hyper_sel_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab info")
@@ -3534,7 +3568,7 @@ H5S_hyper_add_span_element(H5S_t *space, unsigned rank, const hsize_t *coords)
space->select.type = H5S_sel_hyper;
/* Reset "regular" hyperslab flag */
- space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_NO;
+ space->select.sel_info.hslab->diminfo_valid = FALSE;
/* Set # of elements in selection */
space->select.num_elem = 1;
@@ -3553,7 +3587,7 @@ done:
H5S_hyper_free_span_info(head);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_add_span_element() */
+} /* H5S_hyper_add_span_element() */
/*--------------------------------------------------------------------------
@@ -3587,7 +3621,7 @@ H5S_hyper_reset_scratch(H5S_t *space)
H5S_hyper_span_scratch(space->select.sel_info.hslab->span_lst, NULL);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S_hyper_reset_scratch() */
+} /* H5S_hyper_reset_scratch() */
/*--------------------------------------------------------------------------
@@ -3657,7 +3691,126 @@ H5S_hyper_convert(H5S_t *space)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_convert() */
+} /* H5S_hyper_convert() */
+
+#ifdef LATER
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S_hyper_intersect_helper
+ PURPOSE
+ Helper routine to detect intersections in span trees
+ USAGE
+ htri_t H5S_hyper_intersect_helper(spans1, spans2)
+ H5S_hyper_span_info_t *spans1; IN: First span tree to operate with
+ H5S_hyper_span_info_t *spans2; IN: Second span tree to operate with
+ RETURNS
+ Non-negative on success, negative on failure
+ DESCRIPTION
+ Quickly detect intersections between two span trees
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static htri_t
+H5S_hyper_intersect_helper (H5S_hyper_span_info_t *spans1, H5S_hyper_span_info_t *spans2)
+{
+ H5S_hyper_span_t *curr1; /* Pointer to current span in 1st span tree */
+ H5S_hyper_span_t *curr2; /* Pointer to current span in 2nd span tree */
+ htri_t status; /* Status from recursive call */
+ htri_t ret_value=FALSE; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* Sanity check */
+ HDassert((spans1 && spans2) || (spans1 == NULL && spans2 == NULL));
+
+ /* "NULL" span trees compare as overlapping */
+ if(spans1==NULL && spans2==NULL)
+ HGOTO_DONE(TRUE);
+
+ /* Get the span lists for each span in this tree */
+ curr1=spans1->head;
+ curr2=spans2->head;
+
+ /* Iterate over the spans in each tree */
+ while(curr1!=NULL && curr2!=NULL) {
+ /* Check for 1st span entirely before 2nd span */
+ if(curr1->high<curr2->low)
+ curr1=curr1->next;
+ /* Check for 2nd span entirely before 1st span */
+ else if(curr2->high<curr1->low)
+ curr2=curr2->next;
+ /* Spans must overlap */
+ else {
+ /* Recursively check spans in next dimension down */
+ if((status=H5S_hyper_intersect_helper(curr1->down,curr2->down))<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "can't perform hyperslab intersection check")
+
+ /* If there is a span intersection in the down dimensions, the span trees overlap */
+ if(status==TRUE)
+ HGOTO_DONE(TRUE);
+
+ /* No intersection in down dimensions, advance to next span */
+ if(curr1->high<curr2->high)
+ curr1=curr1->next;
+ else
+ curr2=curr2->next;
+ } /* end else */
+ } /* end while */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5S_hyper_intersect_helper() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S_hyper_intersect
+ PURPOSE
+ Detect intersections in span trees
+ USAGE
+ htri_t H5S_hyper_intersect(space1, space2)
+ H5S_t *space1; IN: First dataspace to operate on span tree
+ H5S_t *space2; IN: Second dataspace to operate on span tree
+ RETURNS
+ Non-negative on success, negative on failure
+ DESCRIPTION
+ Quickly detect intersections between two span trees
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+htri_t
+H5S_hyper_intersect (H5S_t *space1, H5S_t *space2)
+{
+ htri_t ret_value=FAIL; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* Sanity check */
+ HDassert(space1);
+ HDassert(space2);
+
+ /* Check that the space selections both have span trees */
+ if(space1->select.sel_info.hslab->span_lst==NULL ||
+ space2->select.sel_info.hslab->span_lst==NULL)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree")
+
+ /* Check that the dataspaces are both the same rank */
+ if(space1->extent.rank!=space2->extent.rank)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "dataspace ranks don't match")
+
+ /* Perform the span-by-span intersection check */
+ if((ret_value=H5S_hyper_intersect_helper(space1->select.sel_info.hslab->span_lst,space2->select.sel_info.hslab->span_lst))<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "can't perform hyperslab intersection check")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5S_hyper_intersect() */
+#endif /* LATER */
/*--------------------------------------------------------------------------
@@ -3681,8 +3834,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S_hyper_intersect_block_helper(const H5S_hyper_span_info_t *spans,
- const hsize_t *start, const hsize_t *end)
+H5S_hyper_intersect_block_helper (const H5S_hyper_span_info_t *spans, hsize_t *start, hsize_t *end)
{
H5S_hyper_span_t *curr; /* Pointer to current span in 1st span tree */
htri_t status; /* Status from recursive call */
@@ -3728,7 +3880,7 @@ H5S_hyper_intersect_block_helper(const H5S_hyper_span_info_t *spans,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_intersect_block_helper() */
+} /* H5S_hyper_intersect_block_helper() */
/*--------------------------------------------------------------------------
@@ -3751,9 +3903,9 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
htri_t
-H5S_hyper_intersect_block(H5S_t *space, const hsize_t *start, const hsize_t *end)
+H5S_hyper_intersect_block (H5S_t *space, hsize_t *start, hsize_t *end)
{
- htri_t ret_value = FAIL; /* Return value */
+ htri_t ret_value=FAIL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -3764,30 +3916,30 @@ H5S_hyper_intersect_block(H5S_t *space, const hsize_t *start, const hsize_t *end
/* Check for 'all' selection, instead of a hyperslab selection */
/* (Technically, this shouldn't be in the "hyperslab" routines...) */
- if(H5S_GET_SELECT_TYPE(space) == H5S_SEL_ALL)
+ if(H5S_GET_SELECT_TYPE(space)==H5S_SEL_ALL)
HGOTO_DONE(TRUE);
/* Check that the space selection has a span tree */
- if(space->select.sel_info.hslab->span_lst == NULL)
- if(H5S_hyper_generate_spans(space) < 0)
+ if(space->select.sel_info.hslab->span_lst==NULL)
+ if(H5S_hyper_generate_spans(space)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree")
/* Perform the span-by-span intersection check */
- if((ret_value = H5S_hyper_intersect_block_helper(space->select.sel_info.hslab->span_lst, start, end)) < 0)
+ if((ret_value=H5S_hyper_intersect_block_helper(space->select.sel_info.hslab->span_lst,start,end))<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "can't perform hyperslab intersection check")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_intersect_block() */
+} /* H5S_hyper_intersect_block() */
/*--------------------------------------------------------------------------
NAME
- H5S_hyper_adjust_u_helper
+ H5S_hyper_adjust_helper_u
PURPOSE
Helper routine to adjust offsets in span trees
USAGE
- herr_t H5S_hyper_adjust_u_helper(spans, offset)
+ herr_t H5S_hyper_adjust_helper_u(spans, offset)
H5S_hyper_span_info_t *spans; IN: Span tree to operate with
const hsize_t *offset; IN: Offset to subtract
RETURNS
@@ -3800,7 +3952,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_hyper_adjust_u_helper(H5S_hyper_span_info_t *spans, const hsize_t *offset)
+H5S_hyper_adjust_helper_u (H5S_hyper_span_info_t *spans, const hsize_t *offset)
{
H5S_hyper_span_t *span; /* Pointer to current span in span tree */
@@ -3827,7 +3979,7 @@ H5S_hyper_adjust_u_helper(H5S_hyper_span_info_t *spans, const hsize_t *offset)
/* Recursively adjust spans in next dimension down */
if(span->down!=NULL)
- H5S_hyper_adjust_u_helper(span->down,offset+1);
+ H5S_hyper_adjust_helper_u(span->down,offset+1);
/* Advance to next span in this dimension */
span=span->next;
@@ -3835,7 +3987,7 @@ H5S_hyper_adjust_u_helper(H5S_hyper_span_info_t *spans, const hsize_t *offset)
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S_hyper_adjust_u_helper() */
+} /* H5S_hyper_adjust_helper_u() */
/*--------------------------------------------------------------------------
@@ -3859,9 +4011,8 @@ H5S_hyper_adjust_u_helper(H5S_hyper_span_info_t *spans, const hsize_t *offset)
static herr_t
H5S_hyper_adjust_u(H5S_t *space, const hsize_t *offset)
{
- hbool_t update_bound = FALSE; /* Indicate whether to update bound */
unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -3869,39 +4020,25 @@ H5S_hyper_adjust_u(H5S_t *space, const hsize_t *offset)
HDassert(offset);
/* Subtract the offset from the "regular" coordinates, if they exist */
- /* (No need to rebuild the dimension info yet -QAK) */
- if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
- for(u = 0; u < space->extent.rank; u++) {
- HDassert(space->select.sel_info.hslab->opt_diminfo[u].start >= offset[u]);
- space->select.sel_info.hslab->opt_diminfo[u].start -= offset[u];
+ if(space->select.sel_info.hslab->diminfo_valid) {
+ for(u=0; u<space->extent.rank; u++) {
+ HDassert(space->select.sel_info.hslab->opt_diminfo[u].start>=offset[u]);
+ space->select.sel_info.hslab->opt_diminfo[u].start-=offset[u];
} /* end for */
-
- update_bound = TRUE;
} /* end if */
/* Subtract the offset from the span tree coordinates, if they exist */
if(space->select.sel_info.hslab->span_lst) {
- if(H5S_hyper_adjust_u_helper(space->select.sel_info.hslab->span_lst, offset) < 0)
+ if(H5S_hyper_adjust_helper_u(space->select.sel_info.hslab->span_lst,offset)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "can't perform hyperslab offset adjustment")
/* Reset the scratch pointers for the next routine which needs them */
H5S_hyper_span_scratch(space->select.sel_info.hslab->span_lst, NULL);
-
- update_bound = TRUE;
- } /* end if */
-
- if(update_bound) {
- /* Update the bound box of this hyperslab */
- for(u = 0; u < space->extent.rank; u++) {
- HDassert(space->select.low_bounds[u] >= offset[u]);
- space->select.low_bounds[u] -= offset[u];
- space->select.high_bounds[u] -= offset[u];
- } /* end for */
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_adjust_u() */
+} /* H5S_hyper_adjust_u() */
/*-------------------------------------------------------------------------
@@ -3930,8 +4067,7 @@ H5S_hyper_project_scalar(const H5S_t *space, hsize_t *offset)
HDassert(offset);
/* Check for a "regular" hyperslab selection */
- /* (No need to rebuild the dimension info yet -QAK) */
- if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
+ if(space->select.sel_info.hslab->diminfo_valid) {
const H5S_hyper_dim_t *diminfo = space->select.sel_info.hslab->opt_diminfo; /* Alias for dataspace's diminfo information */
unsigned u; /* Counter */
@@ -3966,11 +4102,11 @@ H5S_hyper_project_scalar(const H5S_t *space, hsize_t *offset)
} /* end else */
/* Calculate offset of selection in projected buffer */
- *offset = H5VM_array_offset(space->extent.rank, space->extent.size, block);
+ *offset = H5VM_array_offset(space->extent.rank, space->extent.size, block);
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_project_scalar() */
+} /* H5S_hyper_project_scalar() */
/*-------------------------------------------------------------------------
@@ -3991,7 +4127,6 @@ H5S_hyper_project_simple_lower(const H5S_t *base_space, H5S_t *new_space)
{
H5S_hyper_span_info_t *down; /* Pointer to list of spans */
unsigned curr_dim; /* Current dimension being operated on */
- unsigned u; /* Local index variable */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -4013,18 +4148,12 @@ H5S_hyper_project_simple_lower(const H5S_t *base_space, H5S_t *new_space)
} /* end while */
HDassert(down);
- /* Update the bounding box */
- for(u = 0; u < new_space->extent.rank; u++) {
- new_space->select.low_bounds[u] = base_space->select.low_bounds[u + curr_dim];
- new_space->select.high_bounds[u] = base_space->select.high_bounds[u + curr_dim];
- } /* end for */
-
/* Share the underlying hyperslab span information */
new_space->select.sel_info.hslab->span_lst = down;
new_space->select.sel_info.hslab->span_lst->count++;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S_hyper_project_simple_lower() */
+} /* H5S_hyper_project_simple_lower() */
/*-------------------------------------------------------------------------
@@ -4045,7 +4174,6 @@ H5S_hyper_project_simple_higher(const H5S_t *base_space, H5S_t *new_space)
{
H5S_hyper_span_t *prev_span = NULL; /* Pointer to previous list of spans */
unsigned curr_dim; /* Current dimension being operated on */
- unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -4063,7 +4191,7 @@ H5S_hyper_project_simple_higher(const H5S_t *base_space, H5S_t *new_space)
H5S_hyper_span_t *new_span; /* Temporary hyperslab span */
/* Allocate a new span_info node */
- if(NULL == (new_span_info = H5FL_CALLOC(H5S_hyper_span_info_t))) {
+ if(NULL == (new_span_info = H5FL_MALLOC(H5S_hyper_span_info_t))) {
if(prev_span)
if(H5S_hyper_free_span(prev_span) < 0)
HERROR(H5E_DATASPACE, H5E_CANTFREE, "can't free hyperslab span");
@@ -4075,7 +4203,7 @@ H5S_hyper_project_simple_higher(const H5S_t *base_space, H5S_t *new_space)
prev_span->down = new_span_info;
/* Allocate a new node */
- if(NULL == (new_span = H5S_hyper_new_span((hsize_t)0, (hsize_t)0, NULL, NULL))) {
+ if(NULL == (new_span = H5S_hyper_new_span(0, 0, NULL, NULL))) {
HDassert(new_span_info);
if(!prev_span)
(void)H5FL_FREE(H5S_hyper_span_info_t, new_span_info);
@@ -4084,8 +4212,8 @@ H5S_hyper_project_simple_higher(const H5S_t *base_space, H5S_t *new_space)
/* Set the span_info information */
new_span_info->count = 1;
+ new_span_info->scratch = NULL;
new_span_info->head = new_span;
- new_span_info->tail = new_span;
/* Attach to new space, if top span info */
if(NULL == new_space->select.sel_info.hslab->span_lst)
@@ -4100,16 +4228,6 @@ H5S_hyper_project_simple_higher(const H5S_t *base_space, H5S_t *new_space)
HDassert(new_space->select.sel_info.hslab->span_lst);
HDassert(prev_span);
- /* Update the bounding box */
- for(u = 0; u < curr_dim; u++) {
- new_space->select.low_bounds[u] = 0;
- new_space->select.high_bounds[u] = 0;
- } /* end for */
- for(; u < new_space->extent.rank; u++) {
- new_space->select.low_bounds[u] = base_space->select.low_bounds[u - curr_dim];
- new_space->select.high_bounds[u] = base_space->select.high_bounds[u - curr_dim];
- } /* end for */
-
/* Share the underlying hyperslab span information */
prev_span->down = base_space->select.sel_info.hslab->span_lst;
prev_span->down->count++;
@@ -4125,7 +4243,7 @@ done:
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_project_simple_higher() */
+} /* H5S_hyper_project_simple_higher() */
/*-------------------------------------------------------------------------
@@ -4162,22 +4280,21 @@ H5S_hyper_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *off
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab info")
/* Check for a "regular" hyperslab selection */
- /* (No need to rebuild the dimension info yet -QAK) */
- if(base_space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
+ if(base_space->select.sel_info.hslab->diminfo_valid) {
unsigned base_space_dim; /* Current dimension in the base dataspace */
unsigned new_space_dim; /* Current dimension in the new dataspace */
- unsigned u; /* Local index variable */
/* Check if the new space's rank is < or > base space's rank */
if(new_space->extent.rank < base_space->extent.rank) {
const H5S_hyper_dim_t *opt_diminfo = base_space->select.sel_info.hslab->opt_diminfo; /* Alias for dataspace's diminfo information */
hsize_t block[H5S_MAX_RANK]; /* Block selected in base dataspace */
+ unsigned u; /* Local index variable */
/* Compute the offset for the down-projection */
HDmemset(block, 0, sizeof(block));
for(u = 0; u < (base_space->extent.rank - new_space->extent.rank); u++)
block[u] = opt_diminfo[u].start;
- *offset = H5VM_array_offset(base_space->extent.rank, base_space->extent.size, block);
+ *offset = H5VM_array_offset(base_space->extent.rank, base_space->extent.size, block);
/* Set the correct dimensions for the base & new spaces */
base_space_dim = base_space->extent.rank - new_space->extent.rank;
@@ -4208,22 +4325,22 @@ H5S_hyper_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *off
/* Copy the diminfo */
while(base_space_dim < base_space->extent.rank) {
- new_space->select.sel_info.hslab->app_diminfo[new_space_dim].start =
+ new_space->select.sel_info.hslab->app_diminfo[new_space_dim].start =
base_space->select.sel_info.hslab->app_diminfo[base_space_dim].start;
- new_space->select.sel_info.hslab->app_diminfo[new_space_dim].stride =
+ new_space->select.sel_info.hslab->app_diminfo[new_space_dim].stride =
base_space->select.sel_info.hslab->app_diminfo[base_space_dim].stride;
- new_space->select.sel_info.hslab->app_diminfo[new_space_dim].count =
+ new_space->select.sel_info.hslab->app_diminfo[new_space_dim].count =
base_space->select.sel_info.hslab->app_diminfo[base_space_dim].count;
- new_space->select.sel_info.hslab->app_diminfo[new_space_dim].block =
+ new_space->select.sel_info.hslab->app_diminfo[new_space_dim].block =
base_space->select.sel_info.hslab->app_diminfo[base_space_dim].block;
- new_space->select.sel_info.hslab->opt_diminfo[new_space_dim].start =
+ new_space->select.sel_info.hslab->opt_diminfo[new_space_dim].start =
base_space->select.sel_info.hslab->opt_diminfo[base_space_dim].start;
new_space->select.sel_info.hslab->opt_diminfo[new_space_dim].stride =
base_space->select.sel_info.hslab->opt_diminfo[base_space_dim].stride;
- new_space->select.sel_info.hslab->opt_diminfo[new_space_dim].count =
+ new_space->select.sel_info.hslab->opt_diminfo[new_space_dim].count =
base_space->select.sel_info.hslab->opt_diminfo[base_space_dim].count;
- new_space->select.sel_info.hslab->opt_diminfo[new_space_dim].block =
+ new_space->select.sel_info.hslab->opt_diminfo[new_space_dim].block =
base_space->select.sel_info.hslab->opt_diminfo[base_space_dim].block;
/* Advance to next dimensions */
@@ -4231,14 +4348,8 @@ H5S_hyper_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *off
new_space_dim++;
} /* end for */
- /* Update the bounding box */
- for(u = 0; u < new_space->extent.rank; u++) {
- new_space->select.low_bounds[u] = new_space->select.sel_info.hslab->opt_diminfo[u].start;
- new_space->select.high_bounds[u] = new_space->select.low_bounds[u] + new_space->select.sel_info.hslab->opt_diminfo[u].stride * (new_space->select.sel_info.hslab->opt_diminfo[u].count - 1) + (new_space->select.sel_info.hslab->opt_diminfo[u].block - 1);
- } /* end for */
-
/* Indicate that the dimension information is valid */
- new_space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_YES;
+ new_space->select.sel_info.hslab->diminfo_valid = TRUE;
/* Indicate that there's no slab information */
new_space->select.sel_info.hslab->span_lst = NULL;
@@ -4266,7 +4377,7 @@ H5S_hyper_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *off
} /* end while */
/* Compute the offset for the down-projection */
- *offset = H5VM_array_offset(base_space->extent.rank, base_space->extent.size, block);
+ *offset = H5VM_array_offset(base_space->extent.rank, base_space->extent.size, block);
/* Project the base space's selection down in less dimensions */
if(H5S_hyper_project_simple_lower(base_space, new_space) < 0)
@@ -4278,13 +4389,13 @@ H5S_hyper_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *off
/* The offset is zero when projected into higher dimensions */
*offset = 0;
- /* Project the base space's selection down in more dimensions */
+ /* Project the base space's selection down in less dimensions */
if(H5S_hyper_project_simple_higher(base_space, new_space) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't project hyperslab selection into less dimensions")
} /* end else */
- /* Copy the status of the dimension information */
- new_space->select.sel_info.hslab->diminfo_valid = base_space->select.sel_info.hslab->diminfo_valid;
+ /* Indicate that the dimension information is not valid */
+ new_space->select.sel_info.hslab->diminfo_valid = FALSE;
} /* end else */
/* Number of elements selected will be the same */
@@ -4295,16 +4406,16 @@ H5S_hyper_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *off
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_project_simple() */
+} /* H5S_hyper_project_simple() */
/*--------------------------------------------------------------------------
NAME
- H5S_hyper_adjust_s_helper
+ H5S_hyper_adjust_helper_s
PURPOSE
Helper routine to adjust offsets in span trees
USAGE
- herr_t H5S_hyper_adjust_s_helper(spans, offset)
+ herr_t H5S_hyper_adjust_helper_s(spans, offset)
H5S_hyper_span_info_t *spans; IN: Span tree to operate with
const hssize_t *offset; IN: Offset to subtract
RETURNS
@@ -4317,7 +4428,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_hyper_adjust_s_helper(H5S_hyper_span_info_t *spans, const hssize_t *offset)
+H5S_hyper_adjust_helper_s(H5S_hyper_span_info_t *spans, const hssize_t *offset)
{
H5S_hyper_span_t *span; /* Pointer to current span in span tree */
@@ -4344,7 +4455,7 @@ H5S_hyper_adjust_s_helper(H5S_hyper_span_info_t *spans, const hssize_t *offset)
/* Recursively adjust spans in next dimension down */
if(span->down != NULL)
- H5S_hyper_adjust_s_helper(span->down, offset + 1);
+ H5S_hyper_adjust_helper_s(span->down, offset + 1);
/* Advance to next span in this dimension */
span = span->next;
@@ -4352,7 +4463,7 @@ H5S_hyper_adjust_s_helper(H5S_hyper_span_info_t *spans, const hssize_t *offset)
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S_hyper_adjust_s_helper() */
+} /* H5S_hyper_adjust_helper_s() */
/*--------------------------------------------------------------------------
@@ -4376,7 +4487,6 @@ H5S_hyper_adjust_s_helper(H5S_hyper_span_info_t *spans, const hssize_t *offset)
herr_t
H5S_hyper_adjust_s(H5S_t *space, const hssize_t *offset)
{
- hbool_t update_bound = FALSE; /* Indicate whether to update bound */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
@@ -4386,42 +4496,25 @@ H5S_hyper_adjust_s(H5S_t *space, const hssize_t *offset)
HDassert(offset);
/* Subtract the offset from the "regular" coordinates, if they exist */
- /* (No need to rebuild the dimension info yet -QAK) */
- if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
+ if(space->select.sel_info.hslab->diminfo_valid) {
for(u = 0; u < space->extent.rank; u++) {
HDassert((hssize_t)space->select.sel_info.hslab->opt_diminfo[u].start >= offset[u]);
space->select.sel_info.hslab->opt_diminfo[u].start = (hsize_t)((hssize_t)space->select.sel_info.hslab->opt_diminfo[u].start - offset[u]);
} /* end for */
-
- update_bound = TRUE;
} /* end if */
/* Subtract the offset from the span tree coordinates, if they exist */
if(space->select.sel_info.hslab->span_lst) {
- if(H5S_hyper_adjust_s_helper(space->select.sel_info.hslab->span_lst, offset) < 0)
+ if(H5S_hyper_adjust_helper_s(space->select.sel_info.hslab->span_lst, offset) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "can't perform hyperslab offset adjustment")
/* Reset the scratch pointers for the next routine which needs them */
H5S_hyper_span_scratch(space->select.sel_info.hslab->span_lst, NULL);
-
- update_bound = TRUE;
- } /* end if */
-
- if(update_bound) {
- /* Update the bound box of this hyperslab */
- for(u = 0; u < space->extent.rank; u++) {
- hssize_t tmp = (hssize_t)space->select.low_bounds[u];
-
- HDassert(tmp >= offset[u]);
- space->select.low_bounds[u] = (hsize_t)(tmp - offset[u]);
- tmp = (hssize_t)space->select.high_bounds[u];
- space->select.high_bounds[u] = (hsize_t)(tmp - offset[u]);
- } /* end for */
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_adjust_s() */
+} /* H5S_hyper_adjust_s() */
/*--------------------------------------------------------------------------
@@ -4476,7 +4569,7 @@ H5S_hyper_normalize_offset(H5S_t *space, hssize_t *old_offset)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_normalize_offset() */
+} /* H5S_hyper_normalize_offset() */
/*--------------------------------------------------------------------------
@@ -4519,7 +4612,7 @@ H5S_hyper_denormalize_offset(H5S_t *space, const hssize_t *old_offset)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_denormalize_offset() */
+} /* H5S_hyper_denormalize_offset() */
/*--------------------------------------------------------------------------
@@ -4545,8 +4638,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_hyper_append_span(H5S_hyper_span_t **prev_span, H5S_hyper_span_info_t **span_tree,
- hsize_t low, hsize_t high, H5S_hyper_span_info_t *down, H5S_hyper_span_t *next)
+H5S_hyper_append_span (H5S_hyper_span_t **prev_span, H5S_hyper_span_info_t ** span_tree, hsize_t low, hsize_t high, H5S_hyper_span_info_t *down, H5S_hyper_span_t *next)
{
H5S_hyper_span_t *new_span = NULL;
herr_t ret_value = SUCCEED; /* Return value */
@@ -4557,51 +4649,51 @@ H5S_hyper_append_span(H5S_hyper_span_t **prev_span, H5S_hyper_span_info_t **span
HDassert(span_tree);
/* Check for adding first node to merged spans */
- if(*prev_span == NULL) {
+ if(*prev_span==NULL) {
/* Allocate new span node to append to list */
- if(NULL == (new_span = H5S_hyper_new_span(low, high, down, next)))
+ if((new_span = H5S_hyper_new_span(low,high,down,next))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Make first node in span list */
/* Check that we haven't already allocated a span tree */
- HDassert(*span_tree == NULL);
+ HDassert(*span_tree==NULL);
/* Allocate a new span_info node */
- if(NULL == (*span_tree = H5FL_CALLOC(H5S_hyper_span_info_t)))
+ if((*span_tree = H5FL_MALLOC(H5S_hyper_span_info_t))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Set the span tree's basic information */
- (*span_tree)->count = 1;
- (*span_tree)->head = new_span;
- (*span_tree)->tail = new_span;
+ (*span_tree)->count=1;
+ (*span_tree)->scratch=NULL;
+ (*span_tree)->head=new_span;
/* Update previous merged span */
- *prev_span = new_span;
+ *prev_span=new_span;
} /* end if */
/* Merge or append to existing merged spans list */
else {
/* Check if span can just extend the previous merged span */
- if((((*prev_span)->high + 1) == low) &&
- TRUE == H5S_hyper_cmp_spans(down, (*prev_span)->down)) {
+ if((((*prev_span)->high+1)==low) &&
+ H5S_hyper_cmp_spans(down,(*prev_span)->down)==TRUE) {
/* Extend previous merged span to include new high bound */
- (*prev_span)->high = high;
- (*prev_span)->nelem += (high - low) + 1;
+ (*prev_span)->high=high;
+ (*prev_span)->nelem+=(high-low)+1;
} /* end if */
else {
/* Allocate new span node to append to list */
- if(NULL == (new_span = H5S_hyper_new_span(low, high, down, next)))
+ if((new_span = H5S_hyper_new_span(low,high,down,next))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Check if there is actually a down span */
if(new_span->down) {
/* Check if the down spans for the new span node are the same as the previous span node */
- if(TRUE == H5S_hyper_cmp_spans(new_span->down, (*prev_span)->down)) {
+ if(H5S_hyper_cmp_spans(new_span->down,(*prev_span)->down)==TRUE) {
/* Release the down span for the new node */
H5S_hyper_free_span_info(new_span->down);
/* Point the new node's down span at the previous node's down span */
- new_span->down = (*prev_span)->down;
+ new_span->down=(*prev_span)->down;
/* Increment the reference count to the shared down span */
new_span->down->count++;
@@ -4609,23 +4701,23 @@ H5S_hyper_append_span(H5S_hyper_span_t **prev_span, H5S_hyper_span_info_t **span
} /* end if */
/* Indicate elements from previous span */
- new_span->pstride = low - (*prev_span)->low;
+ new_span->pstride=low-(*prev_span)->low;
/* Append to end of merged spans list */
- (*prev_span)->next = new_span;
- *prev_span = new_span;
-
- (*span_tree)->tail = new_span;
+ (*prev_span)->next=new_span;
+ *prev_span=new_span;
} /* end else */
} /* end else */
done:
- if(ret_value < 0)
- if(new_span && H5S_hyper_free_span(new_span) < 0)
- HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "failed to release new hyperslab span")
+ if(ret_value < 0) {
+ if(new_span)
+ if(H5S_hyper_free_span(new_span) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "failed to release new hyperslab span")
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_append_span() */
+} /* H5S_hyper_append_span() */
/*--------------------------------------------------------------------------
@@ -4634,24 +4726,9 @@ done:
PURPOSE
Clip a new span tree against the current spans in the hyperslab selection
USAGE
- herr_t H5S_hyper_clip_spans(span_a, span_b, selector, cur_dim, dim_size,
- span_a_b_bounds[4], all_clips_bound,
- a_not_b, a_and_b, b_not_a)
+ herr_t H5S_hyper_clip_spans(span_a, span_b, a_not_b, a_and_b, b_not_a)
H5S_hyper_span_t *a_spans; IN: Span tree 'a' to clip with.
H5S_hyper_span_t *b_spans; IN: Span tree 'b' to clip with.
- unsigned int selector; IN: The parameter deciding which output is needed
- (only considering the last three bits ABC:
- If A is set, then a_not_b is needed;
- If B is set, then a_and_b is needed;
- If C is set, then b_not_a is needed;
- )
- unsigned int cur_dim; IN: The dimension in which this clip operation
- is performed.
- unsigned int dim_size; IN: The dimension size.
- const hsize_t *span_a_b_bounds[4]; IN: The bound box of span a and span b.
- hsize_t *all_clips_bounds; OUT: The array containing the bounds box
- of all three clipped span tree in the order
- a_not_b, a_and_b and b_not_a.
H5S_hyper_span_t **a_not_b; OUT: Span tree of 'a' hyperslab spans which
doesn't overlap with 'b' hyperslab
spans.
@@ -4674,29 +4751,21 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_spans,
- unsigned int selector, unsigned cur_dim, unsigned dim_size,
- const hsize_t *span_a_b_bounds[4], hsize_t *all_clips_bounds,
+H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_spans,
H5S_hyper_span_info_t **a_not_b, H5S_hyper_span_info_t **a_and_b,
H5S_hyper_span_info_t **b_not_a)
{
- H5S_hyper_span_t *span_a; /* Pointer to a node in span tree 'a' */
- H5S_hyper_span_t *span_b; /* Pointer to a node in span tree 'b' */
- const hsize_t *span_a_low_bounds; /* The low bound array for span a */
- const hsize_t *span_a_high_bounds; /* The high bound array for span a */
- const hsize_t *span_b_low_bounds; /* The low bound array for span b */
- const hsize_t *span_b_high_bounds; /* The high bound array for span b */
- hsize_t *a_not_b_low_bounds; /* The low bound array for a_not_b */
- hsize_t *a_not_b_high_bounds; /* The high bound array for a_not_b */
- hsize_t *a_and_b_low_bounds; /* The low bound array for a_and_b */
- hsize_t *a_and_b_high_bounds; /* The high bound array for a_and_b */
- hsize_t *b_not_a_low_bounds; /* The low bound array for b_not_a */
- hsize_t *b_not_a_high_bounds; /* The high bound array for b_not_a */
- hbool_t need_a_not_b = FALSE; /* Whether to generate a_not_b list */
- hbool_t need_a_and_b = FALSE; /* Whether to generate a_and_b list */
- hbool_t need_b_not_a = FALSE; /* Whether to generate b_not_a list */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5S_hyper_span_t *span_a; /* Pointer to a node in span tree 'a' */
+ H5S_hyper_span_t *span_b; /* Pointer to a node in span tree 'b' */
+ H5S_hyper_span_t *tmp_span; /* Temporary pointer to new span */
+ H5S_hyper_span_t *last_a_not_b; /* Pointer to previous node in span tree 'a_not_b' */
+ H5S_hyper_span_t *last_a_and_b; /* Pointer to previous node in span tree 'a_and_b' */
+ H5S_hyper_span_t *last_b_not_a; /* Pointer to previous node in span tree 'b_not_a' */
+ H5S_hyper_span_info_t *down_a_not_b; /* Temporary pointer to a_not_b span tree of down spans for overlapping nodes */
+ H5S_hyper_span_info_t *down_a_and_b; /* Temporary pointer to a_and_b span tree of down spans for overlapping nodes */
+ H5S_hyper_span_info_t *down_b_not_a; /* Temporary pointer to b_and_a span tree of down spans for overlapping nodes */
+ unsigned recover_a, recover_b; /* Flags to indicate when to recover temporary spans */
+ herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -4706,151 +4775,76 @@ H5S_hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_sp
HDassert(a_not_b);
HDassert(a_and_b);
HDassert(b_not_a);
- HDassert(cur_dim < dim_size);
- HDassert(all_clips_bounds);
- HDassert(span_a_b_bounds);
-
- /* Set the values of bound box pointers */
- span_a_low_bounds = span_a_b_bounds[0];
- span_a_high_bounds = span_a_b_bounds[1];
- span_b_low_bounds = span_a_b_bounds[2];
- span_b_high_bounds = span_a_b_bounds[3];
- a_not_b_low_bounds = all_clips_bounds;
- a_not_b_high_bounds = all_clips_bounds + dim_size;
- a_and_b_low_bounds = all_clips_bounds + 2 * dim_size;
- a_and_b_high_bounds = all_clips_bounds + 3 * dim_size;
- b_not_a_low_bounds = all_clips_bounds + 4 * dim_size;
- b_not_a_high_bounds = all_clips_bounds + 5 * dim_size;
-
- /* Set which list(s) to be generated, based on selector */
- if(H5S_HYPER_COMPUTE_B_NOT_A == (selector & H5S_HYPER_COMPUTE_B_NOT_A))
- need_b_not_a = TRUE;
- if(H5S_HYPER_COMPUTE_A_AND_B == (selector & H5S_HYPER_COMPUTE_A_AND_B))
- need_a_and_b = TRUE;
- if(H5S_HYPER_COMPUTE_A_NOT_B == (selector & H5S_HYPER_COMPUTE_A_NOT_B))
- need_a_not_b = TRUE;
/* Check if both span trees are not defined */
- if(a_spans == NULL && b_spans == NULL) {
- *a_not_b = NULL;
- *a_and_b = NULL;
- *b_not_a = NULL;
+ if(a_spans==NULL && b_spans==NULL) {
+ *a_not_b=NULL;
+ *a_and_b=NULL;
+ *b_not_a=NULL;
} /* end if */
/* If span 'a' is not defined, but 'b' is, copy 'b' and set the other return span trees to empty */
- else if(a_spans == NULL) {
- *a_not_b = NULL;
- *a_and_b = NULL;
- if(need_b_not_a) {
- if(NULL == (*b_not_a = H5S_hyper_copy_span(b_spans)))
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, FAIL, "can't copy hyperslab span tree")
-
- /* update b_not_a's bound box based on the values from span_b's bound box */
- for(u = cur_dim; u < dim_size; u++) {
- b_not_a_low_bounds[u] = MIN(b_not_a_low_bounds[u], span_b_low_bounds[u]);
- b_not_a_high_bounds[u] = MAX(b_not_a_high_bounds[u], span_b_high_bounds[u]);
- } /* end for */
- } /* end if */
- else
- *b_not_a = NULL;
+ else if(a_spans==NULL) {
+ *a_not_b=NULL;
+ *a_and_b=NULL;
+ if((*b_not_a=H5S_hyper_copy_span(b_spans))==NULL)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, FAIL, "can't copy hyperslab span tree")
} /* end if */
/* If span 'b' is not defined, but 'a' is, copy 'a' and set the other return span trees to empty */
- else if(b_spans == NULL) {
- *a_and_b = NULL;
- *b_not_a = NULL;
- if(need_a_not_b) {
- if(NULL == (*a_not_b = H5S_hyper_copy_span(a_spans)))
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, FAIL, "can't copy hyperslab span tree")
-
- /* update b_not_a's bound box based on the values from span_a's bound box */
- for(u = cur_dim; u < dim_size; u++) {
- a_not_b_low_bounds[u] = MIN(a_not_b_low_bounds[u], span_a_low_bounds[u]);
- a_not_b_high_bounds[u] = MAX(a_not_b_high_bounds[u], span_a_high_bounds[u]);
- } /* end for */
- } /* end if */
- else
- *a_not_b = NULL;
+ else if(b_spans==NULL) {
+ if((*a_not_b=H5S_hyper_copy_span(a_spans))==NULL)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, FAIL, "can't copy hyperslab span tree")
+ *a_and_b=NULL;
+ *b_not_a=NULL;
} /* end if */
/* If span 'a' and 'b' are both defined, calculate the proper span trees */
else {
/* Check if both span trees completely overlap */
- if(H5S_hyper_cmp_spans(a_spans, b_spans) == TRUE) {
- *a_not_b = NULL;
- *b_not_a = NULL;
- if(need_a_and_b) {
- if(NULL == (*a_and_b = H5S_hyper_copy_span(a_spans)))
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, FAIL, "can't copy hyperslab span tree")
-
- /* update a_and_b's bound box based on the values from span_a's bound box */
- for(u = cur_dim; u < dim_size; u++) {
- a_and_b_low_bounds[u] = MIN(a_and_b_low_bounds[u], span_a_low_bounds[u]);
- a_and_b_high_bounds[u] = MAX(a_and_b_high_bounds[u], span_a_high_bounds[u]);
- } /* end for */
- } /* end if */
- else
- *a_and_b = NULL;
+ if(H5S_hyper_cmp_spans(a_spans,b_spans)==TRUE) {
+ *a_not_b=NULL;
+ if((*a_and_b=H5S_hyper_copy_span(a_spans))==NULL)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, FAIL, "can't copy hyperslab span tree")
+ *b_not_a=NULL;
} /* end if */
else {
- H5S_hyper_span_t *last_a_not_b; /* Pointer to previous node in span tree 'a_not_b' */
- H5S_hyper_span_t *last_a_and_b; /* Pointer to previous node in span tree 'a_and_b' */
- H5S_hyper_span_t *last_b_not_a; /* Pointer to previous node in span tree 'b_not_a' */
- hbool_t update_a_not_b_bounds, update_b_not_a_bounds; /* Flags to indicate that bounds should be updated */
- hbool_t recover_a, recover_b; /* Flags to indicate when to recover temporary spans */
-
/* Get the pointers to the new and old span lists */
- span_a = a_spans->head;
- span_b = b_spans->head;
+ span_a=a_spans->head;
+ span_b=b_spans->head;
- /* Reset the pointers to the previous spans */
- last_a_not_b = last_a_and_b = last_b_not_a = NULL;
+ /* Set the pointer to the previous spans */
+ last_a_not_b=NULL;
+ last_a_and_b=NULL;
+ last_b_not_a=NULL;
/* No spans to recover yet */
- recover_a = recover_b = FALSE;
-
- /* No bounds to update yet */
- update_a_not_b_bounds = update_b_not_a_bounds = FALSE;
+ recover_a=recover_b=0;
/* Work through the list of spans in the new list */
- while(span_a != NULL && span_b != NULL) {
- H5S_hyper_span_info_t *down_a_not_b; /* Temporary pointer to a_not_b span tree of down spans for overlapping nodes */
- H5S_hyper_span_info_t *down_a_and_b; /* Temporary pointer to a_and_b span tree of down spans for overlapping nodes */
- H5S_hyper_span_info_t *down_b_not_a; /* Temporary pointer to b_and_a span tree of down spans for overlapping nodes */
- H5S_hyper_span_t *tmp_span; /* Temporary pointer to new span */
-
+ while(span_a!=NULL && span_b!=NULL) {
/* Check if span 'a' is completely before span 'b' */
/* AAAAAAA */
/* <-----------------------------------> */
/* BBBBBBBBBB */
- if(span_a->high < span_b->low) {
+ if(span_a->high<span_b->low) {
/* Copy span 'a' and add to a_not_b list */
/* Merge/add span 'a' with/to a_not_b list */
- if(need_a_not_b) {
- if(H5S_hyper_append_span(&last_a_not_b, a_not_b, span_a->low, span_a->high, span_a->down, NULL) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
-
- /* Indicate that the a_not_b bounds should be updated */
- update_a_not_b_bounds = TRUE;
- } /* end if */
+ if(H5S_hyper_append_span(&last_a_not_b,a_not_b,span_a->low,span_a->high,span_a->down,NULL)==FAIL)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Advance span 'a', leave span 'b' */
- H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next);
+ H5S_hyper_recover_span(&recover_a,&span_a,span_a->next);
} /* end if */
/* Check if span 'a' overlaps only the lower bound */
/* of span 'b' , up to the upper bound of span 'b' */
/* AAAAAAAAAAAA */
/* <-----------------------------------> */
/* BBBBBBBBBB */
- else if(span_a->low < span_b->low && (span_a->high >= span_b->low && span_a->high <= span_b->high)) {
+ else if(span_a->low<span_b->low && (span_a->high>=span_b->low && span_a->high<=span_b->high)) {
/* Split span 'a' into two parts at the low bound of span 'b' */
/* Merge/add lower part of span 'a' with/to a_not_b list */
- if(need_a_not_b) {
- if(H5S_hyper_append_span(&last_a_not_b, a_not_b, span_a->low, span_b->low - 1, span_a->down, NULL) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
-
- /* Indicate that the a_not_b bounds should be updated */
- update_a_not_b_bounds = TRUE;
- } /* end if */
+ if(H5S_hyper_append_span(&last_a_not_b,a_not_b,span_a->low,span_b->low-1,span_a->down,NULL)==FAIL)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Check for overlaps between upper part of span 'a' and lower part of span 'b' */
@@ -4858,33 +4852,26 @@ H5S_hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_sp
HDassert((span_a->down != NULL && span_b->down != NULL) || (span_a->down == NULL && span_b->down == NULL));
/* If there are no down spans, just add the overlapping area to the a_and_b list */
- if(span_a->down == NULL) {
+ if(span_a->down==NULL) {
/* Merge/add overlapped part with/to a_and_b list */
- if(need_a_and_b)
- if(H5S_hyper_append_span(&last_a_and_b, a_and_b, span_b->low, span_a->high, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
+ if(H5S_hyper_append_span(&last_a_and_b,a_and_b,span_b->low,span_a->high,NULL,NULL)==FAIL)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
} /* end if */
/* If there are down spans, check for the overlap in them and add to each appropriate list */
else {
/* NULL out the temporary pointers to clipped areas in down spans */
- down_a_not_b = NULL;
- down_a_and_b = NULL;
- down_b_not_a = NULL;
+ down_a_not_b=NULL;
+ down_a_and_b=NULL;
+ down_b_not_a=NULL;
/* Check for overlaps in the 'down spans' of span 'a' & 'b' */
- /** Note: since the bound box of remaining dimensions
- * has been updated in the following clip function (via
- * all_clips_bounds), there's no need updating the bound box
- * after each append call in the following codes */
- if(H5S_hyper_clip_spans(span_a->down, span_b->down, selector, cur_dim + 1, dim_size, span_a_b_bounds, all_clips_bounds, &down_a_not_b, &down_a_and_b, &down_b_not_a) < 0)
+ if(H5S_hyper_clip_spans(span_a->down,span_b->down,&down_a_not_b,&down_a_and_b,&down_b_not_a)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information")
/* Check for additions to the a_not_b list */
- if(down_a_not_b) {
- HDassert(need_a_not_b == TRUE);
-
+ if(down_a_not_b!=NULL) {
/* Merge/add overlapped part with/to a_not_b list */
- if(H5S_hyper_append_span(&last_a_not_b, a_not_b, span_b->low, span_a->high, down_a_not_b, NULL) < 0)
+ if(H5S_hyper_append_span(&last_a_not_b,a_not_b,span_b->low,span_a->high,down_a_not_b,NULL)==FAIL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Release the down span tree generated */
@@ -4892,11 +4879,9 @@ H5S_hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_sp
} /* end if */
/* Check for additions to the a_and_b list */
- if(down_a_and_b) {
- HDassert(need_a_and_b == TRUE);
-
+ if(down_a_and_b!=NULL) {
/* Merge/add overlapped part with/to a_and_b list */
- if(H5S_hyper_append_span(&last_a_and_b, a_and_b, span_b->low, span_a->high, down_a_and_b, NULL) < 0)
+ if(H5S_hyper_append_span(&last_a_and_b,a_and_b,span_b->low,span_a->high,down_a_and_b,NULL)==FAIL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Release the down span tree generated */
@@ -4904,11 +4889,9 @@ H5S_hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_sp
} /* end if */
/* Check for additions to the b_not_a list */
- if(down_b_not_a) {
- HDassert(need_b_not_a == TRUE);
-
+ if(down_b_not_a!=NULL) {
/* Merge/add overlapped part with/to b_not_a list */
- if(H5S_hyper_append_span(&last_b_not_a, b_not_a, span_b->low, span_a->high, down_b_not_a, NULL) < 0)
+ if(H5S_hyper_append_span(&last_b_not_a,b_not_a,span_b->low,span_a->high,down_b_not_a,NULL)==FAIL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Release the down span tree generated */
@@ -4919,23 +4902,23 @@ H5S_hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_sp
/* Split off upper part of span 'b' at upper span of span 'a' */
/* Check if there is actually an upper part of span 'b' to split off */
- if(span_a->high < span_b->high) {
+ if(span_a->high<span_b->high) {
/* Allocate new span node for upper part of span 'b' */
- if(NULL == (tmp_span = H5S_hyper_new_span(span_a->high + 1, span_b->high, span_b->down, span_b->next)))
+ if((tmp_span = H5S_hyper_new_span(span_a->high+1,span_b->high,span_b->down,span_b->next))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Advance span 'a' */
- H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next);
+ H5S_hyper_recover_span(&recover_a,&span_a,span_a->next);
/* Make upper part of span 'b' into new span 'b' */
- H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, tmp_span);
- recover_b = TRUE;
+ H5S_hyper_recover_span(&recover_b,&span_b,tmp_span);
+ recover_b=1;
} /* end if */
/* No upper part of span 'b' to split */
else {
/* Advance both 'a' and 'b' */
- H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next);
- H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next);
+ H5S_hyper_recover_span(&recover_a,&span_a,span_a->next);
+ H5S_hyper_recover_span(&recover_b,&span_b,span_b->next);
} /* end else */
} /* end if */
/* Check if span 'a' overlaps the lower & upper bound */
@@ -4943,17 +4926,12 @@ H5S_hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_sp
/* AAAAAAAAAAAAAAAAAAAAA */
/* <-----------------------------------> */
/* BBBBBBBBBB */
- else if(span_a->low < span_b->low && span_a->high > span_b->high) {
+ else if(span_a->low<span_b->low && span_a->high>span_b->high) {
/* Split off lower part of span 'a' at lower span of span 'b' */
/* Merge/add lower part of span 'a' with/to a_not_b list */
- if(need_a_not_b) {
- if(H5S_hyper_append_span(&last_a_not_b, a_not_b, span_a->low, span_b->low - 1, span_a->down, NULL) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
-
- /* Indicate that the a_not_b bounds should be updated */
- update_a_not_b_bounds = TRUE;
- } /* end if */
+ if(H5S_hyper_append_span(&last_a_not_b,a_not_b,span_a->low,span_b->low-1,span_a->down,NULL)==FAIL)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Check for overlaps between middle part of span 'a' and span 'b' */
@@ -4961,29 +4939,26 @@ H5S_hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_sp
HDassert((span_a->down != NULL && span_b->down != NULL) || (span_a->down == NULL && span_b->down == NULL));
/* If there are no down spans, just add the overlapping area to the a_and_b list */
- if(span_a->down == NULL) {
+ if(span_a->down==NULL) {
/* Merge/add overlapped part with/to a_and_b list */
- if(need_a_and_b)
- if(H5S_hyper_append_span(&last_a_and_b, a_and_b, span_b->low, span_b->high, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
+ if(H5S_hyper_append_span(&last_a_and_b,a_and_b,span_b->low,span_b->high,NULL,NULL)==FAIL)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
} /* end if */
/* If there are down spans, check for the overlap in them and add to each appropriate list */
else {
/* NULL out the temporary pointers to clipped areas in down spans */
- down_a_not_b = NULL;
- down_a_and_b = NULL;
- down_b_not_a = NULL;
+ down_a_not_b=NULL;
+ down_a_and_b=NULL;
+ down_b_not_a=NULL;
/* Check for overlaps in the 'down spans' of span 'a' & 'b' */
- if(H5S_hyper_clip_spans(span_a->down, span_b->down, selector, cur_dim + 1, dim_size, span_a_b_bounds, all_clips_bounds, &down_a_not_b, &down_a_and_b, &down_b_not_a) < 0)
+ if(H5S_hyper_clip_spans(span_a->down,span_b->down,&down_a_not_b,&down_a_and_b,&down_b_not_a)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information")
/* Check for additions to the a_not_b list */
- if(down_a_not_b) {
- HDassert(need_a_not_b == TRUE);
-
+ if(down_a_not_b!=NULL) {
/* Merge/add overlapped part with/to a_not_b list */
- if(H5S_hyper_append_span(&last_a_not_b, a_not_b,span_b->low, span_b->high, down_a_not_b, NULL) < 0)
+ if(H5S_hyper_append_span(&last_a_not_b,a_not_b,span_b->low,span_b->high,down_a_not_b,NULL)==FAIL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Release the down span tree generated */
@@ -4991,11 +4966,9 @@ H5S_hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_sp
} /* end if */
/* Check for additions to the a_and_b list */
- if(down_a_and_b) {
- HDassert(need_a_and_b == TRUE);
-
+ if(down_a_and_b!=NULL) {
/* Merge/add overlapped part with/to a_and_b list */
- if(H5S_hyper_append_span(&last_a_and_b, a_and_b, span_b->low, span_b->high, down_a_and_b, NULL) < 0)
+ if(H5S_hyper_append_span(&last_a_and_b,a_and_b,span_b->low,span_b->high,down_a_and_b,NULL)==FAIL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Release the down span tree generated */
@@ -5003,11 +4976,9 @@ H5S_hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_sp
} /* end if */
/* Check for additions to the b_not_a list */
- if(down_b_not_a) {
- HDassert(need_b_not_a == TRUE);
-
+ if(down_b_not_a!=NULL) {
/* Merge/add overlapped part with/to b_not_a list */
- if(H5S_hyper_append_span(&last_b_not_a, b_not_a, span_b->low, span_b->high, down_b_not_a, NULL) < 0)
+ if(H5S_hyper_append_span(&last_b_not_a,b_not_a,span_b->low,span_b->high,down_b_not_a,NULL)==FAIL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Release the down span tree generated */
@@ -5018,33 +4989,28 @@ H5S_hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_sp
/* Split off upper part of span 'a' at upper span of span 'b' */
/* Allocate new span node for upper part of span 'a' */
- if(NULL == (tmp_span = H5S_hyper_new_span(span_b->high + 1, span_a->high, span_a->down, span_a->next)))
+ if((tmp_span = H5S_hyper_new_span(span_b->high+1,span_a->high,span_a->down,span_a->next))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Make upper part of span 'a' the new span 'a' */
- H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, tmp_span);
- recover_a = TRUE;
+ H5S_hyper_recover_span(&recover_a,&span_a,tmp_span);
+ recover_a=1;
/* Advance span 'b' */
- H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next);
+ H5S_hyper_recover_span(&recover_b,&span_b,span_b->next);
} /* end if */
/* Check if span 'a' is entirely within span 'b' */
/* AAAAA */
/* <-----------------------------------> */
/* BBBBBBBBBB */
- else if(span_a->low >= span_b->low && span_a->high <= span_b->high) {
+ else if(span_a->low>=span_b->low && span_a->high<=span_b->high) {
/* Split off lower part of span 'b' at lower span of span 'a' */
/* Check if there is actually a lower part of span 'b' to split off */
- if(span_a->low > span_b->low) {
+ if(span_a->low>span_b->low) {
/* Merge/add lower part of span 'b' with/to b_not_a list */
- if(need_b_not_a) {
- if(H5S_hyper_append_span(&last_b_not_a, b_not_a, span_b->low, span_a->low - 1, span_b->down, NULL) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
-
- /* Indicate that the b_not_a bounds should be updated */
- update_b_not_a_bounds = TRUE;
- } /* end if */
+ if(H5S_hyper_append_span(&last_b_not_a,b_not_a,span_b->low,span_a->low-1,span_b->down,NULL)==FAIL)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
} /* end if */
else {
/* Keep going, nothing to split off */
@@ -5056,29 +5022,26 @@ H5S_hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_sp
HDassert((span_a->down != NULL && span_b->down != NULL) || (span_a->down == NULL && span_b->down == NULL));
/* If there are no down spans, just add the overlapping area to the a_and_b list */
- if(span_a->down == NULL) {
+ if(span_a->down==NULL) {
/* Merge/add overlapped part with/to a_and_b list */
- if(need_a_and_b)
- if(H5S_hyper_append_span(&last_a_and_b, a_and_b, span_a->low, span_a->high, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
+ if(H5S_hyper_append_span(&last_a_and_b,a_and_b,span_a->low,span_a->high,NULL,NULL)==FAIL)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
} /* end if */
/* If there are down spans, check for the overlap in them and add to each appropriate list */
else {
/* NULL out the temporary pointers to clipped areas in down spans */
- down_a_not_b = NULL;
- down_a_and_b = NULL;
- down_b_not_a = NULL;
+ down_a_not_b=NULL;
+ down_a_and_b=NULL;
+ down_b_not_a=NULL;
/* Check for overlaps in the 'down spans' of span 'a' & 'b' */
- if(H5S_hyper_clip_spans(span_a->down, span_b->down, selector, cur_dim + 1, dim_size, span_a_b_bounds, all_clips_bounds, &down_a_not_b, &down_a_and_b, &down_b_not_a) < 0)
+ if(H5S_hyper_clip_spans(span_a->down,span_b->down,&down_a_not_b,&down_a_and_b,&down_b_not_a)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information")
/* Check for additions to the a_not_b list */
- if(down_a_not_b) {
- HDassert(need_a_not_b == TRUE);
-
+ if(down_a_not_b!=NULL) {
/* Merge/add overlapped part with/to a_not_b list */
- if(H5S_hyper_append_span(&last_a_not_b, a_not_b, span_a->low, span_a->high, down_a_not_b, NULL) < 0)
+ if(H5S_hyper_append_span(&last_a_not_b,a_not_b,span_a->low,span_a->high,down_a_not_b,NULL)==FAIL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Release the down span tree generated */
@@ -5086,11 +5049,9 @@ H5S_hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_sp
} /* end if */
/* Check for additions to the a_and_b list */
- if(down_a_and_b) {
- HDassert(need_a_and_b == TRUE);
-
+ if(down_a_and_b!=NULL) {
/* Merge/add overlapped part with/to a_and_b list */
- if(H5S_hyper_append_span(&last_a_and_b, a_and_b, span_a->low, span_a->high, down_a_and_b, NULL) < 0)
+ if(H5S_hyper_append_span(&last_a_and_b,a_and_b,span_a->low,span_a->high,down_a_and_b,NULL)==FAIL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Release the down span tree generated */
@@ -5098,11 +5059,9 @@ H5S_hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_sp
} /* end if */
/* Check for additions to the b_not_a list */
- if(down_b_not_a) {
- HDassert(need_b_not_a == TRUE);
-
+ if(down_b_not_a!=NULL) {
/* Merge/add overlapped part with/to b_not_a list */
- if(H5S_hyper_append_span(&last_b_not_a, b_not_a, span_a->low, span_a->high, down_b_not_a, NULL) < 0)
+ if(H5S_hyper_append_span(&last_b_not_a,b_not_a,span_a->low,span_a->high,down_b_not_a,NULL)==FAIL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Release the down span tree generated */
@@ -5111,24 +5070,24 @@ H5S_hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_sp
} /* end else */
/* Check if there is actually an upper part of span 'b' to split off */
- if(span_a->high < span_b->high) {
+ if(span_a->high<span_b->high) {
/* Split off upper part of span 'b' at upper span of span 'a' */
/* Allocate new span node for upper part of spans 'a' */
- if(NULL == (tmp_span = H5S_hyper_new_span(span_a->high + 1, span_b->high, span_b->down, span_b->next)))
+ if((tmp_span = H5S_hyper_new_span(span_a->high+1,span_b->high,span_b->down,span_b->next))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* And advance span 'a' */
- H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next);
+ H5S_hyper_recover_span(&recover_a,&span_a,span_a->next);
/* Make upper part of span 'b' the new span 'b' */
- H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, tmp_span);
- recover_b = TRUE;
+ H5S_hyper_recover_span(&recover_b,&span_b,tmp_span);
+ recover_b=1;
} /* end if */
else {
/* Advance both span 'a' & span 'b' */
- H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next);
- H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next);
+ H5S_hyper_recover_span(&recover_a,&span_a,span_a->next);
+ H5S_hyper_recover_span(&recover_b,&span_b,span_b->next);
} /* end else */
} /* end if */
/* Check if span 'a' overlaps only the upper bound */
@@ -5136,19 +5095,14 @@ H5S_hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_sp
/* AAAAAAAAAA */
/* <-----------------------------------> */
/* BBBBBBBBBB */
- else if((span_a->low >= span_b->low && span_a->low <= span_b->high) && span_a->high > span_b->high) {
+ else if((span_a->low>=span_b->low && span_a->low<=span_b->high) && span_a->high>span_b->high) {
/* Check if there is actually a lower part of span 'b' to split off */
- if(span_a->low > span_b->low) {
+ if(span_a->low>span_b->low) {
/* Split off lower part of span 'b' at lower span of span 'a' */
/* Merge/add lower part of span 'b' with/to b_not_a list */
- if(need_b_not_a) {
- if(H5S_hyper_append_span(&last_b_not_a, b_not_a, span_b->low, span_a->low - 1, span_b->down, NULL) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
-
- /* Indicate that the b_not_a bounds should be updated */
- update_b_not_a_bounds = TRUE;
- } /* end if */
+ if(H5S_hyper_append_span(&last_b_not_a,b_not_a,span_b->low,span_a->low-1,span_b->down,NULL)==FAIL)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
} /* end if */
else {
/* Keep going, nothing to split off */
@@ -5160,29 +5114,26 @@ H5S_hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_sp
HDassert((span_a->down != NULL && span_b->down != NULL) || (span_a->down == NULL && span_b->down == NULL));
/* If there are no down spans, just add the overlapping area to the a_and_b list */
- if(span_a->down == NULL) {
+ if(span_a->down==NULL) {
/* Merge/add overlapped part with/to a_and_b list */
- if(need_a_and_b)
- if(H5S_hyper_append_span(&last_a_and_b, a_and_b, span_a->low, span_b->high, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
+ if(H5S_hyper_append_span(&last_a_and_b,a_and_b,span_a->low,span_b->high,NULL,NULL)==FAIL)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
} /* end if */
/* If there are down spans, check for the overlap in them and add to each appropriate list */
else {
/* NULL out the temporary pointers to clipped areas in down spans */
- down_a_not_b = NULL;
- down_a_and_b = NULL;
- down_b_not_a = NULL;
+ down_a_not_b=NULL;
+ down_a_and_b=NULL;
+ down_b_not_a=NULL;
/* Check for overlaps in the 'down spans' of span 'a' & 'b' */
- if(H5S_hyper_clip_spans(span_a->down, span_b->down, selector, cur_dim + 1, dim_size, span_a_b_bounds, all_clips_bounds, &down_a_not_b, &down_a_and_b, &down_b_not_a) < 0)
+ if(H5S_hyper_clip_spans(span_a->down,span_b->down,&down_a_not_b,&down_a_and_b,&down_b_not_a)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information")
/* Check for additions to the a_not_b list */
- if(down_a_not_b) {
- HDassert(need_a_not_b == TRUE);
-
+ if(down_a_not_b!=NULL) {
/* Merge/add overlapped part with/to a_not_b list */
- if(H5S_hyper_append_span(&last_a_not_b, a_not_b, span_a->low, span_b->high, down_a_not_b, NULL) < 0)
+ if(H5S_hyper_append_span(&last_a_not_b,a_not_b,span_a->low,span_b->high,down_a_not_b,NULL)==FAIL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Release the down span tree generated */
@@ -5190,11 +5141,9 @@ H5S_hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_sp
} /* end if */
/* Check for additions to the a_and_b list */
- if(down_a_and_b) {
- HDassert(need_a_and_b == TRUE);
-
+ if(down_a_and_b!=NULL) {
/* Merge/add overlapped part with/to a_and_b list */
- if(H5S_hyper_append_span(&last_a_and_b, a_and_b, span_a->low, span_b->high, down_a_and_b, NULL) < 0)
+ if(H5S_hyper_append_span(&last_a_and_b,a_and_b,span_a->low,span_b->high,down_a_and_b,NULL)==FAIL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Release the down span tree generated */
@@ -5202,11 +5151,9 @@ H5S_hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_sp
} /* end if */
/* Check for additions to the b_not_a list */
- if(down_b_not_a) {
- HDassert(need_b_not_a == TRUE);
-
+ if(down_b_not_a!=NULL) {
/* Merge/add overlapped part with/to b_not_a list */
- if(H5S_hyper_append_span(&last_b_not_a, b_not_a, span_a->low, span_b->high, down_b_not_a, NULL) < 0)
+ if(H5S_hyper_append_span(&last_b_not_a,b_not_a,span_a->low,span_b->high,down_b_not_a,NULL)==FAIL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Release the down span tree generated */
@@ -5217,15 +5164,15 @@ H5S_hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_sp
/* Split off upper part of span 'a' at upper span of span 'b' */
/* Allocate new span node for upper part of span 'a' */
- if(NULL == (tmp_span = H5S_hyper_new_span(span_b->high + 1, span_a->high, span_a->down, span_a->next)))
+ if((tmp_span = H5S_hyper_new_span(span_b->high+1,span_a->high,span_a->down,span_a->next))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Make upper part of span 'a' into new span 'a' */
- H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, tmp_span);
- recover_a = TRUE;
+ H5S_hyper_recover_span(&recover_a,&span_a,tmp_span);
+ recover_a=1;
/* Advance span 'b' */
- H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next);
+ H5S_hyper_recover_span(&recover_b,&span_b,span_b->next);
} /* end if */
/* span 'a' must be entirely above span 'b' */
/* AAAAA */
@@ -5235,103 +5182,46 @@ H5S_hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_sp
/* Copy span 'b' and add to b_not_a list */
/* Merge/add span 'b' with/to b_not_a list */
- if(need_b_not_a) {
- if(H5S_hyper_append_span(&last_b_not_a, b_not_a, span_b->low, span_b->high, span_b->down, NULL) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
-
- /* Indicate that the b_not_a bounds should be updated */
- update_b_not_a_bounds = TRUE;
- } /* end if */
+ if(H5S_hyper_append_span(&last_b_not_a,b_not_a,span_b->low,span_b->high,span_b->down,NULL)==FAIL)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Advance span 'b', leave span 'a' */
- H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next);
+ H5S_hyper_recover_span(&recover_b,&span_b,span_b->next);
} /* end else */
} /* end while */
/* Clean up 'a' spans which haven't been covered yet */
- if(span_a != NULL && span_b == NULL) {
- /* Check if need to merge/add 'a' spans with/to a_not_b list */
- if(need_a_not_b) {
- while(span_a != NULL) {
- /* Copy span 'a' and add to a_not_b list */
- if(H5S_hyper_append_span(&last_a_not_b, a_not_b, span_a->low, span_a->high, span_a->down, NULL) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
+ if(span_a!=NULL && span_b==NULL) {
+ while(span_a!=NULL) {
+ /* Copy span 'a' and add to a_not_b list */
- /* Advance to the next 'a' span */
- H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next);
- } /* end while */
+ /* Merge/add span 'a' with/to a_not_b list */
+ if(H5S_hyper_append_span(&last_a_not_b,a_not_b,span_a->low,span_a->high,span_a->down,NULL)==FAIL)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
- /* Indicate that the a_not_b bounds should be updated */
- update_a_not_b_bounds = TRUE;
- } /* end if */
- else {
- /* Free the span, if it's generated */
- if(recover_a)
- H5S_hyper_free_span(span_a);
- } /* end else */
+ /* Advance to the next 'a' span */
+ H5S_hyper_recover_span(&recover_a,&span_a,span_a->next);
+ } /* end while */
} /* end if */
/* Clean up 'b' spans which haven't been covered yet */
- else if(span_a == NULL && span_b != NULL) {
- /* Check if need to merge/add 'b' spans with/to b_not_a list */
- if(need_b_not_a) {
- while(span_b != NULL) {
- /* Copy span 'b' and add to b_not_a list */
- if(H5S_hyper_append_span(&last_b_not_a, b_not_a, span_b->low, span_b->high, span_b->down, NULL) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
-
- /* Advance to the next 'b' span */
- H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next);
- } /* end while */
-
- /* Indicate that the b_not_a bounds should be updated */
- update_b_not_a_bounds = TRUE;
- } /* end if */
- else {
- /* Free the span, if it's generated */
- if(recover_b)
- H5S_hyper_free_span(span_b);
- } /* end else */
- } /* end if */
+ else if(span_a==NULL && span_b!=NULL) {
+ while(span_b!=NULL) {
+ /* Copy span 'b' and add to b_not_a list */
- /* Check for needing to update each set of bounds */
- if(update_a_not_b_bounds) {
- /* Update bounding box of a_not_b for remaining dimensions as a span was appended */
- for(u = cur_dim + 1; u < dim_size; u++) {
- a_not_b_low_bounds[u] = MIN(a_not_b_low_bounds[u], span_a_low_bounds[u]);
- a_not_b_high_bounds[u] = MAX(a_not_b_high_bounds[u], span_a_high_bounds[u]);
- } /* end for */
- } /* end if */
- if(update_b_not_a_bounds) {
- /* Update bounding box of b_not_a for remaining dimensions as a span was appended */
- for(u = cur_dim + 1; u < dim_size; u++) {
- b_not_a_low_bounds[u] = MIN(b_not_a_low_bounds[u], span_b_low_bounds[u]);
- b_not_a_high_bounds[u] = MAX(b_not_a_high_bounds[u], span_b_high_bounds[u]);
- } /* end for */
- } /* end if */
+ /* Merge/add span 'b' with/to b_not_a list */
+ if(H5S_hyper_append_span(&last_b_not_a,b_not_a,span_b->low,span_b->high,span_b->down,NULL)==FAIL)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
- /**
- * Up to this point, the clip operation has been applied to one
- * span list in one dimension. So it's time to update the bound
- * box of the clipped span trees.
- */
- if(need_a_not_b && *a_not_b != NULL) {
- a_not_b_low_bounds[cur_dim] = MIN(a_not_b_low_bounds[cur_dim], (*a_not_b)->head->low);
- a_not_b_high_bounds[cur_dim] = MAX(a_not_b_high_bounds[cur_dim], (*a_not_b)->tail->high);
- } /* end if */
- if(need_a_and_b && *a_and_b != NULL) {
- a_and_b_low_bounds[cur_dim] = MIN(a_and_b_low_bounds[cur_dim], (*a_and_b)->head->low);
- a_and_b_high_bounds[cur_dim] = MAX(a_and_b_high_bounds[cur_dim], (*a_and_b)->tail->high);
- } /* end if */
- if(need_b_not_a && *b_not_a != NULL) {
- b_not_a_low_bounds[cur_dim] = MIN(b_not_a_low_bounds[cur_dim], (*b_not_a)->head->low);
- b_not_a_high_bounds[cur_dim] = MAX(b_not_a_high_bounds[cur_dim], (*b_not_a)->tail->high);
+ /* Advance to the next 'b' span */
+ H5S_hyper_recover_span(&recover_b,&span_b,span_b->next);
+ } /* end while */
} /* end if */
} /* end else */
} /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_clip_spans() */
+} /* H5S_hyper_clip_spans() */
/*--------------------------------------------------------------------------
@@ -5356,10 +5246,16 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static H5S_hyper_span_info_t *
-H5S_hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_spans)
+H5S_hyper_merge_spans_helper (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_spans)
{
- H5S_hyper_span_info_t *merged_spans = NULL; /* Pointer to the merged span tree */
- H5S_hyper_span_info_t *ret_value; /* Return value */
+ H5S_hyper_span_info_t *merged_spans=NULL; /* Pointer to the merged span tree */
+ H5S_hyper_span_info_t *tmp_spans; /* Pointer to temporary new span tree */
+ H5S_hyper_span_t *tmp_span; /* Pointer to temporary new span */
+ H5S_hyper_span_t *span_a; /* Pointer to current span 'a' working on */
+ H5S_hyper_span_t *span_b; /* Pointer to current span 'b' working on */
+ H5S_hyper_span_t *prev_span_merge; /* Pointer to previous merged span */
+ unsigned recover_a, recover_b; /* Flags to indicate when to recover temporary spans */
+ H5S_hyper_span_info_t *ret_value;
FUNC_ENTER_NOAPI_NOINIT
@@ -5367,54 +5263,46 @@ H5S_hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info
HDassert((a_spans != NULL && b_spans != NULL) || (a_spans == NULL && b_spans == NULL));
/* Check if the span trees for the 'a' span and the 'b' span are the same */
- if(H5S_hyper_cmp_spans(a_spans, b_spans) == TRUE) {
- if(a_spans == NULL)
- merged_spans = NULL;
+ if(H5S_hyper_cmp_spans(a_spans,b_spans)==TRUE) {
+ if(a_spans==NULL)
+ merged_spans=NULL;
else {
/* Copy one of the span trees to return */
- if(NULL == (merged_spans = H5S_hyper_copy_span(a_spans)))
+ if((merged_spans=H5S_hyper_copy_span(a_spans))==NULL)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "can't copy hyperslab span tree")
} /* end else */
} /* end if */
else {
- H5S_hyper_span_t *span_a; /* Pointer to current span 'a' working on */
- H5S_hyper_span_t *span_b; /* Pointer to current span 'b' working on */
- H5S_hyper_span_t *prev_span_merge; /* Pointer to previous merged span */
- hbool_t recover_a, recover_b; /* Flags to indicate when to recover temporary spans */
-
/* Get the pointers to the 'a' and 'b' span lists */
- span_a = a_spans->head;
- span_b = b_spans->head;
+ span_a=a_spans->head;
+ span_b=b_spans->head;
/* Set the pointer to the previous spans */
- prev_span_merge = NULL;
+ prev_span_merge=NULL;
/* No spans to recover yet */
- recover_a = recover_b = FALSE;
+ recover_a=recover_b=0;
/* Work through the list of spans in the new list */
while(span_a!=NULL && span_b!=NULL) {
- H5S_hyper_span_info_t *tmp_spans; /* Pointer to temporary new span tree */
- H5S_hyper_span_t *tmp_span; /* Pointer to temporary new span */
-
/* Check if the 'a' span is completely before 'b' span */
/* AAAAAAA */
/* <-----------------------------------> */
/* BBBBBBBBBB */
- if(span_a->high < span_b->low) {
+ if(span_a->high<span_b->low) {
/* Merge/add span 'a' with/to the merged spans */
if(H5S_hyper_append_span(&prev_span_merge,&merged_spans,span_a->low,span_a->high,span_a->down,NULL)==FAIL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
/* Advance span 'a' */
- H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next);
+ H5S_hyper_recover_span(&recover_a,&span_a,span_a->next);
} /* end if */
/* Check if span 'a' overlaps only the lower bound */
/* of span 'b', up to the upper bound of span 'b' */
/* AAAAAAAAAAAA */
/* <-----------------------------------> */
/* BBBBBBBBBB */
- else if(span_a->low < span_b->low && (span_a->high >= span_b->low && span_a->high <= span_b->high)) {
+ else if(span_a->low<span_b->low && (span_a->high>=span_b->low && span_a->high<=span_b->high)) {
/* Check if span 'a' and span 'b' down spans are equal */
if(H5S_hyper_cmp_spans(span_a->down,span_b->down)==TRUE) {
/* Merge/add copy of span 'a' with/to merged spans */
@@ -5438,7 +5326,7 @@ H5S_hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info
} /* end else */
/* Check if there is an upper part of span 'b' */
- if(span_a->high < span_b->high) {
+ if(span_a->high<span_b->high) {
/* Copy upper part of span 'b' as new span 'b' */
/* Allocate new span node to append to list */
@@ -5446,16 +5334,16 @@ H5S_hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
/* Advance span 'a' */
- H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next);
+ H5S_hyper_recover_span(&recover_a,&span_a,span_a->next);
/* Set new span 'b' to tmp_span */
- H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, tmp_span);
- recover_b = TRUE;
+ H5S_hyper_recover_span(&recover_b,&span_b,tmp_span);
+ recover_b=1;
} /* end if */
else {
/* Advance both span 'a' & 'b' */
- H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next);
- H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next);
+ H5S_hyper_recover_span(&recover_a,&span_a,span_a->next);
+ H5S_hyper_recover_span(&recover_b,&span_b,span_b->next);
} /* end else */
} /* end if */
/* Check if span 'a' overlaps the lower & upper bound */
@@ -5463,7 +5351,7 @@ H5S_hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info
/* AAAAAAAAAAAAAAAAAAAAA */
/* <-----------------------------------> */
/* BBBBBBBBBB */
- else if(span_a->low < span_b->low && span_a->high > span_b->high) {
+ else if(span_a->low<span_b->low && span_a->high>span_b->high) {
/* Check if span 'a' and span 'b' down spans are equal */
if(H5S_hyper_cmp_spans(span_a->down,span_b->down)==TRUE) {
/* Merge/add copy of lower & middle parts of span 'a' to merged spans */
@@ -5493,17 +5381,17 @@ H5S_hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
/* Set new span 'a' to tmp_span */
- H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, tmp_span);
- recover_a = TRUE;
+ H5S_hyper_recover_span(&recover_a,&span_a,tmp_span);
+ recover_a=1;
/* Advance span 'b' */
- H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next);
+ H5S_hyper_recover_span(&recover_b,&span_b,span_b->next);
} /* end if */
/* Check if span 'a' is entirely within span 'b' */
/* AAAAA */
/* <-----------------------------------> */
/* BBBBBBBBBB */
- else if(span_a->low >= span_b->low && span_a->high <= span_b->high) {
+ else if(span_a->low>=span_b->low && span_a->high<=span_b->high) {
/* Check if span 'a' and span 'b' down spans are equal */
if(H5S_hyper_cmp_spans(span_a->down,span_b->down)==TRUE) {
/* Merge/add copy of lower & middle parts of span 'b' to merged spans */
@@ -5512,7 +5400,7 @@ H5S_hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info
} /* end if */
else {
/* Check if there is a lower part of span 'b' */
- if(span_a->low > span_b->low) {
+ if(span_a->low>span_b->low) {
/* Merge/add lower part of span 'b' to merged spans */
if(H5S_hyper_append_span(&prev_span_merge,&merged_spans,span_b->low,span_a->low-1,span_b->down,NULL)==FAIL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
@@ -5533,7 +5421,7 @@ H5S_hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info
} /* end else */
/* Check if there is an upper part of span 'b' */
- if(span_a->high < span_b->high) {
+ if(span_a->high<span_b->high) {
/* Copy upper part of span 'b' as new span 'b' (remember to free) */
/* Allocate new span node to append to list */
@@ -5541,16 +5429,16 @@ H5S_hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
/* Advance span 'a' */
- H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next);
+ H5S_hyper_recover_span(&recover_a,&span_a,span_a->next);
/* Set new span 'b' to tmp_span */
- H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, tmp_span);
- recover_b = TRUE;
+ H5S_hyper_recover_span(&recover_b,&span_b,tmp_span);
+ recover_b=1;
} /* end if */
else {
/* Advance both spans */
- H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next);
- H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next);
+ H5S_hyper_recover_span(&recover_a,&span_a,span_a->next);
+ H5S_hyper_recover_span(&recover_b,&span_b,span_b->next);
} /* end else */
} /* end if */
/* Check if span 'a' overlaps only the upper bound */
@@ -5558,7 +5446,7 @@ H5S_hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info
/* AAAAAAAAAA */
/* <-----------------------------------> */
/* BBBBBBBBBB */
- else if((span_a->low >= span_b->low && span_a->low <= span_b->high) && span_a->high > span_b->high) {
+ else if((span_a->low>=span_b->low && span_a->low<=span_b->high) && span_a->high>span_b->high) {
/* Check if span 'a' and span 'b' down spans are equal */
if(H5S_hyper_cmp_spans(span_a->down,span_b->down)==TRUE) {
/* Merge/add copy of span 'b' to merged spans if so */
@@ -5567,7 +5455,7 @@ H5S_hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info
} /* end if */
else {
/* Check if there is a lower part of span 'b' */
- if(span_a->low > span_b->low) {
+ if(span_a->low>span_b->low) {
/* Merge/add lower part of span 'b' to merged spans */
if(H5S_hyper_append_span(&prev_span_merge,&merged_spans,span_b->low,span_a->low-1,span_b->down,NULL)==FAIL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
@@ -5594,11 +5482,11 @@ H5S_hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
/* Set new span 'a' to tmp_span */
- H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, tmp_span);
- recover_a = TRUE;
+ H5S_hyper_recover_span(&recover_a,&span_a,tmp_span);
+ recover_a=1;
/* Advance span 'b' */
- H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next);
+ H5S_hyper_recover_span(&recover_b,&span_b,span_b->next);
} /* end if */
/* Span 'a' must be entirely above span 'b' */
/* AAAAA */
@@ -5610,7 +5498,7 @@ H5S_hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
/* Advance span 'b' */
- H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next);
+ H5S_hyper_recover_span(&recover_b,&span_b,span_b->next);
} /* end else */
} /* end while */
@@ -5622,7 +5510,7 @@ H5S_hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
/* Advance to next 'a' span, until all processed */
- H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next);
+ H5S_hyper_recover_span(&recover_a,&span_a,span_a->next);
} /* end while */
} /* end if */
@@ -5634,7 +5522,7 @@ H5S_hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
/* Advance to next 'b' span, until all processed */
- H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next);
+ H5S_hyper_recover_span(&recover_b,&span_b,span_b->next);
} /* end while */
} /* end if */
} /* end else */
@@ -5643,12 +5531,14 @@ H5S_hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info
ret_value = merged_spans;
done:
- if(ret_value == NULL)
- if(merged_spans && H5S_hyper_free_span_info(merged_spans) < 0)
- HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, NULL, "failed to release merged hyperslab spans")
+ if(ret_value == NULL) {
+ if(merged_spans)
+ if(H5S_hyper_free_span_info(merged_spans) < 0)
+ HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, NULL, "failed to release merged hyperslab spans")
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_merge_spans_helper() */
+} /* H5S_hyper_merge_spans_helper() */
/*--------------------------------------------------------------------------
@@ -5662,6 +5552,9 @@ done:
selection.
H5S_hyper_span_t *new_spans; IN: Span tree of new spans to add to
hyperslab selection
+ hbool_t can_own; IN: Flag to indicate that it is OK to point
+ directly to the new spans, instead of
+ copying them.
RETURNS
non-negative on success, negative on failure
DESCRIPTION
@@ -5674,38 +5567,41 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_hyper_merge_spans(H5S_t *space, H5S_hyper_span_info_t *new_spans)
+H5S_hyper_merge_spans (H5S_t *space, H5S_hyper_span_info_t *new_spans, hbool_t can_own)
{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
HDassert(space);
HDassert(new_spans);
/* If this is the first span tree in the hyperslab selection, just use it */
- if(space->select.sel_info.hslab->span_lst == NULL)
- space->select.sel_info.hslab->span_lst = new_spans;
+ if(space->select.sel_info.hslab->span_lst==NULL) {
+ if(can_own)
+ space->select.sel_info.hslab->span_lst=new_spans;
+ else
+ space->select.sel_info.hslab->span_lst=H5S_hyper_copy_span(new_spans);
+ } /* end if */
else {
H5S_hyper_span_info_t *merged_spans;
/* Get the merged spans */
- if(NULL == (merged_spans = H5S_hyper_merge_spans_helper(space->select.sel_info.hslab->span_lst, new_spans)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTMERGE, FAIL, "can't merge hyperslab spans")
+ merged_spans=H5S_hyper_merge_spans_helper(space->select.sel_info.hslab->span_lst, new_spans);
+
+ /* Sanity checking since we started with some spans, we should still have some after the merge */
+ HDassert(merged_spans);
/* Free the previous spans */
- if(H5S_hyper_free_span_info(space->select.sel_info.hslab->span_lst) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "failed to release hyperslab spans")
+ H5S_hyper_free_span_info(space->select.sel_info.hslab->span_lst);
/* Point to the new merged spans */
- space->select.sel_info.hslab->span_lst = merged_spans;
+ space->select.sel_info.hslab->span_lst=merged_spans;
} /* end else */
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_merge_spans() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5S_hyper_merge_spans() */
+
/*--------------------------------------------------------------------------
NAME
H5S_hyper_spans_nelem
@@ -5724,150 +5620,34 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static hsize_t
-H5S_hyper_spans_nelem(const H5S_hyper_span_info_t *spans)
+H5S_hyper_spans_nelem (H5S_hyper_span_info_t *spans)
{
- hsize_t ret_value = 0; /* Return value */
+ H5S_hyper_span_t *span; /* Hyperslab span */
+ hsize_t ret_value;
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Count the number of elements in the span tree */
- if(spans != NULL) {
- const H5S_hyper_span_t *span; /* Hyperslab span */
-
- span = spans->head;
- while(span != NULL) {
+ if(spans==NULL)
+ ret_value=0;
+ else {
+ span=spans->head;
+ ret_value=0;
+ while(span!=NULL) {
/* If there are down spans, multiply the size of this span by the total down span elements */
- if(span->down != NULL)
- ret_value += span->nelem * H5S_hyper_spans_nelem(span->down);
+ if(span->down!=NULL)
+ ret_value+=span->nelem*H5S_hyper_spans_nelem(span->down);
/* If there are no down spans, just count the elements in this span */
else
- ret_value += span->nelem;
+ ret_value+=span->nelem;
/* Advance to next span */
- span = span->next;
+ span=span->next;
} /* end while */
} /* end else */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_spans_nelem() */
-
-/*--------------------------------------------------------------------------
- NAME
- H5S_hyper_add_disjoint_spans
- PURPOSE
- Add new hyperslab spans to existing hyperslab selection in the case the
- new hyperslab spans don't overlap or border with the existing hyperslab
- selection
- USAGE
- herr_t H5S_hyper_add_disjoint_spans(space, new_spans)
- H5S_t *space; IN: Dataspace to add new spans to hyperslab
- selection.
- H5S_hyper_span_t *new_spans; IN: Span tree of new spans to add to
- hyperslab selection
- RETURNS
- non-negative on success, negative on failure
- DESCRIPTION
- Add a set of hyperslab spans to an existing hyperslab selection. The
- new spans are required not to overlap or borderwith the existing spans
- in the dataspace's current hyperslab selection in terms of bound box.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static herr_t
-H5S_hyper_add_disjoint_spans(H5S_t *space, H5S_hyper_span_info_t *new_spans)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- /* Check args */
- HDassert(space);
- HDassert(new_spans);
-
- /* update the number of elements in the selection */
- space->select.num_elem += H5S_hyper_spans_nelem(new_spans);
-
- /* If this is the first span tree in the hyperslab selection, just use it */
- if(space->select.sel_info.hslab->span_lst == NULL)
- space->select.sel_info.hslab->span_lst = new_spans;
- else {
- H5S_hyper_span_info_t *old_spans = space->select.sel_info.hslab->span_lst;
- H5S_hyper_span_info_t *high_order_spans = NULL;
- H5S_hyper_span_info_t *low_order_spans = NULL;
-
- /* Combine the new_spans with the old_spans only in the highest-order of dimension */
- /* Example:
- * old_spans: ------------------> X
- * | (1,2)--->(1,3)--->(6,4)--->||
- * | | ^
- * | | |
- * Y | V |
- * | (5,2)------.
- * | |
- * | |
- * | V
- * | =
- * V
- * new_spans: --------------------> X
- * | (8,2)--->(12,3)--->(17,4)--->||
- * | |
- * Y | |
- * | V
- * | =
- * V
- *
- * After merging, the old_spans becomes
- *
- * old_spans: ------------------> X
- * | (1,2)--->(1,3)--->(6,4)--->||
- * | | ^
- * | | |
- * | V |
- * | (5,2)------.
- * | |
- * Y | |
- * | (8,2)--->(12,3)--->(17,4)--->||
- * | |
- * | |
- * | V
- * | =
- * V
- */
-
- /* Make sure the tail pointers are updated correctly */
- HDassert(old_spans->tail);
- HDassert(NULL == old_spans->tail->next);
- HDassert(new_spans->tail);
- HDassert(NULL == new_spans->tail->next);
-
- /* Check old_spans and new_spans to see which one is of higher order,
- * and append the higher order spans to the lower order ones.
- */
- if(new_spans->head->low > old_spans->tail->high) {
- high_order_spans = new_spans;
- low_order_spans = old_spans;
- } /* end if */
- else{
- high_order_spans = old_spans;
- low_order_spans = new_spans;
- } /* end else */
-
- /* The high_order_spans should be appended to low_order_spans */
- low_order_spans->tail->next = high_order_spans->head;
-
- /* "pstride" is only updated in IO operations, so it needs no update here */
- /*high_order_spans->head->pstride = high_order_spans->head->low - low_order_spans->tail->low;*/
- low_order_spans->tail = high_order_spans->tail;
-
- /* Fix the selection's 1st span info node */
- space->select.sel_info.hslab->span_lst = low_order_spans;
-
- /* free the memory space for "new_spans" node */
- high_order_spans = H5FL_FREE(H5S_hyper_span_info_t, high_order_spans);
- } /* end else */
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S_hyper_add_disjoint_spans */
+} /* H5S_hyper_spans_nelem() */
/*--------------------------------------------------------------------------
@@ -5956,19 +5736,23 @@ H5S_hyper_make_spans(unsigned rank, const hsize_t *start, const hsize_t *stride,
span->down = down;
down->count++; /* Increment reference count for shared span */
} /* end if */
- else
+ else {
span->down = NULL;
+ } /* end else */
} /* end for */
/* Allocate a span info node */
- if(NULL == (down = H5FL_CALLOC(H5S_hyper_span_info_t)))
+ if(NULL == (down = H5FL_MALLOC(H5S_hyper_span_info_t)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span")
+ /* Set the reference count */
+ down->count = 0;
+
+ /* Reset the scratch pad space */
+ down->scratch = 0;
+
/* Keep the pointer to the next dimension down's completed list */
down->head = head;
-
- /* Keep the tail pointer to the next dimension down's completed list */
- down->tail = last_span;
} /* end for */
/* Indicate that there is a pointer to this tree */
@@ -6002,217 +5786,7 @@ done:
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_make_spans() */
-
-
-/*--------------------------------------------------------------------------
- NAME
- H5S_hyper_update_diminfo
- PURPOSE
- Attempt to update optimized hyperslab information quickly. (It can be
- recovered with regular selection). If this algorithm cannot determine
- the optimized dimension info quickly, this function will simply mark it
- as invalid and unknown if it can be built (H5S_DIMINFO_VALID_NO), so
- H5S_hyper_rebuild can be run later to determine for sure.
- USAGE
- herr_t H5S_hyper_update_diminfo(space, op, new_hyper_diminfo)
- H5S_t *space; IN: Dataspace to check
- H5S_seloper_t op; IN: The operation being performed on the
- selection
- const H5S_hyper_dim_t new_hyper_diminfo; IN: The new selection that
- is being combined with
- the current
- RETURNS
- >=0 on success, <0 on failure
- DESCRIPTION
- Examine the span tree for a hyperslab selection and rebuild
- the start/stride/count/block information for the selection, if possible.
-
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
- NF, 2014/6/6
---------------------------------------------------------------------------*/
-static herr_t
-H5S_hyper_update_diminfo(H5S_t *space, H5S_seloper_t op,
- const H5S_hyper_dim_t *new_hyper_diminfo)
-{
- H5S_hyper_dim_t tmp_diminfo[H5S_MAX_RANK]; /* Temporary dimension info */
- hbool_t found_nonidentical_dim = FALSE;
- unsigned curr_dim;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- /* Check args */
- HDassert(space);
- HDassert(new_hyper_diminfo);
-
- /* Check for conditions that prevent us from using the fast algorithm here
- * (and instead require H5S_hyper_rebuild) */
- if(!((op == H5S_SELECT_OR) || (op == H5S_SELECT_XOR))
- || space->select.sel_info.hslab->diminfo_valid != H5S_DIMINFO_VALID_YES
- || !space->select.sel_info.hslab->span_lst->head) {
- space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_NO;
- HGOTO_DONE(SUCCEED)
- } /* end if */
-
- /* Copy current opt_diminfo values */
- for(curr_dim = 0; curr_dim < space->extent.rank; curr_dim++) {
- tmp_diminfo[curr_dim].start = space->select.sel_info.hslab->opt_diminfo[curr_dim].start;
- tmp_diminfo[curr_dim].stride = space->select.sel_info.hslab->opt_diminfo[curr_dim].stride;
- tmp_diminfo[curr_dim].count = space->select.sel_info.hslab->opt_diminfo[curr_dim].count;
- tmp_diminfo[curr_dim].block = space->select.sel_info.hslab->opt_diminfo[curr_dim].block;
- } /* end for */
-
- /* Loop over dimensions */
- for(curr_dim = 0; curr_dim < space->extent.rank; curr_dim++) {
- /* Check for this being identical */
- if((tmp_diminfo[curr_dim].start != new_hyper_diminfo[curr_dim].start)
- || (tmp_diminfo[curr_dim].stride != new_hyper_diminfo[curr_dim].stride)
- || (tmp_diminfo[curr_dim].count != new_hyper_diminfo[curr_dim].count)
- || (tmp_diminfo[curr_dim].block != new_hyper_diminfo[curr_dim].block)) {
- hsize_t high_start, high_count, high_block; /* The start, count & block values for the higher block */
-
- /* Dimension is not identical */
- /* Check if we already found a nonidentical dim - only one is
- * allowed */
- if(found_nonidentical_dim) {
- space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_NO;
- break;
- } /* end if */
-
- /* Check that strides are the same, or count is 1 for one of the
- * slabs */
- if((tmp_diminfo[curr_dim].stride != new_hyper_diminfo[curr_dim].stride)
- && (tmp_diminfo[curr_dim].count > 1)
- && (new_hyper_diminfo[curr_dim].count > 1)) {
- space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_NO;
- break;
- } /* end if */
-
- /* Patch tmp_diminfo.stride if its count is 1 */
- if((tmp_diminfo[curr_dim].count == 1)
- && (new_hyper_diminfo[curr_dim].count > 1))
- tmp_diminfo[curr_dim].stride = new_hyper_diminfo[curr_dim].stride;
-
- /* Determine lowest start, and set tmp_diminfo.start, count and
- * block to use the lowest, and high_start, high_count and
- * high_block to use the highest
- */
- if(tmp_diminfo[curr_dim].start < new_hyper_diminfo[curr_dim].start) {
- high_start = new_hyper_diminfo[curr_dim].start;
- high_count = new_hyper_diminfo[curr_dim].count;
- high_block = new_hyper_diminfo[curr_dim].block;
- } /* end if */
- else {
- high_start = tmp_diminfo[curr_dim].start;
- tmp_diminfo[curr_dim].start = new_hyper_diminfo[curr_dim].start;
- high_count = tmp_diminfo[curr_dim].count;
- tmp_diminfo[curr_dim].count = new_hyper_diminfo[curr_dim].count;
- high_block = tmp_diminfo[curr_dim].block;
- tmp_diminfo[curr_dim].block = new_hyper_diminfo[curr_dim].block;
- } /* end else */
-
- /* If count is 1 for both slabs, take different actions */
- if((tmp_diminfo[curr_dim].count == 1) && (high_count == 1)) {
- /* Check for overlap */
- if((tmp_diminfo[curr_dim].start + tmp_diminfo[curr_dim].block)
- > high_start) {
- /* Check operation type */
- if(op == H5S_SELECT_OR)
- /* Merge blocks */
- tmp_diminfo[curr_dim].block = ((high_start + high_block)
- >= (tmp_diminfo[curr_dim].start + tmp_diminfo[curr_dim].block))
- ? (high_start + high_block - tmp_diminfo[curr_dim].start)
- : tmp_diminfo[curr_dim].block;
- else {
- /* Block values must be the same */
- if(tmp_diminfo[curr_dim].block != high_block) {
- space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_NO;
- break;
- } /* end if */
-
- /* XOR - overlap creates 2 blocks */
- tmp_diminfo[curr_dim].stride = high_block;
- tmp_diminfo[curr_dim].count = 2;
- tmp_diminfo[curr_dim].block = high_start - tmp_diminfo[curr_dim].start;
- } /* end else */
- } /* end if */
- else if((tmp_diminfo[curr_dim].start + tmp_diminfo[curr_dim].block)
- == high_start)
- /* Blocks border, merge them */
- tmp_diminfo[curr_dim].block += high_block;
- else {
- /* Distinct blocks */
- /* Block values must be the same */
- if(tmp_diminfo[curr_dim].block != high_block) {
- space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_NO;
- break;
- } /* end if */
-
- /* Create strided selection */
- tmp_diminfo[curr_dim].stride = high_start - tmp_diminfo[curr_dim].start;
- tmp_diminfo[curr_dim].count = 2;
- } /* end else */
- } /* end if */
- else {
- /* Check if block values are the same */
- if(tmp_diminfo[curr_dim].block != new_hyper_diminfo[curr_dim].block) {
- space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_NO;
- break;
- } /* end if */
-
- /* Check phase of strides */
- if((tmp_diminfo[curr_dim].start % tmp_diminfo[curr_dim].stride)
- != (new_hyper_diminfo[curr_dim].start % tmp_diminfo[curr_dim].stride)) {
- space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_NO;
- break;
- } /* end if */
-
- /* Check operation type */
- if(op == H5S_SELECT_OR) {
- /* Make sure the slabs border or overlap */
- if(high_start > (tmp_diminfo[curr_dim].start
- + (tmp_diminfo[curr_dim].count
- * tmp_diminfo[curr_dim].stride))) {
- space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_NO;
- break;
- } /* end if */
- } /* end if */
- else
- /* XOR: Make sure the slabs border */
- if(high_start != (tmp_diminfo[curr_dim].start
- + (tmp_diminfo[curr_dim].count
- * tmp_diminfo[curr_dim].stride))) {
- space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_NO;
- break;
- } /* end if */
-
- /* Set count for combined selection */
- tmp_diminfo[curr_dim].count = ((high_start
- - tmp_diminfo[curr_dim].start)
- / tmp_diminfo[curr_dim].stride) + high_count;
- } /* end else */
-
- /* Indicate that we found a nonidentical dim */
- found_nonidentical_dim = TRUE;
- } /* end if */
- } /* end for */
-
- /* Check if we succeeded, if so, set the new diminfo values */
- if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES)
- for(curr_dim = 0; curr_dim < space->extent.rank; curr_dim++) {
- space->select.sel_info.hslab->app_diminfo[curr_dim].start = space->select.sel_info.hslab->opt_diminfo[curr_dim].start = tmp_diminfo[curr_dim].start;
- space->select.sel_info.hslab->app_diminfo[curr_dim].stride = space->select.sel_info.hslab->opt_diminfo[curr_dim].stride = tmp_diminfo[curr_dim].stride;
- space->select.sel_info.hslab->app_diminfo[curr_dim].count = space->select.sel_info.hslab->opt_diminfo[curr_dim].count = tmp_diminfo[curr_dim].count;
- space->select.sel_info.hslab->app_diminfo[curr_dim].block = space->select.sel_info.hslab->opt_diminfo[curr_dim].block = tmp_diminfo[curr_dim].block;
- } /* end for */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_update_diminfo() */
+} /* H5S_hyper_make_spans() */
/*--------------------------------------------------------------------------
@@ -6245,22 +5819,23 @@ static hbool_t
H5S_hyper_rebuild_helper(const H5S_hyper_span_t *span, H5S_hyper_dim_t span_slab_info[],
unsigned rank)
{
- hbool_t ret_value = TRUE; /* Return value */
+ hsize_t curr_stride, next_stride;
+ hsize_t curr_block, next_block;
+ hsize_t curr_start;
+ hsize_t curr_low;
+ size_t outcount;
+ unsigned u;
+ H5S_hyper_dim_t canon_down_span_slab_info[H5S_MAX_RANK];
+ hbool_t ret_value = TRUE;
FUNC_ENTER_NOAPI_NOINIT_NOERR
if(span) {
- H5S_hyper_dim_t canon_down_span_slab_info[H5S_MAX_RANK];
- hsize_t curr_stride;
- hsize_t curr_block;
- hsize_t curr_start;
- hsize_t curr_low;
- size_t outcount; /* Number of spans encountered in this dimension */
-
/* Initialization */
curr_stride = 1;
- curr_low = 0;
+ curr_block = 0;
outcount = 0;
+ curr_low = 0;
/* Get "canonical" down span information */
if(span->down) {
@@ -6279,13 +5854,9 @@ H5S_hyper_rebuild_helper(const H5S_hyper_span_t *span, H5S_hyper_dim_t span_slab
/* Loop the span */
while(span) {
- hsize_t next_stride;
- hsize_t next_block;
-
if(outcount > 0) {
if(span->down) {
- H5S_hyper_dim_t *curr_down_span_slab_info;
- unsigned u; /* Local index variable */
+ H5S_hyper_dim_t *curr_down_span_slab_info;
HDassert(span->down->head);
@@ -6296,7 +5867,7 @@ H5S_hyper_rebuild_helper(const H5S_hyper_span_t *span, H5S_hyper_dim_t span_slab
/* Compare the slab information of the adjacent spans in the down span tree.
We have to compare all the sub-tree slab information with the canon_down_span_slab_info.*/
- for(u = 0; u < rank - 1; u++) {
+ for( u = 0; u < rank - 1; u++) {
curr_down_span_slab_info = &span_slab_info[u];
if(curr_down_span_slab_info->count > 0 && canon_down_span_slab_info[u].count > 0) {
@@ -6306,9 +5877,9 @@ H5S_hyper_rebuild_helper(const H5S_hyper_span_t *span, H5S_hyper_dim_t span_slab
|| curr_down_span_slab_info->count != canon_down_span_slab_info[u].count)
HGOTO_DONE(FALSE)
} /* end if */
- else if(!((curr_down_span_slab_info->count == 0) && (canon_down_span_slab_info[u].count == 0)))
+ else if (!((curr_down_span_slab_info->count == 0) && (canon_down_span_slab_info[u].count == 0)))
HGOTO_DONE(FALSE)
- } /* end for */
+ }
} /* end if */
} /* end if */
@@ -6370,19 +5941,22 @@ done:
EXAMPLES
REVISION LOG
+
This routine is the optimization of the old version. The previous version
can only detect a singluar selection. This version is general enough to
detect any regular selection.
KY, 2005/9/22
--------------------------------------------------------------------------*/
-htri_t
+static htri_t
H5S_hyper_rebuild(H5S_t *space)
{
H5S_hyper_dim_t top_span_slab_info[H5O_LAYOUT_NDIMS];
- unsigned rank; /* Dataspace rank */
- htri_t ret_value = TRUE; /* Return value */
+ H5S_hyper_dim_t *diminfo;
+ H5S_hyper_dim_t *app_diminfo;
+ unsigned rank, curr_dim;
+ htri_t ret_value = TRUE; /* Return value */
- FUNC_ENTER_NOAPI_NOERR
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
HDassert(space);
@@ -6393,32 +5967,27 @@ H5S_hyper_rebuild(H5S_t *space)
/* Check whether the slab can be rebuilt. Only regular selection can be rebuilt. If yes, fill in correct values.*/
if(!H5S_hyper_rebuild_helper(space->select.sel_info.hslab->span_lst->head, top_span_slab_info, rank)) {
- space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_IMPOSSIBLE;
HGOTO_DONE(FALSE)
} /* end if */
else {
- H5S_hyper_dim_t *opt_diminfo; /* Convenience pointer to optimized dimension info */
- H5S_hyper_dim_t *app_diminfo; /* Convenience pointer to application dimension info */
- unsigned u; /* Local index variable */
+ diminfo=space->select.sel_info.hslab->opt_diminfo;
+ app_diminfo=space->select.sel_info.hslab->app_diminfo;
- /* Set the convenience pointers */
- opt_diminfo = space->select.sel_info.hslab->opt_diminfo;
- app_diminfo = space->select.sel_info.hslab->app_diminfo;
+ for(curr_dim = 0; curr_dim < rank; curr_dim++) {
+
+ app_diminfo[(rank - curr_dim) - 1].start = diminfo[(rank - curr_dim) - 1].start = top_span_slab_info[curr_dim].start;
+ app_diminfo[(rank - curr_dim) - 1].stride = diminfo[(rank - curr_dim) - 1].stride = top_span_slab_info[curr_dim].stride;
+ app_diminfo[(rank - curr_dim) - 1].count = diminfo[(rank - curr_dim) - 1].count = top_span_slab_info[curr_dim].count;
+ app_diminfo[(rank - curr_dim) - 1].block = diminfo[(rank - curr_dim) - 1].block = top_span_slab_info[curr_dim].block;
- /* Set the dimension info for the dataspace, from the rebuilt info */
- for(u = 0; u < rank; u++) {
- app_diminfo[(rank - u) - 1].start = opt_diminfo[(rank - u) - 1].start = top_span_slab_info[u].start;
- app_diminfo[(rank - u) - 1].stride = opt_diminfo[(rank - u) - 1].stride = top_span_slab_info[u].stride;
- app_diminfo[(rank - u) - 1].count = opt_diminfo[(rank - u) - 1].count = top_span_slab_info[u].count;
- app_diminfo[(rank - u) - 1].block = opt_diminfo[(rank - u) - 1].block = top_span_slab_info[u].block;
} /* end for */
- space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_YES;
+ space->select.sel_info.hslab->diminfo_valid = TRUE;
} /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_rebuild() */
+} /* H5S_hyper_rebuild() */
/*--------------------------------------------------------------------------
@@ -6442,12 +6011,12 @@ done:
static herr_t
H5S_hyper_generate_spans(H5S_t *space)
{
- hsize_t tmp_start[H5O_LAYOUT_NDIMS]; /* Temporary start information */
+ hsize_t tmp_start[H5O_LAYOUT_NDIMS]; /* Temporary start information */
hsize_t tmp_stride[H5O_LAYOUT_NDIMS]; /* Temporary stride information */
hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary count information */
hsize_t tmp_block[H5O_LAYOUT_NDIMS]; /* Temporary block information */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ unsigned u; /* Counter */
+ herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -6455,367 +6024,203 @@ H5S_hyper_generate_spans(H5S_t *space)
HDassert(H5S_GET_SELECT_TYPE(space) == H5S_SEL_HYPERSLABS);
/* Get the diminfo */
- for(u = 0; u < space->extent.rank; u++) {
- tmp_start[u] = space->select.sel_info.hslab->opt_diminfo[u].start;
- tmp_stride[u] = space->select.sel_info.hslab->opt_diminfo[u].stride;
- tmp_count[u] = space->select.sel_info.hslab->opt_diminfo[u].count;
- tmp_block[u] = space->select.sel_info.hslab->opt_diminfo[u].block;
+ for(u=0; u<space->extent.rank; u++) {
+ tmp_start[u]=space->select.sel_info.hslab->opt_diminfo[u].start;
+ tmp_stride[u]=space->select.sel_info.hslab->opt_diminfo[u].stride;
+ tmp_count[u]=space->select.sel_info.hslab->opt_diminfo[u].count;
+ tmp_block[u]=space->select.sel_info.hslab->opt_diminfo[u].block;
} /* end for */
/* Build the hyperslab information also */
- if(H5S_generate_hyperslab(space, H5S_SELECT_SET, tmp_start, tmp_stride, tmp_count, tmp_block) < 0)
+ if(H5S_generate_hyperslab (space, H5S_SELECT_SET, tmp_start, tmp_stride, tmp_count, tmp_block)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't generate hyperslabs")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_generate_spans() */
+} /* H5S_hyper_generate_spans() */
-/*--------------------------------------------------------------------------
- NAME
- H5S_hyper_update_bound_box
- PURPOSE
- Update the bounding box of the hyperslab depending on the selection operator
- USAGE
- herr_t H5S_hyper_update_bound_box(space, op, low_bounds, high_bounds, overlapped)
- H5S_t *space; IN/OUT: Dataspace containing the 1st space
- H5S_seloper_t op; IN: Selection operator
- const hszie_t low_bounds; IN: The lower bounds of the 2nd space
- const hsize_t high_bounds; IN: The higher bounds of the 2nd space
- RETURNS
- Non-negative on success, negative on failure
- DESCRIPTION
- GLOBAL VARIABLES
- COMMENTS, BUGS
- ASSUMPTIONS
- This function assumes that the two bound boxes are not overlapped. If two bound
- boxes are overlapped, the "space"'s bound box should be calculated recursively,
- which has been done in H5S_fill_in_new_space function.
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
+#ifndef NEW_HYPERSLAB_API
+
+/*-------------------------------------------------------------------------
+ * Function: H5S_generate_hyperlab
+ *
+ * Purpose: Generate hyperslab information from H5S_select_hyperslab()
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol (split from HS_select_hyperslab()).
+ * Tuesday, September 12, 2000
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
static herr_t
-H5S_hyper_update_bound_box(H5S_t *space, H5S_seloper_t op,
- const hsize_t low_bounds[], const hsize_t high_bounds[])
+H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
+ const hsize_t start[],
+ const hsize_t stride[],
+ const hsize_t count[],
+ const hsize_t block[])
{
- herr_t ret_value = SUCCEED; /* Return value */
+ H5S_hyper_span_info_t *new_spans=NULL; /* Span tree for new hyperslab */
+ H5S_hyper_span_info_t *a_not_b=NULL; /* Span tree for hyperslab spans in old span tree and not in new span tree */
+ H5S_hyper_span_info_t *a_and_b=NULL; /* Span tree for hyperslab spans in both old and new span trees */
+ H5S_hyper_span_info_t *b_not_a=NULL; /* Span tree for hyperslab spans in new span tree and not in old span tree */
+ herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
+ /* Check args */
HDassert(space);
- HDassert(H5S_GET_SELECT_TYPE(space) == H5S_SEL_HYPERSLABS);
+ HDassert(op > H5S_SELECT_NOOP && op < H5S_SELECT_INVALID);
+ HDassert(start);
+ HDassert(stride);
+ HDassert(count);
+ HDassert(block);
- /* The offset of the dataspace is ignored here */
- switch(op) {
- case H5S_SELECT_OR:
- case H5S_SELECT_XOR:
- {
- unsigned u; /* Local index variable */
+ /* Generate span tree for new hyperslab information */
+ if((new_spans=H5S_hyper_make_spans(space->extent.rank,start,stride,count,block))==NULL)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't create hyperslab information")
- for(u = 0; u < space->extent.rank; u++) {
- /* choose the smaller value for the low bound as the op is (X)OR */
- space->select.low_bounds[u] = MIN(low_bounds[u], space->select.low_bounds[u]);
+ /* Generate list of blocks to add/remove based on selection operation */
+ if(op==H5S_SELECT_SET) {
+ /* Add new spans to current selection */
+ if(H5S_hyper_merge_spans(space,new_spans,TRUE)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
- /* choose the larger value for the high bound as the op is (X)OR */
- space->select.high_bounds[u] = MAX(high_bounds[u], space->select.high_bounds[u]);
- } /* end for */
- }
- break;
+ /* Set the number of elements in current selection */
+ space->select.num_elem=H5S_hyper_spans_nelem(new_spans);
- case H5S_SELECT_AND:
- {
- hsize_t tmp = HSIZET_MAX;
+ /* Indicate that the new_spans are owned */
+ new_spans=NULL;
+ } /* end if */
+ else {
+ hbool_t updated_spans = FALSE; /* Whether the spans in the selection were modified */
- H5VM_array_fill(space->select.low_bounds, &tmp, sizeof(hsize_t), space->extent.rank);
- HDmemset(space->select.high_bounds, 0, sizeof(hsize_t) * space->extent.rank);
- }
- break;
+ /* Generate lists of spans which overlap and don't overlap */
+ if(H5S_hyper_clip_spans(space->select.sel_info.hslab->span_lst,new_spans,&a_not_b,&a_and_b,&b_not_a)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information")
- case H5S_SELECT_NOTB:
- /* Since the two spaces don't overlap, the bound box needs no update */
- break;
+ switch(op) {
+ case H5S_SELECT_OR:
+ /* Add any new spans from b_not_a to current selection */
+ if(b_not_a!=NULL) {
+ if(H5S_hyper_merge_spans(space,b_not_a,FALSE)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
- case H5S_SELECT_NOTA:
- /* Since the two spaces don't overlap, the bound box is same with 2nd space */
- HDmemcpy(space->select.low_bounds, low_bounds, sizeof(hsize_t) * space->extent.rank);
- HDmemcpy(space->select.high_bounds, high_bounds, sizeof(hsize_t) * space->extent.rank);
- break;
+ /* Update the number of elements in current selection */
+ space->select.num_elem+=H5S_hyper_spans_nelem(b_not_a);
- case H5S_SELECT_NOOP:
- case H5S_SELECT_SET:
- case H5S_SELECT_APPEND:
- case H5S_SELECT_PREPEND:
- case H5S_SELECT_INVALID:
- default:
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
- } /* end switch(op) */
+ /* Indicate that the spans were updated */
+ updated_spans = TRUE;
+ } /* end if */
+ break;
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_hyper_update_bound_box() */
+ case H5S_SELECT_AND:
+ /* Free the current selection */
+ if(H5S_hyper_free_span_info(space->select.sel_info.hslab->span_lst)<0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab spans")
+ space->select.sel_info.hslab->span_lst=NULL;
-
-/*--------------------------------------------------------------------------
- NAME
- H5S_fill_in_new_space
- PURPOSE
- Combine two span lists, one from an existing dataspace and the
- other from input arguments, into a new selection depending on the
- selection operator. The new selection is put into a resulting dataspace
- which could be allocated inside the function.
- USAGE
- herr_t H5S_fill_in_new_space(space1, op, space2_span_lst, space2_low_bound,
- space2_high_bound, can_own_span2,
- span2_owned, result)
- H5S_t *space1; IN: Dataspace containing the first span list
- H5S_seloper_t op; IN: Selection operation
- H5S_hyper_span_info_t *space2_span_lst; IN: Second span list
- const hsize_t *span2_low_bound; IN: The lower bound box for 2nd span list
- const hsize_t *span2_high_bound; IN: The higher bound box for 2nd span list
- hbool_t can_own_span2; IN: Indicates whether the 2nd span list could be
- owned by the result. If not, the 2nd span list
- has to be copied.
- hbool_t *span2_owned; OUT: Indicates if the 2nd span list is actually owned
- H5S_t **result; OUT: The dataspace containing the the new selection. It
- could be same with the 1st dataspace.
- RETURNS
- Non-negative on success, negative on failure
- PROGRAMMER
- Chao Mei July 8, 2011
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- The function is extracted from H5S_generate_hyperslab, and then modified
- to be general enough for hyperslab selection operations.
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static herr_t
-H5S_fill_in_new_space(H5S_t *space1, H5S_seloper_t op,
- H5S_hyper_span_info_t *space2_span_lst, const hsize_t *space2_low_bound,
- const hsize_t *space2_high_bound, hbool_t can_own_span2, hbool_t *span2_owned,
- hbool_t *updated_spans, H5S_t **result)
-{
- H5S_hyper_span_info_t *a_not_b = NULL; /* Span tree for hyperslab spans in old span tree and not in new span tree */
- H5S_hyper_span_info_t *a_and_b = NULL; /* Span tree for hyperslab spans in both old and new span trees */
- H5S_hyper_span_info_t *b_not_a = NULL; /* Span tree for hyperslab spans in new span tree and not in old span tree */
- hsize_t *space1_low_bound = space1->select.low_bounds;
- hsize_t *space1_high_bound = space1->select.high_bounds;
- hbool_t overlapped = FALSE;
- hbool_t is_result_new = FALSE;
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ /* Reset the number of items in selection */
+ space->select.num_elem=0;
- FUNC_ENTER_NOAPI_NOINIT
+ /* Check if there are any overlapped selections */
+ if(a_and_b!=NULL) {
+ if(H5S_hyper_merge_spans(space,a_and_b,TRUE)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
- HDassert(space1);
- HDassert(space2_span_lst);
- HDassert(op >= H5S_SELECT_OR && op <= H5S_SELECT_NOTA);
- /* The result is either a to-be-created space or an empty one */
- HDassert(*result == NULL || *result == space1);
- HDassert(space1->select.sel_info.hslab->span_lst);
- HDassert(span2_owned);
-
- /* Reset flags to return */
- *span2_owned = FALSE;
- *updated_spans = FALSE;
-
- /* The result shares the same info from space1 */
- if(*result == NULL) {
- if(NULL == ((*result) = H5S_copy(space1, TRUE, TRUE)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to copy dataspace")
- space1->select.sel_info.hslab->span_lst->count--;
- (*result)->select.sel_info.hslab->span_lst = NULL;
- is_result_new = TRUE;
- } /* end if */
+ /* Update the number of elements in current selection */
+ space->select.num_elem=H5S_hyper_spans_nelem(a_and_b);
- /* Check bound box of both spaces to see if they overlap or border */
- for(u = 0; u < space1->extent.rank; u++) {
- /*
- * Three conditions for overlapping/bordering:
- * 1. the lower bound of the new span is between the lower and
- * higher bound of the existing one. In other words, the left
- * part of new span will at least overlap or border with the
- * existing one.
- * 2. the higher bound of the new span is between the lower and
- * higher bound of the exisiting one. In other words, the right
- * part of new span will at least overlap or border with the
- * existing one.
- * 3. The new span includes the existing one where the lower bound
- * is smaller than that of the existing one, and the higher bound
- * is larger than that of the existing one.
- */
- /* condition 1 */
- if((space1_low_bound[u] >= space2_low_bound[u] &&
- space1_low_bound[u] <= (space2_high_bound[u] + 1)) ||
- /* condition 2 */
- ((space1_high_bound[u] + 1) >= space2_low_bound[u] &&
- space1_high_bound[u] <= space2_high_bound[u]) ||
- /* condition 3 */
- (space1_low_bound[u] < space2_low_bound[u] &&
- space1_high_bound[u] > space2_high_bound[u])) {
- overlapped = TRUE;
- break;
- } /* end if */
- } /* end for */
+ /* Indicate that the a_and_b spans are owned */
+ a_and_b=NULL;
- /* If two spans are disjoint in terms of bound box, then work could be much simplified. */
- if(!overlapped) {
- switch(op) {
- case H5S_SELECT_OR:
- case H5S_SELECT_XOR:
- /* Add the new disjoint spans to the space */
- /* A copy of space1's spans to *result, and another copy of space2's spans */
- if(is_result_new)
- (*result)->select.sel_info.hslab->span_lst = H5S_hyper_copy_span(space1->select.sel_info.hslab->span_lst);
- if(!can_own_span2) {
- b_not_a = H5S_hyper_copy_span(space2_span_lst);
- if(H5S_hyper_add_disjoint_spans(*result, b_not_a) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't append hyperslabs")
-
- /* The new_spans is now owned by space, so its memory space should not be released */
- b_not_a = NULL;
+ /* Indicate that the spans were updated */
+ updated_spans = TRUE;
} /* end if */
- else {
- if(H5S_hyper_add_disjoint_spans(*result, space2_span_lst) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't append hyperslabs")
- *span2_owned = TRUE;
- } /* end else */
-
- /* Indicate that the spans changed */
- *updated_spans = TRUE;
break;
- case H5S_SELECT_AND:
- /* Convert *result to "none" selection */
- if(H5S_select_none(*result) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't convert selection")
- HGOTO_DONE(SUCCEED);
+ case H5S_SELECT_XOR:
+ /* Free the current selection */
+ if(H5S_hyper_free_span_info(space->select.sel_info.hslab->span_lst)<0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab spans")
+ space->select.sel_info.hslab->span_lst=NULL;
- case H5S_SELECT_NOTB:
- /* Copy space1's spans to *result */
- if(is_result_new)
- (*result)->select.sel_info.hslab->span_lst = H5S_hyper_copy_span(space1->select.sel_info.hslab->span_lst);
+ /* Reset the number of items in selection */
+ space->select.num_elem=0;
- /* Indicate that the spans changed */
- *updated_spans = TRUE;
- break;
+ /* Check if there are any non-overlapped selections */
+ if(a_not_b!=NULL) {
+ if(H5S_hyper_merge_spans(space,a_not_b,FALSE)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
- case H5S_SELECT_NOTA:
- if(!is_result_new) {
- HDassert(space1 == *result);
+ /* Update the number of elements in current selection */
+ space->select.num_elem=H5S_hyper_spans_nelem(a_not_b);
- /* Free the current selection */
- if(H5S_hyper_free_span_info(space1->select.sel_info.hslab->span_lst) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab spans")
+ /* Indicate that the spans were updated */
+ updated_spans = TRUE;
} /* end if */
+ if(b_not_a!=NULL) {
+ if(H5S_hyper_merge_spans(space,b_not_a,FALSE)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
- /* Copy space2's spans to *result */
- if(!can_own_span2)
- (*result)->select.sel_info.hslab->span_lst = H5S_hyper_copy_span(space2_span_lst);
- else {
- (*result)->select.sel_info.hslab->span_lst = space2_span_lst;
- *span2_owned = TRUE;
- } /* end else */
-
- /* Reset the number of items in selection */
- (*result)->select.num_elem = H5S_hyper_spans_nelem(space2_span_lst);
+ /* Update the number of elements in current selection */
+ space->select.num_elem+=H5S_hyper_spans_nelem(b_not_a);
- /* Indicate that the spans changed */
- *updated_spans = TRUE;
+ /* Indicate that the spans were updated */
+ updated_spans = TRUE;
+ } /* end if */
break;
- case H5S_SELECT_NOOP:
- case H5S_SELECT_SET:
- case H5S_SELECT_APPEND:
- case H5S_SELECT_PREPEND:
- case H5S_SELECT_INVALID:
- default:
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
- } /* end switch */
-
- /* update bound box of the selection result */
- if(H5S_hyper_update_bound_box(*result, op, space2_low_bound, space2_high_bound) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't update the bound box")
- } /* end if */
- else {
- const hsize_t *span_a_b_bounds[4]; /* Pointers to space1 & space2 bound boxes */
- hsize_t bounds_array[6 * H5S_MAX_RANK]; /* Array for bounding boxes */
- hsize_t *tmp_bounds_array; /* Temp. pointer to array for bounding boxes */
- hsize_t tmp = HSIZET_MAX;
- unsigned selector = 0; /* Select which clipping spans to generate */
+ case H5S_SELECT_NOTB:
+ /* Free the current selection */
+ if(H5S_hyper_free_span_info(space->select.sel_info.hslab->span_lst)<0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab spans")
+ space->select.sel_info.hslab->span_lst=NULL;
- /* Generate mask for clip operation depending on the op */
- switch(op) {
- case H5S_SELECT_OR:
- selector = H5S_HYPER_COMPUTE_B_NOT_A; /* a + b_not_a */
- break;
+ /* Reset the number of items in selection */
+ space->select.num_elem=0;
- case H5S_SELECT_XOR: /* a_not_b + b_not_a */
- selector = H5S_HYPER_COMPUTE_A_NOT_B | H5S_HYPER_COMPUTE_B_NOT_A;
- break;
+ /* Check if there are any non-overlapped selections */
+ if(a_not_b!=NULL) {
+ if(H5S_hyper_merge_spans(space,a_not_b,TRUE)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
- case H5S_SELECT_AND: /* a_and_b */
- selector = H5S_HYPER_COMPUTE_A_AND_B;
- break;
+ /* Update the number of elements in current selection */
+ space->select.num_elem=H5S_hyper_spans_nelem(a_not_b);
- case H5S_SELECT_NOTB: /* a_not_b */
- selector = H5S_HYPER_COMPUTE_A_NOT_B;
- break;
+ /* Indicate that the a_not_b are owned */
+ a_not_b=NULL;
- case H5S_SELECT_NOTA: /* b_not_a */
- selector = H5S_HYPER_COMPUTE_B_NOT_A;
+ /* Indicate that the spans were updated */
+ updated_spans = TRUE;
+ } /* end if */
break;
- case H5S_SELECT_NOOP:
- case H5S_SELECT_SET:
- case H5S_SELECT_APPEND:
- case H5S_SELECT_PREPEND:
- case H5S_SELECT_INVALID:
- default:
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
- } /* end switch */
+ case H5S_SELECT_NOTA:
+ /* Free the current selection */
+ if(H5S_hyper_free_span_info(space->select.sel_info.hslab->span_lst)<0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab spans")
+ space->select.sel_info.hslab->span_lst=NULL;
- /* Initialize arrays for 3 pairs of low/high bounds to default values */
- tmp_bounds_array = bounds_array;
- for(u = 0; u < 3; u++) {
- /* set the bounds to be the default value */
- H5VM_array_fill(tmp_bounds_array, &tmp, sizeof(hsize_t), space1->extent.rank);
- tmp_bounds_array += space1->extent.rank;
- HDmemset(tmp_bounds_array, 0, sizeof(hsize_t) * space1->extent.rank);
- tmp_bounds_array += space1->extent.rank;
- } /* end for */
+ /* Reset the number of items in selection */
+ space->select.num_elem=0;
- /* Initialize array of pointers to space1 & space2's bound arrays */
- span_a_b_bounds[0] = space1->select.low_bounds;
- span_a_b_bounds[1] = space1->select.high_bounds;
- span_a_b_bounds[2] = space2_low_bound;
- span_a_b_bounds[3] = space2_high_bound;
+ /* Check if there are any non-overlapped selections */
+ if(b_not_a!=NULL) {
+ if(H5S_hyper_merge_spans(space,b_not_a,TRUE)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
- /* Generate lists of spans which overlap and don't overlap */
- if(H5S_hyper_clip_spans(space1->select.sel_info.hslab->span_lst,
- space2_span_lst, selector, 0, space1->extent.rank,
- span_a_b_bounds, bounds_array, &a_not_b, &a_and_b, &b_not_a) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information")
- switch(op) {
- case H5S_SELECT_OR:
- if(is_result_new)
- (*result)->select.sel_info.hslab->span_lst = H5S_hyper_copy_span(space1->select.sel_info.hslab->span_lst);
- break;
+ /* Update the number of elements in current selection */
+ space->select.num_elem=H5S_hyper_spans_nelem(b_not_a);
- case H5S_SELECT_AND:
- case H5S_SELECT_XOR:
- case H5S_SELECT_NOTB:
- case H5S_SELECT_NOTA:
- if(!is_result_new) {
- HDassert(space1 == *result);
+ /* Indicate that the b_not_a are owned */
+ b_not_a=NULL;
- /* Free the current selection */
- if(H5S_hyper_free_span_info(space1->select.sel_info.hslab->span_lst) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab spans")
- space1->select.sel_info.hslab->span_lst = NULL;
+ /* Indicate that the spans were updated */
+ updated_spans = TRUE;
} /* end if */
-
- /* Reset the number of items in selection */
- (*result)->select.num_elem = 0;
break;
case H5S_SELECT_NOOP:
@@ -6827,110 +6232,40 @@ H5S_fill_in_new_space(H5S_t *space1, H5S_seloper_t op,
HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
} /* end switch */
- /* Check if there are any non-overlapped selections */
- if(a_not_b) {
- hsize_t *a_not_b_low_bounds = bounds_array;
- hsize_t *a_not_b_high_bounds = bounds_array + space1->extent.rank;
-
- /* Other than OR, the span_lst is set to NULL. And in OR, a_not_b is not needed */
- HDassert(NULL == (*result)->select.sel_info.hslab->span_lst);
-
- if(H5S_hyper_merge_spans(*result, a_not_b) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
-
- /* Update the bound box: just use a_not_b's bound box as no span tree is in result */
- HDmemcpy((*result)->select.low_bounds, a_not_b_low_bounds, sizeof(hsize_t) * space1->extent.rank);
- HDmemcpy((*result)->select.high_bounds, a_not_b_high_bounds, sizeof(hsize_t) * space1->extent.rank);
-
- /* Update the number of elements in current selection */
- (*result)->select.num_elem += H5S_hyper_spans_nelem(a_not_b);
+ /* Check if the resulting hyperslab span tree is empty */
+ if(space->select.sel_info.hslab->span_lst==NULL) {
+ H5S_hyper_span_info_t *spans; /* Empty hyperslab span tree */
- /* Indicate that the spans were updated */
- *updated_spans = TRUE;
-
- /* Indicate that the a_not_b spans are owned */
- a_not_b = NULL;
- } /* end if */
-
- if(a_and_b) {
- hsize_t *a_and_b_low_bounds = bounds_array + 2 * space1->extent.rank;
- hsize_t *a_and_b_high_bounds = bounds_array + 3 * space1->extent.rank;
-
- /**
- * 1. Other than OR, the span_lst is set to NULL. And in OR,
- * a_and_b is not needed
- * 2. a_not_b will never be computed together with a_and_b
- * because merging these two equals to a.
- */
- HDassert(NULL == (*result)->select.sel_info.hslab->span_lst);
+ /* Sanity check */
+ HDassert(space->select.num_elem == 0);
- if(H5S_hyper_merge_spans(*result, a_and_b) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
+ /* Allocate a span info node */
+ if((spans = H5FL_MALLOC(H5S_hyper_span_info_t))==NULL)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
- /* Update the bound box: just use a_not_b's bound box as no span tree is in result */
- HDmemcpy((*result)->select.low_bounds, a_and_b_low_bounds, sizeof(hsize_t) * space1->extent.rank);
- HDmemcpy((*result)->select.high_bounds, a_and_b_high_bounds, sizeof(hsize_t) * space1->extent.rank);
+ /* Set the reference count */
+ spans->count=1;
- /* Update the number of elements in current selection */
- (*result)->select.num_elem += H5S_hyper_spans_nelem(a_and_b);
+ /* Reset the scratch pad space */
+ spans->scratch=0;
- /* Indicate that the spans were updated */
- *updated_spans = TRUE;
+ /* Set to empty tree */
+ spans->head=NULL;
- /* Indicate that the a_and_b spans are owned */
- a_and_b = NULL;
+ /* Set pointer to empty span tree */
+ space->select.sel_info.hslab->span_lst=spans;
} /* end if */
-
- if(b_not_a) {
- hsize_t *b_not_a_low_bounds = bounds_array + 4 * space1->extent.rank;
- hsize_t *b_not_a_high_bounds = bounds_array + 5 * space1->extent.rank;
- hbool_t has_span_tree = (NULL != (*result)->select.sel_info.hslab->span_lst);
-
- if(H5S_hyper_merge_spans(*result, b_not_a) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
-
- /* Update the bound box */
- if(has_span_tree) {
- /* Since two span trees are merged, the update on bound box is like an OR operation */
- for(u = 0; u < space1->extent.rank; u++) {
- (*result)->select.low_bounds[u] = MIN((*result)->select.low_bounds[u], b_not_a_low_bounds[u]);
- (*result)->select.high_bounds[u] = MAX((*result)->select.high_bounds[u], b_not_a_high_bounds[u]);
- } /* end for */
+ else {
+ /* Check if we updated the spans */
+ if(updated_spans) {
+ /* Attempt to rebuild "optimized" start/stride/count/block information.
+ * from resulting hyperslab span tree
+ */
+ if(H5S_hyper_rebuild(space) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't rebuild hyperslab info")
} /* end if */
- else {
- /* Just use b_not_a's bound box as no span tree is in result */
- HDmemcpy((*result)->select.low_bounds, b_not_a_low_bounds, sizeof(hsize_t) * space1->extent.rank);
- HDmemcpy((*result)->select.high_bounds, b_not_a_high_bounds, sizeof(hsize_t) * space1->extent.rank);
- } /* end else */
-
- /* Update the number of elements in current selection */
- (*result)->select.num_elem += H5S_hyper_spans_nelem(b_not_a);
-
- /* Indicate that the spans were updated */
- *updated_spans = TRUE;
-
- /* Indicate that the b_not_a spans are owned */
- b_not_a = NULL;
- } /* end if */
- } /* end else for the case the new span overlaps with the old (i.e. space) */
-
- /* Check if the spans weren't updated, and reset selection if so */
- if(!*updated_spans) {
- /** If updated_spans remains FALSE as in this branch, it
- * means the result has been cleared in cases
- * XOR/AND/NOTB/NOTA, and the result is a copy of the
- * dataspace in the case OR.
- *
- * If two dataspaces have generated any of the three clipped
- * span trees (i.e. a_not_b, a_and_b, and b_not_a), the
- * updated_spans must be TRUE.
- */
- if(H5S_SELECT_OR != op) {
- /* Convert *result to "none" selection */
- if(H5S_select_none(*result) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't convert selection")
} /* end else */
- } /* end if */
+ } /* end else */
done:
/* Free resources */
@@ -6943,108 +6278,6 @@ done:
if(b_not_a)
if(H5S_hyper_free_span_info(b_not_a) < 0)
HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release temporary hyperslab spans")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_fill_in_new_space() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5S_generate_hyperlab
- *
- * Purpose: Generate hyperslab information from H5S_select_hyperslab()
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Tuesday, September 12, 2000
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5S_generate_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[],
- const hsize_t stride[], const hsize_t count[], const hsize_t block[])
-{
- H5S_hyper_span_info_t *new_spans=NULL; /* Span tree for new hyperslab */
- hsize_t new_spans_low_bounds[H5S_MAX_RANK]; /* The lower bound box for the new hyperslab */
- hsize_t new_spans_high_bounds[H5S_MAX_RANK]; /* The upper bound box for the new hyperslab */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Check args */
- HDassert(space);
- HDassert(op > H5S_SELECT_NOOP && op < H5S_SELECT_INVALID);
- HDassert(start);
- HDassert(stride);
- HDassert(count);
- HDassert(block);
-
- /* Generate span tree for new hyperslab information */
- if(NULL == (new_spans = H5S_hyper_make_spans(space->extent.rank, start, stride, count, block)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't create hyperslab information")
-
- /* Generate the bound box for the new hyperslab */
- for(u = 0; u < space->extent.rank; u++) {
- new_spans_low_bounds[u] = start[u];
- new_spans_high_bounds[u] = new_spans_low_bounds[u] + stride[u] * (count[u] - 1) + (block[u] - 1);
- } /* end for */
-
- /* Generate list of blocks to add/remove based on selection operation */
- if(op == H5S_SELECT_SET) {
- H5S_hyper_span_info_t *existing_spans = space->select.sel_info.hslab->span_lst;
-
- /* Add new spans to current selection */
- if(NULL != existing_spans)
- if(H5S_hyper_free_span_info(existing_spans) < 0)
- HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release existing hyperslab spans")
-
- space->select.sel_info.hslab->span_lst = new_spans;
-
- /* Set the number of elements in current selection */
- space->select.num_elem = H5S_hyper_spans_nelem(new_spans);
-
- /* Update the bound box of this hyperslab */
- HDmemcpy(space->select.low_bounds, new_spans_low_bounds, sizeof(hsize_t) * space->extent.rank);
- HDmemcpy(space->select.high_bounds, new_spans_high_bounds, sizeof(hsize_t) * space->extent.rank);
-
- /* Indicate that the new_spans are owned */
- new_spans = NULL;
- } /* end if */
- else {
- hbool_t new_spans_owned;
- hbool_t updated_spans;
-
- /* Generate new spans for space */
- if(H5S_fill_in_new_space(space, op, new_spans, new_spans_low_bounds, new_spans_high_bounds, TRUE, &new_spans_owned, &updated_spans, &space) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't generate the specified hyperslab")
-
- /* Check if the spans were updated by H5S_fill_in_new_space */
- if(updated_spans) {
- H5S_hyper_dim_t new_hyper_diminfo[H5S_MAX_RANK];
-
- /* Sanity check */
- HDassert(space->select.sel_info.hslab->span_lst->head);
-
- /* Build diminfo struct */
- for(u = 0; u <space->extent.rank; u++) {
- new_hyper_diminfo[u].start = start[u];
- new_hyper_diminfo[u].stride = stride[u];
- new_hyper_diminfo[u].count = count[u];
- new_hyper_diminfo[u].block = block[u];
- } /* end for */
-
- /* Update space's dim info */
- if(H5S_hyper_update_diminfo(space, op, new_hyper_diminfo) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't update hyperslab info")
- } /* end if */
-
- /* Indicate that the new_spans are owned, there's no need to free */
- if(new_spans_owned)
- new_spans = NULL;
- } /* end else */
-
-done:
if(new_spans)
if(H5S_hyper_free_span_info(new_spans) < 0)
HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release temporary hyperslab spans")
@@ -7066,17 +6299,20 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[],
- const hsize_t *stride, const hsize_t count[], const hsize_t *block)
+H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
+ const hsize_t start[],
+ const hsize_t *stride,
+ const hsize_t count[],
+ const hsize_t *block)
{
hsize_t int_stride[H5O_LAYOUT_NDIMS]; /* Internal storage for stride information */
hsize_t int_count[H5O_LAYOUT_NDIMS]; /* Internal storage for count information */
hsize_t int_block[H5O_LAYOUT_NDIMS]; /* Internal storage for block information */
- const hsize_t *opt_stride; /* Optimized stride information */
- const hsize_t *opt_count; /* Optimized count information */
- const hsize_t *opt_block; /* Optimized block information */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ const hsize_t *opt_stride; /* Optimized stride information */
+ const hsize_t *opt_count; /* Optimized count information */
+ const hsize_t *opt_block; /* Optimized block information */
+ unsigned u; /* Counters */
+ herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -7109,8 +6345,8 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[],
case H5S_SELECT_AND: /* Binary "and" operation for hyperslabs */
case H5S_SELECT_NOTA: /* Binary "B not A" operation for hyperslabs */
/* Convert to "none" selection */
- if(H5S_select_none(space) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't convert selection")
+ if(H5S_select_none(space)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection")
HGOTO_DONE(SUCCEED);
case H5S_SELECT_OR: /* Binary "or" operation for hyperslabs */
@@ -7229,8 +6465,8 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[],
case H5S_SELECT_NOTA: /* Binary "B not A" operation for hyperslabs */
/* Convert to "none" selection */
- if(H5S_select_none(space) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't convert selection")
+ if(H5S_select_none(space)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection")
HGOTO_DONE(SUCCEED);
case H5S_SELECT_NOOP:
@@ -7279,21 +6515,14 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[],
space->select.sel_info.hslab->opt_diminfo[u].count = opt_count[u];
space->select.sel_info.hslab->opt_diminfo[u].block = opt_block[u];
- /* update bound box of the hyperslab selection */
- space->select.low_bounds[u] = start[u];
- space->select.high_bounds[u] = space->select.low_bounds[u] + stride[u] * (count[u] - 1) + (block[u] - 1);
-
space->select.num_elem *= (opt_count[u] * opt_block[u]);
} /* end for */
/* Indicate that the dimension information is valid */
- space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_YES;
+ space->select.sel_info.hslab->diminfo_valid = TRUE;
/* Indicate that there's no slab information */
space->select.sel_info.hslab->span_lst = NULL;
-
- /* Set selection type */
- space->select.type = H5S_sel_hyper;
} /* end if */
else if(op >= H5S_SELECT_OR && op <= H5S_SELECT_NOTA) {
/* Sanity check */
@@ -7304,9 +6533,8 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[],
if(H5S_hyper_generate_spans(space) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree")
- /* Set selection type */
- /* (Could be overridden by resetting selection to 'none', below) */
- space->select.type = H5S_sel_hyper;
+ /* Indicate that the regular dimensions are no longer valid */
+ space->select.sel_info.hslab->diminfo_valid = FALSE;
/* Add in the new hyperslab information */
if(H5S_generate_hyperslab(space, op, start, opt_stride, opt_count, opt_block) < 0)
@@ -7315,9 +6543,12 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[],
else
HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
+ /* Set selection type */
+ space->select.type = H5S_sel_hyper;
+
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_select_hyperslab() */
+} /* end H5S_select_hyperslab() */
/*--------------------------------------------------------------------------
@@ -7348,9 +6579,10 @@ done:
--------------------------------------------------------------------------*/
herr_t
H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[],
- const hsize_t stride[], const hsize_t count[], const hsize_t block[])
+ const hsize_t stride[], const hsize_t count[], const hsize_t block[])
{
H5S_t *space; /* Dataspace to modify selection of */
+ unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -7358,7 +6590,7 @@ H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[],
/* Check args */
if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
if(H5S_SCALAR == H5S_GET_EXTENT_TYPE(space))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hyperslab doesn't support H5S_SCALAR space")
if(H5S_NULL == H5S_GET_EXTENT_TYPE(space))
@@ -7367,283 +6599,617 @@ H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[],
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hyperslab not specified")
if(!(op > H5S_SELECT_NOOP && op < H5S_SELECT_INVALID))
HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
- if(stride != NULL) {
- unsigned u; /* Local index variable */
-
+ if(stride!=NULL) {
/* Check for 0-sized strides */
- for(u = 0; u < space->extent.rank; u++) {
- if(stride[u] == 0)
+ for(u=0; u<space->extent.rank; u++) {
+ if(stride[u]==0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid stride==0 value")
} /* end for */
} /* end if */
- if(H5S_select_hyperslab(space, op, start, stride, count, block) < 0)
+ if (H5S_select_hyperslab(space, op, start, stride, count, block)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to set hyperslab selection")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Sselect_hyperslab() */
+#else /* NEW_HYPERSLAB_API */ /* Works */
+
+/*-------------------------------------------------------------------------
+ * Function: H5S_operate_hyperslab
+ *
+ * Purpose: Combines two hyperslabs with an operation, putting the
+ * result into a third hyperslab selection
+ *
+ * Return: non-negative on success/NULL on failure
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, October 30, 2001
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper_t op, H5S_hyper_span_info_t *spans2,
+ hbool_t can_own_span2, hbool_t *span2_owned)
+{
+ H5S_hyper_span_info_t *a_not_b=NULL; /* Span tree for hyperslab spans in old span tree and not in new span tree */
+ H5S_hyper_span_info_t *a_and_b=NULL; /* Span tree for hyperslab spans in both old and new span trees */
+ H5S_hyper_span_info_t *b_not_a=NULL; /* Span tree for hyperslab spans in new span tree and not in old span tree */
+ herr_t ret_value=SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* Check args */
+ HDassert(result);
+ HDassert(spans2);
+ HDassert(op > H5S_SELECT_NOOP && op < H5S_SELECT_INVALID);
+
+ /* Just copy the selection from spans2 if we are setting the selection */
+ /* ('space1' to 'result' aliasing happens at the next layer up) */
+ if(op==H5S_SELECT_SET) {
+ if(H5S_hyper_merge_spans(result,spans2,can_own_span2)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
+
+ /* Update the number of elements in current selection */
+ result->select.num_elem=H5S_hyper_spans_nelem(spans2);
+
+ /* Indicate that we took ownership of span2, if allowed */
+ if(can_own_span2)
+ *span2_owned=TRUE;
+ } /* end if */
+ else {
+ hbool_t updated_spans = FALSE; /* Whether the spans in the selection were modified */
+
+ HDassert(spans1);
+
+ /* Generate lists of spans which overlap and don't overlap */
+ if(H5S_hyper_clip_spans(spans1,spans2,&a_not_b,&a_and_b,&b_not_a)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information")
+
+ /* Switch on the operation */
+ switch(op) {
+ case H5S_SELECT_OR:
+ /* Copy spans from spans1 to current selection */
+ if(spans1!=NULL) {
+ if(H5S_hyper_merge_spans(result,spans1,FALSE)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
+
+ /* Update the number of elements in current selection */
+ result->select.num_elem=H5S_hyper_spans_nelem(spans1);
+ } /* end if */
+
+ /* Add any new spans from spans2 to current selection */
+ if(b_not_a!=NULL) {
+ if(H5S_hyper_merge_spans(result,b_not_a,FALSE)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
+
+ /* Update the number of elements in current selection */
+ result->select.num_elem+=H5S_hyper_spans_nelem(b_not_a);
+
+ /* Indicate that the spans were updated */
+ updated_spans = TRUE;
+ } /* end if */
+ break;
+
+ case H5S_SELECT_AND:
+ /* Check if there are any overlapped selections */
+ if(a_and_b!=NULL) {
+ if(H5S_hyper_merge_spans(result,a_and_b,TRUE)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
+
+ /* Update the number of elements in current selection */
+ result->select.num_elem=H5S_hyper_spans_nelem(a_and_b);
+
+ /* Indicate that the result owns the a_and_b spans */
+ a_and_b=NULL;
+
+ /* Indicate that the spans were updated */
+ updated_spans = TRUE;
+ } /* end if */
+ break;
+
+ case H5S_SELECT_XOR:
+ /* Check if there are any non-overlapped selections */
+ if(a_not_b!=NULL) {
+ if(H5S_hyper_merge_spans(result,a_not_b,FALSE)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
+
+ /* Update the number of elements in current selection */
+ result->select.num_elem=H5S_hyper_spans_nelem(a_not_b);
+
+ /* Indicate that the spans were updated */
+ updated_spans = TRUE;
+ } /* end if */
+ if(b_not_a!=NULL) {
+ if(H5S_hyper_merge_spans(result,b_not_a,FALSE)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
+
+ /* Update the number of elements in current selection */
+ result->select.num_elem+=H5S_hyper_spans_nelem(b_not_a);
+
+ /* Indicate that the spans were updated */
+ updated_spans = TRUE;
+ } /* end if */
+ break;
+
+ case H5S_SELECT_NOTB:
+ /* Check if there are any non-overlapped selections */
+ if(a_not_b!=NULL) {
+ if(H5S_hyper_merge_spans(result,a_not_b,TRUE)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
+
+ /* Update the number of elements in current selection */
+ result->select.num_elem=H5S_hyper_spans_nelem(a_not_b);
+
+ /* Indicate that the result owns the a_not_b spans */
+ a_not_b=NULL;
+
+ /* Indicate that the spans were updated */
+ updated_spans = TRUE;
+ } /* end if */
+ break;
+
+ case H5S_SELECT_NOTA:
+ /* Check if there are any non-overlapped selections */
+ if(b_not_a!=NULL) {
+ if(H5S_hyper_merge_spans(result,b_not_a,TRUE)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
+
+ /* Update the number of elements in current selection */
+ result->select.num_elem=H5S_hyper_spans_nelem(b_not_a);
+
+ /* Indicate that the result owns the b_not_a spans */
+ b_not_a=NULL;
+
+ /* Indicate that the spans were updated */
+ updated_spans = TRUE;
+ } /* end if */
+ break;
+
+ default:
+ HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
+ } /* end switch */
+
+ /* Free the hyperslab trees generated from the clipping algorithm */
+ if(a_not_b)
+ H5S_hyper_free_span_info(a_not_b);
+ if(a_and_b)
+ H5S_hyper_free_span_info(a_and_b);
+ if(b_not_a)
+ H5S_hyper_free_span_info(b_not_a);
+
+ /* Check if the resulting hyperslab span tree is empty */
+ if(result->select.sel_info.hslab->span_lst==NULL) {
+ H5S_hyper_span_info_t *spans; /* Empty hyperslab span tree */
+
+ /* Sanity check */
+ HDassert(result->select.num_elem == 0);
+
+ /* Allocate a span info node */
+ if((spans = H5FL_MALLOC(H5S_hyper_span_info_t))==NULL)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
+
+ /* Set the reference count */
+ spans->count=1;
+
+ /* Reset the scratch pad space */
+ spans->scratch=0;
+
+ /* Set to empty tree */
+ spans->head=NULL;
+
+ /* Set pointer to empty span tree */
+ result->select.sel_info.hslab->span_lst=spans;
+ } /* end if */
+ else {
+ /* Check if we updated the spans */
+ if(updated_spans) {
+ /* Attempt to rebuild "optimized" start/stride/count/block information.
+ * from resulting hyperslab span tree
+ */
+ if(H5S_hyper_rebuild(result) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't rebuild hyperslab info")
+ } /* end if */
+ } /* end else */
+ } /* end else */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S_operate_hyperslab() */
-/*--------------------------------------------------------------------------
- NAME
- H5S_fill_in_hyperslab
- PURPOSE
- Specify a hyperslab to combine with the current hyperslab selection, and
- store the result in the new hyperslab selection.
- USAGE
- herr_t H5S_fill_in_hyperslab(new_space, old_space, op, start, stride, count, block)
- H5S_t old_space; IN: The old space the selection is performed on
- H5S_seloper_t op; IN: Operation to perform on current selection
- const hsize_t *start; IN: Offset of start of hyperslab
- const hsize_t *stride; IN: Hyperslab stride
- const hsize_t *count; IN: Number of blocks included in hyperslab
- const hsize_t *block; IN: Size of block in hyperslab
- H5S_t *new_space; OUT: The new dataspace to store the selection result
- RETURNS
- Non-negative on success/Negative on failure
- DESCRIPTION
- Combines a hyperslab selection with the current selection for a dataspace.
- If STRIDE or BLOCK is NULL, they are assumed to be set to all '1'.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- In some cases, the whole span tree in the old_space could be avoided from copying
- into the new_space. In order to deal with such cases, H5S_select_hyperslab could
- not be directly called. Otherwise, this function equals two steps:
- 1. copy the whole span tree from old_space into new_space
- 2. call H5S_select_hyperslab with the new_space.
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------
+ * Function: H5S_generate_hyperlab
+ *
+ * Purpose: Generate hyperslab information from H5S_select_hyperslab()
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol (split from HS_select_hyperslab()).
+ * Tuesday, September 12, 2000
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
static herr_t
-H5S_fill_in_hyperslab(H5S_t *old_space, H5S_seloper_t op, const hsize_t start[],
- const hsize_t *stride, const hsize_t count[], const hsize_t *block,
- H5S_t **new_space)
+H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
+ const hsize_t start[],
+ const hsize_t stride[],
+ const hsize_t count[],
+ const hsize_t block[])
{
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5S_hyper_span_info_t *new_spans=NULL; /* Span tree for new hyperslab */
+ H5S_hyper_span_info_t *tmp_spans=NULL; /* Temporary copy of selection */
+ hbool_t span2_owned=FALSE; /* Flag to indicate that span2 was used in H5S_operate_hyperslab() */
+ herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Check args */
- HDassert(old_space);
+ HDassert(space);
+ HDassert(op > H5S_SELECT_NOOP && op < H5S_SELECT_INVALID);
HDassert(start);
+ HDassert(stride);
HDassert(count);
- HDassert(op >= H5S_SELECT_SET && op <= H5S_SELECT_NOTA);
- HDassert(new_space);
- HDassert(*new_space == NULL);
+ HDassert(block);
+
+ /* Generate span tree for new hyperslab information */
+ if((new_spans=H5S_hyper_make_spans(space->extent.rank,start,stride,count,block))==NULL)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't create hyperslab information")
+
+ /* Copy the original dataspace */
+ if(space->select.sel_info.hslab->span_lst!=NULL) {
+ /* Take ownership of the dataspace's hyperslab spans */
+ /* (These are freed later) */
+ tmp_spans=space->select.sel_info.hslab->span_lst;
+ space->select.sel_info.hslab->span_lst=NULL;
+
+ /* Reset the other dataspace selection information */
+ if(H5S_SELECT_RELEASE(space)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection")
+
+ /* Allocate space for the hyperslab selection information */
+ if((space->select.sel_info.hslab=H5FL_MALLOC(H5S_hyper_sel_t))==NULL)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab info")
+ } /* end if */
+
+ /* Combine tmp_space (really space) & new_space, with the result in space */
+ if(H5S_operate_hyperslab(space,tmp_spans,op,new_spans,TRUE,&span2_owned)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information")
+
+done:
+ /* Free temporary data structures */
+ if(tmp_spans!=NULL)
+ if(H5S_hyper_free_span_info(tmp_spans)<0)
+ HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release temporary hyperslab spans")
+ if(new_spans!=NULL && span2_owned==FALSE)
+ if(H5S_hyper_free_span_info(new_spans)<0)
+ HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release temporary hyperslab spans")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S_generate_hyperslab() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5S_select_hyperslab
+ *
+ * Purpose: Internal version of H5Sselect_hyperslab().
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, January 10, 2001
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
+ const hsize_t start[],
+ const hsize_t *stride,
+ const hsize_t count[],
+ const hsize_t *block)
+{
+ hsize_t int_stride[H5O_LAYOUT_NDIMS]; /* Internal storage for stride information */
+ hsize_t int_count[H5O_LAYOUT_NDIMS]; /* Internal storage for count information */
+ hsize_t int_block[H5O_LAYOUT_NDIMS]; /* Internal storage for block information */
+ const hsize_t *opt_stride; /* Optimized stride information */
+ const hsize_t *opt_count; /* Optimized count information */
+ const hsize_t *opt_block; /* Optimized block information */
+ unsigned u; /* Counters */
+ herr_t ret_value=SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check args */
+ HDassert(space);
+ HDassert(start);
+ HDassert(count);
+ HDassert(op > H5S_SELECT_NOOP && op < H5S_SELECT_INVALID);
/* Point to the correct stride values */
- if(stride == NULL)
+ if(stride==NULL)
stride = _ones;
/* Point to the correct block values */
- if(block == NULL)
+ if(block==NULL)
block = _ones;
- /* Check new selection. */
- for(u = 0; u < old_space->extent.rank; u++) {
+ /*
+ * Check new selection.
+ */
+ for(u=0; u<space->extent.rank; u++) {
/* Check for overlapping hyperslab blocks in new selection. */
- if(count[u] > 1 && stride[u] < block[u])
+ if(count[u]>1 && stride[u]<block[u])
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hyperslab blocks overlap")
/* Detect zero-sized hyperslabs in new selection */
if(count[u] == 0 || block[u] == 0) {
switch(op) {
+ case H5S_SELECT_SET: /* Select "set" operation */
case H5S_SELECT_AND: /* Binary "and" operation for hyperslabs */
case H5S_SELECT_NOTA: /* Binary "B not A" operation for hyperslabs */
/* Convert to "none" selection */
- /* Copy the first dataspace without sharing the list of spans */
- if(NULL == ((*new_space) = H5S_copy(old_space, TRUE, TRUE)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to copy dataspace")
- if(H5S_select_none((*new_space)) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't convert selection")
+ if(H5S_select_none(space)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection")
HGOTO_DONE(SUCCEED);
case H5S_SELECT_OR: /* Binary "or" operation for hyperslabs */
case H5S_SELECT_XOR: /* Binary "xor" operation for hyperslabs */
case H5S_SELECT_NOTB: /* Binary "A not B" operation for hyperslabs */
- /* Copy the first dataspace with sharing the list of spans */
- if(NULL == ((*new_space) = H5S_copy(old_space, FALSE, TRUE)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to copy dataspace")
HGOTO_DONE(SUCCEED); /* Selection stays same */
- case H5S_SELECT_NOOP:
- case H5S_SELECT_SET:
- case H5S_SELECT_APPEND:
- case H5S_SELECT_PREPEND:
- case H5S_SELECT_INVALID:
default:
HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
} /* end switch */
} /* end if */
} /* end for */
- if(H5S_GET_SELECT_TYPE(old_space) == H5S_SEL_HYPERSLABS) {
- hsize_t new_low_bound[H5S_MAX_RANK];
- hsize_t new_high_bound[H5S_MAX_RANK];
- hbool_t overlapped = FALSE;
-
- /* Generate bounding box for hyperslab parameters */
- for(u = 0; u < old_space->extent.rank; u++) {
- new_low_bound[u] = start[u];
- new_high_bound[u] = new_low_bound[u] + stride[u] * (count[u]-1) + (block[u]-1);
- } /* end for */
-
- /* Check bounding box to see if two are disjoint */
- for(u = 0; u < old_space->extent.rank; u++) {
- /* Note: offset of this old_space is neglected */
- hsize_t old_low_bound = old_space->select.low_bounds[u];
- hsize_t old_high_bound = old_space->select.high_bounds[u];
-
- /* The following condition tests are copied from H5S_fill_in_new_space */
- if((new_low_bound[u] >= old_low_bound && new_low_bound[u] <= old_high_bound) ||
- (new_high_bound[u] >= old_low_bound && new_high_bound[u] <= old_high_bound) ||
- (new_low_bound[u] <= old_low_bound && new_high_bound[u] >= old_high_bound)) {
- overlapped = TRUE;
- break;
+ /* Optimize hyperslab parameters to merge contiguous blocks, etc. */
+ if(stride == _ones && block == _ones) {
+ /* Point to existing arrays */
+ opt_stride = _ones;
+ opt_count = _ones;
+ opt_block = count;
+ } /* end if */
+ else {
+ /* Point to local arrays */
+ opt_stride = int_stride;
+ opt_count = int_count;
+ opt_block = int_block;
+ for(u=0; u<space->extent.rank; u++) {
+ /* contiguous hyperslabs have the block size equal to the stride */
+ if(stride[u]==block[u]) {
+ int_count[u]=1;
+ int_stride[u]=1;
+ if(block[u]==1)
+ int_block[u]=count[u];
+ else
+ int_block[u]=block[u]*count[u];
} /* end if */
+ else {
+ if(count[u]==1)
+ int_stride[u]=1;
+ else {
+ HDassert(stride[u] > block[u]);
+ int_stride[u]=stride[u];
+ } /* end else */
+ int_count[u]=count[u];
+ int_block[u]=block[u];
+ } /* end else */
} /* end for */
+ } /* end else */
- if(!overlapped) {
- H5S_hyper_span_info_t *new_spans = NULL;
- H5S_hyper_dim_t new_hyper_diminfo[H5S_MAX_RANK];
+ /* Fixup operation for non-hyperslab selections */
+ switch(H5S_GET_SELECT_TYPE(space)) {
+ case H5S_SEL_NONE: /* No elements selected in dataspace */
+ switch(op) {
+ case H5S_SELECT_SET: /* Select "set" operation */
+ /* Change "none" selection to hyperslab selection */
+ break;
- if(NULL == ((*new_space) = H5S_copy(old_space, TRUE, TRUE)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to copy dataspace")
- if(NULL != (*new_space)->select.sel_info.hslab->span_lst) {
- old_space->select.sel_info.hslab->span_lst->count--;
- (*new_space)->select.sel_info.hslab->span_lst = NULL;
- } /* end if */
+ case H5S_SELECT_OR: /* Binary "or" operation for hyperslabs */
+ case H5S_SELECT_XOR: /* Binary "xor" operation for hyperslabs */
+ case H5S_SELECT_NOTA: /* Binary "B not A" operation for hyperslabs */
+ op=H5S_SELECT_SET; /* Maps to "set" operation when applied to "none" selection */
+ break;
+
+ case H5S_SELECT_AND: /* Binary "and" operation for hyperslabs */
+ case H5S_SELECT_NOTB: /* Binary "A not B" operation for hyperslabs */
+ HGOTO_DONE(SUCCEED); /* Selection stays "none" */
+
+ default:
+ HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
+ } /* end switch */
+ break;
- /* Generate hyperslab info for new space */
+ case H5S_SEL_ALL: /* All elements selected in dataspace */
switch(op) {
- case H5S_SELECT_OR:
- case H5S_SELECT_XOR:
- /* Add the new space to the space */
- if(NULL == (new_spans = H5S_hyper_make_spans(old_space->extent.rank, start, stride, count, block)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't create hyperslab information")
- if(NULL != old_space->select.sel_info.hslab->span_lst)
- (*new_space)->select.sel_info.hslab->span_lst = H5S_hyper_copy_span(old_space->select.sel_info.hslab->span_lst);
- if(H5S_hyper_add_disjoint_spans(*new_space, new_spans) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't append hyperslabs")
+ case H5S_SELECT_SET: /* Select "set" operation */
+ /* Change "all" selection to hyperslab selection */
break;
- case H5S_SELECT_AND:
- if(H5S_select_none((*new_space)) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't convert selection")
- HGOTO_DONE(SUCCEED);
+ case H5S_SELECT_OR: /* Binary "or" operation for hyperslabs */
+ HGOTO_DONE(SUCCEED); /* Selection stays "all" */
- case H5S_SELECT_NOTB:
- if(old_space->select.sel_info.hslab->span_lst != NULL)
- (*new_space)->select.sel_info.hslab->span_lst = H5S_hyper_copy_span(old_space->select.sel_info.hslab->span_lst);
- else {
- if(H5S_select_none((*new_space)) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't convert selection")
- HGOTO_DONE(SUCCEED);
- } /* end else */
+ case H5S_SELECT_AND: /* Binary "and" operation for hyperslabs */
+ op=H5S_SELECT_SET; /* Maps to "set" operation when applied to "none" selection */
break;
- case H5S_SELECT_NOTA:
- if(NULL == (new_spans = H5S_hyper_make_spans(old_space->extent.rank, start, stride, count, block)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't create hyperslab information")
- (*new_space)->select.sel_info.hslab->span_lst = new_spans;
- (*new_space)->select.num_elem = H5S_hyper_spans_nelem(new_spans);
+ case H5S_SELECT_XOR: /* Binary "xor" operation for hyperslabs */
+ case H5S_SELECT_NOTB: /* Binary "A not B" operation for hyperslabs */
+ /* Convert current "all" selection to "real" hyperslab selection */
+ /* Then allow operation to proceed */
+ {
+ hsize_t tmp_start[H5O_LAYOUT_NDIMS]; /* Temporary start information */
+ hsize_t tmp_stride[H5O_LAYOUT_NDIMS]; /* Temporary stride information */
+ hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary count information */
+ hsize_t tmp_block[H5O_LAYOUT_NDIMS]; /* Temporary block information */
+
+ /* Fill in temporary information for the dimensions */
+ for(u=0; u<space->extent.rank; u++) {
+ tmp_start[u]=0;
+ tmp_stride[u]=1;
+ tmp_count[u]=1;
+ tmp_block[u]=space->extent.size[u];
+ } /* end for */
+
+ /* Convert to hyperslab selection */
+ if(H5S_select_hyperslab(space,H5S_SELECT_SET,tmp_start,tmp_stride,tmp_count,tmp_block)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection")
+ } /* end case */
break;
- case H5S_SELECT_NOOP:
- case H5S_SELECT_SET:
- case H5S_SELECT_APPEND:
- case H5S_SELECT_PREPEND:
- case H5S_SELECT_INVALID:
+ case H5S_SELECT_NOTA: /* Binary "B not A" operation for hyperslabs */
+ /* Convert to "none" selection */
+ if(H5S_select_none(space)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection")
+ HGOTO_DONE(SUCCEED);
+
default:
HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
} /* end switch */
+ break;
- /* Update bound box */
- if(H5S_hyper_update_bound_box(*new_space, op, new_low_bound, new_high_bound)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't update the bound box")
+ case H5S_SEL_HYPERSLABS:
+ /* Hyperslab operation on hyperslab selection, OK */
+ break;
- /* Build diminfo struct */
- for(u = 0; u < (*new_space)->extent.rank; u++) {
- new_hyper_diminfo[u].start = start[u];
- new_hyper_diminfo[u].stride = stride[u];
- new_hyper_diminfo[u].count = count[u];
- new_hyper_diminfo[u].block = block[u];
- } /* end for */
+ case H5S_SEL_POINTS: /* Can't combine hyperslab operations and point selections currently */
+ if(op==H5S_SELECT_SET) /* Allow only "set" operation to proceed */
+ break;
+ /* Else fall through to error */
- /* Update space's dim info */
- if(H5S_hyper_update_diminfo(*new_space, op, new_hyper_diminfo) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't update hyperslab info")
+ default:
+ HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
+ } /* end switch */
- HGOTO_DONE(SUCCEED);
- } /* end if(!overlapped) */
- } /* end if the selection of old space is H5S_SEL_HYPERSLABS*/
- /* Copy the first dataspace with sharing the list of spans */
- if(NULL == ((*new_space) = H5S_copy(old_space, FALSE, TRUE)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to copy dataspace")
+ if(op==H5S_SELECT_SET) {
+ /* If we are setting a new selection, remove current selection first */
+ if(H5S_SELECT_RELEASE(space)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release hyperslab")
- /* Note: a little overhead in calling the function as some conditions are checked again */
- if(H5S_select_hyperslab(*new_space, op, start, stride, count, block) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to set hyperslab selection")
+ /* Allocate space for the hyperslab selection information */
+ if((space->select.sel_info.hslab=H5FL_MALLOC(H5S_hyper_sel_t))==NULL)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab info")
+
+ /* Save the diminfo */
+ space->select.num_elem=1;
+ for(u=0; u<space->extent.rank; u++) {
+ space->select.sel_info.hslab->app_diminfo[u].start = start[u];
+ space->select.sel_info.hslab->app_diminfo[u].stride = stride[u];
+ space->select.sel_info.hslab->app_diminfo[u].count = count[u];
+ space->select.sel_info.hslab->app_diminfo[u].block = block[u];
+
+ space->select.sel_info.hslab->opt_diminfo[u].start = start[u];
+ space->select.sel_info.hslab->opt_diminfo[u].stride = opt_stride[u];
+ space->select.sel_info.hslab->opt_diminfo[u].count = opt_count[u];
+ space->select.sel_info.hslab->opt_diminfo[u].block = opt_block[u];
+
+ space->select.num_elem*=(opt_count[u]*opt_block[u]);
+ } /* end for */
+
+ /* Indicate that the dimension information is valid */
+ space->select.sel_info.hslab->diminfo_valid=TRUE;
+
+ /* Indicate that there's no slab information */
+ space->select.sel_info.hslab->span_lst=NULL;
+ } /* end if */
+ else if(op>=H5S_SELECT_OR && op<=H5S_SELECT_NOTA) {
+ /* Sanity check */
+ HDassert(H5S_GET_SELECT_TYPE(space) == H5S_SEL_HYPERSLABS);
+
+ /* Check if there's no hyperslab span information currently */
+ if(space->select.sel_info.hslab->span_lst==NULL)
+ if(H5S_hyper_generate_spans(space)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree")
+
+ /* Add in the new hyperslab information */
+ if(H5S_generate_hyperslab (space, op, start, opt_stride, opt_count, opt_block)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't generate hyperslabs")
+
+ /* Indicate that the regular dimensions are no longer valid */
+ space->select.sel_info.hslab->diminfo_valid=FALSE;
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
+
+ /* Set selection type */
+ space->select.type=H5S_sel_hyper;
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_fill_in_hyperslab() */
+} /* end H5S_select_hyperslab() */
-/*-------------------------------------------------------------------------
- * Function: H5S_fill_in_select
- *
- * Purpose: Combines two hyperslabs with an operation, putting the
- * result into a third hyperslab selection
- *
- * Return: non-negative on success/NULL on failure
- *
- * Programmer: Chao Mei
- * Tuesday, July 5, 2011
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5S_fill_in_select(H5S_t *space1, H5S_seloper_t op, H5S_t *space2, H5S_t **result)
+/*--------------------------------------------------------------------------
+ NAME
+ H5Sselect_hyperslab
+ PURPOSE
+ Specify a hyperslab to combine with the current hyperslab selection
+ USAGE
+ herr_t H5Sselect_hyperslab(dsid, op, start, stride, count, block)
+ hid_t dsid; IN: Dataspace ID of selection to modify
+ H5S_seloper_t op; IN: Operation to perform on current selection
+ const hsize_t *start; IN: Offset of start of hyperslab
+ const hsize_t *stride; IN: Hyperslab stride
+ const hsize_t *count; IN: Number of blocks included in hyperslab
+ const hsize_t *block; IN: Size of block in hyperslab
+ RETURNS
+ Non-negative on success/Negative on failure
+ DESCRIPTION
+ Combines a hyperslab selection with the current selection for a dataspace.
+ If the current selection is not a hyperslab, it is freed and the hyperslab
+ parameters passed in are combined with the H5S_SEL_ALL hyperslab (ie. a
+ selection composing the entire current extent). If STRIDE or BLOCK is
+ NULL, they are assumed to be set to all '1'.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+herr_t
+H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[],
+ const hsize_t stride[], const hsize_t count[], const hsize_t block[])
{
- hbool_t span2_owned;
- hbool_t updated_spans;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5S_t *space = NULL; /* Dataspace to modify selection of */
+ herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_API(FAIL)
+ H5TRACE6("e", "iSs*h*h*h*h", space_id, op, start, stride, count, block);
- /* Sanity check */
- HDassert(space1);
- HDassert(space2);
- HDassert(op >= H5S_SELECT_OR && op <= H5S_SELECT_NOTA);
- HDassert(space1->extent.rank == space2->extent.rank);
- /* The result is either a to-be-created space or an empty one */
- HDassert(NULL == *result || *result == space1);
- HDassert(space1->select.sel_info.hslab->span_lst);
- HDassert(space2->select.sel_info.hslab->span_lst);
-
- /* Note: the offset of space2 is not considered here for bounding box */
- if(H5S_fill_in_new_space(space1, op, space2->select.sel_info.hslab->span_lst, space2->select.low_bounds, space2->select.high_bounds, FALSE, &span2_owned, &updated_spans, result) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't create the specified selection")
-
- /* Update diminfo if space2's diminfo was valid, otherwise just mark it as
- * invalid if the spans were updated */
- HDassert(result);
- if(updated_spans) {
- if(space2->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
- if(H5S_hyper_update_diminfo(*result, op, space2->select.sel_info.hslab->opt_diminfo) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't update hyperslab info")
- } /* end if */
- else
- (*result)->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_NO;
+ /* Check args */
+ if (NULL == (space=H5I_object_verify(space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
+ if (H5S_SCALAR==H5S_GET_EXTENT_TYPE(space))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hyperslab doesn't support H5S_SCALAR space")
+ if (H5S_NULL==H5S_GET_EXTENT_TYPE(space))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hyperslab doesn't support H5S_NULL space")
+ if(start==NULL || count==NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hyperslab not specified")
+ if(!(op>H5S_SELECT_NOOP && op<H5S_SELECT_INVALID))
+ HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
+ if(stride!=NULL) {
+ unsigned u; /* Local index variable */
+
+ /* Check for 0-sized strides */
+ for(u=0; u<space->extent.rank; u++) {
+ if(stride[u]==0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid stride==0 value")
+ } /* end for */
} /* end if */
+ if (H5S_select_hyperslab(space, op, start, stride, count, block)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to set hyperslab selection")
+
done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_fill_in_select() */
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Sselect_hyperslab() */
/*--------------------------------------------------------------------------
@@ -7677,33 +7243,38 @@ done:
--------------------------------------------------------------------------*/
hid_t
H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[],
- const hsize_t stride[], const hsize_t count[], const hsize_t block[])
+ const hsize_t stride[], const hsize_t count[], const hsize_t block[])
{
- H5S_t *space; /* Dataspace to modify selection of */
- H5S_t *new_space = NULL; /* New dataspace created */
- hid_t ret_value; /* Return value */
+ H5S_t *space = NULL; /* Dataspace to modify selection of */
+ H5S_t *new_space = NULL; /* New dataspace created */
+ hid_t ret_value;
FUNC_ENTER_API(FAIL)
H5TRACE6("i", "iSs*h*h*h*h", space_id, op, start, stride, count, block);
/* Check args */
- if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
- if(start == NULL || count == NULL)
+ if (NULL == (space=H5I_object_verify(space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
+ if(start==NULL || count==NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hyperslab not specified")
- if(!(op >= H5S_SELECT_SET && op <= H5S_SELECT_NOTA))
+
+ if(!(op>H5S_SELECT_NOOP && op<H5S_SELECT_INVALID))
HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
- /* Generate new space, with combination of selections */
- if(H5S_fill_in_hyperslab(space, op, start, stride, count, block, &new_space) < 0)
+ /* Copy the first dataspace */
+ if (NULL == (new_space = H5S_copy (space, TRUE, TRUE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "unable to copy data space")
+
+ /* Go modify the selection in the new dataspace */
+ if (H5S_select_hyperslab(new_space, op, start, stride, count, block)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to set hyperslab selection")
/* Atomize */
- if((ret_value = H5I_register(H5I_DATASPACE, new_space, TRUE)) < 0)
+ if ((ret_value=H5I_register (H5I_DATASPACE, new_space, TRUE))<0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom")
done:
- if(ret_value < 0 && new_space)
+ if (ret_value<0 && new_space)
H5S_close(new_space);
FUNC_LEAVE_API(ret_value)
@@ -7720,62 +7291,57 @@ done:
* Programmer: Quincey Koziol
* Tuesday, October 30, 2001
*
- * Chao Mei
- * Wednesday, June 29, 2011
+ * Modifications:
*
*-------------------------------------------------------------------------
*/
static H5S_t *
-H5S_combine_select(H5S_t *space1, H5S_seloper_t op, H5S_t *space2)
+H5S_combine_select (H5S_t *space1, H5S_seloper_t op, H5S_t *space2)
{
- H5S_t *new_space = NULL; /* New dataspace generated */
- H5S_t *ret_value = NULL; /* Return value */
+ H5S_t *new_space=NULL; /* New dataspace generated */
+ hbool_t span2_owned=FALSE; /* Flag to indicate that span2 was used in H5S_operate_hyperslab() */
+ H5S_t *ret_value; /* return value */
FUNC_ENTER_NOAPI_NOINIT
/* Check args */
HDassert(space1);
HDassert(space2);
- HDassert(op >= H5S_SELECT_OR && op <= H5S_SELECT_NOTA);
+ HDassert(op > H5S_SELECT_NOOP && op < H5S_SELECT_INVALID);
- /* Check that if space1 selections has span trees */
- if(NULL == space1->select.sel_info.hslab->span_lst)
- if(H5S_hyper_generate_spans(space1) < 0)
+ /* Check that the space selections both have span trees */
+ if(space1->select.sel_info.hslab->span_lst==NULL)
+ if(H5S_hyper_generate_spans(space1)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, NULL, "dataspace does not have span tree")
+ if(space2->select.sel_info.hslab->span_lst==NULL)
+ if(H5S_hyper_generate_spans(space2)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, NULL, "dataspace does not have span tree")
- if(NULL == space2->select.sel_info.hslab->span_lst) {
- hsize_t tmp_start[H5S_MAX_RANK];
- hsize_t tmp_stride[H5S_MAX_RANK];
- hsize_t tmp_count[H5S_MAX_RANK];
- hsize_t tmp_block[H5S_MAX_RANK];
- unsigned u;
-
- for(u = 0; u < space2->extent.rank; u++) {
- tmp_start[u] = space2->select.sel_info.hslab->opt_diminfo[u].start;
- tmp_stride[u] = space2->select.sel_info.hslab->opt_diminfo[u].stride;
- tmp_count[u] = space2->select.sel_info.hslab->opt_diminfo[u].count;
- tmp_block[u] = space2->select.sel_info.hslab->opt_diminfo[u].block;
- } /* end for */
+ /* Copy the first dataspace */
+ if (NULL == (new_space = H5S_copy (space1, TRUE, TRUE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "unable to copy data space")
- /* call H5S_select_hyperslab directly */
- if(H5S_fill_in_hyperslab(space1, op, tmp_start, tmp_stride, tmp_count, tmp_block, &new_space) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "unable to set hyperslab selection")
- } /* end if */
- else{
- /* Combine new_space (a copy of space 1) & space2, with the result in new_space */
- if(H5S_fill_in_select(space1, op, space2, &new_space) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, NULL, "can't clip hyperslab information")
- } /* end else */
+ /* Free the current selection for the new dataspace */
+ if(H5S_SELECT_RELEASE(new_space)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, NULL, "can't release selection")
+
+ /* Allocate space for the hyperslab selection information */
+ if((new_space->select.sel_info.hslab=H5FL_CALLOC(H5S_hyper_sel_t))==NULL)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab info")
+
+ /* Combine space1 & space2, with the result in new_space */
+ if(H5S_operate_hyperslab(new_space,space1->select.sel_info.hslab->span_lst,op,space2->select.sel_info.hslab->span_lst,FALSE,&span2_owned)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, NULL, "can't clip hyperslab information")
/* Set return value */
- ret_value = new_space;
+ ret_value=new_space;
done:
- if(ret_value == NULL && new_space)
+ if(ret_value==NULL && new_space!=NULL)
H5S_close(new_space);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_combine_select() */
+} /* end H5S_combine_select() */
/*--------------------------------------------------------------------------
@@ -7806,47 +7372,37 @@ H5Scombine_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id)
H5S_t *space1; /* First Dataspace */
H5S_t *space2; /* Second Dataspace */
H5S_t *new_space = NULL; /* New Dataspace */
- hid_t ret_value; /* Return value */
+ hid_t ret_value;
FUNC_ENTER_API(FAIL)
H5TRACE3("i", "iSsi", space1_id, op, space2_id);
/* Check args */
- if(NULL == (space1 = (H5S_t *)H5I_object_verify(space1_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
- if(NULL == (space2 = (H5S_t *)H5I_object_verify(space2_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
- if(!(op >= H5S_SELECT_OR && op <= H5S_SELECT_NOTA))
+ if (NULL == (space1=H5I_object_verify(space1_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
+ if (NULL == (space2=H5I_object_verify(space2_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
+ if(!(op>H5S_SELECT_NOOP && op<H5S_SELECT_INVALID))
HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
/* Check that both dataspaces have the same rank */
- if(space1->extent.rank != space2->extent.rank)
+ if(space1->extent.rank!=space2->extent.rank)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspaces not same rank")
- /* Note: currently, the offset of each dataspace is ignored */
-#if 0
- /* Check that both dataspaces have the same offset */
- /* Same note as in H5Smodify_select */
- for(u=0; u<space1->extent.rank; u++) {
- if(space1->select.offset[u] != space2->select.offset[u])
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspaces not same offset")
- } /* end for */
-#endif
-
/* Check that both dataspaces have hyperslab selections */
- if(H5S_GET_SELECT_TYPE(space1) != H5S_SEL_HYPERSLABS || H5S_GET_SELECT_TYPE(space2) != H5S_SEL_HYPERSLABS)
+ if(H5S_GET_SELECT_TYPE(space1)!=H5S_SEL_HYPERSLABS || H5S_GET_SELECT_TYPE(space2)!=H5S_SEL_HYPERSLABS)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspaces don't have hyperslab selections")
/* Go combine the dataspaces */
- if(NULL == (new_space = H5S_combine_select(space1, op, space2)))
+ if ((new_space=H5S_combine_select(space1, op, space2))==NULL)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to create hyperslab selection")
/* Atomize */
- if((ret_value = H5I_register(H5I_DATASPACE, new_space, TRUE)) < 0)
+ if ((ret_value=H5I_register (H5I_DATASPACE, new_space, TRUE))<0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom")
done:
- if(ret_value < 0 && new_space)
+ if (ret_value<0 && new_space)
H5S_close(new_space);
FUNC_LEAVE_API(ret_value)
@@ -7854,74 +7410,74 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5S_modify_select
+ * Function: H5S_select_select
*
- * Purpose: Internal version of H5Smodify_select().
+ * Purpose: Internal version of H5Sselect_select().
*
* Return: New dataspace on success/NULL on failure
*
* Programmer: Quincey Koziol
* Tuesday, October 30, 2001
*
- * Chao Mei
- * Wednesday, June 29, 2011
+ * Modifications:
*
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_modify_select(H5S_t *space1, H5S_seloper_t op, H5S_t *space2)
+H5S_select_select (H5S_t *space1, H5S_seloper_t op, H5S_t *space2)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ H5S_hyper_span_info_t *tmp_spans=NULL; /* Temporary copy of selection */
+ hbool_t span2_owned=FALSE; /* Flag to indicate that span2 was used in H5S_operate_hyperslab() */
+ herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Check args */
HDassert(space1);
HDassert(space2);
- HDassert(op >= H5S_SELECT_OR && op <= H5S_SELECT_NOTA);
+ HDassert(op > H5S_SELECT_NOOP && op < H5S_SELECT_INVALID);
/* Check that the space selections both have span trees */
- if(NULL == space1->select.sel_info.hslab->span_lst)
- if(H5S_hyper_generate_spans(space1) < 0)
+ if(space1->select.sel_info.hslab->span_lst==NULL)
+ if(H5S_hyper_generate_spans(space1)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree")
+ if(space2->select.sel_info.hslab->span_lst==NULL)
+ if(H5S_hyper_generate_spans(space2)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree")
- if(NULL == space2->select.sel_info.hslab->span_lst) {
- hsize_t tmp_start[H5S_MAX_RANK];
- hsize_t tmp_stride[H5S_MAX_RANK];
- hsize_t tmp_count[H5S_MAX_RANK];
- hsize_t tmp_block[H5S_MAX_RANK];
- unsigned u;
-
- for(u = 0; u < space2->extent.rank; u++) {
- tmp_start[u] = space2->select.sel_info.hslab->opt_diminfo[u].start;
- tmp_stride[u] = space2->select.sel_info.hslab->opt_diminfo[u].stride;
- tmp_count[u] = space2->select.sel_info.hslab->opt_diminfo[u].count;
- tmp_block[u] = space2->select.sel_info.hslab->opt_diminfo[u].block;
- } /* end for */
+ /* Take ownership of the dataspace's hyperslab spans */
+ /* (These are freed later) */
+ tmp_spans=space1->select.sel_info.hslab->span_lst;
+ space1->select.sel_info.hslab->span_lst=NULL;
- /* Call H5S_select_hyperslab directly */
- if(H5S_select_hyperslab(space1, op, tmp_start, tmp_stride, tmp_count, tmp_block) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to set hyperslab selection")
- } /* end if */
- else {
- /* Combine spans from space1 & spans from space2, with the result in space1 */
- if(H5S_fill_in_select(space1, op, space2, &space1) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't perform operation on two selections")
- } /* end else*/
+ /* Reset the other dataspace selection information */
+ if(H5S_SELECT_RELEASE(space1)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection")
+
+ /* Allocate space for the hyperslab selection information */
+ if((space1->select.sel_info.hslab=H5FL_CALLOC(H5S_hyper_sel_t))==NULL)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab info")
+
+ /* Combine tmp_spans (from space1) & spans from space2, with the result in space1 */
+ if(H5S_operate_hyperslab(space1,tmp_spans,op,space2->select.sel_info.hslab->span_lst,FALSE,&span2_owned)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information")
done:
+ if(tmp_spans!=NULL)
+ H5S_hyper_free_span_info(tmp_spans);
+
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_modify_select() */
+} /* end H5S_select_select() */
/*--------------------------------------------------------------------------
NAME
- H5Smodify_select
+ H5Sselect_select
PURPOSE
Refine a hyperslab selection with an operation using a second hyperslab
- to modify it
+ to modify it.
USAGE
- herr_t H5Smodify_select(space1, op, space2)
+ herr_t H5Sselect_select(space1, op, space2)
hid_t space1; IN/OUT: First Dataspace ID
H5S_seloper_t op; IN: Selection operation
hid_t space2; IN: Second Dataspace ID
@@ -7937,63 +7493,39 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5Smodify_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id)
+H5Sselect_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id)
{
H5S_t *space1; /* First Dataspace */
H5S_t *space2; /* Second Dataspace */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "iSsi", space1_id, op, space2_id);
/* Check args */
- if(NULL == (space1 = (H5S_t *)H5I_object_verify(space1_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
- if(NULL == (space2 = (H5S_t *)H5I_object_verify(space2_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
- if(!(op >= H5S_SELECT_OR && op <= H5S_SELECT_NOTA))
+ if (NULL == (space1=H5I_object_verify(space1_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
+ if (NULL == (space2=H5I_object_verify(space2_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
+ if(!(op>H5S_SELECT_NOOP && op<H5S_SELECT_INVALID))
HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
/* Check that both dataspaces have the same rank */
- if(space1->extent.rank != space2->extent.rank)
+ if(space1->extent.rank!=space2->extent.rank)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspaces not same rank")
- /* Check that both dataspaces have the same offset */
- /** Note that this is a tricky part of this function. It's
- * possible that two dataspaces have different "offset". If the
- * space2 has smaller offset value than that of space1 in a
- * dimension, then the span elements of this dimension in
- * space2 could have negative "low" and "high" values relative
- * to the offset in space1. In other words, if the bounds of
- * span elements in space2 are adjusted relative to the offset
- * in space1, then every span element's bound is computed as
- * "origin_bound+offset2-offset1". Therefore, if offset2 (the
- * offset of space2) is smaller, then
- * "origin_bound+offset2-offset1" could be negative which is
- * not allowed by the bound type declaration as hsize_t!
- * As a result, if the op is an OR selection, then the final
- * result may contain span elements that have negative bound!
- * So right now, the difference in the offset is totally
- * ignored!!
- */
-#if 0
- for(u=0; u<space1->extent.rank; u++) {
- if(space1->select.offset[u] != space2->select.offset[u])
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspaces not same offset")
- } /* end for */
-#endif
-
/* Check that both dataspaces have hyperslab selections */
- if(H5S_GET_SELECT_TYPE(space1) != H5S_SEL_HYPERSLABS || H5S_GET_SELECT_TYPE(space2) != H5S_SEL_HYPERSLABS)
+ if(H5S_GET_SELECT_TYPE(space1)!=H5S_SEL_HYPERSLABS || H5S_GET_SELECT_TYPE(space2)!=H5S_SEL_HYPERSLABS)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspaces don't have hyperslab selections")
/* Go refine the first selection */
- if(H5S_modify_select(space1, op, space2) < 0)
+ if (H5S_select_select(space1, op, space2)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to modify hyperslab selection")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Smodify_select() */
+} /* end H5Sselect_select() */
+#endif /* NEW_HYPERSLAB_API */ /* Works */
/*--------------------------------------------------------------------------
@@ -8027,7 +7559,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_hyper_get_seq_list_gen(const H5S_t *space, H5S_sel_iter_t *iter,
+H5S_hyper_get_seq_list_gen(const H5S_t *space,H5S_sel_iter_t *iter,
size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem,
hsize_t *off, size_t *len)
{
@@ -9199,14 +8731,8 @@ H5S_hyper_get_seq_list(const H5S_t *space, unsigned UNUSED flags, H5S_sel_iter_t
HDassert(off);
HDassert(len);
- /* Rebuild diminfo if it is invalid and has not been confirmed to be
- * impossible */
- if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_NO)
- /* Casting away const OK -NAF */
- (void)H5S_hyper_rebuild((H5S_t *)space);
-
/* Check for the special case of just one H5Sselect_hyperslab call made */
- if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
+ if(space->select.sel_info.hslab->diminfo_valid) {
const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
const hssize_t *sel_off; /* Selection offset in dataspace */
hsize_t *mem_size; /* Size of the source buffer */
diff --git a/src/H5Smpio.c b/src/H5Smpio.c
index 8a2bd27..9a1b5a6 100644
--- a/src/H5Smpio.c
+++ b/src/H5Smpio.c
@@ -1081,7 +1081,7 @@ H5S_mpio_space_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type
case H5S_NO_CLASS:
default:
- HDassert("unknown dataspace type" && 0);
+ HDassert("unknown data space type" && 0);
break;
} /* end switch */
diff --git a/src/H5Snone.c b/src/H5Snone.c
index c381656..3c5eccc 100644
--- a/src/H5Snone.c
+++ b/src/H5Snone.c
@@ -17,7 +17,7 @@
* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
* Tuesday, November 10, 1998
*
- * Purpose: "None" selection dataspace I/O functions.
+ * Purpose: "None" selection data space I/O functions.
*/
#define H5S_PACKAGE /*suppress error about including H5Spkg */
@@ -850,7 +850,7 @@ H5Sselect_none(hid_t spaceid)
/* Check args */
if(NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
/* Change to "none" selection */
if(H5S_select_none(space) < 0)
diff --git a/src/H5Spkg.h b/src/H5Spkg.h
index d76d7ca..0a9df69 100644
--- a/src/H5Spkg.h
+++ b/src/H5Spkg.h
@@ -77,7 +77,6 @@ struct H5S_pnt_node_t {
/* Information about point selection list */
typedef struct {
H5S_pnt_node_t *head; /* Pointer to head of point list */
- H5S_pnt_node_t *tail; /* Pointer to tail of point list */
} H5S_pnt_list_t;
/* Information about new-style hyperslab spans */
@@ -91,7 +90,7 @@ struct H5S_hyper_span_t {
struct H5S_hyper_span_t *next; /* Pointer to next span in list */
};
-/* Information about a list of hyperslab spans in one dimension */
+/* Information about a list of hyperslab spans */
struct H5S_hyper_span_info_t {
unsigned count; /* Ref. count of number of spans which share this span */
struct H5S_hyper_span_info_t *scratch; /* Scratch pointer
@@ -100,20 +99,12 @@ struct H5S_hyper_span_info_t {
* to point to the last span in a
* list during single element adds)
*/
- struct H5S_hyper_span_t *head; /* Pointer to the first span of list of spans in the current dimension */
- struct H5S_hyper_span_t *tail; /* Pointer to the last span of list of spans in the current dimension */
+ struct H5S_hyper_span_t *head; /* Pointer to list of spans in next dimension down */
};
-/* Enum for diminfo_valid field in H5S_hyper_sel_t */
-typedef enum {
- H5S_DIMINFO_VALID_IMPOSSIBLE, /* 0: diminfo is not valid and can never be valid with the current selection */
- H5S_DIMINFO_VALID_NO, /* 1: diminfo is not valid but may or may not be possible to constuct */
- H5S_DIMINFO_VALID_YES /* 2: diminfo is valid */
-} H5S_diminfo_valid_t;
-
/* Information about new-style hyperslab selection */
typedef struct {
- H5S_diminfo_valid_t diminfo_valid; /* Whether the dataset has valid diminfo */
+ hbool_t diminfo_valid; /* Whether the dataset has valid diminfo */
H5S_hyper_dim_t opt_diminfo[H5S_MAX_RANK]; /* per-dim selection info */
H5S_hyper_dim_t app_diminfo[H5S_MAX_RANK]; /* per-dim selection info */
/* 'opt_diminfo' points to a [potentially] optimized version of the user's
@@ -122,7 +113,7 @@ typedef struct {
* are only used for re-gurgitating the original values used to set the
* hyperslab to the application when it queries the hyperslab selection
* information. */
- H5S_hyper_span_info_t *span_lst; /* List of hyperslab span information of all dimensions */
+ H5S_hyper_span_info_t *span_lst; /* List of hyperslab span information */
} H5S_hyper_sel_t;
/* Selection information methods */
@@ -189,12 +180,7 @@ typedef struct {
const H5S_select_class_t *type; /* Pointer to selection's class info */
hbool_t offset_changed; /* Indicate that the offset for the selection has been changed */
hssize_t offset[H5S_MAX_RANK]; /* Offset within the extent */
- hsize_t num_elem; /* Number of elements in selection */
-
- /* The following two fields defines the bounding box of the whole selection relative to the offset */
- hsize_t low_bounds[H5S_MAX_RANK]; /* The smallest offset in each dimension */
- hsize_t high_bounds[H5S_MAX_RANK]; /* The largest offset in each dimension */
-
+ hsize_t num_elem; /* Number of elements in selection */
union {
H5S_pnt_list_t *pnt_lst; /* List of selected points (order is important) */
H5S_hyper_sel_t *hslab; /* Info about hyperslab selections */
@@ -263,16 +249,11 @@ H5_DLL herr_t H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src,
hbool_t copy_max);
/* Operations on selections */
-H5_DLL htri_t H5S_hyper_rebuild(H5S_t *space);
/* Testing functions */
#ifdef H5S_TESTING
H5_DLL htri_t H5S_select_shape_same_test(hid_t sid1, hid_t sid2);
-H5_DLL herr_t H5S_get_rebuild_status_test(hid_t space_id,
- H5S_diminfo_valid_t *status1, H5S_diminfo_valid_t *status2);
-H5_DLL herr_t H5S_get_diminfo_status_test(hid_t space_id,
- H5S_diminfo_valid_t *status);
-H5_DLL htri_t H5S_internal_consistency_test(hid_t space_id);
+H5_DLL htri_t H5S_get_rebuild_status_test(hid_t space_id);
#endif /* H5S_TESTING */
#endif /*_H5Spkg_H*/
diff --git a/src/H5Spoint.c b/src/H5Spoint.c
index d6b26fa..70842df 100644
--- a/src/H5Spoint.c
+++ b/src/H5Spoint.c
@@ -17,7 +17,7 @@
* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
* Tuesday, June 16, 1998
*
- * Purpose: Point selection dataspace I/O functions.
+ * Purpose: Point selection data space I/O functions.
*/
#define H5S_PACKAGE /*suppress error about including H5Spkg */
@@ -400,8 +400,6 @@ H5S_point_add(H5S_t *space, H5S_seloper_t op, size_t num_elem, const hsize_t *co
HDassert(op == H5S_SELECT_SET || op == H5S_SELECT_APPEND || op == H5S_SELECT_PREPEND);
for(u = 0; u < num_elem; u++) {
- unsigned dim; /* Counter for dimensions */
-
/* Allocate space for the new node */
if(NULL == (new_node = H5FL_MALLOC(H5S_pnt_node_t)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate point node")
@@ -420,45 +418,31 @@ H5S_point_add(H5S_t *space, H5S_seloper_t op, size_t num_elem, const hsize_t *co
else
curr->next = new_node;
curr = new_node;
-
- /**
- * Note: when op is H5S_SELECT_SET, the bound box has been reset
- * inside H5S_select_elements, the only caller of this function.
- * So the following bound box update procedure works correctly
- * for the SET operation.
- */
- /* update bound box */
- for(dim = 0; dim < space->extent.rank; dim++) {
- space->select.low_bounds[dim] = MIN(space->select.low_bounds[dim], curr->pnt[dim]);
- space->select.high_bounds[dim] = MAX(space->select.high_bounds[dim], curr->pnt[dim]);
- } /* end for */
} /* end for */
new_node = NULL;
/* Insert the list of points selected in the proper place */
if(op == H5S_SELECT_SET || op == H5S_SELECT_PREPEND) {
/* Append current list, if there is one */
- if(NULL != space->select.sel_info.pnt_lst->head)
+ if(space->select.sel_info.pnt_lst->head != NULL)
curr->next = space->select.sel_info.pnt_lst->head;
/* Put new list in point selection */
space->select.sel_info.pnt_lst->head = top;
-
- /* Change the tail pointer if tail has not been set */
- if(NULL == space->select.sel_info.pnt_lst->tail)
- space->select.sel_info.pnt_lst->tail = curr;
} /* end if */
else { /* op==H5S_SELECT_APPEND */
H5S_pnt_node_t *tmp_node; /* Temporary point selection node */
tmp_node = space->select.sel_info.pnt_lst->head;
if(tmp_node != NULL) {
- HDassert(space->select.sel_info.pnt_lst->tail);
- space->select.sel_info.pnt_lst->tail->next = top;
+ while(tmp_node->next != NULL)
+ tmp_node = tmp_node->next;
+
+ /* Append new list to point selection */
+ tmp_node->next = top;
} /* end if */
else
space->select.sel_info.pnt_lst->head = top;
- space->select.sel_info.pnt_lst->tail = curr;
} /* end else */
/* Set the number of elements in the new selection */
@@ -582,17 +566,10 @@ H5S_select_elements(H5S_t *space, H5S_seloper_t op, size_t num_elem,
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release point selection")
/* Allocate space for the point selection information if necessary */
- if(H5S_GET_SELECT_TYPE(space) != H5S_SEL_POINTS || space->select.sel_info.pnt_lst == NULL) {
- hsize_t tmp = HSIZET_MAX;
-
+ if(H5S_GET_SELECT_TYPE(space) != H5S_SEL_POINTS || space->select.sel_info.pnt_lst == NULL)
if(NULL == (space->select.sel_info.pnt_lst = H5FL_CALLOC(H5S_pnt_list_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate element information")
- /* Set the bound box to the default value */
- H5VM_array_fill(space->select.low_bounds, &tmp, sizeof(hsize_t), space->extent.rank);
- HDmemset(space->select.high_bounds, 0, sizeof(hsize_t) * space->extent.rank);
- } /* end if */
-
/* Add points to selection */
if(H5S_point_add(space, op, num_elem, coord) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert elements")
@@ -664,7 +641,6 @@ H5S_point_copy(H5S_t *dst, const H5S_t *src, hbool_t UNUSED share_selection)
curr = curr->next;
} /* end while */
- dst->select.sel_info.pnt_lst->tail = new_tail;
done:
if(ret_value < 0 && dst->select.sel_info.pnt_lst) {
@@ -708,21 +684,28 @@ done:
static htri_t
H5S_point_is_valid (const H5S_t *space)
{
- unsigned u; /* Counter */
- htri_t ret_value = TRUE; /* Return value */
+ H5S_pnt_node_t *curr; /* Point information nodes */
+ unsigned u; /* Counter */
+ htri_t ret_value=TRUE; /* return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
HDassert(space);
- /* Check each dimension */
- for(u = 0; u < space->extent.rank; u++) {
- /* Bounds check the selected point + offset against the extent */
- if((space->select.high_bounds[u] + (hsize_t)space->select.offset[u]) > space->extent.size[u])
- HGOTO_DONE(FALSE)
- if(((hssize_t)space->select.low_bounds[u] + space->select.offset[u]) < 0)
- HGOTO_DONE(FALSE)
- } /* end for */
+ /* Check each point to determine whether selection+offset is within extent */
+ curr = space->select.sel_info.pnt_lst->head;
+ while(curr != NULL) {
+ /* Check each dimension */
+ for(u = 0; u < space->extent.rank; u++) {
+ /* Check if an offset has been defined */
+ /* Bounds check the selected point + offset against the extent */
+ if(((curr->pnt[u] + (hsize_t)space->select.offset[u]) > space->extent.size[u])
+ || (((hssize_t)curr->pnt[u] + space->select.offset[u]) < 0))
+ HGOTO_DONE(FALSE)
+ } /* end for */
+
+ curr = curr->next;
+ } /* end while */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -757,7 +740,7 @@ H5Sget_select_elem_npoints(hid_t spaceid)
/* Check args */
if(NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
if(H5S_GET_SELECT_TYPE(space) != H5S_SEL_POINTS)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an element selection")
@@ -790,6 +773,7 @@ done:
static hssize_t
H5S_point_serial_size (const H5S_t *space)
{
+ H5S_pnt_node_t *curr; /* Point information nodes */
hssize_t ret_value; /* return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -800,11 +784,15 @@ H5S_point_serial_size (const H5S_t *space)
* <type (4 bytes)> + <version (4 bytes)> + <padding (4 bytes)> +
* <length (4 bytes)> + <rank (4 bytes)> + <# of points (4 bytes)> = 24 bytes
*/
- ret_value = 24;
+ ret_value=24;
/* Count points in selection */
- /* (Add 4 bytes times the rank for each element selected) */
- ret_value += (4 * space->extent.rank) * (hssize_t)H5S_GET_SELECT_NPOINTS(space);
+ curr=space->select.sel_info.pnt_lst->head;
+ while(curr!=NULL) {
+ /* Add 4 bytes times the rank for each element selected */
+ ret_value+=4*space->extent.rank;
+ curr=curr->next;
+ } /* end while */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_point_serial_size() */
@@ -1047,7 +1035,7 @@ H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t startpoint,
if(NULL == buf)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pointer")
if(NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
if(H5S_GET_SELECT_TYPE(space) != H5S_SEL_POINTS)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a point selection")
@@ -1087,30 +1075,42 @@ done:
static herr_t
H5S_point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
{
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5S_pnt_node_t *node; /* Point node */
+ unsigned rank; /* Dataspace rank */
+ unsigned u; /* index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
- /* Sanity check */
HDassert(space);
HDassert(start);
HDassert(end);
- /* Loop over dimensions */
- for(u = 0; u < space->extent.rank; u++) {
- /* Sanity check */
- HDassert(space->select.low_bounds[u] <= space->select.high_bounds[u]);
-
- /* Check for offset moving selection negative */
- if(((hssize_t)space->select.low_bounds[u] + space->select.offset[u]) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds")
+ /* Get the dataspace extent rank */
+ rank = space->extent.rank;
- /* Set the low & high bounds in this dimension */
- start[u] = (hsize_t)((hssize_t)space->select.low_bounds[u] + space->select.offset[u]);
- end[u] = (hsize_t)((hssize_t)space->select.high_bounds[u] + space->select.offset[u]);
+ /* Set the start and end arrays up */
+ for(u = 0; u < rank; u++) {
+ start[u] = HSIZET_MAX;
+ end[u] = 0;
} /* end for */
+ /* Iterate through the node, checking the bounds on each element */
+ node = space->select.sel_info.pnt_lst->head;
+ while(node != NULL) {
+ for(u = 0; u < rank; u++) {
+ /* Check for offset moving selection negative */
+ if(((hssize_t)node->pnt[u] + space->select.offset[u]) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds")
+
+ if(start[u] > (node->pnt[u] + space->select.offset[u]))
+ start[u] = node->pnt[u] + space->select.offset[u];
+ if(end[u] < (node->pnt[u] + space->select.offset[u]))
+ end[u] = node->pnt[u] + space->select.offset[u];
+ } /* end for */
+ node = node->next;
+ } /* end while */
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_point_bounds() */
@@ -1321,7 +1321,6 @@ H5S_point_adjust_u(H5S_t *space, const hsize_t *offset)
{
H5S_pnt_node_t *node; /* Point node */
unsigned rank; /* Dataspace rank */
- unsigned u; /* Local index variable */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -1332,6 +1331,8 @@ H5S_point_adjust_u(H5S_t *space, const hsize_t *offset)
node = space->select.sel_info.pnt_lst->head;
rank = space->extent.rank;
while(node) {
+ unsigned u; /* Local index variable */
+
/* Adjust each coordinate for point node */
for(u = 0; u < rank; u++) {
/* Check for offset moving selection negative */
@@ -1345,12 +1346,6 @@ H5S_point_adjust_u(H5S_t *space, const hsize_t *offset)
node = node->next;
} /* end while */
- /* update the bound box of the selection */
- for(u = 0; u < rank; u++) {
- space->select.low_bounds[u] -= offset[u];
- space->select.high_bounds[u] -= offset[u];
- } /* end for */
-
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5S_point_adjust_u() */
@@ -1415,7 +1410,6 @@ H5S_point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *off
H5S_pnt_node_t *new_node; /* Point node in new space */
H5S_pnt_node_t *prev_node; /* Previous point node in new space */
unsigned rank_diff; /* Difference in ranks between spaces */
- unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -1472,12 +1466,6 @@ H5S_point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *off
/* Advance to next node */
base_node = base_node->next;
} /* end while */
-
- /* Update the bounding box */
- for(u = 0; u < new_space->extent.rank; u++) {
- new_space->select.low_bounds[u] = base_space->select.low_bounds[u + rank_diff];
- new_space->select.high_bounds[u] = base_space->select.high_bounds[u + rank_diff];
- } /* end for */
} /* end if */
else {
HDassert(new_space->extent.rank > base_space->extent.rank);
@@ -1516,16 +1504,6 @@ H5S_point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *off
/* Advance to next node */
base_node = base_node->next;
} /* end while */
-
- /* Update the bounding box */
- for(u = 0; u < rank_diff; u++) {
- new_space->select.low_bounds[u] = 0;
- new_space->select.high_bounds[u] = 0;
- } /* end for */
- for(; u < new_space->extent.rank; u++) {
- new_space->select.low_bounds[u] = base_space->select.low_bounds[u - rank_diff];
- new_space->select.high_bounds[u] = base_space->select.high_bounds[u - rank_diff];
- } /* end for */
} /* end else */
/* Number of elements selected will be the same */
@@ -1665,7 +1643,7 @@ H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter,
/* Get the dataspace dimensions */
if((ndims = H5S_get_simple_extent_dims (space, dims, NULL)) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to retrieve dataspace dimensions")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to retrieve data space dimensions")
/* Walk through the points in the selection, starting at the current */
/* location in the iterator */
diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h
index 26b29bd..44cd6c3 100644
--- a/src/H5Sprivate.h
+++ b/src/H5Sprivate.h
@@ -124,6 +124,7 @@ typedef struct H5S_sel_iter_t {
#define H5S_GET_SELECT_TYPE(S) ((S)->select.type->type)
#define H5S_SELECT_GET_SEQ_LIST(S,FLAGS,ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN) ((*(S)->select.type->get_seq_list)(S,FLAGS,ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN))
#define H5S_SELECT_VALID(S) ((*(S)->select.type->is_valid)(S))
+#define H5S_SELECT_RELEASE(S) ((*(S)->select.type->release)(S))
#define H5S_SELECT_SERIAL_SIZE(S) ((*(S)->select.type->serial_size)(S))
#define H5S_SELECT_SERIALIZE(S,BUF) ((*(S)->select.type->serialize)(S,BUF))
#define H5S_SELECT_BOUNDS(S,START,END) ((*(S)->select.type->bounds)(S,START,END))
@@ -149,6 +150,7 @@ typedef struct H5S_sel_iter_t {
#define H5S_GET_SELECT_TYPE(S) (H5S_get_select_type(S))
#define H5S_SELECT_GET_SEQ_LIST(S,FLAGS,ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN) (H5S_select_get_seq_list(S,FLAGS,ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN))
#define H5S_SELECT_VALID(S) (H5S_select_valid(S))
+#define H5S_SELECT_RELEASE(S) (H5S_select_release(S))
#define H5S_SELECT_SERIAL_SIZE(S) (H5S_select_serial_size(S))
#define H5S_SELECT_SERIALIZE(S,BUF) (H5S_select_serialize(S,BUF))
#define H5S_SELECT_BOUNDS(S,START,END) (H5S_get_select_bounds(S,START,END))
@@ -167,9 +169,8 @@ typedef struct H5S_sel_iter_t {
#define H5S_SELECT_ITER_NEXT_BLOCK(ITER) (H5S_select_iter_next_block(ITER))
#define H5S_SELECT_ITER_RELEASE(ITER) (H5S_select_iter_release(ITER))
#endif /* H5S_PACKAGE */
-/* Handle these callbacks in a special way, since they have prologs that need to be executed */
+/* Handle these two callbacks in a special way, since they have prologs that need to be executed */
#define H5S_SELECT_COPY(DST,SRC,SHARE) (H5S_select_copy(DST,SRC,SHARE))
-#define H5S_SELECT_RELEASE(S) (H5S_select_release(S))
#define H5S_SELECT_DESERIALIZE(S,BUF) (H5S_select_deserialize(S,BUF))
@@ -248,10 +249,13 @@ H5_DLL herr_t H5S_select_elements(H5S_t *space, H5S_seloper_t op,
H5_DLL herr_t H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op, const hsize_t start[],
const hsize_t *stride, const hsize_t count[], const hsize_t *block);
H5_DLL herr_t H5S_hyper_add_span_element(H5S_t *space, unsigned rank,
- const hsize_t *coords);
+ hsize_t *coords);
H5_DLL herr_t H5S_hyper_reset_scratch(H5S_t *space);
H5_DLL herr_t H5S_hyper_convert(H5S_t *space);
-H5_DLL htri_t H5S_hyper_intersect_block(H5S_t *space, const hsize_t *start, const hsize_t *end);
+#ifdef LATER
+H5_DLL htri_t H5S_hyper_intersect (H5S_t *space1, H5S_t *space2);
+#endif /* LATER */
+H5_DLL htri_t H5S_hyper_intersect_block (H5S_t *space, hsize_t *start, hsize_t *end);
H5_DLL herr_t H5S_hyper_adjust_s(H5S_t *space, const hssize_t *offset);
H5_DLL htri_t H5S_hyper_normalize_offset(H5S_t *space, hssize_t *old_offset);
H5_DLL herr_t H5S_hyper_denormalize_offset(H5S_t *space, const hssize_t *old_offset);
diff --git a/src/H5Spublic.h b/src/H5Spublic.h
index 7b2f61b..0a39ce1 100644
--- a/src/H5Spublic.h
+++ b/src/H5Spublic.h
@@ -113,15 +113,20 @@ H5_DLL herr_t H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op,
const hsize_t _stride[],
const hsize_t count[],
const hsize_t _block[]);
+/* #define NEW_HYPERSLAB_API */
+/* Note that these haven't been working for a while and were never
+ * publicly released - QAK */
+#ifdef NEW_HYPERSLAB_API
H5_DLL hid_t H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op,
const hsize_t start[],
const hsize_t _stride[],
const hsize_t count[],
const hsize_t _block[]);
-H5_DLL herr_t H5Smodify_select(hid_t space1_id, H5S_seloper_t op,
+H5_DLL herr_t H5Sselect_select(hid_t space1_id, H5S_seloper_t op,
hid_t space2_id);
H5_DLL hid_t H5Scombine_select(hid_t space1_id, H5S_seloper_t op,
hid_t space2_id);
+#endif /* NEW_HYPERSLAB_API */
H5_DLL herr_t H5Sselect_elements(hid_t space_id, H5S_seloper_t op,
size_t num_elem, const hsize_t *coord);
H5_DLL H5S_class_t H5Sget_simple_extent_type(hid_t space_id);
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index 9e9fd2c..2cb4b38 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -105,7 +105,7 @@ H5S_select_offset(H5S_t *space, const hssize_t *offset)
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5S_select_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection)
+H5S_select_copy (H5S_t *dst, const H5S_t *src, hbool_t share_selection)
{
herr_t ret_value; /* return value */
@@ -116,17 +116,10 @@ H5S_select_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection)
HDassert(src);
/* Copy regular fields */
- dst->select = src->select;
-
- /* Copy for type H5S_SEL_ALL is differently processed, and there's no bounds for H5S_SEL_NONE */
- if(src->select.type->type == H5S_SEL_HYPERSLABS || src->select.type->type == H5S_SEL_POINTS) {
- /* Copy bounding box */
- HDmemcpy(dst->select.low_bounds, src->select.low_bounds, sizeof(hsize_t) * src->extent.rank);
- HDmemcpy(dst->select.high_bounds, src->select.high_bounds, sizeof(hsize_t) * src->extent.rank);
- } /* end if */
+ dst->select=src->select;
/* Perform correct type of copy based on the type of selection */
- if((ret_value = (*src->select.type->copy)(dst,src,share_selection)) < 0)
+ if((ret_value=(*src->select.type->copy)(dst,src,share_selection))<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy selection specific information")
done:
@@ -148,6 +141,8 @@ done:
* pattern, don't call it directly, use the appropriate macro
* defined in H5Sprivate.h.
*
+ * Modifications:
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -155,24 +150,13 @@ H5S_select_release(H5S_t *ds)
{
herr_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
HDassert(ds);
- /* Reset the bounding box of the selection */
- if(ds->extent.rank > 0) {
- /* ds->extent.rank could be 0 during dataspace initialization */
- hsize_t tmp = HSIZET_MAX;
-
- H5VM_array_fill(ds->select.low_bounds, &tmp, sizeof(hsize_t), ds->extent.rank);
- HDmemset(ds->select.high_bounds, 0, sizeof(hsize_t)*ds->extent.rank);
- } /* end if */
-
/* Call the selection type's release function */
- if((ret_value = (*ds->select.type->release)(ds)) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection")
+ ret_value=(*ds->select.type->release)(ds);
-done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_select_release() */
@@ -192,6 +176,8 @@ done:
* pattern, don't call it directly, use the appropriate macro
* defined in H5Sprivate.h.
*
+ * Modifications:
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -201,15 +187,13 @@ H5S_select_get_seq_list(const H5S_t *space, unsigned flags,
{
herr_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
HDassert(space);
/* Call the selection type's get_seq_list function */
- if((ret_value = (*space->select.type->get_seq_list)(space, flags, iter, maxseq, maxbytes, nseq, nbytes, off, len)) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get selection sequence list")
+ ret_value = (*space->select.type->get_seq_list)(space, flags, iter, maxseq, maxbytes, nseq, nbytes, off, len);
-done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_select_get_seq_list() */
@@ -229,6 +213,8 @@ done:
* pattern, don't call it directly, use the appropriate macro
* defined in H5Sprivate.h.
*
+ * Modifications:
+ *
*-------------------------------------------------------------------------
*/
hssize_t
@@ -458,39 +444,39 @@ H5S_select_valid(const H5S_t *space)
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5S_select_deserialize(H5S_t *space, const uint8_t *buf)
+H5S_select_deserialize (H5S_t *space, const uint8_t *buf)
{
const uint8_t *tbuf; /* Temporary pointer to the selection type */
uint32_t sel_type; /* Pointer to the selection type */
- herr_t ret_value = FAIL; /* return value */
+ herr_t ret_value=FAIL; /* return value */
FUNC_ENTER_NOAPI(FAIL)
HDassert(space);
- tbuf = buf;
+ tbuf=buf;
UINT32DECODE(tbuf, sel_type);
switch(sel_type) {
case H5S_SEL_POINTS: /* Sequence of points selected */
- ret_value = (*H5S_sel_point->deserialize)(space, buf);
+ ret_value=(*H5S_sel_point->deserialize)(space,buf);
break;
case H5S_SEL_HYPERSLABS: /* Hyperslab selection defined */
- ret_value = (*H5S_sel_hyper->deserialize)(space, buf);
+ ret_value=(*H5S_sel_hyper->deserialize)(space,buf);
break;
case H5S_SEL_ALL: /* Entire extent selected */
- ret_value = (*H5S_sel_all->deserialize)(space, buf);
+ ret_value=(*H5S_sel_all->deserialize)(space,buf);
break;
case H5S_SEL_NONE: /* Nothing selected */
- ret_value = (*H5S_sel_none->deserialize)(space, buf);
+ ret_value=(*H5S_sel_none->deserialize)(space,buf);
break;
default:
break;
- } /* end switch */
- if(ret_value < 0)
+ }
+ if(ret_value<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTLOAD, FAIL, "can't deserialize selection")
done:
@@ -1441,8 +1427,8 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
{
H5S_sel_iter_t iter_a; /* Selection a iteration info */
H5S_sel_iter_t iter_b; /* Selection b iteration info */
- hbool_t iter_a_init = FALSE; /* Selection a iteration info has been initialized */
- hbool_t iter_b_init = FALSE; /* Selection b iteration info has been initialized */
+ hbool_t iter_a_init = 0; /* Selection a iteration info has been initialized */
+ hbool_t iter_b_init = 0; /* Selection b iteration info has been initialized */
htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1499,19 +1485,6 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
if(H5S_GET_SELECT_NPOINTS(space_a) != H5S_GET_SELECT_NPOINTS(space_b))
HGOTO_DONE(FALSE)
- /* For hyperslabs, rebuild diminfo if it is invalid and has not been
- * confirmed to be impossible */
- if((H5S_GET_SELECT_TYPE(space_a) == H5S_SEL_HYPERSLABS)
- && (space_a->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_NO))
- /* Casting away const OK -NAF */
- if(H5S_hyper_rebuild((H5S_t *)space_a) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't update hyperslab info")
- if((H5S_GET_SELECT_TYPE(space_b) == H5S_SEL_HYPERSLABS)
- && (space_b->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_NO))
- /* Casting away const OK -NAF */
- if(H5S_hyper_rebuild((H5S_t *)space_b) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't update hyperslab info")
-
/* Check for "easy" cases before getting into generalized block iteration code */
if((H5S_GET_SELECT_TYPE(space_a) == H5S_SEL_ALL) && (H5S_GET_SELECT_TYPE(space_b) == H5S_SEL_ALL)) {
hsize_t dims1[H5O_LAYOUT_NDIMS]; /* End point of selection block in dataspace #1 */
@@ -1540,7 +1513,7 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
space_b_dim--;
} /* end while */
- /* Since we are selecting the entire space, we must also verify that space_a
+ /* Since we are selecting the entire spaces, we must also verify that space_a
* has size 1 in all dimensions that it does not share with space_b.
*/
while(space_a_dim >= 0) {
@@ -1553,8 +1526,8 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
else if((H5S_GET_SELECT_TYPE(space1) == H5S_SEL_NONE) || (H5S_GET_SELECT_TYPE(space2) == H5S_SEL_NONE)) {
HGOTO_DONE(TRUE)
} /* end if */
- else if((H5S_GET_SELECT_TYPE(space_a) == H5S_SEL_HYPERSLABS && space_a->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES)
- && (H5S_GET_SELECT_TYPE(space_b) == H5S_SEL_HYPERSLABS && space_b->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES)) {
+ else if((H5S_GET_SELECT_TYPE(space_a) == H5S_SEL_HYPERSLABS && space_a->select.sel_info.hslab->diminfo_valid)
+ && (H5S_GET_SELECT_TYPE(space_b) == H5S_SEL_HYPERSLABS && space_b->select.sel_info.hslab->diminfo_valid)) {
int space_a_dim; /* Current dimension in dataspace A */
int space_b_dim; /* Current dimension in dataspace B */
@@ -1590,56 +1563,13 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
} /* end if */
/* Iterate through all the blocks in the selection */
else {
- hsize_t start_a[H5O_LAYOUT_NDIMS]; /* Start point of selection block in dataspace a */
- hsize_t start_b[H5O_LAYOUT_NDIMS]; /* Start point of selection block in dataspace b */
- hsize_t end_a[H5O_LAYOUT_NDIMS]; /* End point of selection block in dataspace a */
- hsize_t end_b[H5O_LAYOUT_NDIMS]; /* End point of selection block in dataspace b */
- hsize_t off_a[H5O_LAYOUT_NDIMS]; /* Offset of selection a blocks */
- hsize_t off_b[H5O_LAYOUT_NDIMS]; /* Offset of selection b blocks */
- hbool_t first_block = TRUE; /* Flag to indicate the first block */
-
- /* Check that the range between the low & high bounds are the same */
- {
- hsize_t space_a_range; /* Selection a range */
- hsize_t space_b_range; /* Selection b range */
- int space_a_dim; /* Current dimension in dataspace A */
- int space_b_dim; /* Current dimension in dataspace B */
-
- space_a_dim = (int)space_a_rank - 1;
- space_b_dim = (int)space_b_rank - 1;
- while(space_b_dim >= 0) {
- /* Sanity check */
- HDassert(space_a->select.low_bounds[space_a_dim] <= space_a->select.high_bounds[space_a_dim]);
- HDassert(space_b->select.low_bounds[space_b_dim] <= space_b->select.high_bounds[space_b_dim]);
-
- /* Compute range in each space, for this dimension */
- space_a_range = space_a->select.high_bounds[space_a_dim] - space_a->select.low_bounds[space_a_dim];
- space_b_range = space_b->select.high_bounds[space_b_dim] - space_b->select.low_bounds[space_b_dim];
-
- /* Verify that the ranges are the same */
- if(space_a_range != space_b_range)
- HGOTO_DONE(FALSE)
-
- /* Go to next dimension */
- space_a_dim--;
- space_b_dim--;
- } /* end while */
-
- /* Check that the rest of the ranges in space a are "flat" */
- while(space_a_dim >= 0) {
- /* Sanity check */
- HDassert(space_a->select.low_bounds[space_a_dim] <= space_a->select.high_bounds[space_a_dim]);
-
- /* Compute range in space a, for this dimension */
- space_a_range = space_a->select.high_bounds[space_a_dim] - space_a->select.low_bounds[space_a_dim];
-
- /* This range should be flat (i.e. 0-sized) to be the same in a lower dimension */
- if(space_a_range != 0)
- HGOTO_DONE(FALSE)
-
- space_a_dim--;
- } /* end while */
- } /* end block */
+ hsize_t start_a[H5O_LAYOUT_NDIMS]; /* Start point of selection block in dataspace a */
+ hsize_t start_b[H5O_LAYOUT_NDIMS]; /* Start point of selection block in dataspace b */
+ hsize_t end_a[H5O_LAYOUT_NDIMS]; /* End point of selection block in dataspace a */
+ hsize_t end_b[H5O_LAYOUT_NDIMS]; /* End point of selection block in dataspace b */
+ hsize_t off_a[H5O_LAYOUT_NDIMS]; /* Offset of selection a blocks */
+ hsize_t off_b[H5O_LAYOUT_NDIMS]; /* Offset of selection b blocks */
+ hbool_t first_block = TRUE; /* Flag to indicate the first block */
/* Initialize iterator for each dataspace selection
* Use '0' for element size instead of actual element size to indicate
@@ -1648,10 +1578,10 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
*/
if(H5S_select_iter_init(&iter_a, space_a, (size_t)0) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator a")
- iter_a_init = TRUE;
+ iter_a_init = 1;
if(H5S_select_iter_init(&iter_b, space_b, (size_t)0) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator b")
- iter_b_init = TRUE;
+ iter_b_init = 1;
/* Iterate over all the blocks in each selection */
while(1) {
@@ -1778,7 +1708,7 @@ done:
topologically identical to that in b (as verified by
H5S_select_shape_same().
- This function exists, as some I/O code chokes on topologically
+ This function exists, as some I/O code chokes of topologically
identical selections with different ranks. At least to begin
with, we will deal with the issue by constructing projections
of the memory dataspace with ranks equaling those of the file
@@ -2028,9 +1958,10 @@ H5S_select_construct_projection(const H5S_t *base_space, H5S_t **new_space_ptr,
done:
/* Cleanup on error */
- if(ret_value < 0)
+ if(ret_value < 0) {
if(new_space && H5S_close(new_space) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_select_construct_projection() */
diff --git a/src/H5Stest.c b/src/H5Stest.c
index 0e2a72d..62a4179 100644
--- a/src/H5Stest.c
+++ b/src/H5Stest.c
@@ -77,271 +77,14 @@ done:
NAME
H5S_get_rebuild_status_test
PURPOSE
- Determine the status of the diminfo_valid field (whether we know the
- selection information for an equivalent single hyperslab selection)
- before and after calling H5S_hyper_rebuild.
+ Determine the status of hyperslab rebuild
USAGE
- herr_t H5S_inquiry_rebuild_status(hid_t space_id)
- hid_t space_id; IN: dataspace id
- H5S_diminfo_valid_t *status1; OUT: status before calling
- H5S_hyper_rebuild
- H5S_diminfo_valid_t *status2; OUT: status after calling
- H5S_hyper_rebuild
- RETURNS
- Non-negative on success, negative on failure
- DESCRIPTION
- Query the status of rebuilding the hyperslab
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-herr_t
-H5S_get_rebuild_status_test(hid_t space_id, H5S_diminfo_valid_t *status1,
- H5S_diminfo_valid_t *status2)
-{
- H5S_t *space; /* Pointer to 1st dataspace */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- HDassert(status1);
- HDassert(status2);
-
- /* Get dataspace structures */
- if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
-
- *status1 = space->select.sel_info.hslab->diminfo_valid;
-
- /* Fully rebuild diminfo, if necessary */
- if(*status1 == H5S_DIMINFO_VALID_NO)
- if(H5S_hyper_rebuild(space) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't update hyperslab info")
-
- *status2 = space->select.sel_info.hslab->diminfo_valid;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_get_rebuild_status_test() */
-
-
-/*--------------------------------------------------------------------------
- NAME
- H5S_get_diminfo_status_test
- PURPOSE
- Determine the status of the diminfo_valid field (whether we know the
- selection information for an equivalent single hyperslab selection)
- USAGE
- herr_t H5S_inquiry_rebuild_status(hid_t space_id)
- hid_t space_id; IN: dataspace id
- H5S_diminfo_valid_t *status; OUT: status of diminfo_valid
- RETURNS
- Non-negative on success, negative on failure
- DESCRIPTION
- Query the status of rebuilding the hyperslab
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-herr_t
-H5S_get_diminfo_status_test(hid_t space_id, H5S_diminfo_valid_t *status)
-{
- H5S_t *space; /* Pointer to 1st dataspace */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- HDassert(status);
-
- /* Get dataspace structures */
- if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
-
- *status = space->select.sel_info.hslab->diminfo_valid;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_get_diminfo_status_test() */
-
-/*--------------------------------------------------------------------------
- NAME
- H5S_check_spans_tail_ptr
- PURPOSE
- Determine if the tail pointer of the spans are correctly set
- USAGE
- herr_t H5S_check_spans_tail_ptr(span_lst)
- const H5S_hyper_span_info_t *span_lst; IN: the spans to check for taill pointers
- RETURNS
- SUCCEED/FAIL
- DESCRIPTION
- Checks to see if the current selection in the dataspaces has tail pointers of each
- dimension correctly set.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- Only check the hyperslab selection
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static herr_t
-H5S_check_spans_tail_ptr(const H5S_hyper_span_info_t *span_lst)
-{
- H5S_hyper_span_t *cur_elem;
- H5S_hyper_span_t *actual_tail = NULL;
- htri_t ret_value = TRUE; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- HDassert(span_lst);
-
- cur_elem = span_lst->head;
- while(cur_elem) {
- actual_tail = cur_elem;
-
- /* check the next dimension of lower order */
- if(NULL != cur_elem->down)
- if((ret_value = H5S_check_spans_tail_ptr(cur_elem->down)) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the seletion has inconsistent tail pointers")
-
- cur_elem = cur_elem->next;
- } /* end while */
- if(actual_tail != span_lst->tail)
- HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the seletion has inconsistent tail pointers")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_check_spans_tail_ptr */
-
-/*--------------------------------------------------------------------------
- NAME
- H5S_check_points_tail_ptr
- PURPOSE
- Determine if the tail pointer of the points list are correctly set
- USAGE
- herr_t H5S_check_points_tail_ptr(pnt_lst)
- const H5S_pnt_list_t *pnt_lst; IN: the points list to check for taill pointers
- RETURNS
- SUCCEED/FAIL
- DESCRIPTION
- Checks to see if the current selection in the dataspaces has tail pointers correctly set.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- Only check the points selection
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static herr_t
-H5S_check_points_tail_ptr(const H5S_pnt_list_t *pnt_lst)
-{
- H5S_pnt_node_t *cur_elem;
- H5S_pnt_node_t *actual_tail = NULL;
- htri_t ret_value = TRUE; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- HDassert(pnt_lst);
-
- cur_elem = pnt_lst->head;
- while(cur_elem) {
- actual_tail = cur_elem;
- cur_elem = cur_elem->next;
- } /* end while */
- if(actual_tail != pnt_lst->tail)
- HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the seletion has inconsistent tail pointers")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_check_points_tail_ptr */
-
-
-/*--------------------------------------------------------------------------
- NAME
- H5S_check_internal_consistency
- PURPOSE
- Determine if internal data structures are consistent
- USAGE
- herr_t H5S_check_internal_consistency(space)
- const H5S_t *space; IN: 1st Dataspace pointer to compare
- RETURNS
- SUCCEED/FAIL
- DESCRIPTION
- Checks to see if the current selection in the dataspaces has consistent
- state of internal data structure.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- Currently only check the hyperslab selection
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static herr_t
-H5S_check_internal_consistency(const H5S_t *space)
-{
- hsize_t low_bounds[H5S_MAX_RANK];
- hsize_t high_bounds[H5S_MAX_RANK];
- unsigned u;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Check args */
- HDassert(space);
-
- if(space->select.type->type == H5S_SEL_NONE)
- HGOTO_DONE(ret_value);
-
- /* Initialize the inputs */
- for(u = 0; u < space->extent.rank; u++) {
- low_bounds[u] = HSIZET_MAX;
- high_bounds[u] = 0;
- } /* end for */
-
- /* Check the bound box */
- if(H5S_get_select_bounds(space, low_bounds, high_bounds) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the bound box could not be retrieved")
-
- for(u = 0; u < space->extent.rank; u++) {
- if((hsize_t)((hssize_t)space->select.low_bounds[u] + space->select.offset[u]) != low_bounds[u])
- HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the lower bound box of the selection is inconsistent")
- if((hsize_t)((hssize_t)space->select.high_bounds[u] + space->select.offset[u]) != high_bounds[u])
- HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the higher bound box of the selection is inconsistent")
- } /* end for */
-
- if(space->select.type->type == H5S_SEL_HYPERSLABS) {
- H5S_hyper_sel_t *hslab = space->select.sel_info.hslab;
-
- /* check the tail pointer */
- if((NULL != hslab) && (NULL != hslab->span_lst))
- if(H5S_check_spans_tail_ptr(hslab->span_lst) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the seletion has inconsistent tail pointers")
- } /* end if */
- else if(space->select.type->type == H5S_SEL_POINTS) {
- H5S_pnt_list_t *pnt_lst = space->select.sel_info.pnt_lst;
-
- if(NULL != pnt_lst)
- if(H5S_check_points_tail_ptr(pnt_lst) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the seletion has inconsistent tail pointers")
- } /* end else-if */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_check_internal_consistency */
-
-/*--------------------------------------------------------------------------
- NAME
- H5S_internal_consistency_test
- PURPOSE
- Determine if states of internal data structures are consistent
- USAGE
- htri_t H5S_internal_consistency_test(hid_t space_id)
+ htri_t H5S_inquiry_rebuild_status(hid_t space_id)
hid_t space_id; IN: dataspace id
RETURNS
Non-negative TRUE/FALSE on success, negative on failure
DESCRIPTION
- Check the states of internal data structures of the hyperslab, and see
- whether they are consistent or not
+ Query the status of rebuilding the hyperslab
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING
@@ -349,10 +92,10 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
htri_t
-H5S_internal_consistency_test(hid_t space_id)
+H5S_get_rebuild_status_test(hid_t space_id)
{
H5S_t *space; /* Pointer to 1st dataspace */
- htri_t ret_value = TRUE; /* Return value */
+ htri_t ret_value; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -360,11 +103,9 @@ H5S_internal_consistency_test(hid_t space_id)
if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
- /* Check if the dataspace selections are the same shape */
- if(FAIL == H5S_check_internal_consistency(space))
- HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "The dataspace has inconsistent internal state")
+ ret_value = (htri_t)space->select.sel_info.hslab->diminfo_valid;
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_internal_consistency_test() */
+} /* H5S_get_rebuild_status_test() */
diff --git a/src/H5VLnative.c b/src/H5VLnative.c
index 9675655..61abedb 100644
--- a/src/H5VLnative.c
+++ b/src/H5VLnative.c
@@ -509,7 +509,7 @@ H5VL_native_attr_create(void *obj, H5VL_loc_params_t loc_params, const char *att
if(0 == (H5F_INTENT(loc.oloc->file) & H5F_ACC_RDWR))
HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, NULL, "no write intent on file")
- if(NULL == (dt = (H5T_t *)H5I_object(type_id)))
+ if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype")
/* If this is a named datatype, get the plugin pointer to the datatype */
type = (H5T_t *)H5T_get_actual_type(dt);
diff --git a/src/H5Z.c b/src/H5Z.c
index bc5f290..5cb890c 100644
--- a/src/H5Z.c
+++ b/src/H5Z.c
@@ -850,7 +850,7 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type
H5S_t *space; /* Dataspace describing chunk */
size_t u; /* Local index variable */
- /* Create a dataspace for a chunk & set the extent */
+ /* Create a data space for a chunk & set the extent */
for(u = 0; u < dcpl_layout.u.chunk.ndims; u++)
chunk_dims[u] = dcpl_layout.u.chunk.dim[u];
if(NULL == (space = H5S_create_simple(dcpl_layout.u.chunk.ndims, chunk_dims, NULL)))
diff --git a/src/H5Znbit.c b/src/H5Znbit.c
index ea761c5..ebb534b 100644
--- a/src/H5Znbit.c
+++ b/src/H5Znbit.c
@@ -794,7 +794,7 @@ H5Z_set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id)
/* Get dataspace */
if(NULL == (ds = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
/* Get total number of elements in the chunk */
if((npoints = H5S_GET_EXTENT_NPOINTS(ds)) < 0)
diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c
index 1ae4503..83864b9 100644
--- a/src/H5Zscaleoffset.c
+++ b/src/H5Zscaleoffset.c
@@ -896,7 +896,7 @@ H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id)
/* Get dataspace */
if(NULL == (ds = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
/* Get total number of elements in the chunk */
if((npoints = H5S_GET_EXTENT_NPOINTS(ds)) < 0)
diff --git a/src/H5Zszip.c b/src/H5Zszip.c
index 7f50275..4544ec3 100644
--- a/src/H5Zszip.c
+++ b/src/H5Zszip.c
@@ -190,7 +190,7 @@ H5Z_set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id)
/* Get dataspace */
if(NULL == (ds = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
/* Get dimensions for dataspace */
if((ndims = H5S_get_simple_extent_dims(ds, dims, NULL)) < 0)
diff --git a/src/H5err.txt b/src/H5err.txt
index e7ff958..c3908e4 100644
--- a/src/H5err.txt
+++ b/src/H5err.txt
@@ -218,7 +218,6 @@ MINOR, DSPACE, H5E_CANTSELECT, Can't select hyperslab
MINOR, DSPACE, H5E_CANTNEXT, Can't move to next iterator location
MINOR, DSPACE, H5E_BADSELECT, Invalid selection
MINOR, DSPACE, H5E_CANTCOMPARE, Can't compare objects
-MINOR, DSPACE, H5E_INCONSISTENTSTATE, Internal states are inconsistent
# Property list errors
MINOR, PLIST, H5E_CANTGET, Can't get value
diff --git a/src/H5public.h b/src/H5public.h
index cf9d779..832e210 100644
--- a/src/H5public.h
+++ b/src/H5public.h
@@ -94,10 +94,10 @@ extern "C" {
/* Version numbers */
#define H5_VERS_MAJOR 1 /* For major interface/format changes */
#define H5_VERS_MINOR 9 /* For minor interface/format changes */
-#define H5_VERS_RELEASE 200 /* For tweaks, bug-fixes, or development */
+#define H5_VERS_RELEASE 203 /* For tweaks, bug-fixes, or development */
#define H5_VERS_SUBRELEASE "" /* For pre-releases like snap0 */
/* Empty string for real releases. */
-#define H5_VERS_INFO "HDF5 library version: 1.9.200" /* Full version string */
+#define H5_VERS_INFO "HDF5 library version: 1.9.203" /* Full version string */
#define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \
H5_VERS_RELEASE)
diff --git a/src/H5trace.c b/src/H5trace.c
index ddf376c..dfa5dce 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -1251,7 +1251,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case H5I_DATASPACE:
fprintf(out, "%ld (dspace)", (long)obj);
- /* Save the rank of simple dataspaces for arrays */
+ /* Save the rank of simple data spaces for arrays */
/* This may generate recursive call to the library... -QAK */
{
H5S_t *space;
diff --git a/src/Makefile.in b/src/Makefile.in
index 71b7e3b..fb51b86 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -734,7 +734,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog
# After making changes, run bin/reconfigure to update other configure related
# files like Makefile.in.
LT_VERS_INTERFACE = 6
-LT_VERS_REVISION = 190
+LT_VERS_REVISION = 193
LT_VERS_AGE = 0
# Our main target, the HDF5 library
diff --git a/test/h5test.c b/test/h5test.c
index 61a9ae0..693760c 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -908,7 +908,7 @@ h5_get_file_size(const char *filename, hid_t fapl)
{
char temp[2048]; /* Temporary buffer for file names */
h5_stat_t sb; /* Structure for querying file info */
- int j = 0;
+ int j = 0;
if(fapl == H5P_DEFAULT) {
/* Get the file's statistics */
@@ -924,9 +924,6 @@ h5_get_file_size(const char *filename, hid_t fapl)
/* Check for simple cases */
if(driver == H5FD_SEC2 || driver == H5FD_STDIO || driver == H5FD_CORE ||
-#ifdef H5_HAVE_PARALLEL
- driver == H5FD_MPIO ||
-#endif /* H5_HAVE_PARALLEL */
#ifdef H5_HAVE_WINDOWS
driver == H5FD_WINDOWS ||
#endif /* H5_HAVE_WINDOWS */
@@ -961,6 +958,22 @@ h5_get_file_size(const char *filename, hid_t fapl)
/* Return total size */
return(tot_size);
} /* end if */
+#ifdef H5_HAVE_PARALLEL
+ else if(driver == H5FD_MPIO) {
+ MPI_File fh; /* MPI file handle used to open the file and verify its size */
+ int mpi_ret;
+ MPI_Offset file_size;
+
+ mpi_ret = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDONLY, MPI_INFO_NULL, &fh);
+ if (mpi_ret != MPI_SUCCESS) return -1;
+ mpi_ret = MPI_File_get_size(fh, &file_size);
+ if (mpi_ret != MPI_SUCCESS) return -1;
+ mpi_ret = MPI_File_close(&fh);
+ if (mpi_ret != MPI_SUCCESS) return -1;
+
+ return file_size;
+ }
+#endif /* H5_HAVE_PARALLEL */
else if(driver == H5FD_FAMILY) {
h5_stat_size_t tot_size = 0;
diff --git a/test/tselect.c b/test/tselect.c
index a945ca8..d5a1f4c 100644
--- a/test/tselect.c
+++ b/test/tselect.c
@@ -159,12 +159,6 @@
#define SPACERE5_DIM3 12
#define SPACERE5_DIM4 8
-/* Information for Space update diminfo test */
-#define SPACEUD1_DIM0 20
-#define SPACEUD3_DIM0 9
-#define SPACEUD3_DIM1 12
-#define SPACEUD3_DIM2 13
-
/* #defines for shape same / different rank tests */
#define SS_DR_MAX_RANK 5
@@ -1646,8 +1640,8 @@ verify_select_hyper_contig_dr__run_test(const uint16_t *cube_buf,
/* Advance to next element */
cube_ptr++;
expected_value++;
- s++;
- m++;
+ s++;
+ m++;
} while((cube_rank > 0) && (m < edge_size));
l++;
} while((cube_rank > 1) && (l < edge_size));
@@ -1664,10 +1658,10 @@ verify_select_hyper_contig_dr__run_test(const uint16_t *cube_buf,
/****************************************************************
**
-** test_select_hyper_contig_dr__run_test(): Test H5S (dataspace)
-** selection code with contiguous source and target having
+** test_select_hyper_contig_dr__run_test(): Test H5S (dataspace)
+** selection code with contiguous source and target having
** different ranks but the same shape. We have already
-** tested H5S_shape_same in isolation, so now we try to do
+** tested H5S_shape_same in isolation, so now we try to do
** I/O.
**
****************************************************************/
@@ -1771,13 +1765,13 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
CHECK(file_large_cube_sid, FAIL, "H5Screate_simple");
/* if chunk edge size is greater than zero, set up the small and
- * large data set creation property lists to specify chunked
+ * large data set creation property lists to specify chunked
* datasets.
*/
if(chunk_edge_size > 0) {
hsize_t chunk_dims[SS_DR_MAX_RANK]; /* Chunk dimensions */
- chunk_dims[0] = chunk_dims[1] =
+ chunk_dims[0] = chunk_dims[1] =
chunk_dims[2] = chunk_dims[3] = chunk_dims[4] = (hsize_t)chunk_edge_size;
small_cube_dcpl_id = H5Pcreate(H5P_DATASET_CREATE);
@@ -1801,7 +1795,7 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
} /* end if */
/* create the small cube dataset */
- small_cube_dataset = H5Dcreate2(fid1, "small_cube_dataset", dset_type,
+ small_cube_dataset = H5Dcreate2(fid1, "small_cube_dataset", dset_type,
small_cube_sid, H5P_DEFAULT, small_cube_dcpl_id, H5P_DEFAULT);
CHECK(small_cube_dataset, FAIL, "H5Dcreate2");
@@ -1812,7 +1806,7 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
} /* end if */
/* create the large cube dataset */
- large_cube_dataset = H5Dcreate2(fid1, "large_cube_dataset", dset_type,
+ large_cube_dataset = H5Dcreate2(fid1, "large_cube_dataset", dset_type,
file_large_cube_sid, H5P_DEFAULT, large_cube_dcpl_id, H5P_DEFAULT);
CHECK(large_cube_dataset, FAIL, "H5Dcreate2");
@@ -1824,16 +1818,16 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
/* write initial data to the on disk datasets */
- ret = H5Dwrite(small_cube_dataset, H5T_NATIVE_UINT16, small_cube_sid,
+ ret = H5Dwrite(small_cube_dataset, H5T_NATIVE_UINT16, small_cube_sid,
small_cube_sid, xfer_plist, cube_buf);
CHECK(ret, FAIL, "H5Dwrite");
- ret = H5Dwrite(large_cube_dataset, H5T_NATIVE_UINT16, mem_large_cube_sid,
+ ret = H5Dwrite(large_cube_dataset, H5T_NATIVE_UINT16, mem_large_cube_sid,
file_large_cube_sid, xfer_plist, cube_buf);
CHECK(ret, FAIL, "H5Dwrite");
/* read initial data from disk and verify that it is as expected. */
- ret = H5Dread(small_cube_dataset, H5T_NATIVE_UINT16, small_cube_sid,
+ ret = H5Dread(small_cube_dataset, H5T_NATIVE_UINT16, small_cube_sid,
small_cube_sid, xfer_plist, small_cube_buf_1);
CHECK(ret, FAIL, "H5Dread");
@@ -1841,7 +1835,7 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
verify_select_hyper_contig_dr__run_test(small_cube_buf_1, small_cube_size,
edge_size, small_rank);
- ret = H5Dread(large_cube_dataset, H5T_NATIVE_UINT16, mem_large_cube_sid,
+ ret = H5Dread(large_cube_dataset, H5T_NATIVE_UINT16, mem_large_cube_sid,
file_large_cube_sid, xfer_plist, large_cube_buf_1);
CHECK(ret, FAIL, "H5Dread");
@@ -1854,12 +1848,12 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
* of different rank that H5S_select_shape_same() views as being of the
* same shape.
*
- * Start by reading small_rank-D slice from the on disk large cube, and
- * verifying that the data read is correct. Verify that H5S_select_shape_same()
+ * Start by reading small_rank-D slice from the on disk large cube, and
+ * verifying that the data read is correct. Verify that H5S_select_shape_same()
* returns true on the memory and file selections.
*/
-
+
/* set up start, stride, count, and block -- note that we will
* change start[] so as to read slices of the large cube.
*/
@@ -1891,18 +1885,18 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
start[3] = (hsize_t)x;
start[4] = (hsize_t)0;
- ret = H5Sselect_hyperslab(file_large_cube_sid,
+ ret = H5Sselect_hyperslab(file_large_cube_sid,
H5S_SELECT_SET,
- start_ptr,
- stride_ptr,
- count_ptr,
+ start_ptr,
+ stride_ptr,
+ count_ptr,
block_ptr);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- /* verify that H5S_select_shape_same() reports the two
+ /* verify that H5S_select_shape_same() reports the two
* selections as having the same shape.
*/
- check = H5S_select_shape_same_test(small_cube_sid,
+ check = H5S_select_shape_same_test(small_cube_sid,
file_large_cube_sid);
VERIFY(check, TRUE, "H5S_select_shape_same_test");
@@ -1939,7 +1933,7 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
} while((large_rank >= 4) && (small_rank <= 3) && (v < edge_size));
u++;
} while((large_rank >= 5) && (small_rank <= 4) && (u < edge_size));
-
+
/* similarly, read the on disk small cube into slices through the in memory
* large cube, and verify that the correct data (and only the correct data)
@@ -1967,19 +1961,19 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
start[3] = (hsize_t)x;
start[4] = (hsize_t)0;
- ret = H5Sselect_hyperslab(mem_large_cube_sid,
+ ret = H5Sselect_hyperslab(mem_large_cube_sid,
H5S_SELECT_SET,
- start_ptr,
- stride_ptr,
- count_ptr,
+ start_ptr,
+ stride_ptr,
+ count_ptr,
block_ptr);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- /* verify that H5S_select_shape_same() reports the two
+ /* verify that H5S_select_shape_same() reports the two
* selections as having the same shape.
*/
- check = H5S_select_shape_same_test(small_cube_sid,
+ check = H5S_select_shape_same_test(small_cube_sid,
mem_large_cube_sid);
VERIFY(check, TRUE, "H5S_select_shape_same_test");
@@ -1994,7 +1988,7 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
CHECK(ret, FAIL, "H5Dread");
- /* verify that the expected data and only the
+ /* verify that the expected data and only the
* expected data was read.
*/
start_index = (u * edge_size * edge_size * edge_size * edge_size) +
@@ -2030,7 +2024,7 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
/* Zero out the buffer for the next pass */
HDmemset(large_cube_buf_1 + start_index, 0, small_cube_size * sizeof(uint16_t));
-
+
x++;
} while((large_rank >= 2) && (small_rank <= 1) && (x < edge_size));
w++;
@@ -2041,16 +2035,16 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
} while((large_rank >= 5) && (small_rank <= 4) && (u < edge_size));
- /* now we go in the opposite direction, verifying that we can write
- * from memory to file using selections of different rank that
+ /* now we go in the opposite direction, verifying that we can write
+ * from memory to file using selections of different rank that
* H5S_select_shape_same() views as being of the same shape.
*
- * Start by writing small_rank D slices from the in memory large cube, to
+ * Start by writing small_rank D slices from the in memory large cube, to
* the the on disk small cube dataset. After each write, read the small
* cube dataset back from disk, and verify that it contains the expected
- * data. Verify that H5S_select_shape_same() returns true on the
+ * data. Verify that H5S_select_shape_same() returns true on the
* memory and file selections.
- */
+ */
u = 0;
do {
@@ -2066,15 +2060,15 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
*/
/* zero out the on disk small cube */
- ret = H5Dwrite(small_cube_dataset,
- H5T_NATIVE_UINT16,
- small_cube_sid,
- small_cube_sid,
- xfer_plist,
+ ret = H5Dwrite(small_cube_dataset,
+ H5T_NATIVE_UINT16,
+ small_cube_sid,
+ small_cube_sid,
+ xfer_plist,
zero_buf);
CHECK(ret, FAIL, "H5Dwrite");
- /* select the portion of the in memory large cube from which we
+ /* select the portion of the in memory large cube from which we
* are going to write data.
*/
start[0] = (hsize_t)u;
@@ -2083,40 +2077,40 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
start[3] = (hsize_t)x;
start[4] = (hsize_t)0;
- ret = H5Sselect_hyperslab(mem_large_cube_sid,
+ ret = H5Sselect_hyperslab(mem_large_cube_sid,
H5S_SELECT_SET,
- start_ptr,
- stride_ptr,
- count_ptr,
+ start_ptr,
+ stride_ptr,
+ count_ptr,
block_ptr);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- /* verify that H5S_select_shape_same() reports the in
- * memory slice through the cube selection and the
+ /* verify that H5S_select_shape_same() reports the in
+ * memory slice through the cube selection and the
* on disk full small cube selections as having the same shape.
*/
- check = H5S_select_shape_same_test(small_cube_sid,
+ check = H5S_select_shape_same_test(small_cube_sid,
mem_large_cube_sid);
VERIFY(check, TRUE, "H5S_select_shape_same_test");
/* write the slice from the in memory large cube to the on disk small cube */
- ret = H5Dwrite(small_cube_dataset,
- H5T_NATIVE_UINT16,
- mem_large_cube_sid,
- small_cube_sid,
- xfer_plist,
+ ret = H5Dwrite(small_cube_dataset,
+ H5T_NATIVE_UINT16,
+ mem_large_cube_sid,
+ small_cube_sid,
+ xfer_plist,
cube_buf);
CHECK(ret, FAIL, "H5Dwrite");
/* read the on disk small cube into memory */
- ret = H5Dread(small_cube_dataset,
+ ret = H5Dread(small_cube_dataset,
H5T_NATIVE_UINT16,
small_cube_sid,
- small_cube_sid,
- xfer_plist,
+ small_cube_sid,
+ xfer_plist,
small_cube_buf_1);
CHECK(ret, FAIL, "H5Dread");
@@ -2136,7 +2130,7 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
} /* end for */
if(mis_match )
TestErrPrintf("small cube data don't match! Line=%d\n",__LINE__);
-
+
x++;
} while((large_rank >= 2) && (small_rank <= 1) && (x < edge_size));
w++;
@@ -2147,10 +2141,10 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
} while((large_rank >= 5) && (small_rank <= 4) && (u < edge_size));
- /* Now write the contents of the in memory small cube to slices of
+ /* Now write the contents of the in memory small cube to slices of
* the on disk cube. After each write, read the on disk cube
- * into memeory, and verify that it contains the expected
- * data. Verify that H5S_select_shape_same() returns true on
+ * into memeory, and verify that it contains the expected
+ * data. Verify that H5S_select_shape_same() returns true on
* the memory and file selections.
*/
@@ -2175,16 +2169,16 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
*/
/* zero out the on disk cube */
- ret = H5Dwrite(large_cube_dataset,
- H5T_NATIVE_USHORT,
- mem_large_cube_sid,
- file_large_cube_sid,
- xfer_plist,
+ ret = H5Dwrite(large_cube_dataset,
+ H5T_NATIVE_USHORT,
+ mem_large_cube_sid,
+ file_large_cube_sid,
+ xfer_plist,
zero_buf);
CHECK(ret, FAIL, "H5Dwrite");
- /* select the portion of the in memory large cube to which we
+ /* select the portion of the in memory large cube to which we
* are going to write data.
*/
start[0] = (hsize_t)u;
@@ -2193,31 +2187,31 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
start[3] = (hsize_t)x;
start[4] = (hsize_t)0;
- ret = H5Sselect_hyperslab(file_large_cube_sid,
+ ret = H5Sselect_hyperslab(file_large_cube_sid,
H5S_SELECT_SET,
- start_ptr,
- stride_ptr,
- count_ptr,
+ start_ptr,
+ stride_ptr,
+ count_ptr,
block_ptr);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- /* verify that H5S_select_shape_same() reports the in
- * memory full selection of the small cube and the
- * on disk slice through the large cube selection
+ /* verify that H5S_select_shape_same() reports the in
+ * memory full selection of the small cube and the
+ * on disk slice through the large cube selection
* as having the same shape.
*/
- check = H5S_select_shape_same_test(small_cube_sid,
+ check = H5S_select_shape_same_test(small_cube_sid,
file_large_cube_sid);
VERIFY(check, TRUE, "H5S_select_shape_same_test");
/* write the cube from memory to the target slice of the disk cube */
- ret = H5Dwrite(large_cube_dataset,
- H5T_NATIVE_UINT16,
- small_cube_sid,
- file_large_cube_sid,
- xfer_plist,
+ ret = H5Dwrite(large_cube_dataset,
+ H5T_NATIVE_UINT16,
+ small_cube_sid,
+ file_large_cube_sid,
+ xfer_plist,
cube_buf);
CHECK(ret, FAIL, "H5Dwrite");
@@ -2226,16 +2220,16 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
ret = H5Sselect_all(file_large_cube_sid);
CHECK(ret, FAIL, "H5Sselect_all");
- ret = H5Dread(large_cube_dataset,
+ ret = H5Dread(large_cube_dataset,
H5T_NATIVE_UINT16,
mem_large_cube_sid,
- file_large_cube_sid,
- xfer_plist,
+ file_large_cube_sid,
+ xfer_plist,
large_cube_buf_1);
CHECK(ret, FAIL, "H5Dread");
- /* verify that the expected data and only the
+ /* verify that the expected data and only the
* expected data was read.
*/
start_index = (u * edge_size * edge_size * edge_size * edge_size) +
@@ -2268,7 +2262,7 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
} /* end for */
if(mis_match)
TestErrPrintf("large cube written from small cube has bad data! Line=%d\n", __LINE__);
-
+
x++;
} while((large_rank >= 2) && (small_rank <= 1) && (x < edge_size));
w++;
@@ -2311,10 +2305,10 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
/****************************************************************
**
-** test_select_hyper_contig_dr(): Test H5S (dataspace)
-** selection code with contiguous source and target having
+** test_select_hyper_contig_dr(): Test H5S (dataspace)
+** selection code with contiguous source and target having
** different ranks but the same shape. We have already
-** tested H5S_shape_same in isolation, so now we try to do
+** tested H5S_shape_same in isolation, so now we try to do
** I/O.
**
****************************************************************/
@@ -2379,12 +2373,12 @@ test_select_hyper_contig_dr(hid_t dset_type, hid_t xfer_plist)
/****************************************************************
**
-** test_select_hyper_checker_board_dr__select_checker_board():
-** Given an n-cube data space with each edge of length
+** test_select_hyper_checker_board_dr__select_checker_board():
+** Given an n-cube data space with each edge of length
** edge_size, and a checker_edge_size either select a checker
** board selection of the entire cube(if sel_rank == n),
** or select a checker board selection of a
-** sel_rank dimensional slice through n-cube parallel to the
+** sel_rank dimensional slice through n-cube parallel to the
** sel_rank fastest changing indices, with origin (in the
** higher indices) as indicated by the start array.
**
@@ -2440,7 +2434,7 @@ test_select_hyper_checker_board_dr__select_checker_board(hid_t tgt_n_cube_sid,
offset_count++;
/* Now set up the stride and block arrays, and portions of the start
- * and count arrays that will not be altered during the selection of
+ * and count arrays that will not be altered during the selection of
* the checker board.
*/
u = 0;
@@ -2469,7 +2463,7 @@ test_select_hyper_checker_board_dr__select_checker_board(hid_t tgt_n_cube_sid,
u++;
} /* end while */
-
+
i = 0;
do {
if(0 >= sel_offset) {
@@ -2484,7 +2478,7 @@ test_select_hyper_checker_board_dr__select_checker_board(hid_t tgt_n_cube_sid,
} /* end if */
j = 0;
- do {
+ do {
if(1 >= sel_offset) {
if(j == 0 ) {
start[1] = 0;
@@ -2537,22 +2531,22 @@ test_select_hyper_checker_board_dr__select_checker_board(hid_t tgt_n_cube_sid,
if(((i + j + k + l + m) % 2) == 0) {
if(first_selection) {
- first_selection = FALSE;
+ first_selection = FALSE;
- ret = H5Sselect_hyperslab(tgt_n_cube_sid,
+ ret = H5Sselect_hyperslab(tgt_n_cube_sid,
H5S_SELECT_SET,
- &(start[n_cube_offset]),
- &(stride[n_cube_offset]),
- &(count[n_cube_offset]),
+ &(start[n_cube_offset]),
+ &(stride[n_cube_offset]),
+ &(count[n_cube_offset]),
&(block[n_cube_offset]));
CHECK(ret, FAIL, "H5Sselect_hyperslab");
} /* end if */
else {
- ret = H5Sselect_hyperslab(tgt_n_cube_sid,
+ ret = H5Sselect_hyperslab(tgt_n_cube_sid,
H5S_SELECT_OR,
- &(start[n_cube_offset]),
- &(stride[n_cube_offset]),
- &(count[n_cube_offset]),
+ &(start[n_cube_offset]),
+ &(stride[n_cube_offset]),
+ &(count[n_cube_offset]),
&(block[n_cube_offset]));
CHECK(ret, FAIL, "H5Sselect_hyperslab");
} /* end else */
@@ -2590,21 +2584,21 @@ test_select_hyper_checker_board_dr__select_checker_board(hid_t tgt_n_cube_sid,
/****************************************************************
**
-** test_select_hyper_checker_board_dr__verify_data():
+** test_select_hyper_checker_board_dr__verify_data():
**
-** Examine the supplied buffer to see if it contains the
-** expected data. Return TRUE if it does, and FALSE
+** Examine the supplied buffer to see if it contains the
+** expected data. Return TRUE if it does, and FALSE
** otherwise.
**
** The supplied buffer is presumed to contain the results
-** of read or writing a checkerboard selection of an
+** of read or writing a checkerboard selection of an
** n-cube, or a checkerboard selection of an m (1 <= m < n)
-** dimensional slice through an n-cube parallel to the
-** fastest changing indices.
+** dimensional slice through an n-cube parallel to the
+** fastest changing indices.
**
** It is further presumed that the buffer was zeroed before
-** the read, and that the n-cube was initialize with the
-** natural numbers listed in order from the origin along
+** the read, and that the n-cube was initialize with the
+** natural numbers listed in order from the origin along
** the fastest changing axis.
**
** Thus for a 10x10x10 3-cube, the value stored in location
@@ -2613,19 +2607,19 @@ test_select_hyper_checker_board_dr__select_checker_board(hid_t tgt_n_cube_sid,
**
** (10 * 10 * x) + (10 * y) + z
**
-** Thus, if the buffer contains the result of reading a
+** Thus, if the buffer contains the result of reading a
** checker board selection of a 10x10x10 3-cube, location
** (x, y, z) will contain zero if it is not in a checker,
** and 100x + 10y + z if (x, y, z) is in a checker.
**
-** If the buffer contains the result of reading a 3
+** If the buffer contains the result of reading a 3
** dimensional slice (parallel to the three fastest changing
-** indices) through an n cube (n > 3), then the expected
+** indices) through an n cube (n > 3), then the expected
** values in the buffer will be the same, save that we will
-** add a constant determined by the origin of the 3-cube
+** add a constant determined by the origin of the 3-cube
** in the n-cube.
**
-** Finally, the function presumes that the first element
+** Finally, the function presumes that the first element
** of the buffer resides either at the origin of either
** a selected or an unselected checker.
**
@@ -2685,7 +2679,7 @@ test_select_hyper_checker_board_dr__verify_data(uint16_t * buf_ptr,
l = 0;
y = 0;
start_in_checker[3] = start_in_checker[2];
- do {
+ do {
if(y >= checker_edge_size) {
start_in_checker[3] = ! start_in_checker[3];
y = 0;
@@ -2699,7 +2693,7 @@ test_select_hyper_checker_board_dr__verify_data(uint16_t * buf_ptr,
in_checker = ! in_checker;
z = 0;
} /* end if */
-
+
if(in_checker) {
if(*val_ptr != expected_value)
good_data = FALSE;
@@ -2708,10 +2702,10 @@ test_select_hyper_checker_board_dr__verify_data(uint16_t * buf_ptr,
if(*val_ptr != 0)
good_data = FALSE;
} /* end else */
-
+
val_ptr++;
expected_value++;
-
+
m++;
z++;
} while((rank >= (test_max_rank - 4)) && (m < edge_size));
@@ -2734,10 +2728,10 @@ test_select_hyper_checker_board_dr__verify_data(uint16_t * buf_ptr,
/****************************************************************
**
-** test_select_hyper_checker_board_dr__run_test(): Test H5S
-** (dataspace) selection code with checker board source and
-** target selections having different ranks but the same
-** shape. We have already tested H5S_shape_same in
+** test_select_hyper_checker_board_dr__run_test(): Test H5S
+** (dataspace) selection code with checker board source and
+** target selections having different ranks but the same
+** shape. We have already tested H5S_shape_same in
** isolation, so now we try to do I/O.
**
****************************************************************/
@@ -2862,11 +2856,11 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
/* if chunk edge size is greater than zero, set up the small and
- * large data set creation property lists to specify chunked
+ * large data set creation property lists to specify chunked
* datasets.
*/
if(chunk_edge_size > 0) {
- chunk_dims[0] = chunk_dims[1] =
+ chunk_dims[0] = chunk_dims[1] =
chunk_dims[2] = chunk_dims[3] = chunk_dims[4] = chunk_edge_size;
small_cube_dcpl_id = H5Pcreate(H5P_DATASET_CREATE);
@@ -2891,7 +2885,7 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
/* create the small cube dataset */
- small_cube_dataset = H5Dcreate2(fid, "small_cube_dataset", dset_type,
+ small_cube_dataset = H5Dcreate2(fid, "small_cube_dataset", dset_type,
file_small_cube_sid, H5P_DEFAULT, small_cube_dcpl_id, H5P_DEFAULT);
CHECK(small_cube_dataset, FAIL, "H5Dcreate2");
@@ -2902,7 +2896,7 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
} /* end if */
/* create the large cube dataset */
- large_cube_dataset = H5Dcreate2(fid, "large_cube_dataset", dset_type,
+ large_cube_dataset = H5Dcreate2(fid, "large_cube_dataset", dset_type,
file_large_cube_sid, H5P_DEFAULT, large_cube_dcpl_id, H5P_DEFAULT);
CHECK(large_cube_dataset, FAIL, "H5Dcreate2");
@@ -2914,17 +2908,17 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
/* write initial data to the on disk datasets */
- ret = H5Dwrite(small_cube_dataset, H5T_NATIVE_UINT16, full_small_cube_sid,
+ ret = H5Dwrite(small_cube_dataset, H5T_NATIVE_UINT16, full_small_cube_sid,
full_small_cube_sid, xfer_plist, cube_buf);
CHECK(ret, FAIL, "H5Dwrite");
- ret = H5Dwrite(large_cube_dataset, H5T_NATIVE_UINT16, full_large_cube_sid,
+ ret = H5Dwrite(large_cube_dataset, H5T_NATIVE_UINT16, full_large_cube_sid,
full_large_cube_sid, xfer_plist, cube_buf);
CHECK(ret, FAIL, "H5Dwrite");
/* read initial small cube data from disk and verify that it is as expected. */
- ret = H5Dread(small_cube_dataset, H5T_NATIVE_UINT16, full_small_cube_sid,
+ ret = H5Dread(small_cube_dataset, H5T_NATIVE_UINT16, full_small_cube_sid,
full_small_cube_sid, xfer_plist, small_cube_buf_1);
CHECK(ret, FAIL, "H5Dread");
@@ -2933,7 +2927,7 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
edge_size, small_rank);
/* read initial large cube data from disk and verify that it is as expected. */
- ret = H5Dread(large_cube_dataset, H5T_NATIVE_UINT16, full_large_cube_sid,
+ ret = H5Dread(large_cube_dataset, H5T_NATIVE_UINT16, full_large_cube_sid,
full_large_cube_sid, xfer_plist, large_cube_buf_1);
CHECK(ret, FAIL, "H5Dread");
@@ -2946,11 +2940,11 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
* of different rank that H5S_select_shape_same() views as being of the
* same shape.
*
- * Start by reading small_rank-D slice from the on disk large cube, and
- * verifying that the data read is correct. Verify that H5S_select_shape_same()
+ * Start by reading small_rank-D slice from the on disk large cube, and
+ * verifying that the data read is correct. Verify that H5S_select_shape_same()
* returns true on the memory and file selections.
*
- * The first step is to set up the needed checker board selection in the
+ * The first step is to set up the needed checker board selection in the
* in memory small small cube
*/
@@ -2963,8 +2957,8 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
small_rank,
sel_start);
- /* now read slices from the large, on-disk cube into the small cube.
- * Note how we adjust sel_start only in the dimensions peculiar to the
+ /* now read slices from the large, on-disk cube into the small cube.
+ * Note how we adjust sel_start only in the dimensions peculiar to the
* large cube.
*/
@@ -3009,10 +3003,10 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
sel_start
);
- /* verify that H5S_select_shape_same() reports the two
+ /* verify that H5S_select_shape_same() reports the two
* selections as having the same shape.
*/
- check = H5S_select_shape_same_test(mem_small_cube_sid,
+ check = H5S_select_shape_same_test(mem_small_cube_sid,
file_large_cube_sid);
VERIFY(check, TRUE, "H5S_select_shape_same_test");
@@ -3047,18 +3041,18 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
TestErrPrintf("small cube read from largecube has bad data! Line=%d\n",__LINE__);
x++;
- } while((large_rank >= (test_max_rank - 3)) &&
+ } while((large_rank >= (test_max_rank - 3)) &&
(small_rank <= (test_max_rank - 4)) && (x < edge_size));
w++;
- } while((large_rank >= (test_max_rank - 2)) &&
+ } while((large_rank >= (test_max_rank - 2)) &&
(small_rank <= (test_max_rank - 3)) && (w < edge_size));
v++;
- } while((large_rank >= (test_max_rank - 1)) &&
+ } while((large_rank >= (test_max_rank - 1)) &&
(small_rank <= (test_max_rank - 2)) && (v < edge_size));
u++;
- } while((large_rank >= test_max_rank) &&
+ } while((large_rank >= test_max_rank) &&
(small_rank <= (test_max_rank - 1)) && (u < edge_size));
-
+
/* similarly, read the on disk small cube into slices through the in memory
* large cube, and verify that the correct data (and only the correct data)
@@ -3116,10 +3110,10 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
sel_start
);
- /* verify that H5S_select_shape_same() reports the two
+ /* verify that H5S_select_shape_same() reports the two
* selections as having the same shape.
*/
- check = H5S_select_shape_same_test(file_small_cube_sid,
+ check = H5S_select_shape_same_test(file_small_cube_sid,
mem_large_cube_sid);
VERIFY(check, TRUE, "H5S_select_shape_same_test");
@@ -3137,7 +3131,7 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
CHECK(ret, FAIL, "H5Dread");
- /* verify that the expected data and only the
+ /* verify that the expected data and only the
* expected data was read.
*/
data_ok = TRUE;
@@ -3185,29 +3179,29 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
TestErrPrintf("large cube read from small cube has bad data! Line=%d\n",__LINE__);
x++;
- } while((large_rank >= (test_max_rank - 3)) &&
+ } while((large_rank >= (test_max_rank - 3)) &&
(small_rank <= (test_max_rank - 4)) && (x < edge_size));
w++;
- } while((large_rank >= (test_max_rank - 2)) &&
+ } while((large_rank >= (test_max_rank - 2)) &&
(small_rank <= (test_max_rank - 3)) && (w < edge_size));
v++;
- } while((large_rank >= (test_max_rank - 1)) &&
+ } while((large_rank >= (test_max_rank - 1)) &&
(small_rank <= (test_max_rank - 2)) && (v < edge_size));
u++;
- } while((large_rank >= test_max_rank) &&
+ } while((large_rank >= test_max_rank) &&
(small_rank <= (test_max_rank - 1)) && (u < edge_size));
- /* now we go in the opposite direction, verifying that we can write
- * from memory to file using selections of different rank that
+ /* now we go in the opposite direction, verifying that we can write
+ * from memory to file using selections of different rank that
* H5S_select_shape_same() views as being of the same shape.
*
- * Start by writing small_rank D slices from the in memory large cube, to
+ * Start by writing small_rank D slices from the in memory large cube, to
* the the on disk small cube dataset. After each write, read the small
* cube dataset back from disk, and verify that it contains the expected
- * data. Verify that H5S_select_shape_same() returns true on the
+ * data. Verify that H5S_select_shape_same() returns true on the
* memory and file selections.
- */
+ */
/* select a checker board in the file small cube dataspace */
sel_start[0] = sel_start[1] = sel_start[2] = sel_start[3] = sel_start[4] = 0;
@@ -3239,11 +3233,11 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
sel_start[3] = x;
/* zero out the on disk small cube */
- ret = H5Dwrite(small_cube_dataset,
- H5T_NATIVE_UINT16,
- full_small_cube_sid,
- full_small_cube_sid,
- xfer_plist,
+ ret = H5Dwrite(small_cube_dataset,
+ H5T_NATIVE_UINT16,
+ full_small_cube_sid,
+ full_small_cube_sid,
+ xfer_plist,
zero_buf);
CHECK(ret, FAIL, "H5Dwrite");
@@ -3269,22 +3263,22 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
sel_start
);
- /* verify that H5S_select_shape_same() reports the two
+ /* verify that H5S_select_shape_same() reports the two
* selections as having the same shape.
*/
- check = H5S_select_shape_same_test(file_small_cube_sid,
+ check = H5S_select_shape_same_test(file_small_cube_sid,
mem_large_cube_sid);
VERIFY(check, TRUE, "H5S_select_shape_same_test");
- /* write the slice from the in memory large cube to the
- * on disk small cube
+ /* write the slice from the in memory large cube to the
+ * on disk small cube
*/
- ret = H5Dwrite(small_cube_dataset,
- H5T_NATIVE_UINT16,
- mem_large_cube_sid,
- file_small_cube_sid,
- xfer_plist,
+ ret = H5Dwrite(small_cube_dataset,
+ H5T_NATIVE_UINT16,
+ mem_large_cube_sid,
+ file_small_cube_sid,
+ xfer_plist,
cube_buf);
CHECK(ret, FAIL, "H5Dwrite");
@@ -3293,11 +3287,11 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
HDmemset(small_cube_buf_1, 0, sizeof(*small_cube_buf_1) * small_cube_size);
/* read the on disk small cube into memory */
- ret = H5Dread(small_cube_dataset,
+ ret = H5Dread(small_cube_dataset,
H5T_NATIVE_UINT16,
full_small_cube_sid,
- full_small_cube_sid,
- xfer_plist,
+ full_small_cube_sid,
+ xfer_plist,
small_cube_buf_1);
CHECK(ret, FAIL, "H5Dread");
@@ -3320,24 +3314,24 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
TestErrPrintf("small cube read from largecube has bad data! Line=%d\n",__LINE__);
x++;
- } while((large_rank >= (test_max_rank - 3)) &&
+ } while((large_rank >= (test_max_rank - 3)) &&
(small_rank <= (test_max_rank - 4)) && (x < edge_size));
w++;
- } while((large_rank >= (test_max_rank - 2)) &&
+ } while((large_rank >= (test_max_rank - 2)) &&
(small_rank <= (test_max_rank - 3)) && (w < edge_size));
v++;
- } while((large_rank >= (test_max_rank - 1)) &&
+ } while((large_rank >= (test_max_rank - 1)) &&
(small_rank <= (test_max_rank - 2)) && (v < edge_size));
u++;
- } while((large_rank >= test_max_rank) &&
+ } while((large_rank >= test_max_rank) &&
(small_rank <= (test_max_rank - 1)) && (u < edge_size));
- /* Now write checker board selections of the entries in memory
- * small cube to slices of the on disk cube. After each write,
- * read the on disk large cube * into memeory, and verify that
- * it contains the expected * data. Verify that
- * H5S_select_shape_same() returns true on the memory and file
+ /* Now write checker board selections of the entries in memory
+ * small cube to slices of the on disk cube. After each write,
+ * read the on disk large cube * into memeory, and verify that
+ * it contains the expected * data. Verify that
+ * H5S_select_shape_same() returns true on the memory and file
* selections.
*/
@@ -3371,11 +3365,11 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
sel_start[3] = x;
/* zero out the on disk cube */
- ret = H5Dwrite(large_cube_dataset,
- H5T_NATIVE_USHORT,
- full_large_cube_sid,
- full_large_cube_sid,
- xfer_plist,
+ ret = H5Dwrite(large_cube_dataset,
+ H5T_NATIVE_USHORT,
+ full_large_cube_sid,
+ full_large_cube_sid,
+ xfer_plist,
zero_buf);
CHECK(ret, FAIL, "H5Dwrite");
@@ -3401,10 +3395,10 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
sel_start
);
- /* verify that H5S_select_shape_same() reports the two
+ /* verify that H5S_select_shape_same() reports the two
* selections as having the same shape.
*/
- check = H5S_select_shape_same_test(file_large_cube_sid,
+ check = H5S_select_shape_same_test(file_large_cube_sid,
mem_small_cube_sid);
VERIFY(check, TRUE, "H5S_select_shape_same_test");
@@ -3413,11 +3407,11 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
* small cube to a slice through the on disk large
* cube.
*/
- ret = H5Dwrite(large_cube_dataset,
- H5T_NATIVE_UINT16,
- mem_small_cube_sid,
- file_large_cube_sid,
- xfer_plist,
+ ret = H5Dwrite(large_cube_dataset,
+ H5T_NATIVE_UINT16,
+ mem_small_cube_sid,
+ file_large_cube_sid,
+ xfer_plist,
cube_buf);
CHECK(ret, FAIL, "H5Dwrite");
@@ -3426,16 +3420,16 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
HDmemset(large_cube_buf_1, 0, sizeof(*large_cube_buf_1) * large_cube_size);
/* read the on disk large cube into memory */
- ret = H5Dread(large_cube_dataset,
+ ret = H5Dread(large_cube_dataset,
H5T_NATIVE_UINT16,
full_large_cube_sid,
- full_large_cube_sid,
- xfer_plist,
+ full_large_cube_sid,
+ xfer_plist,
large_cube_buf_1);
CHECK(ret, FAIL, "H5Dread");
- /* verify that the expected data and only the
+ /* verify that the expected data and only the
* expected data was written to the on disk large
* cube.
*/
@@ -3485,18 +3479,18 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
TestErrPrintf("large cube written from small cube has bad data! Line=%d\n",__LINE__);
x++;
- } while((large_rank >= (test_max_rank - 3)) &&
+ } while((large_rank >= (test_max_rank - 3)) &&
(small_rank <= (test_max_rank - 4)) && (x < edge_size));
w++;
- } while((large_rank >= (test_max_rank - 2)) &&
+ } while((large_rank >= (test_max_rank - 2)) &&
(small_rank <= (test_max_rank - 3)) && (w < edge_size));
v++;
- } while((large_rank >= (test_max_rank - 1)) &&
+ } while((large_rank >= (test_max_rank - 1)) &&
(small_rank <= (test_max_rank - 2)) && (v < edge_size));
u++;
- } while((large_rank >= test_max_rank) &&
+ } while((large_rank >= test_max_rank) &&
(small_rank <= (test_max_rank - 1)) && (u < edge_size));
-
+
/* Close memory dataspaces */
ret = H5Sclose(full_small_cube_sid);
@@ -4931,11 +4925,12 @@ test_select_hyper_union(void)
HDfree(rbuf);
} /* test_select_hyper_union() */
+#ifdef NEW_HYPERSLAB_API
/****************************************************************
**
** test_select_hyper_union_stagger(): Test basic H5S (dataspace) selection code.
** Tests unions of staggered hyperslabs. (Uses H5Scombine_hyperslab
-** and H5Smodify_select instead of H5Sselect_hyperslab)
+** and H5Sselect_select instead of H5Sselect_hyperslab)
**
****************************************************************/
static void
@@ -5039,8 +5034,8 @@ test_select_hyper_union_stagger(void)
CHECK(error, FAIL, "H5Sselect_hyperslab");
/* Combine the copied dataspace with the temporary dataspace */
- error=H5Smodify_select(tmp_space,H5S_SELECT_OR,tmp2_space);
- CHECK(error, FAIL, "H5Smodify_select");
+ error=H5Sselect_select(tmp_space,H5S_SELECT_OR,tmp2_space);
+ CHECK(error, FAIL, "H5Sselect_select");
/* Create Memory Dataspace */
memspace=H5Screate_simple(memrank,dimsm,NULL);
@@ -5287,109 +5282,7 @@ test_select_hyper_union_3d(void)
HDfree(wbuf);
HDfree(rbuf);
} /* test_select_hyper_union_3d() */
-
-/****************************************************************
-**
-** test_select_hyper_valid_combination(): Tests invalid and valid
-** combinations of selections on dataspace for H5Scombine_select
-** and H5Smodify_select.
-**
-****************************************************************/
-static void
-test_select_hyper_valid_combination(void)
-{
- hid_t single_pt_sid; /* Dataspace ID with single point selection */
- hid_t single_hyper_sid; /* Dataspace ID with single block hyperslab selection */
- hid_t regular_hyper_sid; /* Dataspace ID with regular hyperslab selection */
- hid_t non_existent_sid = -1; /* A non-existent space id */
- hid_t tmp_sid; /* Temporary dataspace ID */
- hsize_t dims2D[] = {SPACE9_DIM1, SPACE9_DIM2};
- hsize_t dims3D[] = {SPACE4_DIM1, SPACE4_DIM2, SPACE4_DIM3};
-
- hsize_t coord1[1][SPACE2_RANK]; /* Coordinates for single point selection */
- hsize_t start[SPACE4_RANK]; /* Hyperslab start */
- hsize_t stride[SPACE4_RANK]; /* Hyperslab stride */
- hsize_t count[SPACE4_RANK]; /* Hyperslab block count */
- hsize_t block[SPACE4_RANK]; /* Hyperslab block size */
- herr_t ret; /* Generic return value */
-
- /* Output message about test being performed */
- MESSAGE(6, ("Testing Selection Combination Validity\n"));
- assert(SPACE9_DIM2>=POINT1_NPOINTS);
-
- /* Create dataspace for single point selection */
- single_pt_sid = H5Screate_simple(SPACE9_RANK, dims2D, NULL);
- CHECK(single_pt_sid, FAIL, "H5Screate_simple");
-
- /* Select sequence of ten points for multiple point selection */
- coord1[0][0] = 2; coord1[0][1] = 2;
- ret = H5Sselect_elements(single_pt_sid, H5S_SELECT_SET, (size_t)1, (const hsize_t *)coord1);
- CHECK(ret, FAIL, "H5Sselect_elements");
-
- /* Create dataspace for single hyperslab selection */
- single_hyper_sid = H5Screate_simple(SPACE9_RANK, dims2D, NULL);
- CHECK(single_hyper_sid, FAIL, "H5Screate_simple");
-
- /* Select 10x10 hyperslab for single hyperslab selection */
- start[0]=1; start[1]=1;
- stride[0]=1; stride[1]=1;
- count[0]=1; count[1]=1;
- block[0]=(SPACE9_DIM1-2); block[1]=(SPACE9_DIM2-2);
- ret = H5Sselect_hyperslab(single_hyper_sid,H5S_SELECT_SET,start,stride,count,block);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* Create dataspace for regular hyperslab selection */
- regular_hyper_sid = H5Screate_simple(SPACE4_RANK, dims3D, NULL);
- CHECK(regular_hyper_sid, FAIL, "H5Screate_simple");
-
- /* Select regular, strided hyperslab selection */
- start[0]=2; start[1]=2; start[2]=2;
- stride[0]=2; stride[1]=2; stride[2]=2;
- count[0]=5; count[1]=2; count[2]=5;
- block[0]=1; block[1]=1; block[2]=1;
- ret = H5Sselect_hyperslab(regular_hyper_sid,H5S_SELECT_SET,start,stride,count,block);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
-
- /* Test all the selections created */
-
- /* Test the invalid combinations between point and hyperslab */
- tmp_sid = H5Scombine_select(single_pt_sid, H5S_SELECT_AND, single_hyper_sid);
- VERIFY(tmp_sid, FAIL, "H5Scombine_select");
-
- tmp_sid = H5Smodify_select(single_pt_sid, H5S_SELECT_AND, single_hyper_sid);
- VERIFY(tmp_sid, FAIL, "H5Smodify_select");
-
- /* Test the invalid combination between two hyperslab but of different dimension size */
- tmp_sid = H5Scombine_select(single_hyper_sid, H5S_SELECT_AND, regular_hyper_sid);
- VERIFY(tmp_sid, FAIL, "H5Scombine_select");
-
- tmp_sid = H5Smodify_select(single_hyper_sid, H5S_SELECT_AND, regular_hyper_sid);
- VERIFY(tmp_sid, FAIL, "H5Smodify_select");
-
- /* Test invalid operation inputs to the two functions */
- tmp_sid = H5Scombine_select(single_hyper_sid, H5S_SELECT_SET, single_hyper_sid);
- VERIFY(tmp_sid, FAIL, "H5Scombine_select");
-
- tmp_sid = H5Smodify_select(single_hyper_sid, H5S_SELECT_SET, single_hyper_sid);
- VERIFY(tmp_sid, FAIL, "H5Smodify_select");
-
- /* Test inputs in case of non-existent space ids */
- tmp_sid = H5Scombine_select(single_hyper_sid, H5S_SELECT_AND, non_existent_sid);
- VERIFY(tmp_sid, FAIL, "H5Scombine_select");
-
- tmp_sid = H5Smodify_select(single_hyper_sid, H5S_SELECT_AND, non_existent_sid);
- VERIFY(tmp_sid, FAIL, "H5Smodify_select");
-
- /* Close dataspaces */
- ret = H5Sclose(single_pt_sid);
- CHECK(ret, FAIL, "H5Sclose");
- ret = H5Sclose(single_hyper_sid);
- CHECK(ret, FAIL, "H5Sclose");
- ret = H5Sclose(regular_hyper_sid);
- CHECK(ret, FAIL, "H5Sclose");
-} /* test_select_hyper_valid_combination() */
-
+#endif /* NEW_HYPERSLAB_API */
/****************************************************************
**
@@ -12014,8 +11907,7 @@ test_space_rebuild(void)
hid_t sid_irreg1,sid_irreg2,sid_irreg3,sid_irreg4,sid_irreg5;
/* rebuild status state */
- H5S_diminfo_valid_t rebuild_stat1,rebuild_stat2;
- htri_t rebuild_check;
+ htri_t rebuild_stat,rebuild_check;
herr_t ret;
/* dimensions of rank 1 to rank 5 */
@@ -12084,23 +11976,19 @@ test_space_rebuild(void)
ret = H5Sselect_hyperslab(sid_reg1,H5S_SELECT_OR,start1,stride1,count1,block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- ret = H5S_get_rebuild_status_test(sid_reg1,&rebuild_stat1,&rebuild_stat2);
- CHECK(ret, FAIL, "H5S_get_rebuild_status_test");
- /* In this case, rebuild_stat1 and rebuild_stat2 should be
- * H5S_DIMINFO_VALID_YES. */
- if(rebuild_stat1 != H5S_DIMINFO_VALID_YES) {
+ rebuild_stat = FALSE;
+ rebuild_stat = H5S_get_rebuild_status_test(sid_reg1);
+ assert(rebuild_stat!=FAIL);
+ /* In this case, rebuild_stat should be TRUE. */
+ if(!rebuild_stat){
ret = FAIL;
CHECK(ret,FAIL,"H5S_hyper_rebuild");
- } /* end if */
- if(rebuild_stat2 != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
- } /* end if */
- if(ret != FAIL) {
+ }
+ else {
/* In this case, rebuild_check should be TRUE. */
rebuild_check = H5S_select_shape_same_test(sid_reg1,sid_reg_ori1);
CHECK(rebuild_check,FALSE,"H5S_hyper_rebuild");
- } /* end if */
+ }
/* For irregular hyperslab */
sid_irreg1 = H5Screate_simple(SPACERE1_RANK,dims1,NULL);
@@ -12120,19 +12008,14 @@ test_space_rebuild(void)
ret = H5Sselect_hyperslab(sid_irreg1,H5S_SELECT_OR,start1,stride1,count1,block1);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- ret = H5S_get_rebuild_status_test(sid_irreg1,&rebuild_stat1,&rebuild_stat2);
- CHECK(ret, FAIL, "H5S_get_rebuild_status_test");
- /* In this case, rebuild_stat1 should be H5S_DIMINFO_VALID_NO and
- * rebuild_stat2 should be H5S_DIMINFO_VALID_IMPOSSIBLE. */
- if(rebuild_stat1 != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
- } /* end if */
- if(rebuild_stat2 != H5S_DIMINFO_VALID_IMPOSSIBLE) {
+ rebuild_stat = TRUE;
+ rebuild_stat = H5S_get_rebuild_status_test(sid_irreg1);
+ assert(rebuild_stat!=FAIL);
+ /* In this case, rebuild_stat should be FALSE. */
+ if(rebuild_stat){
ret = FAIL;
CHECK(ret,FAIL,"H5S_hyper_rebuild");
- } /* end if */
- /* No need to do shape comparision */
+ }/* No need to do shape comparision */
MESSAGE(7, ("Testing functionality to rebuild 2-D hyperslab selection\n"));
@@ -12172,23 +12055,19 @@ test_space_rebuild(void)
ret = H5Sselect_hyperslab(sid_reg2,H5S_SELECT_OR,start2,stride2,count2,block2);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- ret = H5S_get_rebuild_status_test(sid_reg2,&rebuild_stat1,&rebuild_stat2);
- CHECK(ret, FAIL, "H5S_get_rebuild_status_test");
- /* In this case, rebuild_stat1 and rebuild_stat2 should be
- * H5S_DIMINFO_VALID_YES. */
- if(rebuild_stat1 != H5S_DIMINFO_VALID_YES) {
+ rebuild_stat = FALSE;
+ rebuild_stat = H5S_get_rebuild_status_test(sid_reg2);
+ assert(rebuild_stat!=FAIL);
+ /* In this case, rebuild_stat should be TRUE. */
+ if(!rebuild_stat){
ret = FAIL;
CHECK(ret,FAIL,"H5S_hyper_rebuild");
- } /* end if */
- if(rebuild_stat2 != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
- } /* end if */
- if(ret != FAIL) {
+ }
+ else {
/* In this case, rebuild_check should be TRUE. */
rebuild_check = H5S_select_shape_same_test(sid_reg2,sid_reg_ori2);
CHECK(rebuild_check,FALSE,"H5S_hyper_rebuild");
- } /* end if */
+ }
/* 2-D irregular case */
sid_irreg2 = H5Screate_simple(SPACERE2_RANK,dims2,NULL);
@@ -12213,19 +12092,14 @@ test_space_rebuild(void)
ret = H5Sselect_hyperslab(sid_irreg2,H5S_SELECT_OR,start2,stride2,count2,block2);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- ret = H5S_get_rebuild_status_test(sid_irreg2,&rebuild_stat1,&rebuild_stat2);
- CHECK(ret, FAIL, "H5S_get_rebuild_status_test");
- /* In this case, rebuild_stat1 should be H5S_DIMINFO_VALID_NO and
- * rebuild_stat2 should be H5S_DIMINFO_VALID_IMPOSSIBLE. */
- if(rebuild_stat1 != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
- } /* end if */
- if(rebuild_stat2 != H5S_DIMINFO_VALID_IMPOSSIBLE) {
+ rebuild_stat = TRUE;
+ rebuild_stat = H5S_get_rebuild_status_test(sid_irreg2);
+ assert(rebuild_stat!=FAIL);
+ /* In this case, rebuild_stat should be FALSE. */
+ if(rebuild_stat){
ret = FAIL;
CHECK(ret,FAIL,"H5S_hyper_rebuild");
- } /* end if */
- /* No need to do shape comparision */
+ }/* No need to do shape comparision */
MESSAGE(7, ("Testing functionality to rebuild 3-D hyperslab selection\n"));
@@ -12270,23 +12144,20 @@ test_space_rebuild(void)
ret = H5Sselect_hyperslab(sid_reg3,H5S_SELECT_OR,start3,stride3,count3,block3);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- ret = H5S_get_rebuild_status_test(sid_reg3,&rebuild_stat1,&rebuild_stat2);
- CHECK(ret, FAIL, "H5S_get_rebuild_status_test");
- /* In this case, rebuild_stat1 and rebuild_stat2 should be
- * H5S_DIMINFO_VALID_YES. */
- if(rebuild_stat1 != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
- } /* end if */
- if(rebuild_stat2 != H5S_DIMINFO_VALID_YES) {
+ rebuild_stat = FALSE;
+ rebuild_stat = H5S_get_rebuild_status_test(sid_reg3);
+ assert(rebuild_stat!=FAIL);
+
+ /* In this case, rebuild_stat should be TRUE. */
+ if(!rebuild_stat){
ret = FAIL;
CHECK(ret,FAIL,"H5S_hyper_rebuild");
- } /* end if */
- if(ret != FAIL) {
+ }
+ else {
/* In this case, rebuild_check should be TRUE. */
rebuild_check = H5S_select_shape_same_test(sid_reg3,sid_reg_ori3);
CHECK(rebuild_check,FALSE,"H5S_hyper_rebuild");
- } /* end if */
+ }
sid_irreg3 = H5Screate_simple(SPACERE3_RANK,dims3,NULL);
@@ -12316,19 +12187,14 @@ test_space_rebuild(void)
ret = H5Sselect_hyperslab(sid_irreg3,H5S_SELECT_OR,start3,stride3,count3,block3);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- ret = H5S_get_rebuild_status_test(sid_irreg3,&rebuild_stat1,&rebuild_stat2);
- CHECK(ret, FAIL, "H5S_get_rebuild_status_test");
- /* In this case, rebuild_stat1 should be H5S_DIMINFO_VALID_NO and
- * rebuild_stat2 should be H5S_DIMINFO_VALID_IMPOSSIBLE. */
- if(rebuild_stat1 != H5S_DIMINFO_VALID_NO) {
+ rebuild_stat = TRUE;
+ rebuild_stat = H5S_get_rebuild_status_test(sid_irreg3);
+ assert(rebuild_stat!=FAIL);
+ /* In this case, rebuild_stat should be FALSE. */
+ if(rebuild_stat){
ret = FAIL;
CHECK(ret,FAIL,"H5S_hyper_rebuild");
- } /* end if */
- if(rebuild_stat2 != H5S_DIMINFO_VALID_IMPOSSIBLE) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
- } /* end if */
- /* No need to do shape comparision */
+ }/* No need to do shape comparision */
MESSAGE(7, ("Testing functionality to rebuild 4-D hyperslab selection\n"));
@@ -12381,23 +12247,19 @@ test_space_rebuild(void)
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- ret = H5S_get_rebuild_status_test(sid_reg4,&rebuild_stat1,&rebuild_stat2);
- CHECK(ret, FAIL, "H5S_get_rebuild_status_test");
- /* In this case, rebuild_stat1 and rebuild_stat2 should be
- * H5S_DIMINFO_VALID_YES. */
- if(rebuild_stat1 != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
- } /* end if */
- if(rebuild_stat2 != H5S_DIMINFO_VALID_YES) {
+ rebuild_stat = FALSE;
+ rebuild_stat = H5S_get_rebuild_status_test(sid_reg4);
+ assert(rebuild_stat!=FAIL);
+ /* In this case, rebuild_stat should be TRUE. */
+ if(!rebuild_stat){
ret = FAIL;
CHECK(ret,FAIL,"H5S_hyper_rebuild");
- } /* end if */
- if(ret != FAIL) {
+ }
+ else {
/* In this case, rebuild_check should be TRUE. */
rebuild_check = H5S_select_shape_same_test(sid_reg4,sid_reg_ori4);
CHECK(rebuild_check,FALSE,"H5S_hyper_rebuild");
- } /* end if */
+ }
/* Testing irregular selection */
sid_irreg4 = H5Screate_simple(SPACERE4_RANK,dims4,NULL);
@@ -12438,19 +12300,14 @@ test_space_rebuild(void)
ret = H5Sselect_hyperslab(sid_irreg4,H5S_SELECT_OR,start4,stride4,count4,block4);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- ret = H5S_get_rebuild_status_test(sid_irreg4,&rebuild_stat1,&rebuild_stat2);
- CHECK(ret, FAIL, "H5S_get_rebuild_status_test");
- /* In this case, rebuild_stat1 should be H5S_DIMINFO_VALID_NO and
- * rebuild_stat2 should be H5S_DIMINFO_VALID_IMPOSSIBLE. */
- if(rebuild_stat1 != H5S_DIMINFO_VALID_NO) {
+ rebuild_stat = TRUE;
+ rebuild_stat = H5S_get_rebuild_status_test(sid_irreg4);
+ assert(rebuild_stat!=FAIL);
+ /* In this case, rebuild_stat should be FALSE. */
+ if(rebuild_stat){
ret = FAIL;
CHECK(ret,FAIL,"H5S_hyper_rebuild");
- } /* end if */
- if(rebuild_stat2 != H5S_DIMINFO_VALID_IMPOSSIBLE) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
- } /* end if */
- /* No need to do shape comparision */
+ }/* No need to do shape comparision */
MESSAGE(7, ("Testing functionality to rebuild 5-D hyperslab selection\n"));
@@ -12487,7 +12344,7 @@ test_space_rebuild(void)
ret = H5Sselect_hyperslab(sid_reg_ori5,H5S_SELECT_SET,start5,stride5,count5,block5);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- /* Build up five dimensional regular selection with H5_SELECT_OR, inside HDF5,
+ /* Build up four dimensional regular selection with H5_SELECT_OR, inside HDF5,
it will be treated as an irregular selection. */
start5[4] = 1;
count5[4] = 1;
@@ -12507,23 +12364,19 @@ test_space_rebuild(void)
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- ret = H5S_get_rebuild_status_test(sid_reg5,&rebuild_stat1,&rebuild_stat2);
- CHECK(ret, FAIL, "H5S_get_rebuild_status_test");
- /* In this case, rebuild_stat1 and rebuild_stat2 should be
- * H5S_DIMINFO_VALID_YES. */
- if(rebuild_stat1 != H5S_DIMINFO_VALID_YES) {
+ rebuild_stat = FALSE;
+ rebuild_stat = H5S_get_rebuild_status_test(sid_reg5);
+ assert(rebuild_stat!=FAIL);
+ /* In this case, rebuild_stat should be TRUE. */
+ if(!rebuild_stat){
ret = FAIL;
CHECK(ret,FAIL,"H5S_hyper_rebuild");
- } /* end if */
- if(rebuild_stat2 != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
- } /* end if */
- if(ret != FAIL) {
+ }
+ else {
/* In this case, rebuild_check should be TRUE. */
rebuild_check = H5S_select_shape_same_test(sid_reg5,sid_reg_ori5);
CHECK(rebuild_check,FALSE,"H5S_hyper_rebuild");
- } /* end if */
+ }
sid_irreg5 = H5Screate_simple(SPACERE5_RANK,dims5,NULL);
@@ -12569,19 +12422,14 @@ test_space_rebuild(void)
ret = H5Sselect_hyperslab(sid_irreg5,H5S_SELECT_OR,start5,stride5,count5,block5);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- ret = H5S_get_rebuild_status_test(sid_irreg5,&rebuild_stat1,&rebuild_stat2);
- CHECK(ret, FAIL, "H5S_get_rebuild_status_test");
- /* In this case, rebuild_stat1 should be H5S_DIMINFO_VALID_NO and
- * rebuild_stat2 should be H5S_DIMINFO_VALID_IMPOSSIBLE. */
- if(rebuild_stat1 != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
- } /* end if */
- if(rebuild_stat2 != H5S_DIMINFO_VALID_IMPOSSIBLE) {
+ rebuild_stat = TRUE;
+ rebuild_stat = H5S_get_rebuild_status_test(sid_irreg5);
+ assert(rebuild_stat!=FAIL);
+ /* In this case, rebuild_stat should be FALSE. */
+ if(rebuild_stat){
ret = FAIL;
CHECK(ret,FAIL,"H5S_hyper_rebuild");
- } /* end if */
- /* No need to do shape comparision */
+ }/* No need to do shape comparision */
/* We use 5-D to test a special case with
rebuilding routine TRUE, FALSE and TRUE */
@@ -12615,20 +12463,13 @@ test_space_rebuild(void)
ret = H5Sselect_hyperslab(sid_spec,H5S_SELECT_SET,start5,stride5,count5,block5);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- ret = H5S_get_rebuild_status_test(sid_spec,&rebuild_stat1,&rebuild_stat2);
- CHECK(ret, FAIL, "H5S_get_rebuild_status_test");
- /* In this case, rebuild_stat1 and rebuild_stat2 should both be
- * H5S_DIMINFO_VALID_YES. */
- if(rebuild_stat1 != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
- } /* end if */
- if(rebuild_stat2 != H5S_DIMINFO_VALID_YES) {
+ rebuild_stat = FALSE;
+ rebuild_stat = H5S_get_rebuild_status_test(sid_spec);
+ /* In this case, rebuild_stat should be TRUE. */
+ if(!rebuild_stat){
ret = FAIL;
CHECK(ret,FAIL,"H5S_hyper_rebuild");
- } /* end if */
- /* No need to do shape comparision */
+ }/* No need to do shape comparision */
/* Adding some selections to make it real irregular */
start5[3] = 1;
@@ -12644,21 +12485,15 @@ test_space_rebuild(void)
ret = H5Sselect_hyperslab(sid_spec,H5S_SELECT_OR,start5,stride5,count5,block5);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- ret = H5S_get_rebuild_status_test(sid_spec,&rebuild_stat1,&rebuild_stat2);
- CHECK(ret, FAIL, "H5S_get_rebuild_status_test");
- /* In this case, rebuild_stat1 should be H5S_DIMINFO_VALID_NO and
- * rebuild_stat2 should be H5S_DIMINFO_VALID_IMPOSSIBLE. */
- if(rebuild_stat1 != H5S_DIMINFO_VALID_NO) {
+ rebuild_stat = TRUE;
+ rebuild_stat = H5S_get_rebuild_status_test(sid_spec);
+ assert(rebuild_stat!=FAIL);
+ /* In this case, rebuild_stat should be FALSE. */
+ if(rebuild_stat){
ret = FAIL;
CHECK(ret,FAIL,"H5S_hyper_rebuild");
- } /* end if */
- if(rebuild_stat2 != H5S_DIMINFO_VALID_IMPOSSIBLE) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
- } /* end if */
- /* No need to do shape comparision */
+ }/* No need to do shape comparision */
- /* Add more selections to make it regular again */
start5[3] = 5;
count5[3] = 1;
stride5[3] = 4;
@@ -12672,19 +12507,14 @@ test_space_rebuild(void)
ret = H5Sselect_hyperslab(sid_spec,H5S_SELECT_OR,start5,stride5,count5,block5);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
- ret = H5S_get_rebuild_status_test(sid_spec,&rebuild_stat1,&rebuild_stat2);
- CHECK(ret, FAIL, "H5S_get_rebuild_status_test");
- /* In this case, rebuild_stat1 should be H5S_DIMINFO_VALID_NO and
- * rebuild_stat2 should be H5S_DIMINFO_VALID_YES. */
- if(rebuild_stat1 != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret,FAIL,"H5S_hyper_rebuild");
- } /* end if */
- if(rebuild_stat2 != H5S_DIMINFO_VALID_YES) {
+ rebuild_stat = FALSE;
+ rebuild_stat = H5S_get_rebuild_status_test(sid_spec);
+ assert(rebuild_stat!=FAIL);
+ /* In this case, rebuild_stat should be FALSE. */
+ if(!rebuild_stat){
ret = FAIL;
CHECK(ret,FAIL,"H5S_hyper_rebuild");
- } /* end if */
- /* No need to do shape comparision */
+ }/* No need to do shape comparision */
H5Sclose(sid_reg1);
CHECK(ret, FAIL, "H5Sclose");
@@ -12718,791 +12548,6 @@ test_space_rebuild(void)
/****************************************************************
**
-** test_space_update_diminfo(): Tests selection diminfo update
-** routine. We will test whether regular selections can be
-** quickly updated when the selection is modified.
-**
-**
-****************************************************************/
-static void
-test_space_update_diminfo(void)
-{
- hid_t space_id; /* Dataspace id */
- H5S_diminfo_valid_t diminfo_valid; /* Diminfo status */
- H5S_diminfo_valid_t rebuild_status; /* Diminfo status after rebuid */
- H5S_sel_type sel_type; /* Selection type */
- herr_t ret; /* Return value */
-
- /* dimensions of rank 1 to rank 5 */
- hsize_t dims1[] ={SPACEUD1_DIM0};
- hsize_t dims3[] ={SPACEUD3_DIM0, SPACEUD3_DIM1, SPACEUD3_DIM2};
-
- /* The start of the hyperslab */
- hsize_t start1[1], start3[3];
-
- /* The stride of the hyperslab */
- hsize_t stride1[1], stride3[3];
-
- /* The number of blocks for the hyperslab */
- hsize_t count1[1], count3[3];
-
- /* The size of each block for the hyperslab */
- hsize_t block1[1], block3[3];
-
-
- /* Output message about test being performed */
- MESSAGE(6, ("Testing functionality to update hyperslab dimension info\n"));
-
-
- MESSAGE(7, ("Testing functionality to update 1-D hyperslab dimension info\n"));
-
- /*
- * Test adding regularly spaced distinct blocks
- */
-
- /* Create 1-D dataspace */
- space_id = H5Screate_simple(1, dims1, NULL);
-
- /* Create single block */
- start1[0] = 3;
- count1[0] = 1;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, NULL, count1, block1);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be YES */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- /* Add block after first, with OR */
- start1[0] = 6;
- count1[0] = 1;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be YES */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- /* Add block before first, this time with XOR */
- start1[0] = 0;
- count1[0] = 1;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_XOR, start1, NULL, count1, block1);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be YES */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- /* Add two blocks after current block */
- start1[0] = 9;
- stride1[0] = 3;
- count1[0] = 2;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, stride1, count1, block1);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be YES */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- /* Add two blocks overlapping current block, with OR */
- start1[0] = 9;
- stride1[0] = 3;
- count1[0] = 2;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, stride1, count1, block1);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be YES */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- /* Add two blocks partially overlapping current block, with OR */
- start1[0] = 12;
- stride1[0] = 3;
- count1[0] = 2;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, stride1, count1, block1);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be YES */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- /* Add two blocks partially overlapping current block, with XOR */
- start1[0] = 15;
- stride1[0] = 3;
- count1[0] = 2;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_XOR, start1, stride1, count1, block1);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be NO, after rebuild it should be IMPOSSIBLE */
- ret = H5S_get_rebuild_status_test(space_id, &diminfo_valid,
- &rebuild_status);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
- if(rebuild_status != H5S_DIMINFO_VALID_IMPOSSIBLE) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_rebuild");
- } /* end if */
-
- /* Fill in missing block */
- start1[0] = 15;
- count1[0] = 1;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_XOR, start1, NULL, count1, block1);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be NO, after rebuild it should be YES */
- ret = H5S_get_rebuild_status_test(space_id, &diminfo_valid,
- &rebuild_status);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
- if(rebuild_status != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_rebuild");
- } /* end if */
-
- /*
- * Test adding contiguous blocks
- */
-
- /* Create single block */
- start1[0] = 3;
- count1[0] = 1;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, NULL, count1, block1);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be YES */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- /* Add block immediately after first, with OR */
- start1[0] = 5;
- count1[0] = 1;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be YES */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- /* Add block immediately before first, with XOR */
- start1[0] = 1;
- count1[0] = 1;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be YES */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- /* Add differently size block immediately after current, with OR */
- start1[0] = 7;
- count1[0] = 1;
- block1[0] = 7;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be YES */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- /*
- * Test adding overlapping blocks
- */
-
- /* Create single block */
- start1[0] = 3;
- count1[0] = 1;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, NULL, count1, block1);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be YES */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- /* Add block completely overlapping first, with OR */
- start1[0] = 3;
- count1[0] = 1;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be YES */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- /* Add block parially overlapping first, with OR */
- start1[0] = 4;
- count1[0] = 1;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be YES */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- /* Add block completely enclosing current, with OR */
- start1[0] = 2;
- count1[0] = 1;
- block1[0] = 5;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be YES */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- /* Add block completely enclosed by current, with OR */
- start1[0] = 3;
- count1[0] = 1;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be YES */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- /* Add equally sized block parially overlapping current, with XOR */
- start1[0] = 3;
- count1[0] = 1;
- block1[0] = 5;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_XOR, start1, NULL, count1, block1);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be YES */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- /* Fill in hole in block */
- start1[0] = 3;
- count1[0] = 1;
- block1[0] = 4;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be NO, after rebuild it should be YES */
- ret = H5S_get_rebuild_status_test(space_id, &diminfo_valid,
- &rebuild_status);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
- if(rebuild_status != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_rebuild");
- } /* end if */
-
- /* Add differently sized block parially overlapping current, with XOR */
- start1[0] = 4;
- count1[0] = 1;
- block1[0] = 5;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_XOR, start1, NULL, count1, block1);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be NO */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- /* Fill in hole in block */
- start1[0] = 4;
- count1[0] = 1;
- block1[0] = 4;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be NO, after rebuild it should be YES */
- ret = H5S_get_rebuild_status_test(space_id, &diminfo_valid,
- &rebuild_status);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
- if(rebuild_status != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_rebuild");
- } /* end if */
-
- /* Add block completely overlapping current, with XOR */
- start1[0] = 2;
- count1[0] = 1;
- block1[0] = 7;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_XOR, start1, NULL, count1, block1);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- sel_type = H5Sget_select_type(space_id);
- VERIFY(sel_type, H5S_SEL_NONE, "H5Sget_select_type");
-
- /*
- * Test various conditions that break the fast algorithm
- */
-
- /* Create multiple blocks */
- start1[0] = 3;
- stride1[0] = 3;
- count1[0] = 2;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, stride1, count1, block1);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be YES */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- /* Create single block with start out of phase */
- start1[0] = 8;
- count1[0] = 1;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be NO */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- /* Create multiple blocks */
- start1[0] = 3;
- stride1[0] = 3;
- count1[0] = 2;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, stride1, count1, block1);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be YES */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- /* Create multiple blocks with start out of phase */
- start1[0] = 8;
- stride1[0] = 3;
- count1[0] = 2;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, stride1, count1, block1);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be NO */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- /* Create multiple blocks */
- start1[0] = 3;
- stride1[0] = 3;
- count1[0] = 2;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, stride1, count1, block1);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be YES */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- /* Create multiple blocks with wrong stride */
- start1[0] = 9;
- stride1[0] = 4;
- count1[0] = 2;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, stride1, count1, block1);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be NO */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- /* Create single block */
- start1[0] = 3;
- count1[0] = 1;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, NULL, count1, block1);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be YES */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- /* Create single block with wrong size */
- start1[0] = 6;
- count1[0] = 1;
- block1[0] = 1;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be NO */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- /* Create single block */
- start1[0] = 3;
- count1[0] = 1;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, NULL, count1, block1);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be YES */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- /* Create multiple blocks with wrong size */
- start1[0] = 6;
- stride1[0] = 3;
- count1[0] = 2;
- block1[0] = 1;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, stride1, count1, block1);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be NO */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- /* Create multiple blocks */
- start1[0] = 3;
- stride1[0] = 3;
- count1[0] = 2;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, stride1, count1, block1);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be YES */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- /* Create single block with wrong size */
- start1[0] = 9;
- count1[0] = 1;
- block1[0] = 1;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, NULL, count1, block1);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be NO */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- /* Create multiple blocks */
- start1[0] = 3;
- stride1[0] = 3;
- count1[0] = 2;
- block1[0] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start1, stride1, count1, block1);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be YES */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- /* Create multiple blocks with wrong size */
- start1[0] = 9;
- stride1[0] = 3;
- count1[0] = 2;
- block1[0] = 1;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start1, stride1, count1, block1);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be NO */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- ret = H5Sclose(space_id);
- CHECK(ret, FAIL, "H5Sclose");
-
-
- MESSAGE(7, ("Testing functionality to update 3-D hyperslab dimension info\n"));
-
- /* Create 3-D dataspace */
- space_id = H5Screate_simple(3, dims3, NULL);
-
- /* Create multiple blocks */
- start3[0] = 0;
- start3[1] = 1;
- start3[2] = 2;
- stride3[0] = 2;
- stride3[1] = 3;
- stride3[2] = 4;
- count3[0] = 4;
- count3[1] = 3;
- count3[2] = 2;
- block3[0] = 1;
- block3[1] = 2;
- block3[2] = 3;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start3, stride3, count3, block3);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be YES */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- /* Add blocks with same values in all dimensions */
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start3, stride3, count3, block3);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be YES */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- /* Add blocks with same values in two dimensions */
- start3[0] = 8;
- stride3[0] = 1;
- count3[0] = 1;
- block3[0] = 1;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start3, stride3, count3, block3);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be YES */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- /* Create multiple blocks */
- start3[0] = 0;
- start3[1] = 1;
- start3[2] = 2;
- stride3[0] = 2;
- stride3[1] = 3;
- stride3[2] = 4;
- count3[0] = 4;
- count3[1] = 3;
- count3[2] = 2;
- block3[0] = 1;
- block3[1] = 2;
- block3[2] = 3;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start3, stride3, count3, block3);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be YES */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- /* Add blocks with same values in one dimension */
- start3[0] = 8;
- start3[1] = 10;
- stride3[0] = 1;
- stride3[1] = 1;
- count3[0] = 1;
- count3[1] = 1;
- block3[0] = 1;
- block3[1] = 2;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start3, stride3, count3, block3);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be NO */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- /* Create multiple blocks */
- start3[0] = 0;
- start3[1] = 1;
- start3[2] = 2;
- stride3[0] = 2;
- stride3[1] = 3;
- stride3[2] = 4;
- count3[0] = 4;
- count3[1] = 3;
- count3[2] = 2;
- block3[0] = 1;
- block3[1] = 2;
- block3[2] = 3;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start3, stride3, count3, block3);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be YES */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_YES) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- /* Add blocks with same values in no dimensions */
- start3[0] = 8;
- start3[1] = 10;
- start3[2] = 10;
- stride3[0] = 1;
- stride3[1] = 1;
- stride3[2] = 1;
- count3[0] = 1;
- count3[1] = 1;
- count3[2] = 1;
- block3[0] = 1;
- block3[1] = 2;
- block3[2] = 3;
- ret = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, start3, stride3, count3, block3);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* diminfo_valid should be NO */
- ret = H5S_get_diminfo_status_test(space_id, &diminfo_valid);
- CHECK(ret, FAIL, "H5S_get_diminfo_status_test");
- if(diminfo_valid != H5S_DIMINFO_VALID_NO) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5S_hyper_update_diminfo");
- } /* end if */
-
- ret = H5Sclose(space_id);
- CHECK(ret, FAIL, "H5Sclose");
-} /* end test_space_update_diminfo() */
-
-
-/****************************************************************
-**
** test_select_hyper_chunk_offset(): Tests selections on dataspace,
** verify that offsets for hyperslab selections are working in
** chunked datasets.
@@ -14022,270 +13067,6 @@ test_select_bounds(void)
CHECK(ret, FAIL, "H5Sclose");
} /* test_select_bounds() */
-
-/****************************************************************
-**
-** test_internal_consistency(): Tests selections on dataspace, then
-** verify that internal states of data structures of selections are
-** consistent.
-**
-****************************************************************/
-static void
-test_internal_consistency(void)
-{
- hid_t all_sid; /* Dataspace ID with "all" selection */
- hid_t none_sid; /* Dataspace ID with "none" selection */
- hid_t single_pt_sid; /* Dataspace ID with single point selection */
- hid_t mult_pt_sid; /* Dataspace ID with multiple point selection */
- hid_t single_hyper_sid; /* Dataspace ID with single block hyperslab selection */
- hid_t single_hyper_all_sid; /* Dataspace ID with single block hyperslab
- * selection that is the entire dataspace
- */
- hid_t single_hyper_pt_sid; /* Dataspace ID with single block hyperslab
- * selection that is the same as the single
- * point selection
- */
- hid_t regular_hyper_sid; /* Dataspace ID with regular hyperslab selection */
- hid_t irreg_hyper_sid; /* Dataspace ID with irregular hyperslab selection */
- hid_t none_hyper_sid; /* Dataspace ID with "no hyperslabs" selection */
- hid_t scalar_all_sid; /* ID for scalar dataspace with "all" selection */
- hid_t scalar_none_sid; /* ID for scalar dataspace with "none" selection */
- hid_t tmp_sid; /* Temporary dataspace ID */
- hsize_t dims[] = {SPACE9_DIM1, SPACE9_DIM2};
- hsize_t coord1[1][SPACE2_RANK]; /* Coordinates for single point selection */
- hsize_t coord2[SPACE9_DIM2][SPACE9_RANK]; /* Coordinates for multiple point selection */
- hsize_t start[SPACE9_RANK]; /* Hyperslab start */
- hsize_t stride[SPACE9_RANK]; /* Hyperslab stride */
- hsize_t count[SPACE9_RANK]; /* Hyperslab block count */
- hsize_t block[SPACE9_RANK]; /* Hyperslab block size */
- htri_t check; /* Shape comparison return value */
- herr_t ret; /* Generic return value */
-
- /* Output message about test being performed */
- MESSAGE(6, ("Testing Consistency of Internal States\n"));
- assert(SPACE9_DIM2>=POINT1_NPOINTS);
-
- /* Create dataspace for "all" selection */
- all_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
- CHECK(all_sid, FAIL, "H5Screate_simple");
-
- /* Select entire extent for dataspace */
- ret = H5Sselect_all(all_sid);
- CHECK(ret, FAIL, "H5Sselect_all");
-
- /* Create dataspace for "none" selection */
- none_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
- CHECK(none_sid, FAIL, "H5Screate_simple");
-
- /* Un-Select entire extent for dataspace */
- ret = H5Sselect_none(none_sid);
- CHECK(ret, FAIL, "H5Sselect_none");
-
- /* Create dataspace for single point selection */
- single_pt_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
- CHECK(single_pt_sid, FAIL, "H5Screate_simple");
-
- /* Select sequence of ten points for multiple point selection */
- coord1[0][0] = 2; coord1[0][1] = 2;
- ret = H5Sselect_elements(single_pt_sid, H5S_SELECT_SET, (size_t)1, (const hsize_t *)coord1);
- CHECK(ret, FAIL, "H5Sselect_elements");
-
- /* Create dataspace for multiple point selection */
- mult_pt_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
- CHECK(mult_pt_sid, FAIL, "H5Screate_simple");
-
- /* Select sequence of ten points for multiple point selection */
- coord2[0][0]=2; coord2[0][1]=2;
- coord2[1][0]=7; coord2[1][1]=2;
- coord2[2][0]=1; coord2[2][1]=4;
- coord2[3][0]=2; coord2[3][1]=6;
- coord2[4][0]=0; coord2[4][1]=8;
- coord2[5][0]=3; coord2[5][1]=2;
- coord2[6][0]=4; coord2[6][1]=4;
- coord2[7][0]=1; coord2[7][1]=0;
- coord2[8][0]=5; coord2[8][1]=1;
- coord2[9][0]=9; coord2[9][1]=3;
- ret = H5Sselect_elements(mult_pt_sid, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord2);
- CHECK(ret, FAIL, "H5Sselect_elements");
-
- /* Create dataspace for single hyperslab selection */
- single_hyper_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
- CHECK(single_hyper_sid, FAIL, "H5Screate_simple");
-
- /* Select 10x10 hyperslab for single hyperslab selection */
- start[0]=1; start[1]=1;
- stride[0]=1; stride[1]=1;
- count[0]=1; count[1]=1;
- block[0]=(SPACE9_DIM1-2); block[1]=(SPACE9_DIM2-2);
- ret = H5Sselect_hyperslab(single_hyper_sid,H5S_SELECT_SET,start,stride,count,block);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* Create dataspace for single hyperslab selection with entire extent selected */
- single_hyper_all_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
- CHECK(single_hyper_all_sid, FAIL, "H5Screate_simple");
-
- /* Select entire extent for hyperslab selection */
- start[0]=0; start[1]=0;
- stride[0]=1; stride[1]=1;
- count[0]=1; count[1]=1;
- block[0]=SPACE9_DIM1; block[1]=SPACE9_DIM2;
- ret = H5Sselect_hyperslab(single_hyper_all_sid,H5S_SELECT_SET,start,stride,count,block);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* Create dataspace for single hyperslab selection with single point selected */
- single_hyper_pt_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
- CHECK(single_hyper_pt_sid, FAIL, "H5Screate_simple");
-
- /* Select entire extent for hyperslab selection */
- start[0]=2; start[1]=2;
- stride[0]=1; stride[1]=1;
- count[0]=1; count[1]=1;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(single_hyper_pt_sid,H5S_SELECT_SET,start,stride,count,block);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* Create dataspace for regular hyperslab selection */
- regular_hyper_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
- CHECK(regular_hyper_sid, FAIL, "H5Screate_simple");
-
- /* Select regular, strided hyperslab selection */
- start[0]=2; start[1]=2;
- stride[0]=2; stride[1]=2;
- count[0]=5; count[1]=2;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(regular_hyper_sid,H5S_SELECT_SET,start,stride,count,block);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* Create dataspace for irregular hyperslab selection */
- irreg_hyper_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
- CHECK(irreg_hyper_sid, FAIL, "H5Screate_simple");
-
- /* Create irregular hyperslab selection by OR'ing two blocks together */
- start[0]=2; start[1]=2;
- stride[0]=1; stride[1]=1;
- count[0]=1; count[1]=1;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(irreg_hyper_sid,H5S_SELECT_SET,start,stride,count,block);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- start[0]=4; start[1]=4;
- stride[0]=1; stride[1]=1;
- count[0]=1; count[1]=1;
- block[0]=3; block[1]=3;
- ret = H5Sselect_hyperslab(irreg_hyper_sid,H5S_SELECT_OR,start,stride,count,block);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* Create dataspace for "no" hyperslab selection */
- none_hyper_sid = H5Screate_simple(SPACE9_RANK, dims, NULL);
- CHECK(none_hyper_sid, FAIL, "H5Screate_simple");
-
- /* Create "no" hyperslab selection by XOR'ing same blocks together */
- start[0]=2; start[1]=2;
- stride[0]=1; stride[1]=1;
- count[0]=1; count[1]=1;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(none_hyper_sid,H5S_SELECT_SET,start,stride,count,block);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- ret = H5Sselect_hyperslab(none_hyper_sid,H5S_SELECT_XOR,start,stride,count,block);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* Create scalar dataspace for "all" selection */
- scalar_all_sid = H5Screate(H5S_SCALAR);
- CHECK(scalar_all_sid, FAIL, "H5Screate");
-
- /* Create scalar dataspace for "none" selection */
- scalar_none_sid = H5Screate(H5S_SCALAR);
- CHECK(scalar_none_sid, FAIL, "H5Screate");
-
- /* Un-Select entire extent for dataspace */
- ret = H5Sselect_none(scalar_none_sid);
- CHECK(ret, FAIL, "H5Sselect_none");
-
- /* Test all the selections created */
-
- /* Test the copy of itself */
- tmp_sid=H5Scopy(all_sid);
- CHECK(tmp_sid, FAIL, "H5Scopy");
-
- check=H5S_internal_consistency_test(tmp_sid);
- VERIFY(check, TRUE, "H5S_internal_consistency_test");
-
- ret = H5Sclose(tmp_sid);
- CHECK(ret, FAIL, "H5Sclose");
-
- /* Test "none" selection */
- check=H5S_internal_consistency_test(none_sid);
- VERIFY(check, TRUE, "H5S_internal_consistency_test");
-
- /* Test single point selection */
- check=H5S_internal_consistency_test(single_pt_sid);
- VERIFY(check, TRUE, "H5S_internal_consistency_test");
-
- /* Test multiple point selection */
- check=H5S_internal_consistency_test(mult_pt_sid);
- VERIFY(check, TRUE, "H5S_internal_consistency_test");
-
- /* Test "plain" single hyperslab selection */
- check=H5S_internal_consistency_test(single_hyper_sid);
- VERIFY(check, TRUE, "H5S_internal_consistency_test");
-
- /* Test "all" single hyperslab selection */
- check=H5S_internal_consistency_test(single_hyper_all_sid);
- VERIFY(check, TRUE, "H5S_internal_consistency_test");
-
- /* Test "single point" single hyperslab selection */
- check=H5S_internal_consistency_test(single_hyper_pt_sid);
- VERIFY(check, TRUE, "H5S_internal_consistency_test");
-
- /* Test regular, strided hyperslab selection */
- check=H5S_internal_consistency_test(regular_hyper_sid);
- VERIFY(check, TRUE, "H5S_internal_consistency_test");
-
- /* Test irregular hyperslab selection */
- check=H5S_internal_consistency_test(irreg_hyper_sid);
- VERIFY(check, TRUE, "H5S_internal_consistency_test");
-
- /* Test "no" hyperslab selection */
- check=H5S_internal_consistency_test(none_hyper_sid);
- VERIFY(check, TRUE, "H5S_internal_consistency_test");
-
- /* Test scalar "all" hyperslab selection */
- check = H5S_internal_consistency_test(scalar_all_sid);
- VERIFY(check, TRUE, "H5S_internal_consistency_test");
-
- /* Test scalar "none" hyperslab selection */
- check = H5S_internal_consistency_test(scalar_none_sid);
- VERIFY(check, TRUE, "H5S_internal_consistency_test");
-
- /* Close dataspaces */
- ret = H5Sclose(all_sid);
- CHECK(ret, FAIL, "H5Sclose");
- ret = H5Sclose(none_sid);
- CHECK(ret, FAIL, "H5Sclose");
- ret = H5Sclose(single_pt_sid);
- CHECK(ret, FAIL, "H5Sclose");
- ret = H5Sclose(mult_pt_sid);
- CHECK(ret, FAIL, "H5Sclose");
- ret = H5Sclose(single_hyper_sid);
- CHECK(ret, FAIL, "H5Sclose");
- ret = H5Sclose(single_hyper_all_sid);
- CHECK(ret, FAIL, "H5Sclose");
- ret = H5Sclose(single_hyper_pt_sid);
- CHECK(ret, FAIL, "H5Sclose");
- ret = H5Sclose(regular_hyper_sid);
- CHECK(ret, FAIL, "H5Sclose");
- ret = H5Sclose(irreg_hyper_sid);
- CHECK(ret, FAIL, "H5Sclose");
- ret = H5Sclose(none_hyper_sid);
- CHECK(ret, FAIL, "H5Sclose");
- ret = H5Sclose(scalar_all_sid);
- CHECK(ret, FAIL, "H5Sclose");
- ret = H5Sclose(scalar_none_sid);
- CHECK(ret, FAIL, "H5Sclose");
-} /* test_internal_consistency() */
-
-
/****************************************************************
**
** test_select(): Main H5S selection testing routine.
@@ -14354,12 +13135,10 @@ test_select(void)
test_select_hyper_offset2();/* Test more selection offset code with hyperslabs */
test_select_point_offset(); /* Test selection offset code with elements */
test_select_hyper_union(); /* Test hyperslab union code */
-
- /* Fancy hyperslab API tests */
+#ifdef NEW_HYPERSLAB_API
test_select_hyper_union_stagger(); /* Test hyperslab union code for staggered slabs */
test_select_hyper_union_3d(); /* Test hyperslab union code for 3-D dataset */
- test_select_hyper_valid_combination(); /* Test different input combinations */
-
+#endif /* NEW_HYPERSLAB_API */
test_select_hyper_and_2d(); /* Test hyperslab intersection (AND) code for 2-D dataset */
test_select_hyper_xor_2d(); /* Test hyperslab XOR code for 2-D dataset */
test_select_hyper_notb_2d(); /* Test hyperslab NOTB code for 2-D dataset */
@@ -14435,14 +13214,13 @@ test_select(void)
/* Test "re-build" routine */
test_space_rebuild();
- /* Test "update diminfo" routine */
- test_space_update_diminfo();
/* Test point selections in chunked datasets */
test_select_point_chunk();
/* Test scalar dataspaces in chunked datasets */
test_select_scalar_chunk();
+
/* Test using selection offset on hyperslab in chunked dataset */
test_select_hyper_chunk_offset();
test_select_hyper_chunk_offset2();
@@ -14450,9 +13228,6 @@ test_select(void)
/* Test selection bounds with & without offsets */
test_select_bounds();
- /* Test the consistency of internal data structures of selection */
- test_internal_consistency();
-
} /* test_select() */
diff --git a/tools/h5copy/h5copy.c b/tools/h5copy/h5copy.c
index b5965ba..278cd3e 100644
--- a/tools/h5copy/h5copy.c
+++ b/tools/h5copy/h5copy.c
@@ -475,7 +475,7 @@ main (int argc, const char *argv[])
/* free link info path */
if (linkinfo.trg_path)
- HDfree((char*)linkinfo.trg_path);
+ HDfree(linkinfo.trg_path);
/* close propertis */
if(H5Pclose(ocpl_id)<0)
@@ -496,7 +496,7 @@ error:
/* free link info path */
if (linkinfo.trg_path)
- HDfree((char*)linkinfo.trg_path);
+ HDfree(linkinfo.trg_path);
H5E_BEGIN_TRY {
H5Pclose(ocpl_id);
diff --git a/tools/h5diff/CMakeTests.cmake b/tools/h5diff/CMakeTests.cmake
index 686803b..c650dbe 100644
--- a/tools/h5diff/CMakeTests.cmake
+++ b/tools/h5diff/CMakeTests.cmake
@@ -1072,12 +1072,7 @@ ADD_H5_TEST (h5diff_80 1 -v ${FILE7} ${FILE8})
ADD_H5_TEST (h5diff_90 0 -v ${FILE2} ${FILE2})
# 10. read by hyperslab, print indexes
-#if test -n "$pmode" -a "$mydomainname" = hdfgroup.uiuc.edu; then
-# # skip this test which sometimes hangs in some THG machines
-# message (STATUS "SKIP -v ${FILE9} ${FILE10})
-#else
-# ADD_H5_TEST (h5diff_100 1 -v ${FILE9} ${FILE10})
-#fi
+ADD_H5_TEST (h5diff_100 1 -v ${FILE9} ${FILE10})
# 11. floating point comparison
ADD_H5_TEST (h5diff_101 1 -v ${FILE1} ${FILE1} g1/d1 g1/d2)
diff --git a/tools/h5diff/testh5diff.sh.in b/tools/h5diff/testh5diff.sh.in
index ee8a09b..3be0b80 100644
--- a/tools/h5diff/testh5diff.sh.in
+++ b/tools/h5diff/testh5diff.sh.in
@@ -807,12 +807,7 @@ TOOLTEST h5diff_80.txt -v h5diff_dset1.h5 h5diff_dset2.h5
TOOLTEST h5diff_90.txt -v h5diff_basic2.h5 h5diff_basic2.h5
# 10. read by hyperslab, print indexes
-if test -n "$pmode" -a "$mydomainname" = hdfgroup.uiuc.edu; then
- # skip this test which sometimes hangs in some THG machines
- SKIP -v h5diff_hyper1.h5 h5diff_hyper2.h5
-else
- TOOLTEST h5diff_100.txt -v h5diff_hyper1.h5 h5diff_hyper2.h5
-fi
+TOOLTEST h5diff_100.txt -v h5diff_hyper1.h5 h5diff_hyper2.h5
# 11. floating point comparison
# double value
diff --git a/tools/h5dump/CMakeTests.cmake b/tools/h5dump/CMakeTests.cmake
index f9ebc32..afb482e 100644
--- a/tools/h5dump/CMakeTests.cmake
+++ b/tools/h5dump/CMakeTests.cmake
@@ -50,6 +50,7 @@
${HDF5_TOOLS_SRC_DIR}/testfiles/tbin4.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/tbinregR.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/tbigdims.ddl
+ ${HDF5_TOOLS_SRC_DIR}/testfiles/tbitnopaque.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/tboot1.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/tboot2.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/tboot2A.ddl
@@ -206,6 +207,7 @@
${HDF5_TOOLS_SRC_DIR}/testfiles/tattrreg.h5
${HDF5_TOOLS_SRC_DIR}/testfiles/tbigdims.h5
${HDF5_TOOLS_SRC_DIR}/testfiles/tbinary.h5
+ ${HDF5_TOOLS_SRC_DIR}/testfiles/tbitnopaque.h5
${HDF5_TOOLS_SRC_DIR}/testfiles/tchar.h5
${HDF5_TOOLS_SRC_DIR}/testfiles/tcmpdattrintsize.h5
${HDF5_TOOLS_SRC_DIR}/testfiles/tcmpdintarray.h5
@@ -805,6 +807,8 @@
tbinregR.out.err
tbigdims.out
tbigdims.out.err
+ tbitnopaque.out
+ tbitnopaque.out.err
tboot1.out
tboot1.out.err
tboot2.out
@@ -1147,6 +1151,8 @@
ADD_H5ERR_MASK_TEST (tcomp-3 0 "--enable-error-stack;-t;/#6632;-g;/group2;tcompound.h5")
# test complicated compound datatype
ADD_H5_TEST (tcomp-4 0 --enable-error-stack tcompound_complex.h5)
+ # tests for bitfields and opaque data types
+ ADD_H5_TEST (tbitnopaque 0 --enable-error-stack tbitnopaque.h5)
#test for the nested compound type
ADD_H5_TEST (tnestcomp-1 0 --enable-error-stack tnestedcomp.h5)
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index 1a823c4..82273a3 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -109,6 +109,7 @@
#define FILE77 "tcmpdints.h5"
#define FILE78 "tscalarintattrsize.h5"
#define FILE79 "tintsattrs.h5"
+#define FILE80 "tbitnopaque.h5"
/*-------------------------------------------------------------------------
* prototypes
@@ -349,6 +350,8 @@ typedef struct s1_t {
#define F77_DATASETNAME2 "CompoundRInts"
#define F77_LENGTH 64
+#define F80_DIM32 32
+
static void
gent_group(void)
{
@@ -9575,6 +9578,156 @@ gent_intsattrs(void)
H5Fclose(fid);
}
+static void gent_bitnopaquefields(void)
+{
+ /* Compound datatype */
+ typedef struct s_t
+ {
+ unsigned char a;
+ unsigned int b;
+ unsigned long c;
+ unsigned long long d;
+ } s_t;
+ hid_t file, grp=-1, type=-1, space=-1, dset=-1;
+ size_t i;
+ hsize_t nelmts = F80_DIM32;
+ unsigned char buf[F80_DIM32]; /* bitfield, opaque */
+ unsigned int buf2[F80_DIM32]; /* bitfield, opaque */
+ unsigned long buf3[F80_DIM32]; /* bitfield, opaque */
+ unsigned long long buf4[F80_DIM32]; /* bitfield, opaque */
+ s_t buf5[F80_DIM32]; /* compound */
+
+ file = H5Fcreate(FILE80, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ if ((grp = H5Gcreate2(file, "bittypetests", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ /* bitfield_1 */
+ if ((type = H5Tcopy(H5T_STD_B8LE)) >= 0) {
+ if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) {
+ if ((dset = H5Dcreate2(grp, "bitfield_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ for (i = 0; i < nelmts; i++) {
+ buf[i] = (unsigned char)0xff ^ (unsigned char)i;
+ }
+ H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ H5Dclose(dset);
+ }
+ H5Sclose(space);
+ }
+ H5Tclose(type);
+ }
+
+ /* bitfield_2 */
+ if ((type = H5Tcopy(H5T_STD_B16LE)) >= 0) {
+ if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) {
+ if ((dset = H5Dcreate2(grp, "bitfield_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ for (i = 0; i < nelmts; i++) {
+ buf2[i] = (unsigned int)0xffff ^ (unsigned int)(i * 16);
+ }
+ H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2);
+ H5Dclose(dset);
+ }
+ H5Sclose(space);
+ }
+ H5Tclose(type);
+ }
+
+ /* bitfield_3 */
+ if ((type = H5Tcopy(H5T_STD_B32LE)) >= 0) {
+ if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) {
+ if ((dset = H5Dcreate2(grp, "bitfield_3", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ for (i = 0; i < nelmts; i++) {
+ buf3[i] = (unsigned long)0xffffffff ^ (unsigned long)(i * 32);
+ }
+ H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf3);
+ H5Dclose(dset);
+ }
+ H5Sclose(space);
+ }
+ H5Tclose(type);
+ }
+
+ /* bitfield_4 */
+ if ((type = H5Tcopy(H5T_STD_B64LE)) >= 0) {
+ if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) {
+ if ((dset = H5Dcreate2(grp, "bitfield_4", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ for (i = 0; i < nelmts; i++) {
+ buf4[i] = (unsigned long long)0xffffffffffffffff ^ (unsigned long long)(i * 64);
+ }
+ H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf4);
+ H5Dclose(dset);
+ }
+ H5Sclose(space);
+ }
+ H5Tclose(type);
+ }
+
+ H5Gclose(grp);
+ }
+
+ if ((grp = H5Gcreate2(file, "opaquetypetests", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ /* opaque_1 */
+ if ((type = H5Tcreate(H5T_OPAQUE, 1)) >= 0) {
+ if ((H5Tset_tag(type, "1-byte opaque type")) >= 0) {
+ if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) {
+ if ((dset = H5Dcreate2(grp, "opaque_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ for(i = 0; i < nelmts; i++)
+ buf[i] = (unsigned char)0xff ^ (unsigned char)i;
+ H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ H5Dclose(dset);
+ }
+ H5Sclose(space);
+ }
+ }
+ H5Tclose(type);
+ }
+
+ /* opaque_2 */
+ if ((type = H5Tcreate(H5T_OPAQUE, 2)) >= 0) {
+ if ((H5Tset_tag(type, "2-byte opaque type")) >= 0) {
+ if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) {
+ if ((dset = H5Dcreate2(grp, "opaque_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ for(i = 0; i < nelmts; i++)
+ buf2[i] = (unsigned int)0xffff ^ (unsigned int)(i * 16);
+
+ H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2);
+ H5Dclose(dset);
+ }
+ H5Sclose(space);
+ }
+ }
+ H5Tclose(type);
+ }
+ H5Gclose(grp);
+ }
+
+ if ((grp = H5Gcreate2(file, "cmpdtypetests", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ /* compound_1 */
+ if ((type = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) >= 0) {
+ H5Tinsert(type, "a", HOFFSET(s_t, a), H5T_STD_B8LE);
+ H5Tinsert(type, "b", HOFFSET(s_t, b), H5T_STD_B16LE);
+ H5Tinsert(type, "c", HOFFSET(s_t, c), H5T_STD_B32LE);
+ H5Tinsert(type, "d", HOFFSET(s_t, d), H5T_STD_B64LE);
+ if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) {
+ if ((dset = H5Dcreate2(grp, "compound_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ for(i = 0; i < nelmts; i++) {
+ buf5[i].a = (unsigned char)0xff ^ (unsigned char)i;
+ buf5[i].b = (unsigned int)0xffff ^ (unsigned int)(i * 16);
+ buf5[i].c = (unsigned long)0xffffffff ^ (unsigned long)(i * 32);
+ buf5[i].d = (unsigned long long)0xffffffffffffffff ^ (unsigned long long)(i * 64);
+ }
+
+ H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5);
+ H5Dclose(dset);
+ }
+ H5Sclose(space);
+ }
+ H5Tclose(type);
+ }
+ H5Gclose(grp);
+ }
+
+ H5Fclose(file);
+}
+
/*-------------------------------------------------------------------------
* Function: main
@@ -9665,6 +9818,7 @@ int main(void)
gent_compound_ints();
gent_intattrscalars();
gent_intsattrs();
+ gent_bitnopaquefields();
return 0;
}
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index 13cea23..badaf3c 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -549,7 +549,7 @@ static herr_t trav_grp_symlinks(const char *path, const H5L_info_t *linfo,
done:
if (lnk_info.trg_path)
- HDfree((char *)lnk_info.trg_path);
+ HDfree(lnk_info.trg_path);
return 0;
}
@@ -1064,9 +1064,9 @@ out:
/* free link info buffer */
if (trg_linfo1.trg_path)
- HDfree((char *)trg_linfo1.trg_path);
+ HDfree(trg_linfo1.trg_path);
if (trg_linfo2.trg_path)
- HDfree((char *)trg_linfo2.trg_path);
+ HDfree(trg_linfo2.trg_path);
/* close */
H5E_BEGIN_TRY
@@ -1905,9 +1905,9 @@ hsize_t diff(hid_t file1_id,
/* free link info buffer */
if (linkinfo1.trg_path)
- HDfree((char *)linkinfo1.trg_path);
+ HDfree(linkinfo1.trg_path);
if (linkinfo2.trg_path)
- HDfree((char *)linkinfo2.trg_path);
+ HDfree(linkinfo2.trg_path);
return nfound;
@@ -1948,9 +1948,9 @@ out2:
/* free link info buffer */
if (linkinfo1.trg_path)
- HDfree((char *)linkinfo1.trg_path);
+ HDfree(linkinfo1.trg_path);
if (linkinfo2.trg_path)
- HDfree((char *)linkinfo2.trg_path);
+ HDfree(linkinfo2.trg_path);
/* close */
/* disable error reporting */
diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c
index caf71df..52d84f9 100644
--- a/tools/lib/h5tools_ref.c
+++ b/tools/lib/h5tools_ref.c
@@ -65,7 +65,7 @@ free_ref_path_info(void *item, void UNUSED *key, void UNUSED *operator_data/*in,
{
ref_path_node_t *node = (ref_path_node_t *)item;
- HDfree((void *)node->path);
+ HDfree(node->path);
HDfree(node);
return(0);
diff --git a/tools/testfiles/tbitnopaque.ddl b/tools/testfiles/tbitnopaque.ddl
new file mode 100644
index 0000000..9000463
--- /dev/null
+++ b/tools/testfiles/tbitnopaque.ddl
@@ -0,0 +1,293 @@
+HDF5 "tbitnopaque.h5" {
+GROUP "/" {
+ GROUP "bittypetests" {
+ DATASET "bitfield_1" {
+ DATATYPE H5T_STD_B8LE
+ DATASPACE SIMPLE { ( 32 ) / ( 32 ) }
+ DATA {
+ (0): 0xff, 0xfe, 0xfd, 0xfc, 0xfb, 0xfa, 0xf9, 0xf8, 0xf7, 0xf6,
+ (10): 0xf5, 0xf4, 0xf3, 0xf2, 0xf1, 0xf0, 0xef, 0xee, 0xed, 0xec,
+ (20): 0xeb, 0xea, 0xe9, 0xe8, 0xe7, 0xe6, 0xe5, 0xe4, 0xe3, 0xe2,
+ (30): 0xe1, 0xe0
+ }
+ }
+ DATASET "bitfield_2" {
+ DATATYPE H5T_STD_B16LE
+ DATASPACE SIMPLE { ( 32 ) / ( 32 ) }
+ DATA {
+ (0): ff:ff, 00:00, ef:ff, 00:00, df:ff, 00:00, cf:ff, 00:00, bf:ff,
+ (9): 00:00, af:ff, 00:00, 9f:ff, 00:00, 8f:ff, 00:00, 7f:ff, 00:00,
+ (18): 6f:ff, 00:00, 5f:ff, 00:00, 4f:ff, 00:00, 3f:ff, 00:00, 2f:ff,
+ (27): 00:00, 1f:ff, 00:00, 0f:ff, 00:00
+ }
+ }
+ DATASET "bitfield_3" {
+ DATATYPE H5T_STD_B32LE
+ DATASPACE SIMPLE { ( 32 ) / ( 32 ) }
+ DATA {
+ (0): ff:ff:ff:ff, 00:00:00:00, df:ff:ff:ff, 00:00:00:00,
+ (4): bf:ff:ff:ff, 00:00:00:00, 9f:ff:ff:ff, 00:00:00:00,
+ (8): 7f:ff:ff:ff, 00:00:00:00, 5f:ff:ff:ff, 00:00:00:00,
+ (12): 3f:ff:ff:ff, 00:00:00:00, 1f:ff:ff:ff, 00:00:00:00,
+ (16): ff:fe:ff:ff, 00:00:00:00, df:fe:ff:ff, 00:00:00:00,
+ (20): bf:fe:ff:ff, 00:00:00:00, 9f:fe:ff:ff, 00:00:00:00,
+ (24): 7f:fe:ff:ff, 00:00:00:00, 5f:fe:ff:ff, 00:00:00:00,
+ (28): 3f:fe:ff:ff, 00:00:00:00, 1f:fe:ff:ff, 00:00:00:00
+ }
+ }
+ DATASET "bitfield_4" {
+ DATATYPE H5T_STD_B64LE
+ DATASPACE SIMPLE { ( 32 ) / ( 32 ) }
+ DATA {
+ (0): ff:ff:ff:ff:ff:ff:ff:ff, bf:ff:ff:ff:ff:ff:ff:ff,
+ (2): 7f:ff:ff:ff:ff:ff:ff:ff, 3f:ff:ff:ff:ff:ff:ff:ff,
+ (4): ff:fe:ff:ff:ff:ff:ff:ff, bf:fe:ff:ff:ff:ff:ff:ff,
+ (6): 7f:fe:ff:ff:ff:ff:ff:ff, 3f:fe:ff:ff:ff:ff:ff:ff,
+ (8): ff:fd:ff:ff:ff:ff:ff:ff, bf:fd:ff:ff:ff:ff:ff:ff,
+ (10): 7f:fd:ff:ff:ff:ff:ff:ff, 3f:fd:ff:ff:ff:ff:ff:ff,
+ (12): ff:fc:ff:ff:ff:ff:ff:ff, bf:fc:ff:ff:ff:ff:ff:ff,
+ (14): 7f:fc:ff:ff:ff:ff:ff:ff, 3f:fc:ff:ff:ff:ff:ff:ff,
+ (16): ff:fb:ff:ff:ff:ff:ff:ff, bf:fb:ff:ff:ff:ff:ff:ff,
+ (18): 7f:fb:ff:ff:ff:ff:ff:ff, 3f:fb:ff:ff:ff:ff:ff:ff,
+ (20): ff:fa:ff:ff:ff:ff:ff:ff, bf:fa:ff:ff:ff:ff:ff:ff,
+ (22): 7f:fa:ff:ff:ff:ff:ff:ff, 3f:fa:ff:ff:ff:ff:ff:ff,
+ (24): ff:f9:ff:ff:ff:ff:ff:ff, bf:f9:ff:ff:ff:ff:ff:ff,
+ (26): 7f:f9:ff:ff:ff:ff:ff:ff, 3f:f9:ff:ff:ff:ff:ff:ff,
+ (28): ff:f8:ff:ff:ff:ff:ff:ff, bf:f8:ff:ff:ff:ff:ff:ff,
+ (30): 7f:f8:ff:ff:ff:ff:ff:ff, 3f:f8:ff:ff:ff:ff:ff:ff
+ }
+ }
+ }
+ GROUP "cmpdtypetests" {
+ DATASET "compound_1" {
+ DATATYPE H5T_COMPOUND {
+ H5T_STD_B8LE "a";
+ H5T_STD_B16LE "b";
+ H5T_STD_B32LE "c";
+ H5T_STD_B64LE "d";
+ }
+ DATASPACE SIMPLE { ( 32 ) / ( 32 ) }
+ DATA {
+ (0): {
+ 0xff,
+ ff:ff,
+ ff:ff:ff:ff,
+ ff:ff:ff:ff:ff:ff:ff:ff
+ },
+ (1): {
+ 0xfe,
+ ef:ff,
+ df:ff:ff:ff,
+ bf:ff:ff:ff:ff:ff:ff:ff
+ },
+ (2): {
+ 0xfd,
+ df:ff,
+ bf:ff:ff:ff,
+ 7f:ff:ff:ff:ff:ff:ff:ff
+ },
+ (3): {
+ 0xfc,
+ cf:ff,
+ 9f:ff:ff:ff,
+ 3f:ff:ff:ff:ff:ff:ff:ff
+ },
+ (4): {
+ 0xfb,
+ bf:ff,
+ 7f:ff:ff:ff,
+ ff:fe:ff:ff:ff:ff:ff:ff
+ },
+ (5): {
+ 0xfa,
+ af:ff,
+ 5f:ff:ff:ff,
+ bf:fe:ff:ff:ff:ff:ff:ff
+ },
+ (6): {
+ 0xf9,
+ 9f:ff,
+ 3f:ff:ff:ff,
+ 7f:fe:ff:ff:ff:ff:ff:ff
+ },
+ (7): {
+ 0xf8,
+ 8f:ff,
+ 1f:ff:ff:ff,
+ 3f:fe:ff:ff:ff:ff:ff:ff
+ },
+ (8): {
+ 0xf7,
+ 7f:ff,
+ ff:fe:ff:ff,
+ ff:fd:ff:ff:ff:ff:ff:ff
+ },
+ (9): {
+ 0xf6,
+ 6f:ff,
+ df:fe:ff:ff,
+ bf:fd:ff:ff:ff:ff:ff:ff
+ },
+ (10): {
+ 0xf5,
+ 5f:ff,
+ bf:fe:ff:ff,
+ 7f:fd:ff:ff:ff:ff:ff:ff
+ },
+ (11): {
+ 0xf4,
+ 4f:ff,
+ 9f:fe:ff:ff,
+ 3f:fd:ff:ff:ff:ff:ff:ff
+ },
+ (12): {
+ 0xf3,
+ 3f:ff,
+ 7f:fe:ff:ff,
+ ff:fc:ff:ff:ff:ff:ff:ff
+ },
+ (13): {
+ 0xf2,
+ 2f:ff,
+ 5f:fe:ff:ff,
+ bf:fc:ff:ff:ff:ff:ff:ff
+ },
+ (14): {
+ 0xf1,
+ 1f:ff,
+ 3f:fe:ff:ff,
+ 7f:fc:ff:ff:ff:ff:ff:ff
+ },
+ (15): {
+ 0xf0,
+ 0f:ff,
+ 1f:fe:ff:ff,
+ 3f:fc:ff:ff:ff:ff:ff:ff
+ },
+ (16): {
+ 0xef,
+ ff:fe,
+ ff:fd:ff:ff,
+ ff:fb:ff:ff:ff:ff:ff:ff
+ },
+ (17): {
+ 0xee,
+ ef:fe,
+ df:fd:ff:ff,
+ bf:fb:ff:ff:ff:ff:ff:ff
+ },
+ (18): {
+ 0xed,
+ df:fe,
+ bf:fd:ff:ff,
+ 7f:fb:ff:ff:ff:ff:ff:ff
+ },
+ (19): {
+ 0xec,
+ cf:fe,
+ 9f:fd:ff:ff,
+ 3f:fb:ff:ff:ff:ff:ff:ff
+ },
+ (20): {
+ 0xeb,
+ bf:fe,
+ 7f:fd:ff:ff,
+ ff:fa:ff:ff:ff:ff:ff:ff
+ },
+ (21): {
+ 0xea,
+ af:fe,
+ 5f:fd:ff:ff,
+ bf:fa:ff:ff:ff:ff:ff:ff
+ },
+ (22): {
+ 0xe9,
+ 9f:fe,
+ 3f:fd:ff:ff,
+ 7f:fa:ff:ff:ff:ff:ff:ff
+ },
+ (23): {
+ 0xe8,
+ 8f:fe,
+ 1f:fd:ff:ff,
+ 3f:fa:ff:ff:ff:ff:ff:ff
+ },
+ (24): {
+ 0xe7,
+ 7f:fe,
+ ff:fc:ff:ff,
+ ff:f9:ff:ff:ff:ff:ff:ff
+ },
+ (25): {
+ 0xe6,
+ 6f:fe,
+ df:fc:ff:ff,
+ bf:f9:ff:ff:ff:ff:ff:ff
+ },
+ (26): {
+ 0xe5,
+ 5f:fe,
+ bf:fc:ff:ff,
+ 7f:f9:ff:ff:ff:ff:ff:ff
+ },
+ (27): {
+ 0xe4,
+ 4f:fe,
+ 9f:fc:ff:ff,
+ 3f:f9:ff:ff:ff:ff:ff:ff
+ },
+ (28): {
+ 0xe3,
+ 3f:fe,
+ 7f:fc:ff:ff,
+ ff:f8:ff:ff:ff:ff:ff:ff
+ },
+ (29): {
+ 0xe2,
+ 2f:fe,
+ 5f:fc:ff:ff,
+ bf:f8:ff:ff:ff:ff:ff:ff
+ },
+ (30): {
+ 0xe1,
+ 1f:fe,
+ 3f:fc:ff:ff,
+ 7f:f8:ff:ff:ff:ff:ff:ff
+ },
+ (31): {
+ 0xe0,
+ 0f:fe,
+ 1f:fc:ff:ff,
+ 3f:f8:ff:ff:ff:ff:ff:ff
+ }
+ }
+ }
+ }
+ GROUP "opaquetypetests" {
+ DATASET "opaque_1" {
+ DATATYPE H5T_OPAQUE {
+ OPAQUE_TAG "1-byte opaque type";
+ }
+ DATASPACE SIMPLE { ( 32 ) / ( 32 ) }
+ DATA {
+ (0): 0xff, 0xfe, 0xfd, 0xfc, 0xfb, 0xfa, 0xf9, 0xf8, 0xf7, 0xf6,
+ (10): 0xf5, 0xf4, 0xf3, 0xf2, 0xf1, 0xf0, 0xef, 0xee, 0xed, 0xec,
+ (20): 0xeb, 0xea, 0xe9, 0xe8, 0xe7, 0xe6, 0xe5, 0xe4, 0xe3, 0xe2,
+ (30): 0xe1, 0xe0
+ }
+ }
+ DATASET "opaque_2" {
+ DATATYPE H5T_OPAQUE {
+ OPAQUE_TAG "2-byte opaque type";
+ }
+ DATASPACE SIMPLE { ( 32 ) / ( 32 ) }
+ DATA {
+ (0): ff:ff, 00:00, ef:ff, 00:00, df:ff, 00:00, cf:ff, 00:00, bf:ff,
+ (9): 00:00, af:ff, 00:00, 9f:ff, 00:00, 8f:ff, 00:00, 7f:ff, 00:00,
+ (18): 6f:ff, 00:00, 5f:ff, 00:00, 4f:ff, 00:00, 3f:ff, 00:00, 2f:ff,
+ (27): 00:00, 1f:ff, 00:00, 0f:ff, 00:00
+ }
+ }
+ }
+}
+}
diff --git a/tools/testfiles/tbitnopaque.h5 b/tools/testfiles/tbitnopaque.h5
new file mode 100644
index 0000000..2b1f23d
--- /dev/null
+++ b/tools/testfiles/tbitnopaque.h5
Binary files differ
diff --git a/vms/src/h5pubconf.h b/vms/src/h5pubconf.h
index 7bf33ce..28b3d2a 100644
--- a/vms/src/h5pubconf.h
+++ b/vms/src/h5pubconf.h
@@ -504,7 +504,7 @@
#define H5_PACKAGE_NAME "HDF5"
/* Define to the full name and version of this package. */
-#define H5_PACKAGE_STRING "HDF5 1.9.200"
+#define H5_PACKAGE_STRING "HDF5 1.9.203"
/* Define to the one symbol short name of this package. */
#define H5_PACKAGE_TARNAME "hdf5"
@@ -513,7 +513,7 @@
#define H5_PACKAGE_URL ""
/* Define to the version of this package. */
-#define H5_PACKAGE_VERSION "1.9.200"
+#define H5_PACKAGE_VERSION "1.9.203"
/* Width for printf() for type `long long' or `__int64', use `ll' */
#define H5_PRINTF_LL_WIDTH "ll"
@@ -676,7 +676,7 @@
/* #undef H5_USING_MEMCHECKER */
/* Version number of package */
-#define H5_VERSION "1.9.200"
+#define H5_VERSION "1.9.203"
/* Define if vsnprintf() returns the correct value for formatted strings that
don't fit into size allowed */