Thanks Mat, Use the DA coordinate mechanism and you can get the coordinates as a parallel Vec.
well, that won't be working for me since although I use one DA and the parallel vectors derived from same DA, yet I am using staggered grid formulation. So, there the coordinates could be different for different vectors. Is there any other way around this ? On Thu, Jan 19, 2012 at 6:59 AM, Matthew Knepley <knepley at gmail.com> wrote: > On Thu, Jan 19, 2012 at 2:50 AM, Mohamad M. Nasr-Azadani <mmnasr at gmail.com > > wrote: > >> Hi guys, >> >> I have compiled petsc to use HDF5 package. >> >> I like to store the data from a parallel vector(s) (obtained from >> structured DA in 3 dimensions) to file using VecView() in conjunction with >> PetscViewerHDF5Open(). >> >> I followed the example here >> http://www.mcs.anl.gov/petsc/petsc-current/src/dm/examples/tutorials/ex10.c.html >> and everything looks fine. >> >> However, I had a couple questions: >> >> 1- When I am done writing the parallel vector obtained from the DA (and >> PETSC_COMM_WORLD), >> >> // Create the HDF5 viewer >> PetscViewerHDF5Open<http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Viewer/PetscViewerHDF5Open.html#PetscViewerHDF5Open> >> (PETSC_COMM_WORLD<http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PETSC_COMM_WORLD.html#PETSC_COMM_WORLD> >> ,"gauss.h5",FILE_MODE_WRITE,&H5viewer); >> // Write the H5 file >> >> VecView<http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecView.html#VecView> >> (gauss,H5viewer); >> // Cleaning stage >> PetscViewerDestroy<http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Viewer/PetscViewerDestroy.html#PetscViewerDestroy> >> (&H5viewer); >> >> how can I add data that are just simple 1-D numbers stored on local >> arrays. >> Easier said, I would like to add the structured grid coordinates (first >> all x's, then all y's, and then all z's) at the end (or to the beginning) >> of each data (*.h5) file. But the grid coordinates are stored locally on >> each machine and not derived from any parallel vectors or DA. I was >> thinking about creating vectors and viewers using PETSC_COMM_SELF but i am >> not sure if that is the right approach since that vector is created on all >> processors locally. >> > > Use the DA coordinate mechanism and you can get the coordinates as a > parallel Vec. > > >> 2- When using VecView() and HDF5 writer, what is the status of data >> compression? >> The reason that I am asking is that, I used the same example above and >> comparing two files saved via two different PetscViewers, i.e. (just) >> Binary and HDF5 (Binary) the size is not reduced in the (*.h5) case. >> In fact, it is slightly bigger than pure binary file!! >> Is there any command we have to set in Petsc to tell HDF5 viewer to use >> data compression? >> > > We do not support it. We are happy to take patches that enable this. > > Thanks, > > Matt > > >> Thanks for your patience, >> Best, >> Mohamad >> >> >> >> >> > > > -- > 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/20120119/5543660d/attachment.htm>
