Important API changes since version 0.99.11
Overview
Several changes has been made to the H5hut C and Fortran API:
-
Versions newer than 0.99.13 provide an improved API to open H5hut files. Existing code must be adapted accordingly.
-
A more complete set of functions to query datasets and attributes has been implemented.
-
Starting with version 0.99.11 the C-API is implemented with inline functions. This does not require changes in the source code but for linking - the library
libh5hutC
has been removed. -
The compiler wrapper
h5hutcc
is obsolete and not available any more. -
The Fortran API has been reviewed and partially rewritten.
-
More and better examples has been added some old examples removed.
Changes in API
The API function to open a H5hut file are more general and more flexible making it simpler to add new features. Like in HDF5 you can define properties of a file and pass this properties to the open call. Adapting old code is easy and straight forward.
Open H5hut file
Old implementation
h5_file_t* H5OpenFile ( const char* filename, /*!< file name */ h5_int32_t flags, /*!< file open flags */ MPI_Comm comm /*!< MPI communicator */ );
The return type was a pointer to a structure. With the argument flags
the access mode of the file and the virtual file driver was selected. In the parallel version comm
was used to pass the MPI communicator. In the serial version this argument was ignored.
New implementation
h5_file_t H5OpenFile ( const char* const filename, ///< [in] name of file const h5_int64_t flags, ///< [in] file access mode const h5_prop_t props ///< [in] identifier for file property list )
- Return type
-
The return value is not a pointer any more.
With the argument flags
the file access mode is defined. The virtual file driver must be selected via a property list, if another than the default should be used.
Compiling and Linking
Compile and link a program written in C
For serial compilation set $CC
to something like cc
, gcc
, icc
. For parallel compilation use mpicc
.
With H5hut ⇐ 1.99.10
$CC -I/opt/H5hut/1.99/include -c H5test.c $CC -L/opt/H5hut/1.99/lib -L/opt/hdf5/1.8.19/lib H5test.o -o H5test -lH5hutC -lH5hut -lhdf5 -lz
Now (without -lH5hutC
):
$CC -I/opt/H5hut/2.0/include -c H5test.c $CC -L/opt/H5hut/2.0/lib -L/opt/hdf5/1.8.19/lib H5test.o -o H5test -lH5hut -lhdf5 -lz
Compile and link a program written in Fortran
No changes are required with the new version to link a Fortran program.
For serial compilation set $FC
to something like f90
. For parallel compilation use mpif90
.
$FC -I/opt/H5hut/2.0/include -c H5test.f90 $FC -o H5test H5test.o -L/opt/hdf5/1.8.19/lib -L/opt/H5hut/2.0/lib -lH5hutF -lH5hut -lhdf5 -lz