writes to a binary file.



Input Parameters#

  • comm - the MPI communicator

  • fd - the file

  • n - the number of items to write

  • p - the buffer, an array of the type that matches the value in type

  • type - the type of items to write (PETSC_INT, PETSC_REAL or PETSC_SCALAR)


MPI rank 0 does a PetscBinaryWrite() the values on other MPI processes are not used

The files are written using big-endian ordering to the file. On little-endian machines the numbers are converted to the big-endian format when they are written to disk. When PETSc is configured using ./configure with --with-64-bit-indices the integers are written to the file as 64-bit integers, this means they can only be read back in when the option --with-64-bit-indices is used.

Because byte-swapping may be done on the values in data it cannot be declared const


This is NOT like PetscSynchronizedFPrintf()! This routine ignores calls on all but MPI rank 0, while PetscSynchronizedFPrintf() has all MPI processes print their strings in order.

See Also#

PetscBinaryWrite(), PetscBinaryOpen(), PetscBinaryClose(), PetscBinaryRead(), PetscBinarySynchronizedRead(), PetscBinarySynchronizedSeek()





Edit on GitLab

Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages