On 28 September 2013 10:42, Chris Richardson <[email protected]> wrote:
>
> This is a continuation of the discussion at:
>
> https://bitbucket.org/fenics-project/dolfin/pull-request/52
>
> The question is how best to save a time-series of Function in HDF5, when the
> cell and dof layout remains constant.
>
> It has been suggested to use:
>
> u = Function(V)
> h0 = HDF5File('Timeseries_of_Function.h5', 'w')
> h0.write(u, '/Function')
> # Then later
> h0.write(u.vector(), "/Vector/0")
> h0.write(u.vector(), "/Vector/1")
>
Shouldn't this be
h0.write(u.vector(), "/Function/Vector/0")
h0.write(u.vector(), "/Function/Vector/1")
?
> and to read back:
>
> u = Function(V)
> h0 = HDF5File('Timeseries_of_Function.h5', 'r')
> h0.read(u, "/Function")
> h0.read(u.vector(), "/Function/vector")
>
> The problem with this, is not so much the saving of the vector, but the
> reading back. It works OK if the vector is distributed in the same way, but
> will fail
> in the general case.
>
A problem with the above is that
u = Function(V)
implies a DofMap, which will be used to initialise the underlying
vectors, when the DofMap should be read from file by
h0.read(u, "/Function")
If the DofMap is read correctly from file and the underlying Function
vector is distributed accordingly, I don't see why reading the Vector
should be a problem.
> To fix the problem, there needs to be some kind of connection between the
> original Function and the subsequent Vectors.
Isn't the 'connection' implied by the hierarchy in the HDF5 file,
i.e. Vectors under 'MyFunction/' belong to 'MyFunction'?
Garth
> This could be provided at
> write time, by storing a link back to the original Function when writing a
> Vector, or at read time by specifying a base Function and an alternative
> Vector to read.
>
> Chris R.
> _______________________________________________
> fenics mailing list
> [email protected]
> http://fenicsproject.org/mailman/listinfo/fenics
_______________________________________________
fenics mailing list
[email protected]
http://fenicsproject.org/mailman/listinfo/fenics