petsc-3.12.4 2020-02-04
Report Typos and Errors

# VecCreate

Creates an empty vector object. The type can then be set with VecSetType(), or VecSetFromOptions().

### Synopsis

    #include "petscvec.h"
    PetscErrorCode  VecCreate(MPI_Comm comm, Vec *vec)

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

Collective

### Input Parameter

comm -The communicator for the vector object

### Output Parameter

vec -The vector object

### See Also

VecSetType(), VecSetSizes(), VecCreateMPIWithArray(), VecCreateMPI(), VecDuplicate(),
VecDuplicateVecs(), VecCreateGhost(), VecCreateSeq(), VecPlaceArray()

### Level

beginner

### Location

src/vec/vec/interface/veccreate.c

### Examples

src/vec/vec/utils/tagger/examples/tutorials/ex1.c.html
src/vec/vec/examples/tutorials/ex1.c.html
src/vec/vec/examples/tutorials/ex2.c.html
src/vec/vec/examples/tutorials/ex3.c.html
src/vec/vec/examples/tutorials/ex5.c.html
src/vec/vec/examples/tutorials/ex6.c.html
src/vec/vec/examples/tutorials/ex7.c.html
src/vec/vec/examples/tutorials/ex8.c.html
src/vec/vec/examples/tutorials/ex9.c.html
src/vec/vec/examples/tutorials/ex10.c.html
src/vec/vec/examples/tutorials/ex11.c.html

### Implementations

VecCreate_MPICUDA in src/vec/vec/impls/mpi/mpicuda/mpicuda.cu
VecCreate_CUDA in src/vec/vec/impls/mpi/mpicuda/mpicuda.cu
VecCreate_MPIViennaCL in src/vec/vec/impls/mpi/mpiviennacl/mpiviennacl.cxx
VecCreate_ViennaCL in src/vec/vec/impls/mpi/mpiviennacl/mpiviennacl.cxx
VecCreate_MPI in src/vec/vec/impls/mpi/pbvec.c
VecCreate_Standard in src/vec/vec/impls/mpi/pbvec.c
VecCreate_Node in src/vec/vec/impls/node/vecnode.c
VecCreate_Seq in src/vec/vec/impls/seq/bvec3.c
VecCreate_SeqCUDA in src/vec/vec/impls/seq/seqcuda/veccuda.c
VecCreate_SeqViennaCL in src/vec/vec/impls/seq/seqviennacl/vecviennacl.cxx
VecCreate_Shared in src/vec/vec/impls/shared/shvec.c
VecCreate_Shared in src/vec/vec/impls/shared/shvec.c
Index of all Vec routines
Table of Contents for all manual pages
Index of all manual pages