# DMStagMatGetValuesStencil
retrieve local matrix entries using grid indexing 
## Synopsis
```
PetscErrorCode DMStagMatGetValuesStencil(DM dm, Mat mat, PetscInt nRow, const DMStagStencil *posRow, PetscInt nCol, const DMStagStencil *posCol, PetscScalar *val)
```
Not Collective


## Input Parameters

- ***dm -*** the `DMSTAG` object
- ***mat -*** the matrix
- ***nRow -*** number of rows
- ***posRow -*** grid locations (including components) of rows
- ***nCol -*** number of columns
- ***posCol -*** grid locations (including components) of columns



## Output Parameter

- ***val -*** logically two-dimensional array of values





## See Also
 [](chapter_stag), `DMSTAG`, `DMStagStencil`, `DMStagStencilLocation`, `DMStagVecGetValuesStencil()`, `DMStagVecSetValuesStencil()`, `DMStagMatSetValuesStencil()`, `MatSetValuesStencil()`, `MatAssemblyBegin()`, `MatAssemblyEnd()`, `DMCreateMatrix()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/stag/stagstencil.c.html#DMStagMatGetValuesStencil">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)  
