[petsc-dev] [petsc4py] PETSc.Viewer().createHDF5 wipes out existing files

Lisandro Dalcin dalcinl at gmail.com
Thu Sep 9 16:24:08 CDT 2010


On 9 September 2010 17:40, Blaise Bourdin <bourdin at math.lsu.edu> wrote:
> Hi,
>
> 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-dev mailing list