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

VecGetArray2dWrite

Returns a pointer to a 2d contiguous array that will contain this processor's portion of the vector data. You MUST call VecRestoreArray2dWrite() when you no longer need access to the array.

Synopsis

#include "petscvec.h"   
PetscErrorCode  VecGetArray2dWrite(Vec x,PetscInt m,PetscInt n,PetscInt mstart,PetscInt nstart,PetscScalar **a[])
Logically Collective

Input Parameter

x - the vector
m - first dimension of two dimensional array
n - second dimension of two dimensional array
mstart - first index you will use in first coordinate direction (often 0)
nstart - first index in the second coordinate direction (often 0)

Output Parameter

a - location to put pointer to the array

Notes

For a vector obtained from DMCreateLocalVector() mstart and nstart are likely obtained from the corner indices obtained from DMDAGetGhostCorners() while for DMCreateGlobalVector() they are the corner indices from DMDAGetCorners(). In both cases the arguments from DMDAGet[Ghost]Corners() are reversed in the call to VecGetArray2d().

For standard PETSc vectors this is an inexpensive call; it does not copy the vector values.

Concepts: vector^accessing local values as 2d array

See Also

VecGetArray(), VecRestoreArray(), VecGetArrays(), VecGetArrayF90(), VecPlaceArray(),
VecRestoreArray2d(), DMDAVecGetArray(), DMDAVecRestoreArray(), VecGetArray3d(), VecRestoreArray3d(), VecGetArray1d(), VecRestoreArray1d(), VecGetArray4d(), VecRestoreArray4d()

Level

developer

Location

src/vec/vec/interface/rvector.c
Index of all Vec routines
Table of Contents for all manual pages
Index of all manual pages