ComputationalRadiationPhysics / libSplash

libSplash - Simple Parallel file output Library for Accumulating Simulation data using Hdf5
GNU Lesser General Public License v3.0
15 stars 15 forks source link

Store states in DataCollectors #237

Open Flamefire opened 8 years ago

Flamefire commented 8 years ago

The DataCollector classes should be converted to C++ classes that can store states.

  1. Store the ID.
    Currently you must pass the id to almost(?) every write/read method. This is inconvenient and error-prone. The ID should be stored (e.g. during opening or with setters if it should be possible to change it) and removed from the write/read interface
  2. Similar with the mpiRank
    Currently some classes use the mpiRank and some use the ID for accessing data, it even seems to be mixed or nulled at some places. Better would be to honor the arguments passed in at file-opening and store it. So it would be possible to use a variable naming scheme for the files (mpiRank or ID in name)
  3. Store the (base) filename
    It might be good to store the basename of the h5 file for users to access it. It is e.g. required for openPMD attributes and doesn't cost much.
  4. Store current dataset
    Writing/reading is often done dataset-wise. So the interface should support that. A wrapper I came up with supports the usage below:

Wrapper:

 dc.setDataset("fields/foobar");
 auto writeAttribute = dc.getAttributeWriter();
 writeAttribute("foo", "bar");
 writeAttribute("idx", 5);
 writeAttribute("units", std::vector<int>(5,0));
ax3l commented 8 years ago

possible to be done as a high-level interface in #163