summaryrefslogtreecommitdiffstats
path: root/src/H5VM.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2015-05-13 21:30:24 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2015-05-13 21:30:24 (GMT)
commit7e231953a25fd4cc82f5b14b48b2c928cb3748e7 (patch)
treedd725497a7dff53acdab7120b76e628a7b533ffb /src/H5VM.c
parent67ba6cb57d84dd34c69930d469ae445697b49731 (diff)
downloadhdf5-7e231953a25fd4cc82f5b14b48b2c928cb3748e7.zip
hdf5-7e231953a25fd4cc82f5b14b48b2c928cb3748e7.tar.gz
hdf5-7e231953a25fd4cc82f5b14b48b2c928cb3748e7.tar.bz2
[svn-r27058] Description:
Convert internal chunk structures to use 'scaled' coordinates instead of absolute coordinates. Tested on: Mac OSX/64 10.10.3 (amazon) w/parallel & serial Linux 2.6.x/32 (jam) w/parallel & serial Linux 2.6.x/64 (koala) w/serial
Diffstat (limited to 'src/H5VM.c')
-rw-r--r--src/H5VM.c97
1 files changed, 39 insertions, 58 deletions
diff --git a/src/H5VM.c b/src/H5VM.c
index ffc657d..c546609 100644
--- a/src/H5VM.c
+++ b/src/H5VM.c
@@ -386,55 +386,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5VM_hyper_disjointp
- *
- * Purpose: Determines if two hyperslabs are disjoint.
- *
- * Return: Success: FALSE if they are not disjoint.
- * TRUE if they are disjoint.
- *
- * Failure: A hyperslab of zero size is disjoint from all
- * other hyperslabs.
- *
- * Programmer: Robb Matzke
- * Thursday, October 16, 1997
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-htri_t
-H5VM_hyper_disjointp(unsigned n,
- const hsize_t *offset1, const uint32_t *size1,
- const hsize_t *offset2, const uint32_t *size2)
-{
- unsigned u;
- htri_t ret_value = FALSE; /* Return value */
-
- /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- if(!n || !size1 || !size2)
- HGOTO_DONE(TRUE)
-
- for(u = 0; u < n; u++) {
- HDcompile_assert(sizeof(uint32_t) <= sizeof(hsize_t));
-
- if(0 == size1[u] || 0 == size2[u])
- HGOTO_DONE(TRUE)
- if(((offset1 ? offset1[u] : 0) < (offset2 ? offset2[u] : 0) &&
- ((offset1 ? offset1[u] : 0) + size1[u] <= (offset2 ? offset2[u] : 0))) ||
- ((offset2 ? offset2[u] : 0) < (offset1 ? offset1[u] : 0) &&
- ((offset2 ? offset2[u] : 0) + size2[u] <= (offset1 ? offset1[u] : 0))))
- HGOTO_DONE(TRUE)
- } /* end for */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VM_hyper_disjointp() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5VM_hyper_fill
*
* Purpose: Similar to memset() except it operates on hyperslabs...
@@ -1068,17 +1019,12 @@ H5VM_array_down(unsigned n, const hsize_t *total_size, hsize_t *down)
* Programmer: Quincey Koziol
* Tuesday, June 22, 1999
*
- * Modifications:
- * Use precomputed accumulator array
- * Quincey Koziol
- * Saturday, April 26, 2003
- *
*-------------------------------------------------------------------------
*/
hsize_t
H5VM_array_offset_pre(unsigned n, const hsize_t *acc, const hsize_t *offset)
{
- int i; /*counter */
+ unsigned u; /* Local index variable */
hsize_t ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -1088,8 +1034,8 @@ H5VM_array_offset_pre(unsigned n, const hsize_t *acc, const hsize_t *offset)
HDassert(offset);
/* Compute offset in array */
- for(i = (int)(n - 1), ret_value = 0; i >= 0; --i)
- ret_value += acc[i] * offset[i];
+ for(u = 0, ret_value = 0; u < n; u++)
+ ret_value += acc[u] * offset[u];
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VM_array_offset_pre() */
@@ -1157,7 +1103,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t
+herr_t
H5VM_array_calc_pre(hsize_t offset, unsigned n, const hsize_t *down,
hsize_t *coords)
{
@@ -1288,6 +1234,41 @@ H5VM_chunk_index(unsigned ndims, const hsize_t *coord, const uint32_t *chunk,
/*-------------------------------------------------------------------------
+ * Function: H5VM_chunk_scaled
+ *
+ * Purpose: Compute the scaled coordinates for a chunk offset
+ *
+ * Return: <none>
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, November 19, 2014
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VM_chunk_scaled(unsigned ndims, const hsize_t *coord, const uint32_t *chunk,
+ hsize_t *scaled)
+{
+ unsigned u; /* Local index variable */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* Sanity check */
+ HDassert(ndims <= H5VM_HYPER_NDIMS);
+ HDassert(coord);
+ HDassert(chunk);
+ HDassert(scaled);
+
+ /* Compute the scaled coordinates for actual coordinates */
+ /* (Note that the 'scaled' array is an 'OUT' parameter) */
+ for(u = 0; u < ndims; u++)
+ scaled[u] = coord[u] / chunk[u];
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VM_chunk_scaled() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5VM_chunk_index_scaled
*
* Purpose: Given a coordinate offset (COORD), the size of each chunk