2014-04-02 13:26 GMT-04:00 Chris Richardson <[email protected]>:
>> (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.

>From a user's point of view, this sounds somewhat counterintuitive. I
would expect that the following two commands are "inverses" of each
other:

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

So it would be odd if in the first command "timestep" can be any
floating point number (representing the actual timestep) but in the
second one it has to be an integer (indicating the index in the series
of timesteps that was stored internally). Why not have the 'read'
function look up the value of "timestep" in the "series" attribute and
use this to automatically return the correct vector corresponding to
the given timestep?

>> 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.

Ok, no problem.

>> (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.

No, it doesn't work at the moment (using dolfin version 1.3.0). But it
only seems to fail if a timestep argument is provided. Here is a
minimal example to reproduce:

==>
from dolfin import *

mesh = UnitSquareMesh(2, 2)
V = FunctionSpace(mesh, 'CG', 1)
u = Function(V)
u.vector()[:] = 0
f = HDF5File('data.h5', 'w')

# This works as expected.
#f.write(u, '/foo/bar/baz/quux')

# This produces an error (see below for error message).
f.write(u, '/foo/bar/baz/quux', 0.0)

f.close()
<==

Here is the error message I get:

==>
HDF5-DIAG: Error detected in HDF5 (1.8.4-patch1) MPI-process 0:
  #000: ../../../src/H5L.c line 825 in H5Lexists(): unable to get link info
    major: Symbol table
    minor: Object not found
  #001: ../../../src/H5L.c line 2745 in H5L_exists(): path doesn't exist
    major: Symbol table
    minor: Object already exists
  #002: ../../../src/H5Gtraverse.c line 877 in H5G_traverse():
internal path traversal failed
    major: Symbol table
    minor: Object not found
  #003: ../../../src/H5Gtraverse.c line 776 in H5G_traverse_real():
component not found
    major: Symbol table
    minor: Object not found
HDF5-DIAG: Error detected in HDF5 (1.8.4-patch1) MPI-process 0:
  #000: ../../../src/H5O.c line 243 in H5Oopen(): unable to open object
    major: Symbol table
    minor: Can't open object
  #001: ../../../src/H5O.c line 1294 in H5O_open_name(): object not found
    major: Symbol table
    minor: Object not found
  #002: ../../../src/H5Gloc.c line 468 in H5G_loc_find(): can't find object
    major: Symbol table
    minor: Object not found
  #003: ../../../src/H5Gtraverse.c line 877 in H5G_traverse():
internal path traversal failed
    major: Symbol table
    minor: Object not found
  #004: ../../../src/H5Gtraverse.c line 776 in H5G_traverse_real():
component not found
    major: Symbol table
    minor: Object not found
HDF5-DIAG: Error detected in HDF5 (1.8.4-patch1) MPI-process 0:
  #000: ../../../src/H5A.c line 2543 in H5Aexists(): not a location
    major: Invalid arguments to routine
    minor: Inappropriate type
  #001: ../../../src/H5Gloc.c line 241 in H5G_loc(): invalid object ID
    major: Invalid arguments to routine
    minor: Bad value
HDF5-DIAG: Error detected in HDF5 (1.8.4-patch1) MPI-process 0:
  #000: ../../../src/H5O.c line 1025 in H5Oclose(): not a valid file
object ID (dataset, group, or datatype)
    major: Invalid arguments to routine
    minor: Unable to release object
Traceback (most recent call last):
  File "ggg.py", line 17, in <module>
    f.write(u, '/foo/bar/baz/quux', 0.0)

RuntimeError:

*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
***
***     [email protected]
***
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
*** -------------------------------------------------------------------------
*** Error:   Unable to append to series.
*** Reason:  Function dataset does not contain a 'series' attribute.
*** Where:   This error was encountered inside HDF5File.cpp.
*** Process: 0
***
*** DOLFIN version: 1.3.0
*** Git changeset:  unknown
*** -------------------------------------------------------------------------
<==


>
> My thoughts for near-term enhancements would be:-
>
> (i)  implement f.read(u, 'function', i) as above

Sounds good, but as mentioned above it would be great if the
'timestep' argument could be the same as the one provided during the
write operation, and the lookup in the series attribute would happen
internally.

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

That would certainly be useful as well.

Many thanks!
Max


P.S.: Somewhat unrelated, when I run the code snippet above with the
commented out alternative, I get a HDF5 error as well, even though the
write operation seems to be successful. Any ideas?


HDF5-DIAG: Error detected in HDF5 (1.8.4-patch1) MPI-process 0:
  #000: ../../../src/H5F.c line 1956 in H5Fclose(): decrementing file ID failed
    major: Object atom
    minor: Unable to close file
  #001: ../../../src/H5I.c line 1370 in H5I_dec_ref(): can't locate ID
    major: Object atom
    minor: Unable to find atom information (already closed?)
_______________________________________________
fenics mailing list
[email protected]
http://fenicsproject.org/mailman/listinfo/fenics

Reply via email to