[petsc-users] RAW binary write

Sal Am tempohoper at gmail.com
Thu Nov 29 09:49:01 CST 2018


Is there a way to write the solution from the system Ax=b in raw binary
instead of PETSc binary format?

Currently I am doing:
  ierr = PetscViewerBinaryOpen(PETSC_COMM_WORLD,
"../../python/petscpy/Vector_x_petsc.dat", FILE_MODE_WRITE,
&viewer);CHKERRQ(ierr);
  ierr = VecView(x,viewer);CHKERRQ(ierr);CHKERRQ(ierr);
  ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr);

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.

Thanks,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20181129/88eb79ea/attachment.html>


More information about the petsc-users mailing list