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

DMStagVecGetArray

get access to local array

Synopsis

PetscErrorCode DMStagVecGetArray(DM dm,Vec vec,void *array)
Logically Collective

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 (dim+1)-dimensional C array depends on the grid size and the number of dof stored at each location.

Input Parameters

dm - the DMStag object
vec - the Vec object

Output Parameters

array - the array

Notes

DMStagVecRestoreArray() must be called, once finished with the array

See Also

DMSTAG, DMStagVecGetArrayRead(), DMStagGetLocationSlot(), DMGetLocalVector(), DMCreateLocalVector(), DMGetGlobalVector(), DMCreateGlobalVector(), DMDAVecGetArray(), DMDAVecGetArrayDOF()

Level

beginner

Location

src/dm/impls/stag/stagutils.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