Function ReadVecWithSizes

Function Documentation

PetscErrorCode ReadVecWithSizes(MPI_Comm COMM, PetscViewer viewer, char *varname, Vec *newvec, PetscInt *n, PetscInt nlocal, PetscInt nglobal, PetscBool trunc)

Read data from a PetscViewer into a Vec (scalar) object. This version good for anticipating allocation across nodes.

Parameters
  • COMM: The MPI communicator, PETSC_COMM_SELF or PETSC_COMM_WORLD.
  • viewer: A PetscViewer instance.
  • *varname: The new vector will have this name. For reading from hdf5 files, this name must match the dataset name in the file.
  • *newvec: The new vector object.
  • *n: The number of entries in the new object.
  • nlocal: The number of entries the local rank will own.
  • nglobal: The total number of expected entries in newvec.
  • trunc: Boolean whether to truncate the imported data.