[petsc-users] Multiple output using one viewer

Alexander Grayver agrayver at gfz-potsdam.de
Fri Jan 6 06:51:46 CST 2012


On 06.01.2012 13:45, Jed Brown wrote:
> On Fri, Jan 6, 2012 at 03:09, Alexander Grayver 
> <agrayver at gfz-potsdam.de <mailto:agrayver at gfz-potsdam.de>> wrote:
>
>     This is not always convinient to store everything in one file, but
>     in some cases I do want to use it. I haven't found any examples on
>     that. Do I have to use FILE_MODE_APPEND and then write? What
>     happens if file doesn't exist?
>
>
> You just create a viewer and then call MatView(), VecView(), etc, 
> repeatedly for each object you want to put in the file (e.g. once per 
> time step). No need for FILE_MODE_APPEND and unless you want to append 
> to an existing file.

Ok, that was my meaning to use PetscViewerFileSetName from the beginning 
since if you have let's say ten different objects (Mat and Vec) and you 
need to output them at each iteration (time step or frequency for 
multi-freqs modeling) you need ten viewer objects which is not cool I 
guess, that is why I started to use one viewer and change just a name of 
the file.
And to be honest I don't see any reason why having ten viewers is better 
than calling PetscViewerFileSetName ten times.

Regards,
Alexander
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120106/0e9290f3/attachment.htm>


More information about the petsc-users mailing list