petsc-3.14.5 2021-03-03
Report Typos and Errors

# 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 setting values directly with DMStagVecGetArray(), which is recommended for matrix free operators.

### See Also

DMSTAG, DMStagStencil, DMStagStencilLocation, DMStagVecSetValuesStencil(), DMStagMatSetValuesStencil(), DMStagVecGetArray()

### Level

advanced

### Location

src/dm/impls/stag/stagstencil.c

### Examples

src/dm/impls/stag/tutorials/ex1.c.html
src/dm/impls/stag/tutorials/ex4.c.html
src/dm/impls/stag/tutorials/ex6.c.html
Index of all DMSTAG routines
Table of Contents for all manual pages
Index of all manual pages