[petsc-users] Multiple vectors read/written into one file in binary/HDF5 format

Matthew Knepley knepley at gmail.com
Thu Jun 9 17:08:41 CDT 2011


On Thu, Jun 9, 2011 at 5:05 PM, Li, Zhisong (lizs) <lizs at mail.uc.edu> wrote:

>  Hi, Petsc Team,
>
>
> I know that we can write multiple vectors or matrices into one binary file
> by doing
>
>    PetscViewerBinaryOpen(COMM, "./vector.dat", FILE_MODE_WRITE, &viewer1);
>
>    VecView(a, viewer1);
>    PetscViewerBinaryOpen(COMM, "./vector.dat", FILE_MODE_APPEND, &viewer1);
>    VecView(b, viewer1);
>

Just call VecView twice without reopening the file.


>
> But if we want to read from "./vector.dat" and distribute the respective
> values to vector a and b, how to realize that?  What I previously knew is
> "one file for one vector only" when reading.
>

Just call VecLoad twice.


> Another question is about the HDF5 format.  I've included "petscsys.h" at
> the code header.  But when I complied (make file) the code, the error
> message indicated "undefined reference to PetscViewerHDF5Open".  The error
> also happens to the example codes for this function.  What's wrong with is?
> Is it no more supported?
>

Did you configure with support for HDF5, --with-hdf5?

  Thanks,

     Matt


>
> Thank you.
>
>
>
> Zhisong Li
>



-- 
What most experimenters take for granted before they begin their experiments
is infinitely more interesting than any results to which their experiments
lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110609/5257dc7d/attachment.htm>


More information about the petsc-users mailing list