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
objectvec - the
Vec
n - the number of values to set
pos - the locations to set values, as an array of
DMStagStencil
structsval - the values to set
insertMode -
INSERT_VALUES
orADD_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: Staggered, Structured Grid, DMSTAG
, Vec
, DMStagStencil
, DMStagStencilLocation
, DMStagVecGetValuesStencil()
, DMStagMatSetValuesStencil()
, DMCreateGlobalVector()
, DMGetLocalVector()
, DMStagVecGetArray()
Level#
advanced
Location#
Examples#
src/dm/impls/stag/tutorials/ex1.c
src/dm/impls/stag/tutorials/ex2.c
src/dm/impls/stag/tutorials/ex3.c
src/dm/impls/stag/tutorials/ex4.c
src/dm/impls/stag/tutorials/ex6.c
src/dm/impls/stag/tutorials/ex8.c
Index of all DMStag routines
Table of Contents for all manual pages
Index of all manual pages