Building a bridge to HDF5
I've wanted to write data from Dune to HDF5 in the past and could not find an easy way to do that. Since my setting was rather simple (I was only writing block vectors rather than, say, sparse matrices or custom data structures), I wrote wrappers around the C interface myself.
They currently reside in the dune-fufem module in dune/fufem/hdf5 with a corresponding test test-hdf5.cc. Real-world application code that puts it to use can be found here with all the actual work-horse code residing here.
The code provides two classes, HDF5SingletonWriter
that can write data to a single-entry file (I did not bother to implement reading here) and another class HDF5SequenceIO
which can both write and read from a file that automatically grows as data is written beyond its current size.
I'd like to get a discussion started on whether any of this is helpful to anyone, where it could go, what needs to change, and whether it could make its way into the core modules eventually... If there is any interest, I can also turn this into a merge request to make it easier to comment on certain parts of the code.
Update: SWMR mode (single writer, multiple readers) is now supported.