Actual source code: veccreate.c
petsc-3.7.1 2016-05-15
Report Typos and Errors

      2: #include <petsc/private/vecimpl.h>           /*I  "petscvec.h"   I*/

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

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

     13:   Collective on MPI_Comm

     15:   Input Parameter:
     16: . comm - The communicator for the vector object

     18:   Output Parameter:
     19: . vec  - The vector object

     21:   Level: beginner

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

     34:   *vec = NULL;
     35:   VecInitializePackage();

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

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

     43:   *vec = v;
     44:   return(0);
     45: }