summaryrefslogtreecommitdiffstats
path: root/src/H5Farray.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Farray.c')
-rw-r--r--src/H5Farray.c320
1 files changed, 160 insertions, 160 deletions
diff --git a/src/H5Farray.c b/src/H5Farray.c
index 88dae0b..9b2d194 100644
--- a/src/H5Farray.c
+++ b/src/H5Farray.c
@@ -5,8 +5,8 @@
* Programmer: Robb Matzke <robb@arborea.spizella.com>
* Thursday, January 15, 1998
*
- * Purpose: Provides I/O facilities for multi-dimensional arrays of bytes
- * stored with various layout policies.
+ * Purpose: Provides I/O facilities for multi-dimensional arrays of bytes
+ * stored with various layout policies.
*/
#include <H5private.h>
#include <H5Dprivate.h>
@@ -16,25 +16,23 @@
#include <H5Oprivate.h>
/* Interface initialization */
-#define PABLO_MASK H5F_arr_mask
-#define INTERFACE_INIT NULL
-static intn interface_initialize_g = FALSE;
-
-
+#define PABLO_MASK H5F_arr_mask
+#define INTERFACE_INIT NULL
+static intn interface_initialize_g = FALSE;
/*-------------------------------------------------------------------------
- * Function: H5F_arr_create
+ * Function: H5F_arr_create
*
- * Purpose: Creates an array of bytes. When called to create an array of
- * some type, the fastest varying dimension corresponds to an
- * instance of that type. That is, a 10x20 array of int32 is
- * really a 10x20x4 array of bytes.
+ * Purpose: Creates an array of bytes. When called to create an array of
+ * some type, the fastest varying dimension corresponds to an
+ * instance of that type. That is, a 10x20 array of int32 is
+ * really a 10x20x4 array of bytes.
*
- * Return: Success: SUCCEED
+ * Return: Success: SUCCEED
*
- * Failure: FAIL
+ * Failure: FAIL
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Friday, January 16, 1998
*
* Modifications:
@@ -42,178 +40,180 @@ static intn interface_initialize_g = FALSE;
*-------------------------------------------------------------------------
*/
herr_t
-H5F_arr_create (H5F_t *f, struct H5O_layout_t *layout/*in,out*/)
+H5F_arr_create(H5F_t *f, struct H5O_layout_t *layout /*in,out */ )
{
- intn i;
- size_t nbytes;
-
- FUNC_ENTER (H5F_arr_create, FAIL);
-
- /* check args */
- assert (f);
- assert (layout);
- H5F_addr_undef (&(layout->addr)); /*just in case we fail*/
-
- switch (layout->type) {
- case H5D_CONTIGUOUS:
- /* Reserve space in the file for the entire array */
- for (i=0, nbytes=1; i<layout->ndims; i++) nbytes *= layout->dim[i];
- assert (nbytes>0);
- if (H5MF_alloc (f, H5MF_RAW, nbytes, &(layout->addr)/*out*/)<0) {
- HRETURN_ERROR (H5E_IO, H5E_NOSPACE, FAIL,
- "unable to reserve file space");
- }
- break;
-
- case H5D_CHUNKED:
- /* Create the root of the B-tree that describes chunked storage */
- if (H5F_istore_create (f, layout/*out*/)<0) {
- HRETURN_ERROR (H5E_IO, H5E_CANTINIT, FAIL,
- "unable to initialize chunked storage");
- }
- break;
-
- default:
- assert ("not implemented yet" && 0);
- HRETURN_ERROR (H5E_IO, H5E_UNSUPPORTED, FAIL,
- "unsupported storage layout");
- break;
- }
-
- FUNC_LEAVE (SUCCEED);
+ intn i;
+ size_t nbytes;
+
+ FUNC_ENTER(H5F_arr_create, FAIL);
+
+ /* check args */
+ assert(f);
+ assert(layout);
+ H5F_addr_undef(&(layout->addr)); /*just in case we fail */
+
+ switch (layout->type) {
+ case H5D_CONTIGUOUS:
+ /* Reserve space in the file for the entire array */
+ for (i = 0, nbytes = 1; i < layout->ndims; i++)
+ nbytes *= layout->dim[i];
+ assert(nbytes > 0);
+ if (H5MF_alloc(f, H5MF_RAW, nbytes, &(layout->addr) /*out */ ) < 0) {
+ HRETURN_ERROR(H5E_IO, H5E_NOSPACE, FAIL,
+ "unable to reserve file space");
+ }
+ break;
+
+ case H5D_CHUNKED:
+ /* Create the root of the B-tree that describes chunked storage */
+ if (H5F_istore_create(f, layout /*out */ ) < 0) {
+ HRETURN_ERROR(H5E_IO, H5E_CANTINIT, FAIL,
+ "unable to initialize chunked storage");
+ }
+ break;
+
+ default:
+ assert("not implemented yet" && 0);
+ HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL,
+ "unsupported storage layout");
+ break;
+ }
+
+ FUNC_LEAVE(SUCCEED);
}
-
/*-------------------------------------------------------------------------
- * Function: H5F_arr_read
+ * Function: H5F_arr_read
*
- * Purpose: Reads a hyperslab of a file byte array into a byte array in
- * memory which has the same dimensions as the hyperslab.
+ * Purpose: Reads a hyperslab of a file byte array into a byte array in
+ * memory which has the same dimensions as the hyperslab.
*
- * Return: Success: SUCCEED
+ * Return: Success: SUCCEED
*
- * Failure: FAIL
+ * Failure: FAIL
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Friday, January 16, 1998
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
-herr_t H5F_arr_read (H5F_t *f, const struct H5O_layout_t *layout,
- const size_t offset[], const size_t size[],
- void *buf/*out*/)
+herr_t
+H5F_arr_read(H5F_t *f, const struct H5O_layout_t *layout,
+ const size_t offset[], const size_t size[],
+ void *buf /*out */ )
{
- intn i;
- size_t nbytes;
- size_t zero_offset[H5O_LAYOUT_NDIMS];
-
- FUNC_ENTER (H5F_arr_read, FAIL);
-
- /* Check args */
- assert (f);
- assert (layout);
- if (!offset) {
- HDmemset (zero_offset, 0, sizeof zero_offset);
- offset = zero_offset;
- }
- assert (size);
- assert (buf);
-
- switch (layout->type) {
- case H5D_CONTIGUOUS:
- /*
- * We currently only support complete I/O.
- */
- for (i=0; i<layout->ndims; i++) {
- assert (0==offset[i]);
- assert (size[i]==layout->dim[i]);
- }
- for (i=0, nbytes=1; i<layout->ndims; i++) nbytes *= layout->dim[i];
- if (H5F_block_read (f, &(layout->addr), nbytes, buf)<0) {
- HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL, "block read failed");
- }
- break;
-
- case H5D_CHUNKED:
- if (H5F_istore_read (f, layout, offset, size, buf)<0) {
- HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL, "chunked read failed");
- }
- break;
-
- default:
- assert ("not implemented yet" && 0);
- HRETURN_ERROR (H5E_IO, H5E_UNSUPPORTED, FAIL,
- "unsupported storage layout");
- break;
- }
-
- FUNC_LEAVE (SUCCEED);
+ intn i;
+ size_t nbytes;
+ size_t zero_offset[H5O_LAYOUT_NDIMS];
+
+ FUNC_ENTER(H5F_arr_read, FAIL);
+
+ /* Check args */
+ assert(f);
+ assert(layout);
+ if (!offset) {
+ HDmemset(zero_offset, 0, sizeof zero_offset);
+ offset = zero_offset;
+ }
+ assert(size);
+ assert(buf);
+
+ switch (layout->type) {
+ case H5D_CONTIGUOUS:
+ /*
+ * We currently only support complete I/O.
+ */
+ for (i = 0; i < layout->ndims; i++) {
+ assert(0 == offset[i]);
+ assert(size[i] == layout->dim[i]);
+ }
+ for (i = 0, nbytes = 1; i < layout->ndims; i++)
+ nbytes *= layout->dim[i];
+ if (H5F_block_read(f, &(layout->addr), nbytes, buf) < 0) {
+ HRETURN_ERROR(H5E_IO, H5E_READERROR, FAIL, "block read failed");
+ }
+ break;
+
+ case H5D_CHUNKED:
+ if (H5F_istore_read(f, layout, offset, size, buf) < 0) {
+ HRETURN_ERROR(H5E_IO, H5E_READERROR, FAIL, "chunked read failed");
+ }
+ break;
+
+ default:
+ assert("not implemented yet" && 0);
+ HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL,
+ "unsupported storage layout");
+ break;
+ }
+
+ FUNC_LEAVE(SUCCEED);
}
-
/*-------------------------------------------------------------------------
- * Function: H5F_arr_write
+ * Function: H5F_arr_write
*
- * Purpose: Writes an array to a hyperslab of a file byte array. The
- * memory array and the hyperslab are the same size.
+ * Purpose: Writes an array to a hyperslab of a file byte array. The
+ * memory array and the hyperslab are the same size.
*
- * Return: Success: SUCCEED
+ * Return: Success: SUCCEED
*
- * Failure: FAIL
+ * Failure: FAIL
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Friday, January 16, 1998
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
-herr_t H5F_arr_write (H5F_t *f, const struct H5O_layout_t *layout,
- const size_t offset[], const size_t size[],
- const void *buf)
+herr_t
+H5F_arr_write(H5F_t *f, const struct H5O_layout_t *layout,
+ const size_t offset[], const size_t size[],
+ const void *buf)
{
- intn i;
- size_t nbytes;
-
- FUNC_ENTER (H5F_arr_write, FAIL);
-
- /* Check args */
- assert (f);
- assert (layout);
- assert (offset);
- assert (size);
- assert (buf);
-
- switch (layout->type) {
- case H5D_CONTIGUOUS:
- /*
- * We currently only support complete I/O.
- */
- for (i=0; i<layout->ndims; i++) {
- assert (0==offset[i]);
- assert (size[i]==layout->dim[i]);
- }
- for (i=0, nbytes=1; i<layout->ndims; i++) nbytes *= layout->dim[i];
- if (H5F_block_write (f, &(layout->addr), nbytes, buf)<0) {
- HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "block write failed");
- }
- break;
-
- case H5D_CHUNKED:
- if (H5F_istore_write (f, layout, offset, size, buf)<0) {
- HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "chunked write failed");
- }
- break;
-
- default:
- assert ("not implemented yet" && 0);
- HRETURN_ERROR (H5E_IO, H5E_UNSUPPORTED, FAIL,
- "unsupported storage layout");
- break;
- }
-
- FUNC_LEAVE (SUCCEED);
+ intn i;
+ size_t nbytes;
+
+ FUNC_ENTER(H5F_arr_write, FAIL);
+
+ /* Check args */
+ assert(f);
+ assert(layout);
+ assert(offset);
+ assert(size);
+ assert(buf);
+
+ switch (layout->type) {
+ case H5D_CONTIGUOUS:
+ /*
+ * We currently only support complete I/O.
+ */
+ for (i = 0; i < layout->ndims; i++) {
+ assert(0 == offset[i]);
+ assert(size[i] == layout->dim[i]);
+ }
+ for (i = 0, nbytes = 1; i < layout->ndims; i++)
+ nbytes *= layout->dim[i];
+ if (H5F_block_write(f, &(layout->addr), nbytes, buf) < 0) {
+ HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed");
+ }
+ break;
+
+ case H5D_CHUNKED:
+ if (H5F_istore_write(f, layout, offset, size, buf) < 0) {
+ HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "chunked write failed");
+ }
+ break;
+
+ default:
+ assert("not implemented yet" && 0);
+ HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL,
+ "unsupported storage layout");
+ break;
+ }
+
+ FUNC_LEAVE(SUCCEED);
}
-