[petsc-dev] reading vector from HDF5 with DMPlex
Adrian Croucher
a.croucher at auckland.ac.nz
Sun Feb 14 21:16:11 CST 2016
OK, I think I've figured out what the problem was here. The
'cell_geometry' vector I wrote to the HDF5 file was actually a local
vector (not global). If I first do DMLocalToGlobal on it and then
VecView the global vector, it turns up under the 'fields' group, and I
can access it for reading back in.
Cheers, Adrian
On 12/02/16 18:07, Adrian Croucher wrote:
> hi
>
> I'm having trouble reading in a vector on a DMPlex from an HDF5 file.
> The attached minimal program (readdmvec2.F90) illustrates the problem.
>
> What it does is:
> - reads in a DMPlex from file (ghotcol.exo) and sets it up
> (distributes, constructs ghost cells and default section)
> - uses DMGetGlobalVector() to get the vector
> - sets its object name to 'cell_geometry'
> - opens the HDF5 file (hotcol_ss.h5) in a viewer and tries to read the
> vector using VecLoad()
>
> The VecLoad() dies, saying "object 'cell_geometry' doesn't exist" in
> the HDF5 file. (Full error message is below.)
>
> But it does exist- it shows up as a dataset in the '/' group in
> h5dump. I can also read it in from a Python script and h5py, e.g.:
>
> >>> import h5py
> >>> f = h5py.File('hotcol_ss.h5')
> >>> f['cell_geometry'][:]
>
> Any idea why VecLoad() can't find it? I get the same error running on
> any number of processors.
>
> The program that writes 'cell_geometry' to the HDF5 file also
> subsequently writes time-dependent simulation results to the same file
> (that's what the other datasets are in there) using
> DMSetOutputSequenceNumber() and VecView(). I am wondering if the
> problem is related to this, because if I just write a simple vector
> out to the file by itself it seems to read back in ok.
>
> Cheers, Adrian
>
>
--
Dr Adrian Croucher
Senior Research Fellow
Department of Engineering Science
University of Auckland, New Zealand
email: a.croucher at auckland.ac.nz
tel: +64 (0)9 923 84611
More information about the petsc-dev
mailing list