PETSc version 3.16.5
Fix/Edit manual page

# VecSetType

Builds a vector, for a particular vector implementation.

### Synopsis

    #include "petscvec.h"
    PetscErrorCode VecSetType(Vec vec, VecType method)

Collective on Vec

### Input Parameters

| vec | - The vector object
| method | - The name of the vector type

### Options Database Key

| -vec_type <type> | - Sets the vector type; use -help for a list of available types

### Notes

See "petsc/include/petscvec.h" for available vector types (for instance, VECSEQ, VECMPI, or VECSHARED).

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

### See Also

VecGetType(), VecCreate()

### Level

intermediate

### Location

src/vec/vec/interface/vecreg.c

### Examples

src/vec/vec/tutorials/ex9.c.html
src/vec/vec/tutorials/ex10.c.html
src/dm/impls/plex/tutorials/ex12.c.html
src/ksp/ksp/tutorials/ex73.c.html
src/snes/tutorials/ex70.c.html
src/tao/constrained/tutorials/maros.c.html
src/tao/pde_constrained/tutorials/hyperbolic.c.html
Index of all Vec routines
Table of Contents for all manual pages
Index of all manual pages