<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Fri, Nov 30, 2018 at 4:03 AM Sal Am <<a href="mailto:tempohoper@gmail.com">tempohoper@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Hi Matthew,</div><div><br></div><div>by raw I mean something the equivalent of pure C++ like<br></div><div><br></div><div>std::fstream fout("Vector_b.bin",std::ios::out | std::ios::binary);</div><div>fout.write((char*)&b[i],sizeof(std::complex<double>));</div><div>fout.close(); //std::vector<
std::complex<double>
> b<br></div><div><br></div><div>i.e. without the PETSc format information, so I can use the resulting data in other software.</div></div></div></div></div></blockquote><div><br></div><div>That format would not let the user know how big the vector was. Moreover, other people would</div><div>want other slightly different formats. The PETSc binary viewer is built from lower level PETSc</div><div>functions which you could use to build whatever output you want.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Thanks <br></div><div><br></div><div><br></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Nov 29, 2018 at 4:39 PM Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Thu, Nov 29, 2018 at 10:50 AM Sal Am via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>Is there a way to write the solution from the system Ax=b in raw binary instead of PETSc binary format?</div></div></div></blockquote><div><br></div><div>What is "raw binary". You have to have some format.</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>Currently I am doing:<br> ierr = PetscViewerBinaryOpen(PETSC_COMM_WORLD, "../../python/petscpy/Vector_x_petsc.dat", FILE_MODE_WRITE, &viewer);CHKERRQ(ierr);<br> ierr = VecView(x,viewer);CHKERRQ(ierr);CHKERRQ(ierr);<br> ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr);</div><div><br></div><div>And then use PetscBinaryIO to read it back and save it using write('newformat', 'wb') to get to raw... however this approach is not good it seems as there are some troubles with little/big endian when using the resulting converted file on other systems for post-processing. <br></div><div><br></div><div>Thanks,</div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="m_8550690722099759565m_3272071233696678754gmail_signature" data-smartmail="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>
</blockquote></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="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>