DMStagVecGetValuesStencil — PETSc 3.21.4 documentation

Skip to main content
`Ctrl`+`K`

# DMStagVecGetValuesStencil

get vector values using grid indexing

## Synopsis

    PetscErrorCode DMStagVecGetValuesStencil(DM dm, Vec vec, PetscInt n, const DMStagStencil *pos, PetscScalar *val)

Not Collective

## Input Parameters

- dm - the `DMSTAG` object

- vec - the vector object

- n - the number of values to obtain

- pos - locations to obtain values from (as an array of `DMStagStencil` values)

## Output Parameter

- val - value at the point

## Notes

Accepts stencils which refer to global element numbers, but only allows access to entries in the local representation (including ghosts).

This approach is not as efficient as getting values directly with `DMStagVecGetArray()`, which is recommended for matrix-free operators.

## See Also

DMSTAG: Staggered, Structured Grid, `DMSTAG`, `DMStagStencil`, `DMStagStencilLocation`, `DMStagVecSetValuesStencil()`, `DMStagMatSetValuesStencil()`, `DMStagVecGetArray()`

## Level

advanced

## Location

src/dm/impls/stag/stagstencil.c

## Examples

src/dm/impls/stag/tutorials/ex6.c
src/dm/impls/stag/tutorials/ex4.c
src/dm/impls/stag/tutorials/ex1.c

Index of all DMStag routines
Table of Contents for all manual pages
Index of all manual pages