# VecGetValues

Gets values from certain locations of a vector. Currently can only get values on the same processor

### Synopsis

    #include "petscvec.h"
    PetscErrorCode PETSCVEC_DLLEXPORT VecGetValues(Vec x,PetscInt ni,const PetscInt ix[],PetscScalar y[])

Collective on Vec

### Input Parameters

| x | - vector to get values from
| ni | - number of elements to get
| ix | - indices where to get them from (in global 1d numbering)

### Output Parameter

y -array of values

### Notes

The user provides the allocated array y; it is NOT allocated in this routine

VecGetValues() gets y[i] = x[ix[i]], for i=0,...,ni-1.

VecAssemblyBegin() and VecAssemblyEnd() MUST be called before calling this

VecGetValues() uses 0-based indices in Fortran as well as in C.

### See Also

VecAssemblyBegin(), VecAssemblyEnd(), VecGetValuesLocal(),
VecGetValue(), VecGetValuesBlocked(), InsertMode, INSERT_VALUES, ADD_VALUES, VecSetValues()

Level:beginner
Location:src/vec/interface/vector.c
Index of all Vec routines
Table of Contents for all manual pages
Index of all manual pages