Jed, Barry, Thank you for your advices. I restructured output and got rid of PetscViewerFileSetName by having several viewers and putting more things in one file.
Regards, Alexander On 07.01.2012 03:58, Barry Smith wrote: > On Jan 6, 2012, at 6:51 AM, Alexander Grayver wrote: > >> On 06.01.2012 13:45, Jed Brown wrote: >>> On Fri, Jan 6, 2012 at 03:09, Alexander Grayver<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 > I don't understand why you need ten viewer objects. Why not just dump all > the objects into the one file (creating one Viewer object and never changing > its name) one after each other and then in MATLAB read then back in one after > the other. > > Barry > >> 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
