Date: 2025-03-29T05:58:53+00:00

Actual source code: vseqcr.c

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

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

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

     10:   Collective

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

     16:   Output Parameter:
     17: . v - the vector

     19:   Level: intermediate

     21:   Notes:
     22:   It is recommended to use `VecCreateFromOptions()` instead of this routine

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

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