VecSetValues

Inserts or adds values into certain locations of a vector.

Synopsis

int VecSetValues(Vec x,int ni,const int ix[],const Scalar y[],InsertMode iora) 

Input Parameters

Not Collective

x - vector to insert in
ni - number of elements to add
ix - indices where to add
y - array of values
iora - either INSERT_VALUES or ADD_VALUES, where ADD_VALUES adds values to any existing entries, and INSERT_VALUES replaces existing entries with new values

Notes

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

Calls to VecSetValues() with the INSERT_VALUES and ADD_VALUES options cannot be mixed without intervening calls to the assembly routines.

These values may be cached, so VecAssemblyBegin() and VecAssemblyEnd() MUST be called after all calls to VecSetValues() have been completed.

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

Negative indices may be passed in ix, these rows are simply ignored. This allows easily inserting element load matrices with homogeneous Dirchlet boundary conditions that you don't want represented in the vector.

Keywords

vector, set, values

See Also

VecAssemblyBegin(), VecAssemblyEnd(), VecSetValuesLocal(),
VecSetValue(), VecSetValuesBlocked()

Examples

src/vec/examples/tutorials/ex4f.F
src/vec/examples/tutorials/ex2f.F
src/vec/examples/tutorials/ex3f.F
src/vec/examples/tutorials/ex4f90.F
src/vec/examples/tutorials/ex9f.F
src/vec/examples/tutorials/ex3.c
src/vec/examples/tutorials/ex2.c
src/vec/examples/tutorials/ex9.c
src/vec/examples/tutorials/ex13.c

Level:beginner
Location:src/vec/interface/vector.c
Vector Index
Table of Contents