# DMStagStencilToIndexLocal
Convert an array of DMStagStencil objects to an array of indices into a local vector. 
## Synopsis
```
PetscErrorCode DMStagStencilToIndexLocal(DM dm, PetscInt dim, PetscInt n, const DMStagStencil *pos, PetscInt *ix)
```
Not Collective


## Input Parameters

- ***dm -*** the DMStag object
- ***dim -*** the dimension of the DMStag object
- ***n -*** the number of `DMStagStencil` objects
- ***pos -*** an array of `n` `DMStagStencil` objects



## Output Parameter

- ***ix -*** output array of `n` indices



## Notes
The `DMStagStencil` objects in `pos` use global element indices.

The `.c` fields in `pos` must always be set (even if to `0`).


## Developer Notes
This is a "hot" function, and accepts the dimension redundantly to avoid having to perform any error checking inside the function.




## See Also
 `DMSTAG`, `DMStagStencilLocation`, `DMStagStencil`, `DMGetLocalVector`, `DMCreateLocalVector`

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/stag/stagstencil.c.html#DMStagStencilToIndexLocal">src/dm/impls/stag/stagstencil.c</A>


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


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