h5md-user
[Top][All Lists]
Advanced

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

Re: [h5md-user] Species Data Type


From: Peter Colberg
Subject: Re: [h5md-user] Species Data Type
Date: Fri, 9 Aug 2013 12:36:08 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Aug 07, 2013 at 10:22:43AM +0200, Olaf Lenz wrote:
> Enum types indeed seem to be an excellent idea in the case of
> species. I wonder whether they would not be useful in some other
> cases as well.  The boundary springs into mind. We could specify
> that 0 always means "no boundary", 1 means "periodic", and when any
> other value is used, a corresponding Enum datatype has to be
> defined.

The same thought also struck my mind after discovering enums. However,
I think enums are better used only where storage efficiency is needed,
i.e. for (potentially) large arrays. In particular, the integer values
of an enum type should not be hard-coded, since they are intended as a
program-internal representation, while the associated strings are the
HDF5 data representation.

> This would avoid the strings-with-variable-lengths problem and still
> give the flexibility to define new values without clash with future
> versions.

I actually find variable-length strings easy to use ;-). At least in
programs with a C string model, it is simpler to write a string using
a variable-length rather than a fixed-length datatype, since all that
is needed is a pointer (or an array of pointers) to the string.

What I find annoying about HDF5 string handling in low-level languages
is the incompatibility of variable-length and fixed-length strings.
It would be of much help if the H5MD specification explicitly defined
string-valued attributes to be of variable-length string datatype.

Peter



reply via email to

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