Actual source code: veccreate.c

petsc-3.8.3 2017-12-09
Report Typos and Errors

  2:  #include <petsc/private/vecimpl.h>

  4: /*@
  5:   VecCreate - Creates an empty vector object. The type can then be set with VecSetType(),
  6:   or VecSetFromOptions().

  8:    If you never  call VecSetType() or VecSetFromOptions() it will generate an
  9:    error when you try to use the vector.

 11:   Collective on MPI_Comm

 13:   Input Parameter:
 14: . comm - The communicator for the vector object

 16:   Output Parameter:
 17: . vec  - The vector object

 19:   Level: beginner

 21: .keywords: vector, create
 22: .seealso: VecSetType(), VecSetSizes(), VecCreateMPIWithArray(), VecCreateMPI(), VecDuplicate(),
 23:           VecDuplicateVecs(), VecCreateGhost(), VecCreateSeq(), VecPlaceArray()
 24: @*/
 25: PetscErrorCode  VecCreate(MPI_Comm comm, Vec *vec)
 26: {
 27:   Vec            v;

 32:   *vec = NULL;
 33:   VecInitializePackage();

 35:   PetscHeaderCreate(v, VEC_CLASSID, "Vec", "Vector", "Vec", comm, VecDestroy, VecView);

 37:   PetscLayoutCreate(comm,&v->map);
 38:   v->array_gotten = PETSC_FALSE;
 39:   v->petscnative  = PETSC_FALSE;

 41:   *vec = v;
 42:   return(0);
 43: }