PETSc version 3.17.0
Fix/Edit manual page

# VecGetArrayAndMemType

Like VecGetArray(), but if this is a standard device vector (e.g., VECCUDA), the returned pointer will be a device pointer to the device memory that contains this processor's portion of the vector data. Device data is guaranteed to have the latest value. Otherwise, when this is a host vector (e.g., VECMPI), this routine functions the same as VecGetArray() and returns a host pointer.

### Synopsis

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

For VECKOKKOS, if Kokkos is configured without device (e.g., use serial or openmp), per this function, the vector works like VECSEQ/VECMPI; otherwise, it works like VECCUDA or VECHIP etc.

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(), VecGetArrayReadAndMemType(), VecGetArrayWriteAndMemType(), 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