From 421a92630ac7a5919031b8c0b56498a2efcdac3e Mon Sep 17 00:00:00 2001 From: Marc Howison Date: Thu, 22 Jul 2010 20:32:52 +0000 Subject: [PATCH] refactored Fortran interface to use h5core calls instead of C API calls --- src/C/H5.c | 2 +- src/C/H5Part.c | 21 --- src/C/generate-h5b-readwrite.py | 53 +++---- src/Fortran/H5Block_F.c | 97 +++++++------ src/Fortran/H5Block_readwrite_F.c | 206 +++++++++++--------------- src/Fortran/H5Part.f90 | 8 -- src/Fortran/H5Part_F.c | 134 +++++++---------- src/Fortran/H5_F.c | 42 +++--- src/Fortran/H5_attribs_F.c | 232 +++++++++++++++++++----------- src/include/H5.h | 2 +- src/include/H5Part.h | 5 - 11 files changed, 379 insertions(+), 423 deletions(-) diff --git a/src/C/H5.c b/src/C/H5.c index ea37040..0aec62c 100644 --- a/src/C/H5.c +++ b/src/C/H5.c @@ -188,7 +188,7 @@ H5GetNumProcs ( \return number of time-steps or error code */ -h5_size_t +h5_ssize_t H5GetNumSteps ( h5_file_t* const f ) { diff --git a/src/C/H5Part.c b/src/C/H5Part.c index d13b508..50fe843 100644 --- a/src/C/H5Part.c +++ b/src/C/H5Part.c @@ -571,27 +571,6 @@ H5PartSetViewIndices ( return h5u_set_view_indices ( f, indices, nelems ); } -/*! - \ingroup h5part_model - - In MPI-IO collective mode, all MPI tasks must participate in I/O - operations. \c H5PartSetViewEmpty() allows a task to participate - but with an empty view of the file, so that it contributes no data - to the I/O operation. - - \return \c H5_SUCCESS or error code -*/ -h5_err_t -H5PartSetViewEmpty ( - h5_file_t *f /*!< [in] Handle to open file */ - ) { - - SET_FNAME( f, __func__ ); - - /* using a null indices list will set an empty view */ - return h5u_set_view_indices ( f, NULL, 0 ); -} - /*! \ingroup h5part_model diff --git a/src/C/generate-h5b-readwrite.py b/src/C/generate-h5b-readwrite.py index 23e3067..c065a6d 100755 --- a/src/C/generate-h5b-readwrite.py +++ b/src/C/generate-h5b-readwrite.py @@ -16,7 +16,7 @@ h_tail = """ fc_head = """ #include -#include "H5hut.h" +#include "h5core/h5_core.h" #include "Underscore.h" #if defined(F77_SINGLE_UNDERSCORE) @@ -137,12 +137,10 @@ h5bl_#DIM#d_write_scalar_field_#TYPE_F90_ABV# ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); - - h5_err_t herr = H5Block#DIM#dWriteScalarField#TYPE_ABV# ( - filehandle, field_name2, data ); - + h5_err_t herr = h5b_write_scalar_data ( + filehandle, field_name2, (void*)data, #TYPE_HDF5# ); free ( field_name2 ); return herr; } @@ -164,12 +162,10 @@ h5bl_#DIM#d_read_scalar_field_#TYPE_F90_ABV# ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); - - h5_err_t herr = H5Block#DIM#dWriteScalarField#TYPE_ABV# ( - filehandle, field_name2, data ); - + h5_err_t herr = h5b_read_scalar_data ( + filehandle, field_name2, data, #TYPE_HDF5# ); free ( field_name2 ); return herr; } @@ -303,12 +299,11 @@ h5bl_#DIM#d_write_vector3d_field_#TYPE_F90_ABV# ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); - - h5_err_t herr = H5Block#DIM#dWriteVector3dField#TYPE_ABV# ( - filehandle, field_name2, xval, yval, zval ); - + h5_err_t herr = h5b_write_vector3d_data ( + filehandle, field_name2, + (void*)xval, (void*)yval, (void*)zval, #TYPE_HDF5# ); free ( field_name2 ); return herr; } @@ -332,12 +327,11 @@ h5bl_#DIM#d_read_vector3d_field_#TYPE_F90_ABV# ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); - - h5_err_t herr = H5Block#DIM#dReadVector3dField#TYPE_ABV# ( - filehandle, field_name2, xval, yval, zval ); - + h5_err_t herr = h5b_read_vector3d_data ( + filehandle, field_name2, + (void*)xval, (void*)yval, (void*)zval, #TYPE_HDF5# ); free ( field_name2 ); return herr; } @@ -417,13 +411,12 @@ h5bl_writefieldattrib_#TYPE_F90_ABV# ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name ); - - h5_err_t herr = H5BlockWriteFieldAttrib#TYPE_ABV# ( - filehandle, field_name2, attrib_name2, values, *nvalues ); - + h5_err_t herr = h5_write_field_attrib ( + filehandle, field_name2, attrib_name2, + #TYPE_HDF5#, values, *nvalues ); free ( field_name2 ); free ( attrib_name2 ); return herr; @@ -499,13 +492,11 @@ h5bl_readfieldattrib_#TYPE_F90_ABV# ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name ); - - h5_err_t herr = H5BlockReadFieldAttrib#TYPE_ABV# ( - filehandle, field_name2, attrib_name2, values ); - + h5_err_t herr = h5_read_field_attrib ( + filehandle, field_name2, attrib_name2, #TYPE_HDF5#, values ); free ( field_name2 ); free ( attrib_name2 ); return herr; diff --git a/src/Fortran/H5Block_F.c b/src/Fortran/H5Block_F.c index 4e283f6..bfdc72f 100755 --- a/src/Fortran/H5Block_F.c +++ b/src/Fortran/H5Block_F.c @@ -1,6 +1,7 @@ #include +#include -#include "H5hut.h" +#include "h5core/h5_core.h" #include "Underscore.h" #if defined(F77_SINGLE_UNDERSCORE) @@ -61,8 +62,8 @@ h5bl_3d_setview ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - return H5Block3dSetView ( + h5_set_funcname( filehandle, __func__ ); + return h5b_3d_set_view ( filehandle, *i_start-1, *i_end-1, *j_start-1, *j_end-1, @@ -78,34 +79,36 @@ h5bl_3d_setchunk ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - return H5Block3dSetChunk ( filehandle, *i, *j, *k ); + h5_set_funcname( filehandle, __func__ ); + return h5b_3d_set_chunk ( filehandle, *i, *j, *k ); } h5_err_t h5bl_3d_getview ( - h5_int64_t *f, /*!< file handle */ - h5_int64_t *i_start, /*!< start index of i */ - h5_int64_t *i_end, /*!< end index of i */ - h5_int64_t *j_start, /*!< start index of j */ - h5_int64_t *j_end, /*!< end index of j */ - h5_int64_t *k_start, /*!< start index of k */ - h5_int64_t *k_end /*!< end index of k */ + h5_int64_t *f, + h5_int64_t *i_start, + h5_int64_t *i_end, + h5_int64_t *j_start, + h5_int64_t *j_end, + h5_int64_t *k_start, + h5_int64_t *k_end ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + h5_set_funcname( filehandle, __func__ ); + h5_size_t view[6]; - h5_err_t herr = H5Block3dGetView ( + h5_err_t herr = h5b_3d_get_view ( filehandle, - i_start, i_end, j_start, j_end, k_start, k_end ); + view+0, view+1, view+2, view+3, view+4, view+5 ); if ( herr < 0 ) return herr; - (*i_start)++; - (*i_end)++; - (*j_start)++; - (*j_end)++; - (*k_start)++; - (*k_end)++; + *i_start = view[0]+1; + *i_end = view[1]+1; + *j_start = view[2]+1; + *j_end = view[3]+1; + *k_start = view[4]+1; + *k_end = view[5]+1; return H5_SUCCESS; } @@ -122,18 +125,20 @@ h5bl_3d_getreducedview ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + h5_set_funcname( filehandle, __func__ ); + h5_size_t view[6]; - h5_err_t herr = H5Block3dGetReducedView ( + h5_err_t herr = h5b_3d_get_reduced_view ( filehandle, - i_start, i_end, j_start, j_end, k_start, k_end ); + view+0, view+1, view+2, view+3, view+4, view+5 ); if ( herr < 0 ) return herr; - (*i_start)++; - (*i_end)++; - (*j_start)++; - (*j_end)++; - (*k_start)++; - (*k_end)++; + *i_start = view[0]+1; + *i_end = view[1]+1; + *j_start = view[2]+1; + *j_end = view[3]+1; + *k_start = view[4]+1; + *k_end = view[5]+1; return H5_SUCCESS; } @@ -144,8 +149,8 @@ h5bl_3d_hasview ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - return H5Block3dHasView ( filehandle ); + h5_set_funcname( filehandle, __func__ ); + return h5b_3d_has_view ( filehandle ); } h5_err_t @@ -154,8 +159,8 @@ h5bl_getnumfields ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - return H5BlockGetNumFields ( filehandle ); + h5_set_funcname( filehandle, __func__ ); + return h5b_get_num_fields ( filehandle ); } h5_err_t @@ -163,18 +168,18 @@ h5bl_getfieldinfo ( h5_int64_t *f, const h5_int64_t *idx, char *field_name, - h5_size_t *grid_rank, - h5_size_t *grid_dims, + h5_size_t *field_rank, h5_size_t *field_dims, + h5_size_t *elem_rank, h5_int64_t *type, const int l_field_name ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - h5_err_t herr = H5BlockGetFieldInfo ( + h5_set_funcname( filehandle, __func__ ); + h5_err_t herr = h5b_get_field_info ( filehandle, *idx, field_name, l_field_name, - grid_rank, grid_dims, field_dims, type ); + field_rank, field_dims, elem_rank, type ); h5_strc2for ( field_name, l_field_name ); return herr; } @@ -191,13 +196,15 @@ h5bl_writefieldattrib_string ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + h5_set_funcname( filehandle, __func__ ); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name ); char *attrib_value2 = h5_strdupfor2c ( attrib_value, l_attrib_value ); - h5_err_t herr = H5BlockWriteFieldAttribString ( - filehandle, field_name2, attrib_name2, attrib_value2 ); + h5_err_t herr = h5_write_field_attrib ( + filehandle, field_name2, attrib_name2, + H5T_NATIVE_CHAR, attrib_value2, strlen(attrib_value2)+1 ); free ( field_name2 ); free ( attrib_name2 ); @@ -214,10 +221,11 @@ h5bl_getnfieldattribs ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + h5_set_funcname( filehandle, __func__ ); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); - h5_err_t herr = H5BlockGetNumFieldAttribs ( + h5_err_t herr = h5b_get_num_field_attribs ( filehandle, field_name2 ); free ( field_name2 ); @@ -236,12 +244,13 @@ h5bl_getfieldattribinfo ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + h5_set_funcname( filehandle, __func__ ); h5_int64_t attrib_type; char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); - h5_err_t herr = H5BlockGetFieldAttribInfo ( + h5_err_t herr = h5b_get_field_attrib_info ( filehandle, field_name2, *attrib_idx, attrib_name, l_attrib_name, &attrib_type, @@ -266,12 +275,14 @@ h5bl_readfieldattrib_string ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + h5_set_funcname( filehandle, __func__ ); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name ); - h5_err_t herr = H5BlockReadFieldAttribString ( - filehandle, field_name2, attrib_name2, attrib_value ); + h5_err_t herr = h5_read_field_attrib ( + filehandle, field_name2, attrib_name2, + H5_STRING_T, attrib_value ); h5_strc2for ( attrib_value, l_attrib_value ); diff --git a/src/Fortran/H5Block_readwrite_F.c b/src/Fortran/H5Block_readwrite_F.c index fcbccd3..f01b335 100644 --- a/src/Fortran/H5Block_readwrite_F.c +++ b/src/Fortran/H5Block_readwrite_F.c @@ -1,7 +1,7 @@ #include -#include "H5hut.h" +#include "h5core/h5_core.h" #include "Underscore.h" #if defined(F77_SINGLE_UNDERSCORE) @@ -28,12 +28,10 @@ h5bl_3d_write_scalar_field_r8 ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); - - h5_err_t herr = H5Block3dWriteScalarFieldFloat64 ( - filehandle, field_name2, data ); - + h5_err_t herr = h5b_write_scalar_data ( + filehandle, field_name2, (void*)data, H5T_NATIVE_DOUBLE ); free ( field_name2 ); return herr; } @@ -53,12 +51,10 @@ h5bl_3d_read_scalar_field_r8 ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); - - h5_err_t herr = H5Block3dWriteScalarFieldFloat64 ( - filehandle, field_name2, data ); - + h5_err_t herr = h5b_read_scalar_data ( + filehandle, field_name2, data, H5T_NATIVE_DOUBLE ); free ( field_name2 ); return herr; } @@ -80,12 +76,11 @@ h5bl_3d_write_vector3d_field_r8 ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); - - h5_err_t herr = H5Block3dWriteVector3dFieldFloat64 ( - filehandle, field_name2, xval, yval, zval ); - + h5_err_t herr = h5b_write_vector3d_data ( + filehandle, field_name2, + (void*)xval, (void*)yval, (void*)zval, H5T_NATIVE_DOUBLE ); free ( field_name2 ); return herr; } @@ -107,12 +102,11 @@ h5bl_3d_read_vector3d_field_r8 ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); - - h5_err_t herr = H5Block3dReadVector3dFieldFloat64 ( - filehandle, field_name2, xval, yval, zval ); - + h5_err_t herr = h5b_read_vector3d_data ( + filehandle, field_name2, + (void*)xval, (void*)yval, (void*)zval, H5T_NATIVE_DOUBLE ); free ( field_name2 ); return herr; } @@ -132,12 +126,10 @@ h5bl_3d_write_scalar_field_r4 ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); - - h5_err_t herr = H5Block3dWriteScalarFieldFloat32 ( - filehandle, field_name2, data ); - + h5_err_t herr = h5b_write_scalar_data ( + filehandle, field_name2, (void*)data, H5T_NATIVE_FLOAT ); free ( field_name2 ); return herr; } @@ -157,12 +149,10 @@ h5bl_3d_read_scalar_field_r4 ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); - - h5_err_t herr = H5Block3dWriteScalarFieldFloat32 ( - filehandle, field_name2, data ); - + h5_err_t herr = h5b_read_scalar_data ( + filehandle, field_name2, data, H5T_NATIVE_FLOAT ); free ( field_name2 ); return herr; } @@ -184,12 +174,11 @@ h5bl_3d_write_vector3d_field_r4 ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); - - h5_err_t herr = H5Block3dWriteVector3dFieldFloat32 ( - filehandle, field_name2, xval, yval, zval ); - + h5_err_t herr = h5b_write_vector3d_data ( + filehandle, field_name2, + (void*)xval, (void*)yval, (void*)zval, H5T_NATIVE_FLOAT ); free ( field_name2 ); return herr; } @@ -211,12 +200,11 @@ h5bl_3d_read_vector3d_field_r4 ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); - - h5_err_t herr = H5Block3dReadVector3dFieldFloat32 ( - filehandle, field_name2, xval, yval, zval ); - + h5_err_t herr = h5b_read_vector3d_data ( + filehandle, field_name2, + (void*)xval, (void*)yval, (void*)zval, H5T_NATIVE_FLOAT ); free ( field_name2 ); return herr; } @@ -236,12 +224,10 @@ h5bl_3d_write_scalar_field_i8 ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); - - h5_err_t herr = H5Block3dWriteScalarFieldInt64 ( - filehandle, field_name2, data ); - + h5_err_t herr = h5b_write_scalar_data ( + filehandle, field_name2, (void*)data, H5T_NATIVE_INT64 ); free ( field_name2 ); return herr; } @@ -261,12 +247,10 @@ h5bl_3d_read_scalar_field_i8 ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); - - h5_err_t herr = H5Block3dWriteScalarFieldInt64 ( - filehandle, field_name2, data ); - + h5_err_t herr = h5b_read_scalar_data ( + filehandle, field_name2, data, H5T_NATIVE_INT64 ); free ( field_name2 ); return herr; } @@ -288,12 +272,11 @@ h5bl_3d_write_vector3d_field_i8 ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); - - h5_err_t herr = H5Block3dWriteVector3dFieldInt64 ( - filehandle, field_name2, xval, yval, zval ); - + h5_err_t herr = h5b_write_vector3d_data ( + filehandle, field_name2, + (void*)xval, (void*)yval, (void*)zval, H5T_NATIVE_INT64 ); free ( field_name2 ); return herr; } @@ -315,12 +298,11 @@ h5bl_3d_read_vector3d_field_i8 ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); - - h5_err_t herr = H5Block3dReadVector3dFieldInt64 ( - filehandle, field_name2, xval, yval, zval ); - + h5_err_t herr = h5b_read_vector3d_data ( + filehandle, field_name2, + (void*)xval, (void*)yval, (void*)zval, H5T_NATIVE_INT64 ); free ( field_name2 ); return herr; } @@ -340,12 +322,10 @@ h5bl_3d_write_scalar_field_i4 ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); - - h5_err_t herr = H5Block3dWriteScalarFieldInt32 ( - filehandle, field_name2, data ); - + h5_err_t herr = h5b_write_scalar_data ( + filehandle, field_name2, (void*)data, H5T_NATIVE_INT32 ); free ( field_name2 ); return herr; } @@ -365,12 +345,10 @@ h5bl_3d_read_scalar_field_i4 ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); - - h5_err_t herr = H5Block3dWriteScalarFieldInt32 ( - filehandle, field_name2, data ); - + h5_err_t herr = h5b_read_scalar_data ( + filehandle, field_name2, data, H5T_NATIVE_INT32 ); free ( field_name2 ); return herr; } @@ -392,12 +370,11 @@ h5bl_3d_write_vector3d_field_i4 ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); - - h5_err_t herr = H5Block3dWriteVector3dFieldInt32 ( - filehandle, field_name2, xval, yval, zval ); - + h5_err_t herr = h5b_write_vector3d_data ( + filehandle, field_name2, + (void*)xval, (void*)yval, (void*)zval, H5T_NATIVE_INT32 ); free ( field_name2 ); return herr; } @@ -419,12 +396,11 @@ h5bl_3d_read_vector3d_field_i4 ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); - - h5_err_t herr = H5Block3dReadVector3dFieldInt32 ( - filehandle, field_name2, xval, yval, zval ); - + h5_err_t herr = h5b_read_vector3d_data ( + filehandle, field_name2, + (void*)xval, (void*)yval, (void*)zval, H5T_NATIVE_INT32 ); free ( field_name2 ); return herr; } @@ -447,13 +423,12 @@ h5bl_writefieldattrib_r8 ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name ); - - h5_err_t herr = H5BlockWriteFieldAttribFloat64 ( - filehandle, field_name2, attrib_name2, values, *nvalues ); - + h5_err_t herr = h5_write_field_attrib ( + filehandle, field_name2, attrib_name2, + H5T_NATIVE_DOUBLE, values, *nvalues ); free ( field_name2 ); free ( attrib_name2 ); return herr; @@ -476,13 +451,11 @@ h5bl_readfieldattrib_r8 ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name ); - - h5_err_t herr = H5BlockReadFieldAttribFloat64 ( - filehandle, field_name2, attrib_name2, values ); - + h5_err_t herr = h5_read_field_attrib ( + filehandle, field_name2, attrib_name2, H5T_NATIVE_DOUBLE, values ); free ( field_name2 ); free ( attrib_name2 ); return herr; @@ -506,13 +479,12 @@ h5bl_writefieldattrib_r4 ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name ); - - h5_err_t herr = H5BlockWriteFieldAttribFloat32 ( - filehandle, field_name2, attrib_name2, values, *nvalues ); - + h5_err_t herr = h5_write_field_attrib ( + filehandle, field_name2, attrib_name2, + H5T_NATIVE_FLOAT, values, *nvalues ); free ( field_name2 ); free ( attrib_name2 ); return herr; @@ -535,13 +507,11 @@ h5bl_readfieldattrib_r4 ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name ); - - h5_err_t herr = H5BlockReadFieldAttribFloat32 ( - filehandle, field_name2, attrib_name2, values ); - + h5_err_t herr = h5_read_field_attrib ( + filehandle, field_name2, attrib_name2, H5T_NATIVE_FLOAT, values ); free ( field_name2 ); free ( attrib_name2 ); return herr; @@ -565,13 +535,12 @@ h5bl_writefieldattrib_i8 ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name ); - - h5_err_t herr = H5BlockWriteFieldAttribInt64 ( - filehandle, field_name2, attrib_name2, values, *nvalues ); - + h5_err_t herr = h5_write_field_attrib ( + filehandle, field_name2, attrib_name2, + H5T_NATIVE_INT64, values, *nvalues ); free ( field_name2 ); free ( attrib_name2 ); return herr; @@ -594,13 +563,11 @@ h5bl_readfieldattrib_i8 ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name ); - - h5_err_t herr = H5BlockReadFieldAttribInt64 ( - filehandle, field_name2, attrib_name2, values ); - + h5_err_t herr = h5_read_field_attrib ( + filehandle, field_name2, attrib_name2, H5T_NATIVE_INT64, values ); free ( field_name2 ); free ( attrib_name2 ); return herr; @@ -624,13 +591,12 @@ h5bl_writefieldattrib_i4 ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name ); - - h5_err_t herr = H5BlockWriteFieldAttribInt32 ( - filehandle, field_name2, attrib_name2, values, *nvalues ); - + h5_err_t herr = h5_write_field_attrib ( + filehandle, field_name2, attrib_name2, + H5T_NATIVE_INT32, values, *nvalues ); free ( field_name2 ); free ( attrib_name2 ); return herr; @@ -653,13 +619,11 @@ h5bl_readfieldattrib_i4 ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name ); - - h5_err_t herr = H5BlockReadFieldAttribInt32 ( - filehandle, field_name2, attrib_name2, values ); - + h5_err_t herr = h5_read_field_attrib ( + filehandle, field_name2, attrib_name2, H5T_NATIVE_INT32, values ); free ( field_name2 ); free ( attrib_name2 ); return herr; diff --git a/src/Fortran/H5Part.f90 b/src/Fortran/H5Part.f90 index 5d5ca93..21a5042 100644 --- a/src/Fortran/H5Part.f90 +++ b/src/Fortran/H5Part.f90 @@ -65,14 +65,6 @@ INTEGER*8 FUNCTION h5pt_setview_indices (filehandle,indices,nelem) INTEGER*8, INTENT(IN) :: nelem !< number of particles in the list END FUNCTION -!> \ingroup h5part_model_f -!! See \ref H5PartSetViewEmpty -!! \return 0 on success or error code -!< -INTEGER*8 FUNCTION h5pt_setview_empty (filehandle) - INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open -END FUNCTION - !> \ingroup h5part_model_f !! See \ref H5PartResetView !! \return 0 on success or error code diff --git a/src/Fortran/H5Part_F.c b/src/Fortran/H5Part_F.c index b463f15..c8c1d5b 100755 --- a/src/Fortran/H5Part_F.c +++ b/src/Fortran/H5Part_F.c @@ -1,6 +1,6 @@ #include -#include "H5hut.h" +#include "h5core/h5_core.h" #include "Underscore.h" #if defined(F77_SINGLE_UNDERSCORE) @@ -81,8 +81,8 @@ h5pt_setnpoints ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - return H5PartSetNumParticles ( filehandle, *np ); + h5_set_funcname( filehandle, __func__ ); + return h5u_set_num_particles ( filehandle, *np, 1 ); } h5_err_t @@ -93,30 +93,30 @@ h5pt_setnpoints_strided ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - return H5PartSetNumParticlesStrided ( filehandle, *np, *stride ); + h5_set_funcname( filehandle, __func__ ); + return h5u_set_num_particles ( filehandle, *np, *stride ); } /*==============Reading Data Characteristics============*/ -h5_err_t +h5_int64_t h5pt_getndatasets ( const h5_int64_t *f ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - return H5PartGetNumDatasets ( filehandle ); + h5_set_funcname( filehandle, __func__ ); + return h5u_get_num_datasets ( filehandle ); } -h5_err_t +h5_int64_t h5pt_getnpoints ( const h5_int64_t *f ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - return H5PartGetNumParticles ( filehandle ); + h5_set_funcname( filehandle, __func__ ); + return h5u_get_num_particles ( filehandle ); } h5_err_t @@ -128,10 +128,9 @@ h5pt_getdatasetname ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - h5_int64_t herr = H5PartGetDatasetName ( - filehandle, *index, name, l_name ); - + h5_set_funcname( filehandle, __func__ ); + h5_err_t herr = h5u_get_dataset_info ( + filehandle, *index, name, l_name, NULL, NULL ); h5_strc2for ( name, l_name ); return herr; } @@ -146,8 +145,8 @@ h5pt_setview ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - return H5PartSetView ( filehandle, *start, *end ); + h5_set_funcname( filehandle, __func__ ); + return h5u_set_view ( filehandle, *start, *end ); } h5_err_t @@ -158,18 +157,8 @@ h5pt_setview_indices ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - return H5PartSetViewIndices ( filehandle, indices, *nelem ); -} - -h5_err_t -h5pt_setview_empty ( - const h5_int64_t *f - ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - return H5PartSetViewEmpty ( filehandle ); + h5_set_funcname( filehandle, __func__ ); + return h5u_set_view_indices ( filehandle, indices, *nelem ); } h5_err_t @@ -178,8 +167,8 @@ h5pt_resetview ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - return H5PartResetView ( filehandle ); + h5_set_funcname( filehandle, __func__ ); + return h5u_reset_view ( filehandle ); } h5_err_t @@ -188,8 +177,8 @@ h5pt_hasview ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - return H5PartHasView ( filehandle ); + h5_set_funcname( filehandle, __func__ ); + return h5u_has_view ( filehandle ); } h5_err_t @@ -200,8 +189,8 @@ h5pt_getview ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - return H5PartGetView ( filehandle, start, end); + h5_set_funcname( filehandle, __func__ ); + return h5u_get_view ( filehandle, start, end); } @@ -214,14 +203,11 @@ h5pt_writedata_r8 ( const int l_name ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *name2 = h5_strdupfor2c ( name, l_name ); - - h5_int64_t herr = H5PartWriteDataFloat64 ( - filehandle, name2, data ); - + h5_err_t herr = h5u_write_data ( + filehandle, name2, (void*)data, H5T_NATIVE_DOUBLE ); free ( name2 ); - return herr; } @@ -233,14 +219,11 @@ h5pt_writedata_r4 ( const int l_name ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *name2 = h5_strdupfor2c ( name, l_name ); - - h5_int64_t herr = H5PartWriteDataFloat32 ( - filehandle, name2, data ); - + h5_err_t herr = h5u_write_data ( + filehandle, name2, (void*)data, H5T_NATIVE_FLOAT ); free ( name2 ); - return herr; } @@ -252,14 +235,11 @@ h5pt_writedata_i8 ( const int l_name ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *name2 = h5_strdupfor2c ( name, l_name ); - - h5_int64_t herr = H5PartWriteDataInt64 ( - filehandle, name2, data ); - + h5_err_t herr = h5u_write_data ( + filehandle, name2, (void*)data, H5T_NATIVE_INT64 ); free ( name2 ); - return herr; } @@ -271,14 +251,11 @@ h5pt_writedata_i4 ( const int l_name ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *name2 = h5_strdupfor2c ( name, l_name ); - - h5_int64_t herr = H5PartWriteDataInt32 ( - filehandle, name2, data ); - + h5_err_t herr = h5u_write_data ( + filehandle, name2, (void*)data, H5T_NATIVE_INT32 ); free ( name2 ); - return herr; } @@ -288,17 +265,15 @@ h5_err_t h5pt_readdata_r8 ( const h5_int64_t *f, const char *name, - h5_float64_t *array, + h5_float64_t *data, const int l_name ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *name2 = h5_strdupfor2c ( name, l_name ); - - h5_int64_t herr = H5PartReadDataFloat64 ( - filehandle, name2, array ); - + h5_err_t herr = h5u_read_data ( + filehandle, name2, data, H5T_NATIVE_DOUBLE ); free ( name2 ); return herr; } @@ -307,17 +282,15 @@ h5_err_t h5pt_readdata_r4 ( const h5_int64_t *f, const char *name, - h5_float32_t *array, + h5_float32_t *data, const int l_name ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *name2 = h5_strdupfor2c ( name, l_name ); - - h5_int64_t herr = H5PartReadDataFloat32 ( - filehandle, name2, array ); - + h5_err_t herr = h5u_read_data ( + filehandle, name2, data, H5T_NATIVE_FLOAT ); free ( name2 ); return herr; } @@ -326,16 +299,15 @@ h5_err_t h5pt_readdata_i8 ( const h5_int64_t *f, const char *name, - h5_int64_t *array, + h5_int64_t *data, const int l_name ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *name2 = h5_strdupfor2c ( name, l_name ); - - h5_int64_t herr = H5PartReadDataInt64 ( - filehandle, name2, array ); + h5_err_t herr = h5u_read_data ( + filehandle, name2, data, H5T_NATIVE_INT64 ); free ( name2 ); return herr; @@ -345,17 +317,15 @@ h5_err_t h5pt_readdata_i4 ( const h5_int64_t *f, const char *name, - h5_int32_t *array, + h5_int32_t *data, const int l_name ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - + h5_set_funcname( filehandle, __func__ ); char *name2 = h5_strdupfor2c ( name, l_name ); - - h5_int64_t herr = H5PartReadDataInt32 ( - filehandle, name2, array ); - + h5_err_t herr = h5u_read_data ( + filehandle, name2, data, H5T_NATIVE_INT32 ); free ( name2 ); return herr; } diff --git a/src/Fortran/H5_F.c b/src/Fortran/H5_F.c index 0b47aae..164fc23 100644 --- a/src/Fortran/H5_F.c +++ b/src/Fortran/H5_F.c @@ -1,7 +1,7 @@ #include #include -#include "H5hut.h" +#include "h5core/h5_core.h" #include "Underscore.h" #if defined(F77_SINGLE_UNDERSCORE) @@ -78,9 +78,7 @@ h5_openr ( ) { char *file_name2 = h5_strdupfor2c ( file_name, l_file_name ); - - h5_file_t* f = H5OpenFile ( file_name2, H5_O_RDONLY, 0 ); - + h5_file_t* f = h5_open_file ( file_name2, H5_O_RDONLY, 0, __func__ ); free ( file_name2 ); return (h5_int64_t)(size_t)f; } @@ -92,9 +90,7 @@ h5_openw ( ) { char *file_name2 = h5_strdupfor2c ( file_name, l_file_name ); - - h5_file_t* f = H5OpenFile ( file_name2, H5_O_WRONLY, 0 ); - + h5_file_t* f = h5_open_file ( file_name2, H5_O_WRONLY, 0, __func__ ); free ( file_name2 ); return (h5_int64_t)(size_t)f; } @@ -106,9 +102,7 @@ h5pt_opena ( ) { char *file_name2 = h5_strdupfor2c ( file_name, l_file_name ); - - h5_file_t* f = H5OpenFile ( file_name2, H5_O_APPEND, 0 ); - + h5_file_t* f = h5_open_file ( file_name2, H5_O_APPEND, 0, __func__ ); free ( file_name2 ); return (h5_int64_t)(size_t)f; } @@ -129,7 +123,7 @@ h5_openr_par ( h5_int32_t fbits = H5_O_RDONLY | _flagsfor2c ( flags2 ); - h5_file_t* f = H5OpenFile ( file_name2, ccomm, fbits ); + h5_file_t* f = h5_open_file ( file_name2, fbits, ccomm, __func__ ); free ( file_name2 ); free ( flags2 ); @@ -151,7 +145,7 @@ h5_openw_par ( h5_int32_t fbits = H5_O_WRONLY | _flagsfor2c ( flags2 ); - h5_file_t* f = H5OpenFile ( file_name2, fbits, ccomm ); + h5_file_t* f = h5_open_file ( file_name2, ccomm, fbits, __func__ ); free ( file_name2 ); free ( flags2 ); @@ -174,7 +168,7 @@ h5pt_opena_par_align ( h5_int32_t fbits = H5_O_APPEND | _flagsfor2c ( flags2 ); - h5_file_t* f = H5OpenFile( file_name2, fbits, ccomm ); + h5_file_t* f = H5OpenFile( file_name2, ccomm, fbits, __func__ ); free ( file_name2 ); free ( flags2 ); @@ -186,18 +180,20 @@ h5_err_t h5_close ( const h5_int64_t *f ) { - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - return H5CloseFile ( filehandle ); + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + h5_set_funcname( filehandle, __func__ ); + return h5_close_file ( filehandle ); } h5_err_t h5_check ( const h5_int64_t *f ) { - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - return H5CheckFile ( filehandle ); + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + h5_set_funcname( filehandle, __func__ ); + return h5_check_filehandle ( filehandle ); } h5_err_t @@ -206,24 +202,24 @@ h5_setstep ( h5_int64_t *step ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - return H5SetStep ( filehandle, (*step)-1 ); + h5_set_funcname( filehandle, __func__ ); + return h5_set_step ( filehandle, (*step)-1 ); } -h5_err_t +h5_ssize_t h5_getnsteps ( const h5_int64_t *f ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - return H5GetNumSteps ( filehandle ); + h5_set_funcname( filehandle, __func__ ); + return h5_get_num_steps ( filehandle ); } h5_err_t h5_set_verbosity_level ( const h5_int64_t *level ) { - return H5SetVerbosityLevel ( *level ); + return h5_set_debuglevel ( *level ); } diff --git a/src/Fortran/H5_attribs_F.c b/src/Fortran/H5_attribs_F.c index 53dbad6..a4a42ee 100644 --- a/src/Fortran/H5_attribs_F.c +++ b/src/Fortran/H5_attribs_F.c @@ -1,6 +1,7 @@ #include +#include -#include "H5hut.h" +#include "h5core/h5_core.h" #include "Underscore.h" #if defined(F77_SINGLE_UNDERSCORE) @@ -39,12 +40,14 @@ h5_writefileattrib_string ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + h5_set_funcname( filehandle, __func__ ); char *attrib_name2 = h5_strdupfor2c (attrib_name,l_attrib_name); char *attrib_value2= h5_strdupfor2c (attrib_value,l_attrib_value); - h5_err_t herr = H5WriteFileAttribString ( - filehandle, attrib_name2, attrib_value2 ); + h5_err_t herr = h5_write_attrib ( + filehandle, H5_ATTRIB_FILE, attrib_name2, + H5T_NATIVE_CHAR, attrib_value2, strlen(attrib_value2)+1 ); free ( attrib_name2 ); free ( attrib_value2 ); @@ -61,41 +64,20 @@ h5_writestepattrib_string ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + h5_set_funcname( filehandle, __func__ ); char *attrib_name2 = h5_strdupfor2c (attrib_name,l_attrib_name); char *attrib_value2= h5_strdupfor2c (attrib_value,l_attrib_value); - h5_err_t herr = H5WriteStepAttribString ( - filehandle, attrib_name2, attrib_value2 ); + h5_err_t herr = h5_write_attrib ( + filehandle, H5_ATTRIB_STEP, attrib_name2, + H5T_NATIVE_CHAR, attrib_value2, strlen(attrib_value2)+1 ); free ( attrib_name2 ); free ( attrib_value2 ); return herr; } - -h5_err_t -h5_readstepattrib_string ( - const h5_int64_t *f, - const char *attrib_name, - char *attrib_value, - const int l_attrib_name, - const int l_attrib_value - ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - char * attrib_name2 = h5_strdupfor2c (attrib_name,l_attrib_name); - - h5_err_t herr = H5ReadStepAttribString ( - filehandle, attrib_name2, attrib_value ); - - h5_strc2for ( attrib_value, l_attrib_value ); - - free ( attrib_name2 ); - return herr; -} - h5_err_t h5_readfileattrib_string ( const h5_int64_t *f, @@ -106,11 +88,13 @@ h5_readfileattrib_string ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + h5_set_funcname( filehandle, __func__ ); char * attrib_name2 = h5_strdupfor2c (attrib_name,l_attrib_name); - h5_err_t herr = H5ReadFileAttribString ( - filehandle, attrib_name2, attrib_value ); + h5_err_t herr = h5_read_attrib ( + filehandle, H5_ATTRIB_FILE, attrib_name2, + H5_STRING_T, attrib_value ); h5_strc2for ( attrib_value, l_attrib_value ); @@ -118,6 +102,31 @@ h5_readfileattrib_string ( return herr; } +h5_err_t +h5_readstepattrib_string ( + const h5_int64_t *f, + const char *attrib_name, + char *attrib_value, + const int l_attrib_name, + const int l_attrib_value + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + h5_set_funcname( filehandle, __func__ ); + + char * attrib_name2 = h5_strdupfor2c (attrib_name,l_attrib_name); + + h5_err_t herr = h5_read_attrib ( + filehandle, H5_ATTRIB_STEP, attrib_name2, + H5_STRING_T, attrib_value ); + + h5_strc2for ( attrib_value, l_attrib_value ); + + free ( attrib_name2 ); + return herr; +} + + #if ! defined(F77_NO_UNDERSCORE) #define h5_writefileattrib_r8 F77NAME ( \ h5_writefileattrib_r8_, \ @@ -129,16 +138,18 @@ h5_writefileattrib_r8 ( h5_int64_t *f, const char *name, const h5_float64_t *data, - const h5_float64_t *nelem, + const h5_int64_t *nelem, const int l_name ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + h5_set_funcname( filehandle, __func__ ); char *name2 = h5_strdupfor2c ( name, l_name ); - h5_err_t herr = H5WriteFileAttribFloat64( - filehandle, name2, data, *nelem); + h5_err_t herr = h5_write_attrib( + filehandle, H5_ATTRIB_FILE, name2, + H5T_NATIVE_DOUBLE, data, (hsize_t) *nelem); free ( name2 ); return herr; @@ -159,10 +170,12 @@ h5_readfileattrib_r8 ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + h5_set_funcname( filehandle, __func__ ); char *name2 = h5_strdupfor2c ( name, l_name ); - h5_err_t herr = H5ReadFileAttribFloat64(filehandle, name2, data); + h5_err_t herr = h5_read_attrib( + filehandle, H5_ATTRIB_FILE, name2, H5_FLOAT64_T, data); free ( name2 ); return herr; @@ -179,16 +192,18 @@ h5_writefileattrib_r4 ( h5_int64_t *f, const char *name, const h5_float32_t *data, - const h5_float32_t *nelem, + const h5_int64_t *nelem, const int l_name ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + h5_set_funcname( filehandle, __func__ ); char *name2 = h5_strdupfor2c ( name, l_name ); - h5_err_t herr = H5WriteFileAttribFloat32( - filehandle, name2, data, *nelem); + h5_err_t herr = h5_write_attrib( + filehandle, H5_ATTRIB_FILE, name2, + H5T_NATIVE_FLOAT, data, (hsize_t) *nelem); free ( name2 ); return herr; @@ -209,10 +224,12 @@ h5_readfileattrib_r4 ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + h5_set_funcname( filehandle, __func__ ); char *name2 = h5_strdupfor2c ( name, l_name ); - h5_err_t herr = H5ReadFileAttribFloat32(filehandle, name2, data); + h5_err_t herr = h5_read_attrib( + filehandle, H5_ATTRIB_FILE, name2, H5_FLOAT32_T, data); free ( name2 ); return herr; @@ -234,10 +251,13 @@ h5_writefileattrib_i8 ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + h5_set_funcname( filehandle, __func__ ); char *name2 = h5_strdupfor2c ( name, l_name ); - h5_err_t herr = H5WriteFileAttribInt64(filehandle, name2, data, *nelem); + h5_err_t herr = h5_write_attrib( + filehandle, H5_ATTRIB_FILE, name2, + H5T_NATIVE_INT64, data, (hsize_t) *nelem); free ( name2 ); return herr; @@ -258,10 +278,12 @@ h5_readfileattrib_i8 ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + h5_set_funcname( filehandle, __func__ ); char *name2 = h5_strdupfor2c ( name, l_name ); - h5_err_t herr = H5ReadFileAttribInt64(filehandle, name2, data); + h5_err_t herr = h5_read_attrib( + filehandle, H5_ATTRIB_FILE, name2, H5_INT64_T, data); free ( name2 ); return herr; @@ -278,15 +300,18 @@ h5_writefileattrib_i4 ( h5_int64_t *f, const char *name, const h5_int32_t *data, - const h5_int32_t *nelem, + const h5_int64_t *nelem, const int l_name ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + h5_set_funcname( filehandle, __func__ ); char *name2 = h5_strdupfor2c ( name, l_name ); - h5_err_t herr = H5WriteFileAttribInt32(filehandle, name2, data, *nelem); + h5_err_t herr = h5_write_attrib( + filehandle, H5_ATTRIB_FILE, name2, + H5T_NATIVE_INT32, data, (hsize_t) *nelem); free ( name2 ); return herr; @@ -307,10 +332,12 @@ h5_readfileattrib_i4 ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + h5_set_funcname( filehandle, __func__ ); char *name2 = h5_strdupfor2c ( name, l_name ); - h5_err_t herr = H5ReadFileAttribInt32(filehandle, name2, data); + h5_err_t herr = h5_read_attrib( + filehandle, H5_ATTRIB_FILE, name2, H5_INT32_T, data); free ( name2 ); return herr; @@ -327,16 +354,18 @@ h5_writestepattrib_r8 ( h5_int64_t *f, const char *name, const h5_float64_t *data, - const h5_float64_t *nelem, + const h5_int64_t *nelem, const int l_name ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + h5_set_funcname( filehandle, __func__ ); char *name2 = h5_strdupfor2c ( name, l_name ); - h5_err_t herr = H5WriteStepAttribFloat64( - filehandle, name2, data, *nelem); + h5_err_t herr = h5_write_attrib( + filehandle, H5_ATTRIB_STEP, name2, + H5T_NATIVE_DOUBLE, data, (hsize_t) *nelem); free ( name2 ); return herr; @@ -357,10 +386,12 @@ h5_readstepattrib_r8 ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + h5_set_funcname( filehandle, __func__ ); char *name2 = h5_strdupfor2c ( name, l_name ); - h5_err_t herr = H5ReadStepAttribFloat64(filehandle, name2, data); + h5_err_t herr = h5_read_attrib( + filehandle, H5_ATTRIB_STEP, name2, H5_FLOAT64_T, data); free ( name2 ); return herr; @@ -377,16 +408,18 @@ h5_writestepattrib_r4 ( h5_int64_t *f, const char *name, const h5_float32_t *data, - const h5_float32_t *nelem, + const h5_int64_t *nelem, const int l_name ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + h5_set_funcname( filehandle, __func__ ); char *name2 = h5_strdupfor2c ( name, l_name ); - h5_err_t herr = H5WriteStepAttribFloat32( - filehandle, name2, data, *nelem); + h5_err_t herr = h5_write_attrib( + filehandle, H5_ATTRIB_STEP, name2, + H5T_NATIVE_FLOAT, data, (hsize_t) *nelem); free ( name2 ); return herr; @@ -407,10 +440,12 @@ h5_readstepattrib_r4 ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + h5_set_funcname( filehandle, __func__ ); char *name2 = h5_strdupfor2c ( name, l_name ); - h5_err_t herr = H5ReadStepAttribFloat32(filehandle, name2, data); + h5_err_t herr = h5_read_attrib( + filehandle, H5_ATTRIB_STEP, name2, H5_FLOAT32_T, data); free ( name2 ); return herr; @@ -432,10 +467,13 @@ h5_writestepattrib_i8 ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + h5_set_funcname( filehandle, __func__ ); char *name2 = h5_strdupfor2c ( name, l_name ); - h5_err_t herr = H5WriteStepAttribInt64(filehandle, name2, data, *nelem); + h5_err_t herr = h5_write_attrib( + filehandle, H5_ATTRIB_STEP, name2, + H5T_NATIVE_INT64, data, (hsize_t) *nelem); free ( name2 ); return herr; @@ -456,10 +494,12 @@ h5_readstepattrib_i8 ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + h5_set_funcname( filehandle, __func__ ); char *name2 = h5_strdupfor2c ( name, l_name ); - h5_err_t herr = H5ReadStepAttribInt64(filehandle, name2, data); + h5_err_t herr = h5_read_attrib( + filehandle, H5_ATTRIB_STEP, name2, H5_INT64_T, data); free ( name2 ); return herr; @@ -476,15 +516,18 @@ h5_writestepattrib_i4 ( h5_int64_t *f, const char *name, const h5_int32_t *data, - const h5_int32_t *nelem, + const h5_int64_t *nelem, const int l_name ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + h5_set_funcname( filehandle, __func__ ); char *name2 = h5_strdupfor2c ( name, l_name ); - h5_err_t herr = H5WriteStepAttribInt32(filehandle, name2, data, *nelem); + h5_err_t herr = h5_write_attrib( + filehandle, H5_ATTRIB_STEP, name2, + H5T_NATIVE_INT32, data, (hsize_t) *nelem); free ( name2 ); return herr; @@ -505,10 +548,12 @@ h5_readstepattrib_i4 ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + h5_set_funcname( filehandle, __func__ ); char *name2 = h5_strdupfor2c ( name, l_name ); - h5_err_t herr = H5ReadStepAttribInt32(filehandle, name2, data); + h5_err_t herr = h5_read_attrib( + filehandle, H5_ATTRIB_STEP, name2, H5_INT32_T, data); free ( name2 ); return herr; @@ -533,24 +578,49 @@ h5_readstepattrib_i4 ( #endif -h5_err_t -h5_getnstepattribs ( - const h5_int64_t *f - ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - return H5GetNumStepAttribs ( filehandle ); -} - -h5_err_t +h5_int64_t h5_getnfileattribs ( const h5_int64_t *f ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + h5_set_funcname( filehandle, __func__ ); - return H5GetNumFileAttribs ( filehandle ); + return h5_get_num_attribs ( filehandle, H5_ATTRIB_FILE ); +} + +h5_int64_t +h5_getnstepattribs ( + const h5_int64_t *f + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + h5_set_funcname( filehandle, __func__ ); + + return h5_get_num_attribs ( filehandle, H5_ATTRIB_STEP ); +} + +h5_err_t +h5_getfileattribinfo ( + const h5_int64_t *f, + const h5_int64_t *idx, + char *name, + h5_int64_t *nelem, + const int l_name ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + h5_set_funcname( filehandle, __func__ ); + h5_int64_t type; + h5_size_t nelem2; + + h5_err_t herr = h5_get_attrib_info ( + filehandle, H5_ATTRIB_FILE, (h5_size_t)*idx, + name, l_name, &type, &nelem2); + + *nelem = (h5_int64_t)nelem2; + + h5_strc2for( name, l_name ); + return herr; } h5_err_t @@ -563,30 +633,18 @@ h5_getstepattribinfo ( ) { h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + h5_set_funcname( filehandle, __func__ ); h5_int64_t type; + h5_size_t nelem2; - h5_err_t herr = H5GetStepAttribInfo ( - filehandle, *idx, name, l_name, &type, nelem); + h5_err_t herr = h5_get_attrib_info ( + filehandle, H5_ATTRIB_STEP, (h5_size_t)*idx, + name, l_name, &type, &nelem2); + + *nelem = (h5_int64_t)nelem2; h5_strc2for( name, l_name ); return herr; } -h5_err_t -h5_getfileattribinfo ( - const h5_int64_t *f, - const h5_int64_t *idx, - char *name, - h5_int64_t *nelem, - const int l_name ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - h5_int64_t type; - - h5_err_t herr = H5GetFileAttribInfo ( - filehandle, *idx, name, l_name, &type, nelem); - - h5_strc2for( name, l_name ); - return herr; -} diff --git a/src/include/H5.h b/src/include/H5.h index 332fde8..0cfd5d4 100644 --- a/src/include/H5.h +++ b/src/include/H5.h @@ -64,7 +64,7 @@ H5GetNumProcs ( h5_file_t * const f ); -h5_size_t +h5_ssize_t H5GetNumSteps ( h5_file_t * const f ); diff --git a/src/include/H5Part.h b/src/include/H5Part.h index 085f8ab..c7844bc 100644 --- a/src/include/H5Part.h +++ b/src/include/H5Part.h @@ -129,11 +129,6 @@ H5PartSetViewIndices ( h5_size_t nelems /*!< [in] Size of list */ ); -h5_err_t -H5PartSetViewEmpty ( - h5_file_t *f /*!< [in] Handle to open file */ - ); - h5_err_t H5PartGetView ( h5_file_t *f, /*!< [in] Handle to open file */