diff --git a/NEWS b/NEWS index 28fc909..cac6f41 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,16 @@ +#### H5PART 1.6.2 ############################################################ + +Removed H5PartSetViewEmpty +-------------------------- + +An empty view can now be selected with: +H5PartSetNumParticles(file, 0); + +Bug Fixes to Attribute Calls in Fortran API +------------------------------------------- + +Fixed a problem where attribute values were reverting to zero. + #### H5PART 1.6.1 ############################################################ Chunking in the H5Part API diff --git a/configure.ac b/configure.ac index da6491e..52cd90a 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ # Every configure script must call AC_INIT before doing anything else. # AC_INIT (package, version, [bug-report], [tarname]) -AC_INIT([H5Part], [1.6.1], [h5part@lists.psi.ch], H5Part) +AC_INIT([H5Part], [1.6.2], [h5part@lists.psi.ch], H5Part) # Ensure that a recent enough version of Autoconf is being used. diff --git a/examples/simplef.F90 b/examples/simplef.F90 index da1f93f..7720dee 100644 --- a/examples/simplef.F90 +++ b/examples/simplef.F90 @@ -8,12 +8,15 @@ program H5PartTest integer*8 :: file_id, status, npoints, i real*8, allocatable :: particles(:) integer*8, allocatable :: id(:) + real*8 :: r8val + integer*8 :: i8val comm = MPI_COMM_WORLD call mpi_init(ierr) call mpi_comm_rank(comm, rank, ierr) ! open the a file for parallel writing + file_id = h5pt_set_verbosity_level(5) file_id = h5pt_openw_par('test.h5', comm) ! in the Fortran API, time steps start at 1 @@ -22,6 +25,10 @@ program H5PartTest ! write an attribute to the file status = h5pt_writefileattrib_string(file_id, 'desc', 'This is a test.') + r8val = 0.5 + i8val = 1 + status = h5pt_writefileattrib_r8(file_id, 'double', r8val, i8val) + ! create fake data npoints = 99 allocate(particles(npoints), id(npoints)) diff --git a/src/H5Part.c b/src/H5Part.c index 2d0e112..2702cca 100644 --- a/src/H5Part.c +++ b/src/H5Part.c @@ -199,7 +199,7 @@ _H5Part_open_file ( { /* extend the btree size so that metadata pieces are * close to the alignment value */ - if ( align > 0 ) + if ( align > 16384 ) { unsigned int btree_ik = (align - 4096) / 96; unsigned int btree_bytes = 64 + 96*btree_ik; @@ -1647,9 +1647,9 @@ H5PartWriteStepAttrib ( h5part_int64_t herr = _H5Part_write_step_attrib ( f, name, - (const hid_t)type, + (hid_t)type, data, - nelem ); + (hsize_t)nelem ); if ( herr < 0 ) return herr; return H5PART_SUCCESS; @@ -1691,9 +1691,9 @@ H5PartWriteFileAttrib ( h5part_int64_t herr = _H5Part_write_file_attrib ( f, name, - (const hid_t)type, + (hid_t)type, data, - nelem ); + (hsize_t)nelem ); if ( herr < 0 ) return herr; return H5PART_SUCCESS; @@ -2282,7 +2282,12 @@ _H5Part_get_num_objects_matching_pattern ( data.pattern = pattern; #ifdef H5PART_HAVE_HDF5_18 - hid_t child_id = H5Gopen( group_id, group_name, H5P_DEFAULT ); + hid_t child_id = H5Gopen( group_id, group_name +#ifndef H5_USE_16_API + , H5P_DEFAULT +#endif + ); + if ( child_id < 0 ) return child_id; herr = H5Literate( child_id, H5_INDEX_NAME, H5_ITER_INC, 0, _H5Part_iteration_operator2, &data ); @@ -2785,10 +2790,7 @@ _set_view ( end==-1 to mean end of file */ total = (hsize_t) _H5Part_get_num_particles ( f ); - if ( total < 0 ) { - return HANDLE_H5PART_GET_NUM_PARTICLES_ERR ( total ); - } - else if ( total == 0 ) { + if ( total == 0 ) { /* No datasets have been created yet and no veiws are set. * We have to leave the view empty because we don't know how * many particles there should be! */ @@ -2867,10 +2869,7 @@ _set_view_indices ( end==-1 to mean end of file */ total = (hsize_t) _H5Part_get_num_particles ( f ); - if ( total < 0 ) { - return HANDLE_H5PART_GET_NUM_PARTICLES_ERR ( total ); - } - else if ( total == 0 ) { + if ( total == 0 ) { /* No datasets have been created yet and no veiws are set. * We have to leave the view empty because we don't know how * many particles there should be! */ @@ -3142,7 +3141,7 @@ _read_data ( ) { h5part_int64_t herr; - hsize_t ndisk, nread, nmem; + hssize_t ndisk, nread, nmem; hid_t dataset_id; hid_t space_id; hid_t memspace_id; diff --git a/src/H5Part.f90 b/src/H5Part.f90 index 0ccd0b6..80554ac 100644 --- a/src/H5Part.f90 +++ b/src/H5Part.f90 @@ -265,14 +265,6 @@ INTEGER*8 FUNCTION h5pt_setview_indices (filehandle,indices,nelem) INTEGER*8, INTENT(IN) :: nelem !< number of particles in the list END FUNCTION -!> \ingroup h5partf_model -!! 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 h5partf_model !! See \ref H5PartResetView !! \return 0 on success or error code diff --git a/src/H5PartAttribF.c b/src/H5PartAttribF.c index 64c3e07..23d179e 100644 --- a/src/H5PartAttribF.c +++ b/src/H5PartAttribF.c @@ -23,7 +23,7 @@ h5pt_writefileattrib_r8 ( h5part_int64_t *f, const char *name, const h5part_float64_t *data, - const h5part_float64_t *nelem, + const h5part_int64_t *nelem, const int l_name ) { @@ -39,9 +39,9 @@ h5pt_writefileattrib_r8 ( } #if ! defined(F77_NO_UNDERSCORE) -#define h5pt_writefileattrib_r8 F77NAME ( \ - h5pt_writefileattrib_r8_, \ - H5PT_WRITEFILEATTRIB_R8 ) +#define h5pt_readfileattrib_r8 F77NAME ( \ + h5pt_readfileattrib_r8_, \ + H5PT_READFILEATTRIB_R8 ) #endif h5part_int64_t @@ -74,7 +74,7 @@ h5pt_writefileattrib_r4 ( h5part_int64_t *f, const char *name, const h5part_float32_t *data, - const h5part_float32_t *nelem, + const h5part_int64_t *nelem, const int l_name ) { @@ -90,9 +90,9 @@ h5pt_writefileattrib_r4 ( } #if ! defined(F77_NO_UNDERSCORE) -#define h5pt_writefileattrib_r4 F77NAME ( \ - h5pt_writefileattrib_r4_, \ - H5PT_WRITEFILEATTRIB_R4 ) +#define h5pt_readfileattrib_r4 F77NAME ( \ + h5pt_readfileattrib_r4_, \ + H5PT_READFILEATTRIB_R4 ) #endif h5part_int64_t @@ -141,9 +141,9 @@ h5pt_writefileattrib_i8 ( } #if ! defined(F77_NO_UNDERSCORE) -#define h5pt_writefileattrib_i8 F77NAME ( \ - h5pt_writefileattrib_i8_, \ - H5PT_WRITEFILEATTRIB_I8 ) +#define h5pt_readfileattrib_i8 F77NAME ( \ + h5pt_readfileattrib_i8_, \ + H5PT_READFILEATTRIB_I8 ) #endif h5part_int64_t @@ -176,7 +176,7 @@ h5pt_writefileattrib_i4 ( h5part_int64_t *f, const char *name, const h5part_int32_t *data, - const h5part_int32_t *nelem, + const h5part_int64_t *nelem, const int l_name ) { @@ -192,9 +192,9 @@ h5pt_writefileattrib_i4 ( } #if ! defined(F77_NO_UNDERSCORE) -#define h5pt_writefileattrib_i4 F77NAME ( \ - h5pt_writefileattrib_i4_, \ - H5PT_WRITEFILEATTRIB_I4 ) +#define h5pt_readfileattrib_i4 F77NAME ( \ + h5pt_readfileattrib_i4_, \ + H5PT_READFILEATTRIB_I4 ) #endif h5part_int64_t @@ -227,7 +227,7 @@ h5pt_writestepattrib_r8 ( h5part_int64_t *f, const char *name, const h5part_float64_t *data, - const h5part_float64_t *nelem, + const h5part_int64_t *nelem, const int l_name ) { @@ -243,9 +243,9 @@ h5pt_writestepattrib_r8 ( } #if ! defined(F77_NO_UNDERSCORE) -#define h5pt_writestepattrib_r8 F77NAME ( \ - h5pt_writestepattrib_r8_, \ - H5PT_WRITESTEPATTRIB_R8 ) +#define h5pt_readstepattrib_r8 F77NAME ( \ + h5pt_readstepattrib_r8_, \ + H5PT_READSTEPATTRIB_R8 ) #endif h5part_int64_t @@ -278,7 +278,7 @@ h5pt_writestepattrib_r4 ( h5part_int64_t *f, const char *name, const h5part_float32_t *data, - const h5part_float32_t *nelem, + const h5part_int64_t *nelem, const int l_name ) { @@ -294,9 +294,9 @@ h5pt_writestepattrib_r4 ( } #if ! defined(F77_NO_UNDERSCORE) -#define h5pt_writestepattrib_r4 F77NAME ( \ - h5pt_writestepattrib_r4_, \ - H5PT_WRITESTEPATTRIB_R4 ) +#define h5pt_readstepattrib_r4 F77NAME ( \ + h5pt_readstepattrib_r4_, \ + H5PT_READSTEPATTRIB_R4 ) #endif h5part_int64_t @@ -345,9 +345,9 @@ h5pt_writestepattrib_i8 ( } #if ! defined(F77_NO_UNDERSCORE) -#define h5pt_writestepattrib_i8 F77NAME ( \ - h5pt_writestepattrib_i8_, \ - H5PT_WRITESTEPATTRIB_I8 ) +#define h5pt_readstepattrib_i8 F77NAME ( \ + h5pt_readstepattrib_i8_, \ + H5PT_READSTEPATTRIB_I8 ) #endif h5part_int64_t @@ -380,7 +380,7 @@ h5pt_writestepattrib_i4 ( h5part_int64_t *f, const char *name, const h5part_int32_t *data, - const h5part_int32_t *nelem, + const h5part_int64_t *nelem, const int l_name ) { @@ -396,9 +396,9 @@ h5pt_writestepattrib_i4 ( } #if ! defined(F77_NO_UNDERSCORE) -#define h5pt_writestepattrib_i4 F77NAME ( \ - h5pt_writestepattrib_i4_, \ - H5PT_WRITESTEPATTRIB_I4 ) +#define h5pt_readstepattrib_i4 F77NAME ( \ + h5pt_readstepattrib_i4_, \ + H5PT_READSTEPATTRIB_I4 ) #endif h5part_int64_t diff --git a/src/H5PartF.c b/src/H5PartF.c index 5267c41..2e7a32e 100755 --- a/src/H5PartF.c +++ b/src/H5PartF.c @@ -100,9 +100,6 @@ #define h5pt_setview_indices F77NAME ( \ h5pt_setview_indices_, \ H5PT_SETVIEW_INDICES ) -#define h5pt_setview_empty F77NAME ( \ - h5pt_setview_empty_, \ - H5PT_SETVIEW_EMPTY ) #define h5pt_resetview F77NAME ( \ h5pt_resetview_, \ H5PT_RESETVIEW ) @@ -641,16 +638,6 @@ h5pt_setview_indices ( return H5PartSetViewIndices ( filehandle, indices, *nelem ); } -h5part_int64_t -h5pt_setview_empty ( - const h5part_int64_t *f - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - return H5PartSetViewEmpty ( filehandle ); -} - h5part_int64_t h5pt_resetview ( const h5part_int64_t *f diff --git a/src/H5PartTypes.h b/src/H5PartTypes.h index 2848338..af40372 100644 --- a/src/H5PartTypes.h +++ b/src/H5PartTypes.h @@ -19,11 +19,9 @@ __attribute__ ((format (printf, 3, 4))) #endif ; -#ifndef MPI_INCLUDED -#ifndef OPEN_MPI +#ifndef PARALLEL_IO typedef unsigned long MPI_Comm; #endif -#endif #define H5PART_STEPNAME_LEN 64 #define H5PART_DATANAME_LEN 64 diff --git a/src/generate-attr.py b/src/generate-attr.py index 1a2946e..5e6a4aa 100755 --- a/src/generate-attr.py +++ b/src/generate-attr.py @@ -113,7 +113,7 @@ h5pt_write#LEVELLC#attrib_#TYPE_F90_ABV# ( h5part_int64_t *f, const char *name, const h5part_#TYPE_H5P#_t *data, - const h5part_#TYPE_H5P#_t *nelem, + const h5part_int64_t *nelem, const int l_name ) { @@ -143,9 +143,9 @@ END FUNCTION read_attr_fc = """ #if ! defined(F77_NO_UNDERSCORE) -#define h5pt_write#LEVELLC#attrib_#TYPE_F90_ABV# F77NAME ( \\ - h5pt_write#LEVELLC#attrib_#TYPE_F90_ABV#_, \\ - H5PT_WRITE#LEVELUC#ATTRIB_#TYPE_F90_ABVC# ) +#define h5pt_read#LEVELLC#attrib_#TYPE_F90_ABV# F77NAME ( \\ + h5pt_read#LEVELLC#attrib_#TYPE_F90_ABV#_, \\ + H5PT_READ#LEVELUC#ATTRIB_#TYPE_F90_ABVC# ) #endif h5part_int64_t