adapted to coding style
This commit is contained in:
@@ -28,8 +28,8 @@
|
||||
#define H5BLOCK_GROUPNAME_BLOCK H5B_CONTAINER_GRPNAME
|
||||
|
||||
|
||||
#define TRY( func ) \
|
||||
if ( (int64_t)(ptrdiff_t)(func) <= (int64_t)H5_ERR ) \
|
||||
#define TRY( func ) \
|
||||
if ((int64_t)(ptrdiff_t)(func) <= (int64_t)H5_ERR) \
|
||||
return H5_ERR;
|
||||
|
||||
/*!
|
||||
@@ -43,38 +43,38 @@
|
||||
|
||||
h5_int64_t
|
||||
h5_get_num_particles (
|
||||
h5_file_t *f
|
||||
h5_file_t* const f
|
||||
);
|
||||
|
||||
herr_t
|
||||
h5_iteration_operator (
|
||||
hid_t group_id,
|
||||
const char *member_name,
|
||||
void *operator_data
|
||||
const char* member_name,
|
||||
void* operator_data
|
||||
);
|
||||
|
||||
|
||||
h5_int64_t
|
||||
_H5Part_get_object_name (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
hid_t group_id,
|
||||
const char *group_name,
|
||||
const char* group_name,
|
||||
const hid_t type,
|
||||
const h5_int64_t idx,
|
||||
char *obj_name,
|
||||
char* obj_name,
|
||||
const h5_int64_t len_obj_name
|
||||
);
|
||||
|
||||
|
||||
char *
|
||||
char*
|
||||
_H5Part_strdupfor2c (
|
||||
const char *s,
|
||||
const char* s,
|
||||
const ssize_t len
|
||||
);
|
||||
|
||||
char *
|
||||
char*
|
||||
_H5Part_strc2for (
|
||||
char * const str,
|
||||
char* const str,
|
||||
const ssize_t l_str
|
||||
);
|
||||
|
||||
|
||||
@@ -4,34 +4,34 @@
|
||||
/*** group ***/
|
||||
hid_t
|
||||
h5priv_open_hdf5_group (
|
||||
h5_file_t *f,
|
||||
h5_file_t* const f,
|
||||
const hid_t loc_id,
|
||||
const char * const group_name
|
||||
const char* const group_name
|
||||
);
|
||||
|
||||
hid_t
|
||||
h5priv_create_hdf5_group (
|
||||
h5_file_t * f,
|
||||
h5_file_t* const f,
|
||||
const hid_t loc_id,
|
||||
const char * const group_name
|
||||
const char* const group_name
|
||||
);
|
||||
|
||||
hid_t
|
||||
h5priv_open_group (
|
||||
h5_file_t *f,
|
||||
h5_file_t* const f,
|
||||
const hid_t loc_id,
|
||||
const char * const group_name
|
||||
const char* const group_name
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
h5priv_close_hdf5_group (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
const hid_t group_id
|
||||
);
|
||||
|
||||
hsize_t
|
||||
h5priv_get_num_objs_in_hdf5_group (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
const hid_t group_id
|
||||
);
|
||||
|
||||
@@ -40,23 +40,23 @@ h5priv_get_hdf5_objname_by_idx (
|
||||
h5_file_t* const f,
|
||||
hid_t loc_id,
|
||||
hsize_t idx,
|
||||
char *name,
|
||||
char* name,
|
||||
size_t size
|
||||
);
|
||||
|
||||
/*** dataset ***/
|
||||
hid_t
|
||||
h5priv_open_hdf5_dataset (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
const hid_t gid,
|
||||
const char * const dataset_name
|
||||
const char* const dataset_name
|
||||
);
|
||||
|
||||
hid_t
|
||||
h5priv_create_hdf5_dataset (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
hid_t loc_id,
|
||||
const char * dataset_name,
|
||||
const char* dataset_name,
|
||||
const hid_t type_id,
|
||||
const hid_t dataspace_id,
|
||||
const hid_t create_proplist
|
||||
@@ -64,160 +64,160 @@ h5priv_create_hdf5_dataset (
|
||||
|
||||
herr_t
|
||||
h5priv_close_hdf5_dataset (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
const hid_t dataset_id
|
||||
);
|
||||
|
||||
|
||||
herr_t
|
||||
h5priv_write_hdf5_dataset (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
const hid_t dataset_id,
|
||||
const hid_t type_id,
|
||||
const hid_t memspace_id,
|
||||
const hid_t diskspace_id,
|
||||
const hid_t xfer_prop,
|
||||
const void * buf
|
||||
const void* buf
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
h5priv_read_hdf5_dataset (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
const hid_t dataset_id,
|
||||
const hid_t type_id,
|
||||
const hid_t memspace_id,
|
||||
const hid_t diskspace_id,
|
||||
const hid_t xfer_prop,
|
||||
void * const buf );
|
||||
void* const buf );
|
||||
|
||||
hid_t
|
||||
h5priv_get_hdf5_dataset_type (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
const hid_t dataset_id
|
||||
);
|
||||
|
||||
herr_t
|
||||
h5priv_set_hdf5_dataset_extent (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
hid_t dset_id,
|
||||
const hsize_t *size
|
||||
const hsize_t* size
|
||||
);
|
||||
|
||||
hssize_t
|
||||
h5priv_get_npoints_of_hdf5_dataset (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
hid_t dset_id
|
||||
);
|
||||
|
||||
hssize_t
|
||||
h5priv_get_npoints_of_hdf5_dataset_by_name (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
hid_t loc_id,
|
||||
char * name
|
||||
char* name
|
||||
);
|
||||
|
||||
/*** dataspace ***/
|
||||
hid_t
|
||||
h5priv_create_hdf5_dataspace (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
const int rank,
|
||||
const hsize_t * dims,
|
||||
const hsize_t * maxdims
|
||||
const hsize_t* dims,
|
||||
const hsize_t* maxdims
|
||||
);
|
||||
|
||||
hid_t
|
||||
h5priv_get_hdf5_dataset_space (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
const hid_t dataset_id
|
||||
);
|
||||
|
||||
herr_t
|
||||
h5priv_select_hyperslab_of_hdf5_dataspace (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
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
|
||||
);
|
||||
|
||||
hssize_t
|
||||
h5priv_get_selected_npoints_of_hdf5_dataspace (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
hid_t space_id
|
||||
);
|
||||
|
||||
hssize_t
|
||||
h5priv_get_npoints_of_hdf5_dataspace (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
hid_t space_id
|
||||
);
|
||||
|
||||
herr_t
|
||||
h5priv_close_hdf5_dataspace (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
const hid_t dataspace_id
|
||||
);
|
||||
|
||||
int
|
||||
h5priv_get_dims_of_hdf5_dataspace (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
hid_t space_id,
|
||||
hsize_t *dims,
|
||||
hsize_t *maxdims
|
||||
hsize_t* dims,
|
||||
hsize_t* maxdims
|
||||
);
|
||||
|
||||
/*** type ***/
|
||||
hid_t
|
||||
h5priv_create_hdf5_array_type (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
hid_t base_type_id,
|
||||
int rank,
|
||||
const hsize_t *dims
|
||||
const hsize_t* dims
|
||||
);
|
||||
|
||||
hid_t
|
||||
h5priv_create_hdf5_type (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
H5T_class_t _class,
|
||||
const size_t size
|
||||
);
|
||||
|
||||
herr_t
|
||||
h5priv_insert_hdf5_type (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
hid_t dtype_id,
|
||||
const char * name,
|
||||
const char* name,
|
||||
size_t offset,
|
||||
hid_t field_id
|
||||
);
|
||||
|
||||
herr_t
|
||||
h5priv_close_hdf5_type (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
hid_t dtype_id
|
||||
);
|
||||
|
||||
/*** property ***/
|
||||
hid_t
|
||||
h5priv_create_hdf5_property (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
hid_t cls_id
|
||||
);
|
||||
|
||||
herr_t
|
||||
h5priv_set_hdf5_chunk_property (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
hid_t plist,
|
||||
int ndims,
|
||||
const hsize_t * dim
|
||||
const hsize_t* dim
|
||||
);
|
||||
|
||||
#ifdef PARALLEL_IO
|
||||
h5_err_t
|
||||
h5priv_set_hdf5_fapl_mpio_property (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
hid_t fapl_id,
|
||||
MPI_Comm comm,
|
||||
MPI_Info info
|
||||
@@ -226,54 +226,54 @@ h5priv_set_hdf5_fapl_mpio_property (
|
||||
|
||||
h5_err_t
|
||||
h5priv_close_hdf5_property (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
hid_t prop
|
||||
);
|
||||
|
||||
/*** file ***/
|
||||
herr_t
|
||||
h5priv_close_hdf5_file (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
hid_t fileid
|
||||
);
|
||||
|
||||
/*** error handling ***/
|
||||
herr_t
|
||||
h5priv_set_hdf5_errorhandler (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
hid_t estack_id,
|
||||
H5E_auto_t func,
|
||||
void *client_data
|
||||
void* client_data
|
||||
);
|
||||
|
||||
/*** attributes ***/
|
||||
hid_t
|
||||
h5priv_open_hdf5_attribute (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
hid_t loc_id,
|
||||
const char *attr_name
|
||||
);
|
||||
|
||||
hid_t
|
||||
h5priv_open_hdf5_attribute_idx (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
hid_t loc_id,
|
||||
unsigned int idx
|
||||
);
|
||||
|
||||
hid_t
|
||||
h5priv_open_hdf5_attribute_by_name (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
hid_t loc_id,
|
||||
const char *obj_name,
|
||||
const char *attr_name
|
||||
const char* obj_name,
|
||||
const char* attr_name
|
||||
);
|
||||
|
||||
hid_t
|
||||
h5priv_create_hdf5_attribute (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
hid_t loc_id,
|
||||
const char *attr_name,
|
||||
const char* attr_name,
|
||||
hid_t type_id,
|
||||
hid_t space_id,
|
||||
hid_t acpl_id,
|
||||
@@ -282,58 +282,58 @@ h5priv_create_hdf5_attribute (
|
||||
|
||||
herr_t
|
||||
h5priv_read_hdf5_attribute (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
hid_t attr_id,
|
||||
hid_t mem_type_id,
|
||||
void *buf
|
||||
void* buf
|
||||
);
|
||||
|
||||
herr_t
|
||||
h5priv_write_hdf5_attribute (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
hid_t attr_id,
|
||||
hid_t mem_type_id,
|
||||
const void *buf
|
||||
const void* buf
|
||||
);
|
||||
|
||||
ssize_t
|
||||
h5priv_get_hdf5_attribute_name (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
hid_t attr_id,
|
||||
size_t buf_size,
|
||||
char *buf
|
||||
char* buf
|
||||
);
|
||||
|
||||
hid_t
|
||||
h5priv_get_hdf5_attribute_type (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
hid_t attr_id
|
||||
);
|
||||
|
||||
hid_t
|
||||
h5priv_get_hdf5_attribute_dataspace (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
hid_t attr_id
|
||||
);
|
||||
|
||||
int
|
||||
h5priv_get_num_hdf5_attribute (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
hid_t loc_id
|
||||
);
|
||||
|
||||
herr_t
|
||||
h5priv_close_hdf5_attribute (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
hid_t attr_id
|
||||
);
|
||||
|
||||
/*** link ***/
|
||||
herr_t
|
||||
h5priv_delete_hdf5_link (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
hid_t loc_id,
|
||||
const char *name,
|
||||
const char* name,
|
||||
hid_t lapl_id
|
||||
);
|
||||
|
||||
|
||||
@@ -17,61 +17,61 @@ typedef enum {
|
||||
} h5_action_t;
|
||||
|
||||
typedef struct h5_entry {
|
||||
void *dta;
|
||||
void* dta;
|
||||
} h5_entry_t;
|
||||
|
||||
/* Reentrant versions which can handle multiple hashing tables at the
|
||||
same time. */
|
||||
extern h5_err_t
|
||||
h5priv_hsearch (
|
||||
h5_file_t * const f,
|
||||
void *item,
|
||||
h5_file_t* const f,
|
||||
void* item,
|
||||
const h5_action_t action,
|
||||
void **retval,
|
||||
h5_hashtable_t *htab
|
||||
void** retval,
|
||||
h5_hashtable_t* htab
|
||||
);
|
||||
|
||||
extern h5_err_t
|
||||
h5priv_hcreate (
|
||||
h5_file_t* const f,
|
||||
size_t __nel,
|
||||
h5_hashtable_t *__htab,
|
||||
h5_hashtable_t* __htab,
|
||||
int (*compare)(const void*, const void*),
|
||||
unsigned int (*compute_hash)(const void*)
|
||||
);
|
||||
|
||||
extern h5_err_t
|
||||
h5priv_hresize (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
size_t nel,
|
||||
h5_hashtable_t *htab
|
||||
h5_hashtable_t* htab
|
||||
);
|
||||
|
||||
extern h5_err_t
|
||||
h5priv_hdestroy (
|
||||
h5_file_t* f,
|
||||
h5_hashtable_t *__htab
|
||||
h5_hashtable_t* __htab
|
||||
);
|
||||
|
||||
extern h5_err_t
|
||||
h5priv_hwalk (
|
||||
h5_file_t* f,
|
||||
h5_hashtable_t *__htab,
|
||||
h5_err_t (*visit)(h5_file_t*const f, const void *__item)
|
||||
h5_hashtable_t* __htab,
|
||||
h5_err_t (*visit)(h5_file_t* const f, const void* __item)
|
||||
);
|
||||
|
||||
extern h5_err_t
|
||||
h5priv_hcreate_string_keyed (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
size_t nel,
|
||||
h5_hashtable_t *htab
|
||||
h5_hashtable_t* htab
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
h5priv_hcreate_id_keyed (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
size_t nel,
|
||||
h5_hashtable_t *htab
|
||||
h5_hashtable_t* htab
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
#ifdef PARALLEL_IO
|
||||
h5_err_t
|
||||
h5priv_mpi_allgather (
|
||||
h5_file_t * const f,
|
||||
void * sendbuf,
|
||||
h5_file_t* const f,
|
||||
void* sendbuf,
|
||||
const int sendcount,
|
||||
const MPI_Datatype sendtype,
|
||||
void * recvbuf,
|
||||
void* recvbuf,
|
||||
const int recvcount,
|
||||
const MPI_Datatype recvtype,
|
||||
const MPI_Comm comm
|
||||
@@ -16,16 +16,16 @@ h5priv_mpi_allgather (
|
||||
|
||||
h5_err_t
|
||||
h5priv_mpi_comm_size (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
MPI_Comm comm,
|
||||
int *size
|
||||
int* size
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
h5priv_mpi_comm_rank (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
MPI_Comm comm,
|
||||
int *rank
|
||||
int* rank
|
||||
);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
+114
-115
@@ -7,9 +7,9 @@
|
||||
|
||||
h5_err_t
|
||||
h5_write_data (
|
||||
h5_file_t * const f, /*!< IN: Handle to open file */
|
||||
const char *name, /*!< IN: Name to associate array with */
|
||||
const void *array, /*!< IN: Array to commit to disk */
|
||||
h5_file_t* const f, /*!< IN: Handle to open file */
|
||||
const char* name, /*!< IN: Name to associate array with */
|
||||
const void* array, /*!< IN: Array to commit to disk */
|
||||
const hid_t type_id, /*!< IN: Type of data */
|
||||
const hid_t group_id,
|
||||
const hid_t memspace_id,
|
||||
@@ -17,23 +17,23 @@ h5_write_data (
|
||||
) {
|
||||
hid_t dset_id;
|
||||
|
||||
h5_info ( f, "Writing dataset %s/%s.", h5_get_objname(group_id), name );
|
||||
TRY ( dset_id = h5priv_create_hdf5_dataset (
|
||||
f,
|
||||
group_id,
|
||||
name,
|
||||
type_id,
|
||||
diskspace_id,
|
||||
H5P_DEFAULT ) );
|
||||
TRY ( h5priv_write_hdf5_dataset (
|
||||
f,
|
||||
dset_id,
|
||||
type_id,
|
||||
memspace_id,
|
||||
diskspace_id,
|
||||
f->xfer_prop,
|
||||
array ) );
|
||||
TRY ( h5priv_close_hdf5_dataset( f, dset_id ) );
|
||||
h5_info (f, "Writing dataset %s/%s.", h5_get_objname(group_id), name);
|
||||
TRY( dset_id = h5priv_create_hdf5_dataset (
|
||||
f,
|
||||
group_id,
|
||||
name,
|
||||
type_id,
|
||||
diskspace_id,
|
||||
H5P_DEFAULT) );
|
||||
TRY( h5priv_write_hdf5_dataset (
|
||||
f,
|
||||
dset_id,
|
||||
type_id,
|
||||
memspace_id,
|
||||
diskspace_id,
|
||||
f->xfer_prop,
|
||||
array) );
|
||||
TRY( h5priv_close_hdf5_dataset (f, dset_id) );
|
||||
|
||||
f->empty = 0;
|
||||
|
||||
@@ -50,28 +50,28 @@ h5_write_data (
|
||||
*/
|
||||
h5_err_t
|
||||
h5priv_write_dataset_by_name (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
const hid_t loc_id,
|
||||
h5_dsinfo_t *dsinfo,
|
||||
h5_dsinfo_t* dsinfo,
|
||||
hid_t (*set_memspace)(h5_file_t*,hid_t),
|
||||
hid_t (*set_diskspace)(h5_file_t*,hid_t),
|
||||
const void * const data
|
||||
const void* const data
|
||||
) {
|
||||
h5_info ( f, "Writing dataset %s/%s.",
|
||||
h5_get_objname ( loc_id ), dsinfo->name );
|
||||
h5_info (f, "Writing dataset %s/%s.",
|
||||
h5_get_objname (loc_id), dsinfo->name);
|
||||
|
||||
H5O_info_t obj_info;
|
||||
herr_t herr = H5Oget_info_by_name(
|
||||
loc_id,
|
||||
dsinfo->name,
|
||||
&obj_info,
|
||||
H5P_DEFAULT );
|
||||
H5P_DEFAULT);
|
||||
|
||||
if ( (herr >= 0) && ( (f->mode==H5_O_WRONLY) || (f->mode==H5_O_APPEND) ) ) {
|
||||
h5_warn ( f,
|
||||
"Dataset %s/%s already exist.",
|
||||
h5_get_objname ( loc_id ), dsinfo->name );
|
||||
return h5priv_handle_file_mode_error( f, f->mode );
|
||||
if ((herr >= 0) && ((f->mode==H5_O_WRONLY) || (f->mode==H5_O_APPEND))) {
|
||||
h5_warn (f,
|
||||
"Dataset %s/%s already exist.",
|
||||
h5_get_objname (loc_id), dsinfo->name);
|
||||
return h5priv_handle_file_mode_error(f, f->mode);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -82,49 +82,48 @@ h5priv_write_dataset_by_name (
|
||||
hid_t diskspace_id;
|
||||
hid_t memspace_id;
|
||||
|
||||
if ( herr >= 0 ) {
|
||||
if (herr >= 0) {
|
||||
/* overwrite dataset */
|
||||
TRY ( (dset_id = h5priv_open_hdf5_dataset (
|
||||
f,
|
||||
loc_id,
|
||||
dsinfo->name ) ) );
|
||||
TRY ( (dataspace_id = h5priv_get_hdf5_dataset_space (
|
||||
f,
|
||||
dset_id ) ) );
|
||||
TRY ( h5priv_set_hdf5_dataset_extent (
|
||||
f,
|
||||
dset_id,
|
||||
dsinfo->dims ) );
|
||||
TRY( dset_id = h5priv_open_hdf5_dataset (
|
||||
f,
|
||||
loc_id,
|
||||
dsinfo->name) );
|
||||
TRY( dataspace_id = h5priv_get_hdf5_dataset_space (
|
||||
f,
|
||||
dset_id) );
|
||||
TRY( h5priv_set_hdf5_dataset_extent (
|
||||
f,
|
||||
dset_id,
|
||||
dsinfo->dims) );
|
||||
/* exten dataset? */
|
||||
} else {
|
||||
/* create dataset */
|
||||
TRY ( dataspace_id = h5priv_create_hdf5_dataspace (
|
||||
f,
|
||||
dsinfo->rank,
|
||||
dsinfo->dims,
|
||||
dsinfo->max_dims ) );
|
||||
TRY( dataspace_id = h5priv_create_hdf5_dataspace (
|
||||
f,
|
||||
dsinfo->rank,
|
||||
dsinfo->dims,
|
||||
dsinfo->max_dims) );
|
||||
TRY ( dset_id = h5priv_create_hdf5_dataset (
|
||||
f,
|
||||
loc_id,
|
||||
dsinfo->name,
|
||||
dsinfo->type_id,
|
||||
dataspace_id,
|
||||
dsinfo->create_prop ) );
|
||||
dsinfo->create_prop) );
|
||||
}
|
||||
TRY ( memspace_id = (*set_memspace)( f, 0 ) );
|
||||
TRY ( diskspace_id = (*set_diskspace)( f, dataspace_id ) );
|
||||
TRY ( h5priv_write_hdf5_dataset (
|
||||
TRY( memspace_id = (*set_memspace)(f, 0) );
|
||||
TRY( diskspace_id = (*set_diskspace)(f, dataspace_id) );
|
||||
TRY( h5priv_write_hdf5_dataset (
|
||||
f,
|
||||
dset_id,
|
||||
dsinfo->type_id,
|
||||
memspace_id,
|
||||
diskspace_id,
|
||||
f->xfer_prop,
|
||||
data ) );
|
||||
TRY ( h5priv_close_hdf5_dataspace ( f, diskspace_id ) );
|
||||
TRY ( h5priv_close_hdf5_dataspace ( f, memspace_id ) );
|
||||
TRY ( h5priv_close_hdf5_dataset( f, dset_id ) );
|
||||
|
||||
data) );
|
||||
TRY( h5priv_close_hdf5_dataspace (f, diskspace_id) );
|
||||
TRY( h5priv_close_hdf5_dataspace (f, memspace_id) );
|
||||
TRY( h5priv_close_hdf5_dataset (f, dset_id) );
|
||||
f->empty = 0;
|
||||
|
||||
return H5_SUCCESS;
|
||||
@@ -132,51 +131,51 @@ h5priv_write_dataset_by_name (
|
||||
|
||||
h5_err_t
|
||||
h5priv_read_dataset (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
hid_t dset_id,
|
||||
h5_dsinfo_t *dsinfo,
|
||||
h5_dsinfo_t* dsinfo,
|
||||
hid_t (*set_mspace)(h5_file_t*,hid_t),
|
||||
hid_t (*set_dspace)(h5_file_t*,hid_t),
|
||||
void * const data
|
||||
void* const data
|
||||
) {
|
||||
|
||||
hid_t mspace_id;
|
||||
hid_t dspace_id;
|
||||
|
||||
TRY ( (mspace_id = (*set_mspace)( f, dset_id ) ) );
|
||||
TRY ( (dspace_id = (*set_dspace)( f, dset_id ) ) );
|
||||
TRY ( h5priv_read_hdf5_dataset (
|
||||
f,
|
||||
dset_id,
|
||||
dsinfo->type_id,
|
||||
mspace_id,
|
||||
dspace_id,
|
||||
f->xfer_prop,
|
||||
data ) );
|
||||
TRY ( h5priv_close_hdf5_dataspace ( f, dspace_id ) );
|
||||
TRY ( h5priv_close_hdf5_dataspace ( f, mspace_id ) );
|
||||
TRY( mspace_id = (*set_mspace)(f, dset_id) );
|
||||
TRY( dspace_id = (*set_dspace)(f, dset_id) );
|
||||
TRY( h5priv_read_hdf5_dataset (
|
||||
f,
|
||||
dset_id,
|
||||
dsinfo->type_id,
|
||||
mspace_id,
|
||||
dspace_id,
|
||||
f->xfer_prop,
|
||||
data) );
|
||||
TRY( h5priv_close_hdf5_dataspace (f, dspace_id) );
|
||||
TRY( h5priv_close_hdf5_dataspace (f, mspace_id) );
|
||||
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5priv_read_dataset_by_name (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
hid_t loc_id,
|
||||
h5_dsinfo_t *dsinfo,
|
||||
h5_dsinfo_t* dsinfo,
|
||||
hid_t (*set_mspace)(h5_file_t*,hid_t),
|
||||
hid_t (*set_dspace)(h5_file_t*,hid_t),
|
||||
void * const data
|
||||
void* const data
|
||||
) {
|
||||
|
||||
hid_t dset_id;
|
||||
TRY ( (dset_id = h5priv_open_hdf5_dataset (
|
||||
TRY( dset_id = h5priv_open_hdf5_dataset (
|
||||
f,
|
||||
loc_id,
|
||||
dsinfo->name ) ) );
|
||||
TRY ( h5priv_read_dataset ( f, dset_id, dsinfo, set_mspace, set_dspace,
|
||||
data ) );
|
||||
TRY ( h5priv_close_hdf5_dataset ( f, dset_id ) );
|
||||
dsinfo->name) );
|
||||
TRY( h5priv_read_dataset (f, dset_id, dsinfo, set_mspace, set_dspace,
|
||||
data) );
|
||||
TRY( h5priv_close_hdf5_dataset (f, dset_id) );
|
||||
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
@@ -184,21 +183,21 @@ h5priv_read_dataset_by_name (
|
||||
|
||||
static h5_err_t
|
||||
_init_step (
|
||||
h5_file_t * f
|
||||
h5_file_t* const f
|
||||
) {
|
||||
TRY ( h5tpriv_init_step ( f ) );
|
||||
TRY( h5tpriv_init_step (f) );
|
||||
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
h5_err_t
|
||||
h5priv_close_step (
|
||||
h5_file_t * f
|
||||
h5_file_t* const f
|
||||
) {
|
||||
|
||||
if ( f->step_gid < 0 ) return H5_SUCCESS;
|
||||
TRY ( h5tpriv_close_step ( f ) );
|
||||
TRY ( h5priv_close_hdf5_group ( f, f->step_gid ) );
|
||||
if (f->step_gid < 0) return H5_SUCCESS;
|
||||
TRY( h5tpriv_close_step (f) );
|
||||
TRY( h5priv_close_hdf5_group (f, f->step_gid) );
|
||||
|
||||
f->step_gid = -1;
|
||||
|
||||
@@ -207,7 +206,7 @@ h5priv_close_step (
|
||||
|
||||
h5_err_t
|
||||
_set_step (
|
||||
h5_file_t * f,
|
||||
h5_file_t* const f,
|
||||
const h5_int64_t step_idx /*!< [in] Step to set. */
|
||||
) {
|
||||
f->step_idx = step_idx;
|
||||
@@ -215,27 +214,27 @@ _set_step (
|
||||
sprintf (
|
||||
f->step_name,
|
||||
"%s#%0*lld",
|
||||
f->prefix_step_name, f->width_step_idx, (long long) f->step_idx );
|
||||
f->prefix_step_name, f->width_step_idx, (long long) f->step_idx);
|
||||
h5_info (
|
||||
f,
|
||||
"Proc[%d]: Open step #%lld for file %lld",
|
||||
f->myproc,
|
||||
(long long)f->step_idx,
|
||||
(long long)(size_t) f );
|
||||
TRY ( f->step_gid = h5priv_open_group ( f, f->file, f->step_name ) );
|
||||
(long long)(size_t) f);
|
||||
TRY ( f->step_gid = h5priv_open_group (f, f->file, f->step_name) );
|
||||
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
h5_int64_t
|
||||
h5_set_step (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
h5_file_t* const f, /*!< [in] Handle to open file */
|
||||
const h5_int64_t step_idx /*!< [in] Step to set. */
|
||||
) {
|
||||
|
||||
TRY ( h5priv_close_step ( f ) );
|
||||
TRY ( _set_step ( f, step_idx ) );
|
||||
TRY ( _init_step ( f ) );
|
||||
TRY( h5priv_close_step (f) );
|
||||
TRY( _set_step (f, step_idx) );
|
||||
TRY( _init_step (f) );
|
||||
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
@@ -245,18 +244,18 @@ h5_set_step (
|
||||
*/
|
||||
hid_t
|
||||
h5_normalize_h5_type (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
hid_t type
|
||||
) {
|
||||
H5T_class_t tclass = H5Tget_class ( type );
|
||||
int size = H5Tget_size ( type );
|
||||
H5T_class_t tclass = H5Tget_class (type);
|
||||
int size = H5Tget_size (type);
|
||||
|
||||
switch ( tclass ){
|
||||
switch (tclass){
|
||||
case H5T_INTEGER:
|
||||
if ( size==8 ) {
|
||||
if (size==8) {
|
||||
return H5T_NATIVE_INT64;
|
||||
}
|
||||
else if ( size==1 ) {
|
||||
else if (size==1) {
|
||||
return H5T_NATIVE_CHAR;
|
||||
}
|
||||
break;
|
||||
@@ -265,7 +264,7 @@ h5_normalize_h5_type (
|
||||
default:
|
||||
; /* NOP */
|
||||
}
|
||||
h5_warn ( f, "Unknown type %d", (int)type );
|
||||
h5_warn (f, "Unknown type %d", (int)type);
|
||||
|
||||
return -1;
|
||||
}
|
||||
@@ -273,30 +272,30 @@ h5_normalize_h5_type (
|
||||
|
||||
h5_int64_t
|
||||
h5_get_dataset_type(
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
hid_t group_id,
|
||||
const char *dset_name
|
||||
const char* dset_name
|
||||
) {
|
||||
hid_t dset_id;
|
||||
hid_t hdf5_type;
|
||||
|
||||
TRY( dset_id = h5priv_open_hdf5_dataset ( f, group_id, dset_name ) );
|
||||
TRY ( hdf5_type = h5priv_get_hdf5_dataset_type ( f, dset_id ) );
|
||||
h5_int64_t type = (h5_int64_t) h5_normalize_h5_type ( f, hdf5_type );
|
||||
TRY( h5priv_close_hdf5_type( f, hdf5_type ) );
|
||||
TRY( h5priv_close_hdf5_dataset( f, dset_id ) );
|
||||
TRY( dset_id = h5priv_open_hdf5_dataset (f, group_id, dset_name) );
|
||||
TRY( hdf5_type = h5priv_get_hdf5_dataset_type (f, dset_id) );
|
||||
h5_int64_t type = (h5_int64_t)h5_normalize_h5_type (f, hdf5_type);
|
||||
TRY( h5priv_close_hdf5_type (f, hdf5_type) );
|
||||
TRY( h5priv_close_hdf5_dataset (f, dset_id) );
|
||||
|
||||
return type;
|
||||
returntype;
|
||||
}
|
||||
|
||||
h5_int64_t
|
||||
h5_has_index (
|
||||
h5_file_t *f, /*!< [in] Handle to open file */
|
||||
h5_int64_t step /*!< [in] Step number to query */
|
||||
h5_file_t* const f, /*!< [in] Handle to open file */
|
||||
h5_int64_t step /*!< [in] Step number to query */
|
||||
) {
|
||||
char name[128];
|
||||
sprintf ( name,
|
||||
"%s#%0*lld",
|
||||
f->prefix_step_name, f->width_step_idx, (long long) step );
|
||||
return ( H5Gget_objinfo( f->file, name, 1, NULL ) >= 0 );
|
||||
sprintf (name,
|
||||
"%s#%0*lld",
|
||||
f->prefix_step_name, f->width_step_idx, (long long)step);
|
||||
return (H5Gget_objinfo(f->file, name, 1, NULL) >= 0);
|
||||
}
|
||||
|
||||
@@ -1,39 +1,39 @@
|
||||
#ifndef __H5_SYSCALL_H
|
||||
#define __H5_SYSCALL_H
|
||||
|
||||
void *
|
||||
void*
|
||||
h5priv_alloc (
|
||||
h5_file_t * const f,
|
||||
void *ptr,
|
||||
h5_file_t* const f,
|
||||
void* ptr,
|
||||
const size_t size
|
||||
);
|
||||
|
||||
void *
|
||||
void*
|
||||
h5priv_calloc (
|
||||
h5_file_t * const f,
|
||||
h5_file_t* const f,
|
||||
const size_t count,
|
||||
const size_t size
|
||||
);
|
||||
|
||||
h5_err_t
|
||||
h5priv_free (
|
||||
h5_file_t * const f,
|
||||
void *ptr
|
||||
h5_file_t* const f,
|
||||
void* ptr
|
||||
);
|
||||
|
||||
void *
|
||||
void*
|
||||
h5priv_tsearch (
|
||||
h5_file_t * const f,
|
||||
const void *key,
|
||||
void **rootp,
|
||||
int (*compar) (const void *key1, const void *key2)
|
||||
h5_file_t* const f,
|
||||
const void* key,
|
||||
void** rootp,
|
||||
int (*compar) (const void* key1, const void* key2)
|
||||
);
|
||||
|
||||
void *
|
||||
void*
|
||||
h5priv_tfind (
|
||||
h5_file_t * const f,
|
||||
const void *key,
|
||||
void *const *rootp,
|
||||
int (*compar) (const void *key1, const void *key2)
|
||||
h5_file_t* const f,
|
||||
const void* key,
|
||||
void *const* rootp,
|
||||
int (*compar) (const void* key1, const void* key2)
|
||||
);
|
||||
#endif
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
#define __H5B_ERRORHANDLING_PRIVATE_H
|
||||
|
||||
#define CHECK_LAYOUT( f ) \
|
||||
if ( ! f->b->have_layout ) \
|
||||
if (! f->b->have_layout) \
|
||||
return h5_error( \
|
||||
f, \
|
||||
H5_ERR_LAYOUT, \
|
||||
"No layout defined." )
|
||||
H5_ERR_LAYOUT, \
|
||||
"No layout defined.")
|
||||
|
||||
#define HANDLE_H5_LAYOUT_ERR( f ) \
|
||||
h5_error( \
|
||||
f, \
|
||||
H5_ERR_LAYOUT, \
|
||||
"Bad layout." );
|
||||
H5_ERR_LAYOUT, \
|
||||
"Bad layout.");
|
||||
|
||||
#endif
|
||||
|
||||
@@ -15,8 +15,8 @@ struct h5b_fdata {
|
||||
h5_size_t i_max;
|
||||
h5_size_t j_max;
|
||||
h5_size_t k_max;
|
||||
struct h5b_partition *user_layout;
|
||||
struct h5b_partition *write_layout;
|
||||
struct h5b_partition* user_layout;
|
||||
struct h5b_partition* write_layout;
|
||||
int have_layout;
|
||||
h5_size_t chunk[3];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user