# VecRegister
Adds a new vector component implementation 
## Synopsis
```
#include "petscvec.h"  
PetscErrorCode VecRegister(const char sname[], PetscErrorCode (*function)(Vec))
```
Not Collective


## Input Parameters

- ***name        -*** The name of a new user-defined creation routine
- ***create_func -*** The creation routine itself



## Notes
VecRegister() may be called multiple times to add several user-defined vectors


## Sample usage
```none
    VecRegister("my_vec",MyVectorCreate);
```


Then, your vector type can be chosen with the procedural interface via
```none
    VecCreate(MPI_Comm, Vec *);
    VecSetType(Vec,"my_vector_name");
```

or at runtime via the option
```none
    -vec_type my_vector_name
```





## See Also
 `VecRegisterAll()`, `VecRegisterDestroy()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/vec/interface/vecreg.c.html#VecRegister">src/vec/vec/interface/vecreg.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/vec/vec/interface/vecreg.c)


[Index of all Vec routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
