h5md-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [h5md-user] generic API for H5MD libraries


From: Pierre de Buyl
Subject: Re: [h5md-user] generic API for H5MD libraries
Date: Fri, 24 Apr 2015 16:04:59 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

Hi Felix,

On Fri, Apr 10, 2015 at 10:43:23AM +0200, Felix Höfling wrote:
> At the time being we have already a bunch of libraries that support reading
> and writing H5MD [1], specifically for Fortran, Python, C (thanks to
> Pierre), a second one for C (Jonas, see VMD plugin), and Lua (Peter). For
> myself, I'm planning a C++ version.
> 
> My proposal is to specify a (generic) API for H5MD libraries which then can
> be implemented in the various languages. I didn't inspect all the different
> libraries more closely, but I suspect that the essential functions have
> similar interfaces.
> 
> Such a specification would be helpful to define a set of core functionality
> that any H5MD library should provide. Of course, it has to be written as
> pseudo-prototypes, e.g. it does not say whether output is passed by return
> value, reference or pointers, etc. Examples are given below.
> 
> Please let me know, what you think.

I think that it is overkill, at least at the moment. We can discuss our
implementations strategies and, if time allows summarize them somehow to share
the good ideas. The 'should' part is annoying. I find it hard enough to have the
time to write code and don't want additional constraints.

As a kind of contribution, the header file of ch5md lists all the commands so it
is a good starting point:
https://github.com/pdebuyl/ch5md/blob/master/src/ch5md.h

pyh5md, for instance, is relatively easy to use but I think that it should be
simplified and presents a lighter layer on top of h5py, which is a great
library. Any ideas are welcome :-)

Also, even though pyh5md can write and read H5MD files, I often find myself
reading the files directly with h5py instead.

As a last comment, I find that it is quite complex to design for all the use
cases in a library (are the box edges changing?, is the simulation parallel,
etc) and I tend to reduce the choices available in a library. In the lammps
writer I have written, the box is always time dependent to avoid one more
conditional. And also because there is less risk that the user erroneously
specifies a fixed-in-time box when it is actually not.

Cheers,

Pierre

> function validate_file
>       Input: filename (or HDF5 group?)
>       Output: boolean, true if "filename" (HDF5 tree) is in H5MD format
> 
> function read_h5md_element
>       Input: HDF5 group (e.g., "/particles/A")
>       Input: field name (e.g., "position", "id")
>       Input (optional): step
>       Output: data at given step
>       Output (optional): boolean, true upon success
> 
> function write_h5md_data
>       Input: HDF5 group
>       Input: field name
>       Input (optional): step
>       Output: boolean, true upon success
> 
> [1] http://nongnu.org/h5md/software.html#reading-and-writing-h5md-files
> 

-- 
-----------------------------------------------------------
Pierre de Buyl
KU Leuven - Institute for Theoretical Physics
T +32 16 3 27355
W http://pdebuyl.be/
-----------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]