Example of H5Literate_f


#1

I’m looking for an example of how to use H5Literate_f. Can anyone point me in the right direction? I have found some stuff but it is incomplete.


#2

https://support.hdfgroup.org/HDF5/examples/api-fortran.html

h5ex_g_iterate_F03.f90 and h5ex_g_traverse_F03.f90


#3

Much Thanks! One thing to note is that the “name” argument in function op_func could be changed from dimension “1:10” to “*” and this would allow for names of unlimited length. [Though to take advantage of this one would have to use an adjustable length “name_string” when converting from “name” to “name_string”.]


#4

Another question: In the example, the call to
H5Literate_f(file, H5_INDEX_NAME_F, H5_ITER_NATIVE_F, idx, funptr, ptr, ret_value, status)
has ptr set to C_NULL_PTR. I tried using instead a pointer to a local variable. However the value of the operator_data pointer passed to FUNCTION op_func(loc_id, name, info, operator_data) was not correct (it was zero). Using a debugger it looks like ptr is not passed properly to op_func. Is this true? If not, is there an example that shows how to use ptr/operator_data? Thanks.


#5

Have a look at tH5L_F03.F90 in the fortran/test dir of the HDF5 source, it tests the for non-C_NULL_PTR case.

Scot