petsc-3.13.3 2020-07-01
Report Typos and Errors


get access to local array


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


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

See Also

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




Index of all DMSTAG routines
Table of Contents for all manual pages
Index of all manual pages