Actual source code: vseqcr.c


  2: /*
  3:    Implements the sequential vectors.
  4: */

  6: #include <../src/vec/vec/impls/dvecimpl.h>

  8: /*@
  9:    VecCreateSeq - Creates a standard, sequential array-style vector.

 11:    Collective

 13:    Input Parameters:
 14: +  comm - the communicator, should be `PETSC_COMM_SELF`
 15: -  n - the vector length

 17:    Output Parameter:
 18: .  V - the vector

 20:    Level: intermediate

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

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