Open alvarovm opened 2 years ago
Hello,
I wrote subroutines to support HDF5 files, see: https://github.com/alvarovm/madness/blob/h5files/src/madness/world/h5_archive.h
For now, I am just saving one dataset per file. See example below.
It would be great if you could give feedback. I could clean up and send a PR to the main branch if this is useful.
Thanks
#include <madness/world/info.h> #include <cstdio> #include <vector> #include <iostream> using namespace madness; #include <madness/world/h5_archive.h> using madness::archive::H5OutputArchive; using madness::archive::H5InputArchive; template <class OutputArchive> void test_out(const OutputArchive& oar) { constexpr const int n = 3; oar & n; } int main(int argc, char** argv) { std::cout << "git revision " << info::git_commit() << std::endl; std::string name = "dsetmad.h5"; std::vector<int> v = { 7, 5, 16, 8 ,9 }; std::vector<int> vi = { 0, 0, 0, 0 ,0 }; // Print out the vector std::cout << "v = { "; for (int n : v) { std::cout << n << ", "; } std::cout << "}; \n"; std::cout << "v is size "<< v.size() << std::endl; { #Write H5 FILE const char *f = "test.h5"; std::cout << std::endl << "testing h5 archive" << std::endl; H5OutputArchive oar(f); oar & v; oar.flush(); oar.close(); # Read H5 FILE H5InputArchive iar(f); iar & vi; iar.close(); // Print out the vector std::cout << "vi = { "; for (int n : vi) { std::cout << n << ", "; } std::cout << "}; \n"; } return 0; }
Alvaro ... sorry ... did not see this until now. Is this the same as you just merged into the main tree?
Yes. It is the same, just updated
Hello,
I wrote subroutines to support HDF5 files, see: https://github.com/alvarovm/madness/blob/h5files/src/madness/world/h5_archive.h
For now, I am just saving one dataset per file. See example below.
It would be great if you could give feedback. I could clean up and send a PR to the main branch if this is useful.
Thanks