How to use H5copy in C++ code

Hello Team,

I want to copy few groups from one hdf5 file to hdf5 another file which is not yet created and this should be done inside the C++ code..can you please tell me how can i use this inside this tool

Hey sandhya, this sounds like the perfect question for our next HDF Clinic. If you can make it, I reckon @steven will get you up and running in 10 min or your money back :wink: . If you can’t make it, you can watch the recording on the hdf5 YouTube channel. Deal? G.

1 Like

On the next Gerd Heber’s HDF Clinic, Feb 23 13:00CT I will explore this problem by providing a fast implementation of random trees based on Prufer sequence – to generate the datasets we will be using for this exercise; then demonstrate the HDF5 C API interop feature of H5CPP to delegate tedious HDF5 handle management to simple/safe RAII idiom – a feature of H5CPP. Then use the H5O_visit(…) in a visitor pattern to traverse the specified input subgroup and H5O_copy(…) to the newly created or opened HDF5 container.

The presentation will be short, roughly 10mins , will provide the MIT licensed C++ code with GNU Makefiles and here is the outline:

  • create random HDF5 file for input: 1 min
  • H5CPP with C API: interop: 2 mins
  • how to write callback for iteration: 1 min
  • assembling the components / final software: 3 mins
  • demo: run the software 1min
  • Q/A: 2 mins

The prerequisites:

  • some understanding of C++ and C programming language
  • some understanding of the HDF5 concepts and API calls
  • HDF5 C API v1.10.6 parallel compile LIBS=-lhdf5 -lz -ldl -lm
  • g++ 9.3.0 in c++17 mode
  • h5cpp v 1.10.6

Post your questions here, or ask them in person on the event!

best wishes: steven

The few liner example code is uploaded to this github page, you can generate random dataset by downloading this project

And tomorrow, on Gerd Heber’s HDF Clinic I will go through the code
best wishes: steven

ocpy.cpp (4.0 KB)