<div dir="ltr"><div dir="ltr">On Fri, Mar 8, 2019 at 5:53 PM Yuyun Yang via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">





<div lang="EN-US">
<div class="gmail-m_-1240697412767583422WordSection1">
<p class="MsoNormal">Hello team,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">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:<u></u><u></u></p>
<p class="MsoNormal">  PetscViewer viewer;<u></u><u></u></p>
<p class="MsoNormal">  ierr = PetscViewerASCIIOpen(PETSC_COMM_WORLD, filename.c_str(), &viewer);</p></div></div></blockquote><div><br></div><div>ASCIIOpen() is a simplified interface. For append, I think you need</div><div><br></div><div>  PetscViewerCreate()</div><div>  PetscViewerSetType()</div><div>  PetscViewerFileSetMode()</div><div>  PetscViewerFileSetName()</div><div>  PetscViewerPushFormat()</div><div><br></div><div>    Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-US"><div class="gmail-m_-1240697412767583422WordSection1"><p class="MsoNormal"><u></u><u></u></p>
<p class="MsoNormal">  ierr = PetscViewerPushFormat(viewer, PETSC_VIEWER_ASCII_MATLAB); CHKERRQ(ierr);<u></u><u></u></p>
<p class="MsoNormal" style="text-indent:5pt">ierr = PetscViewerFileSetMode(viewer, FILE_MODE_APPEND); CHKERRQ(ierr);<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">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?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Thanks a lot,<u></u><u></u></p>
<p class="MsoNormal">Yuyun<u></u><u></u></p>
</div>
</div>

</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>