Writes to a binary file.
fd - the file
p - the buffer, an array of the type that matches the value in
n - the number of items to write
type - the type of items to read (
PetscBinaryWrite() uses byte swapping to work on all machines; 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
If running with
__float128 precision the output of
PETSC_REAL is in
__float128 unless one uses the
p should be read-write buffer, and not static data.
This way, byte-swapping is done in-place, and then the buffer is
written to the file.
This routine restores the original contents of the buffer, after it is written to the file. This is done by byte-swapping in-place the second time.
Because byte-swapping may be done on the values in data it cannot be declared const