PETSc version 3.15.5
Fix/Edit manual page

# VecGetArrayAndMemType

Like VecGetArray(), but if this is a device vector (e.g., VECCUDA) and the device has up-to-date data, the returned pointer will be a device pointer to the device memory that contains this processor's portion of the vector data. Otherwise, when this is a host vector (e.g., VECMPI), or a device vector with the host having newer data than device, it functions as VecGetArray() and returns a host pointer.

### Synopsis

    #include "petscvec.h"
    PetscErrorCode VecGetArrayAndMemType(Vec x,PetscScalar **a,PetscMemType *mtype)

Logically Collective on Vec

### Input Parameter

| x | - the vector

### Output Parameters

| a | - location to put pointer to the array
| mtype | - memory type of the array

### See Also

VecRestoreArrayAndMemType(), VecRestoreArrayAndMemType(), VecRestoreArray(), VecGetArrayRead(), VecGetArrays(), VecGetArrayF90(), VecGetArrayReadF90(),
VecPlaceArray(), VecGetArray2d(), VecGetArrayPair(), VecRestoreArrayPair(), VecGetArrayWrite(), VecRestoreArrayWrite()

### Level

beginner

### Location

src/vec/vec/interface/rvector.c

### Implementations

VecGetArrayAndMemType_SeqKokkos in src/vec/vec/impls/seq/kokkos/veckok.kokkos.cxx
VecGetArrayAndMemType_SeqCUDA in src/vec/vec/impls/seq/seqcuda/veccuda.c
Index of all Vec routines
Table of Contents for all manual pages
Index of all manual pages