Actual source code: vmpicr.c


  2: /*
  3:    This file contains routines for Parallel vector operations.
  4:  */

  6: #include <petscvec.h>

  8: /*@
  9:    VecCreateMPI - Creates a parallel vector.

 11:    Collective

 13:    Input Parameters:
 14: +  comm - the MPI communicator to use
 15: .  n - local vector length (or `PETSC_DECIDE` to have calculated if `N` is given)
 16: -  N - global vector length (or `PETSC_DETERMINE` to have calculated if `n` is given)

 18:    Output Parameter:
 19: .  vv - the vector

 21:    Level: intermediate

 23:    Notes:
 24:    Use `VecDuplicate()` or `VecDuplicateVecs()` to form additional vectors of the
 25:    same type as an existing vector.

 27: .seealso: [](ch_vectors), `Vec`, `VecType`, `VecCreateSeq()`, `VecCreate()`, `VecDuplicate()`, `VecDuplicateVecs()`, `VecCreateGhost()`,
 28:           `VecCreateMPIWithArray()`, `VecCreateGhostWithArray()`, `VecMPISetGhost()`
 29: @*/
 30: PetscErrorCode VecCreateMPI(MPI_Comm comm, PetscInt n, PetscInt N, Vec *v)
 31: {
 32:   PetscFunctionBegin;
 33:   PetscCall(VecCreate(comm, v));
 34:   PetscCall(VecSetSizes(*v, n, N));
 35:   PetscCall(VecSetType(*v, VECMPI));
 36:   PetscFunctionReturn(PETSC_SUCCESS);
 37: }