#include "petscvec.h" PetscErrorCode VecSetValues(Vec x,PetscInt ni,const PetscInt ix,const PetscScalar y,InsertMode iora)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|
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.
If you call VecSetOption(x, VEC_IGNORE_NEGATIVE_INDICES,PETSC_TRUE), 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.