# VecCreateGhostWithArray

Creates a parallel vector with ghost padding on each processor; the caller allocates the array space.

### Synopsis

    #include "petscvec.h"
    int VecCreateGhostWithArray(MPI_Comm comm,int n,int N,int nghost,const int ghosts[],const PetscScalar array[],Vec *vv)

Collective on MPI_Comm

### Input Parameters

| comm | - the MPI communicator to use
| n | - local vector length
| N | - global vector length (or PETSC_DECIDE to have calculated if n is given)
| nghost | - number of local ghost points
| ghosts | - global indices of ghost points (or PETSC_NULL if not needed)
| array | - the space to store the vector values (as long as n + nghost)

### Output Parameter

vv -the global vector representation (without ghost points as part of vector)

### Notes

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

### See Also

VecCreate(), VecGhostGetLocalForm(), VecGhostRestoreLocalForm(),
VecCreateGhost(), VecCreateSeqWithArray(), VecCreateMPIWithArray(), VecCreateGhostBlock(), VecCreateGhostBlockWithArray()

Level:advanced
Location: src/vec/impls/mpi/pbvec.c
Index of all Vec routines
Table of Contents for all manual pages
Index of all manual pages

### Examples

src/vec/examples/tutorials/ex9.c.html
src/vec/examples/tutorials/ex9f.F.html