PetscBinarySynchronizedWrite#

writes to a binary file.

Synopsis#

Collective

Input Parameters#

  • comm - the MPI communicator

  • fd - the file

  • n - the number of items to write

  • p - the buffer

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

Notes#

Process 0 does a PetscBinaryWrite()

PetscBinarySynchronizedWrite() uses byte swapping to work on all machines. Integers are stored on the file as 32 long, regardless of whether they are stored in the machine as 32 or 64, this means the same binary file may be read on any machine.

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

WARNING#

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

See Also#

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

Level#

developer

Location#

src/sys/fileio/sysio.c


Edit on GitLab

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