[petsc-users] [petsc4py] PETSc.Viewer().createHDF5 wipes out existing files
Lisandro Dalcin
dalcinl at gmail.com
Thu Sep 9 16:25:31 CDT 2010
On 9 September 2010 18:05, Blaise Bourdin <bourdin at lsu.edu> wrote:
> Hi,
>
> Hopefully this does not get double posted. I sent the original email from the wrong account to the wrong list…
>
It got double posted. My reply below, just in case.
> I am trying to do HDF5 IO in petsc4py. I noticed that when I create a viewer using
> PETSc.Viewer().createHDF5(inputfile,comm= PETSc.COMM_WORLD)
> the file "outputfile" is wiped out and replaced with a empty hdf5 container, which is bad since I am trying to read forrm it...
>
> Unsurprisingly, I have no problems using the longer approach:
> h5in = PETSc.Viewer().create(PETSc.COMM_WORLD)
> h5in.setType(PETSc.Viewer.Type.HDF5)
> h5in.setFileMode(PETSc.Viewer.Mode.READ)
> h5in.setFileName(inputfile)
>
> Is this expected?
>
Yes, it is expected. These create() methods default to mode=WRITE.
What you and others think about this?
To open in READ mode, just do this:
PETSc.Viewer().createHDF5(inputfile, mode=PETSc.Viewer.Mode.READ,
comm= PETSc.COMM_WORLD)
--
Lisandro Dalcin
---------------
CIMEC (INTEC/CONICET-UNL)
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169
More information about the petsc-users
mailing list