On 02/04/2014 15:02, Maximilian Albert wrote:

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)


Yes, I guess that could work, if "timestep" is just an integer index.

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

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

This is not going to happen any time soon, simply because of the complexity
of saving a "FunctionSpace" to file.

(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")

Can't you do this? I thought the name could be more-or-less anything.

My thoughts for near-term enhancements would be:-

(i)  implement f.read(u, 'function', i) as above
(ii) implement f.get_series('function') or something like that, which
     could return the timeseries as a vector<double>
Probably you can do this at the moment with f.attributes('function')

With that information, the user can pull out whichever dataset they want.

Chris

_______________________________________________
fenics mailing list
[email protected]
http://fenicsproject.org/mailman/listinfo/fenics

Reply via email to