# VecMPISetGhost
Sets the ghost points for an MPI ghost vector 
## Synopsis
```
#include "petscvec.h"   
PetscErrorCode VecMPISetGhost(Vec vv, PetscInt nghost, const PetscInt ghosts[])
```
Collective


## Input Parameters

- ***vv -*** the MPI vector
- ***nghost -*** number of local ghost points
- ***ghosts -*** global indices of ghost points, these do not need to be in increasing order (sorted)



## Notes
Use VecGhostGetLocalForm() to access the local, ghosted representation
of the vector.

This also automatically sets the ISLocalToGlobalMapping() for this vector.

You must call this AFTER you have set the type of the vector (with VecSetType()) and the size (with VecSetSizes()).




## See Also
 `VecCreateSeq()`, `VecCreate()`, `VecDuplicate()`, `VecDuplicateVecs()`, `VecCreateMPI()`,
`VecGhostGetLocalForm()`, `VecGhostRestoreLocalForm()`, `VecGhostUpdateBegin()`,
`VecCreateGhostWithArray()`, `VecCreateMPIWithArray()`, `VecGhostUpdateEnd()`,
`VecCreateGhostBlock()`, `VecCreateGhostBlockWithArray()`


## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/vec/impls/mpi/pbvec.c.html#VecMPISetGhost">src/vec/vec/impls/mpi/pbvec.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/vec/tutorials/ex9.c.html">src/vec/vec/tutorials/ex9.c.html</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/vec/vec/impls/mpi/pbvec.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)  
