I don’t understand the H5Dfill() API. I can’t find any sample code, neither more detailed doc.
How is “buf” supposed to be used ? (Pointer to the memory buffer containing the selection to be filled)
I don’t understand the concept of “memory buffer” when I am just trying to fill a whole dataset with a specific value. I am not aware of any mean to load a subset of the dataset in memory and get a pointer to it.
I can see that H5Diterate() also have such an unexpected “memory pointer” concept that I can’t find out how is is supposed to be used.
Given a memory buffer buf and a subset of elements, as described by a selection on space_id, the purpose of H5Dfill is to initialize each of the selected elements in the buffer with the fill value fill provided. (There might be a datatype conversion between fill_type_id and buf_type_id.)
For a simple example, take an uninitialized memory buffer large enough to hold n elements of size s [byte]. Let’s assume we have a dataspace of n elements, where every other element is selected. Calling H5Dfill with a fill value on this buffer will initialize every other element with a copy of that fill value. OK?
You cannot use this function with datasets in an HDF5 file. You would use a combination of H5Pset_fill_value and H5Pset_fill_time for that. However, you can, of course, H5Dwrite a buffer prepared by H5Dfill to a dataset.