Randall Mackie randy at
Wed Apr 18 10:27:32 CDT 2007

In my fortran program, I save the results of calculations in a binary file
for later use, like this:

           IF (rank == 0) THEN
             irec = irec + 1
             write(7,rec=irec) hsavx(:,ipol)
             irec = irec + 1
             write(7,rec=irec) hsavy(:,ipol)
             irec = irec + 1
             write(7,rec=irec) hsavz(:,ipol)
           END IF

And then read them back later in a similar fashion.

Is it possible to replace this with PetscViewerBinaryWrite?

There is a flag in this call called istemp, which specifies if the
data can be overwritten. I believe if you set this to false, then
with each call you would simply append the vector to the file?

My question is when you go back to re-read in these vectors, how
does PetscViewerBinaryRead know where to start? In other words,
I don't see a way to specify to start at the beginning, or rewind
the file, or maybe these Fortran concepts are not valid?

Thanks for any suggestions.


Randall Mackie
PMB# 643
2261 Market St.,
San Francisco, CA 94114-1600
Tel (415) 469-8649
Fax (415) 469-5044

California Registered Geophysicist
License No. GP 1034

More information about the petsc-users mailing list