Use PetscViewerBinarySetSkipHeader(viewer, PETSC_TRUE) before VecView(). On Thu, 29 Nov 2018 at 18:50, Sal Am via petsc-users < petsc-users@mcs.anl.gov> wrote:
> 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, > -- Lisandro Dalcin ============ Research Scientist Computer, Electrical and Mathematical Sciences & Engineering (CEMSE) Extreme Computing Research Center (ECRC) King Abdullah University of Science and Technology (KAUST) http://ecrc.kaust.edu.sa/ 4700 King Abdullah University of Science and Technology al-Khawarizmi Bldg (Bldg 1), Office # 0109 Thuwal 23955-6900, Kingdom of Saudi Arabia http://www.kaust.edu.sa Office Phone: +966 12 808-0459