petsc-3.14.6 2021-03-30
Report Typos and Errors

DMStagVecSetValuesStencil

Set Vec values using global grid indexing

Synopsis

PetscErrorCode DMStagVecSetValuesStencil(DM dm,Vec vec,PetscInt n,const DMStagStencil *pos,const PetscScalar *val,InsertMode insertMode)
Not Collective

Input Parameters

dm - the DMStag object
vec - the Vec
n - the number of values to set
pos - the locations to set values, as an array of DMStagStencil structs
val - the values to set
insertMode - INSERT_VALUES or ADD_VALUES

Notes

The vector is expected to be a global vector compatible with the DM (usually obtained by DMGetGlobalVector() or DMCreateGlobalVector()).

This approach is not as efficient as setting values directly with DMStagVecGetArray(), which is recommended for matrix-free operators. For assembling systems, where overhead may be less important than convenience, this routine could be helpful in assembling a righthand side and a matrix (using DMStagMatSetValuesStencil()).

See Also

DMSTAG, DMStagStencil, DMStagStencilLocation, DMStagVecGetValuesStencil(), DMStagMatSetValuesStencil(), DMCreateGlobalVector(), DMGetLocalVector(), DMStagVecGetArray()

Level

advanced

Location

src/dm/impls/stag/stagstencil.c

Examples

src/dm/impls/stag/tutorials/ex1.c.html
src/dm/impls/stag/tutorials/ex2.c.html
src/dm/impls/stag/tutorials/ex3.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