summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2020-07-08 01:21:44 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2020-07-08 19:10:26 (GMT)
commit76b579e142df42aa91d5ca5d66c6e413ec5ed608 (patch)
tree74aa539ad0ee1a77830191fec214dd5227146150 /src
parent0cff7d03f8b8f7889be71ac2115b2835f3cd26d2 (diff)
downloadhdf5-76b579e142df42aa91d5ca5d66c6e413ec5ed608.zip
hdf5-76b579e142df42aa91d5ca5d66c6e413ec5ed608.tar.gz
hdf5-76b579e142df42aa91d5ca5d66c6e413ec5ed608.tar.bz2
Normalization of H5S package with develop
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/H5Osdspace.c12
-rw-r--r--src/H5S.c904
-rw-r--r--src/H5Sall.c109
-rw-r--r--src/H5Sdbg.c29
-rw-r--r--src/H5Shyper.c314
-rw-r--r--src/H5Smpio.c852
-rw-r--r--src/H5Snone.c410
-rw-r--r--src/H5Spkg.h21
-rw-r--r--src/H5Spoint.c556
-rw-r--r--src/H5Sprivate.h19
-rw-r--r--src/H5Spublic.h67
-rw-r--r--src/H5Sselect.c175
-rw-r--r--src/H5Stest.c99
-rw-r--r--src/H5mpi.c563
-rw-r--r--src/Makefile.am2
16 files changed, 2285 insertions, 1848 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 3ed9f99..5ded303 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -8,6 +8,7 @@ set (H5_SOURCES
${HDF5_SRC_DIR}/H5.c
${HDF5_SRC_DIR}/H5checksum.c
${HDF5_SRC_DIR}/H5dbg.c
+ ${HDF5_SRC_DIR}/H5mpi.c
${HDF5_SRC_DIR}/H5system.c
${HDF5_SRC_DIR}/H5timer.c
${HDF5_SRC_DIR}/H5trace.c
diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c
index 55a820c..33310dc 100644
--- a/src/H5Osdspace.c
+++ b/src/H5Osdspace.c
@@ -189,7 +189,7 @@ H5O__sdspace_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh,
done:
if(!ret_value && sdim) {
- H5S_extent_release(sdim);
+ H5S__extent_release(sdim);
sdim = H5FL_FREE(H5S_extent_t, sdim);
} /* end if */
@@ -310,7 +310,7 @@ H5O_sdspace_copy(const void *_mesg, void *_dest)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy extent information */
- if(H5S_extent_copy_real(dest, mesg, TRUE) < 0)
+ if(H5S__extent_copy_real(dest, mesg, TRUE) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy extent")
/* Set return value */
@@ -355,11 +355,11 @@ H5O_sdspace_size(const H5F_t *f, const void *_mesg)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Basic information for all dataspace messages */
- ret_value = 1 + /* Version */
+ ret_value = (size_t)(1 + /* Version */
1 + /* Rank */
1 + /* Flags */
1 + /* Dataspace type/reserved */
- ((space->version > H5O_SDSPACE_VERSION_1) ? 0 : 4); /* Eliminated/reserved */
+ ((space->version > H5O_SDSPACE_VERSION_1) ? 0 : 4)); /* Eliminated/reserved */
/* Add in the dimension sizes */
ret_value += space->rank * H5F_SIZEOF_SIZE(f);
@@ -391,7 +391,7 @@ H5O__sdspace_reset(void *_mesg)
FUNC_ENTER_STATIC_NOERR
- H5S_extent_release(mesg);
+ H5S__extent_release(mesg);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O__sdspace_reset() */
@@ -470,7 +470,7 @@ H5O_sdspace_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src,
HGOTO_ERROR(H5E_DATASPACE, H5E_NOSPACE, FAIL, "dataspace extent allocation failed")
/* Create a copy of the dataspace extent */
- if(H5S_extent_copy_real(udata->src_space_extent, src_space_extent, TRUE) < 0)
+ if(H5S__extent_copy_real(udata->src_space_extent, src_space_extent, TRUE) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy extent")
} /* end if */
diff --git a/src/H5S.c b/src/H5S.c
index ad15be3..c6f81f8 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -21,14 +21,15 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
#include "H5CXprivate.h" /* API Contexts */
-#include "H5Fprivate.h" /* Files */
-#include "H5FLprivate.h" /* Free lists */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Oprivate.h" /* Object headers */
-#include "H5Spkg.h" /* Dataspaces */
+#include "H5Fprivate.h" /* Files */
+#include "H5FLprivate.h" /* Free lists */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Oprivate.h" /* Object headers */
+#include "H5Spkg.h" /* Dataspaces */
/****************/
@@ -47,7 +48,12 @@
/********************/
/* Local Prototypes */
/********************/
-static htri_t H5S_is_simple(const H5S_t *sdim);
+static htri_t H5S__is_simple(const H5S_t *sdim);
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
/*********************/
@@ -64,15 +70,6 @@ const unsigned H5O_sdspace_ver_bounds[] = {
H5O_SDSPACE_VERSION_LATEST /* H5F_LIBVER_LATEST */
};
-/*****************************/
-/* Library Private Variables */
-/*****************************/
-
-
-/*******************/
-/* Local Variables */
-/*******************/
-
/* Declare a free list to manage the H5S_extent_t struct */
H5FL_DEFINE(H5S_extent_t);
@@ -82,12 +79,17 @@ H5FL_DEFINE(H5S_t);
/* Declare a free list to manage the array's of hsize_t's */
H5FL_ARR_DEFINE(hsize_t, H5S_MAX_RANK);
+
+/*******************/
+/* Local Variables */
+/*******************/
+
/* Dataspace ID class */
static const H5I_class_t H5I_DATASPACE_CLS[1] = {{
- H5I_DATASPACE, /* ID class value */
- 0, /* Class flags */
- 2, /* # of reserved IDs for class */
- (H5I_free_t)H5S_close /* Callback routine for closing objects of this class */
+ H5I_DATASPACE, /* ID class value */
+ 0, /* Class flags */
+ 2, /* # of reserved IDs for class */
+ (H5I_free_t)H5S_close /* Callback routine for closing objects of this class */
}};
@@ -113,9 +115,9 @@ H5S__init_package(void)
FUNC_ENTER_PACKAGE
- /* Initialize the atom group for the file IDs */
+ /* Initialize the atom group for the dataspace IDs */
if(H5I_register_type(H5I_DATASPACE_CLS) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize interface")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize dataspace ID class")
/* Mark "top" of interface as initialized, too */
H5S_top_package_initialize_s = TRUE;
@@ -146,17 +148,17 @@ done:
int
H5S_top_term_package(void)
{
- int n = 0;
+ int n = 0;
FUNC_ENTER_NOAPI_NOINIT_NOERR
if(H5S_top_package_initialize_s) {
- if(H5I_nmembers(H5I_DATASPACE) > 0) {
- (void)H5I_clear_type(H5I_DATASPACE, FALSE, FALSE);
+ if(H5I_nmembers(H5I_DATASPACE) > 0) {
+ (void)H5I_clear_type(H5I_DATASPACE, FALSE, FALSE);
n++; /*H5I*/
- } /* end if */
+ } /* end if */
- /* Mark "top" of interface as closed */
+ /* Mark "top" of interface as closed */
if(0 == n)
H5S_top_package_initialize_s = FALSE;
} /* end if */
@@ -188,7 +190,7 @@ H5S_top_term_package(void)
int
H5S_term_package(void)
{
- int n = 0;
+ int n = 0;
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -200,7 +202,7 @@ H5S_term_package(void)
/* Destroy the dataspace object id group */
n += (H5I_dec_type_ref(H5I_DATASPACE) > 0);
- /* Mark interface as closed */
+ /* Mark interface as closed */
if(0 == n)
H5_PKG_INIT_VAR = FALSE;
} /* end if */
@@ -238,26 +240,25 @@ H5S_get_validated_dataspace(hid_t space_id, const H5S_t **space)
HDassert(space);
- if (space_id < 0)
+ /* Check for invalid ID */
+ if(space_id < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid space_id (ID cannot be a negative number)")
- if (H5S_ALL == space_id) {
- /* No special dataspace struct for H5S_ALL */
+ /* No special dataspace struct for H5S_ALL */
+ if(H5S_ALL == space_id)
*space = NULL;
- }
else {
/* Get the dataspace pointer */
- if (NULL == (*space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ if(NULL == (*space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "space_id is not a dataspace ID")
/* Check for valid selection */
- if (H5S_SELECT_VALID(*space) != TRUE)
+ if(H5S_SELECT_VALID(*space) != TRUE)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection + offset not within extent")
}
done:
FUNC_LEAVE_NOAPI(ret_value)
-
} /* end H5S_get_validated_dataspace() */
@@ -331,10 +332,9 @@ H5S_create(H5S_class_t type)
ret_value = new_ds;
done:
- if(ret_value == NULL) {
+ if(ret_value == NULL)
if(new_ds && H5S_close(new_ds) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, NULL, "unable to release dataspace")
- } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_create() */
@@ -361,7 +361,7 @@ done:
hid_t
H5Screate(H5S_class_t type)
{
- H5S_t *new_ds=NULL; /* New dataspace structure */
+ H5S_t *new_ds = NULL; /* New dataspace structure */
hid_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -375,39 +375,34 @@ H5Screate(H5S_class_t type)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create dataspace")
/* Atomize */
- if((ret_value = H5I_register (H5I_DATASPACE, new_ds, TRUE)) < 0)
+ if((ret_value = H5I_register(H5I_DATASPACE, new_ds, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom")
done:
- if(ret_value < 0) {
+ if(ret_value < 0)
if(new_ds && H5S_close(new_ds) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
- } /* end if */
FUNC_LEAVE_API(ret_value)
} /* end H5Screate() */
/*-------------------------------------------------------------------------
- * Function: H5S_extent_release
- *
- * Purpose: Releases all memory associated with a dataspace extent.
+ * Function: H5S__extent_release
*
- * Return: Non-negative on success/Negative on failure
+ * Purpose: Releases all memory associated with a dataspace extent.
*
- * Programmer: Quincey Koziol
- * Thursday, July 23, 1998
+ * Return: Non-negative on success/Negative on failure
*
- * Modifications:
+ * Programmer: Quincey Koziol
+ * Thursday, July 23, 1998
*
*-------------------------------------------------------------------------
*/
herr_t
-H5S_extent_release(H5S_extent_t *extent)
+H5S__extent_release(H5S_extent_t *extent)
{
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE_NOERR
HDassert(extent);
@@ -419,20 +414,19 @@ H5S_extent_release(H5S_extent_t *extent)
extent->max = H5FL_ARR_FREE(hsize_t, extent->max);
} /* end if */
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_extent_release() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5S__extent_release() */
/*-------------------------------------------------------------------------
- * Function: H5S_close
+ * Function: H5S_close
*
- * Purpose: Releases all memory associated with a dataspace.
+ * Purpose: Releases all memory associated with a dataspace.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Tuesday, December 9, 1997
+ * Programmer: Robb Matzke
+ * Tuesday, December 9, 1997
*
*-------------------------------------------------------------------------
*/
@@ -447,33 +441,33 @@ H5S_close(H5S_t *ds)
/* Release selection (this should come before the extent release) */
if(H5S_SELECT_RELEASE(ds) < 0)
- HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace selection")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace selection")
/* Release extent */
- if(H5S_extent_release(&ds->extent) < 0)
- HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace extent")
-
- /* Release the main structure */
- ds = H5FL_FREE(H5S_t, ds);
+ if(H5S__extent_release(&ds->extent) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace extent")
done:
+ /* Release the main structure.
+ * Always do this to ensure that we don't leak memory when calling this
+ * function on partially constructed dataspaces (which will fail one or
+ * both of the above calls)
+ */
+ H5FL_FREE(H5S_t, ds);
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_close() */
/*-------------------------------------------------------------------------
- * Function: H5Sclose
- *
- * Purpose: Release access to a dataspace object.
+ * Function: H5Sclose
*
- * Return: Non-negative on success/Negative on failure
+ * Purpose: Release access to a dataspace object.
*
- * Errors:
- *
- * Programmer: Robb Matzke
- * Tuesday, December 9, 1997
+ * Return: Non-negative on success/Negative on failure
*
- * Modifications:
+ * Programmer: Robb Matzke
+ * Tuesday, December 9, 1997
*
*-------------------------------------------------------------------------
*/
@@ -486,7 +480,7 @@ H5Sclose(hid_t space_id)
H5TRACE1("e", "i", space_id);
/* Check args */
- if (NULL == H5I_object_verify(space_id,H5I_DATASPACE))
+ if(NULL == H5I_object_verify(space_id, H5I_DATASPACE))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
/* When the reference count reaches zero the resources are freed */
@@ -499,73 +493,68 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Scopy
+ * Function: H5Scopy
*
- * Purpose: Copies a dataspace.
+ * Purpose: Copies a dataspace.
*
- * Return: Success: ID of the new dataspace
+ * Return: Success: ID of the new dataspace
*
- * Failure: Negative
+ * Failure: H5I_INVALID_HID
*
- * Programmer: Robb Matzke
- * Friday, January 30, 1998
- *
- * Modifications:
+ * Programmer: Robb Matzke
+ * Friday, January 30, 1998
*
*-------------------------------------------------------------------------
*/
hid_t
H5Scopy(hid_t space_id)
{
- H5S_t *src;
- H5S_t *dst = NULL;
- hid_t ret_value;
+ H5S_t *src = NULL;
+ H5S_t *dst = NULL;
+ hid_t ret_value = H5I_INVALID_HID;
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", space_id);
/* Check args */
if(NULL == (src = (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, H5I_INVALID_HID, "not a dataspace")
/* Copy */
if(NULL == (dst = H5S_copy(src, FALSE, TRUE)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to copy dataspace")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy dataspace")
/* Atomize */
if((ret_value = H5I_register (H5I_DATASPACE, dst, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom")
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace atom")
done:
- if(ret_value < 0) {
+ if(ret_value < 0)
if(dst && H5S_close(dst) < 0)
- HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
- } /* end if */
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to release dataspace")
FUNC_LEAVE_API(ret_value)
} /* end H5Scopy() */
/*-------------------------------------------------------------------------
- * Function: H5Sextent_copy
- *
- * Purpose: Copies a dataspace extent.
+ * Function: H5Sextent_copy
*
- * Return: Non-negative on success/Negative on failure
+ * Purpose: Copies a dataspace extent.
*
- * Programmer: Quincey Koziol
- * Thursday, July 23, 1998
+ * Return: Non-negative on success/Negative on failure
*
- * Modifications:
+ * Programmer: Quincey Koziol
+ * Thursday, July 23, 1998
*
*-------------------------------------------------------------------------
*/
herr_t
H5Sextent_copy(hid_t dst_id,hid_t src_id)
{
- H5S_t *src;
- H5S_t *dst;
- herr_t ret_value = SUCCEED;
+ H5S_t *src;
+ H5S_t *dst;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ii", dst_id, src_id);
@@ -595,8 +584,6 @@ done:
* Programmer: Neil Fortner
* Monday, February 23, 2015
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -610,7 +597,7 @@ H5S_extent_copy(H5S_t *dst, const H5S_t *src)
HDassert(src);
/* Copy extent */
- if(H5S_extent_copy_real(&(dst->extent), &(src->extent), TRUE) < 0)
+ if(H5S__extent_copy_real(&(dst->extent), &(src->extent), TRUE) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy extent")
/* If the selection is 'all', update the number of elements selected in the
@@ -625,29 +612,27 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5S_extent_copy_real
+ * Function: H5S__extent_copy_real
*
- * Purpose: Copies a dataspace extent
- *
- * Return: Non-negative on success/Negative on failure
+ * Purpose: Copies a dataspace extent
*
- * Programmer: Quincey Koziol
- * Wednesday, June 3, 1998
+ * Return: Non-negative on success/Negative on failure
*
- * Modifications:
+ * Programmer: Quincey Koziol
+ * Wednesday, June 3, 1998
*
*-------------------------------------------------------------------------
*/
herr_t
-H5S_extent_copy_real(H5S_extent_t *dst, const H5S_extent_t *src, hbool_t copy_max)
+H5S__extent_copy_real(H5S_extent_t *dst, const H5S_extent_t *src, hbool_t copy_max)
{
unsigned u;
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
/* Release destination extent before we copy over it */
- if(H5S_extent_release(dst) < 0)
+ if(H5S__extent_release(dst) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace extent")
/* Copy the regular fields */
@@ -692,34 +677,32 @@ H5S_extent_copy_real(H5S_extent_t *dst, const H5S_extent_t *src, hbool_t copy_ma
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_extent_copy_real() */
+} /* end H5S__extent_copy_real() */
/*-------------------------------------------------------------------------
- * Function: H5S_copy
+ * Function: H5S_copy
*
- * Purpose: Copies a dataspace, by copying the extent and selection through
- * H5S_extent_copy and H5S_select_copy. If the SHARE_SELECTION flag
- * is set, then the selection can be shared between the source and
- * destination dataspaces. (This should only occur in situations
- * where the destination dataspace will immediately change to a new
- * selection)
+ * Purpose: Copies a dataspace, by copying the extent and selection through
+ * H5S_extent_copy and H5S_select_copy. If the SHARE_SELECTION flag
+ * is set, then the selection can be shared between the source and
+ * destination dataspaces. (This should only occur in situations
+ * where the destination dataspace will immediately change to a new
+ * selection)
*
- * Return: Success: A pointer to a new copy of SRC
+ * Return: Success: A pointer to a new copy of SRC
*
- * Failure: NULL
+ * Failure: NULL
*
- * Programmer: Robb Matzke
- * Thursday, December 4, 1997
- *
- * Modifications:
+ * Programmer: Robb Matzke
+ * Thursday, December 4, 1997
*
*-------------------------------------------------------------------------
*/
H5S_t *
H5S_copy(const H5S_t *src, hbool_t share_selection, hbool_t copy_max)
{
- H5S_t *dst = NULL;
+ H5S_t *dst = NULL;
H5S_t *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
@@ -728,7 +711,7 @@ H5S_copy(const H5S_t *src, hbool_t share_selection, hbool_t copy_max)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy the source dataspace's extent */
- if(H5S_extent_copy_real(&(dst->extent), &(src->extent), copy_max) < 0)
+ if(H5S__extent_copy_real(&(dst->extent), &(src->extent), copy_max) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy extent")
/* Copy the source dataspace's selection */
@@ -748,24 +731,21 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5S_get_simple_extent_npoints
+ * Function: H5S_get_simple_extent_npoints
*
- * Purpose: Determines how many data points a dataset extent has.
+ * Purpose: Determines how many data points a dataset extent has.
*
- * Return: Success: Number of data points in the dataset extent.
+ * Return: Success: Number of data points in the dataset extent.
*
- * Failure: negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Tuesday, December 9, 1997
+ * Programmer: Robb Matzke
+ * Tuesday, December 9, 1997
*
* Note: This routine participates in the "Inlining C function pointers"
* pattern, don't call it directly, use the appropriate macro
* defined in H5Sprivate.h.
*
- * Modifications:
- * Changed Name - QAK 7/7/98
- *
*-------------------------------------------------------------------------
*/
hssize_t
@@ -787,27 +767,23 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Sget_simple_extent_npoints
- *
- * Purpose: Determines how many data points a dataset extent has.
- *
- * Return: Success: Number of data points in the dataset.
+ * Function: H5Sget_simple_extent_npoints
*
- * Failure: negative
+ * Purpose: Determines how many data points a dataset extent has.
*
- * Programmer: Robb Matzke
- * Tuesday, December 9, 1997
+ * Return: Success: Number of data points in the dataset.
+ * Failure: Negative
*
- * Modifications:
- * Changed Name - QAK 7/7/98
+ * Programmer: Robb Matzke
+ * Tuesday, December 9, 1997
*
*-------------------------------------------------------------------------
*/
hssize_t
H5Sget_simple_extent_npoints(hid_t space_id)
{
- H5S_t *ds;
- hssize_t ret_value;
+ H5S_t *ds;
+ hssize_t ret_value;
FUNC_ENTER_API(FAIL)
H5TRACE1("Hs", "i", space_id);
@@ -824,38 +800,35 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5S_get_npoints_max
+ * Function: H5S_get_npoints_max
*
- * Purpose: Determines the maximum number of data points a dataspace may
- * have. If the `max' array is null then the maximum number of
- * data points is the same as the current number of data points
- * without regard to the hyperslab. If any element of the `max'
- * array is zero then the maximum possible size is returned.
+ * Purpose: Determines the maximum number of data points a dataspace may
+ * have. If the `max' array is null then the maximum number of
+ * data points is the same as the current number of data points
+ * without regard to the hyperslab. If any element of the `max'
+ * array is zero then the maximum possible size is returned.
*
- * Return: Success: Maximum number of data points the dataspace
- * may have.
+ * Return: Success: Maximum number of data points the dataspace
+ * may have.
+ * Failure: 0
*
- * Failure: 0
- *
- * Programmer: Robb Matzke
- * Tuesday, December 9, 1997
- *
- * Modifications:
+ * Programmer: Robb Matzke
+ * Tuesday, December 9, 1997
*
*-------------------------------------------------------------------------
*/
hsize_t
H5S_get_npoints_max(const H5S_t *ds)
{
- unsigned u;
- hsize_t ret_value = 0; /* Return value */
+ unsigned u;
+ hsize_t ret_value = 0; /* Return value */
FUNC_ENTER_NOAPI(0)
/* check args */
HDassert(ds);
- switch (H5S_GET_EXTENT_TYPE(ds)) {
+ switch(H5S_GET_EXTENT_TYPE(ds)) {
case H5S_NULL:
ret_value = 0;
break;
@@ -865,9 +838,9 @@ H5S_get_npoints_max(const H5S_t *ds)
break;
case H5S_SIMPLE:
- if (ds->extent.max) {
- for (ret_value=1, u=0; u<ds->extent.rank; u++) {
- if (H5S_UNLIMITED==ds->extent.max[u]) {
+ if(ds->extent.max) {
+ for(ret_value = 1, u = 0; u < ds->extent.rank; u++) {
+ if(H5S_UNLIMITED == ds->extent.max[u]) {
ret_value = HSIZET_MAX;
break;
}
@@ -875,10 +848,9 @@ H5S_get_npoints_max(const H5S_t *ds)
ret_value *= ds->extent.max[u];
}
}
- else {
- for (ret_value=1, u=0; u<ds->extent.rank; u++)
+ else
+ for(ret_value = 1, u = 0; u < ds->extent.rank; u++)
ret_value *= ds->extent.size[u];
- }
break;
case H5S_NO_CLASS:
@@ -889,37 +861,34 @@ H5S_get_npoints_max(const H5S_t *ds)
done:
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5S_get_npoints_max() */
/*-------------------------------------------------------------------------
- * Function: H5Sget_simple_extent_ndims
- *
- * Purpose: Determines the dimensionality of a dataspace.
- *
- * Return: Success: The number of dimensions in a dataspace.
+ * Function: H5Sget_simple_extent_ndims
*
- * Failure: Negative
+ * Purpose: Determines the dimensionality of a dataspace.
*
- * Programmer: Robb Matzke
- * Thursday, December 11, 1997
+ * Return: Success: The number of dimensions in a dataspace.
+ * Failure: Negative
*
- * Modifications:
+ * Programmer: Robb Matzke
+ * Thursday, December 11, 1997
*
*-------------------------------------------------------------------------
*/
int
H5Sget_simple_extent_ndims(hid_t space_id)
{
- H5S_t *ds;
- int ret_value;
+ H5S_t *ds;
+ int ret_value = -1;
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API((-1))
H5TRACE1("Is", "i", space_id);
/* Check args */
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, (-1), "not a dataspace")
ret_value = (int)H5S_GET_EXTENT_NDIMS(ds);
@@ -929,30 +898,28 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5S_get_simple_extent_ndims
+ * Function: H5S_get_simple_extent_ndims
*
- * Purpose: Returns the number of dimensions in a dataspace.
+ * Purpose: Returns the number of dimensions in a dataspace.
*
- * Return: Success: Non-negative number of dimensions. Zero
- * implies a scalar.
+ * Return: Success: Non-negative number of dimensions.
+ * Zero implies a scalar.
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Thursday, December 11, 1997
+ * Programmer: Robb Matzke
+ * hursday, December 11, 1997
*
* Note: This routine participates in the "Inlining C function pointers"
* pattern, don't call it directly, use the appropriate macro
* defined in H5Sprivate.h.
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
H5S_get_simple_extent_ndims(const H5S_t *ds)
{
- int ret_value = -1; /* Return value */
+ int ret_value = -1; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -978,67 +945,60 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Sget_simple_extent_dims
+ * Function: H5Sget_simple_extent_dims
*
- * Purpose: Returns the size and maximum sizes in each dimension of
- * a dataspace DS through the DIMS and MAXDIMS arguments.
+ * Purpose: Returns the size and maximum sizes in each dimension of
+ * a dataspace DS through the DIMS and MAXDIMS arguments.
*
- * Return: Success: Number of dimensions, the same value as
- * returned by H5Sget_simple_extent_ndims().
+ * Return: Success: Number of dimensions, the same value as
+ * returned by H5Sget_simple_extent_ndims().
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Robb Matzke
- * Thursday, December 11, 1997
- *
- * Modifications:
- * June 18, 1998 Albert Cheng
- * Added maxdims argument. Removed dims argument check
- * since it can still return ndims even if both dims and
- * maxdims are NULLs.
+ * Programmer: Robb Matzke
+ * Thursday, December 11, 1997
*
*-------------------------------------------------------------------------
*/
int
-H5Sget_simple_extent_dims(hid_t space_id, hsize_t dims[]/*out*/,
- hsize_t maxdims[]/*out*/)
+H5Sget_simple_extent_dims(hid_t space_id, hsize_t dims[]/*out*/, hsize_t maxdims[]/*out*/)
{
- H5S_t *ds;
- int ret_value;
+ H5S_t *ds;
+ int ret_value = -1;
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API((-1))
H5TRACE3("Is", "ixx", space_id, dims, maxdims);
/* Check args */
- if (NULL == (ds = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ if(NULL == (ds = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a dataspace")
ret_value = H5S_get_simple_extent_dims(ds, dims, maxdims);
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Sget_simple_extent_dims() */
/*-------------------------------------------------------------------------
- * Function: H5S_extent_get_dims
+ * Function: H5S_extent_get_dims
*
- * Purpose: Returns the size in each dimension of a dataspace. This
- * function may not be meaningful for all types of dataspaces.
+ * Purpose: Returns the size in each dimension of a dataspace. This
+ * function may not be meaningful for all types of dataspaces.
*
- * Return: Success: Number of dimensions. Zero implies scalar.
- * Failure: Negative
+ * Return: Success: Number of dimensions. Zero implies scalar.
+ * Failure: Negative
*
- * Programmer: Quincey Koziol
- * Tuesday, June 30, 2009
+ * Programmer: Quincey Koziol
+ * Tuesday, June 30, 2009
*
*-------------------------------------------------------------------------
*/
int
H5S_extent_get_dims(const H5S_extent_t *ext, hsize_t dims[], hsize_t max_dims[])
{
- int i; /* Local index variable */
- int ret_value = -1; /* Return value */
+ int i; /* Local index variable */
+ int ret_value = -1; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1077,26 +1037,23 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5S_get_simple_extent_dims
- *
- * Purpose: Returns the size in each dimension of a dataspace. This
- * function may not be meaningful for all types of dataspaces.
- *
- * Return: Success: Number of dimensions. Zero implies scalar.
+ * Function: H5S_get_simple_extent_dims
*
- * Failure: Negative
+ * Purpose: Returns the size in each dimension of a dataspace. This
+ * function may not be meaningful for all types of dataspaces.
*
- * Programmer: Robb Matzke
- * Thursday, December 11, 1997
+ * Return: Success: Number of dimensions. Zero implies scalar.
+ * Failure: Negative
*
- * Modifications:
+ * Programmer: Robb Matzke
+ * Thursday, December 11, 1997
*
*-------------------------------------------------------------------------
*/
int
H5S_get_simple_extent_dims(const H5S_t *ds, hsize_t dims[], hsize_t max_dims[])
{
- int ret_value = -1; /* Return value */
+ int ret_value = -1; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1113,15 +1070,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5S_write
+ * Function: H5S_write
*
- * Purpose: Updates a dataspace by writing a message to an object
- * header.
+ * Purpose: Updates a dataspace by writing a message to an object
+ * header.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Tuesday, December 9, 1997
+ * Programmer: Robb Matzke
+ * Tuesday, December 9, 1997
*
*-------------------------------------------------------------------------
*/
@@ -1147,22 +1104,14 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5S_append
- *
- * Purpose: Updates a dataspace by adding a message to an object
- * header.
+ * Function: H5S_append
*
- * Return: Non-negative on success/Negative on failure
+ * Purpose: Updates a dataspace by adding a message to an object header.
*
- * Programmer: Quincey Koziol
- * Tuesday, December 31, 2002
- *
- * Modifications:
+ * Return: Non-negative on success/Negative on failure
*
- * John Mainzer, 6/6/05
- * Updated function to use the new dirtied parameter of
- * H5AC_unprotect() instead of manipulating the is_dirty
- * field of the cache info.
+ * Programmer: Quincey Koziol
+ * Tuesday, December 31, 2002
*
*-------------------------------------------------------------------------
*/
@@ -1188,23 +1137,23 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5S_read
+ * Function: H5S_read
*
- * Purpose: Reads the dataspace from an object header.
+ * Purpose: Reads the dataspace from an object header.
*
- * Return: Success: Pointer to a new dataspace.
+ * Return: Success: Pointer to a new dataspace.
*
- * Failure: NULL
+ * Failure: NULL
*
- * Programmer: Robb Matzke
- * Tuesday, December 9, 1997
+ * Programmer: Robb Matzke
+ * Tuesday, December 9, 1997
*
*-------------------------------------------------------------------------
*/
H5S_t *
H5S_read(const H5O_loc_t *loc)
{
- H5S_t *ds = NULL; /* Dataspace to return */
+ H5S_t *ds = NULL; /* Dataspace to return */
H5S_t *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
@@ -1226,10 +1175,9 @@ H5S_read(const H5O_loc_t *loc)
ret_value = ds;
done:
- if(ret_value == NULL) {
+ if(ret_value == NULL)
if(ds != NULL)
ds = H5FL_FREE(H5S_t, ds);
- } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_read() */
@@ -1237,34 +1185,34 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5S_is_simple
+ H5S__is_simple
PURPOSE
Check if a dataspace is simple (internal)
USAGE
- htri_t H5S_is_simple(sdim)
- H5S_t *sdim; IN: Pointer to dataspace object to query
+ htri_t H5S__is_simple(sdim)
+ H5S_t *sdim; IN: Pointer to dataspace object to query
RETURNS
TRUE/FALSE/FAIL
DESCRIPTION
- This function determines the if a dataspace is "simple". ie. if it
+ This function determines the if a dataspace is "simple". ie. if it
has orthogonal, evenly spaced dimensions.
--------------------------------------------------------------------------*/
static htri_t
-H5S_is_simple(const H5S_t *sdim)
+H5S__is_simple(const H5S_t *sdim)
{
htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args and all the boring stuff. */
HDassert(sdim);
/* H5S_NULL shouldn't be simple dataspace */
ret_value = (H5S_GET_EXTENT_TYPE(sdim) == H5S_SIMPLE ||
- H5S_GET_EXTENT_TYPE(sdim) == H5S_SCALAR) ? TRUE : FALSE;
+ H5S_GET_EXTENT_TYPE(sdim) == H5S_SCALAR) ? TRUE : FALSE;
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_is_simple() */
+} /* end H5S__is_simple() */
/*--------------------------------------------------------------------------
@@ -1274,31 +1222,31 @@ H5S_is_simple(const H5S_t *sdim)
Check if a dataspace is simple
USAGE
htri_t H5Sis_simple(space_id)
- hid_t space_id; IN: ID of dataspace object to query
+ hid_t space_id; IN: ID of dataspace object to query
RETURNS
TRUE/FALSE/FAIL
DESCRIPTION
- This function determines the if a dataspace is "simple". ie. if it
+ This function determines the if a dataspace is "simple". ie. if it
has orthogonal, evenly spaced dimensions.
--------------------------------------------------------------------------*/
htri_t
H5Sis_simple(hid_t space_id)
{
- H5S_t *space; /* dataspace to modify */
- htri_t ret_value;
+ H5S_t *space; /* Dataspace to check */
+ htri_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("t", "i", space_id);
/* Check args and all the boring stuff. */
- if ((space = (H5S_t *)H5I_object_verify(space_id,H5I_DATASPACE)) == NULL)
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a dataspace")
+ if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a dataspace")
- ret_value = H5S_is_simple(space);
+ ret_value = H5S__is_simple(space);
- done:
+done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Sis_simple() */
/*--------------------------------------------------------------------------
@@ -1308,11 +1256,11 @@ H5Sis_simple(hid_t space_id)
Sets the size of a simple dataspace
USAGE
herr_t H5Sset_extent_simple(space_id, rank, dims, max)
- hid_t space_id; IN: Dataspace object to query
- int rank; IN: # of dimensions for the dataspace
- const size_t *dims; IN: Size of each dimension for the dataspace
- const size_t *max; IN: Maximum size of each dimension for the
- dataspace
+ hid_t space_id; IN: Dataspace object to query
+ int rank; IN: # of dimensions for the dataspace
+ const size_t *dims; IN: Size of each dimension for the dataspace
+ const size_t *max; IN: Maximum size of each dimension for the
+ dataspace
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
@@ -1326,79 +1274,64 @@ H5Sis_simple(hid_t space_id)
Currently, only the first dimension in the array (the slowest) may be
unlimited in size.
- MODIFICATION
- A null dataspace cannot be created from simple space with this function.
-
- Christian Chilan 01/17/2007
- Verifies that each element of DIMS is not equal to H5S_UNLIMITED.
-
- Raymond Lu 03/30/2011
- We allow 0 dimension size for non-unlimited dimension starting from 1.8.7
- release.
--------------------------------------------------------------------------*/
herr_t
H5Sset_extent_simple(hid_t space_id, int rank, const hsize_t dims[/*rank*/],
- const hsize_t max[/*rank*/])
+ const hsize_t max[/*rank*/])
{
- H5S_t *space; /* dataspace to modify */
- int u; /* local counting variable */
- herr_t ret_value=SUCCEED; /* Return value */
+ H5S_t *space; /* Dataspace to modify */
+ int u; /* Local counting variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "iIs*[a1]h*[a1]h", space_id, rank, dims, max);
/* Check args */
- if ((space = (H5S_t *)H5I_object_verify(space_id,H5I_DATASPACE)) == NULL)
+ if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a dataspace")
- if (rank > 0 && dims == NULL)
+ if(rank > 0 && dims == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no dimensions specified")
- if (rank<0 || rank>H5S_MAX_RANK)
+ if(rank < 0 || rank > H5S_MAX_RANK)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid rank")
- if (dims) {
- for (u=0; u<rank; u++) {
- if (H5S_UNLIMITED==dims[u])
+ if(dims)
+ for(u = 0; u < rank; u++)
+ if(H5S_UNLIMITED == dims[u])
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "current dimension must have a specific size, not H5S_UNLIMITED")
- }
- }
- if (max!=NULL) {
- if(dims==NULL)
+ if(max != NULL) {
+ if(dims == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "maximum dimension specified, but no current dimensions specified")
- for (u=0; u<rank; u++) {
- if (max[u]!=H5S_UNLIMITED && max[u]<dims[u])
+ for(u = 0; u < rank; u++)
+ if(max[u] != H5S_UNLIMITED && max[u] < dims[u])
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid maximum dimension size")
- }
}
/* Do it */
- if (H5S_set_extent_simple(space, (unsigned)rank, dims, max)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to set simple extent")
+ if(H5S_set_extent_simple(space, (unsigned)rank, dims, max) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to set simple extent")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Sset_extent_simple() */
/*-------------------------------------------------------------------------
- * Function: H5S_set_extent_simple
+ * Function: H5S_set_extent_simple
*
- * Purpose: This is where the real work happens for
- * H5Sset_extent_simple().
+ * Purpose: This is where the real work happens for H5Sset_extent_simple().
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke (copied from H5Sset_extent_simple)
+ * Programmer: Robb Matzke
* Wednesday, July 8, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims,
- const hsize_t *max)
+ const hsize_t *max)
{
unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1407,13 +1340,13 @@ H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims,
HDassert(0 == rank || dims);
/* shift out of the previous state to a "simple" dataspace. */
- if(H5S_extent_release(&space->extent) < 0)
+ if(H5S__extent_release(&space->extent) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "failed to release previous dataspace extent")
- if(rank == 0) { /* scalar variable */
+ if(rank == 0) { /* scalar variable */
space->extent.type = H5S_SCALAR;
space->extent.nelem = 1;
- space->extent.rank = 0; /* set to scalar rank */
+ space->extent.rank = 0; /* set to scalar rank */
} /* end if */
else {
hsize_t nelem; /* Number of elements in extent */
@@ -1434,12 +1367,11 @@ H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims,
/* Copy the maximum dimensions if specified. Otherwise, the maximal dimensions are the
* same as the dimension */
space->extent.max = (hsize_t *)H5FL_ARR_MALLOC(hsize_t, (size_t)rank);
- if(max != NULL) {
+ if(max != NULL)
H5MM_memcpy(space->extent.max, max, sizeof(hsize_t) * rank);
- } else {
+ else
for(u = 0; u < space->extent.rank; u++)
space->extent.max[u] = dims[u];
- }
} /* end else */
/* Selection related cleanup */
@@ -1455,118 +1387,104 @@ H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_set_extent_simple() */
+} /* end H5S_set_extent_simple() */
/*-------------------------------------------------------------------------
- * Function: H5Screate_simple
- *
- * Purpose: Creates a new simple dataspace object and opens it for
- * access. The DIMS argument is the size of the simple dataset
- * and the MAXDIMS argument is the upper limit on the size of
- * the dataset. MAXDIMS may be the null pointer in which case
- * the upper limit is the same as DIMS. If an element of
- * MAXDIMS is H5S_UNLIMITED then the corresponding dimension is
- * unlimited, otherwise no element of MAXDIMS should be smaller
- * than the corresponding element of DIMS.
+ * Function: H5Screate_simple
*
- * Return: Success: The ID for the new simple dataspace object.
+ * Purpose: Creates a new simple dataspace object and opens it for
+ * access. The DIMS argument is the size of the simple dataset
+ * and the MAXDIMS argument is the upper limit on the size of
+ * the dataset. MAXDIMS may be the null pointer in which case
+ * the upper limit is the same as DIMS. If an element of
+ * MAXDIMS is H5S_UNLIMITED then the corresponding dimension is
+ * unlimited, otherwise no element of MAXDIMS should be smaller
+ * than the corresponding element of DIMS.
*
- * Failure: Negative
+ * Return: Success: The ID for the new simple dataspace object.
*
- * Programmer: Quincey Koziol
- * Tuesday, January 27, 1998
+ * Failure: H5I_INVALID_HID
*
- * Modification:
- * Raymond Lu 03/30/2011
- * We allow 0-dimension for non-unlimited dimension starting
- * from 1.8.7 release.
+ * Programmer: Quincey Koziol
+ * Tuesday, January 27, 1998
*
*-------------------------------------------------------------------------
*/
hid_t
-H5Screate_simple(int rank, const hsize_t dims[/*rank*/],
- const hsize_t maxdims[/*rank*/])
+H5Screate_simple(int rank, const hsize_t dims[/*rank*/], const hsize_t maxdims[/*rank*/])
{
- H5S_t *space = NULL;
- int i;
- hid_t ret_value;
+ H5S_t *space = NULL;
+ int i;
+ hid_t ret_value = H5I_INVALID_HID;
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "Is*[a0]h*[a0]h", rank, dims, maxdims);
/* Check arguments */
if(rank < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dimensionality cannot be negative")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "dimensionality cannot be negative")
if(rank > H5S_MAX_RANK)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dimensionality is too large")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "dimensionality is too large")
/* We allow users to use this function to create scalar or null dataspace.
* Check DIMS isn't set when the RANK is 0.
*/
if(!dims && rank != 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid dataspace information")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid dataspace information")
/* Check whether the current dimensions are valid */
for(i = 0; i < rank; i++) {
if(H5S_UNLIMITED == dims[i])
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "current dimension must have a specific size, not H5S_UNLIMITED")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "current dimension must have a specific size, not H5S_UNLIMITED")
if(maxdims && H5S_UNLIMITED != maxdims[i] && maxdims[i]<dims[i])
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "maxdims is smaller than dims")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "maxdims is smaller than dims")
} /* end for */
/* Create the space and set the extent */
- if(NULL == (space = H5S_create_simple((unsigned)rank,dims,maxdims)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace")
+ if(NULL == (space = H5S_create_simple((unsigned)rank, dims, maxdims)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, H5I_INVALID_HID, "can't create simple dataspace")
/* Atomize */
if((ret_value = H5I_register (H5I_DATASPACE, space, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID")
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace ID")
done:
- if(ret_value < 0) {
+ if(ret_value < 0)
if(space && H5S_close(space) < 0)
- HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
- } /* end if */
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to release dataspace")
FUNC_LEAVE_API(ret_value)
} /* end H5Screate_simple() */
/*-------------------------------------------------------------------------
- * Function: H5S_create_simple
- *
- * Purpose: Internal function to create simple dataspace
+ * Function: H5S_create_simple
*
- * Return: Success: The ID for the new simple dataspace object.
- * Failure: Negative
+ * Purpose: Internal function to create simple dataspace
*
- * Errors:
+ * Return: Success: A pointer to a dataspace object
+ * Failure: NULL
*
- * Programmer: Quincey Koziol
- * Thursday, April 3, 2003
- *
- * Modifications:
- * Extracted from H5Screate_simple
- * Quincey Koziol, Thursday, April 3, 2003
+ * Programmer: Quincey Koziol
+ * Thursday, April 3, 2003
*
*-------------------------------------------------------------------------
*/
H5S_t *
-H5S_create_simple(unsigned rank, const hsize_t dims[/*rank*/],
- const hsize_t maxdims[/*rank*/])
+H5S_create_simple(unsigned rank, const hsize_t dims[/*rank*/], const hsize_t maxdims[/*rank*/])
{
H5S_t *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
/* Check arguments */
- HDassert(rank <=H5S_MAX_RANK);
+ HDassert(rank <= H5S_MAX_RANK);
/* Create the space and set the extent */
- if(NULL==(ret_value=H5S_create(H5S_SIMPLE)))
+ if(NULL == (ret_value = H5S_create(H5S_SIMPLE)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, NULL, "can't create simple dataspace")
- if(H5S_set_extent_simple(ret_value,rank,dims,maxdims)<0)
+ if(H5S_set_extent_simple(ret_value, rank, dims, maxdims) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "can't set dimensions")
done:
@@ -1575,21 +1493,17 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Sencode
+ * Function: H5Sencode
*
- * Purpose: Given a dataspace ID, converts the object description
+ * Purpose: Given a dataspace ID, converts the object description
* (including selection) into binary in a buffer.
*
- * Return: Success: non-negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Failure: negative
- *
- * Programmer: Raymond Lu
- * slu@ncsa.uiuc.edu
+ * Programmer: Raymond Lu
* July 14, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1597,39 +1511,37 @@ H5Sencode(hid_t obj_id, void *buf, size_t *nalloc)
{
H5S_t *dspace;
hid_t temp_fapl_id = H5P_DEFAULT;
- herr_t ret_value=SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "i*x*z", obj_id, buf, nalloc);
/* Check argument and retrieve object */
- if (NULL == (dspace = (H5S_t *)H5I_object_verify(obj_id, H5I_DATASPACE)))
+ if(NULL == (dspace = (H5S_t *)H5I_object_verify(obj_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&temp_fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
- if(H5S_encode(dspace, (unsigned char **)&buf, nalloc)<0)
+ if(H5S_encode(dspace, (unsigned char **)&buf, nalloc) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode dataspace")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Sencode() */
/*-------------------------------------------------------------------------
- * Function: H5S_encode
+ * Function: H5S_encode
*
- * Purpose: Private function for H5Sencode. Converts an object
+ * Purpose: Private function for H5Sencode. Converts an object
* description for dataspace and its selection into binary
* in a buffer.
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return: SUCCEED/FAIL
*
- * Programmer: Raymond Lu
- * slu@ncsa.uiuc.edu
+ * Programmer: Raymond Lu
* July 14, 2004
*
*-------------------------------------------------------------------------
@@ -1647,15 +1559,15 @@ H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc)
/* Allocate "fake" file structure */
if(NULL == (f = H5F_fake_alloc((uint8_t)0)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate fake file struct")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate fake file struct")
/* Find out the size of buffer needed for extent */
if((extent_size = H5O_msg_raw_size(f, H5O_SDSPACE_ID, TRUE, obj)) == 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace size")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace size")
/* Find out the size of buffer needed for selection */
if((sselect_size = H5S_SELECT_SERIAL_SIZE(obj)) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace selection size")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace selection size")
H5_CHECKED_ASSIGN(select_size, size_t, sselect_size, hssize_t);
/* Verify the size of buffer. If it's not big enough, simply return the
@@ -1698,17 +1610,16 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Sdecode
+ * Function: H5Sdecode
*
- * Purpose: Decode a binary object description of dataspace and
+ * Purpose: Decode a binary object description of dataspace and
* return a new object handle.
*
- * Return: Success: dataspace ID(non-negative)
+ * Return: Success: dataspace ID(non-negative)
*
- * Failure: negative
+ * Failure: H5I_INVALID_HID
*
- * Programmer: Raymond Lu
- * slu@ncsa.uiuc.edu
+ * Programmer: Raymond Lu
* July 14, 2004
*
*-------------------------------------------------------------------------
@@ -1719,18 +1630,18 @@ H5Sdecode(const void *buf)
H5S_t *ds;
hid_t ret_value;
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "*x", buf);
if(buf == NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "empty buffer")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "empty buffer")
if((ds = H5S_decode((const unsigned char **)&buf)) == NULL)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, FAIL, "can't decode object")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, H5I_INVALID_HID, "can't decode object")
/* Register the type and return the ID */
if((ret_value = H5I_register(H5I_DATASPACE, ds, TRUE)) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTREGISTER, FAIL, "unable to register dataspace")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace")
done:
FUNC_LEAVE_API(ret_value)
@@ -1738,17 +1649,16 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5S_decode
+ * Function: H5S_decode
*
- * Purpose: Private function for H5Sdecode. Reconstructs a binary
+ * Purpose: Private function for H5Sdecode. Reconstructs a binary
* description of dataspace and returns a new object handle.
*
- * Return: Success: dataspace ID(non-negative)
+ * Return: Success: Pointer to a dataspace buffer
*
- * Failure: negative
+ * Failure: NULL
*
- * Programmer: Raymond Lu
- * slu@ncsa.uiuc.edu
+ * Programmer: Raymond Lu
* July 14, 2004
*
*-------------------------------------------------------------------------
@@ -1768,11 +1678,11 @@ H5S_decode(const unsigned char **p)
/* Decode the type of the information */
if(*pp++ != H5O_SDSPACE_ID)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADMESG, NULL, "not an encoded dataspace")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADMESG, NULL, "not an encoded dataspace")
/* Decode the version of the dataspace information */
if(*pp++ != H5S_ENCODE_VERSION)
- HGOTO_ERROR(H5E_DATASPACE, H5E_VERSION, NULL, "unknown version of encoded dataspace")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_VERSION, NULL, "unknown version of encoded dataspace")
/* Decode the "size of size" information */
sizeof_size = *pp++;
@@ -1791,11 +1701,11 @@ H5S_decode(const unsigned char **p)
pp += extent_size;
/* Copy the extent into dataspace structure */
- if((ds = H5FL_CALLOC(H5S_t))==NULL)
+ if(NULL == (ds = H5FL_CALLOC(H5S_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for dataspace conversion path table")
- if(H5O_msg_copy(H5O_SDSPACE_ID, extent, &(ds->extent)) == NULL)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy object")
- if(H5S_extent_release(extent) < 0)
+ if(NULL == H5O_msg_copy(H5O_SDSPACE_ID, extent, &(ds->extent)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy object")
+ if(H5S__extent_release(extent) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTDELETE, NULL, "can't release previous dataspace")
extent = H5FL_FREE(H5S_extent_t, extent);
@@ -1821,79 +1731,71 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5S_get_simple_extent_type
- *
- * Purpose: Internal function for retrieving the type of extent for a dataspace object
+ * Function: H5S_get_simple_extent_type
*
- * Return: Success: The class of the dataspace object
+ * Purpose: Internal function for retrieving the type of extent for a dataspace object
*
- * Failure: N5S_NO_CLASS
+ * Return: Success: The class of the dataspace object
*
- * Errors:
+ * Failure: N5S_NO_CLASS
*
- * Programmer: Quincey Koziol
- * Thursday, September 28, 2000
+ * Programmer: Quincey Koziol
+ * Thursday, September 28, 2000
*
* Note: This routine participates in the "Inlining C function pointers"
* pattern, don't call it directly, use the appropriate macro
* defined in H5Sprivate.h.
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
H5S_class_t
H5S_get_simple_extent_type(const H5S_t *space)
{
- H5S_class_t ret_value = H5S_NO_CLASS; /* Return value */
+ H5S_class_t ret_value = H5S_NO_CLASS; /* Return value */
FUNC_ENTER_NOAPI(H5S_NO_CLASS)
HDassert(space);
- ret_value=H5S_GET_EXTENT_TYPE(space);
+ ret_value = H5S_GET_EXTENT_TYPE(space);
done:
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5S_get_simple_extent_type() */
/*-------------------------------------------------------------------------
- * Function: H5Sget_simple_extent_type
- *
- * Purpose: Retrieves the type of extent for a dataspace object
+ * Function: H5Sget_simple_extent_type
*
- * Return: Success: The class of the dataspace object
+ * Purpose: Retrieves the type of extent for a dataspace object
*
- * Failure: N5S_NO_CLASS
+ * Return: Success: The class of the dataspace object
*
- * Errors:
+ * Failure: N5S_NO_CLASS
*
- * Programmer: Quincey Koziol
- * Thursday, July 23, 1998
- *
- * Modifications:
+ * Programmer: Quincey Koziol
+ * Thursday, July 23, 1998
*
*-------------------------------------------------------------------------
*/
H5S_class_t
H5Sget_simple_extent_type(hid_t sid)
{
- H5S_t *space;
- H5S_class_t ret_value;
+ H5S_t *space;
+ H5S_class_t ret_value; /* Return value */
FUNC_ENTER_API(H5S_NO_CLASS)
H5TRACE1("Sc", "i", sid);
/* Check arguments */
- if (NULL == (space = (H5S_t *)H5I_object_verify(sid, H5I_DATASPACE)))
+ if(NULL == (space = (H5S_t *)H5I_object_verify(sid, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5S_NO_CLASS, "not a dataspace")
- ret_value=H5S_GET_EXTENT_TYPE(space);
+ ret_value = H5S_GET_EXTENT_TYPE(space);
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Sget_simple_extent_type() */
/*--------------------------------------------------------------------------
@@ -1903,35 +1805,35 @@ done:
Resets the extent of a dataspace back to "none"
USAGE
herr_t H5Sset_extent_none(space_id)
- hid_t space_id; IN: Dataspace object to reset
+ hid_t space_id; IN: Dataspace object to reset
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
- This function resets the type of a dataspace back to "none" with no
+ This function resets the type of a dataspace back to "none" with no
extent information stored for the dataspace.
--------------------------------------------------------------------------*/
herr_t
H5Sset_extent_none(hid_t space_id)
{
- H5S_t *space; /* dataspace to modify */
- herr_t ret_value=SUCCEED; /* Return value */
+ H5S_t *space; /* Dataspace to modify */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", space_id);
/* Check args */
- if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a dataspace")
/* Clear the previous extent from the dataspace */
- if(H5S_extent_release(&space->extent)<0)
+ if(H5S__extent_release(&space->extent) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTDELETE, FAIL, "can't release previous dataspace")
- space->extent.type=H5S_NO_CLASS;
+ space->extent.type = H5S_NO_CLASS;
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Sset_extent_none() */
+} /* end H5Sset_extent_none() */
/*--------------------------------------------------------------------------
@@ -1980,12 +1882,11 @@ done:
/*-------------------------------------------------------------------------
* Function: H5S_set_extent
*
- * Purpose: Modify the dimensions of a dataspace. Based on H5S_extend
+ * Purpose: Modify the dimensions of a dataspace.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: TRUE/FALSE/FAIL
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Programmer: Pedro Vicente
* March 13, 2002
*
*-------------------------------------------------------------------------
@@ -2003,7 +1904,7 @@ H5S_set_extent(H5S_t *space, const hsize_t *size)
HDassert(size);
/* Verify that the dimensions being changed are allowed to change */
- for(u = 0; u < space->extent.rank; u++) {
+ for(u = 0; u < space->extent.rank; u++)
if(space->extent.size[u] != size[u]) {
/* Check for invalid dimension size modification */
if(space->extent.max && H5S_UNLIMITED != space->extent.max[u] &&
@@ -2013,7 +1914,6 @@ H5S_set_extent(H5S_t *space, const hsize_t *size)
/* Indicate that dimension size can be modified */
ret_value = TRUE;
} /* end if */
- } /* end for */
/* Update dimension size(s) */
if(ret_value)
@@ -2040,7 +1940,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-hbool_t
+H5_ATTR_PURE hbool_t
H5S_has_extent(const H5S_t *ds)
{
hbool_t ret_value = FALSE; /* Return value */
@@ -2061,12 +1961,12 @@ H5S_has_extent(const H5S_t *ds)
/*-------------------------------------------------------------------------
* Function: H5S_set_extent_real
*
- * Purpose: Modify the dimensions of a dataspace. Based on H5S_extend
+ * Purpose: Modify the dimensions of a dataspace.
*
* Return: Success: Non-negative
* Failure: Negative
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Programmer: Pedro Vicente
* March 13, 2002
*
*-------------------------------------------------------------------------
@@ -2106,24 +2006,25 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Sextent_equal
+ * Function: H5Sextent_equal
*
- * Purpose: Determines if two dataspace extents are equal.
+ * Purpose: Determines if two dataspace extents are equal.
*
- * Return: Success: TRUE if equal, FALSE if unequal
+ * Return: Success: TRUE if equal, FALSE if unequal
*
- * Failure: Negative
+ * Failure: FAIL
*
- * Programmer: Quincey Koziol
- * Monday, October 24, 2005
+ * Programmer: Quincey Koziol
+ * Monday, October 24, 2005
*
*-------------------------------------------------------------------------
*/
htri_t
H5Sextent_equal(hid_t space1_id, hid_t space2_id)
{
- const H5S_t *ds1, *ds2; /* Dataspaces to compare */
- htri_t ret_value;
+ const H5S_t *ds1; /* Dataspaces to compare */
+ const H5S_t *ds2;
+ htri_t ret_value;
FUNC_ENTER_API(FAIL)
H5TRACE2("t", "ii", space1_id, space2_id);
@@ -2131,11 +2032,11 @@ H5Sextent_equal(hid_t space1_id, hid_t space2_id)
/* check args */
if(NULL == (ds1 = (const H5S_t *)H5I_object_verify(space1_id, H5I_DATASPACE)) ||
NULL == (ds2 = (const H5S_t *)H5I_object_verify(space2_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
/* Check dataspaces for extent's equality */
if((ret_value = H5S_extent_equal(ds1, ds2)) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "dataspace comparison failed")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "dataspace comparison failed")
done:
FUNC_LEAVE_API(ret_value)
@@ -2149,13 +2050,13 @@ done:
Check if two dataspaces have equal extents
USAGE
htri_t H5S_extent_equal(ds1, ds2)
- H5S_t *ds1, *ds2; IN: Dataspace objects to compare
+ H5S_t *ds1, *ds2; IN: Dataspace objects to compare
RETURNS
TRUE if equal, FALSE if unequal on succeess/Negative on failure
DESCRIPTION
- Compare two dataspaces if their extents are identical.
+ Compare two dataspaces if their extents are identical.
--------------------------------------------------------------------------*/
-htri_t
+H5_ATTR_PURE htri_t
H5S_extent_equal(const H5S_t *ds1, const H5S_t *ds2)
{
unsigned u; /* Local index variable */
@@ -2204,19 +2105,19 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5S_extent_nelem
+ * Function: H5S_extent_nelem
*
- * Purpose: Determines how many elements a dataset extent describes.
+ * Purpose: Determines how many elements a dataset extent describes.
*
- * Return: Success: Number of data points in the dataset extent.
- * Failure: negative
+ * Return: Success: Number of data points in the dataset extent.
+ * Failure: Negative
*
- * Programmer: Quincey Koziol
- * Thursday, November 30, 2006
+ * Programmer: Quincey Koziol
+ * Thursday, November 30, 2006
*
*-------------------------------------------------------------------------
*/
-hsize_t
+H5_ATTR_PURE hsize_t
H5S_extent_nelem(const H5S_extent_t *ext)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -2264,6 +2165,5 @@ H5S_set_version(H5F_t *f, H5S_t *ds)
done:
FUNC_LEAVE_NOAPI(ret_value)
-
} /* end H5S_set_version() */
diff --git a/src/H5Sall.c b/src/H5Sall.c
index 8262f9b..da466d0 100644
--- a/src/H5Sall.c
+++ b/src/H5Sall.c
@@ -18,16 +18,36 @@
* Purpose: "All" selection dataspace I/O functions.
*/
+/****************/
+/* Module Setup */
+/****************/
+
#include "H5Smodule.h" /* This source code file is part of the H5S module */
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Iprivate.h" /* ID Functions */
-#include "H5Spkg.h" /* Dataspace functions */
-#include "H5VMprivate.h" /* Vector functions */
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* ID Functions */
+#include "H5Spkg.h" /* Dataspace functions */
+#include "H5VMprivate.h" /* Vector functions */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
-/* Static function prototypes */
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
/* Selection callbacks */
static herr_t H5S__all_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection);
@@ -59,6 +79,16 @@ static herr_t H5S__all_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem);
static herr_t H5S__all_iter_next_block(H5S_sel_iter_t *sel_iter);
static herr_t H5S__all_iter_release(H5S_sel_iter_t *sel_iter);
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
/* Selection properties for "all" selections */
const H5S_select_class_t H5S_sel_all[1] = {{
H5S_SEL_ALL,
@@ -84,6 +114,11 @@ const H5S_select_class_t H5S_sel_all[1] = {{
H5S__all_iter_init,
}};
+
+/*******************/
+/* Local Variables */
+/*******************/
+
/* Iteration properties for "all" selections */
static const H5S_sel_iter_class_t H5S_sel_iter_all[1] = {{
H5S_SEL_ALL,
@@ -98,13 +133,14 @@ static const H5S_sel_iter_class_t H5S_sel_iter_all[1] = {{
H5S__all_iter_release,
}};
+
/*-------------------------------------------------------------------------
* Function: H5S__all_iter_init
*
* Purpose: Initializes iteration information for "all" selection.
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Tuesday, June 16, 1998
@@ -131,7 +167,7 @@ H5S__all_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
iter->type = H5S_sel_iter_all;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S__all_iter_init() */
+} /* end H5S__all_iter_init() */
/*-------------------------------------------------------------------------
@@ -140,7 +176,7 @@ H5S__all_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
* Purpose: Retrieve the current coordinates of iterator for current
* selection
*
- * Return: non-negative on success, negative on failure
+ * Return: Non-negative on success, negative on failure
*
* Programmer: Quincey Koziol
* Tuesday, April 22, 2003
@@ -164,7 +200,7 @@ H5S__all_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S__all_iter_coords() */
+} /* end H5S__all_iter_coords() */
/*-------------------------------------------------------------------------
@@ -173,7 +209,7 @@ done:
* Purpose: Retrieve the current block of iterator for current
* selection
*
- * Return: non-negative on success, negative on failure
+ * Return: Non-negative on success, negative on failure
*
* Programmer: Quincey Koziol
* Monday, June 2, 2003
@@ -203,7 +239,7 @@ H5S__all_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
} /* end for */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S__all_iter_block() */
+} /* end H5S__all_iter_block() */
/*-------------------------------------------------------------------------
@@ -211,7 +247,7 @@ H5S__all_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
*
* Purpose: Return number of elements left to process in iterator
*
- * Return: non-negative number of elements on success, zero on failure
+ * Return: Non-negative number of elements on success, zero on failure
*
* Programmer: Quincey Koziol
* Tuesday, June 16, 1998
@@ -227,7 +263,7 @@ H5S__all_iter_nelmts(const H5S_sel_iter_t *iter)
HDassert(iter);
FUNC_LEAVE_NOAPI(iter->elmt_left)
-} /* H5S__all_iter_nelmts() */
+} /* end H5S__all_iter_nelmts() */
/*--------------------------------------------------------------------------
@@ -256,7 +292,7 @@ H5S__all_iter_has_next_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter)
HDassert(iter);
FUNC_LEAVE_NOAPI(FALSE)
-} /* H5S__all_iter_has_next_block() */
+} /* end H5S__all_iter_has_next_block() */
/*--------------------------------------------------------------------------
@@ -291,7 +327,7 @@ H5S__all_iter_next(H5S_sel_iter_t *iter, size_t nelem)
iter->u.all.byte_offset += (nelem * iter->elmt_size);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S__all_iter_next() */
+} /* end H5S__all_iter_next() */
/*--------------------------------------------------------------------------
@@ -320,7 +356,7 @@ H5S__all_iter_next_block(H5S_sel_iter_t H5_ATTR_UNUSED *iter)
HDassert(iter);
FUNC_LEAVE_NOAPI(FAIL)
-} /* H5S__all_iter_next_block() */
+} /* end H5S__all_iter_next_block() */
/*--------------------------------------------------------------------------
@@ -349,7 +385,7 @@ H5S__all_iter_release(H5S_sel_iter_t H5_ATTR_UNUSED * iter)
HDassert(iter);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S__all_iter_release() */
+} /* end H5S__all_iter_release() */
/*--------------------------------------------------------------------------
@@ -381,7 +417,7 @@ H5S__all_release(H5S_t *space)
space->select.num_elem = 0;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S__all_release() */
+} /* end H5S__all_release() */
/*--------------------------------------------------------------------------
@@ -456,7 +492,7 @@ H5S__all_is_valid(const H5S_t H5_ATTR_UNUSED *space)
Determine the number of bytes needed to store the serialized "all"
selection information.
USAGE
- hssize_t H5S_all_serial_size(space)
+ hssize_t H5S__all_serial_size(space)
H5S_t *space; IN: Dataspace pointer to query
RETURNS
The number of bytes required on success, negative on an error.
@@ -469,7 +505,7 @@ H5S__all_is_valid(const H5S_t H5_ATTR_UNUSED *space)
REVISION LOG
--------------------------------------------------------------------------*/
static hssize_t
-H5S__all_serial_size (const H5S_t H5_ATTR_UNUSED *space)
+H5S__all_serial_size(const H5S_t H5_ATTR_UNUSED *space)
{
FUNC_ENTER_STATIC_NOERR
@@ -526,7 +562,7 @@ H5S__all_serialize(const H5S_t *space, uint8_t **p)
*p = pp;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S__all_serialize() */
+} /* end H5S__all_serialize() */
/*--------------------------------------------------------------------------
@@ -601,7 +637,7 @@ done:
HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace")
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S__all_deserialize() */
+} /* end H5S__all_deserialize() */
/*--------------------------------------------------------------------------
@@ -651,7 +687,7 @@ H5S__all_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
} /* end for */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S__all_bounds() */
+} /* end H5S__all_bounds() */
/*--------------------------------------------------------------------------
@@ -686,7 +722,7 @@ H5S__all_offset(const H5S_t H5_ATTR_UNUSED *space, hsize_t *offset)
*offset = 0;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S__all_offset() */
+} /* end H5S__all_offset() */
/*--------------------------------------------------------------------------
@@ -745,7 +781,7 @@ H5S__all_is_contiguous(const H5S_t H5_ATTR_UNUSED *space)
HDassert(space);
FUNC_LEAVE_NOAPI(TRUE)
-} /* H5S__all_is_contiguous() */
+} /* end H5S__all_is_contiguous() */
/*--------------------------------------------------------------------------
@@ -774,7 +810,7 @@ H5S__all_is_single(const H5S_t H5_ATTR_UNUSED *space)
HDassert(space);
FUNC_LEAVE_NOAPI(TRUE)
-} /* H5S__all_is_single() */
+} /* end H5S__all_is_single() */
/*--------------------------------------------------------------------------
@@ -805,7 +841,7 @@ H5S__all_is_regular(const H5S_t H5_ATTR_UNUSED *space)
HDassert(space);
FUNC_LEAVE_NOAPI(TRUE)
-} /* H5S__all_is_regular() */
+} /* end H5S__all_is_regular() */
/*--------------------------------------------------------------------------
@@ -836,7 +872,7 @@ H5S__all_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *off
HDassert(offset);
FUNC_LEAVE_NOAPI_VOID
-} /* H5S__all_adjust_u() */
+} /* end H5S__all_adjust_u() */
/*-------------------------------------------------------------------------
@@ -845,7 +881,7 @@ H5S__all_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *off
* Purpose: Projects a single element 'all' selection into a scalar
* dataspace
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Sunday, July 18, 2010
@@ -865,7 +901,7 @@ H5S__all_project_scalar(const H5S_t H5_ATTR_UNUSED *space, hsize_t *offset)
*offset = 0;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S__all_project_scalar() */
+} /* end H5S__all_project_scalar() */
/*-------------------------------------------------------------------------
@@ -874,7 +910,7 @@ H5S__all_project_scalar(const H5S_t H5_ATTR_UNUSED *space, hsize_t *offset)
* Purpose: Projects an 'all' selection onto/into a simple dataspace
* of a different rank
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Sunday, July 18, 2010
@@ -882,7 +918,8 @@ H5S__all_project_scalar(const H5S_t H5_ATTR_UNUSED *space, hsize_t *offset)
*-------------------------------------------------------------------------
*/
static herr_t
-H5S__all_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *offset)
+H5S__all_project_simple(const H5S_t H5_ATTR_UNUSED *base_space,
+ H5S_t *new_space, hsize_t H5_ATTR_UNUSED *offset)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -899,7 +936,7 @@ H5S__all_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *offs
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S__all_project_simple() */
+} /* end H5S__all_project_simple() */
/*--------------------------------------------------------------------------
@@ -943,7 +980,7 @@ H5S_select_all(H5S_t *space, hbool_t rel_prev)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_all() */
+} /* end H5S_select_all() */
/*--------------------------------------------------------------------------
@@ -982,7 +1019,7 @@ H5Sselect_all(hid_t spaceid)
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Sselect_all() */
+} /* end H5Sselect_all() */
/*--------------------------------------------------------------------------
diff --git a/src/H5Sdbg.c b/src/H5Sdbg.c
index 6ffa2a9..32f5295 100644
--- a/src/H5Sdbg.c
+++ b/src/H5Sdbg.c
@@ -13,11 +13,12 @@
/*-------------------------------------------------------------------------
*
- * Created: H5Sdbg.c
- * Jul 24 2007
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Created: H5Sdbg.c
+ * Quincey Koziol
+ * Jul 24 2007
+ *
*
- * Purpose: Dump debugging information about a dataspace
+ * Purpose: Dump debugging information about a dataspace
*
*-------------------------------------------------------------------------
*/
@@ -57,30 +58,30 @@
/********************/
-/*********************/
-/* Package Variables */
-/*********************/
-
-
/*****************************/
/* Library Private Variables */
/*****************************/
+/*********************/
+/* Package Variables */
+/*********************/
+
+
/*******************/
/* Local Variables */
/*******************/
-
+
/*-------------------------------------------------------------------------
* Function: H5S_debug
*
- * Purpose: Prints debugging information about a dataspace.
+ * Purpose: Prints debugging information about a dataspace.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Tuesday, July 21, 1998
*
*-------------------------------------------------------------------------
@@ -88,7 +89,7 @@
herr_t
H5S_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth)
{
- const H5S_t *mesg = (const H5S_t*)_mesg;
+ const H5S_t *mesg = (const H5S_t*)_mesg;
FUNC_ENTER_NOAPI_NOINIT_NOERR
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index 405e6a9..e94c66e 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -15,19 +15,27 @@
* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
* Thursday, June 18, 1998
*
- * Purpose: Hyperslab selection dataspace I/O functions.
+ * Purpose: Hyperslab selection dataspace I/O functions.
*/
+/****************/
+/* Module Setup */
+/****************/
+
#include "H5Smodule.h" /* This source code file is part of the H5S module */
-#include "H5private.h" /* Generic Functions */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5Iprivate.h" /* ID Functions */
-#include "H5Spkg.h" /* Dataspace functions */
-#include "H5VMprivate.h" /* Vector functions */
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5Iprivate.h" /* ID Functions */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Spkg.h" /* Dataspace functions */
+#include "H5VMprivate.h" /* Vector functions */
/* Format version bounds for dataspace hyperslab selection */
const unsigned H5O_sds_hyper_ver_bounds[] = {
@@ -36,9 +44,18 @@ const unsigned H5O_sds_hyper_ver_bounds[] = {
H5S_HYPER_VERSION_2 /* H5F_LIBVER_LATEST */
};
-/* Local datatypes */
+/****************/
+/* Local Macros */
+/****************/
+
-/* Static function prototypes */
+/******************/
+/* Local Typedefs */
+/******************/
+
+/********************/
+/* Local 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);
@@ -72,7 +89,7 @@ static herr_t H5S__generate_hyperslab(H5S_t *space, H5S_seloper_t op,
const hsize_t block[]);
/* 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);
+static herr_t H5S__select_select(H5S_t *space1, H5S_seloper_t op, H5S_t *space2);
#endif /*NEW_HYPERSLAB_API*/
static void H5S__hyper_get_clip_diminfo(hsize_t start, hsize_t stride,
hsize_t *count, hsize_t *block, hsize_t clip_size);
@@ -115,6 +132,16 @@ static hbool_t H5S__hyper_rebuild_helper(const H5S_hyper_span_t *span,
H5S_hyper_dim_t span_slab_info[], unsigned rank);
static hbool_t H5S__hyper_rebuild(H5S_t *space);
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
/* Selection properties for hyperslab selections */
const H5S_select_class_t H5S_sel_hyper[1] = {{
H5S_SEL_HYPERSLABS,
@@ -542,14 +569,14 @@ H5S__hyper_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords)
/*-------------------------------------------------------------------------
- * Function: H5S__hyper_iter_block
+ * Function: H5S__hyper_iter_block
*
- * Purpose: Retrieve the current block of iterator for current
+ * Purpose: Retrieve the current block of iterator for current
* selection
*
- * Return: non-negative on success, negative on failure
+ * Return: Non-negative on success, negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Monday, June 2, 2003
*
* Notes: This routine assumes that the iterator is always located at
@@ -573,7 +600,7 @@ H5S__hyper_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
/* Check for a single "regular" hyperslab */
if(iter->u.hyp.diminfo_valid) {
- /* Compute the end of the block */
+ /* Copy the start and compute the end of the block */
for(u = 0; u < iter->rank; u++) {
start[u] = iter->u.hyp.off[u];
end[u] = (start[u] + iter->u.hyp.diminfo[u].block) - 1;
@@ -594,13 +621,13 @@ H5S__hyper_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
/*-------------------------------------------------------------------------
- * Function: H5S__hyper_iter_nelmts
+ * Function: H5S__hyper_iter_nelmts
*
- * Purpose: Return number of elements left to process in iterator
+ * Purpose: Return number of elements left to process in iterator
*
- * Return: non-negative number of elements on success, zero on failure
+ * Return: Non-negative number of elements on success, zero on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Tuesday, June 16, 1998
*
*-------------------------------------------------------------------------
@@ -634,7 +661,7 @@ H5S__hyper_iter_nelmts(const H5S_sel_iter_t *iter)
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static htri_t
+static H5_ATTR_PURE htri_t
H5S__hyper_iter_has_next_block(const H5S_sel_iter_t *iter)
{
unsigned u; /* Local index variable */
@@ -674,15 +701,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5S__hyper_iter_next
+ * Function: H5S__hyper_iter_next
*
- * Purpose: Moves a hyperslab iterator to the beginning of the next sequence
- * of elements to read. Handles walking off the end in all dimensions.
+ * Purpose: Moves a hyperslab iterator to the beginning of the next sequence
+ * of elements to read. Handles walking off the end in all dimensions.
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return: Success: non-negative
+ * Failure: negative
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Friday, September 8, 2000
*
*-------------------------------------------------------------------------
@@ -692,7 +719,7 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
{
unsigned ndims; /* Number of dimensions of dataset */
int fast_dim; /* Rank of the fastest changing dimension for the dataspace */
- unsigned i; /* Counters */
+ unsigned u; /* Counters */
FUNC_ENTER_STATIC_NOERR
@@ -705,14 +732,12 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
int temp_dim; /* Temporary rank holder */
/* Check if this is a "flattened" regular hyperslab selection */
- if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < iter->rank) {
+ if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < iter->rank)
/* Set the aliases for the dimension rank */
ndims = iter->u.hyp.iter_rank;
- } /* end if */
- else {
+ else
/* Set the aliases for the dimension rank */
ndims = iter->rank;
- } /* end else */
/* Set the fastest dimension rank */
fast_dim = (int)ndims - 1;
@@ -721,23 +746,23 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
tdiminfo = iter->u.hyp.diminfo;
/* Calculate the offset and block count for each dimension */
- for(i = 0; i < ndims; i++) {
- if(tdiminfo[i].count == 1) {
- iter_offset[i] = iter->u.hyp.off[i] - tdiminfo[i].start;
- iter_count[i] = 0;
+ for(u = 0; u < ndims; u++) {
+ if(tdiminfo[u].count == 1) {
+ iter_offset[u] = iter->u.hyp.off[u] - tdiminfo[u].start;
+ iter_count[u] = 0;
} /* end if */
else {
- iter_offset[i] = (iter->u.hyp.off[i] - tdiminfo[i].start) % tdiminfo[i].stride;
- iter_count[i] = (iter->u.hyp.off[i] - tdiminfo[i].start) / tdiminfo[i].stride;
+ iter_offset[u] = (iter->u.hyp.off[u] - tdiminfo[u].start) % tdiminfo[u].stride;
+ iter_count[u] = (iter->u.hyp.off[u] - tdiminfo[u].start) / tdiminfo[u].stride;
} /* end else */
} /* end for */
/* Loop through, advancing the offset & counts, until all the nelements are accounted for */
while(nelem > 0) {
/* Start with the fastest changing dimension */
- temp_dim=fast_dim;
- while(temp_dim>=0) {
- if(temp_dim==fast_dim) {
+ temp_dim = fast_dim;
+ while(temp_dim >= 0) {
+ if(temp_dim == fast_dim) {
size_t actual_elem; /* Actual # of elements advanced on each iteration through loop */
hsize_t block_elem; /* Number of elements left in a block */
@@ -745,7 +770,7 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
block_elem = tdiminfo[temp_dim].block - iter_offset[temp_dim];
/* Compute the number of actual elements to advance */
- actual_elem=(size_t)MIN(nelem,block_elem);
+ actual_elem = (size_t)MIN(nelem,block_elem);
/* Move the iterator over as many elements as possible */
iter_offset[temp_dim] += actual_elem;
@@ -753,10 +778,9 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
/* Decrement the number of elements advanced */
nelem -= actual_elem;
} /* end if */
- else {
+ else
/* Move to the next row in the current dimension */
iter_offset[temp_dim]++;
- } /* end else */
/* If this block is still in the range of blocks to output for the dimension, break out of loop */
if(iter_offset[temp_dim] < tdiminfo[temp_dim].block)
@@ -779,8 +803,8 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
} /* end while */
/* Translate current iter_offset and iter_count into iterator position */
- for(i = 0; i < ndims; i++)
- iter->u.hyp.off[i] = tdiminfo[i].start + (tdiminfo[i].stride * iter_count[i]) + iter_offset[i];
+ for(u = 0; u < ndims; u++)
+ iter->u.hyp.off[u] = tdiminfo[u].start + (tdiminfo[u].stride * iter_count[u]) + iter_offset[u];
} /* end if */
/* Must be an irregular hyperslab selection */
else {
@@ -808,7 +832,7 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
curr_span = ispan[curr_dim];
/* Increment absolute position */
- if(curr_dim==fast_dim) {
+ if(curr_dim == fast_dim) {
size_t actual_elem; /* Actual # of elements advanced on each iteration through loop */
hsize_t span_elem; /* Number of elements left in a span */
@@ -824,15 +848,13 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
/* Decrement the number of elements advanced */
nelem -= actual_elem;
} /* end if */
- else {
+ else
/* Move to the next row in the current dimension */
abs_arr[curr_dim]++;
- } /* end else */
/* Check if we are still within the span */
- if(abs_arr[curr_dim] <= curr_span->high) {
+ if(abs_arr[curr_dim] <= curr_span->high)
break;
- } /* end if */
/* If we walked off that span, advance to the next span */
else {
/* Advance span in this dimension */
@@ -848,10 +870,9 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
break;
} /* end if */
- else {
+ else
/* If we finished the span list in this dimension, decrement the dimension worked on and loop again */
curr_dim--;
- } /* end else */
} /* end else */
} /* end while */
@@ -887,15 +908,15 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
/*-------------------------------------------------------------------------
- * Function: H5S__hyper_iter_next_block
+ * Function: H5S__hyper_iter_next_block
*
- * Purpose: Moves a hyperslab iterator to the beginning of the next sequence
- * of elements to read. Handles walking off the end in all dimensions.
+ * Purpose: Moves a hyperslab iterator to the beginning of the next sequence
+ * of elements to read. Handles walking off the end in all dimensions.
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return: Success: non-negative
+ * Failure: negative
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Tuesday, June 3, 2003
*
*-------------------------------------------------------------------------
@@ -910,7 +931,7 @@ H5S__hyper_iter_next_block(H5S_sel_iter_t *iter)
FUNC_ENTER_STATIC_NOERR
/* Check for the special case of just one H5Sselect_hyperslab call made */
- /* (i.e. a regular hyperslab selection */
+ /* (i.e. a regular hyperslab selection) */
if(iter->u.hyp.diminfo_valid) {
const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
hsize_t iter_offset[H5O_LAYOUT_NDIMS];
@@ -918,14 +939,12 @@ H5S__hyper_iter_next_block(H5S_sel_iter_t *iter)
int temp_dim; /* Temporary rank holder */
/* Check if this is a "flattened" regular hyperslab selection */
- if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < iter->rank) {
+ if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < iter->rank)
/* Set the aliases for the dimension rank */
ndims = iter->u.hyp.iter_rank;
- } /* end if */
- else {
+ else
/* Set the aliases for the dimension rank */
ndims = iter->rank;
- } /* end else */
/* Set the fastest dimension rank */
fast_dim = (int)ndims - 1;
@@ -948,14 +967,12 @@ H5S__hyper_iter_next_block(H5S_sel_iter_t *iter)
/* Advance one block */
temp_dim = fast_dim; /* Start with the fastest changing dimension */
while(temp_dim >= 0) {
- if(temp_dim == fast_dim) {
+ if(temp_dim == fast_dim)
/* Move iterator over current block */
iter_offset[temp_dim] += tdiminfo[temp_dim].block;
- } /* end if */
- else {
+ else
/* Move to the next row in the current dimension */
iter_offset[temp_dim]++;
- } /* end else */
/* If this block is still in the range of blocks to output for the dimension, break out of loop */
if(iter_offset[temp_dim] < tdiminfo[temp_dim].block)
@@ -1004,19 +1021,16 @@ H5S__hyper_iter_next_block(H5S_sel_iter_t *iter)
curr_span = ispan[curr_dim];
/* Increment absolute position */
- if(curr_dim == fast_dim) {
+ if(curr_dim == fast_dim)
/* Move the iterator over rest of element in span */
abs_arr[curr_dim] = curr_span->high + 1;
- } /* end if */
- else {
+ else
/* Move to the next row in the current dimension */
abs_arr[curr_dim]++;
- } /* end else */
/* Check if we are still within the span */
- if(abs_arr[curr_dim] <= curr_span->high) {
+ if(abs_arr[curr_dim] <= curr_span->high)
break;
- } /* end if */
/* If we walked off that span, advance to the next span */
else {
/* Advance span in this dimension */
@@ -1032,10 +1046,9 @@ H5S__hyper_iter_next_block(H5S_sel_iter_t *iter)
break;
} /* end if */
- else {
+ else
/* If we finished the span list in this dimension, decrement the dimension worked on and loop again */
curr_dim--;
- } /* end else */
} /* end else */
} /* end while */
@@ -1066,7 +1079,7 @@ H5S__hyper_iter_next_block(H5S_sel_iter_t *iter)
} /* end else */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S__hyper_iter_next() */
+} /* end H5S__hyper_iter_next_block() */
/*--------------------------------------------------------------------------
@@ -1425,22 +1438,22 @@ done:
NAME
H5S__hyper_cmp_spans
PURPOSE
- Check if two hyperslab slabs are the same
+ Check if two hyperslab span trees are the same
USAGE
hbool_t H5S__hyper_cmp_spans(span1, span2)
- H5S_hyper_span_t *span1; IN: First span tree to compare
- H5S_hyper_span_t *span2; IN: Second span tree to compare
+ H5S_hyper_span_info_t *span_info1; IN: First span tree to compare
+ H5S_hyper_span_info_t *span_info2; IN: Second span tree to compare
RETURNS
TRUE (1) or FALSE (0) on success, can't fail
DESCRIPTION
- Compare two hyperslab slabs to determine if they refer to the same
- selection. If span1 & span2 are both NULL, that counts as equal
+ Compare two hyperslab span trees to determine if they refer to the same
+ selection. If span1 & span2 are both NULL, that counts as equal.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static hbool_t
+static H5_ATTR_PURE hbool_t
H5S__hyper_cmp_spans(const H5S_hyper_span_info_t *span_info1, const H5S_hyper_span_info_t *span_info2)
{
hbool_t ret_value = FALSE; /* Return value */
@@ -1545,6 +1558,7 @@ H5S__hyper_free_span_info(H5S_hyper_span_info_t *span_info)
FUNC_ENTER_STATIC
+ /* Sanity check */
HDassert(span_info);
/* Decrement the span tree's reference count */
@@ -1597,6 +1611,7 @@ H5S__hyper_free_span(H5S_hyper_span_t *span)
FUNC_ENTER_STATIC
+ /* Sanity check */
HDassert(span);
/* Decrement the reference count of the 'down spans', freeing them if appropriate */
@@ -1618,11 +1633,12 @@ done:
PURPOSE
Copy a selection from one dataspace to another
USAGE
- herr_t H5S__hyper_copy(dst, src)
+ herr_t H5S__hyper_copy(dst, src, share_selection)
H5S_t *dst; OUT: Pointer to the destination dataspace
H5S_t *src; IN: Pointer to the source dataspace
+ hbool_t; IN: Whether to share the selection between the dataspaces
RETURNS
- Non-negative on success/Negative on failure
+ Non-negative on success, negative on failure
DESCRIPTION
Copies all the hyperslab selection information from the source
dataspace to the destination dataspace.
@@ -1953,12 +1969,12 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5S_hyper_get_version_enc_size
+ H5S__hyper_get_version_enc_size
PURPOSE
Determine the version and encoded size to use for encoding hyperslab selection info
See tables 2 & 3 in the RFC: H5Sencode/H5Sdecode Format Change
USAGE
- hssize_t H5S_hyper_get_version_enc_size(space, block_count, version, enc_size)
+ hssize_t H5S__hyper_get_version_enc_size(space, block_count, version, enc_size)
const H5S_t *space: IN: The dataspace
hsize_t block_count: IN: The number of blocks in the selection
uint32_t *version: OUT: The version to use for encoding
@@ -1976,7 +1992,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_hyper_get_version_enc_size(const H5S_t *space, hsize_t block_count, uint32_t *version, uint8_t *enc_size)
+H5S__hyper_get_version_enc_size(const H5S_t *space, hsize_t block_count, uint32_t *version, uint8_t *enc_size)
{
hsize_t bounds_start[H5S_MAX_RANK]; /* Starting coordinate of bounding box */
hsize_t bounds_end[H5S_MAX_RANK]; /* Opposite coordinate of bounding box */
@@ -1988,16 +2004,15 @@ H5S_hyper_get_version_enc_size(const H5S_t *space, hsize_t block_count, uint32_t
uint32_t tmp_version; /* Temporay version */
herr_t ret_value = SUCCEED; /* return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Get bounding box for the selection */
HDmemset(bounds_end, 0, sizeof(bounds_end));
- if(space->select.sel_info.hslab->unlim_dim < 0) { /* ! H5S_UNLIMITED */
+ if(space->select.sel_info.hslab->unlim_dim < 0) /* ! H5S_UNLIMITED */
/* Get bounding box for the selection */
if(H5S__hyper_bounds(space, bounds_start, bounds_end) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds")
- }
/* Determine whether the number of blocks or the high bounds in the selection exceed (2^32 - 1) */
if(block_count > H5S_UINT32_MAX)
@@ -2051,13 +2066,13 @@ H5S_hyper_get_version_enc_size(const H5S_t *space, hsize_t block_count, uint32_t
break;
default:
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper encoded size")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown hyperslab selection version")
break;
}
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_hyper_get_version_enc_size() */
+} /* H5S__hyper_get_version_enc_size() */
/*--------------------------------------------------------------------------
@@ -2067,7 +2082,7 @@ done:
Determine the number of bytes needed to store the serialized hyperslab
selection information.
USAGE
- hssize_t H5S_hyper_serial_size(space)
+ hssize_t H5S__hyper_serial_size(space)
H5S_t *space; IN: Dataspace pointer to query
RETURNS
The number of bytes required on success, negative on an error.
@@ -2087,7 +2102,7 @@ H5S__hyper_serial_size(const H5S_t *space)
uint8_t enc_size; /* Encoded size of hyperslab selection info */
hssize_t ret_value = -1; /* return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
HDassert(space);
@@ -2096,8 +2111,8 @@ H5S__hyper_serial_size(const H5S_t *space)
block_count = H5S__get_select_hyper_nblocks(space, FALSE);
/* Determine the version and the encoded size */
- if(H5S_hyper_get_version_enc_size(space, block_count, &version, &enc_size) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version")
+ if(H5S__hyper_get_version_enc_size(space, block_count, &version, &enc_size) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version & enc_size")
if(version == H5S_HYPER_VERSION_2) {
/* Version 2 */
@@ -2109,7 +2124,8 @@ H5S__hyper_serial_size(const H5S_t *space)
*/
HDassert(enc_size == 8);
ret_value = (hssize_t)17 + ((hssize_t)4 * (hssize_t)8 * (hssize_t)space->extent.rank);
- } else {
+ }
+ else {
HDassert(version == H5S_HYPER_VERSION_1);
HDassert(enc_size == 4);
/* Version 1 */
@@ -2207,7 +2223,7 @@ H5S__hyper_serialize_helper(const H5S_hyper_span_info_t *spans,
*p = pp;
FUNC_LEAVE_NOAPI_VOID
-} /* H5S__hyper_serialize_helper() */
+} /* end H5S__hyper_serialize_helper() */
/*--------------------------------------------------------------------------
@@ -2253,7 +2269,7 @@ H5S__hyper_serialize(const H5S_t *space, uint8_t **p)
uint8_t enc_size; /* Encoded size */
herr_t ret_value = SUCCEED; /* return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(space);
@@ -2269,9 +2285,9 @@ H5S__hyper_serialize(const H5S_t *space, uint8_t **p)
if(space->select.sel_info.hslab->unlim_dim < 0) /* ! H5S_UNLIMITED */
block_count = H5S__get_select_hyper_nblocks(space, FALSE);
- /* Determine the version to use */
- if(H5S_hyper_get_version_enc_size(space, block_count, &version, &enc_size) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version")
+ /* Determine the version and the encoded size */
+ if(H5S__hyper_get_version_enc_size(space, block_count, &version, &enc_size) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version & enc_size")
is_regular = H5S__hyper_is_regular(space);
if(is_regular && version == H5S_HYPER_VERSION_2)
@@ -2392,8 +2408,8 @@ H5S__hyper_serialize(const H5S_t *space, uint8_t **p)
offset[u] = diminfo[u].start + diminfo[u].stride * (diminfo[u].count - tmp_count[u]);
} /* end while */
} /* end if */
-
- } else { /* irregular */
+ }
+ else { /* irregular */
HDassert(version == H5S_HYPER_VERSION_1);
HDassert(enc_size == H5S_SELECT_INFO_ENC_SIZE_4);
@@ -2419,7 +2435,7 @@ H5S__hyper_serialize(const H5S_t *space, uint8_t **p)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_hyper_serialize() */
+} /* end H5S__hyper_serialize() */
/*--------------------------------------------------------------------------
@@ -2490,7 +2506,8 @@ H5S__hyper_deserialize(H5S_t **space, const uint8_t **p)
/* Skip over the remainder of the header */
pp += 4;
- } else
+ }
+ else
/* Skip over the remainder of the header */
pp += 8;
@@ -7825,18 +7842,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5S__combine_select
+ * Function: H5S__combine_select
*
- * Purpose: Internal version of H5Scombine_select().
+ * Purpose: Internal version of H5Scombine_select().
*
- * Return: New dataspace on success/NULL on failure
+ * Return: New dataspace on success/NULL on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Tuesday, October 30, 2001
*
- * Chao Mei
- * Wednesday, June 29, 2011
- *
*-------------------------------------------------------------------------
*/
static H5S_t *
@@ -7957,27 +7971,25 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5S_select_select
+ * Function: H5S__select_select
*
- * Purpose: Internal version of H5Sselect_select().
+ * Purpose: Internal version of H5Sselect_select().
*
- * Return: New dataspace on success/NULL on failure
+ * Return: New dataspace on success/NULL on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Tuesday, October 30, 2001
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_select_select (H5S_t *space1, H5S_seloper_t op, H5S_t *space2)
+H5S_select_select(H5S_t *space1, H5S_seloper_t op, H5S_t *space2)
{
- H5S_hyper_span_info_t *tmp_spans=NULL; /* Temporary copy of selection */
+ 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 */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(space1);
@@ -8017,7 +8029,7 @@ done:
H5S__hyper_free_span_info(tmp_spans);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_select_select() */
+} /* end H5S_select_select() */
/*--------------------------------------------------------------------------
@@ -8069,7 +8081,7 @@ H5Sselect_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspaces don't have hyperslab selections")
/* Go refine the first selection */
- if (H5S_select_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:
@@ -9966,11 +9978,11 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-void
+static void
H5S__hyper_get_clip_diminfo(hsize_t start, hsize_t stride, hsize_t *count,
hsize_t *block, hsize_t clip_size)
{
- FUNC_ENTER_PACKAGE_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check for selection outside clip size */
if(start >= clip_size) {
@@ -10010,9 +10022,8 @@ H5S__hyper_get_clip_diminfo(hsize_t start, hsize_t stride, hsize_t *count,
RETURNS
Non-negative on success/Negative on failure.
DESCRIPTION
- This function changes the unlimited selection into a limited selection
- with the extent of the formerly unlimited dimension specified by
- * clip_size.
+ This function changes the unlimited selection into a fixed-dimension selection
+ with the extent of the formerly unlimited dimension specified by clip_size.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
Note this function does not take the offset into account.
@@ -10022,11 +10033,11 @@ H5S__hyper_get_clip_diminfo(hsize_t start, hsize_t stride, hsize_t *count,
herr_t
H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size)
{
- H5S_hyper_sel_t *hslab; /* Convenience pointer to hyperslab info */
- hsize_t orig_count; /* Original count in unlimited dimension */
- int orig_unlim_dim; /* Original unliminted dimension */
- H5S_hyper_dim_t *diminfo; /* Convenience pointer to opt_diminfo in unlimited dimension */
- herr_t ret_value = SUCCEED;
+ H5S_hyper_sel_t *hslab = NULL; /* Convenience pointer to hyperslab info */
+ hsize_t orig_count; /* Original count in unlimited dimension */
+ int orig_unlim_dim; /* Original unliminted dimension */
+ H5S_hyper_dim_t *diminfo = NULL; /* Convenience pointer to opt_diminfo in unlimited dimension */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -10068,8 +10079,7 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size)
} /* end if */
else {
/* Calculate number of elements */
- space->select.num_elem = diminfo->count * diminfo->block
- * hslab->num_elem_non_unlim;
+ space->select.num_elem = diminfo->count * diminfo->block * hslab->num_elem_non_unlim;
/* Check if last block is partial. If superset is set, just keep the
* last block complete to speed computation. */
@@ -10375,13 +10385,13 @@ H5S_t *
H5S_hyper_get_unlim_block(const H5S_t *space, hsize_t block_index)
{
H5S_hyper_sel_t *hslab; /* Convenience pointer to hyperslab info */
- H5S_t *space_out = NULL;
- hsize_t start[H5S_MAX_RANK];
+ H5S_t *space_out = NULL; /* Dataspace to return */
+ hsize_t start[H5S_MAX_RANK];/* Hyperslab selection info for unlim. selection */
hsize_t stride[H5S_MAX_RANK];
hsize_t count[H5S_MAX_RANK];
hsize_t block[H5S_MAX_RANK];
- unsigned i;
- H5S_t *ret_value = NULL;
+ unsigned u; /* Local index variable */
+ H5S_t *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
@@ -10395,24 +10405,24 @@ H5S_hyper_get_unlim_block(const H5S_t *space, hsize_t block_index)
/* Set start to select block_indexth block in unlimited dimension and set
* count to 1 in that dimension to only select that block. Copy all other
* diminfo parameters. */
- for(i = 0; i < space->extent.rank; i++) {
- if((int)i == hslab->unlim_dim){
- start[i] = hslab->opt_diminfo[i].start + (block_index
- * hslab->opt_diminfo[i].stride);
- count[i] = (hsize_t)1;
+ for(u = 0; u < space->extent.rank; u++) {
+ if((int)u == hslab->unlim_dim){
+ start[u] = hslab->opt_diminfo[u].start + (block_index
+ * hslab->opt_diminfo[u].stride);
+ count[u] = (hsize_t)1;
} /* end if */
else {
- start[i] = hslab->opt_diminfo[i].start;
- count[i] = hslab->opt_diminfo[i].count;
+ start[u] = hslab->opt_diminfo[u].start;
+ count[u] = hslab->opt_diminfo[u].count;
} /* end else */
- stride[i] = hslab->opt_diminfo[i].stride;
- block[i] = hslab->opt_diminfo[i].block;
+ stride[u] = hslab->opt_diminfo[u].stride;
+ block[u] = hslab->opt_diminfo[u].block;
} /* end for */
/* Create output space, copy extent */
if(NULL == (space_out = H5S_create(H5S_SIMPLE)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, NULL, "unable to create output dataspace")
- if(H5S_extent_copy_real(&space_out->extent, &space->extent, TRUE) < 0)
+ if(H5S__extent_copy_real(&space_out->extent, &space->extent, TRUE) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "unable to copy destination space extent")
/* Select block as defined by start/stride/count/block computed above */
diff --git a/src/H5Smpio.c b/src/H5Smpio.c
index 60e2dc2..3f41be5 100644
--- a/src/H5Smpio.c
+++ b/src/H5Smpio.c
@@ -14,15 +14,20 @@
/*
* Programmer: rky 980813
*
- * Purpose: Functions to read/write directly between app buffer and file.
+ * Purpose: Create MPI data types for HDF5 selections.
*
- * Beware of the ifdef'ed print statements.
- * I didn't make them portable.
*/
+/****************/
+/* Module Setup */
+/****************/
+
#include "H5Smodule.h" /* This source code file is part of the H5S module */
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
@@ -37,67 +42,60 @@
#ifdef H5_HAVE_PARALLEL
-static herr_t H5S_mpio_all_type(const H5S_t *space, size_t elmt_size,
+/****************/
+/* Local Macros */
+/****************/
+#define H5S_MPIO_INITIAL_ALLOC_COUNT 256
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/********************/
+/* Local Prototypes */
+/********************/
+static herr_t H5S__mpio_all_type(const H5S_t *space, size_t elmt_size,
MPI_Datatype *new_type, int *count, hbool_t *is_derived_type);
-static herr_t H5S_mpio_none_type(MPI_Datatype *new_type, int *count,
+static herr_t H5S__mpio_none_type(MPI_Datatype *new_type, int *count,
hbool_t *is_derived_type);
-static herr_t H5S_mpio_create_point_datatype(size_t elmt_size, hsize_t num_points,
+static herr_t H5S__mpio_create_point_datatype(size_t elmt_size, hsize_t num_points,
MPI_Aint *disp, MPI_Datatype *new_type);
-static herr_t H5S_mpio_point_type(const H5S_t *space, size_t elmt_size,
+static herr_t H5S__mpio_point_type(const H5S_t *space, size_t elmt_size,
MPI_Datatype *new_type, int *count, hbool_t *is_derived_type,
hbool_t do_permute, hsize_t **permute_map, hbool_t *is_permuted);
-static herr_t H5S_mpio_permute_type(const H5S_t *space, size_t elmt_size,
+static herr_t H5S__mpio_permute_type(const H5S_t *space, size_t elmt_size,
hsize_t **permute_map, MPI_Datatype *new_type, int *count,
hbool_t *is_derived_type);
-static herr_t H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size,
+static herr_t H5S__mpio_hyper_type(const H5S_t *space, size_t elmt_size,
MPI_Datatype *new_type, int *count, hbool_t *is_derived_type);
-static herr_t H5S_mpio_span_hyper_type(const H5S_t *space, size_t elmt_size,
+static herr_t H5S__mpio_span_hyper_type(const H5S_t *space, size_t elmt_size,
MPI_Datatype *new_type, int *count, hbool_t *is_derived_type);
-static herr_t H5S_obtain_datatype(const hsize_t down[], H5S_hyper_span_t* span,
+static herr_t H5S__obtain_datatype(const hsize_t down[], H5S_hyper_span_t* span,
const MPI_Datatype *elmt_type, MPI_Datatype *span_type, size_t elmt_size);
-static herr_t H5S_mpio_create_large_type (hsize_t, MPI_Aint, MPI_Datatype , MPI_Datatype *);
-#define H5S_MPIO_INITIAL_ALLOC_COUNT 256
+/*****************************/
+/* Library Private Variables */
+/*****************************/
-#define TWO_GIG_LIMIT 2147483648
-#ifndef H5S_MAX_MPI_COUNT
-#define H5S_MAX_MPI_COUNT 536870911 /* (2^29)-1 */
-#endif
+/*********************/
+/* Package Variables */
+/*********************/
-static hsize_t bigio_count = H5S_MAX_MPI_COUNT;
-/*-------------------------------------------------------------------------
- * Function: H5S_mpio_set_bigio_count
- *
- * Purpose: Allow us to programatically change the switch point
- * when we utilize derived datatypes. This is of
- * particular interest for allowing nightly testing
- *
- * Return: the current/previous value of bigio_count.
- *
- * Programmer: Richard Warren, March 10, 2017
- *
- *-------------------------------------------------------------------------
- */
-hsize_t
-H5S_mpio_set_bigio_count(hsize_t new_count)
-{
- hsize_t orig_count = bigio_count;
- if ((new_count > 0) && (new_count < TWO_GIG_LIMIT)) {
- bigio_count = new_count;
- }
- return orig_count;
-}
/*-------------------------------------------------------------------------
- * Function: H5S_mpio_all_type
+ * Function: H5S__mpio_all_type
*
* Purpose: Translate an HDF5 "all" selection into an MPI type.
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Outputs: *new_type the MPI type corresponding to the selection
* *count how many objects of the new_type in selection
@@ -105,24 +103,20 @@ H5S_mpio_set_bigio_count(hsize_t new_count)
* *is_derived_type 0 if MPI primitive type, 1 if derived
*
* Programmer: rky 980813
- * Modifications:
- * Mohamad Chaarawi
- * Adding support for large datatypes (beyond the limit of a
- * 32 bit integer.
- *
*
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_mpio_all_type(const H5S_t *space, size_t elmt_size,
+H5S__mpio_all_type(const H5S_t *space, size_t elmt_size,
MPI_Datatype *new_type, int *count, hbool_t *is_derived_type)
{
hsize_t total_bytes;
hssize_t snelmts; /* Total number of elmts (signed) */
hsize_t nelmts; /* Total number of elmts */
+ hsize_t bigio_count; /* Transition point to create derived type */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(space);
@@ -133,34 +127,34 @@ H5S_mpio_all_type(const H5S_t *space, size_t elmt_size,
H5_CHECKED_ASSIGN(nelmts, hsize_t, snelmts, hssize_t);
total_bytes = (hsize_t)elmt_size * nelmts;
+ bigio_count = H5_mpi_get_bigio_count();
+
/* Verify that the size can be expressed as a 32 bit integer */
if(bigio_count >= total_bytes) {
- /* fill in the return values */
- *new_type = MPI_BYTE;
- H5_CHECKED_ASSIGN(*count, int, total_bytes, hsize_t);
- *is_derived_type = FALSE;
+ /* fill in the return values */
+ *new_type = MPI_BYTE;
+ H5_CHECKED_ASSIGN(*count, int, total_bytes, hsize_t);
+ *is_derived_type = FALSE;
}
else {
- /* Create a LARGE derived datatype for this transfer */
- if (H5S_mpio_create_large_type (total_bytes, 0, MPI_BYTE, new_type) < 0) {
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,
- "couldn't create a large datatype from the all selection")
- }
- *count = 1;
- *is_derived_type = TRUE;
+ /* Create a LARGE derived datatype for this transfer */
+ if(H5_mpio_create_large_type(total_bytes, 0, MPI_BYTE, new_type) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create a large datatype from the all selection")
+ *count = 1;
+ *is_derived_type = TRUE;
}
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_mpio_all_type() */
+} /* H5S__mpio_all_type() */
/*-------------------------------------------------------------------------
- * Function: H5S_mpio_none_type
+ * Function: H5S__mpio_none_type
*
* Purpose: Translate an HDF5 "none" selection into an MPI type.
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Outputs: *new_type the MPI type corresponding to the selection
* *count how many objects of the new_type in selection
@@ -172,9 +166,9 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_mpio_none_type(MPI_Datatype *new_type, int *count, hbool_t *is_derived_type)
+H5S__mpio_none_type(MPI_Datatype *new_type, int *count, hbool_t *is_derived_type)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* fill in the return values */
*new_type = MPI_BYTE;
@@ -182,15 +176,15 @@ H5S_mpio_none_type(MPI_Datatype *new_type, int *count, hbool_t *is_derived_type)
*is_derived_type = FALSE;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_mpio_none_type() */
+} /* H5S__mpio_none_type() */
/*-------------------------------------------------------------------------
- * Function: H5S_mpio_create_point_datatype
+ * Function: H5S__mpio_create_point_datatype
*
* Purpose: Create a derived datatype for point selections.
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Outputs: *new_type the MPI type corresponding to the selection
*
@@ -199,7 +193,7 @@ H5S_mpio_none_type(MPI_Datatype *new_type, int *count, hbool_t *is_derived_type)
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_mpio_create_point_datatype (size_t elmt_size, hsize_t num_points,
+H5S__mpio_create_point_datatype(size_t elmt_size, hsize_t num_points,
MPI_Aint *disp, MPI_Datatype *new_type)
{
MPI_Datatype elmt_type; /* MPI datatype for individual element */
@@ -207,141 +201,126 @@ H5S_mpio_create_point_datatype (size_t elmt_size, hsize_t num_points,
int mpi_code; /* MPI error code */
int *blocks = NULL; /* Array of block sizes for MPI hindexed create call */
hsize_t u; /* Local index variable */
+ hsize_t bigio_count; /* Transition point to create derived type */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Create an MPI datatype for an element */
if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)elmt_size, MPI_BYTE, &elmt_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
elmt_type_created = TRUE;
+ bigio_count = H5_mpi_get_bigio_count();
+
/* Check whether standard or BIGIO processing will be employeed */
if(bigio_count >= num_points) {
#if MPI_VERSION >= 3
- /* Create an MPI datatype for the whole point selection */
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed_block((int)num_points, 1, disp, elmt_type, new_type)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_indexed_block failed", mpi_code)
+ /* Create an MPI datatype for the whole point selection */
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed_block((int)num_points, 1, disp, elmt_type, new_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_indexed_block failed", mpi_code)
#else
- /* Allocate block sizes for MPI datatype call */
- if(NULL == (blocks = (int *)H5MM_malloc(sizeof(int) * num_points)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks")
+ /* Allocate block sizes for MPI datatype call */
+ if(NULL == (blocks = (int *)H5MM_malloc(sizeof(int) * num_points)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks")
- for(u = 0; u < num_points; u++)
- blocks[u] = 1;
+ for(u = 0; u < num_points; u++)
+ blocks[u] = 1;
- /* Create an MPI datatype for the whole point selection */
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)num_points, blocks, disp, elmt_type, new_type)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
+ /* Create an MPI datatype for the whole point selection */
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)num_points, blocks, disp, elmt_type, new_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
#endif
- /* Commit MPI datatype for later use */
- if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(new_type)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
+ /* Commit MPI datatype for later use */
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(new_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
}
else {
- /* use LARGE_DATATYPE::
- * We'll create an hindexed_block type for every 2G point count and then combine
- * those and any remaining points into a single large datatype.
- */
- int total_types, i;
- int remaining_points;
- int num_big_types;
- hsize_t leftover;
+ /* use LARGE_DATATYPE::
+ * We'll create an hindexed_block type for every 2G point count and then combine
+ * those and any remaining points into a single large datatype.
+ */
+ int total_types, i;
+ int remaining_points;
+ int num_big_types;
+ hsize_t leftover;
- int *inner_blocks;
- MPI_Aint *inner_disps;
- MPI_Datatype *inner_types = NULL;
+ int *inner_blocks;
+ MPI_Aint *inner_disps;
+ MPI_Datatype *inner_types = NULL;
- /* Calculate how many Big MPI datatypes are needed to represent the buffer */
- num_big_types = (int)(num_points/bigio_count);
+ /* Calculate how many Big MPI datatypes are needed to represent the buffer */
+ num_big_types = (int)(num_points / bigio_count);
- leftover = (hsize_t)num_points - (hsize_t)num_big_types * (hsize_t)bigio_count;
- H5_CHECKED_ASSIGN(remaining_points, int, leftover, hsize_t);
+ leftover = (hsize_t)num_points - (hsize_t)num_big_types * (hsize_t)bigio_count;
+ H5_CHECKED_ASSIGN(remaining_points, int, leftover, hsize_t);
- total_types = (int)(remaining_points) ? (num_big_types + 1) : num_big_types;
+ total_types = (int)(remaining_points) ? (num_big_types + 1) : num_big_types;
- /* Allocate array if MPI derived types needed */
- if(NULL == (inner_types = (MPI_Datatype *)H5MM_malloc((sizeof(MPI_Datatype) * (size_t)total_types))))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks")
+ /* Allocate array if MPI derived types needed */
+ if(NULL == (inner_types = (MPI_Datatype *)H5MM_malloc((sizeof(MPI_Datatype) * (size_t)total_types))))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks")
- if(NULL == (inner_blocks = (int *)H5MM_malloc(sizeof(int) * (size_t)total_types)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks")
+ if(NULL == (inner_blocks = (int *)H5MM_malloc(sizeof(int) * (size_t)total_types)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks")
- if(NULL == (inner_disps = (MPI_Aint *)H5MM_malloc(sizeof(MPI_Aint) * (size_t)total_types)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks")
+ if(NULL == (inner_disps = (MPI_Aint *)H5MM_malloc(sizeof(MPI_Aint) * (size_t)total_types)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks")
#if MPI_VERSION < 3
- /* Allocate block sizes for MPI datatype call */
- if(NULL == (blocks = (int *)H5MM_malloc(sizeof(int) * bigio_count)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks")
+ /* Allocate block sizes for MPI datatype call */
+ if(NULL == (blocks = (int *)H5MM_malloc(sizeof(int) * bigio_count)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks")
- for(u = 0; u < bigio_count; u++)
- blocks[u] = 1;
+ for(u = 0; u < bigio_count; u++)
+ blocks[u] = 1;
#endif
- for(i=0 ; i<num_big_types ; i++) {
+ for(i = 0; i < num_big_types; i++) {
#if MPI_VERSION >= 3
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed_block(bigio_count,
- 1,
- &disp[i*bigio_count],
- elmt_type,
- &inner_types[i]))) {
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed_block failed", mpi_code);
- }
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed_block(bigio_count,
+ 1, &disp[i*bigio_count], elmt_type, &inner_types[i])))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed_block failed", mpi_code);
#else
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)bigio_count,
- blocks,
- &disp[i*bigio_count],
- elmt_type,
- &inner_types[i]))) {
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
- }
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)bigio_count,
+ blocks, &disp[i*bigio_count], elmt_type, &inner_types[i])))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
#endif
- inner_blocks[i] = 1;
- inner_disps[i] = 0;
- }
+ inner_blocks[i] = 1;
+ inner_disps[i] = 0;
+ } /* end for*/
- if(remaining_points) {
+ if(remaining_points) {
#if MPI_VERSION >= 3
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed_block(remaining_points,
- 1,
- &disp[num_big_types*bigio_count],
- elmt_type,
- &inner_types[num_big_types]))) {
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed_block failed", mpi_code);
- }
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed_block(remaining_points,
+ 1, &disp[num_big_types*bigio_count], elmt_type, &inner_types[num_big_types])))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed_block failed", mpi_code);
#else
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)remaining_points,
- blocks,
- &disp[num_big_types*bigio_count],
- elmt_type,
- &inner_types[num_big_types]))) {
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
- }
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)remaining_points,
+ blocks, &disp[num_big_types*bigio_count], elmt_type, &inner_types[num_big_types])))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
#endif
- inner_blocks[num_big_types] = 1;
- inner_disps[num_big_types] = 0;
- }
-
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_struct(total_types,
- inner_blocks,
- inner_disps,
- inner_types,
- new_type))) {
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct", mpi_code);
- }
- for(i=0 ; i<total_types ; i++)
- MPI_Type_free(&inner_types[i]);
-
- H5MM_free(inner_types);
- H5MM_free(inner_blocks);
- H5MM_free(inner_disps);
-
- /* Commit MPI datatype for later use */
- if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(new_type)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
- }
+ inner_blocks[num_big_types] = 1;
+ inner_disps[num_big_types] = 0;
+ }
+
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_struct(total_types,
+ inner_blocks, inner_disps, inner_types, new_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct", mpi_code);
+
+ for(i = 0; i < total_types; i++)
+ MPI_Type_free(&inner_types[i]);
+
+ H5MM_free(inner_types);
+ H5MM_free(inner_blocks);
+ H5MM_free(inner_disps);
+
+ /* Commit MPI datatype for later use */
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(new_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
+ } /* end else */
+
done:
if(elmt_type_created)
MPI_Type_free(&elmt_type);
@@ -349,16 +328,16 @@ done:
H5MM_free(blocks);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_mpio_create_point_datatype() */
+} /* H5S__mpio_create_point_datatype() */
/*-------------------------------------------------------------------------
- * Function: H5S_mpio_point_type
+ * Function: H5S__mpio_point_type
*
* Purpose: Translate an HDF5 "point" selection into an MPI type.
* Create a permutation array to handle out-of-order point selections.
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Outputs: *new_type the MPI type corresponding to the selection
* *count how many objects of the new_type in selection
@@ -373,7 +352,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type,
+H5S__mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type,
int *count, hbool_t *is_derived_type, hbool_t do_permute, hsize_t **permute,
hbool_t *is_permuted)
{
@@ -384,7 +363,7 @@ H5S_mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type
hsize_t u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(space);
@@ -427,7 +406,7 @@ H5S_mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type
*/
if(do_permute) {
if(u > 0 && disp[u] < disp[u - 1]) {
- unsigned s = 0, l = u, m = u / 2;
+ hsize_t s = 0, l = u, m = u / 2;
*is_permuted = TRUE;
do {
@@ -455,7 +434,7 @@ H5S_mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type
/* this is a memory space, and no permutation is necessary to create
the derived datatype */
else {
- ;/* do nothing */
+ ; /* do nothing */
} /* end else */
/* get the next point */
@@ -463,7 +442,7 @@ H5S_mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type
} /* end for */
/* Create the MPI datatype for the set of element displacements */
- if(H5S_mpio_create_point_datatype(elmt_size, num_points, disp, new_type) < 0)
+ if(H5S__mpio_create_point_datatype(elmt_size, num_points, disp, new_type) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create an MPI Datatype from point selection")
/* Set values about MPI datatype created */
@@ -481,11 +460,11 @@ done:
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_mpio_point_type() */
+} /* H5S__mpio_point_type() */
/*-------------------------------------------------------------------------
- * Function: H5S_mpio_permute_type
+ * Function: H5S__mpio_permute_type
*
* Purpose: Translate an HDF5 "all/hyper/point" selection into an MPI type,
* while applying the permutation map. This function is called if
@@ -496,7 +475,7 @@ done:
* Note: This routine is called from H5S_mpio_space_type(), which is
* called first for the file dataspace and creates
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Outputs: *new_type the MPI type corresponding to the selection
* *count how many objects of the new_type in selection
@@ -508,7 +487,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_mpio_permute_type(const H5S_t *space, size_t elmt_size, hsize_t **permute,
+H5S__mpio_permute_type(const H5S_t *space, size_t elmt_size, hsize_t **permute,
MPI_Datatype *new_type, int *count, hbool_t *is_derived_type)
{
MPI_Aint *disp = NULL; /* Datatype displacement for each point*/
@@ -520,7 +499,7 @@ H5S_mpio_permute_type(const H5S_t *space, size_t elmt_size, hsize_t **permute,
hsize_t u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(space);
@@ -597,7 +576,7 @@ H5S_mpio_permute_type(const H5S_t *space, size_t elmt_size, hsize_t **permute,
} /* end while */
/* Create the MPI datatype for the set of element displacements */
- if(H5S_mpio_create_point_datatype(elmt_size, num_points, disp, new_type) < 0)
+ if(H5S__mpio_create_point_datatype(elmt_size, num_points, disp, new_type) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create an MPI Datatype from point selection")
/* Set values about MPI datatype created */
@@ -619,15 +598,15 @@ done:
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_mpio_permute_type() */
+} /* H5S__mpio_permute_type() */
/*-------------------------------------------------------------------------
- * Function: H5S_mpio_hyper_type
+ * Function: H5S__mpio_hyper_type
*
* Purpose: Translate an HDF5 hyperslab selection into an MPI type.
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Outputs: *new_type the MPI type corresponding to the selection
* *count how many objects of the new_type in selection
@@ -635,14 +614,11 @@ done:
* *is_derived_type 0 if MPI primitive type, 1 if derived
*
* Programmer: rky 980813
- * Modifications:
- * Mohamad Chaarawi
- * Adding support for large datatypes (beyond the limit of a
- * 32 bit integer.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size,
+H5S__mpio_hyper_type(const H5S_t *space, size_t elmt_size,
MPI_Datatype *new_type, int *count, hbool_t *is_derived_type)
{
H5S_sel_iter_t sel_iter; /* Selection iteration info */
@@ -656,6 +632,7 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size,
hsize_t count;
} d[H5S_MAX_RANK];
+ hsize_t bigio_count; /* Transition point to create derived type */
hsize_t offset[H5S_MAX_RANK];
hsize_t max_xtent[H5S_MAX_RANK];
H5S_hyper_dim_t *diminfo; /* [rank] */
@@ -668,12 +645,13 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size,
int mpi_code; /* MPI return code */
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(space);
HDassert(sizeof(MPI_Aint) >= sizeof(elmt_size));
+ bigio_count = H5_mpi_get_bigio_count();
/* Initialize selection iterator */
if(H5S_select_iter_init(&sel_iter, space, elmt_size) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
@@ -683,7 +661,7 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size,
diminfo = sel_iter.u.hyp.diminfo;
HDassert(diminfo);
- /* make a local copy of the dimension info so we can operate with them */
+ /* Make a local copy of the dimension info so we can operate with them */
/* Check if this is a "flattened" regular hyperslab selection */
if(sel_iter.u.hyp.iter_rank != 0 && sel_iter.u.hyp.iter_rank < space->extent.rank) {
@@ -691,8 +669,8 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size,
rank = sel_iter.u.hyp.iter_rank;
HDassert(rank <= H5S_MAX_RANK); /* within array bounds */
#ifdef H5S_DEBUG
- if(H5DEBUG(S))
- HDfprintf(H5DEBUG(S), "%s: Flattened selection\n",FUNC);
+if(H5DEBUG(S))
+ HDfprintf(H5DEBUG(S), "%s: Flattened selection\n",FUNC);
#endif
for(u = 0; u < rank; ++u) {
H5_CHECK_OVERFLOW(diminfo[u].start, hsize_t, hssize_t)
@@ -701,22 +679,22 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size,
d[u].block = diminfo[u].block;
d[u].count = diminfo[u].count;
d[u].xtent = sel_iter.u.hyp.size[u];
+
#ifdef H5S_DEBUG
- if(H5DEBUG(S)){
- HDfprintf(H5DEBUG(S), "%s: start=%Hd stride=%Hu count=%Hu block=%Hu xtent=%Hu",
- FUNC, d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent );
- if (u==0)
- HDfprintf(H5DEBUG(S), " rank=%u\n", rank );
- else
- HDfprintf(H5DEBUG(S), "\n" );
- }
+if(H5DEBUG(S)) {
+ HDfprintf(H5DEBUG(S), "%s: start=%Hd stride=%Hu count=%Hu block=%Hu xtent=%Hu",
+ FUNC, d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent);
+ if(u == 0)
+ HDfprintf(H5DEBUG(S), " rank=%u\n", rank);
+ else
+ HDfprintf(H5DEBUG(S), "\n");
+}
#endif
- if(0 == d[u].block)
- goto empty;
- if(0 == d[u].count)
- goto empty;
- if(0 == d[u].xtent)
- goto empty;
+
+ /* Sanity check */
+ HDassert(d[u].block > 0);
+ HDassert(d[u].count > 0);
+ HDassert(d[u].xtent > 0);
} /* end for */
} /* end if */
else {
@@ -726,8 +704,8 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size,
if(0 == rank)
goto empty;
#ifdef H5S_DEBUG
- if(H5DEBUG(S))
- HDfprintf(H5DEBUG(S),"%s: Non-flattened selection\n",FUNC);
+if(H5DEBUG(S))
+ HDfprintf(H5DEBUG(S),"%s: Non-flattened selection\n",FUNC);
#endif
for(u = 0; u < rank; ++u) {
H5_CHECK_OVERFLOW(diminfo[u].start, hsize_t, hssize_t)
@@ -736,22 +714,22 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size,
d[u].block = diminfo[u].block;
d[u].count = diminfo[u].count;
d[u].xtent = space->extent.size[u];
+
#ifdef H5S_DEBUG
- if(H5DEBUG(S)){
+if(H5DEBUG(S)) {
HDfprintf(H5DEBUG(S), "%s: start=%Hd stride=%Hu count=%Hu block=%Hu xtent=%Hu",
- FUNC, d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent );
- if (u==0)
- HDfprintf(H5DEBUG(S), " rank=%u\n", rank );
+ FUNC, d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent);
+ if(u == 0)
+ HDfprintf(H5DEBUG(S), " rank=%u\n", rank);
else
- HDfprintf(H5DEBUG(S), "\n" );
- }
+ HDfprintf(H5DEBUG(S), "\n");
+}
#endif
- if(0 == d[u].block)
- goto empty;
- if(0 == d[u].count)
- goto empty;
- if(0 == d[u].xtent)
- goto empty;
+
+ /* Sanity check */
+ HDassert(d[u].block > 0);
+ HDassert(d[u].count > 0);
+ HDassert(d[u].xtent > 0);
} /* end for */
} /* end else */
@@ -762,36 +740,35 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size,
offset[rank - 1] = 1;
max_xtent[rank - 1] = d[rank - 1].xtent;
#ifdef H5S_DEBUG
- if(H5DEBUG(S)) {
- i = ((int)rank) - 1;
- HDfprintf(H5DEBUG(S), " offset[%2d]=%Hu; max_xtent[%2d]=%Hu\n",
- i, offset[i], i, max_xtent[i]);
- }
+if(H5DEBUG(S)) {
+ i = ((int)rank) - 1;
+ HDfprintf(H5DEBUG(S), " offset[%2d]=%Hu; max_xtent[%2d]=%Hu\n", i, offset[i], i, max_xtent[i]);
+}
#endif
for(i = ((int)rank) - 2; i >= 0; --i) {
offset[i] = offset[i + 1] * d[i + 1].xtent;
max_xtent[i] = max_xtent[i + 1] * d[i].xtent;
#ifdef H5S_DEBUG
- if(H5DEBUG(S))
- HDfprintf(H5DEBUG(S), " offset[%2d]=%Hu; max_xtent[%2d]=%Hu\n",
- i, offset[i], i, max_xtent[i]);
+if(H5DEBUG(S))
+ HDfprintf(H5DEBUG(S), " offset[%2d]=%Hu; max_xtent[%2d]=%Hu\n", i, offset[i], i, max_xtent[i]);
#endif
} /* end for */
/* Create a type covering the selected hyperslab.
* Multidimensional dataspaces are stored in row-major order.
* The type is built from the inside out, going from the
- * fastest-changing (i.e., inner) dimension * to the slowest (outer). */
+ * fastest-changing (i.e., inner) dimension * to the slowest (outer).
+ */
/*******************************************************
* Construct contig type for inner contig dims:
*******************************************************/
#ifdef H5S_DEBUG
- if(H5DEBUG(S)) {
+if(H5DEBUG(S)) {
HDfprintf(H5DEBUG(S), "%s: Making contig type %Zu MPI_BYTEs\n", FUNC, elmt_size);
for(i = ((int)rank) - 1; i >= 0; --i)
HDfprintf(H5DEBUG(S), "d[%d].xtent=%Hu \n", i, d[i].xtent);
- }
+}
#endif
/* LARGE_DATATYPE::
@@ -801,17 +778,14 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size,
* for the innertype to be created.
*/
if(bigio_count >= elmt_size) {
- /* Use a single MPI datatype that has a 32 bit size */
- if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)elmt_size, MPI_BYTE, &inner_type)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
- }
- else {
- /* Create the compound datatype for this operation (> 2GB) */
- if (H5S_mpio_create_large_type (elmt_size, 0, MPI_BYTE, &inner_type) < 0) {
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,
- "couldn't ccreate a large inner datatype in hyper selection")
- }
+ /* Use a single MPI datatype that has a 32 bit size */
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)elmt_size, MPI_BYTE, &inner_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
}
+ else
+ /* Create the compound datatype for this operation (> 2GB) */
+ if(H5_mpio_create_large_type(elmt_size, 0, MPI_BYTE, &inner_type) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create a large inner datatype in hyper selection")
/*******************************************************
* Construct the type by walking the hyperslab dims
@@ -819,65 +793,57 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size,
*******************************************************/
for(i = ((int)rank) - 1; i >= 0; --i) {
#ifdef H5S_DEBUG
- if(H5DEBUG(S))
- HDfprintf(H5DEBUG(S), "%s: Dimension i=%d \n"
- "start=%Hd count=%Hu block=%Hu stride=%Hu, xtent=%Hu max_xtent=%d\n",
- FUNC, i, d[i].start, d[i].count, d[i].block, d[i].strid, d[i].xtent, max_xtent[i]);
+if(H5DEBUG(S))
+ HDfprintf(H5DEBUG(S), "%s: Dimension i=%d \n"
+ "start=%Hd count=%Hu block=%Hu stride=%Hu, xtent=%Hu max_xtent=%d\n",
+ FUNC, i, d[i].start, d[i].count, d[i].block, d[i].strid, d[i].xtent, max_xtent[i]);
#endif
#ifdef H5S_DEBUG
- if(H5DEBUG(S))
- HDfprintf(H5DEBUG(S), "%s: i=%d Making vector-type \n", FUNC,i);
+if(H5DEBUG(S))
+ HDfprintf(H5DEBUG(S), "%s: i=%d Making vector-type \n", FUNC,i);
#endif
/****************************************
- * Build vector type of the selection.
- ****************************************/
- if (bigio_count >= d[i].count &&
- bigio_count >= d[i].block &&
- bigio_count >= d[i].strid) {
-
- /* All the parameters fit into 32 bit integers so create the vector type normally */
- mpi_code = MPI_Type_vector((int)(d[i].count), /* count */
- (int)(d[i].block), /* blocklength */
- (int)(d[i].strid), /* stride */
- inner_type, /* old type */
- &outer_type); /* new type */
-
- MPI_Type_free(&inner_type);
- if(mpi_code != MPI_SUCCESS)
- HMPI_GOTO_ERROR(FAIL, "couldn't create MPI vector type", mpi_code)
+ * Build vector type of the selection.
+ ****************************************/
+ if(bigio_count >= d[i].count &&
+ bigio_count >= d[i].block && bigio_count >= d[i].strid) {
+ /* All the parameters fit into 32 bit integers so create the vector type normally */
+ mpi_code = MPI_Type_vector((int)(d[i].count), /* count */
+ (int)(d[i].block), /* blocklength */
+ (int)(d[i].strid), /* stride */
+ inner_type, /* old type */
+ &outer_type); /* new type */
+
+ MPI_Type_free(&inner_type);
+ if(mpi_code != MPI_SUCCESS)
+ HMPI_GOTO_ERROR(FAIL, "couldn't create MPI vector type", mpi_code)
}
else {
- /* Things get a bit more complicated and require LARGE_DATATYPE processing
- * There are two MPI datatypes that need to be created:
- * 1) an internal contiguous block; and
- * 2) a collection of elements where an element is a contiguous block(1).
- * Remember that the input arguments to the MPI-IO functions use integer
- * values to represent element counts. We ARE allowed however, in the
- * more recent MPI implementations to use constructed datatypes whereby
- * the total number of bytes in a transfer could be :
- * (2GB-1)number_of_blocks * the_datatype_extent.
- */
+ /* Things get a bit more complicated and require LARGE_DATATYPE processing
+ * There are two MPI datatypes that need to be created:
+ * 1) an internal contiguous block; and
+ * 2) a collection of elements where an element is a contiguous block(1).
+ * Remember that the input arguments to the MPI-IO functions use integer
+ * values to represent element counts. We ARE allowed however, in the
+ * more recent MPI implementations to use constructed datatypes whereby
+ * the total number of bytes in a transfer could be :
+ * (2GB-1)number_of_blocks * the_datatype_extent.
+ */
MPI_Aint stride_in_bytes, inner_extent;
MPI_Datatype block_type;
- /* create a contiguous datatype inner_type x number of BLOCKS.
+ /* Create a contiguous datatype inner_type x number of BLOCKS.
* Again we need to check that the number of BLOCKS can fit into
* a 32 bit integer */
- if (bigio_count < d[i].block) {
- if (H5S_mpio_create_large_type(d[i].block, 0, inner_type,
- &block_type) < 0) {
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,
- "couldn't ccreate a large block datatype in hyper selection")
- }
+ if(bigio_count < d[i].block) {
+ if(H5_mpio_create_large_type(d[i].block, 0, inner_type, &block_type) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create a large block datatype in hyper selection")
}
- else {
- if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)d[i].block,
- inner_type,
- &block_type)))
+ else
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)d[i].block, inner_type, &block_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
- }
/* As of version 4.0, OpenMPI now turns off MPI-1 API calls by default,
* so we're using the MPI-2 version even though we don't need the lb
@@ -892,40 +858,38 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size,
/* If the element count is larger than what a 32 bit integer can hold,
* we call the large type creation function to handle that
*/
- if (bigio_count < d[i].count) {
- if (H5S_mpio_create_large_type (d[i].count, stride_in_bytes, block_type,
- &outer_type) < 0) {
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,
- "couldn't create a large outer datatype in hyper selection")
- }
+ if(bigio_count < d[i].count) {
+ if(H5_mpio_create_large_type(d[i].count, stride_in_bytes, block_type, &outer_type) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create a large outer datatype in hyper selection")
}
/* otherwise a regular create_hvector will do */
- else {
- mpi_code = MPI_Type_create_hvector((int)d[i].count, /* count */
- 1, /* blocklength */
- stride_in_bytes, /* stride in bytes*/
- block_type, /* old type */
- &outer_type); /* new type */
- if(MPI_SUCCESS != mpi_code)
+ else
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector((int)d[i].count, /* count */
+ 1, /* blocklength */
+ stride_in_bytes, /* stride in bytes*/
+ block_type, /* old type */
+ &outer_type))) /* new type */
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code)
- }
+
MPI_Type_free(&block_type);
MPI_Type_free(&inner_type);
- }
- /****************************************
- * Then build the dimension type as (start, vector type, xtent).
- ****************************************/
- /* calculate start and extent values of this dimension */
- start_disp = d[i].start * offset[i] * elmt_size;
+ } /* end else */
+
+ /****************************************
+ * Then build the dimension type as (start, vector type, xtent).
+ ****************************************/
+
+ /* Calculate start and extent values of this dimension */
+ start_disp = d[i].start * offset[i] * elmt_size;
new_extent = (MPI_Aint)elmt_size * max_xtent[i];
if(MPI_SUCCESS != (mpi_code = MPI_Type_get_extent(outer_type, &lb, &extent_len)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_get_extent failed", mpi_code)
/*************************************************
- * Restructure this datatype ("outer_type")
- * so that it still starts at 0, but its extent
- * is the full extent in this dimension.
- *************************************************/
+ * Restructure this datatype ("outer_type")
+ * so that it still starts at 0, but its extent
+ * is the full extent in this dimension.
+ *************************************************/
if(start_disp > 0 || extent_len < new_extent) {
MPI_Datatype interm_type;
int block_len = 1;
@@ -972,21 +936,20 @@ done:
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
#ifdef H5S_DEBUG
- if(H5DEBUG(S))
- HDfprintf(H5DEBUG(S), "Leave %s, count=%ld is_derived_type=%t\n",
- FUNC, *count, *is_derived_type );
+if(H5DEBUG(S))
+ HDfprintf(H5DEBUG(S), "Leave %s, count=%ld is_derived_type=%t\n", FUNC, *count, *is_derived_type);
#endif
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_mpio_hyper_type() */
+} /* end H5S__mpio_hyper_type() */
/*-------------------------------------------------------------------------
- * Function: H5S_mpio_span_hyper_type
+ * Function: H5S__mpio_span_hyper_type
*
* Purpose: Translate an HDF5 irregular hyperslab selection into an
MPI type.
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Outputs: *new_type the MPI type corresponding to the selection
* *count how many objects of the new_type in selection
@@ -995,24 +958,21 @@ done:
*
* Programmer: kyang
*
- * Modifications:
- * Mohamad Chaarawi
- * Adding support for large datatypes (beyond the limit of a
- * 32 bit integer.
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_mpio_span_hyper_type(const H5S_t *space, size_t elmt_size,
+H5S__mpio_span_hyper_type(const H5S_t *space, size_t elmt_size,
MPI_Datatype *new_type, int *count, hbool_t *is_derived_type)
{
MPI_Datatype elmt_type; /* MPI datatype for an element */
hbool_t elmt_type_is_derived = FALSE; /* Whether the element type has been created */
MPI_Datatype span_type; /* MPI datatype for overall span tree */
+ hsize_t bigio_count; /* Transition point to create derived type */
hsize_t down[H5S_MAX_RANK]; /* 'down' sizes for each dimension */
int mpi_code; /* MPI return code */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(space);
@@ -1020,18 +980,15 @@ H5S_mpio_span_hyper_type(const H5S_t *space, size_t elmt_size,
HDassert(space->select.sel_info.hslab->span_lst);
HDassert(space->select.sel_info.hslab->span_lst->head);
+ bigio_count = H5_mpi_get_bigio_count();
/* Create the base type for an element */
- if (bigio_count >= elmt_size) {
- if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)elmt_size, MPI_BYTE, &elmt_type))) {
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
- }
- }
- else {
- if (H5S_mpio_create_large_type (elmt_size, 0, MPI_BYTE, &elmt_type) < 0) {
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,
- "couldn't create a large element datatype in span_hyper selection")
- }
+ if(bigio_count >= elmt_size) {
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)elmt_size, MPI_BYTE, &elmt_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
}
+ else
+ if(H5_mpio_create_large_type(elmt_size, 0, MPI_BYTE, &elmt_type) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create a large element datatype in span_hyper selection")
elmt_type_is_derived = TRUE;
/* Compute 'down' sizes for each dimension */
@@ -1039,7 +996,7 @@ H5S_mpio_span_hyper_type(const H5S_t *space, size_t elmt_size,
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGETSIZE, FAIL, "couldn't compute 'down' dimension sizes")
/* Obtain derived data type */
- if(H5S_obtain_datatype(down, space->select.sel_info.hslab->span_lst->head, &elmt_type, &span_type, elmt_size) < 0)
+ if(H5S__obtain_datatype(down, space->select.sel_info.hslab->span_lst->head, &elmt_type, &span_type, elmt_size) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't obtain MPI derived data type")
if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&span_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
@@ -1056,16 +1013,15 @@ done:
HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code)
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_mpio_span_hyper_type() */
+} /* end H5S__mpio_span_hyper_type() */
/*-------------------------------------------------------------------------
- * Function: H5S_obtain_datatype
+ * Function: H5S__obtain_datatype
*
- * Purpose: Obtain an MPI derived datatype based on span-tree
- * implementation
+ * Purpose: Obtain an MPI derived datatype for span-tree hyperslab selection
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Outputs: *span_type the MPI type corresponding to the selection
*
@@ -1074,9 +1030,10 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_obtain_datatype(const hsize_t *down, H5S_hyper_span_t *span,
+H5S__obtain_datatype(const hsize_t *down, H5S_hyper_span_t *spans,
const MPI_Datatype *elmt_type, MPI_Datatype *span_type, size_t elmt_size)
{
+ hsize_t bigio_count; /* Transition point to create derived type */
size_t alloc_count = 0; /* Number of span tree nodes allocated at this level */
size_t outercount = 0; /* Number of span tree nodes at this level */
MPI_Datatype *inner_type = NULL;
@@ -1089,11 +1046,12 @@ H5S_obtain_datatype(const hsize_t *down, H5S_hyper_span_t *span,
int mpi_code; /* MPI return status code */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Sanity check */
- HDassert(span);
+ HDassert(spans);
+ bigio_count = H5_mpi_get_bigio_count();
/* Allocate the initial displacement & block length buffers */
alloc_count = H5S_MPIO_INITIAL_ALLOC_COUNT;
if(NULL == (disp = (MPI_Aint *)H5MM_malloc(alloc_count * sizeof(MPI_Aint))))
@@ -1102,8 +1060,8 @@ H5S_obtain_datatype(const hsize_t *down, H5S_hyper_span_t *span,
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of block lengths")
/* if this is the fastest changing dimension, it is the base case for derived datatype. */
- if(NULL == span->down) {
- tspan = span;
+ if(NULL == spans->down) {
+ tspan = spans;
outercount = 0;
while(tspan) {
/* Check if we need to increase the size of the buffers */
@@ -1137,33 +1095,28 @@ H5S_obtain_datatype(const hsize_t *down, H5S_hyper_span_t *span,
} /* end while */
/* Everything fits into integers, so cast them and use hindexed */
- if (bigio_count >= outercount && large_block == FALSE) {
+ if(bigio_count >= outercount && large_block == FALSE) {
if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)outercount, blocklen, disp, *elmt_type, span_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
span_type_valid = TRUE;
}
- else { /* LARGE_DATATYPE:: Something doesn't fit into a 32 bit integer */
+ else { /* LARGE_DATATYPE:: Something doesn't fit into a 32 bit integer */
size_t i;
- for (i=0 ; i<outercount ; i++) {
- MPI_Datatype temp_type = MPI_DATATYPE_NULL, outer_type = MPI_DATATYPE_NULL;
+ for(i=0 ; i<outercount ; i++) {
+ MPI_Datatype temp_type = MPI_DATATYPE_NULL, outer_type = MPI_DATATYPE_NULL;
/* create the block type from elmt_type while checking the 32 bit int limit */
- if (blocklen[i] > bigio_count) {
- if (H5S_mpio_create_large_type (blocklen[i], 0, *elmt_type, &temp_type) < 0) {
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,
- "couldn't create a large element datatype in span_hyper selection")
- }
+ if(blocklen[i] > bigio_count) {
+ if(H5_mpio_create_large_type (blocklen[i], 0, *elmt_type, &temp_type) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create a large element datatype in span_hyper selection")
}
- else {
- if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)blocklen[i],
- *elmt_type,
- &temp_type)))
+ else
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)blocklen[i], *elmt_type, &temp_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
- }
/* combine the current datatype that is created with this current block type */
- if (0 == i) { /* first iteration, there is no combined datatype yet */
+ if(0 == i) { /* first iteration, there is no combined datatype yet */
*span_type = temp_type;
}
else {
@@ -1171,23 +1124,23 @@ H5S_obtain_datatype(const hsize_t *down, H5S_hyper_span_t *span,
MPI_Aint ds[2] = {disp[i-1],disp[i]};
MPI_Datatype dt[2] = {*span_type, temp_type};
- if (MPI_SUCCESS != (mpi_code = MPI_Type_create_struct (2, /* count */
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_struct (2, /* count */
bl, /* blocklength */
ds, /* stride in bytes*/
dt, /* old type */
&outer_type))){ /* new type */
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct failed", mpi_code)
}
- *span_type = outer_type;
+ *span_type = outer_type;
}
- if (outer_type != MPI_DATATYPE_NULL)
- MPI_Type_free(&outer_type);
- /* temp_type shouldn't be freed here...
- * Note that we have simply copied it above (not MPI_Type_dup)
- * into the 'span_type' argument of the caller.
- * The caller needs to deal with it there!
- */
+ if(outer_type != MPI_DATATYPE_NULL)
+ MPI_Type_free(&outer_type);
+ /* temp_type shouldn't be freed here...
+ * Note that we have simply copied it above (not MPI_Type_dup)
+ * into the 'span_type' argument of the caller.
+ * The caller needs to deal with it there!
+ */
}
} /* end (LARGE_DATATYPE::) */
@@ -1198,7 +1151,7 @@ H5S_obtain_datatype(const hsize_t *down, H5S_hyper_span_t *span,
if(NULL == (inner_type = (MPI_Datatype *)H5MM_malloc(alloc_count * sizeof(MPI_Datatype))))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of inner MPI datatypes")
- tspan = span;
+ tspan = spans;
outercount = 0;
while(tspan) {
MPI_Datatype down_type; /* Temporary MPI datatype for a span tree node's children */
@@ -1233,7 +1186,7 @@ H5S_obtain_datatype(const hsize_t *down, H5S_hyper_span_t *span,
blocklen[outercount] = 1;
/* Generate MPI datatype for next dimension down */
- if(H5S_obtain_datatype(down + 1, tspan->down->head, elmt_type, &down_type, elmt_size) < 0)
+ if(H5S__obtain_datatype(down + 1, tspan->down->head, elmt_type, &down_type, elmt_size) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't obtain MPI derived data type")
/* Build the MPI datatype for this node */
@@ -1291,7 +1244,7 @@ done:
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_obtain_datatype() */
+} /* end H5S__obtain_datatype() */
/*-------------------------------------------------------------------------
@@ -1300,7 +1253,7 @@ done:
* Purpose: Translate an HDF5 dataspace selection into an MPI type.
* Currently handle only hyperslab and "all" selections.
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Outputs: *new_type the MPI type corresponding to the selection
* *count how many objects of the new_type in selection
@@ -1336,7 +1289,7 @@ H5S_mpio_space_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type
if(TRUE == *is_permuted) {
switch(H5S_GET_SELECT_TYPE(space)) {
case H5S_SEL_NONE:
- if(H5S_mpio_none_type(new_type, count, is_derived_type) < 0)
+ if(H5S__mpio_none_type(new_type, count, is_derived_type) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't convert 'none' selection to MPI type")
break;
@@ -1346,7 +1299,7 @@ H5S_mpio_space_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type
/* Sanity check */
HDassert(!do_permute);
- if(H5S_mpio_permute_type(space, elmt_size, permute_map, new_type, count, is_derived_type) < 0)
+ if(H5S__mpio_permute_type(space, elmt_size, permute_map, new_type, count, is_derived_type) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't convert 'all' selection to MPI type")
break;
@@ -1361,29 +1314,28 @@ H5S_mpio_space_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type
else {
switch(H5S_GET_SELECT_TYPE(space)) {
case H5S_SEL_NONE:
- if(H5S_mpio_none_type(new_type, count, is_derived_type) < 0)
+ if(H5S__mpio_none_type(new_type, count, is_derived_type) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't convert 'none' selection to MPI type")
break;
case H5S_SEL_ALL:
- if(H5S_mpio_all_type(space, elmt_size, new_type, count, is_derived_type) < 0)
+ if(H5S__mpio_all_type(space, elmt_size, new_type, count, is_derived_type) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't convert 'all' selection to MPI type")
break;
case H5S_SEL_POINTS:
- if(H5S_mpio_point_type(space, elmt_size, new_type, count, is_derived_type, do_permute, permute_map, is_permuted) < 0)
+ if(H5S__mpio_point_type(space, elmt_size, new_type, count, is_derived_type, do_permute, permute_map, is_permuted) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't convert 'point' selection to MPI type")
break;
case H5S_SEL_HYPERSLABS:
if((H5S_SELECT_IS_REGULAR(space) == TRUE)) {
- if(H5S_mpio_hyper_type(space, elmt_size, new_type, count, is_derived_type) < 0)
+ if(H5S__mpio_hyper_type(space, elmt_size, new_type, count, is_derived_type) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't convert regular 'hyperslab' selection to MPI type")
} /* end if */
- else {
- if(H5S_mpio_span_hyper_type(space, elmt_size, new_type, count, is_derived_type) < 0)
+ else
+ if(H5S__mpio_span_hyper_type(space, elmt_size, new_type, count, is_derived_type) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't convert irregular 'hyperslab' selection to MPI type")
- } /* end else */
break;
case H5S_SEL_ERROR:
@@ -1405,145 +1357,5 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_mpio_space_type() */
-
-/*-------------------------------------------------------------------------
- * Function: H5S_mpio_create_large_type
- *
- * Purpose: Create a large datatype of size larger than what a 32 bit integer
- * can hold.
- *
- * Return: non-negative on success, negative on failure.
- *
- * *new_type the new datatype created
- *
- * Programmer: Mohamad Chaarawi
- *
- *-------------------------------------------------------------------------
- */
-static herr_t H5S_mpio_create_large_type (hsize_t num_elements,
- MPI_Aint stride_bytes,
- MPI_Datatype old_type,
- MPI_Datatype *new_type)
-{
- int num_big_types; /* num times the 2G datatype will be repeated */
- int remaining_bytes; /* the number of bytes left that can be held in an int value */
- hsize_t leftover;
- int block_len[2];
- int mpi_code; /* MPI return code */
- MPI_Datatype inner_type, outer_type, leftover_type, type[2];
- MPI_Aint disp[2], old_extent;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Calculate how many Big MPI datatypes are needed to represent the buffer */
- num_big_types = (int)(num_elements/bigio_count);
- leftover = num_elements - num_big_types * (hsize_t)bigio_count;
- H5_CHECKED_ASSIGN(remaining_bytes, int, leftover, hsize_t);
-
- /* Create a contiguous datatype of size equal to the largest
- * number that a 32 bit integer can hold x size of old type.
- * If the displacement is 0, then the type is contiguous, otherwise
- * use type_hvector to create the type with the displacement provided
- */
- if (0 == stride_bytes) {
- if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous(bigio_count,
- old_type,
- &inner_type))) {
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
- }
- }
- else {
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector (bigio_count,
- 1,
- stride_bytes,
- old_type,
- &inner_type))) {
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code)
- }
- }
-
- /* Create a contiguous datatype of the buffer (minus the remaining < 2GB part)
- * If a stride is present, use hvector type
- */
- if (0 == stride_bytes) {
- if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous(num_big_types,
- inner_type,
- &outer_type))) {
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
- }
- }
- else {
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector (num_big_types,
- 1,
- stride_bytes,
- inner_type,
- &outer_type))) {
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code)
- }
- }
-
- MPI_Type_free(&inner_type);
-
- /* If there is a remaining part create a contiguous/vector datatype and then
- * use a struct datatype to encapsulate everything.
- */
- if(remaining_bytes) {
- if (stride_bytes == 0) {
- if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous (remaining_bytes,
- old_type,
- &leftover_type))) {
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
- }
- }
- else {
- if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector
- ((int)(num_elements - (hsize_t)num_big_types*bigio_count),
- 1,
- stride_bytes,
- old_type,
- &leftover_type))) {
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code)
- }
- }
-
- /* As of version 4.0, OpenMPI now turns off MPI-1 API calls by default,
- * so we're using the MPI-2 version even though we don't need the lb
- * value.
- */
- {
- MPI_Aint unused_lb_arg;
- MPI_Type_get_extent(old_type, &unused_lb_arg, &old_extent);
- }
-
- /* Set up the arguments for MPI_Type_struct constructor */
- type[0] = outer_type;
- type[1] = leftover_type;
- block_len[0] = 1;
- block_len[1] = 1;
- disp[0] = 0;
- disp[1] = (old_extent+stride_bytes)*num_big_types*(MPI_Aint)bigio_count;
-
- if(MPI_SUCCESS != (mpi_code =
- MPI_Type_create_struct(2, block_len, disp, type, new_type))) {
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct failed", mpi_code)
- }
-
- MPI_Type_free(&outer_type);
- MPI_Type_free(&leftover_type);
- }
- else {
- /* There are no remaining bytes so just set the new type to
- * the outer type created */
- *new_type = outer_type;
- }
-
- if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(new_type)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_mpio_create_large_type */
-
#endif /* H5_HAVE_PARALLEL */
diff --git a/src/H5Snone.c b/src/H5Snone.c
index caa672c..c17ba40 100644
--- a/src/H5Snone.c
+++ b/src/H5Snone.c
@@ -18,165 +18,195 @@
* Purpose: "None" selection dataspace I/O functions.
*/
+/****************/
+/* Module Setup */
+/****************/
+
#include "H5Smodule.h" /* This source code file is part of the H5S module */
-#include "H5private.h"
-#include "H5Eprivate.h"
-#include "H5Iprivate.h"
-#include "H5Spkg.h"
-#include "H5VMprivate.h"
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* ID Functions */
+#include "H5Spkg.h" /* Dataspace functions */
+#include "H5VMprivate.h" /* Vector functions */
#include "H5Dprivate.h"
-/* Static function prototypes */
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
/* Selection callbacks */
-static herr_t H5S_none_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection);
-static herr_t H5S_none_get_seq_list(const H5S_t *space, unsigned flags,
+static herr_t H5S__none_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection);
+static herr_t H5S__none_get_seq_list(const H5S_t *space, unsigned flags,
H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes,
size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len);
-static herr_t H5S_none_release(H5S_t *space);
-static htri_t H5S_none_is_valid(const H5S_t *space);
-static hssize_t H5S_none_serial_size(const H5S_t *space);
-static herr_t H5S_none_serialize(const H5S_t *space, uint8_t **p);
-static herr_t H5S_none_deserialize(H5S_t **space, const uint8_t **p);
-static herr_t H5S_none_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
-static herr_t H5S_none_offset(const H5S_t *space, hsize_t *off);
+static herr_t H5S__none_release(H5S_t *space);
+static htri_t H5S__none_is_valid(const H5S_t *space);
+static hssize_t H5S__none_serial_size(const H5S_t *space);
+static herr_t H5S__none_serialize(const H5S_t *space, uint8_t **p);
+static herr_t H5S__none_deserialize(H5S_t **space, const uint8_t **p);
+static herr_t H5S__none_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
+static herr_t H5S__none_offset(const H5S_t *space, hsize_t *off);
static int H5S__none_unlim_dim(const H5S_t *space);
-static htri_t H5S_none_is_contiguous(const H5S_t *space);
-static htri_t H5S_none_is_single(const H5S_t *space);
-static htri_t H5S_none_is_regular(const H5S_t *space);
-static void H5S_none_adjust_u(H5S_t *space, const hsize_t *offset);
-static herr_t H5S_none_project_scalar(const H5S_t *space, hsize_t *offset);
-static herr_t H5S_none_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset);
-static herr_t H5S_none_iter_init(H5S_sel_iter_t *iter, const H5S_t *space);
+static htri_t H5S__none_is_contiguous(const H5S_t *space);
+static htri_t H5S__none_is_single(const H5S_t *space);
+static htri_t H5S__none_is_regular(const H5S_t *space);
+static void H5S__none_adjust_u(H5S_t *space, const hsize_t *offset);
+static herr_t H5S__none_project_scalar(const H5S_t *space, hsize_t *offset);
+static herr_t H5S__none_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset);
+static herr_t H5S__none_iter_init(H5S_sel_iter_t *iter, const H5S_t *space);
/* Selection iteration callbacks */
-static herr_t H5S_none_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords);
-static herr_t H5S_none_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end);
-static hsize_t H5S_none_iter_nelmts(const H5S_sel_iter_t *iter);
-static htri_t H5S_none_iter_has_next_block(const H5S_sel_iter_t *iter);
-static herr_t H5S_none_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem);
-static herr_t H5S_none_iter_next_block(H5S_sel_iter_t *sel_iter);
-static herr_t H5S_none_iter_release(H5S_sel_iter_t *sel_iter);
+static herr_t H5S__none_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords);
+static herr_t H5S__none_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end);
+static hsize_t H5S__none_iter_nelmts(const H5S_sel_iter_t *iter);
+static htri_t H5S__none_iter_has_next_block(const H5S_sel_iter_t *iter);
+static herr_t H5S__none_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem);
+static herr_t H5S__none_iter_next_block(H5S_sel_iter_t *sel_iter);
+static herr_t H5S__none_iter_release(H5S_sel_iter_t *sel_iter);
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
/* Selection properties for "none" selections */
const H5S_select_class_t H5S_sel_none[1] = {{
H5S_SEL_NONE,
/* Methods on selection */
- H5S_none_copy,
- H5S_none_get_seq_list,
- H5S_none_release,
- H5S_none_is_valid,
- H5S_none_serial_size,
- H5S_none_serialize,
- H5S_none_deserialize,
- H5S_none_bounds,
- H5S_none_offset,
+ H5S__none_copy,
+ H5S__none_get_seq_list,
+ H5S__none_release,
+ H5S__none_is_valid,
+ H5S__none_serial_size,
+ H5S__none_serialize,
+ H5S__none_deserialize,
+ H5S__none_bounds,
+ H5S__none_offset,
H5S__none_unlim_dim,
NULL,
- H5S_none_is_contiguous,
- H5S_none_is_single,
- H5S_none_is_regular,
- H5S_none_adjust_u,
- H5S_none_project_scalar,
- H5S_none_project_simple,
- H5S_none_iter_init,
+ H5S__none_is_contiguous,
+ H5S__none_is_single,
+ H5S__none_is_regular,
+ H5S__none_adjust_u,
+ H5S__none_project_scalar,
+ H5S__none_project_simple,
+ H5S__none_iter_init,
}};
+
+/*******************/
+/* Local Variables */
+/*******************/
+
/* Iteration properties for "none" selections */
static const H5S_sel_iter_class_t H5S_sel_iter_none[1] = {{
H5S_SEL_NONE,
/* Methods on selection iterator */
- H5S_none_iter_coords,
- H5S_none_iter_block,
- H5S_none_iter_nelmts,
- H5S_none_iter_has_next_block,
- H5S_none_iter_next,
- H5S_none_iter_next_block,
- H5S_none_iter_release,
+ H5S__none_iter_coords,
+ H5S__none_iter_block,
+ H5S__none_iter_nelmts,
+ H5S__none_iter_has_next_block,
+ H5S__none_iter_next,
+ H5S__none_iter_next_block,
+ H5S__none_iter_release,
}};
+
/*-------------------------------------------------------------------------
- * Function: H5S_none_iter_init
+ * Function: H5S__none_iter_init
*
- * Purpose: Initializes iteration information for "none" selection.
+ * Purpose: Initializes iteration information for "none" selection.
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Tuesday, June 16, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_none_iter_init(H5S_sel_iter_t *iter, const H5S_t H5_ATTR_UNUSED *space)
+H5S__none_iter_init(H5S_sel_iter_t *iter, const H5S_t H5_ATTR_UNUSED *space)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
- HDassert(space && H5S_SEL_NONE==H5S_GET_SELECT_TYPE(space));
+ HDassert(space && H5S_SEL_NONE == H5S_GET_SELECT_TYPE(space));
HDassert(iter);
/* Initialize type of selection iterator */
iter->type = H5S_sel_iter_none;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_none_iter_init() */
+} /* end H5S__none_iter_init() */
/*-------------------------------------------------------------------------
- * Function: H5S_none_iter_coords
+ * Function: H5S__none_iter_coords
*
- * Purpose: Retrieve the current coordinates of iterator for current
+ * Purpose: Retrieve the current coordinates of iterator for current
* selection
*
- * Return: non-negative on success, negative on failure
+ * Return: Non-negative on success, negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Tuesday, April 22, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_none_iter_coords(const H5S_sel_iter_t H5_ATTR_UNUSED *iter, hsize_t H5_ATTR_UNUSED *coords)
+H5S__none_iter_coords(const H5S_sel_iter_t H5_ATTR_UNUSED *iter, hsize_t H5_ATTR_UNUSED *coords)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
HDassert(coords);
FUNC_LEAVE_NOAPI(FAIL)
-} /* H5S_none_iter_coords() */
+} /* end H5S__none_iter_coords() */
/*-------------------------------------------------------------------------
- * Function: H5S_none_iter_block
+ * Function: H5S__none_iter_block
*
- * Purpose: Retrieve the current block of iterator for current
+ * Purpose: Retrieve the current block of iterator for current
* selection
*
- * Return: non-negative on success, negative on failure
+ * Return: Non-negative on success, negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Monday, June 2, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_none_iter_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter, hsize_t H5_ATTR_UNUSED *start, hsize_t H5_ATTR_UNUSED *end)
+H5S__none_iter_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter, hsize_t H5_ATTR_UNUSED *start, hsize_t H5_ATTR_UNUSED *end)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
@@ -184,42 +214,40 @@ H5S_none_iter_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter, hsize_t H5_ATTR_U
HDassert(end);
FUNC_LEAVE_NOAPI(FAIL)
-} /* H5S_none_iter_block() */
+} /* end H5S__none_iter_block() */
/*-------------------------------------------------------------------------
- * Function: H5S_none_iter_nelmts
+ * Function: H5S__none_iter_nelmts
*
- * Purpose: Return number of elements left to process in iterator
+ * Purpose: Return number of elements left to process in iterator
*
- * Return: non-negative number of elements on success, zero on failure
+ * Return: Non-negative number of elements on success, zero on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Tuesday, June 16, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static hsize_t
-H5S_none_iter_nelmts(const H5S_sel_iter_t H5_ATTR_UNUSED *iter)
+H5S__none_iter_nelmts(const H5S_sel_iter_t H5_ATTR_UNUSED *iter)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
FUNC_LEAVE_NOAPI(0)
-} /* H5S_none_iter_nelmts() */
+} /* end H5S__none_iter_nelmts() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_iter_has_next_block
+ H5S__none_iter_has_next_block
PURPOSE
Check if there is another block left in the current iterator
USAGE
- htri_t H5S_none_iter_has_next_block(iter)
+ htri_t H5S__none_iter_has_next_block(iter)
const H5S_sel_iter_t *iter; IN: Pointer to selection iterator
RETURNS
Non-negative (TRUE/FALSE) on success/Negative on failure
@@ -231,24 +259,24 @@ H5S_none_iter_nelmts(const H5S_sel_iter_t H5_ATTR_UNUSED *iter)
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S_none_iter_has_next_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter)
+H5S__none_iter_has_next_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
FUNC_LEAVE_NOAPI(FAIL)
-} /* H5S_none_iter_has_next_block() */
+} /* end H5S__none_iter_has_next_block() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_iter_next
+ H5S__none_iter_next
PURPOSE
Increment selection iterator
USAGE
- herr_t H5S_none_iter_next(iter, nelem)
+ herr_t H5S__none_iter_next(iter, nelem)
H5S_sel_iter_t *iter; IN: Pointer to selection iterator
size_t nelem; IN: Number of elements to advance by
RETURNS
@@ -261,25 +289,25 @@ H5S_none_iter_has_next_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_none_iter_next(H5S_sel_iter_t H5_ATTR_UNUSED *iter, size_t H5_ATTR_UNUSED nelem)
+H5S__none_iter_next(H5S_sel_iter_t H5_ATTR_UNUSED *iter, size_t H5_ATTR_UNUSED nelem)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
- HDassert(nelem>0);
+ HDassert(nelem > 0);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_none_iter_next() */
+} /* end H5S__none_iter_next() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_iter_next_block
+ H5S__none_iter_next_block
PURPOSE
Increment selection iterator to next block
USAGE
- herr_t H5S_none_iter_next(iter)
+ herr_t H5S__none_iter_next(iter)
H5S_sel_iter_t *iter; IN: Pointer to selection iterator
RETURNS
Non-negative on success/Negative on failure
@@ -291,24 +319,24 @@ H5S_none_iter_next(H5S_sel_iter_t H5_ATTR_UNUSED *iter, size_t H5_ATTR_UNUSED ne
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_none_iter_next_block(H5S_sel_iter_t H5_ATTR_UNUSED *iter)
+H5S__none_iter_next_block(H5S_sel_iter_t H5_ATTR_UNUSED *iter)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
FUNC_LEAVE_NOAPI(FAIL)
-} /* H5S_none_iter_next_block() */
+} /* end H5S__none_iter_next_block() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_iter_release
+ H5S__none_iter_release
PURPOSE
Release "none" selection iterator information for a dataspace
USAGE
- herr_t H5S_none_iter_release(iter)
+ herr_t H5S__none_iter_release(iter)
H5S_sel_iter_t *iter; IN: Pointer to selection iterator
RETURNS
Non-negative on success/Negative on failure
@@ -320,24 +348,24 @@ H5S_none_iter_next_block(H5S_sel_iter_t H5_ATTR_UNUSED *iter)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_none_iter_release(H5S_sel_iter_t H5_ATTR_UNUSED * iter)
+H5S__none_iter_release(H5S_sel_iter_t H5_ATTR_UNUSED *iter)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_none_iter_release() */
+} /* end H5S__none_iter_release() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_release
+ H5S__none_release
PURPOSE
Release none selection information for a dataspace
USAGE
- herr_t H5S_none_release(space)
+ herr_t H5S__none_release(space)
H5S_t *space; IN: Pointer to dataspace
RETURNS
Non-negative on success/Negative on failure
@@ -349,26 +377,27 @@ H5S_none_iter_release(H5S_sel_iter_t H5_ATTR_UNUSED * iter)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_none_release(H5S_t H5_ATTR_UNUSED * space)
+H5S__none_release(H5S_t H5_ATTR_UNUSED *space)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(space);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_none_release() */
+} /* end H5S__none_release() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_copy
+ H5S__none_copy
PURPOSE
Copy a selection from one dataspace to another
USAGE
- herr_t H5S_none_copy(dst, src)
+ herr_t H5S__none_copy(dst, src, share_selection)
H5S_t *dst; OUT: Pointer to the destination dataspace
H5S_t *src; IN: Pointer to the source dataspace
+ hbool_t; IN: Whether to share the selection between the dataspaces
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
@@ -380,9 +409,9 @@ H5S_none_release(H5S_t H5_ATTR_UNUSED * space)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_none_copy(H5S_t *dst, const H5S_t H5_ATTR_UNUSED *src, hbool_t H5_ATTR_UNUSED share_selection)
+H5S__none_copy(H5S_t *dst, const H5S_t H5_ATTR_UNUSED *src, hbool_t H5_ATTR_UNUSED share_selection)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(src);
HDassert(dst);
@@ -391,17 +420,17 @@ H5S_none_copy(H5S_t *dst, const H5S_t H5_ATTR_UNUSED *src, hbool_t H5_ATTR_UNUSE
dst->select.num_elem = 0;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S_none_copy() */
+} /* end H5S__none_copy() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_is_valid
+ H5S__none_is_valid
PURPOSE
Check whether the selection fits within the extent, with the current
offset defined.
USAGE
- htri_t H5S_none_is_valid(space);
+ htri_t H5S__none_is_valid(space);
H5S_t *space; IN: Dataspace pointer to query
RETURNS
TRUE if the selection fits within the extent, FALSE if it does not and
@@ -415,24 +444,24 @@ H5S_none_copy(H5S_t *dst, const H5S_t H5_ATTR_UNUSED *src, hbool_t H5_ATTR_UNUSE
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S_none_is_valid(const H5S_t H5_ATTR_UNUSED *space)
+H5S__none_is_valid(const H5S_t H5_ATTR_UNUSED *space)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(space);
FUNC_LEAVE_NOAPI(TRUE)
-} /* end H5S_none_is_valid() */
+} /* end H5S__none_is_valid() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_serial_size
+ H5S__none_serial_size
PURPOSE
Determine the number of bytes needed to store the serialized "none"
selection information.
USAGE
- hssize_t H5S_none_serial_size(space, f)
+ hssize_t H5S__none_serial_size(space)
H5S_t *space; IN: Dataspace pointer to query
RETURNS
The number of bytes required on success, negative on an error.
@@ -445,9 +474,9 @@ H5S_none_is_valid(const H5S_t H5_ATTR_UNUSED *space)
REVISION LOG
--------------------------------------------------------------------------*/
static hssize_t
-H5S_none_serial_size(const H5S_t H5_ATTR_UNUSED *space)
+H5S__none_serial_size(const H5S_t H5_ATTR_UNUSED *space)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(space);
@@ -456,16 +485,16 @@ H5S_none_serial_size(const H5S_t H5_ATTR_UNUSED *space)
* <length (4 bytes)> = 16 bytes
*/
FUNC_LEAVE_NOAPI(16)
-} /* end H5S_none_serial_size() */
+} /* end H5S__none_serial_size() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_serialize
+ H5S__none_serialize
PURPOSE
Serialize the current selection into a user-provided buffer.
USAGE
- herr_t H5S_none_serialize(space, p)
+ herr_t H5S__none_serialize(space, p)
const H5S_t *space; IN: Dataspace with selection to serialize
uint8_t **p; OUT: Pointer to buffer to put serialized
selection. Will be advanced to end of
@@ -481,11 +510,11 @@ H5S_none_serial_size(const H5S_t H5_ATTR_UNUSED *space)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_none_serialize(const H5S_t *space, uint8_t **p)
+H5S__none_serialize(const H5S_t *space, uint8_t **p)
{
uint8_t *pp = (*p); /* Local pointer for decoding */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(space);
@@ -502,16 +531,16 @@ H5S_none_serialize(const H5S_t *space, uint8_t **p)
*p = pp;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_none_serialize() */
+} /* end H5S__none_serialize() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_deserialize
+ H5S__none_deserialize
PURPOSE
Deserialize the current selection from a user-provided buffer.
USAGE
- herr_t H5S_none_deserialize(space, version, flags, p)
+ herr_t H5S__none_deserialize(space, version, flags, p)
H5S_t **space; IN/OUT: Dataspace pointer to place
selection into
uint8 **p; OUT: Pointer to buffer holding serialized
@@ -528,14 +557,14 @@ H5S_none_serialize(const H5S_t *space, uint8_t **p)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_none_deserialize(H5S_t **space, const uint8_t **p)
+H5S__none_deserialize(H5S_t **space, const uint8_t **p)
{
H5S_t *tmp_space = NULL; /* Pointer to actual dataspace to use,
either *space or a newly allocated one */
uint32_t version; /* Version number */
herr_t ret_value = SUCCEED; /* return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
HDassert(p);
HDassert(*p);
@@ -576,16 +605,16 @@ done:
HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace")
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_none_deserialize() */
+} /* end H5S__none_deserialize() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_bounds
+ H5S__none_bounds
PURPOSE
Gets the bounding box containing the selection.
USAGE
- herr_t H5S_none_bounds(space, start, end)
+ herr_t H5S__none_bounds(space, start, end)
H5S_t *space; IN: Dataspace pointer of selection to query
hsize_t *start; OUT: Starting coordinate of bounding box
hsize_t *end; OUT: Opposite coordinate of bounding box
@@ -605,25 +634,25 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_none_bounds(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSED *start, hsize_t H5_ATTR_UNUSED *end)
+H5S__none_bounds(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSED *start, hsize_t H5_ATTR_UNUSED *end)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(space);
HDassert(start);
HDassert(end);
FUNC_LEAVE_NOAPI(FAIL)
-} /* H5Sget_none_bounds() */
+} /* end H5S_none_bounds() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_offset
+ H5S__none_offset
PURPOSE
Gets the linear offset of the first element for the selection.
USAGE
- herr_t H5S_none_offset(space, offset)
+ herr_t H5S__none_offset(space, offset)
const H5S_t *space; IN: Dataspace pointer of selection to query
hsize_t *offset; OUT: Linear offset of first element in selection
RETURNS
@@ -638,15 +667,15 @@ H5S_none_bounds(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSED *start
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_none_offset(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSED *offset)
+H5S__none_offset(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSED *offset)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(space);
HDassert(offset);
FUNC_LEAVE_NOAPI(FAIL)
-} /* H5S_none_offset() */
+} /* end H5S__none_offset() */
/*--------------------------------------------------------------------------
@@ -679,11 +708,11 @@ H5S__none_unlim_dim(const H5S_t H5_ATTR_UNUSED *space)
/*--------------------------------------------------------------------------
NAME
- H5S_none_is_contiguous
+ H5S__none_is_contiguous
PURPOSE
Check if a "none" selection is contiguous within the dataspace extent.
USAGE
- htri_t H5S_none_is_contiguous(space)
+ htri_t H5S__none_is_contiguous(space)
H5S_t *space; IN: Dataspace pointer to check
RETURNS
TRUE/FALSE/FAIL
@@ -696,23 +725,23 @@ H5S__none_unlim_dim(const H5S_t H5_ATTR_UNUSED *space)
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S_none_is_contiguous(const H5S_t H5_ATTR_UNUSED *space)
+H5S__none_is_contiguous(const H5S_t H5_ATTR_UNUSED *space)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(space);
FUNC_LEAVE_NOAPI(FALSE)
-} /* H5S_none_is_contiguous() */
+} /* end H5S__none_is_contiguous() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_is_single
+ H5S__none_is_single
PURPOSE
Check if a "none" selection is a single block within the dataspace extent.
USAGE
- htri_t H5S_none_is_single(space)
+ htri_t H5S__none_is_single(space)
H5S_t *space; IN: Dataspace pointer to check
RETURNS
TRUE/FALSE/FAIL
@@ -725,23 +754,23 @@ H5S_none_is_contiguous(const H5S_t H5_ATTR_UNUSED *space)
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S_none_is_single(const H5S_t H5_ATTR_UNUSED *space)
+H5S__none_is_single(const H5S_t H5_ATTR_UNUSED *space)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(space);
FUNC_LEAVE_NOAPI(FALSE)
-} /* H5S_none_is_single() */
+} /* end H5S__none_is_single() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_is_regular
+ H5S__none_is_regular
PURPOSE
Check if a "none" selection is "regular"
USAGE
- htri_t H5S_none_is_regular(space)
+ htri_t H5S__none_is_regular(space)
const H5S_t *space; IN: Dataspace pointer to check
RETURNS
TRUE/FALSE/FAIL
@@ -755,24 +784,24 @@ H5S_none_is_single(const H5S_t H5_ATTR_UNUSED *space)
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S_none_is_regular(const H5S_t H5_ATTR_UNUSED *space)
+H5S__none_is_regular(const H5S_t H5_ATTR_UNUSED *space)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(space);
FUNC_LEAVE_NOAPI(TRUE)
-} /* H5S_none_is_regular() */
+} /* end H5S__none_is_regular() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_adjust_u
+ H5S__none_adjust_u
PURPOSE
Adjust an "none" selection by subtracting an offset
USAGE
- void H5S_none_adjust_u(space, offset)
+ void H5S__none_adjust_u(space, offset)
H5S_t *space; IN/OUT: Pointer to dataspace to adjust
const hsize_t *offset; IN: Offset to subtract
RETURNS
@@ -785,24 +814,24 @@ H5S_none_is_regular(const H5S_t H5_ATTR_UNUSED *space)
REVISION LOG
--------------------------------------------------------------------------*/
static void
-H5S_none_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *offset)
+H5S__none_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *offset)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(space);
HDassert(offset);
FUNC_LEAVE_NOAPI_VOID
-} /* H5S_none_adjust_u() */
+} /* end H5S__none_adjust_u() */
/*-------------------------------------------------------------------------
- * Function: H5S_none_project_scalar
+ * Function: H5S__none_project_scalar
*
- * Purpose: Projects a 'none' selection into a scalar dataspace
+ * Purpose: Projects a 'none' selection into a scalar dataspace
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
* Programmer: Quincey Koziol
* Sunday, July 18, 2010
@@ -810,37 +839,38 @@ H5S_none_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *off
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_none_project_scalar(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSED *offset)
+H5S__none_project_scalar(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSED *offset)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(space && H5S_SEL_NONE == H5S_GET_SELECT_TYPE(space));
HDassert(offset);
FUNC_LEAVE_NOAPI(FAIL)
-} /* H5S_none_project_scalar() */
+} /* end H5S__none_project_scalar() */
/*-------------------------------------------------------------------------
- * Function: H5S_none_project_simple
+ * Function: H5S__none_project_simple
*
- * Purpose: Projects an 'none' selection onto/into a simple dataspace
+ * Purpose: Projects an 'none' selection onto/into a simple dataspace
* of a different rank
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Sunday, July 18, 2010
*
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_none_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *offset)
+H5S__none_project_simple(const H5S_t H5_ATTR_UNUSED *base_space,
+ H5S_t *new_space, hsize_t H5_ATTR_UNUSED *offset)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(base_space && H5S_SEL_NONE == H5S_GET_SELECT_TYPE(base_space));
@@ -853,7 +883,7 @@ H5S_none_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *offs
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_none_project_simple() */
+} /* end H5S__none_project_simple() */
/*--------------------------------------------------------------------------
@@ -895,7 +925,7 @@ H5S_select_none(H5S_t *space)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_none() */
+} /* end H5S_select_none() */
/*--------------------------------------------------------------------------
@@ -934,16 +964,16 @@ H5Sselect_none(hid_t spaceid)
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Sselect_none() */
+} /* end H5Sselect_none() */
/*--------------------------------------------------------------------------
NAME
- H5S_none_get_seq_list
+ H5S__none_get_seq_list
PURPOSE
Create a list of offsets & lengths for a selection
USAGE
- herr_t H5S_none_get_seq_list(space,flags,iter,maxseq,maxelem,nseq,nelem,off,len)
+ herr_t H5S__none_get_seq_list(space,flags,iter,maxseq,maxelem,nseq,nelem,off,len)
H5S_t *space; IN: Dataspace containing selection to use.
unsigned flags; IN: Flags for extra information about operation
H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
@@ -969,11 +999,11 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_none_get_seq_list(const H5S_t H5_ATTR_UNUSED *space, unsigned H5_ATTR_UNUSED flags, H5S_sel_iter_t H5_ATTR_UNUSED *iter,
+H5S__none_get_seq_list(const H5S_t H5_ATTR_UNUSED *space, unsigned H5_ATTR_UNUSED flags, H5S_sel_iter_t H5_ATTR_UNUSED *iter,
size_t H5_ATTR_UNUSED maxseq, size_t H5_ATTR_UNUSED maxelem, size_t *nseq, size_t *nelem,
hsize_t H5_ATTR_UNUSED *off, size_t H5_ATTR_UNUSED *len)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(space);
@@ -992,5 +1022,5 @@ H5S_none_get_seq_list(const H5S_t H5_ATTR_UNUSED *space, unsigned H5_ATTR_UNUSED
*nelem = 0;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S_none_get_seq_list() */
+} /* end H5S__none_get_seq_list() */
diff --git a/src/H5Spkg.h b/src/H5Spkg.h
index fc78cb6..6ba671b 100644
--- a/src/H5Spkg.h
+++ b/src/H5Spkg.h
@@ -26,6 +26,7 @@
#ifndef _H5Spkg_H
#define _H5Spkg_H
+/* Get package's private header */
#include "H5Sprivate.h"
/* Flags to indicate special dataspace features are active */
@@ -53,12 +54,13 @@
#define H5S_ALL_VERSION_1 1
#define H5S_ALL_VERSION_LATEST H5S_ALL_VERSION_1
-/* Size of point/offset info for H5S_SEL_POINTS/H5S_SEL_HYPER */
+/* Encoded size of selection info for H5S_SEL_POINTS/H5S_SEL_HYPER */
#define H5S_SELECT_INFO_ENC_SIZE_4 0x04 /* 4 bytes: 32 bits */
#define H5S_SELECT_INFO_ENC_SIZE_8 0x08 /* 8 bytes: 64 bits */
-#define H5S_SELECT_INFO_ENC_SIZE_BITS (H5S_SELECT_INFO_ENC_SIZE_4|H5S_SELECT_INFO_ENC_SIZE_8)
+#define H5S_SELECT_INFO_ENC_SIZE_BITS ( H5S_SELECT_INFO_ENC_SIZE_4 | \
+ H5S_SELECT_INFO_ENC_SIZE_8 )
-#define H5S_UINT32_MAX 4294967295 /* 2^32 - 1 */
+#define H5S_UINT32_MAX 0xFFFFFFFF /* 2^32 - 1 = 4,294,967,295 */
/* Length of stack-allocated sequences for "project intersect" routines */
#define H5S_PROJECT_INTERSECT_NSEQS 256
@@ -101,6 +103,7 @@ struct H5S_extent_t {
/*
* Dataspace selection information
*/
+
/* Node in point selection list (typedef'd in H5Sprivate.h) */
struct H5S_pnt_node_t {
hsize_t *pnt; /* Pointer to a selected point */
@@ -112,7 +115,7 @@ typedef struct {
H5S_pnt_node_t *head; /* Pointer to head of point list */
} H5S_pnt_list_t;
-/* Information about new-style hyperslab spans */
+/* Information about hyperslab spans */
/* Information a particular hyperslab span */
struct H5S_hyper_span_t {
@@ -135,7 +138,7 @@ struct H5S_hyper_span_info_t {
struct H5S_hyper_span_t *head; /* Pointer to list of spans in next dimension down */
};
-/* Information about new-style hyperslab selection */
+/* Information about hyperslab selection */
typedef struct {
hbool_t diminfo_valid; /* Whether the dataset has valid diminfo */
H5S_hyper_dim_t opt_diminfo[H5S_MAX_RANK]; /* per-dim selection info */
@@ -148,7 +151,7 @@ typedef struct {
* information. */
int unlim_dim; /* Dimension where selection is unlimited, or -1 if none */
hsize_t num_elem_non_unlim; /* # of elements in a "slice" excluding the unlimited dimension */
- H5S_hyper_span_info_t *span_lst; /* List of hyperslab span information */
+ H5S_hyper_span_info_t *span_lst; /* List of hyperslab span information of all dimensions */
} H5S_hyper_sel_t;
/* Selection information methods */
@@ -293,8 +296,8 @@ H5_DLLVAR const unsigned H5O_sdspace_ver_bounds[H5F_LIBVER_NBOUNDS];
H5_DLLVAR const unsigned H5O_sds_hyper_ver_bounds[H5F_LIBVER_NBOUNDS];
/* Extent functions */
-H5_DLL herr_t H5S_extent_release(H5S_extent_t *extent);
-H5_DLL herr_t H5S_extent_copy_real(H5S_extent_t *dst, const H5S_extent_t *src,
+H5_DLL herr_t H5S__extent_release(H5S_extent_t *extent);
+H5_DLL herr_t H5S__extent_copy_real(H5S_extent_t *dst, const H5S_extent_t *src,
hbool_t copy_max);
/* Operations on selections */
@@ -305,8 +308,8 @@ H5_DLL herr_t H5S__hyper_subtract(H5S_t *space, H5S_t *subtract_space);
/* Testing functions */
#ifdef H5S_TESTING
+H5_DLL htri_t H5S__get_rebuild_status_test(hid_t space_id);
H5_DLL htri_t H5S_select_shape_same_test(hid_t sid1, hid_t sid2);
-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 d4dd144..2d73dfd 100644
--- a/src/H5Spoint.c
+++ b/src/H5Spoint.c
@@ -15,77 +15,94 @@
* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
* Tuesday, June 16, 1998
*
- * Purpose: Point selection dataspace I/O functions.
+ * Purpose: Point selection dataspace I/O functions.
*/
+/****************/
+/* Module Setup */
+/****************/
+
#include "H5Smodule.h" /* This source code file is part of the H5S module */
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5Iprivate.h" /* ID Functions */
-#include "H5MMprivate.h" /* Memory Management functions */
-#include "H5Spkg.h" /* Dataspace functions */
-#include "H5VMprivate.h" /* Vector functions */
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5Iprivate.h" /* ID Functions */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Spkg.h" /* Dataspace functions */
+#include "H5VMprivate.h" /* Vector functions */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
-/* Static function prototypes */
-/* Selection callbacks */
-static herr_t H5S_point_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection);
-static herr_t H5S_point_get_seq_list(const H5S_t *space, unsigned flags,
+/********************/
+/* Local Prototypes */
+/********************/
+static herr_t H5S__point_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection);
+static herr_t H5S__point_get_seq_list(const H5S_t *space, unsigned flags,
H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes,
size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len);
-static herr_t H5S_point_release(H5S_t *space);
-static htri_t H5S_point_is_valid(const H5S_t *space);
-static hssize_t H5S_point_serial_size(const H5S_t *space);
-static herr_t H5S_point_serialize(const H5S_t *space, uint8_t **p);
-static herr_t H5S_point_deserialize(H5S_t **space, const uint8_t **p);
-static herr_t H5S_point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
-static herr_t H5S_point_offset(const H5S_t *space, hsize_t *off);
+static herr_t H5S__point_release(H5S_t *space);
+static htri_t H5S__point_is_valid(const H5S_t *space);
+static hssize_t H5S__point_serial_size(const H5S_t *space);
+static herr_t H5S__point_serialize(const H5S_t *space, uint8_t **p);
+static herr_t H5S__point_deserialize(H5S_t **space, const uint8_t **p);
+static herr_t H5S__point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
+static herr_t H5S__point_offset(const H5S_t *space, hsize_t *off);
static int H5S__point_unlim_dim(const H5S_t *space);
-static htri_t H5S_point_is_contiguous(const H5S_t *space);
-static htri_t H5S_point_is_single(const H5S_t *space);
-static htri_t H5S_point_is_regular(const H5S_t *space);
-static void H5S_point_adjust_u(H5S_t *space, const hsize_t *offset);
-static herr_t H5S_point_project_scalar(const H5S_t *space, hsize_t *offset);
-static herr_t H5S_point_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset);
-static herr_t H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space);
-static herr_t
- H5S_point_get_version_enc_size(const H5S_t *space, uint32_t *version, uint8_t *enc_size);
+static htri_t H5S__point_is_contiguous(const H5S_t *space);
+static htri_t H5S__point_is_single(const H5S_t *space);
+static htri_t H5S__point_is_regular(const H5S_t *space);
+static void H5S__point_adjust_u(H5S_t *space, const hsize_t *offset);
+static herr_t H5S__point_project_scalar(const H5S_t *space, hsize_t *offset);
+static herr_t H5S__point_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset);
+static herr_t H5S__point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space);
+static herr_t H5S__point_get_version_enc_size(const H5S_t *space, uint32_t *version, uint8_t *enc_size);
/* Selection iteration callbacks */
-static herr_t H5S_point_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords);
-static herr_t H5S_point_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end);
-static hsize_t H5S_point_iter_nelmts(const H5S_sel_iter_t *iter);
-static htri_t H5S_point_iter_has_next_block(const H5S_sel_iter_t *iter);
-static herr_t H5S_point_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem);
-static herr_t H5S_point_iter_next_block(H5S_sel_iter_t *sel_iter);
-static herr_t H5S_point_iter_release(H5S_sel_iter_t *sel_iter);
+static herr_t H5S__point_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords);
+static herr_t H5S__point_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end);
+static hsize_t H5S__point_iter_nelmts(const H5S_sel_iter_t *iter);
+static htri_t H5S__point_iter_has_next_block(const H5S_sel_iter_t *iter);
+static herr_t H5S__point_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem);
+static herr_t H5S__point_iter_next_block(H5S_sel_iter_t *sel_iter);
+static herr_t H5S__point_iter_release(H5S_sel_iter_t *sel_iter);
/* Selection properties for point selections */
const H5S_select_class_t H5S_sel_point[1] = {{
H5S_SEL_POINTS,
/* Methods on selection */
- H5S_point_copy,
- H5S_point_get_seq_list,
- H5S_point_release,
- H5S_point_is_valid,
- H5S_point_serial_size,
- H5S_point_serialize,
- H5S_point_deserialize,
- H5S_point_bounds,
- H5S_point_offset,
+ H5S__point_copy,
+ H5S__point_get_seq_list,
+ H5S__point_release,
+ H5S__point_is_valid,
+ H5S__point_serial_size,
+ H5S__point_serialize,
+ H5S__point_deserialize,
+ H5S__point_bounds,
+ H5S__point_offset,
H5S__point_unlim_dim,
NULL,
- H5S_point_is_contiguous,
- H5S_point_is_single,
- H5S_point_is_regular,
- H5S_point_adjust_u,
- H5S_point_project_scalar,
- H5S_point_project_simple,
- H5S_point_iter_init,
+ H5S__point_is_contiguous,
+ H5S__point_is_single,
+ H5S__point_is_regular,
+ H5S__point_adjust_u,
+ H5S__point_project_scalar,
+ H5S__point_project_simple,
+ H5S__point_iter_init,
}};
/* Iteration properties for point selections */
@@ -93,13 +110,13 @@ static const H5S_sel_iter_class_t H5S_sel_iter_point[1] = {{
H5S_SEL_POINTS,
/* Methods on selection iterator */
- H5S_point_iter_coords,
- H5S_point_iter_block,
- H5S_point_iter_nelmts,
- H5S_point_iter_has_next_block,
- H5S_point_iter_next,
- H5S_point_iter_next_block,
- H5S_point_iter_release,
+ H5S__point_iter_coords,
+ H5S__point_iter_block,
+ H5S__point_iter_nelmts,
+ H5S__point_iter_has_next_block,
+ H5S__point_iter_next,
+ H5S__point_iter_next_block,
+ H5S__point_iter_release,
}};
/* Declare a free list to manage the H5S_pnt_node_t struct */
@@ -110,91 +127,85 @@ H5FL_DEFINE_STATIC(H5S_pnt_list_t);
/*-------------------------------------------------------------------------
- * Function: H5S_point_iter_init
+ * Function: H5S__point_iter_init
*
- * Purpose: Initializes iteration information for point selection.
+ * Purpose: Initializes iteration information for point selection.
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Tuesday, June 16, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
+H5S__point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
- HDassert(space && H5S_SEL_POINTS==H5S_GET_SELECT_TYPE(space));
+ HDassert(space && H5S_SEL_POINTS == H5S_GET_SELECT_TYPE(space));
HDassert(iter);
/* Initialize the number of points to iterate over */
- iter->elmt_left=space->select.num_elem;
+ iter->elmt_left = space->select.num_elem;
/* Start at the head of the list of points */
- iter->u.pnt.curr=space->select.sel_info.pnt_lst->head;
+ iter->u.pnt.curr = space->select.sel_info.pnt_lst->head;
/* Initialize type of selection iterator */
- iter->type=H5S_sel_iter_point;
+ iter->type = H5S_sel_iter_point;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_point_iter_init() */
+} /* end H5S__point_iter_init() */
/*-------------------------------------------------------------------------
- * Function: H5S_point_iter_coords
+ * Function: H5S__point_iter_coords
*
- * Purpose: Retrieve the current coordinates of iterator for current
+ * Purpose: Retrieve the current coordinates of iterator for current
* selection
*
- * Return: non-negative on success, negative on failure
+ * Return: Non-negative on success, negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Tuesday, April 22, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_point_iter_coords (const H5S_sel_iter_t *iter, hsize_t *coords)
+H5S__point_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
HDassert(coords);
/* Copy the offset of the current point */
- H5MM_memcpy(coords,iter->u.pnt.curr->pnt,sizeof(hsize_t)*iter->rank);
+ H5MM_memcpy(coords, iter->u.pnt.curr->pnt, sizeof(hsize_t) * iter->rank);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_point_iter_coords() */
+} /* end H5S__point_iter_coords() */
/*-------------------------------------------------------------------------
- * Function: H5S_point_iter_block
+ * Function: H5S_point_iter_block
*
- * Purpose: Retrieve the current block of iterator for current
+ * Purpose: Retrieve the current block of iterator for current
* selection
*
- * Return: non-negative on success, negative on failure
+ * Return: Non-negative on success, negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Monday, June 2, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_point_iter_block (const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
+H5S__point_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
@@ -202,46 +213,44 @@ H5S_point_iter_block (const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
HDassert(end);
/* Copy the current point as a block */
- H5MM_memcpy(start,iter->u.pnt.curr->pnt,sizeof(hsize_t)*iter->rank);
- H5MM_memcpy(end,iter->u.pnt.curr->pnt,sizeof(hsize_t)*iter->rank);
+ H5MM_memcpy(start, iter->u.pnt.curr->pnt, sizeof(hsize_t) * iter->rank);
+ H5MM_memcpy(end, iter->u.pnt.curr->pnt, sizeof(hsize_t) * iter->rank);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_point_iter_block() */
+} /* end H5S__point_iter_block() */
/*-------------------------------------------------------------------------
- * Function: H5S_point_iter_nelmts
+ * Function: H5S__point_iter_nelmts
*
- * Purpose: Return number of elements left to process in iterator
+ * Purpose: Return number of elements left to process in iterator
*
- * Return: non-negative number of elements on success, zero on failure
+ * Return: Non-negative number of elements on success, zero on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Tuesday, June 16, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static hsize_t
-H5S_point_iter_nelmts (const H5S_sel_iter_t *iter)
+H5S__point_iter_nelmts(const H5S_sel_iter_t *iter)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
FUNC_LEAVE_NOAPI(iter->elmt_left)
-} /* H5S_point_iter_nelmts() */
+} /* end H5S__point_iter_nelmts() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_iter_has_next_block
+ H5S__point_iter_has_next_block
PURPOSE
Check if there is another block left in the current iterator
USAGE
- htri_t H5S_point_iter_has_next_block(iter)
+ htri_t H5S__point_iter_has_next_block(iter)
const H5S_sel_iter_t *iter; IN: Pointer to selection iterator
RETURNS
Non-negative (TRUE/FALSE) on success/Negative on failure
@@ -253,31 +262,31 @@ H5S_point_iter_nelmts (const H5S_sel_iter_t *iter)
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S_point_iter_has_next_block(const H5S_sel_iter_t *iter)
+H5S__point_iter_has_next_block(const H5S_sel_iter_t *iter)
{
- htri_t ret_value=TRUE; /* Return value */
+ htri_t ret_value = TRUE; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
/* Check if there is another point in the list */
- if(iter->u.pnt.curr->next==NULL)
+ if(iter->u.pnt.curr->next == NULL)
HGOTO_DONE(FALSE);
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_point_iter_has_next_block() */
+} /* end H5S__point_iter_has_next_block() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_iter_next
+ H5S__point_iter_next
PURPOSE
Increment selection iterator
USAGE
- herr_t H5S_point_iter_next(iter, nelem)
+ herr_t H5S__point_iter_next(iter, nelem)
H5S_sel_iter_t *iter; IN: Pointer to selection iterator
size_t nelem; IN: Number of elements to advance by
RETURNS
@@ -290,31 +299,31 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_iter_next(H5S_sel_iter_t *iter, size_t nelem)
+H5S__point_iter_next(H5S_sel_iter_t *iter, size_t nelem)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
- HDassert(nelem>0);
+ HDassert(nelem > 0);
/* Increment the iterator */
- while(nelem>0) {
- iter->u.pnt.curr=iter->u.pnt.curr->next;
+ while(nelem > 0) {
+ iter->u.pnt.curr = iter->u.pnt.curr->next;
nelem--;
} /* end while */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_point_iter_next() */
+} /* end H5S__point_iter_next() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_iter_next_block
+ H5S__point_iter_next_block
PURPOSE
Increment selection iterator to next block
USAGE
- herr_t H5S_point_iter_next_block(iter)
+ herr_t H5S__point_iter_next_block(iter)
H5S_sel_iter_t *iter; IN: Pointer to selection iterator
RETURNS
Non-negative on success/Negative on failure
@@ -326,27 +335,27 @@ H5S_point_iter_next(H5S_sel_iter_t *iter, size_t nelem)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_iter_next_block(H5S_sel_iter_t *iter)
+H5S__point_iter_next_block(H5S_sel_iter_t *iter)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
/* Increment the iterator */
- iter->u.pnt.curr=iter->u.pnt.curr->next;
+ iter->u.pnt.curr = iter->u.pnt.curr->next;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_point_iter_next_block() */
+} /* end H5S__point_iter_next_block() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_iter_release
+ H5S__point_iter_release
PURPOSE
Release point selection iterator information for a dataspace
USAGE
- herr_t H5S_point_iter_release(iter)
+ herr_t H5S__point_iter_release(iter)
H5S_sel_iter_t *iter; IN: Pointer to selection iterator
RETURNS
Non-negative on success/Negative on failure
@@ -358,24 +367,24 @@ H5S_point_iter_next_block(H5S_sel_iter_t *iter)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_iter_release (H5S_sel_iter_t H5_ATTR_UNUSED * iter)
+H5S__point_iter_release(H5S_sel_iter_t H5_ATTR_UNUSED * iter)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(iter);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_point_iter_release() */
+} /* end H5S__point_iter_release() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_add
+ H5S__point_add
PURPOSE
Add a series of elements to a point selection
USAGE
- herr_t H5S_point_add(space, num_elem, coord)
+ herr_t H5S__point_add(space, num_elem, coord)
H5S_t *space; IN: Dataspace of selection to modify
hsize_t num_elem; IN: Number of elements in COORD array.
const hsize_t *coord[]; IN: The location of each element selected
@@ -389,14 +398,15 @@ H5S_point_iter_release (H5S_sel_iter_t H5_ATTR_UNUSED * iter)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_add(H5S_t *space, H5S_seloper_t op, hsize_t num_elem, const hsize_t *coord)
+H5S__point_add(H5S_t *space, H5S_seloper_t op, hsize_t num_elem, const hsize_t *coord)
{
H5S_pnt_node_t *top = NULL, *curr = NULL, *new_node = NULL; /* Point selection nodes */
unsigned u; /* Counter */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
+ /* Sanity checks */
HDassert(space);
HDassert(num_elem > 0);
HDassert(coord);
@@ -470,16 +480,16 @@ done:
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_point_add() */
+} /* end H5S__point_add() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_release
+ H5S__point_release
PURPOSE
Release point selection information for a dataspace
USAGE
- herr_t H5S_point_release(space)
+ herr_t H5S__point_release(space)
H5S_t *space; IN: Pointer to dataspace
RETURNS
Non-negative on success/Negative on failure
@@ -491,11 +501,11 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_release (H5S_t *space)
+H5S__point_release(H5S_t *space)
{
H5S_pnt_node_t *curr, *next; /* Point selection nodes */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(space);
@@ -516,7 +526,7 @@ H5S_point_release (H5S_t *space)
space->select.num_elem = 0;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_point_release() */
+} /* end H5S__point_release() */
/*--------------------------------------------------------------------------
@@ -553,9 +563,9 @@ herr_t
H5S_select_elements(H5S_t *space, H5S_seloper_t op, hsize_t num_elem,
const hsize_t *coord)
{
- herr_t ret_value = SUCCEED; /* return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI(FAIL)
/* Check args */
HDassert(space);
@@ -574,7 +584,7 @@ H5S_select_elements(H5S_t *space, H5S_seloper_t op, hsize_t num_elem,
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate element information")
/* Add points to selection */
- if(H5S_point_add(space, op, num_elem, coord) < 0)
+ if(H5S__point_add(space, op, num_elem, coord) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert elements")
/* Set selection type */
@@ -582,12 +592,12 @@ H5S_select_elements(H5S_t *space, H5S_seloper_t op, hsize_t num_elem,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_elements() */
+} /* end H5S_select_elements() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_copy
+ H5S__point_copy
PURPOSE
Copy a selection from one dataspace to another
USAGE
@@ -605,13 +615,14 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_copy(H5S_t *dst, const H5S_t *src, hbool_t H5_ATTR_UNUSED share_selection)
+H5S__point_copy(H5S_t *dst, const H5S_t *src, hbool_t H5_ATTR_UNUSED share_selection)
{
H5S_pnt_node_t *curr, *new_node, *new_tail; /* Point information nodes */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
+ /* Sanity checks */
HDassert(src);
HDassert(dst);
@@ -661,18 +672,18 @@ done:
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_point_copy() */
+} /* end H5S__point_copy() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_is_valid
+ H5S__point_is_valid
PURPOSE
Check whether the selection fits within the extent, with the current
offset defined.
USAGE
- htri_t H5S_point_is_valid(space);
- H5S_t *space; IN: Dataspace pointer to query
+ htri_t H5S__point_is_valid(space);
+ const H5S_t *space; IN: Dataspace pointer to query
RETURNS
TRUE if the selection fits within the extent, FALSE if it does not and
Negative on an error.
@@ -685,13 +696,13 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S_point_is_valid (const H5S_t *space)
+H5S__point_is_valid(const H5S_t *space)
{
H5S_pnt_node_t *curr; /* Point information nodes */
unsigned u; /* Counter */
htri_t ret_value = TRUE; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(space);
@@ -712,7 +723,7 @@ H5S_point_is_valid (const H5S_t *space)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_point_is_valid() */
+} /* end H5S__point_is_valid() */
/*--------------------------------------------------------------------------
@@ -751,20 +762,21 @@ H5Sget_select_elem_npoints(hid_t spaceid)
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Sget_select_elem_npoints() */
+} /* end H5Sget_select_elem_npoints() */
+
/*--------------------------------------------------------------------------
NAME
- H5S_point_get_version_enc_size
+ H5S__point_get_version_enc_size
PURPOSE
Determine the version and the size (4 bytes) to encode point selection info
USAGE
- hssize_t H5S_point_get_version_enc_size(space, uint32_t *version, uint8_t *enc_size
- const H5S_t *space; IN: The dataspace
- uint32_t *version: OUT: The version to use for encoding
- uint8_t *enc_size: OUT: The size to use for encoding
+ hssize_t H5S__point_get_version_enc_size(space, version, enc_size)
+ const H5S_t *space: IN: Dataspace ID of selection to query
+ uint32_t *version: OUT: The version to use for encoding
+ uint8_t *enc_size: OUT: The size to use for encoding
RETURNS
- The version and the encoded size to use
+ The version and the size to encode point selection info
DESCRIPTION
Determine the version and the encoded size to use for encoding points selection info.
Detect whether the number of points or the high bound exceeds 2^32 -1.
@@ -775,27 +787,27 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_get_version_enc_size(const H5S_t *space, uint32_t *version, uint8_t *enc_size)
+H5S__point_get_version_enc_size(const H5S_t *space, uint32_t *version, uint8_t *enc_size)
{
hbool_t exceed = FALSE;
- hsize_t bounds_start[H5S_MAX_RANK];
- hsize_t bounds_end[H5S_MAX_RANK];
- unsigned u;
- herr_t ret_value = SUCCEED; /* return value */
+ hsize_t bounds_start[H5S_MAX_RANK]; /* Starting coordinate of bounding box */
+ hsize_t bounds_end[H5S_MAX_RANK]; /* Opposite coordinate of bounding box */
+ unsigned u; /* Local index veriable */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Get bounding box for the selection */
HDmemset(bounds_end, 0, sizeof(bounds_end));
- if(H5S_point_bounds(space, bounds_start, bounds_end) < 0)
+ if(H5S__point_bounds(space, bounds_start, bounds_end) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds")
- /* Determine whether the number of points or the high bounds in the selection exceed (2^32 - 1) */
+ /* Determine whether number of points or high bounds exceeds (2^32 - 1) */
for(u = 0; u < space->extent.rank; u++)
if(bounds_end[u] > H5S_UINT32_MAX) {
exceed = TRUE;
break;
- }
+ }
if(space->select.num_elem > H5S_UINT32_MAX)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "The number of points in point selection exceeds 2^32")
@@ -807,18 +819,18 @@ H5S_point_get_version_enc_size(const H5S_t *space, uint32_t *version, uint8_t *e
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_point_get_version_enc_size() */
+} /* H5S__point_get_version_enc_size() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_serial_size
+ H5S__point_serial_size
PURPOSE
Determine the number of bytes needed to store the serialized point selection
information.
USAGE
- hssize_t H5S_point_serial_size(space)
- H5S_t *space; IN: Dataspace pointer to query
+ hssize_t H5S__point_serial_size(space)
+ const H5S_t *space; IN: Dataspace pointer to query
RETURNS
The number of bytes required on success, negative on an error.
DESCRIPTION
@@ -830,19 +842,19 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static hssize_t
-H5S_point_serial_size (const H5S_t *space)
+H5S__point_serial_size(const H5S_t *space)
{
H5S_pnt_node_t *curr; /* Point information nodes */
uint32_t version; /* Version number */
- uint8_t enc_size; /* Size of point info */
+ uint8_t enc_size; /* Encoded size of point selection info */
hssize_t ret_value = -1; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
HDassert(space);
/* Determine the version */
- if(H5S_point_get_version_enc_size(space, &version, &enc_size) < 0)
+ if(H5S__point_get_version_enc_size(space, &version, &enc_size) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine version and enc_size")
HDassert(version == H5S_POINT_VERSION_1);
@@ -859,8 +871,8 @@ H5S_point_serial_size (const H5S_t *space)
ret_value += enc_size;
/* Count points in selection */
- curr=space->select.sel_info.pnt_lst->head;
- while(curr!=NULL) {
+ curr = space->select.sel_info.pnt_lst->head;
+ while(curr != NULL) {
/* Add <enc_size> bytes times the rank for each element selected */
ret_value += enc_size * space->extent.rank;
curr = curr->next;
@@ -868,16 +880,16 @@ H5S_point_serial_size (const H5S_t *space)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_point_serial_size() */
+} /* end H5S__point_serial_size() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_serialize
+ H5S__point_serialize
PURPOSE
Serialize the current selection into a user-provided buffer.
USAGE
- herr_t H5S_point_serialize(space, p)
+ herr_t H5S__point_serialize(space, p)
const H5S_t *space; IN: Dataspace with selection to serialize
uint8_t **p; OUT: Pointer to buffer to put serialized
selection. Will be advanced to end of
@@ -893,18 +905,18 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_serialize (const H5S_t *space, uint8_t **p)
+H5S__point_serialize(const H5S_t *space, uint8_t **p)
{
H5S_pnt_node_t *curr; /* Point information nodes */
uint8_t *pp; /* Local pointer for encoding */
- uint8_t *lenp; /* pointer to length location for later storage */
+ uint8_t *lenp = NULL; /* pointer to length location for later storage */
uint32_t len=0; /* number of bytes used */
unsigned u; /* local counting variable */
uint32_t version; /* Version number */
- uint8_t enc_size; /* Size of point info */
+ uint8_t enc_size; /* Encoded size of point selection info */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(space);
@@ -913,7 +925,7 @@ H5S_point_serialize (const H5S_t *space, uint8_t **p)
HDassert(pp);
/* Determine the version */
- if(H5S_point_get_version_enc_size(space, &version, &enc_size) < 0)
+ if(H5S__point_get_version_enc_size(space, &version, &enc_size) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine version and enc_size")
HDassert(enc_size == H5S_SELECT_INFO_ENC_SIZE_4);
@@ -921,6 +933,7 @@ H5S_point_serialize (const H5S_t *space, uint8_t **p)
/* Store the preamble information */
UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */
+
UINT32ENCODE(pp, version); /* Store the version number */
UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */
@@ -948,7 +961,6 @@ H5S_point_serialize (const H5S_t *space, uint8_t **p)
curr=curr->next;
} /* end while */
- /* Encode length */
UINT32ENCODE(lenp, (uint32_t)len); /* Store the length of the extra information */
/* Update encoding pointer */
@@ -956,16 +968,16 @@ H5S_point_serialize (const H5S_t *space, uint8_t **p)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_point_serialize() */
+} /* H5S__point_serialize() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_deserialize
+ H5S__point_deserialize
PURPOSE
Deserialize the current selection from a user-provided buffer.
USAGE
- herr_t H5S_point_deserialize(space, p)
+ herr_t H5S__point_deserialize(space, p)
H5S_t **space; IN/OUT: Dataspace pointer to place
selection into
uint8 **p; OUT: Pointer to buffer holding serialized
@@ -982,7 +994,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_deserialize(H5S_t **space, const uint8_t **p)
+H5S__point_deserialize(H5S_t **space, const uint8_t **p)
{
H5S_t *tmp_space = NULL; /* Pointer to actual dataspace to use,
either *space or a newly allocated one */
@@ -995,7 +1007,7 @@ H5S_point_deserialize(H5S_t **space, const uint8_t **p)
unsigned i, j; /* local counting variables */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(p);
@@ -1071,16 +1083,16 @@ done:
H5MM_xfree(coord);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_point_deserialize() */
+} /* end H5S__point_deserialize() */
/*--------------------------------------------------------------------------
NAME
- H5S_get_select_elem_pointlist
+ H5S__get_select_elem_pointlist
PURPOSE
Get the list of element points currently selected
USAGE
- herr_t H5S_get_select_elem_pointlist(space, hsize_t *buf)
+ herr_t H5S__get_select_elem_pointlist(space, hsize_t *buf)
H5S_t *space; IN: Dataspace pointer of selection to query
hsize_t startpoint; IN: Element point to start with
hsize_t numpoints; IN: Number of element points to get
@@ -1104,12 +1116,12 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_get_select_elem_pointlist(H5S_t *space, hsize_t startpoint, hsize_t numpoints, hsize_t *buf)
+H5S__get_select_elem_pointlist(H5S_t *space, hsize_t startpoint, hsize_t numpoints, hsize_t *buf)
{
H5S_pnt_node_t *node; /* Point node */
unsigned rank; /* Dataspace rank */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(space);
HDassert(buf);
@@ -1135,7 +1147,7 @@ H5S_get_select_elem_pointlist(H5S_t *space, hsize_t startpoint, hsize_t numpoint
} /* end while */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_get_select_elem_pointlist() */
+} /* end H5S__get_select_elem_pointlist() */
/*--------------------------------------------------------------------------
@@ -1185,20 +1197,20 @@ H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t startpoint,
if(H5S_GET_SELECT_TYPE(space) != H5S_SEL_POINTS)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a point selection")
- ret_value = H5S_get_select_elem_pointlist(space, startpoint, numpoints, buf);
+ ret_value = H5S__get_select_elem_pointlist(space, startpoint, numpoints, buf);
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Sget_select_elem_pointlist() */
+} /* end H5Sget_select_elem_pointlist() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_bounds
+ H5S__point_bounds
PURPOSE
Gets the bounding box containing the selection.
USAGE
- herr_t H5S_point_bounds(space, start, end)
+ herr_t H5S__point_bounds(space, start, end)
H5S_t *space; IN: Dataspace pointer of selection to query
hsize_t *start; OUT: Starting coordinate of bounding box
hsize_t *end; OUT: Opposite coordinate of bounding box
@@ -1219,14 +1231,14 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
+H5S__point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
{
H5S_pnt_node_t *node; /* Point node */
unsigned rank; /* Dataspace rank */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(space);
@@ -1260,16 +1272,16 @@ H5S_point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_point_bounds() */
+} /* end H5S__point_bounds() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_offset
+ H5S__point_offset
PURPOSE
Gets the linear offset of the first element for the selection.
USAGE
- herr_t H5S_point_offset(space, offset)
+ herr_t H5S__point_offset(space, offset)
const H5S_t *space; IN: Dataspace pointer of selection to query
hsize_t *offset; OUT: Linear offset of first element in selection
RETURNS
@@ -1284,7 +1296,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_offset(const H5S_t *space, hsize_t *offset)
+H5S__point_offset(const H5S_t *space, hsize_t *offset)
{
const hsize_t *pnt; /* Pointer to a selected point's coordinates */
const hssize_t *sel_offset; /* Pointer to the selection's offset */
@@ -1293,7 +1305,7 @@ H5S_point_offset(const H5S_t *space, hsize_t *offset)
int i; /* index variable */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_STATIC
HDassert(space);
HDassert(offset);
@@ -1324,7 +1336,7 @@ H5S_point_offset(const H5S_t *space, hsize_t *offset)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_point_offset() */
+} /* end H5S__point_offset() */
/*--------------------------------------------------------------------------
@@ -1358,11 +1370,11 @@ H5S__point_unlim_dim(const H5S_t H5_ATTR_UNUSED *space)
/*--------------------------------------------------------------------------
NAME
- H5S_point_is_contiguous
+ H5S__point_is_contiguous
PURPOSE
Check if a point selection is contiguous within the dataspace extent.
USAGE
- htri_t H5S_point_is_contiguous(space)
+ htri_t H5S__point_is_contiguous(space)
H5S_t *space; IN: Dataspace pointer to check
RETURNS
TRUE/FALSE/FAIL
@@ -1378,31 +1390,31 @@ H5S__point_unlim_dim(const H5S_t H5_ATTR_UNUSED *space)
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S_point_is_contiguous(const H5S_t *space)
+H5S__point_is_contiguous(const H5S_t *space)
{
htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(space);
/* One point is definitely contiguous */
- if(space->select.num_elem==1)
- ret_value=TRUE;
- else /* More than one point might be contiguous, but it's complex to check and we don't need it right now */
- ret_value=FALSE;
+ if(space->select.num_elem == 1)
+ ret_value = TRUE;
+ else /* More than one point might be contiguous, but it's complex to check and we don't need it right now */
+ ret_value = FALSE;
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_point_is_contiguous() */
+} /* end H5S__point_is_contiguous() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_is_single
+ H5S__point_is_single
PURPOSE
Check if a point selection is single within the dataspace extent.
USAGE
- htri_t H5S_point_is_single(space)
+ htri_t H5S__point_is_single(space)
H5S_t *space; IN: Dataspace pointer to check
RETURNS
TRUE/FALSE/FAIL
@@ -1415,31 +1427,31 @@ H5S_point_is_contiguous(const H5S_t *space)
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S_point_is_single(const H5S_t *space)
+H5S__point_is_single(const H5S_t *space)
{
htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(space);
/* One point is definitely 'single' :-) */
- if(space->select.num_elem==1)
- ret_value=TRUE;
+ if(space->select.num_elem == 1)
+ ret_value = TRUE;
else
- ret_value=FALSE;
+ ret_value = FALSE;
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_point_is_single() */
+} /* end H5S__point_is_single() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_is_regular
+ H5S__point_is_regular
PURPOSE
Check if a point selection is "regular"
USAGE
- htri_t H5S_point_is_regular(space)
+ htri_t H5S__point_is_regular(space)
const H5S_t *space; IN: Dataspace pointer to check
RETURNS
TRUE/FALSE/FAIL
@@ -1455,28 +1467,28 @@ H5S_point_is_single(const H5S_t *space)
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S_point_is_regular(const H5S_t *space)
+H5S__point_is_regular(const H5S_t *space)
{
htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(space);
/* Only simple check for regular points for now... */
- if(space->select.num_elem==1)
- ret_value=TRUE;
+ if(space->select.num_elem == 1)
+ ret_value = TRUE;
else
- ret_value=FALSE;
+ ret_value = FALSE;
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_point_is_regular() */
+} /* end H5S__point_is_regular() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_adjust_u
+ H5S__point_adjust_u
PURPOSE
Adjust a "point" selection by subtracting an offset
USAGE
@@ -1493,12 +1505,12 @@ H5S_point_is_regular(const H5S_t *space)
REVISION LOG
--------------------------------------------------------------------------*/
static void
-H5S_point_adjust_u(H5S_t *space, const hsize_t *offset)
+H5S__point_adjust_u(H5S_t *space, const hsize_t *offset)
{
H5S_pnt_node_t *node; /* Point node */
unsigned rank; /* Dataspace rank */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(space);
HDassert(offset);
@@ -1523,29 +1535,29 @@ H5S_point_adjust_u(H5S_t *space, const hsize_t *offset)
} /* end while */
FUNC_LEAVE_NOAPI_VOID
-} /* H5S_point_adjust_u() */
+} /* end H5S__point_adjust_u() */
/*-------------------------------------------------------------------------
- * Function: H5S_point_project_scalar
+ * Function: H5S__point_project_scalar
*
- * Purpose: Projects a single element point selection into a scalar
+ * Purpose: Projects a single element point selection into a scalar
* dataspace
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Sunday, July 18, 2010
*
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_point_project_scalar(const H5S_t *space, hsize_t *offset)
+H5S__point_project_scalar(const H5S_t *space, hsize_t *offset)
{
const H5S_pnt_node_t *node; /* Point node */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(space && H5S_SEL_POINTS == H5S_GET_SELECT_TYPE(space));
@@ -1563,24 +1575,24 @@ H5S_point_project_scalar(const H5S_t *space, hsize_t *offset)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_point_project_scalar() */
+} /* end H5S__point_project_scalar() */
/*-------------------------------------------------------------------------
- * Function: H5S_point_project_simple
+ * Function: H5S_point_project_simple
*
- * Purpose: Projects a point selection onto/into a simple dataspace
+ * Purpose: Projects a point selection onto/into a simple dataspace
* of a different rank
*
- * Return: non-negative on success, negative on failure.
+ * Return: Non-negative on success, negative on failure.
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Sunday, July 18, 2010
*
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *offset)
+H5S__point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *offset)
{
const H5S_pnt_node_t *base_node; /* Point node in base space */
H5S_pnt_node_t *new_node; /* Point node in new space */
@@ -1588,7 +1600,7 @@ H5S_point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *off
unsigned rank_diff; /* Difference in ranks between spaces */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(base_space && H5S_SEL_POINTS == H5S_GET_SELECT_TYPE(base_space));
@@ -1690,7 +1702,7 @@ H5S_point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *off
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_point_project_simple() */
+} /* end H5S__point_project_simple() */
/*--------------------------------------------------------------------------
@@ -1751,16 +1763,16 @@ H5Sselect_elements(hid_t spaceid, H5S_seloper_t op, size_t num_elem,
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Sselect_elements() */
+} /* end H5Sselect_elements() */
/*--------------------------------------------------------------------------
NAME
- H5S_point_get_seq_list
+ H5S__point_get_seq_list
PURPOSE
Create a list of offsets & lengths for a selection
USAGE
- herr_t H5S_point_get_seq_list(space,flags,iter,maxseq,maxelem,nseq,nelem,off,len)
+ herr_t H5S__point_get_seq_list(space,flags,iter,maxseq,maxelem,nseq,nelem,off,len)
H5S_t *space; IN: Dataspace containing selection to use.
unsigned flags; IN: Flags for extra information about operation
H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
@@ -1786,7 +1798,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter,
+H5S__point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter,
size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem,
hsize_t *off, size_t *len)
{
@@ -1801,7 +1813,7 @@ H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter,
int i; /* Local index variable */
herr_t ret_value=SUCCEED; /* return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check args */
HDassert(space);
@@ -1833,21 +1845,21 @@ H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter,
} /* end for */
/* Check if this is a later point in the selection */
- if(curr_seq>0) {
+ if(curr_seq > 0) {
/* If a sorted sequence is requested, make certain we don't go backwards in the offset */
- if((flags&H5S_GET_SEQ_LIST_SORTED) && loc<off[curr_seq-1])
+ if((flags & H5S_GET_SEQ_LIST_SORTED) && loc < off[curr_seq-1])
break;
/* Check if this point extends the previous sequence */
/* (Unlikely, but possible) */
- if(loc==(off[curr_seq-1]+len[curr_seq-1])) {
+ if(loc == (off[curr_seq-1] + len[curr_seq-1])) {
/* Extend the previous sequence */
- len[curr_seq-1]+=iter->elmt_size;
+ len[curr_seq-1] += iter->elmt_size;
} /* end if */
else {
/* Add a new sequence */
- off[curr_seq]=loc;
- len[curr_seq]=iter->elmt_size;
+ off[curr_seq] = loc;
+ len[curr_seq] = iter->elmt_size;
/* Increment sequence count */
curr_seq++;
@@ -1855,8 +1867,8 @@ H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter,
} /* end if */
else {
/* Add a new sequence */
- off[curr_seq]=loc;
- len[curr_seq]=iter->elmt_size;
+ off[curr_seq] = loc;
+ len[curr_seq] = iter->elmt_size;
/* Increment sequence count */
curr_seq++;
@@ -1866,28 +1878,28 @@ H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter,
io_left--;
/* Move the iterator */
- iter->u.pnt.curr=node->next;
+ iter->u.pnt.curr = node->next;
iter->elmt_left--;
/* Check if we're finished with all sequences */
- if(curr_seq==maxseq)
+ if(curr_seq == maxseq)
break;
/* Check if we're finished with all the elements available */
- if(io_left==0)
+ if(io_left == 0)
break;
/* Advance to the next point */
- node=node->next;
+ node = node->next;
} /* end while */
/* Set the number of sequences generated */
- *nseq=curr_seq;
+ *nseq = curr_seq;
/* Set the number of elements used */
- *nelem=start_io_left-io_left;
+ *nelem = start_io_left-io_left;
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_point_get_seq_list() */
+} /* end H5S__point_get_seq_list() */
diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h
index 9ed52a9..588b395 100644
--- a/src/H5Sprivate.h
+++ b/src/H5Sprivate.h
@@ -30,7 +30,6 @@ typedef struct H5S_t H5S_t;
#include "H5private.h" /* Generic Functions */
#include "H5Fprivate.h" /* Files */
#include "H5Gprivate.h" /* Groups */
-#include "H5Oprivate.h" /* Object headers */
#include "H5Pprivate.h" /* Property lists */
#include "H5Tprivate.h" /* Datatypes */
@@ -62,20 +61,20 @@ typedef struct H5S_hyper_dim_t {
/* Point selection iteration container */
typedef struct {
- H5S_pnt_node_t *curr; /* Pointer to next node to output */
+ H5S_pnt_node_t *curr; /* Pointer to next node to output */
} H5S_point_iter_t;
/* Hyperslab selection iteration container */
typedef struct {
/* Common fields for all hyperslab selections */
- hsize_t off[H5S_MAX_RANK]; /* Offset in span node (used as position for regular hyperslabs) */
+ hsize_t off[H5S_MAX_RANK]; /* Offset in span node (used as position for regular hyperslabs) */
unsigned iter_rank; /* Rank of iterator information */
/* (This should always be the same as the dataspace
- * rank, except for regular hyperslab selections in
- * which there are contiguous regions in the lower
- * dimensions which have been "flattened" out
+ * rank, except for regular hyperslab selections in
+ * which there are contiguous regions in the lower
+ * dimensions that have been "flattened")
*/
- hbool_t diminfo_valid; /* Whether the dimension information is valid */
+ hbool_t diminfo_valid; /* Whether the dimension information is valid */
/* "Flattened" regular hyperslab selection fields */
H5S_hyper_dim_t diminfo[H5S_MAX_RANK]; /* "Flattened" regular selection information */
@@ -208,7 +207,7 @@ H5_DLL hbool_t H5S_has_extent(const H5S_t *ds);
H5_DLL int H5S_get_simple_extent_ndims(const H5S_t *ds);
H5_DLL int H5S_get_simple_extent_dims(const H5S_t *ds, hsize_t dims[]/*out*/,
hsize_t max_dims[]/*out*/);
-H5_DLL herr_t H5S_write(H5F_t *f, H5O_t *oh, unsigned update_flags, H5S_t *ds);
+H5_DLL herr_t H5S_write(H5F_t *f, struct H5O_t *oh, unsigned update_flags, H5S_t *ds);
H5_DLL herr_t H5S_append(H5F_t *f, struct H5O_t *oh, H5S_t *ds);
H5_DLL H5S_t *H5S_read(const struct H5O_loc_t *loc);
H5_DLL htri_t H5S_set_extent(H5S_t *space, const hsize_t *size);
@@ -303,14 +302,14 @@ H5_DLL hsize_t H5S_hyper_get_first_inc_block(const H5S_t *space,
hsize_t clip_size, hbool_t *partial);
/* Operations on selection iterators */
-H5_DLL herr_t H5S_select_iter_init(H5S_sel_iter_t *iter, const H5S_t *space, size_t elmt_size);
+H5_DLL herr_t H5S_select_iter_init(H5S_sel_iter_t *iter, const H5S_t *space,
+ size_t elmt_size);
H5_DLL herr_t H5S_select_iter_coords(const H5S_sel_iter_t *sel_iter, hsize_t *coords);
H5_DLL hsize_t H5S_select_iter_nelmts(const H5S_sel_iter_t *sel_iter);
H5_DLL herr_t H5S_select_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem);
H5_DLL herr_t H5S_select_iter_release(H5S_sel_iter_t *sel_iter);
#ifdef H5_HAVE_PARALLEL
-H5_DLL hsize_t H5S_mpio_set_bigio_count(hsize_t new_count);
H5_DLL herr_t H5S_mpio_space_type(const H5S_t *space, size_t elmt_size,
/* out: */ MPI_Datatype *new_type,
int *count,
diff --git a/src/H5Spublic.h b/src/H5Spublic.h
index 09b474a..e54fc39 100644
--- a/src/H5Spublic.h
+++ b/src/H5Spublic.h
@@ -79,23 +79,22 @@ typedef enum H5S_seloper_t {
typedef enum {
H5S_SEL_ERROR = -1, /* Error */
H5S_SEL_NONE = 0, /* Nothing selected */
- H5S_SEL_POINTS = 1, /* Sequence of points selected */
- H5S_SEL_HYPERSLABS = 2, /* "New-style" hyperslab selection defined */
+ H5S_SEL_POINTS = 1, /* Points / elements selected */
+ H5S_SEL_HYPERSLABS = 2, /* Hyperslab selected */
H5S_SEL_ALL = 3, /* Entire extent selected */
H5S_SEL_N /*THIS MUST BE LAST */
-}H5S_sel_type;
+} H5S_sel_type;
#ifdef __cplusplus
extern "C" {
#endif
-/* Functions in H5S.c */
+/* Operations on dataspaces */
H5_DLL hid_t H5Screate(H5S_class_t type);
H5_DLL hid_t H5Screate_simple(int rank, const hsize_t dims[],
- const hsize_t maxdims[]);
+ const hsize_t maxdims[]);
H5_DLL herr_t H5Sset_extent_simple(hid_t space_id, int rank,
- const hsize_t dims[],
- const hsize_t max[]);
+ const hsize_t dims[], const hsize_t max[]);
H5_DLL hid_t H5Scopy(hid_t space_id);
H5_DLL herr_t H5Sclose(hid_t space_id);
H5_DLL herr_t H5Sencode(hid_t obj_id, void *buf, size_t *nalloc);
@@ -103,50 +102,46 @@ H5_DLL hid_t H5Sdecode(const void *buf);
H5_DLL hssize_t H5Sget_simple_extent_npoints(hid_t space_id);
H5_DLL int H5Sget_simple_extent_ndims(hid_t space_id);
H5_DLL int H5Sget_simple_extent_dims(hid_t space_id, hsize_t dims[],
- hsize_t maxdims[]);
+ hsize_t maxdims[]);
H5_DLL htri_t H5Sis_simple(hid_t space_id);
+H5_DLL H5S_class_t H5Sget_simple_extent_type(hid_t space_id);
+H5_DLL herr_t H5Sset_extent_none(hid_t space_id);
+H5_DLL herr_t H5Sextent_copy(hid_t dst_id,hid_t src_id);
+H5_DLL htri_t H5Sextent_equal(hid_t sid1, hid_t sid2);
+
+/* Operations on dataspace selections */
+H5_DLL H5S_sel_type H5Sget_select_type(hid_t spaceid);
H5_DLL hssize_t H5Sget_select_npoints(hid_t spaceid);
+H5_DLL htri_t H5Sselect_valid(hid_t spaceid);
+H5_DLL herr_t H5Sget_select_bounds(hid_t spaceid, hsize_t start[],
+ hsize_t end[]);
+H5_DLL herr_t H5Soffset_simple(hid_t space_id, const hssize_t *offset);
+H5_DLL herr_t H5Sselect_all(hid_t spaceid);
+H5_DLL herr_t H5Sselect_none(hid_t spaceid);
+H5_DLL herr_t H5Sselect_elements(hid_t space_id, H5S_seloper_t op,
+ size_t num_elem, const hsize_t *coord);
+H5_DLL hssize_t H5Sget_select_elem_npoints(hid_t spaceid);
+H5_DLL herr_t H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t startpoint,
+ hsize_t numpoints, hsize_t buf[/*numpoints*/]);
H5_DLL 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 start[], 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 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);
+ const hsize_t start[], const hsize_t _stride[], const hsize_t count[],
+ const hsize_t _block[]);
+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);
-H5_DLL herr_t H5Sset_extent_none(hid_t space_id);
-H5_DLL herr_t H5Sextent_copy(hid_t dst_id,hid_t src_id);
-H5_DLL htri_t H5Sextent_equal(hid_t sid1, hid_t sid2);
-H5_DLL herr_t H5Sselect_all(hid_t spaceid);
-H5_DLL herr_t H5Sselect_none(hid_t spaceid);
-H5_DLL herr_t H5Soffset_simple(hid_t space_id, const hssize_t *offset);
-H5_DLL htri_t H5Sselect_valid(hid_t spaceid);
H5_DLL htri_t H5Sis_regular_hyperslab(hid_t spaceid);
H5_DLL htri_t H5Sget_regular_hyperslab(hid_t spaceid, hsize_t start[],
hsize_t stride[], hsize_t count[], hsize_t block[]);
H5_DLL hssize_t H5Sget_select_hyper_nblocks(hid_t spaceid);
-H5_DLL hssize_t H5Sget_select_elem_npoints(hid_t spaceid);
H5_DLL herr_t H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t startblock,
hsize_t numblocks, hsize_t buf[/*numblocks*/]);
-H5_DLL herr_t H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t startpoint,
- hsize_t numpoints, hsize_t buf[/*numpoints*/]);
-H5_DLL herr_t H5Sget_select_bounds(hid_t spaceid, hsize_t start[],
- hsize_t end[]);
-H5_DLL H5S_sel_type H5Sget_select_type(hid_t spaceid);
#ifdef __cplusplus
}
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index 1e692db..8657008 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -17,9 +17,16 @@
* Purpose: Dataspace selection functions.
*/
+/****************/
+/* Module Setup */
+/****************/
+
#include "H5Smodule.h" /* This source code file is part of the H5S module */
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
@@ -27,16 +34,39 @@
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
#include "H5Spkg.h" /* Dataspaces */
-#include "H5VMprivate.h" /* Vector and array functions */
-#include "H5WBprivate.h" /* Wrapped Buffers */
+#include "H5VMprivate.h" /* Vector and array functions */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
-/* Local functions */
#ifdef LATER
static herr_t H5S_select_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end);
static htri_t H5S_select_iter_has_next_block(const H5S_sel_iter_t *iter);
static herr_t H5S_select_iter_next_block(H5S_sel_iter_t *iter);
#endif /* LATER */
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
/* Declare a free list to manage the H5S_sel_iter_t struct */
H5FL_DEFINE(H5S_sel_iter_t);
@@ -47,6 +77,11 @@ H5FL_SEQ_EXTERN(size_t);
H5FL_SEQ_EXTERN(hsize_t);
+/*******************/
+/* Local Variables */
+/*******************/
+
+
/*--------------------------------------------------------------------------
NAME
@@ -78,13 +113,13 @@ H5S_select_offset(H5S_t *space, const hssize_t *offset)
HDassert(offset);
/* Copy the offset over */
- H5MM_memcpy(space->select.offset, offset, sizeof(hssize_t)*space->extent.rank);
+ H5MM_memcpy(space->select.offset, offset, sizeof(hssize_t) * space->extent.rank);
/* Indicate that the offset was changed */
space->select.offset_changed = TRUE;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5S_select_offset() */
+} /* end H5S_select_offset() */
/*--------------------------------------------------------------------------
@@ -93,9 +128,10 @@ H5S_select_offset(H5S_t *space, const hssize_t *offset)
PURPOSE
Copy a selection from one dataspace to another
USAGE
- herr_t H5S_select_copy(dst, src)
+ herr_t H5S_select_copy(dst, src, share_selection)
H5S_t *dst; OUT: Pointer to the destination dataspace
H5S_t *src; IN: Pointer to the source dataspace
+ hbool_t; IN: Whether to share the selection between the dataspaces
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
@@ -126,12 +162,12 @@ H5S_select_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection)
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:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_copy() */
+} /* end H5S_select_copy() */
/*-------------------------------------------------------------------------
@@ -165,7 +201,7 @@ H5S_select_release(H5S_t *ds)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_select_release() */
+} /* end H5S_select_release() */
/*-------------------------------------------------------------------------
@@ -232,10 +268,10 @@ H5S_select_serial_size(const H5S_t *space)
HDassert(space);
/* Call the selection type's serial_size function */
- ret_value=(*space->select.type->serial_size)(space);
+ ret_value = (*space->select.type->serial_size)(space);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_select_serial_size() */
+} /* end H5S_select_serial_size() */
/*--------------------------------------------------------------------------
@@ -265,7 +301,7 @@ H5S_select_serial_size(const H5S_t *space)
herr_t
H5S_select_serialize(const H5S_t *space, uint8_t **p)
{
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -273,10 +309,10 @@ H5S_select_serialize(const H5S_t *space, uint8_t **p)
HDassert(p);
/* Call the selection type's serialize function */
- ret_value=(*space->select.type->serialize)(space,p);
+ ret_value = (*space->select.type->serialize)(space, p);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_select_serialize() */
+} /* end H5S_select_serialize() */
/*--------------------------------------------------------------------------
@@ -313,7 +349,7 @@ H5Sget_select_npoints(hid_t spaceid)
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Sget_select_npoints() */
+} /* H5Sget_select_npoints() */
/*--------------------------------------------------------------------------
@@ -336,7 +372,7 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-hsize_t
+H5_ATTR_PURE hsize_t
H5S_get_select_npoints(const H5S_t *space)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -345,7 +381,7 @@ H5S_get_select_npoints(const H5S_t *space)
HDassert(space);
FUNC_LEAVE_NOAPI(space->select.num_elem)
-} /* H5S_get_select_npoints() */
+} /* end H5S_get_select_npoints() */
/*--------------------------------------------------------------------------
@@ -367,8 +403,6 @@ H5S_get_select_npoints(const H5S_t *space)
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
- Christian Chilan 01/17/2007
- Changed the error return value from 0 to FAIL.
--------------------------------------------------------------------------*/
htri_t
H5Sselect_valid(hid_t spaceid)
@@ -387,7 +421,7 @@ H5Sselect_valid(hid_t spaceid)
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Sselect_valid() */
+} /* end H5Sselect_valid() */
/*--------------------------------------------------------------------------
@@ -425,7 +459,7 @@ H5S_select_valid(const H5S_t *space)
ret_value = (*space->select.type->is_valid)(space);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_valid() */
+} /* end H5S_select_valid() */
/*--------------------------------------------------------------------------
@@ -496,7 +530,7 @@ H5S_select_deserialize(H5S_t **space, const uint8_t **p)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_deserialize() */
+} /* end H5S_select_deserialize() */
/*--------------------------------------------------------------------------
@@ -548,7 +582,7 @@ H5Sget_select_bounds(hid_t spaceid, hsize_t start[], hsize_t end[])
done:
FUNC_LEAVE_API(ret_value)
-} /* H5Sget_select_bounds() */
+} /* end H5Sget_select_bounds() */
/*--------------------------------------------------------------------------
@@ -590,10 +624,10 @@ H5S_get_select_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
HDassert(start);
HDassert(end);
- ret_value = (*space->select.type->bounds)(space,start,end);
+ ret_value = (*space->select.type->bounds)(space, start, end);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_get_select_bounds() */
+} /* end H5S_get_select_bounds() */
/*--------------------------------------------------------------------------
@@ -633,7 +667,7 @@ H5S_get_select_offset(const H5S_t *space, hsize_t *offset)
ret_value = (*space->select.type->offset)(space, offset);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_get_select_offset() */
+} /* end H5S_get_select_offset() */
/*--------------------------------------------------------------------------
@@ -671,7 +705,7 @@ H5S_get_select_unlim_dim(const H5S_t *space)
ret_value = (*space->select.type->unlim_dim)(space);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_get_select_unlim_dim() */
+} /* end H5S_get_select_unlim_dim() */
/*--------------------------------------------------------------------------
@@ -716,7 +750,7 @@ H5S_get_select_num_elem_non_unlim(const H5S_t *space,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_get_select_unlim_dim() */
+} /* end H5S_get_select_unlim_dim() */
/*--------------------------------------------------------------------------
@@ -753,7 +787,7 @@ H5S_select_is_contiguous(const H5S_t *space)
ret_value = (*space->select.type->is_contiguous)(space);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_is_contiguous() */
+} /* end H5S_select_is_contiguous() */
/*--------------------------------------------------------------------------
@@ -790,7 +824,7 @@ H5S_select_is_single(const H5S_t *space)
ret_value = (*space->select.type->is_single)(space);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_is_single() */
+} /* end H5S_select_is_single() */
/*--------------------------------------------------------------------------
@@ -827,7 +861,7 @@ H5S_select_is_regular(const H5S_t *space)
ret_value = (*space->select.type->is_regular)(space);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_is_regular() */
+} /* end H5S_select_is_regular() */
/*--------------------------------------------------------------------------
@@ -863,7 +897,7 @@ H5S_select_adjust_u(H5S_t *space, const hsize_t *offset)
(*space->select.type->adjust_u)(space, offset);
FUNC_LEAVE_NOAPI_VOID
-} /* H5S_select_adjust_u() */
+} /* end H5S_select_adjust_u() */
/*--------------------------------------------------------------------------
@@ -902,7 +936,7 @@ H5S_select_project_scalar(const H5S_t *space, hsize_t *offset)
ret_value = (*space->select.type->project_scalar)(space, offset);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_project_scalar() */
+} /* end H5S_select_project_scalar() */
/*--------------------------------------------------------------------------
@@ -943,7 +977,7 @@ H5S_select_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset)
ret_value = (*space->select.type->project_simple)(space, new_space, offset);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_project_simple() */
+} /* end H5S_select_project_simple() */
/*--------------------------------------------------------------------------
@@ -964,7 +998,8 @@ H5S_select_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset)
in the dataspace's selection.
--------------------------------------------------------------------------*/
herr_t
-H5S_select_iter_init(H5S_sel_iter_t *sel_iter, const H5S_t *space, size_t elmt_size)
+H5S_select_iter_init(H5S_sel_iter_t *sel_iter, const H5S_t *space,
+ size_t elmt_size)
{
herr_t ret_value = FAIL; /* Return value */
@@ -993,7 +1028,7 @@ H5S_select_iter_init(H5S_sel_iter_t *sel_iter, const H5S_t *space, size_t elmt_s
HDassert(sel_iter->type);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_iter_init() */
+} /* end H5S_select_iter_init() */
/*--------------------------------------------------------------------------
@@ -1030,10 +1065,10 @@ H5S_select_iter_coords(const H5S_sel_iter_t *sel_iter, hsize_t *coords)
HDassert(coords);
/* Call iter_coords routine for selection type */
- ret_value = (*sel_iter->type->iter_coords)(sel_iter,coords);
+ ret_value = (*sel_iter->type->iter_coords)(sel_iter, coords);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_iter_coords() */
+} /* end H5S_select_iter_coords() */
#ifdef LATER
@@ -1065,7 +1100,7 @@ H5S_select_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
{
herr_t ret_value; /* return value */
- FUNC_ENTER_NOAPI_NOINIT_NOINIT_NOERR
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
HDassert(iter);
@@ -1073,10 +1108,10 @@ H5S_select_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
HDassert(end);
/* Call iter_block routine for selection type */
- ret_value = (*iter->type->iter_block)(iter,start,end);
+ ret_value = (*iter->type->iter_block)(iter, start, end);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_iter_block() */
+} /* end H5S_select_iter_block() */
#endif /* LATER */
@@ -1114,7 +1149,7 @@ H5S_select_iter_nelmts(const H5S_sel_iter_t *sel_iter)
ret_value = (*sel_iter->type->iter_nelmts)(sel_iter);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_iter_nelmts() */
+} /* end H5S_select_iter_nelmts() */
#ifdef LATER
@@ -1144,7 +1179,7 @@ H5S_select_iter_has_next_block(const H5S_sel_iter_t *iter)
{
herr_t ret_value; /* return value */
- FUNC_ENTER_NOAPI_NOINIT_NOINIT_NOERR
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
HDassert(iter);
@@ -1153,7 +1188,7 @@ H5S_select_iter_has_next_block(const H5S_sel_iter_t *iter)
ret_value = (*iter->type->iter_has_next_block)(iter);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_iter_has_next_block() */
+} /* end H5S_select_iter_has_next_block() */
#endif /* LATER */
@@ -1165,7 +1200,7 @@ H5S_select_iter_has_next_block(const H5S_sel_iter_t *iter)
USAGE
herr_t H5S_select_iter_next(iter, nelem)
H5S_sel_iter_t *iter; IN/OUT: Selection iterator to change
- size_t nelem; IN: Number of elements to advance by
+ size_t nelem; IN: Number of elements to advance by
RETURNS
Non-negative on success, negative on failure.
DESCRIPTION
@@ -1191,13 +1226,13 @@ H5S_select_iter_next(H5S_sel_iter_t *iter, size_t nelem)
HDassert(nelem>0);
/* Call iter_next routine for selection type */
- ret_value = (*iter->type->iter_next)(iter,nelem);
+ ret_value = (*iter->type->iter_next)(iter, nelem);
/* Decrement the number of elements left in selection */
iter->elmt_left-=nelem;
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_iter_next() */
+} /* end H5S_select_iter_next() */
#ifdef LATER
@@ -1238,7 +1273,7 @@ H5S_select_iter_next_block(H5S_sel_iter_t *iter)
ret_value = (*iter->type->iter_next_block)(iter);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_iter_next_block() */
+} /* end H5S_select_iter_next_block() */
#endif /* LATER */
@@ -1248,7 +1283,7 @@ H5S_select_iter_next_block(H5S_sel_iter_t *iter)
PURPOSE
Release a selection iterator's resources.
USAGE
- hssize_t H5S_select_iter_release(sel_iter)
+ herr_t H5S_select_iter_release(sel_iter)
H5S_sel_iter_t *sel_iter; IN: Selection iterator to query
RETURNS
The number of elements in selection on success, 0 on failure
@@ -1276,7 +1311,7 @@ H5S_select_iter_release(H5S_sel_iter_t *sel_iter)
ret_value = (*sel_iter->type->iter_release)(sel_iter);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_iter_release() */
+} /* end H5S_select_iter_release() */
/*--------------------------------------------------------------------------
@@ -1410,10 +1445,12 @@ H5S_select_iterate(void *buf, const H5T_t *type, const H5S_t *space,
/* Make the application callback */
user_ret = (op->u.app_op.op)(loc, op->u.app_op.type_id, ndims, coords, op_data);
break;
+
case H5S_SEL_ITER_OP_LIB:
/* Call the library's callback */
user_ret = (op->u.lib_op)(loc, type, ndims, coords, op_data);
break;
+
default:
HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unsupported op type")
} /* end switch */
@@ -1447,7 +1484,7 @@ done:
iter = H5FL_FREE(H5S_sel_iter_t, iter);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_select_iterate() */
+} /* end H5S_select_iterate() */
/*--------------------------------------------------------------------------
@@ -1483,7 +1520,7 @@ H5Sget_select_type(hid_t space_id)
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Sget_select_type() */
+} /* end H5Sget_select_type() */
/*--------------------------------------------------------------------------
@@ -1505,7 +1542,7 @@ done:
pattern, don't call it directly, use the appropriate macro
defined in H5Sprivate.h.
--------------------------------------------------------------------------*/
-H5S_sel_type
+H5_ATTR_PURE H5S_sel_type
H5S_get_select_type(const H5S_t *space)
{
H5S_sel_type ret_value = H5S_SEL_ERROR; /* Return value */
@@ -1516,10 +1553,10 @@ H5S_get_select_type(const H5S_t *space)
HDassert(space);
/* Set return value */
- ret_value=H5S_GET_SELECT_TYPE(space);
+ ret_value = H5S_GET_SELECT_TYPE(space);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5S_get_select_type() */
+} /* end H5S_get_select_type() */
/*--------------------------------------------------------------------------
@@ -1536,6 +1573,7 @@ H5S_get_select_type(const H5S_t *space)
DESCRIPTION
Checks to see if the current selection in the dataspaces are the same
dimensionality and shape.
+
This is primarily used for reading the entire selection in one swoop.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
@@ -1572,7 +1610,7 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
unsigned space_a_rank; /* Number of dimensions of dataspace A */
unsigned space_b_rank; /* Number of dimensions of dataspace B */
- /* need to be able to handle spaces of different rank:
+ /* Need to be able to handle spaces of different rank:
*
* To simplify logic, let space_a point to the element of the set
* {space1, space2} with the largest rank or space1 if the ranks
@@ -1585,7 +1623,7 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
* space_b_rank be the rank of space_b,
* delta_rank = space_a_rank - space_b_rank.
*
- * Set all this up below.
+ * Set all this up here.
*/
if(space1->extent.rank >= space2->extent.rank) {
space_a = space1;
@@ -1748,7 +1786,7 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
space_b_dim--;
} /* end while */
- /* similarly, if the block size in any dimension that appears only
+ /* Similarly, if the block size in any dimension that appears only
* in space_a is not equal to 1, get out.
*/
while(space_a_dim >= 0) {
@@ -1766,11 +1804,10 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
} /* end if */
/* Check over the blocks for each selection */
else {
- /* for dimensions that space_a and space_b have in common: */
+ /* For dimensions that space_a and space_b have in common: */
while(space_b_dim >= 0) {
/* Check if the blocks are in the same relative location */
- if((start_a[space_a_dim] - off_a[space_a_dim]) !=
- (start_b[space_b_dim] - off_b[space_b_dim]))
+ if((start_a[space_a_dim] - off_a[space_a_dim]) != (start_b[space_b_dim] - off_b[space_b_dim]))
HGOTO_DONE(FALSE)
/* If the block sizes from each selection doesn't match, get out */
@@ -1827,7 +1864,7 @@ done:
iter_b = H5FL_FREE(H5S_sel_iter_t, iter_b);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_shape_same() */
+} /* end H5S_select_shape_same() */
/*--------------------------------------------------------------------------
@@ -2095,7 +2132,7 @@ done:
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_construct_projection() */
+} /* end H5S_select_construct_projection() */
/*--------------------------------------------------------------------------
@@ -2126,7 +2163,7 @@ herr_t
H5S_select_fill(const void *fill, size_t fill_size, const H5S_t *space, void *_buf)
{
H5S_sel_iter_t *iter = NULL; /* Selection iteration info */
- hbool_t iter_init = 0; /* Selection iteration info has been initialized */
+ hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */
hsize_t *off = NULL; /* Array to store sequence offsets */
size_t *len = NULL; /* Array to store sequence lengths */
hssize_t nelmts; /* Number of elements in selection */
@@ -2148,7 +2185,7 @@ H5S_select_fill(const void *fill, size_t fill_size, const H5S_t *space, void *_b
/* Initialize iterator */
if(H5S_select_iter_init(iter, space, fill_size) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
- iter_init = 1; /* Selection iteration info has been initialized */
+ iter_init = TRUE; /* Selection iteration info has been initialized */
/* Get the number of elements in selection */
if((nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS(space)) < 0)
@@ -2203,7 +2240,7 @@ done:
iter = H5FL_FREE(H5S_sel_iter_t, iter);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_fill() */
+} /* end H5S_select_fill() */
/*--------------------------------------------------------------------------
@@ -2254,7 +2291,7 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
/* Create new space, using dst extent. Start with "all" selection. */
if(NULL == (new_space = H5S_create(H5S_SIMPLE)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create output dataspace")
- if(H5S_extent_copy_real(&new_space->extent, &dst_space->extent, TRUE) < 0)
+ if(H5S__extent_copy_real(&new_space->extent, &dst_space->extent, TRUE) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy destination space extent")
/* If the intersecting space is "all", the intersection must be equal to the
@@ -2296,7 +2333,7 @@ done:
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_project_intersection() */
+} /* end H5S_select_project_intersection() */
/*--------------------------------------------------------------------------
@@ -2386,5 +2423,5 @@ H5S_select_subtract(H5S_t *space, H5S_t *subtract_space)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_subtract() */
+} /* end H5S_select_subtract() */
diff --git a/src/H5Stest.c b/src/H5Stest.c
index a7bee2b..60c5679 100644
--- a/src/H5Stest.c
+++ b/src/H5Stest.c
@@ -17,30 +17,65 @@
* Purpose: Dataspace selection testing functions.
*/
+/****************/
+/* Module Setup */
+/****************/
+
#include "H5Smodule.h" /* This source code file is part of the H5S module */
#define H5S_TESTING /*suppress warning about H5S testing funcs*/
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Iprivate.h" /* IDs */
#include "H5Spkg.h" /* Dataspaces */
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+
/*--------------------------------------------------------------------------
NAME
- H5S_select_shape_same_test
+ H5S__get_rebuild_status_test
PURPOSE
- Determine if two dataspace selections are the same shape
+ Determine the status of hyperslab rebuild
USAGE
- htri_t H5S_select_shape_same_test(sid1, sid2)
- hid_t sid1; IN: 1st dataspace to compare
- hid_t sid2; IN: 2nd dataspace to compare
+ 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
- Checks to see if the current selection in the dataspaces are the same
- dimensionality and shape.
+ Query the status of rebuilding the hyperslab
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING
@@ -48,41 +83,38 @@
REVISION LOG
--------------------------------------------------------------------------*/
htri_t
-H5S_select_shape_same_test(hid_t sid1, hid_t sid2)
+H5S__get_rebuild_status_test(hid_t space_id)
{
- H5S_t *space1; /* Pointer to 1st dataspace */
- H5S_t *space2; /* Pointer to 2nd dataspace */
- htri_t ret_value = FAIL; /* Return value */
+ H5S_t *space; /* Pointer to 1st dataspace */
+ htri_t ret_value = FAIL; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- /* Get dataspace structures */
- if(NULL == (space1 = (H5S_t *)H5I_object_verify(sid1, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
- if(NULL == (space2 = (H5S_t *)H5I_object_verify(sid2, H5I_DATASPACE)))
+ /* 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")
- /* Check if the dataspace selections are the same shape */
- if((ret_value = H5S_select_shape_same(space1, space2)) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "unable to compare dataspace selections")
+ ret_value = (htri_t)space->select.sel_info.hslab->diminfo_valid;
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_select_shape_same_test() */
+} /* H5S__get_rebuild_status_test() */
/*--------------------------------------------------------------------------
NAME
- H5S_get_rebuild_status_test
+ H5S_select_shape_same_test
PURPOSE
- Determine the status of hyperslab rebuild
+ Determine if two dataspace selections are the same shape
USAGE
- htri_t H5S_inquiry_rebuild_status(hid_t space_id)
- hid_t space_id; IN: dataspace id
+ htri_t H5S_select_shape_same_test(sid1, sid2)
+ hid_t sid1; IN: 1st dataspace to compare
+ hid_t sid2; IN: 2nd dataspace to compare
RETURNS
Non-negative TRUE/FALSE on success, negative on failure
DESCRIPTION
- Query the status of rebuilding the hyperslab
+ Checks to see if the current selection in the dataspaces are the same
+ dimensionality and shape.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING
@@ -90,20 +122,25 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
htri_t
-H5S_get_rebuild_status_test(hid_t space_id)
+H5S_select_shape_same_test(hid_t sid1, hid_t sid2)
{
- H5S_t *space; /* Pointer to 1st dataspace */
- htri_t ret_value = FAIL; /* Return value */
+ H5S_t *space1; /* Pointer to 1st dataspace */
+ H5S_t *space2; /* Pointer to 2nd dataspace */
+ htri_t ret_value = FAIL; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- /* Get dataspace structures */
- if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ /* Get dataspace structures */
+ if(NULL == (space1 = (H5S_t *)H5I_object_verify(sid1, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ if(NULL == (space2 = (H5S_t *)H5I_object_verify(sid2, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
- ret_value = (htri_t)space->select.sel_info.hslab->diminfo_valid;
+ /* Check if the dataspace selections are the same shape */
+ if((ret_value = H5S_select_shape_same(space1, space2)) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "unable to compare dataspace selections")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5S_get_rebuild_status_test() */
+} /* H5S_select_shape_same_test() */
diff --git a/src/H5mpi.c b/src/H5mpi.c
new file mode 100644
index 0000000..9c72fb0
--- /dev/null
+++ b/src/H5mpi.c
@@ -0,0 +1,563 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Purpose: Common MPI routines
+ *
+ */
+
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5MMprivate.h" /* Memory Management */
+
+
+#ifdef H5_HAVE_PARALLEL
+
+/****************/
+/* Local Macros */
+/****************/
+#define TWO_GIG_LIMIT (1 << 31)
+#ifndef H5_MAX_MPI_COUNT
+#define H5_MAX_MPI_COUNT (1 << 30)
+#endif
+
+/*******************/
+/* Local Variables */
+/*******************/
+static hsize_t bigio_count = H5_MAX_MPI_COUNT;
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5_mpi_set_bigio_count
+ *
+ * Purpose: Allow us to programatically change the switch point
+ * when we utilize derived datatypes. This is of
+ * particular interest for allowing nightly testing
+ *
+ * Return: The current/previous value of bigio_count.
+ *
+ * Programmer: Richard Warren, March 10, 2017
+ *
+ *-------------------------------------------------------------------------
+ */
+hsize_t
+H5_mpi_set_bigio_count(hsize_t new_count)
+{
+ hsize_t orig_count = bigio_count;
+
+ if((new_count > 0) && (new_count < (hsize_t)TWO_GIG_LIMIT)) {
+ bigio_count = new_count;
+ }
+ return orig_count;
+} /* end H5_mpi_set_bigio_count() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5_mpi_get_bigio_count
+ *
+ * Purpose: Allow other HDF5 library functions to access
+ * the current value for bigio_count.
+ *
+ * Return: The current/previous value of bigio_count.
+ *
+ * Programmer: Richard Warren, October 7, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+hsize_t
+H5_mpi_get_bigio_count(void)
+{
+ return bigio_count;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5_mpi_comm_dup
+ *
+ * Purpose: Duplicate an MPI communicator.
+ *
+ * Does not duplicate MPI_COMM_NULL. Instead, comm_new will
+ * be set to MPI_COMM_NULL directly.
+ *
+ * The new communicator is returned via the comm_new pointer.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5_mpi_comm_dup(MPI_Comm comm, MPI_Comm *comm_new)
+{
+ herr_t ret_value = SUCCEED;
+ MPI_Comm comm_dup = MPI_COMM_NULL;
+ int mpi_code;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check arguments */
+ if (!comm_new)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "comm_new cannot be NULL")
+
+ /* Handle MPI_COMM_NULL separately */
+ if (MPI_COMM_NULL == comm) {
+ /* Don't duplicate MPI_COMM_NULL since that's an error in MPI */
+ comm_dup = MPI_COMM_NULL;
+ }
+ else {
+
+ /* Duplicate the MPI communicator */
+ if (MPI_SUCCESS != (mpi_code = MPI_Comm_dup(comm, &comm_dup)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Comm_dup failed", mpi_code)
+
+ /* Set MPI_ERRORS_RETURN on comm_dup so that MPI failures are not fatal,
+ * and return codes can be checked and handled.
+ */
+ if (MPI_SUCCESS != (mpi_code = MPI_Comm_set_errhandler(comm_dup, MPI_ERRORS_RETURN)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Errhandler_set failed", mpi_code)
+
+ }
+
+ /* Copy the new communicator to the return argument */
+ *comm_new = comm_dup;
+
+done:
+ if (FAIL == ret_value) {
+ /* need to free anything created here */
+ if (MPI_COMM_NULL != comm_dup)
+ MPI_Comm_free(&comm_dup);
+ }
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5_mpi_comm_dup() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5_mpi_info_dup
+ *
+ * Purpose: Duplicate an MPI info.
+ *
+ * If the info object is MPI_INFO_NULL, no duplicate
+ * is made but the same value assigned to the new info object
+ * handle.
+ *
+ * The new info is returned via the info_new pointer.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5_mpi_info_dup(MPI_Info info, MPI_Info *info_new)
+{
+ herr_t ret_value = SUCCEED;
+ MPI_Info info_dup = MPI_INFO_NULL;
+ int mpi_code;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check arguments */
+ if (!info_new)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "info_new cannot be NULL")
+
+ /* Duplicate the MPI info */
+ if (info == MPI_INFO_NULL) {
+ /* Don't duplicate MPI_INFO_NULL. Just copy it. */
+ info_dup = MPI_INFO_NULL;
+ }
+ else {
+ /* Duplicate the info */
+ if (MPI_SUCCESS != (mpi_code = MPI_Info_dup(info, &info_dup)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Info_dup failed", mpi_code)
+ }
+
+ /* Copy the new info to the return argument */
+ *info_new = info_dup;
+
+done:
+ if (FAIL == ret_value) {
+ /* need to free anything created here */
+ if (MPI_INFO_NULL != info_dup)
+ MPI_Info_free(&info_dup);
+ }
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5_mpi_info_dup() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5_mpi_comm_free
+ *
+ * Purpose: Free an MPI communicator.
+ *
+ * If comm is MPI_COMM_NULL this call does nothing.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5_mpi_comm_free(MPI_Comm *comm)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check arguments */
+ if (!comm)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "comm pointer cannot be NULL")
+
+ /* Free the communicator */
+ if (MPI_COMM_NULL != *comm)
+ MPI_Comm_free(comm);
+
+ *comm = MPI_COMM_NULL;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* End H5_mpi_comm_free() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5_mpi_info_free
+ *
+ * Purpose: Free the MPI info.
+ *
+ * If info is MPI_INFO_NULL this call does nothing.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5_mpi_info_free(MPI_Info *info)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check arguments */
+ if (!info)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "info pointer cannot be NULL")
+
+ /* Free the info */
+ if (MPI_INFO_NULL != *info)
+ MPI_Info_free(info);
+
+ *info = MPI_INFO_NULL;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* End H5_mpi_info_free() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5_mpi_comm_cmp
+ *
+ * Purpose: Compares two MPI communicators.
+ *
+ * Note that passing MPI_COMM_NULL to this function will not
+ * throw errors, unlike MPI_Comm_compare().
+ *
+ * We consider MPI communicators to be the "same" when the
+ * groups are identical. We don't care about the context
+ * since that will always be different as we call MPI_Comm_dup
+ * when we store the communicator in the fapl.
+ *
+ * The out parameter is a value like strcmp. The value is
+ * undefined when the return value is FAIL.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5_mpi_comm_cmp(MPI_Comm comm1, MPI_Comm comm2, int *result)
+{
+ int mpi_code;
+ int mpi_result = MPI_IDENT;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check arguments */
+ if (!result)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "result cannot be NULL")
+
+ /* Set out parameter to something reasonable in case something goes wrong */
+ *result = 0;
+
+ /* Can't pass MPI_COMM_NULL to MPI_Comm_compare() so we have to handle
+ * it in special cases.
+ *
+ * MPI_Comm can either be an integer type or a pointer. We cast them
+ * to intptr_t so we can compare them with < and > when needed.
+ */
+ if (MPI_COMM_NULL == comm1 && MPI_COMM_NULL == comm2) {
+ /* Special case of both communicators being MPI_COMM_NULL */
+ *result = 0;
+ }
+ else if (MPI_COMM_NULL == comm1 || MPI_COMM_NULL == comm2) {
+
+ /* Special case of one communicator being MPI_COMM_NULL */
+ *result = (intptr_t)comm1 < (intptr_t)comm2 ? -1 : 1;
+ }
+ else {
+
+ /* Normal communicator compare */
+
+ /* Compare the MPI communicators */
+ if (MPI_SUCCESS != (mpi_code = MPI_Comm_compare(comm1, comm2, &mpi_result)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Comm_compare failed", mpi_code)
+
+ /* Set the result */
+ if (MPI_IDENT == mpi_result || MPI_CONGRUENT == mpi_result)
+ *result = 0;
+ else
+ *result = (intptr_t)comm1 < (intptr_t)comm2 ? -1 : 1;
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5_mpi_comm_cmp() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5_mpi_info_cmp
+ *
+ * Purpose: Compares two MPI info objects.
+ *
+ * For our purposes, two mpi info objects are the "same" if
+ * they contain the same key-value pairs or are both
+ * MPI_INFO_NULL.
+ *
+ * The out parameter is a value like strcmp. The value is
+ * undefined when the return value is FAIL.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5_mpi_info_cmp(MPI_Info info1, MPI_Info info2, int *result)
+{
+ hbool_t same = FALSE;
+ char *key = NULL;
+ char *value1 = NULL;
+ char *value2 = NULL;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check arguments */
+ if (!result)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "result cannot be NULL")
+
+ /* Check for MPI_INFO_NULL */
+ if (MPI_INFO_NULL == info1 && MPI_INFO_NULL == info2) {
+ /* Special case of both info objects being MPI_INFO_NULL */
+ same = TRUE;
+ }
+ else if (MPI_INFO_NULL == info1 || MPI_INFO_NULL == info2) {
+
+ /* Special case of one info object being MPI_INFO_NULL */
+ same = FALSE;
+ }
+ else {
+ int mpi_code;
+ int nkeys_1;
+ int nkeys_2;
+
+ /* Check if the number of keys is the same */
+ if (MPI_SUCCESS != (mpi_code = MPI_Info_get_nkeys(info1, &nkeys_1)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Info_get_nkeys failed", mpi_code)
+ if (MPI_SUCCESS != (mpi_code = MPI_Info_get_nkeys(info2, &nkeys_2)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Info_get_nkeys failed", mpi_code)
+
+ if (nkeys_1 != nkeys_2)
+ same = FALSE;
+ else if (0 == nkeys_1 && 0 == nkeys_2)
+ same = TRUE;
+ else {
+ int i;
+ int flag1 = -1;
+ int flag2 = -1;
+
+ /* Allocate buffers for iteration */
+ if (NULL == (key = (char *)H5MM_malloc(MPI_MAX_INFO_KEY * sizeof(char))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ if (NULL == (value1 = (char *)H5MM_malloc(MPI_MAX_INFO_VAL * sizeof(char))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ if (NULL == (value2 = (char *)H5MM_malloc(MPI_MAX_INFO_VAL * sizeof(char))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+
+ /* Iterate over the keys, comparing them */
+ for (i = 0; i < nkeys_1; i++) {
+
+ same = TRUE;
+
+ /* Memset the buffers to zero */
+ HDmemset(key, 0, MPI_MAX_INFO_KEY);
+ HDmemset(value1, 0, MPI_MAX_INFO_VAL);
+ HDmemset(value2, 0, MPI_MAX_INFO_VAL);
+
+ /* Get the nth key */
+ if (MPI_SUCCESS != (mpi_code = MPI_Info_get_nthkey(info1, i, key)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Info_get_nthkey failed", mpi_code)
+
+ /* Get the values */
+ if (MPI_SUCCESS != (mpi_code = MPI_Info_get(info1, key, MPI_MAX_INFO_VAL, value1, &flag1)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Info_get failed", mpi_code)
+ if (MPI_SUCCESS != (mpi_code = MPI_Info_get(info2, key, MPI_MAX_INFO_VAL, value2, &flag2)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Info_get failed", mpi_code)
+
+ /* Compare values and flags */
+ if (!flag1 || !flag2 || HDmemcmp(value1, value2, MPI_MAX_INFO_VAL)) {
+ same = FALSE;
+ break;
+ }
+
+ } /* end for */
+ } /* end else */
+ } /* end else */
+
+ /* Set the output value
+ *
+ * MPI_Info can either be an integer type or a pointer. We cast them
+ * to intptr_t so we can compare them with < and > when needed.
+ */
+ if (same)
+ *result = 0;
+ else
+ *result = (intptr_t)info1 < (intptr_t)info2 ? -1 : 1;
+
+done:
+ if (key)
+ H5MM_xfree(key);
+ if (value1)
+ H5MM_xfree(value1);
+ if (value2)
+ H5MM_xfree(value2);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5_mpi_info_cmp() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5_mpio_create_large_type
+ *
+ * Purpose: Create a large datatype of size larger than what a 32 bit integer
+ * can hold.
+ *
+ * Return: Non-negative on success, negative on failure.
+ *
+ * *new_type the new datatype created
+ *
+ * Programmer: Mohamad Chaarawi
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5_mpio_create_large_type(hsize_t num_elements, MPI_Aint stride_bytes,
+ MPI_Datatype old_type, MPI_Datatype *new_type)
+{
+ int num_big_types; /* num times the 2G datatype will be repeated */
+ int remaining_bytes; /* the number of bytes left that can be held in an int value */
+ hsize_t leftover;
+ int block_len[2];
+ int mpi_code; /* MPI return code */
+ MPI_Datatype inner_type, outer_type, leftover_type, type[2];
+ MPI_Aint disp[2], old_extent;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Calculate how many Big MPI datatypes are needed to represent the buffer */
+ num_big_types = (int)(num_elements/bigio_count);
+ leftover = (hsize_t)num_elements - (hsize_t)num_big_types * bigio_count;
+ H5_CHECKED_ASSIGN(remaining_bytes, int, leftover, hsize_t);
+
+ /* Create a contiguous datatype of size equal to the largest
+ * number that a 32 bit integer can hold x size of old type.
+ * If the displacement is 0, then the type is contiguous, otherwise
+ * use type_hvector to create the type with the displacement provided
+ */
+ if (0 == stride_bytes) {
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)bigio_count, old_type, &inner_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
+ } /* end if */
+ else
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector((int)bigio_count, 1, stride_bytes, old_type, &inner_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code)
+
+ /* Create a contiguous datatype of the buffer (minus the remaining < 2GB part)
+ * If a stride is present, use hvector type
+ */
+ if(0 == stride_bytes) {
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous(num_big_types, inner_type, &outer_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
+ } /* end if */
+ else
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector(num_big_types, 1, stride_bytes, inner_type, &outer_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code)
+
+ MPI_Type_free(&inner_type);
+
+ /* If there is a remaining part create a contiguous/vector datatype and then
+ * use a struct datatype to encapsulate everything.
+ */
+ if(remaining_bytes) {
+ if(stride_bytes == 0) {
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous(remaining_bytes, old_type, &leftover_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
+ } /* end if */
+ else
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector((int)(num_elements - (hsize_t)num_big_types * bigio_count), 1, stride_bytes, old_type, &leftover_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code)
+
+ /* As of version 4.0, OpenMPI now turns off MPI-1 API calls by default,
+ * so we're using the MPI-2 version even though we don't need the lb
+ * value.
+ */
+ {
+ MPI_Aint unused_lb_arg;
+ MPI_Type_get_extent(old_type, &unused_lb_arg, &old_extent);
+ }
+
+ /* Set up the arguments for MPI_Type_struct constructor */
+ type[0] = outer_type;
+ type[1] = leftover_type;
+ block_len[0] = 1;
+ block_len[1] = 1;
+ disp[0] = 0;
+ disp[1] = (old_extent + stride_bytes) * num_big_types * (MPI_Aint)bigio_count;
+
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_struct(2, block_len, disp, type, new_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct failed", mpi_code)
+
+ MPI_Type_free(&outer_type);
+ MPI_Type_free(&leftover_type);
+ } /* end if */
+ else
+ /* There are no remaining bytes so just set the new type to
+ * the outer type created */
+ *new_type = outer_type;
+
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(new_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5_mpio_create_large_type() */
+
+
+#endif /* H5_HAVE_PARALLEL */
+
diff --git a/src/Makefile.am b/src/Makefile.am
index dbbac99..0ec6c41 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -118,7 +118,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
# Only compile parallel sources if necessary
if BUILD_PARALLEL_CONDITIONAL
- libhdf5_la_SOURCES += H5ACmpio.c H5Cmpio.c H5Dmpio.c H5Fmpi.c H5FDmpi.c H5FDmpio.c H5Smpio.c
+ libhdf5_la_SOURCES += H5mpi.c H5ACmpio.c H5Cmpio.c H5Dmpio.c H5Fmpi.c H5FDmpi.c H5FDmpio.c H5Smpio.c
endif
# Only compile the direct VFD if necessary