PetscErrorCode PetscBinaryWrite(int fd,void *p,PetscInt n,PetscDataType type,PetscBool istemp)Not Collective
fd | - the file | |
p | - the buffer | |
n | - the number of items to write | |
type | - the type of items to read (PETSC_INT, PETSC_DOUBLE or PETSC_SCALAR) | |
istemp | - PETSC_FALSE if buffer data should be preserved, PETSC_TRUE otherwise. |
The Buffer 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. If the flag istemp is set to PETSC_TRUE, the second byte-swapping operation is not done, thus saving some computation, but the buffer is left corrupted.
Because byte-swapping may be done on the values in data it cannot be declared const
Level:advanced
Location:src/sys/fileio/sysio.c
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages