I see, thank you! Yuyun From: Matthew Knepley <[email protected]> Sent: Friday, March 8, 2019 4:51 PM To: Yuyun Yang <[email protected]> Cc: [email protected] Subject: Re: [petsc-users] Append vector to existing file
On Fri, Mar 8, 2019 at 5:53 PM Yuyun Yang via petsc-users <[email protected]<mailto:[email protected]>> wrote: Hello team, This is a very simple question, but I just want to be sure I understand how the viewer works. I have a file with some vectors already written into it. Now I’m calling PetscViewerASCIIOpen, setting the format and then the file mode into append: PetscViewer viewer; ierr = PetscViewerASCIIOpen(PETSC_COMM_WORLD, filename.c_str(), &viewer); ASCIIOpen() is a simplified interface. For append, I think you need PetscViewerCreate() PetscViewerSetType() PetscViewerFileSetMode() PetscViewerFileSetName() PetscViewerPushFormat() Matt ierr = PetscViewerPushFormat(viewer, PETSC_VIEWER_ASCII_MATLAB); CHKERRQ(ierr); ierr = PetscViewerFileSetMode(viewer, FILE_MODE_APPEND); CHKERRQ(ierr); After which I call VecView to append some new vectors to the existing file. But this operation is clearing out my existing file and writing it with new information. Does the append mode happen to not work with this type of viewer, or am I missing something here? Thanks a lot, Yuyun -- 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 https://www.cse.buffalo.edu/~knepley/<http://www.cse.buffalo.edu/~knepley/>
