[petsc-users] hdf5 and FILE_MODE_APPEND

Matthew Knepley knepley at gmail.com
Fri Jan 20 15:55:01 CST 2012


On Fri, Jan 20, 2012 at 3:47 PM, Mohamad M. Nasr-Azadani
<mmnasr at gmail.com>wrote:

> I know, it is getting very confusing. But this sounds very simple but got
> this complicated so far.
> I think you have seen my emails yesterday.
> I want to write a vector (3D DMDA, structured) at each time to an hdf5
> file.
> But, I want to also add the coodinates to the same *.h5 file as well.
> The grid is structured, so I only need 3 1-D arrays representing the
> coordinates (and not 1D*1D*1D coordinates cell coordinates).
> How would you go about it?
>
> I thought about creating a "parallel" vector which has the size of 0 on
> all processors and N on processor zero and then dump the coordinates into
> that vector and into the same hdf5 file. No luck, since hdf5 writer does
> not like zero-sized local vectors (if I could have done this, then I could
> use the same hdf5 viewer and not close the file). But now, I am stuck.
> I think about closing the hdf5 viewer after I dumped the field data,
> create a vector using PETSC_COMM_SELF including the coordinates on all
> processor and then add that vector to the end of same hdf5 file (that's why
> I need to open it and use append mode). Of course, I would do the writing
> only on processor zero.
>

There is no need for append mode. HDF5 does not work that way. Just open it
up and write.

   Matt


> I hope I did not confuse you.
> Thanks,
> Mohamad
>
>
>
>
>
> On Fri, Jan 20, 2012 at 1:37 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
>
>> On Fri, Jan 20, 2012 at 15:33, Mohamad M. Nasr-Azadani <mmnasr at gmail.com>wrote:
>>
>>> At this point, I can't since the first time the viewer is created via
>>>  PETSC_COMM_WORLD and the second time, PETSC_COMM_SELF.
>>> (I am not even 100% sure if that could cause any troubles with the hdf5
>>> file?)
>>>
>>
>> Well this sounds pretty confusing. What are you actually trying to do?
>>
>
>


-- 
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/20120120/f2f624ef/attachment.htm>


More information about the petsc-users mailing list