Hi Chris,

many thanks for the clarification! So it sounds like HDF5File should
be favoured over TimeSeriesHDF5.

>> I saw a proposal a while ago about advanced HDF5File functionality
>> (e.g. using 'HDF5FunctionHandle'); see this thread: [1]. However, this
>> doesn't seem implemented yet. Is it still on the agenda, or was it
>> superseded by something else? In the meantime, what are the
>> recommended alternatives?
>
> No, that was never carried forward - seemed a little too complex.

Ok. It looked quite promising and intuitive when I saw it, but I
appreciate that a simpler interface can probably equally well
accommodate the most common use cases.

> I believe you can do this:-
>
> f = df.HDF5File('data.h5','r')
> # u must alread exist and be on the correct FunctionSpace
> u = Function(Q)
> f.read(u, 'my_function/vector_2')
>
> though perhaps not the most elegant. Suggestions for improvement are welcome
> - provided that they make the interface simple and intuitive :-).

Two suggestions immediately come to mind:

(i) Would it be possible to add something like this:

   f.read(u, 'my_function', timestep)

? Internally, this would look up the correct vector (here: 'vector_2')
associated with the timestep so that the user doesn't need to
explicitly specify it themselves. (Btw, I saw that the first vector is
simply called 'my_function/vector' rather than 'my_function/vector_0'
which makes it even less elegant because it requires another case
distinction to retrieve it.)

On the Python level it would be great to have the slightly more
intuitive syntax:

    u = f.read('my_function', timestep)

which creates and returns a function u on the correct FunctionSpace
rather than passing in a pre-existing one as the first parameter. (For
efficiency reasons, the more C-like syntax is still very useful
because u doesn't need to be re-created for each read operation, but
it would be very convenient to have the second option available, too.)

(ii) It would be great if it was possible to create arrays in nested
subgroups by specifying slashes in the group name, e.g.:

   f.write(u, "/foo/bar/baz/quux")

This would allow the user to manually label the timesteps in subgroups:

   f.write(u, "/my_function/0.0")
   f.write(u, "/my_function/1e-9")
   f.write(u, "/my_function/2e-9")

It's certainly less flexible than (i), especially if more complex
operations or queries are needed, but if the exact timesteps are known
in advance it would be a quick and easy solution. Also, I'm sure that
nested subgroups would be useful in a variety of other use cases.

Thanks and best wishes,
Max
_______________________________________________
fenics mailing list
[email protected]
http://fenicsproject.org/mailman/listinfo/fenics

Reply via email to