# DMPlexVecGetClosure
Get an array of the values on the closure of 'point' 
## Synopsis
```
#include "petscdmplex.h"   
PetscErrorCode DMPlexVecGetClosure(DM dm, PetscSection section, Vec v, PetscInt point, PetscInt *csize, PetscScalar *values[])
```
Not collective


## Input Parameters

- ***dm -*** The DM
- ***section -*** The section describing the layout in v, or NULL to use the default section
- ***v -*** The local vector
- ***point -*** The point in the DM



## Input/Output Parameters

- ***csize  -*** The size of the input values array, or NULL; on output the number of values in the closure
- ***values -*** An array to use for the values, or NULL to have it allocated automatically;
if the user provided NULL, it is a borrowed array and should not be freed



```none
Note that DMPlexVecGetClosure/DMPlexVecRestoreClosure only allocates the values array if it set to NULL in the
```
```none
calling function. This is because DMPlexVecGetClosure() is typically called in the inner loop of a Vec or Mat
```
```none
assembly function, and a user may already have allocated storage for this operation.
```
```none
```
```none
A typical use could be
```
```none
```
```none
values = NULL;
```
```none
PetscCall(DMPlexVecGetClosure(dm, NULL, v, p, &clSize, &values));
```
```none
for (cl = 0; cl < clSize; ++cl) {
```
```none
<Compute on closure>
```
```none
}
```
```none
PetscCall(DMPlexVecRestoreClosure(dm, NULL, v, p, &clSize, &values));
```
```none
```
```none
or
```
```none
```
```none
PetscMalloc1(clMaxSize, &values);
```
```none
for (p = pStart; p < pEnd; ++p) {
```
```none
clSize = clMaxSize;
```
```none
PetscCall(DMPlexVecGetClosure(dm, NULL, v, p, &clSize, &values));
```
```none
for (cl = 0; cl < clSize; ++cl) {
```
```none
<Compute on closure>
```
```none
}
```
```none
}
```
```none
PetscFree(values);
```


## Fortran Notes
Since it returns an array, this routine is only available in Fortran 90, and you must
include petsc.h90 in your code.

The csize argument is not present in the Fortran 90 binding since it is internal to the array.




## See Also
`DMPlexVecRestoreClosure()`, `DMPlexVecSetClosure()`, `DMPlexMatSetClosure()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/plex/plex.c.html#DMPlexVecGetClosure">src/dm/impls/plex/plex.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/plex/tutorials/ex11.c.html">src/dm/impls/plex/tutorials/ex11.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/plex/tutorials/ex6.c.html">src/dm/impls/plex/tutorials/ex6.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex56.c.html">src/snes/tutorials/ex56.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex77.c.html">src/snes/tutorials/ex77.c.html</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/dm/impls/plex/plex.c)


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