added const to pass-by-value function parameters; worked more to attributes API

This commit is contained in:
Marc Howison
2010-06-29 15:27:25 +00:00
parent fa806cf273
commit e06dc187c7
17 changed files with 407 additions and 452 deletions
+2 -1
View File
@@ -374,7 +374,7 @@ src/C/H5Fed_retrieve.c -text
src/C/H5Fed_store.c -text
src/C/H5Fed_tags.c -text
src/C/H5Part.c -text
src/C/H5_attrib.c -text
src/C/H5_attribs.c -text
src/C/H5_inquiry.c -text
src/C/Makefile.am -text
src/Fortran/H5BlockF.c -text
@@ -458,6 +458,7 @@ src/include/H5Fed_retrieve.h -text
src/include/H5Fed_store.h -text
src/include/H5Fed_tags.h -text
src/include/H5Part.h -text
src/include/H5_attribs.h -text
src/include/H5_inquiry.h -text
src/include/h5core/h5_attribs.h -text
src/include/h5core/h5_core.h -text
-329
View File
@@ -1,329 +0,0 @@
/********************** attribute API ****************************************/
/*!
\ingroup h5part_c_api
\defgroup h5part_c_api_attrib Reading and Writing Attributes
*/
/*!
\ingroup h5part_c_api_attrib
Writes a string attribute bound to a file.
This function creates a new attribute \c name with the string \c value as
content. The attribute is bound to the file associated with the file handle
\c f.
If the attribute already exists an error will be returned. There
is currently no way to change the content of an existing attribute.
\return \c H5_SUCCESS or error code
*/
h5_int64_t
H5PartWriteFileAttribString (
h5_file_t *f, /*!< [in] Handle to open file */
const char *attrib_name,/*!< [in] Name of attribute to create */
const char *attrib_value/*!< [in] Value of attribute */
) {
SET_FNAME ( f, __func__ );
if ( h5_check_filehandle ( f ) != H5_SUCCESS )
return h5_get_errno( f );
return h5_write_attrib (
f,
f->root_gid,
attrib_name,
H5T_NATIVE_CHAR,
attrib_value,
strlen ( attrib_value ) + 1 );
}
/*!
\ingroup h5part_c_api_attrib
Writes a string attribute bound to the current time-step.
This function creates a new attribute \c name with the string \c value as
content. The attribute is bound to the current time step in the file given
by the file handle \c f.
If the attribute already exists an error will be returned. There
is currently no way to change the content of an existing attribute.
\return \c H5_SUCCESS or error code
*/
h5_int64_t
H5PartWriteStepAttribString (
h5_file_t *f, /*!< [in] Handle to open file */
const char *attrib_name,/*!< [in] Name of attribute to create */
const char *attrib_value/*!< [in] Value of attribute */
) {
SET_FNAME ( f, __func__ );
if ( h5_check_filehandle ( f ) != H5_SUCCESS )
return h5_get_errno( f );
return h5_write_attrib (
f,
f->step_gid,
attrib_name,
H5T_NATIVE_CHAR,
attrib_value,
strlen ( attrib_value ) + 1 );
}
/*!
\ingroup h5part_c_api_attrib
Writes a attribute bound to the current time-step.
This function creates a new attribute \c name with the string \c value as
content. The attribute is bound to the current time step in the file given
by the file handle \c f.
The value of the attribute is given the parameter \c type, which must be one
of \c H5T_NATIVE_DOUBLE, \c H5T_NATIVE_INT64 of \c H5T_NATIVE_CHAR, the array
\c value and the number of elements \c nelem in the array.
If the attribute already exists an error will be returned. There
is currently no way to change the content of an existing attribute.
\return \c H5_SUCCESS or error code
*/
h5_int64_t
H5PartWriteStepAttrib (
h5_file_t *f, /*!< [in] Handle to open file */
const char *attrib_name, /*!< [in] Name of attribute */
const h5_int64_t attrib_type,/*!< [in] Type of value. */
const void *attrib_value, /*!< [in] Value of attribute */
const h5_int64_t attrib_nelem/*!< [in] Number of elements */
){
SET_FNAME ( f, __func__ );
if ( h5_check_filehandle ( f ) != H5_SUCCESS )
return h5_get_errno( f );
return h5_write_attrib (
f,
f->step_gid,
attrib_name,
(hid_t)attrib_type,
attrib_value,
attrib_nelem );
}
/*!
\ingroup h5part_c_api_attrib
Writes a attribute bound to a file.
This function creates a new attribute \c name with the string \c value as
content. The attribute is bound to the file file given by the file handle
\c f.
The value of the attribute is given the parameter \c type, which must be one
of H5T_NATIVE_DOUBLE, H5T_NATIVE_INT64 of H5T_NATIVE_CHAR, the array \c value
and the number of elements \c nelem in the array.
If the attribute already exists an error will be returned. There
is currently no way to change the content of an existing attribute.
\return \c H5_SUCCESS or error code
*/
h5_int64_t
H5PartWriteFileAttrib (
h5_file_t *f, /*!< [in] Handle to open file */
const char *attrib_name, /*!< [in] Name of attribute */
const h5_int64_t attrib_type,/*!< [in] Type of value. */
const void *attrib_value, /*!< [in] Value of attribute */
const h5_int64_t attrib_nelem/*!< [in] Number of elements */
) {
SET_FNAME ( f, __func__ );
if ( h5_check_filehandle ( f ) != H5_SUCCESS )
return h5_get_errno( f );
return h5_write_attrib (
f,
f->root_gid,
attrib_name,
(hid_t)attrib_type,
attrib_value,
attrib_nelem );
}
/*!
\ingroup h5part_c_api_attrib
Gets the number of attributes bound to the current step.
\return Number of attributes bound to current time step or error code.
*/
h5_int64_t
H5PartGetNumStepAttribs (
h5_file_t *f /*!< [in] Handle to open file */
) {
SET_FNAME ( f, __func__ );
if ( h5_check_filehandle ( f ) != H5_SUCCESS )
return h5_get_errno( f );
return h5_get_num_attribs ( f, f->step_gid );
}
/*!
\ingroup h5part_c_api_attrib
Gets the number of attributes bound to the file.
\return Number of attributes bound to file \c f or error code.
*/
h5_int64_t
H5PartGetNumFileAttribs (
h5_file_t *f /*!< [in] Handle to open file */
) {
SET_FNAME ( f, __func__ );
if ( h5_check_filehandle ( f ) != H5_SUCCESS )
return h5_get_errno( f );
return h5_get_num_attribs ( f, f->root_gid );
}
/*!
\ingroup h5part_c_api_attrib
Gets the name, type and number of elements of the step attribute
specified by its index.
This function can be used to retrieve all attributes bound to the
current time-step by looping from \c 0 to the number of attribute
minus one. The number of attributes bound to the current
time-step can be queried by calling the function
\c H5PartGetNumStepAttribs().
\return \c H5_SUCCESS or error code
*/
h5_int64_t
H5PartGetStepAttribInfo (
h5_file_t *f, /*!< [in] Handle to open file */
const h5_int64_t attrib_idx,/*!< [in] Index of attribute to
get infos about */
char *attrib_name, /*!< [out] Name of attribute */
const h5_int64_t len_of_attrib_name,
/*!< [in] length of buffer \c name */
h5_int64_t *attrib_type, /*!< [out] Type of value. */
h5_int64_t *attrib_nelem /*!< [out] Number of elements */
) {
SET_FNAME ( f, __func__ );
if ( h5_check_filehandle ( f ) != H5_SUCCESS )
return h5_get_errno( f );
return h5_get_attrib_info (
f,
f->step_gid,
attrib_idx,
attrib_name,
len_of_attrib_name,
attrib_type,
attrib_nelem );
}
/*!
\ingroup h5part_c_api_attrib
Gets the name, type and number of elements of the file attribute
specified by its index.
This function can be used to retrieve all attributes bound to the
file \c f by looping from \c 0 to the number of attribute minus
one. The number of attributes bound to file \c f can be queried
by calling the function \c H5PartGetNumFileAttribs().
\return \c H5_SUCCESS or error code
*/
h5_int64_t
H5PartGetFileAttribInfo (
h5_file_t *f, /*!< [in] Handle to open file */
const h5_int64_t attrib_idx,/*!< [in] Index of attribute to get
infos about */
char *attrib_name, /*!< [out] Name of attribute */
const h5_int64_t len_of_attrib_name,
/*!< [in] length of buffer \c name */
h5_int64_t *attrib_type, /*!< [out] Type of value. */
h5_int64_t *attrib_nelem /*!< [out] Number of elements */
) {
SET_FNAME ( f, __func__ );
if ( h5_check_filehandle ( f ) != H5_SUCCESS )
return h5_get_errno ( f );
return h5_get_attrib_info (
f,
f->root_gid,
attrib_idx,
attrib_name,
len_of_attrib_name,
attrib_type,
attrib_nelem );
}
/*!
\ingroup h5part_c_api_attrib
Reads an attribute bound to current time-step.
\return \c H5_SUCCESS or error code
*/
h5_int64_t
H5PartReadStepAttrib (
h5_file_t *f, /*!< [in] Handle to open file */
const char *attrib_name, /*!< [in] Name of attribute to read */
void *attrib_value /*!< [out] Value of attribute */
) {
SET_FNAME ( f, __func__ );
if ( h5_check_filehandle ( f ) != H5_SUCCESS )
return h5_get_errno ( f );
return h5_read_attrib ( f, f->step_gid, attrib_name, attrib_value );
}
/*!
\ingroup h5part_c_api_attrib
Reads an attribute bound to file \c f.
\return \c H5_SUCCESS or error code
*/
h5_int64_t
H5PartReadFileAttrib (
h5_file_t *f,
const char *attrib_name,
void *attrib_value
) {
SET_FNAME ( f, __func__ );
if ( h5_check_filehandle ( f ) != H5_SUCCESS )
return h5_get_errno ( f );
return h5_read_attrib ( f, f->root_gid, attrib_name, attrib_value );
}
+186
View File
@@ -0,0 +1,186 @@
#include <string.h>
#include "h5core/h5_core.h"
#include "H5.h"
/********************** attribute API ****************************************/
/*!
\ingroup h5_attrib
Writes an attribute \c name with the string \c value to
the file root ("/").
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5WriteFileAttribString (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
const char *value /*!< [in] Value of attribute */
) {
SET_FNAME( f, __func__ );
if ( h5_check_filehandle ( f ) != H5_SUCCESS )
return h5_get_errno( f );
return h5_write_attrib (
f,
H5_ATTRIB_FILE,
name,
H5T_NATIVE_CHAR,
value,
strlen(value) + 1 );
}
/*!
\ingroup h5_attrib
Writes an attribute \c name with the string \c value to
the current timestep.
\return \c H5_SUCCESS or error code
*/
h5_err_t
H5WriteStepAttribString (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
const char *value /*!< [in] Value of attribute */
) {
SET_FNAME ( f, __func__ );
if ( h5_check_filehandle ( f ) != H5_SUCCESS )
return h5_get_errno( f );
return h5_write_attrib (
f,
H5_ATTRIB_STEP,
name,
H5T_NATIVE_CHAR,
value,
strlen(value) + 1 );
}
/*!
\ingroup h5_attrib
Gets the number of attributes in the file's root ("/").
\return Number of attributes or error code.
*/
h5_int64_t
H5GetNumFileAttribs (
h5_file_t *const f /*!< [in] Handle to open file */
) {
SET_FNAME( f, __func__ );
if ( h5_check_filehandle ( f ) != H5_SUCCESS )
return h5_get_errno( f );
return h5_get_num_attribs ( f, H5_ATTRIB_FILE );
}
/*!
\ingroup h5_attrib
Gets the number of attributes bound to the current step.
\return Number of attributes or error code.
*/
h5_int64_t
H5GetNumStepAttribs (
h5_file_t *const f /*!< [in] Handle to open file */
) {
SET_FNAME( f, __func__ );
if ( h5_check_filehandle ( f ) != H5_SUCCESS )
return h5_get_errno( f );
return h5_get_num_attribs ( f, H5_ATTRIB_STEP );
}
/*!
\ingroup h5_attrib
Gets the name, type and number of elements of the file attribute
specified by its index.
This function can be used to retrieve all attributes bound to the
file \c f by looping from \c 0 to the number of attribute minus
one. The number of attributes bound to file \c f can be queried
by calling the function \c H5GetNumFileAttribs().
\return \c H5_SUCCESS or error code
*/
h5_int64_t
H5GetFileAttribInfo (
h5_file_t *const f, /*!< [in] Handle to open file */
const h5_int64_t attrib_idx, /*!< [in] Index of attribute to get
infos about */
char *attrib_name, /*!< [out] Name of attribute */
const h5_int64_t len_of_attrib_name,
/*!< [in] length of buffer \c name */
h5_int64_t *attrib_type, /*!< [out] Type of value. */
h5_int64_t *attrib_nelem /*!< [out] Number of elements */
) {
SET_FNAME ( f, __func__ );
if ( h5_check_filehandle ( f ) != H5_SUCCESS )
return h5_get_errno ( f );
return h5_get_attrib_info (
f,
H5_ATTRIB_FILE,
attrib_idx,
attrib_name,
len_of_attrib_name,
attrib_type,
attrib_nelem );
}
/*!
\ingroup h5_attrib
Gets the name, type and number of elements of the step attribute
specified by its index.
This function can be used to retrieve all attributes bound to the
current time-step by looping from \c 0 to the number of attribute
minus one. The number of attributes bound to the current
time-step can be queried by calling the function
\c H5GetNumStepAttribs().
\return \c H5_SUCCESS or error code
*/
h5_int64_t
H5GetStepAttribInfo (
h5_file_t *const f, /*!< [in] Handle to open file */
const h5_int64_t attrib_idx, /*!< [in] Index of attribute to
get infos about */
char *attrib_name, /*!< [out] Name of attribute */
const h5_int64_t len_of_attrib_name,
/*!< [in] length of buffer \c name */
h5_int64_t *attrib_type, /*!< [out] Type of value. */
h5_int64_t *attrib_nelem /*!< [out] Number of elements */
) {
SET_FNAME ( f, __func__ );
if ( h5_check_filehandle ( f ) != H5_SUCCESS )
return h5_get_errno( f );
return h5_get_attrib_info (
f,
H5_ATTRIB_STEP,
attrib_idx,
attrib_name,
len_of_attrib_name,
attrib_type,
attrib_nelem );
}
+2
View File
@@ -44,6 +44,7 @@ EXTRA_LIBRARIES = libH5.a
# Header files that I wish to install in $(prefix)/include
include_HEADERS = \
../include/H5.h \
../include/H5_attribs.h \
../include/H5Block.h \
../include/H5Fed.h \
../include/H5Fed_store.h \
@@ -56,6 +57,7 @@ EXTRA_HEADERS =
# Listing of sources
libH5_a_SOURCES = \
H5.c \
H5_attribs.c \
H5_inquiry.c \
H5Block.c \
H5Fed.c \
+28 -9
View File
@@ -1,11 +1,18 @@
#include "h5_core.h"
#include "h5_core_private.h"
/*!
\ingroup h5_core
\defgroup h5_core_attrib Attribute handling
static h5_err_t
_get_hdf5_obj_id(
h5_file_t *const f,
const char type,
hid_t *id
) {
if (type == H5_ATTRIB_FILE) *id = f->root_gid;
else if (type == H5_ATTRIB_STEP) *id = f->step_gid;
else h5_error(f, H5_ERR_INVAL, "Attibute flag not recognized");
return H5_SUCCESS;
}
*/
/*!
\ingroup h5_core_attrib
@@ -18,7 +25,7 @@
h5_err_t
h5_read_attrib (
h5_file_t* const f, /*!< handle to open file */
const hid_t id, /*!< id of HDF5 object */
const char type, /*!< FILE or STEP flag */
const char* attrib_name, /*!< name of HDF5 attribute to read */
void* const attrib_value /*!< OUT: attribute value */
) {
@@ -28,6 +35,9 @@ h5_read_attrib (
hid_t mytype;
hsize_t nelem;
hid_t id;
TRY( _get_hdf5_obj_id(f, type, &id) );
TRY( attrib_id = h5priv_open_hdf5_attribute (f, id, attrib_name) );
TRY( mytype = h5priv_get_hdf5_attribute_type (f, attrib_id) );
TRY( space_id = h5priv_get_hdf5_attribute_dataspace (f, attrib_id) );
@@ -51,7 +61,7 @@ h5_read_attrib (
h5_err_t
h5_write_attrib (
h5_file_t* const f, /*!< handle to open file */
const hid_t id, /*!< id of HDF5 object */
const char type, /*!< FILE or STEP flag */
const char* attrib_name, /*!< name of HDF5 attribute to write */
const hid_t attrib_type, /*!< HDF5 type of attribute */
const void* attrib_value, /*!< value of attribute */
@@ -60,6 +70,9 @@ h5_write_attrib (
hid_t space_id;
hid_t attrib_id;
hid_t id;
TRY( _get_hdf5_obj_id(f, type, &id) );
TRY( space_id = h5priv_create_hdf5_dataspace (f, 1, &attrib_nelem, NULL) );
TRY( attrib_id = h5priv_create_hdf5_attribute (
f,
@@ -86,7 +99,7 @@ h5_write_attrib (
h5_err_t
h5_get_attrib_info (
h5_file_t* const f, /*!< handle to open file */
const hid_t id, /*!< id of HDF5 object */
const char type, /*!< FILE or STEP flag */
const h5_int64_t attrib_idx, /*!< index of attribute */
char* attrib_name, /*!< OUT: name of attribute */
const h5_int64_t len_attrib_name, /*!< buffer length */
@@ -97,6 +110,9 @@ h5_get_attrib_info (
hid_t mytype;
hid_t space_id;
hid_t id;
TRY( _get_hdf5_obj_id(f, type, &id) );
TRY( attrib_id = h5priv_open_hdf5_attribute_idx (
f,
id,
@@ -134,9 +150,12 @@ h5_get_attrib_info (
*/
h5_ssize_t
h5_get_num_attribs (
h5_file_t* f, /*!< handle to open file */
const hid_t id
h5_file_t *const f, /*!< handle to open file */
const char type /*!< FILE or STEP flag */
) {
CHECK_FILEHANDLE (f);
hid_t id;
TRY( _get_hdf5_obj_id(f, type, &id) );
return h5priv_get_num_hdf5_attribute (f, id);
}
+30 -30
View File
@@ -5,8 +5,8 @@
#include "h5_core.h"
#include "h5_core_private.h"
static h5_errorhandler_t h5priv_errhandler = h5_report_errorhandler;
static h5_int32_t h5priv_debuglevel = 0;
static h5_errorhandler_t h5priv_errhandler = h5_report_errorhandler;
static h5_int32_t h5priv_debug_level = 0;
/*!
\ingroup h5_core
@@ -34,11 +34,11 @@ const char* const H5_O_MODES[] = {
\return \c H5_ERR_INVAL if debug level is invalid.
*/
h5_err_t
h5_set_debuglevel (
h5_id_t debuglevel /*!< debug level */
h5_set_debug_level (
const h5_id_t level /*!< debug level */
) {
if (debuglevel < 0 || debuglevel > 5) return H5_ERR_INVAL;
h5priv_debuglevel = debuglevel;
if (level < 0 || level > 5) return H5_ERR_INVAL;
h5priv_debug_level = level;
return H5_SUCCESS;
}
@@ -50,10 +50,10 @@ h5_set_debuglevel (
\return current debug level
*/
h5_id_t
h5_get_debuglevel (
h5_get_debug_level (
void
) {
return h5priv_debuglevel;
return h5priv_debug_level;
}
/*!
@@ -65,7 +65,7 @@ h5_get_debuglevel (
*/
h5_err_t
h5_set_errorhandler (
h5_errorhandler_t handler
const h5_errorhandler_t handler
) {
h5priv_errhandler = handler;
return H5_SUCCESS;
@@ -94,7 +94,7 @@ h5_get_errorhandler (
*/
h5_err_t
h5_get_errno (
h5_file_t* const f
const h5_file_t* const f
) {
return f->__errno;
}
@@ -109,9 +109,9 @@ h5_get_errno (
void
h5_set_errno (
h5_file_t* const f,
h5_err_t h5_errno
const h5_err_t errno
) {
f->__errno = h5_errno;
f->__errno = errno;
}
@@ -125,12 +125,12 @@ h5_set_errno (
*/
h5_err_t
h5_report_errorhandler (
h5_file_t* const f,
const h5_file_t* const f,
const char* fmt,
va_list ap
) {
if (h5priv_debuglevel > 0) {
if (h5priv_debug_level > 0) {
h5_verror (f, fmt, ap);
}
return f->__errno;
@@ -144,12 +144,12 @@ h5_report_errorhandler (
*/
h5_err_t
h5_abort_errorhandler (
h5_file_t* const f,
const h5_file_t* const f,
const char* fmt,
va_list ap
) {
if (h5priv_debuglevel > 0) {
if (h5priv_debug_level > 0) {
h5_verror (f, fmt, ap);
}
exit (-(int)f->__errno);
@@ -183,7 +183,7 @@ _vprintf (
h5_err_t
h5_error (
h5_file_t* const f,
h5_err_t __errno,
const h5_err_t __errno,
const char* fmt,
...
) {
@@ -204,12 +204,12 @@ h5_error (
*/
void
h5_verror (
h5_file_t* const f,
const h5_file_t* const f,
const char* fmt,
va_list ap
) {
if (h5priv_debuglevel < 1) return;
if (h5priv_debug_level < 1) return;
_vprintf (stderr, "E", f->__funcname, fmt, ap);
}
@@ -221,11 +221,11 @@ h5_verror (
*/
void
h5_vwarn (
h5_file_t* const f,
const h5_file_t* const f,
const char* fmt,
va_list ap
) {
if (h5priv_debuglevel < 2) return;
if (h5priv_debug_level < 2) return;
_vprintf (stderr, "W", f->__funcname, fmt, ap);
}
@@ -236,8 +236,8 @@ h5_vwarn (
*/
void
h5_warn (
h5_file_t* const f,
const char* fmt,
const h5_file_t* const f,
const char* fmt,
...
) {
va_list ap;
@@ -253,11 +253,11 @@ h5_file_t* const f,
*/
void
h5_vinfo (
h5_file_t* const f,
const h5_file_t* const f,
const char* fmt,
va_list ap
) {
if (h5priv_debuglevel < 3) return;
if (h5priv_debug_level < 3) return;
_vprintf (stdout, "I", f->__funcname, fmt, ap);
}
@@ -268,7 +268,7 @@ h5_vinfo (
*/
void
h5_info (
h5_file_t* const f,
const h5_file_t* const f,
const char* fmt,
...
) {
@@ -285,11 +285,11 @@ h5_info (
*/
void
h5_vdebug (
h5_file_t* const f,
const h5_file_t* const f,
const char* fmt,
va_list ap
) {
if (h5priv_debuglevel < 4) return;
if (h5priv_debug_level < 4) return;
_vprintf (stdout, "D", f->__funcname, fmt, ap);
}
@@ -300,7 +300,7 @@ h5_vdebug (
*/
void
h5_debug (
h5_file_t* const f,
const h5_file_t* const f,
const char* fmt,
...
) {
@@ -330,7 +330,7 @@ h5_set_funcname (
*/
const char*
h5_get_funcname (
h5_file_t* const f
const h5_file_t* const f
) {
return f->__funcname;
}
+19 -3
View File
@@ -812,9 +812,9 @@ h5priv_get_hdf5_mdc_property (
h5_err_t
h5priv_set_hdf5_alignment_property (
h5_file_t* const f,
hid_t fapl_id,
hsize_t threshold,
hsize_t alignment
const hid_t fapl_id,
const hsize_t threshold,
const hsize_t alignment
) {
herr_t herr = H5Pset_alignment (fapl_id, threshold, alignment);
if (herr < 0)
@@ -826,6 +826,22 @@ h5priv_set_hdf5_alignment_property (
return H5_SUCCESS;
}
h5_err_t
h5priv_set_hdf5_btree_ik_property (
h5_file_t* const f,
const hid_t fcpl_id,
const hsize_t btree_ik
) {
herr_t herr = H5Pset_istore_k (fcpl_id, btree_ik);
if (herr < 0)
h5_error (
f,
H5_ERR_HDF5,
"Cannot set btree size in the "
"file access property list.");
return H5_SUCCESS;
}
h5_err_t
h5priv_close_hdf5_property (
h5_file_t* const f,
+10 -3
View File
@@ -272,9 +272,16 @@ h5priv_get_hdf5_mdc_property (
h5_err_t
h5priv_set_hdf5_alignment_property (
h5_file_t* const f,
hid_t fapl_id,
hsize_t threshold,
hsize_t alignment
const hid_t fapl_id,
const hsize_t threshold,
const hsize_t alignment
);
h5_err_t
h5priv_set_hdf5_btree_ik_property (
h5_file_t* const f,
const hid_t fcpl_id,
const hsize_t btree_ik
);
h5_err_t
+3 -3
View File
@@ -5,7 +5,7 @@
h5_err_t
h5priv_mpi_recv(
h5_file_t *f,
h5_file_t *const f,
void* buf,
const int count,
const MPI_Datatype type,
@@ -54,7 +54,7 @@ h5_err_t
h5priv_mpi_sum (
h5_file_t* const f,
void* sendbuf,
void* recvbuf,
void* recvbuf,
const int count,
const MPI_Datatype type,
const MPI_Comm comm
@@ -76,7 +76,7 @@ h5_err_t
h5priv_mpi_prefix_sum (
h5_file_t* const f,
void* sendbuf,
void* recvbuf,
void* recvbuf,
const int count,
const MPI_Datatype type,
const MPI_Comm comm
+6 -2
View File
@@ -191,10 +191,14 @@ h5priv_open_file (
// set alignment
lov_user_md lum;
llapi_file_get_stripe(filename, &lum);
h5_size_t stripe_size = (h5_size_t)lum.lmm_stripe_size;
h5info(f, "Found lustre stripe size of %llu bytes", stripe_size);
hsize_t stripe_size = (hsize_t)lum.lmm_stripe_size;
h5info(f, "Found lustre stripe size of %lld bytes", (long long)stripe_size);
TRY( h5priv_set_hdf5_alignment_property(f,
f->access_prop, 0, stripe_size) );
hsize_t btree_ik = (stripe_size - 4096) / 96;
hsize_t btree_bytes = 64 + 96*btree_ik;
h5info(f, "Using %lld bytes for HDF5 btree", (long long)btree_bytes);
TRY( h5priv_set_hdf5_btree_ik_property(f, f->create_prop, btree_ik) );
#endif
if (flags & H5_O_RDONLY) {
+11 -11
View File
@@ -280,15 +280,15 @@ h5_get_dataset_type(
return type;
}
h5_int64_t
h5_err_t
h5_has_index (
h5_file_t* const 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 */
const h5_int64_t step /*!< [in] Step number to query */
) {
char name[128];
char name[2*H5_STEPNAME_LEN];
sprintf (name,
"%s#%0*lld",
f->prefix_step_name, f->width_step_idx, (long long)step);
"%s#%0*lld",
f->prefix_step_name, f->width_step_idx, (long long)step);
return (H5Gget_objinfo(f->file, name, 1, NULL) >= 0);
}
@@ -305,14 +305,14 @@ h5_normalize_dataset_name (
strcpy ( name2, name );
}
return H5_SUCCESS;
return H5_SUCCESS;
}
#ifdef PARALLEL_IO
h5_err_t
h5_set_throttle (
h5_file_t* f,
int factor
h5_file_t* const f,
const int factor
) {
if ( (f->mode & H5_VFD_INDEPENDENT) || (f->mode & H5_VFD_MPIPOSIX) ) {
f->throttle = factor;
@@ -329,7 +329,7 @@ h5_set_throttle (
h5_err_t
h5_start_throttle (
h5_file_t *f
h5_file_t* const f
) {
if (f->throttle > 0) {
@@ -358,7 +358,7 @@ h5_start_throttle (
h5_err_t
h5_end_throttle (
h5_file_t *f
h5_file_t* const f
) {
if (f->throttle > 0) {
+18 -20
View File
@@ -3,7 +3,7 @@
h5_int64_t
h5u_get_num_particles (
h5_file_t *f /*!< [in] Handle to open file */
h5_file_t *const f /*!< [in] Handle to open file */
) {
h5_int64_t nparticles;
ssize_t exists;
@@ -72,13 +72,11 @@ h5u_get_num_particles (
return nparticles;
}
h5_int64_t
h5u_set_num_particles (
h5_file_t *f, /*!< [in] Handle to open file */
h5_int64_t nparticles, /*!< [in] Number of particles */
h5_int64_t stride /*!< [in] Stride of particles in memory */
h5_file_t *const f, /*!< [in] Handle to open file */
const h5_int64_t nparticles, /*!< [in] Number of particles */
const h5_int64_t stride /*!< [in] Stride of particles in memory */
) {
CHECK_FILEHANDLE( f );
struct h5u_fdata *u = f->u;
@@ -200,14 +198,14 @@ h5u_set_num_particles (
h5_int64_t
h5u_has_view (
h5_file_t *f
const h5_file_t *const f
) {
return ( f->u->viewindexed || ( f->u->viewstart >= 0 && f->u->viewend >= 0 ));
}
h5_err_t
h5u_reset_view (
h5_file_t *f
h5_file_t *const f
) {
struct h5u_fdata *u = f->u;
@@ -225,9 +223,9 @@ h5u_reset_view (
h5_err_t
h5u_set_view (
h5_file_t *f, /*!< [in] Handle to open file */
h5_file_t *const f, /*!< [in] Handle to open file */
h5_int64_t start, /*!< [in] Start particle */
h5_int64_t end /*!< [in] End particle */
h5_int64_t end /*!< [in] End particle */
) {
h5_int64_t herr = 0;
@@ -308,9 +306,9 @@ h5u_set_view (
h5_int64_t
h5u_set_view_indices (
h5_file_t *f, /*!< [in] Handle to open file */
const h5_int64_t *indices, /*!< [in] List of indices */
h5_int64_t nelems /*!< [in] Size of list */
h5_file_t *const f, /*!< [in] Handle to open file */
const h5_int64_t *const indices, /*!< [in] List of indices */
const h5_int64_t nelems /*!< [in] Size of list */
) {
hsize_t total;
@@ -375,7 +373,7 @@ h5u_set_view_indices (
h5_int64_t
h5u_get_view (
h5_file_t *f,
h5_file_t *const f,
h5_int64_t *start,
h5_int64_t *end
) {
@@ -410,7 +408,7 @@ h5u_get_view (
h5_int64_t
h5u_set_canonical_view (
h5_file_t *f
h5_file_t *const f
) {
TRY( h5u_reset_view ( f ) );
@@ -448,7 +446,7 @@ h5u_set_canonical_view (
h5_int64_t
h5u_get_num_datasets (
h5_file_t *f /*!< [in] Handle to open file */
h5_file_t *const f /*!< [in] Handle to open file */
) {
ssize_t n;
TRY ( n = h5_get_num_hdf5_datasets(f, f->step_gid ) );
@@ -460,8 +458,8 @@ h5u_get_num_datasets (
*/
h5_int64_t
h5u_get_dataset_info (
h5_file_t *f, /*!< [in] Handle to open file */
const h5_int64_t idx,/*!< [in] Index of the dataset */
h5_file_t *const f, /*!< [in] Handle to open file */
const h5_int64_t idx, /*!< [in] Index of the dataset */
char *dataset_name, /*!< [out] Name of dataset */
const h5_int64_t len_dataset_name,
/*!< [in] Size of buffer \c dataset_name */
@@ -493,8 +491,8 @@ h5u_get_dataset_info (
h5_err_t
h5u_set_chunk (
h5_file_t *f,
h5_size_t size
h5_file_t *const f,
const h5_size_t size
) {
if ( f->u->dcreate_prop == H5P_DEFAULT ) {
+48
View File
@@ -0,0 +1,48 @@
h5_err_t
H5WriteFileAttribString (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
const char *value /*!< [in] Value of attribute */
);
h5_err_t
H5WriteStepAttribString (
h5_file_t *const f, /*!< [in] Handle to open file */
const char *name, /*!< [in] Name of attribute to create */
const char *value /*!< [in] Value of attribute */
);
h5_int64_t
H5GetNumFileAttribs (
h5_file_t *const f /*!< [in] Handle to open file */
);
h5_int64_t
H5GetNumStepAttribs (
h5_file_t *const f /*!< [in] Handle to open file */
);
h5_int64_t
H5GetFileAttribInfo (
h5_file_t *const f, /*!< [in] Handle to open file */
const h5_int64_t attrib_idx, /*!< [in] Index of attribute to get
infos about */
char *attrib_name, /*!< [out] Name of attribute */
const h5_int64_t len_of_attrib_name,
/*!< [in] length of buffer \c name */
h5_int64_t *attrib_type, /*!< [out] Type of value. */
h5_int64_t *attrib_nelem /*!< [out] Number of elements */
);
h5_int64_t
H5GetStepAttribInfo (
h5_file_t *const f, /*!< [in] Handle to open file */
const h5_int64_t attrib_idx, /*!< [in] Index of attribute to
get infos about */
char *attrib_name, /*!< [out] Name of attribute */
const h5_int64_t len_of_attrib_name,
/*!< [in] length of buffer \c name */
h5_int64_t *attrib_type, /*!< [out] Type of value. */
h5_int64_t *attrib_nelem /*!< [out] Number of elements */
);
+9 -6
View File
@@ -1,10 +1,13 @@
#ifndef __H5_ATTRIBS_H
#define __H5_ATTRIBS_H
#define H5_ATTRIB_FILE 0
#define H5_ATTRIB_STEP 1
h5_int64_t
h5_read_attrib (
h5_file_t * const f,
hid_t id,
const char type,
const char *attrib_name,
void *attrib_value
);
@@ -12,7 +15,7 @@ h5_read_attrib (
h5_int64_t
h5_write_attrib (
h5_file_t * const f,
hid_t id,
const char type,
const char *attrib_name,
const hid_t attrib_type,
const void *attrib_value,
@@ -21,8 +24,8 @@ h5_write_attrib (
h5_int64_t
h5_get_attrib_info (
h5_file_t * const f,
hid_t id,
h5_file_t *const f,
const char type,
const h5_int64_t attrib_idx,
char *attrib_name,
const h5_int64_t len_attrib_name,
@@ -32,8 +35,8 @@ h5_get_attrib_info (
h5_ssize_t
h5_get_num_attribs (
h5_file_t * constf,
hid_t id
h5_file_t *const f,
const char type
);
#endif
+18 -18
View File
@@ -44,18 +44,18 @@
h5_err_t
h5_set_debuglevel (
h5_id_t debuglevel
h5_set_debug_level (
const h5_id_t level
);
h5_err_t
h5_get_debuglevel (
h5_get_debug_level (
void
);
h5_err_t
h5_set_errorhandler (
h5_errorhandler_t errorhandler
const h5_errorhandler_t errorhandler
);
h5_errorhandler_t
@@ -65,33 +65,33 @@ h5_get_errorhandler (
h5_err_t
h5_get_errno (
h5_file_t * const f
const h5_file_t * const f
);
void
h5_set_errno (
h5_file_t * const f,
h5_err_t h5_errno
const h5_err_t h5_errno
);
h5_err_t
h5_report_errorhandler (
h5_file_t * const f,
const h5_file_t * const f,
const char *fmt,
va_list ap
);
h5_err_t
h5_abort_errorhandler (
h5_file_t * const f,
const h5_file_t * const f,
const char *fmt,
va_list ap
) ;
);
h5_err_t
h5_error (
h5_file_t * const f,
h5_err_t error_no,
const h5_err_t error_no,
const char *fmt,
...
)
@@ -102,21 +102,21 @@ h5_error (
void
h5_verror (
h5_file_t * const f,
const h5_file_t * const f,
const char *fmt,
va_list ap
);
void
h5_vwarn (
h5_file_t * const f,
const h5_file_t * const f,
const char *fmt,
va_list ap
);
void
h5_warn (
h5_file_t * const f,
const h5_file_t * const f,
const char *fmt,
...
)
@@ -127,14 +127,14 @@ __attribute__ ((format (printf, 2, 3)))
void
h5_vinfo (
h5_file_t * const f,
const h5_file_t * const f,
const char *fmt,
va_list ap
);
void
h5_info (
h5_file_t * const f,
const h5_file_t * const f,
const char *fmt,
...
)
@@ -145,14 +145,14 @@ __attribute__ ((format (printf, 2, 3)))
void
h5_vdebug (
h5_file_t * const f,
const h5_file_t * const f,
const char *fmt,
va_list ap
);
void
h5_debug (
h5_file_t * const f,
const h5_file_t * const f,
const char *fmt,
...
)
@@ -169,7 +169,7 @@ h5_set_funcname (
const char *
h5_get_funcname (
h5_file_t * const f
const h5_file_t * const f
);
#endif
+1 -1
View File
@@ -57,7 +57,7 @@ struct h5_file;
typedef struct h5_file h5_file_t;
typedef h5_err_t (*h5_errorhandler_t)(
struct h5_file * const,
const struct h5_file * const,
const char*,
va_list ap );
+16 -16
View File
@@ -3,60 +3,60 @@
h5_int64_t
h5u_get_num_particles (
h5_file_t *f
h5_file_t *const f
);
h5_int64_t
h5u_set_num_particles (
h5_file_t *f,
h5_int64_t nparticles,
h5_int64_t stride
h5_file_t *const f,
const h5_int64_t nparticles,
const h5_int64_t stride
);
h5_int64_t
h5u_has_view (
h5_file_t *f
const h5_file_t *const f
);
h5_int64_t
h5u_reset_view (
h5_file_t *f
h5_file_t *const f
);
h5_int64_t
h5u_set_view (
h5_file_t *f,
h5_file_t *const f,
h5_int64_t start,
h5_int64_t end
);
h5_int64_t
h5u_set_view_indices (
h5_file_t *f,
const h5_int64_t *indices,
h5_int64_t nelems
h5_file_t *const f,
const h5_int64_t *const indices,
const h5_int64_t nelems
);
h5_int64_t
h5u_get_view (
h5_file_t *f,
h5_file_t *const f,
h5_int64_t *start,
h5_int64_t *end
);
h5_int64_t
h5u_set_canonical_view (
h5_file_t *f
h5_file_t *const f
);
h5_int64_t
h5u_get_num_datasets (
h5_file_t *f
h5_file_t *const f
);
h5_int64_t
h5u_get_dataset_info (
h5_file_t *f,
h5_file_t *const f,
const h5_int64_t idx,
char *dataset_name,
const h5_int64_t len_dataset_name,
@@ -66,8 +66,8 @@ h5u_get_dataset_info (
h5_err_t
h5u_set_chunk (
h5_file_t *f,
h5_size_t size
h5_file_t *const f,
const h5_size_t size
);
#endif