Actual source code: vmpicr.c
1: /*
2: This file contains routines for Parallel vector operations.
3: */
5: #include <petscvec.h>
7: /*@
8: VecCreateMPI - Creates a parallel vector.
10: Collective
12: Input Parameters:
13: + comm - the MPI communicator to use
14: . n - local vector length (or `PETSC_DECIDE` to have calculated if `N` is given)
15: - N - global vector length (or `PETSC_DETERMINE` to have calculated if `n` is given)
17: Output Parameter:
18: . v - the vector
20: Level: intermediate
22: Notes:
23: It is recommended to use `VecCreateFromOptions()` instead of this routine
25: Use `VecDuplicate()` or `VecDuplicateVecs()` to form additional vectors of the
26: same type as an existing vector.
28: .seealso: [](ch_vectors), `Vec`, `VecType`, `VecCreateSeq()`, `VecCreate()`, `VecDuplicate()`, `VecDuplicateVecs()`, `VecCreateGhost()`,
29: `VecCreateMPIWithArray()`, `VecCreateGhostWithArray()`, `VecMPISetGhost()`
30: @*/
31: PetscErrorCode VecCreateMPI(MPI_Comm comm, PetscInt n, PetscInt N, Vec *v)
32: {
33: PetscFunctionBegin;
34: PetscCall(VecCreate(comm, v));
35: PetscCall(VecSetSizes(*v, n, N));
36: PetscCall(VecSetType(*v, VECMPI));
37: PetscFunctionReturn(PETSC_SUCCESS);
38: }