petsc-3.7.1 2016-05-15
Report Typos and Errors

VecSetValues

Inserts or adds values into certain locations of a vector.

Synopsis

#include "petscvec.h"   
PetscErrorCode  VecSetValues(Vec x,PetscInt ni,const PetscInt ix[],const PetscScalar y[],InsertMode iora)
Not Collective Many br

Input Parameters

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

Notes

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

Calls to VecSetValues() with the INSERT_VALUES and ADD_VALUES Many broptions cannot be mixed without intervening calls to the assembly Many brroutines. Many br

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

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

If you call VecSetOption(x, VEC_IGNORE_NEGATIVE_INDICES,PETSC_TRUE), Many brnegative indices may be passed in ix. These rows are Many brsimply ignored. This allows easily inserting element load matrices Many brwith homogeneous Dirchlet boundary conditions that you don't want represented Many brin the vector. Many br

Many br

See Also

VecAssemblyBegin(), VecAssemblyEnd(), VecSetValuesLocal(),
VecSetValue(), VecSetValuesBlocked(), InsertMode, INSERT_VALUES, ADD_VALUES, VecGetValues() Many br

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

Examples

src/vec/vec/examples/tutorials/ex2.c.html
src/vec/vec/examples/tutorials/ex3.c.html
src/vec/vec/examples/tutorials/ex5.c.html
src/vec/vec/examples/tutorials/ex9.c.html
src/vec/vec/examples/tutorials/ex10.c.html
src/vec/vec/examples/tutorials/ex15.c.html
src/vec/vec/examples/tutorials/ex16.c.html
src/vec/vec/examples/tutorials/ex18.c.html
src/vec/vec/examples/tutorials/ex2f.F.html
src/vec/vec/examples/tutorials/ex3f.F.html
src/vec/vec/examples/tutorials/ex4f.F.html