summaryrefslogtreecommitdiffstats
path: root/src/H5Sselect.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2002-04-03 17:07:14 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2002-04-03 17:07:14 (GMT)
commit7ae00db7a4a4e8330245b15aa1e2fa1659cb9b1b (patch)
treea01c9d03f52334938852b8f509bbe6bc8bcdac36 /src/H5Sselect.c
parentad641fa7b617c8ca2ec11602cde0f72fa12696cd (diff)
downloadhdf5-7ae00db7a4a4e8330245b15aa1e2fa1659cb9b1b.zip
hdf5-7ae00db7a4a4e8330245b15aa1e2fa1659cb9b1b.tar.gz
hdf5-7ae00db7a4a4e8330245b15aa1e2fa1659cb9b1b.tar.bz2
[svn-r5138] Purpose:
Bug Fix & Code Cleanup Description: The MPI-IO optimized transfer routines (H5S_mpio_spaces_read/H5S_mpio_space_write) are not being invoked in all the cases where they could be used. Additionally, the code for determining if an optimized transfer is wrapped into the actual I/O transfer routine in a very confusing way. Solution: Re-enabled MPI-IO optimized transfer routines in all the cases where they should work. Extracted all the pre-conditions for optimized transfers into separate routines from the transfer routines. Platforms tested: FreeBSD 4.5 (sleipnir) & IRIX64 6.5 (modi4)
Diffstat (limited to 'src/H5Sselect.c')
-rw-r--r--src/H5Sselect.c171
1 files changed, 171 insertions, 0 deletions
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index b592e9f..92f9832 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -1342,6 +1342,7 @@ H5S_select_single(const H5S_t *space)
FUNC_ENTER (H5S_select_single, FAIL);
+ /* Check args */
assert(space);
switch(space->select.type) {
@@ -1369,3 +1370,173 @@ H5S_select_single(const H5S_t *space)
FUNC_LEAVE (ret_value);
} /* H5S_select_single() */
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S_select_shape_same
+ PURPOSE
+ Check if two selections are the same shape
+ USAGE
+ htri_t H5S_select_shape_same(space1, space2)
+ const H5S_t *space1; IN: 1st Dataspace pointer to compare
+ const H5S_t *space2; IN: 2nd Dataspace pointer to compare
+ RETURNS
+ TRUE/FALSE/FAIL
+ 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
+ Assumes that there is only a single "block" for hyperslab selections.
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+htri_t
+H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
+{
+ H5S_hyper_span_t *span1=NULL,*span2=NULL; /* Hyperslab span node */
+ hsize_t elmts1,elmts2; /* Number of elements in each dimension of selection */
+ unsigned u; /* Index variable */
+ htri_t ret_value=TRUE; /* return value */
+
+ FUNC_ENTER (H5S_select_shape_same, FAIL);
+
+ /* Check args */
+ assert(space1);
+ assert(space2);
+
+ if (space1->extent.u.simple.rank!=space2->extent.u.simple.rank)
+ HGOTO_DONE(FALSE);
+
+ /* Get information about memory and file */
+ for (u=0; u<space1->extent.u.simple.rank; u++) {
+ switch(space1->select.type) {
+ case H5S_SEL_HYPERSLABS:
+ /* Check size hyperslab selection in this dimension */
+ if(space1->select.sel_info.hslab.diminfo != NULL) {
+ elmts1=space1->select.sel_info.hslab.diminfo[u].block;
+ } /* end if */
+ else {
+ /* Check for the first dimension */
+ if(span1==NULL)
+ span1=space1->select.sel_info.hslab.span_lst->head;
+
+ /* Get the number of elements in the span */
+ elmts1=(span1->high-span1->low)+1;
+
+ /* Advance to the next dimension */
+ span1=span1->down->head;
+ } /* end else */
+ break;
+
+ case H5S_SEL_ALL:
+ elmts1=space1->extent.u.simple.size[u];
+ break;
+
+ case H5S_SEL_POINTS:
+ elmts1=1;
+ break;
+
+ default:
+ assert(0 && "Invalid selection type!");
+ } /* end switch */
+
+ switch(space2->select.type) {
+ case H5S_SEL_HYPERSLABS:
+ /* Check size hyperslab selection in this dimension */
+ if(space2->select.sel_info.hslab.diminfo != NULL) {
+ elmts2=space2->select.sel_info.hslab.diminfo[u].block;
+ } /* end if */
+ else {
+ /* Check for the first dimension */
+ if(span2==NULL)
+ span2=space2->select.sel_info.hslab.span_lst->head;
+
+ /* Get the number of elements in the span */
+ elmts2=(span2->high-span2->low)+1;
+
+ /* Advance to the next dimension */
+ span2=span2->down->head;
+ } /* end else */
+ break;
+
+ case H5S_SEL_ALL:
+ elmts2=space2->extent.u.simple.size[u];
+ break;
+
+ case H5S_SEL_POINTS:
+ elmts2=1;
+ break;
+
+ default:
+ assert(0 && "Invalid selection type!");
+ } /* end switch */
+
+ /* Make certaint the selections have the same number of elements in this dimension */
+ if (elmts1!=elmts2)
+ HGOTO_DONE(FALSE);
+ } /* end for */
+
+done:
+ FUNC_LEAVE (ret_value);
+} /* H5S_select_shape_same() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S_select_regular
+ PURPOSE
+ Check if a selection is "regular"
+ USAGE
+ htri_t H5S_select_regular(space)
+ const H5S_t *space; IN: Dataspace pointer to check
+ RETURNS
+ TRUE/FALSE/FAIL
+ DESCRIPTION
+ Checks to see if the current selection in a dataspace is the a regular
+ pattern.
+ This is primarily used for reading the entire selection in one swoop.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+htri_t
+H5S_select_regular(const H5S_t *space)
+{
+ htri_t ret_value=FAIL; /* return value */
+
+ FUNC_ENTER (H5S_select_regular, FAIL);
+
+ /* Check args */
+ assert(space);
+
+ /* Check for a "regular" selection */
+ /* [Defer (mostly) to the selection routines] */
+ switch(space->select.type) {
+ case H5S_SEL_POINTS: /* Sequence of points selected */
+ ret_value=H5S_point_select_regular(space);
+ break;
+
+ case H5S_SEL_HYPERSLABS: /* Hyperslab selection defined */
+ ret_value=H5S_hyper_select_regular(space);
+ break;
+
+ case H5S_SEL_ALL: /* Entire extent selected */
+ ret_value=TRUE;
+ break;
+
+ case H5S_SEL_NONE: /* Nothing selected */
+ ret_value=FALSE;
+ break;
+
+ case H5S_SEL_ERROR:
+ case H5S_SEL_N:
+ break;
+ } /* end switch */
+
+done:
+ FUNC_LEAVE (ret_value);
+} /* H5S_select_regular() */
+