petsc-3.12.4 2020-02-04
PetscBinaryRead
Reads from a binary file.
Synopsis
PetscErrorCode PetscBinaryRead(int fd,void *data,PetscInt num,PetscInt *count,PetscDataType type)
Not Collective
Input Parameters
| fd | - the file descriptor
|
| num | - the maximum number of items to read
|
| type | - the type of items to read (PETSC_INT, PETSC_REAL, PETSC_SCALAR, etc.)
|
Output Parameters
| data | - the buffer
|
| count | - the number of items read, optional
|
Notes
If count is not provided and the number of items read is less than
the maximum number of items to read, then this routine errors.
PetscBinaryRead() uses byte swapping to work on all machines; the files
are written to file ALWAYS using big-endian ordering. On small-endian machines the numbers
are converted to the small-endian format when they are read in from the file.
When PETSc is ./configure with --with-64bit-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-64bit-indices
is used.
See Also
PetscBinaryWrite(), PetscBinaryOpen(), PetscBinaryClose(), PetscViewerBinaryGetDescriptor(), PetscBinarySynchronizedWrite(),
PetscBinarySynchronizedRead(), PetscBinarySynchronizedSeek()
Level
developer
Location
src/sys/fileio/sysio.c
Examples
src/vec/vec/examples/tutorials/ex6.c.html
src/vec/vec/examples/tutorials/ex6f.F90.html
src/dm/examples/tutorials/ex15.c.html
src/ksp/ksp/examples/tutorials/ex54f.F90.html
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages