DMStagVecGetArray#
get access to local array
Synopsis#
PetscErrorCode DMStagVecGetArray(DM dm, Vec vec, void *array)
Logically Collective
Input Parameters#
Output Parameter#
array - the array
Note#
This function returns a (dim+1)-dimensional array for a dim-dimensional
DMSTAG.
The first 1-3 dimensions indicate an element in the global numbering, using the standard C ordering.
The final dimension in this array corresponds to a degree of freedom with respect to this element, for example corresponding to the element or one of its neighboring faces, edges, or vertices.
For example, for a 3D DMSTAG, indexing is array[k][j][i][idx], where k is the
index in the z-direction, j is the index in the y-direction, and i is the
index in the x-direction.
idx is obtained with DMStagGetLocationSlot(), since the correct offset
into the \((d+1)\)-dimensional C array for a \(d\)-dimensional DMSTAG depends on the grid size and the number
of DOF stored at each location.
DMStagVecRestoreArray() must be called, once finished with the array
See Also#
DMSTAG: Staggered, Structured Grids in PETSc, DMSTAG, DMStagVecGetArrayRead(), DMStagGetLocationSlot(), DMGetLocalVector(), DMCreateLocalVector(), DMGetGlobalVector(), DMCreateGlobalVector(), DMDAVecGetArray(), DMDAVecGetArrayDOF()
Level#
beginner
Location#
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