petsc-3.10.5 2019-03-28
Report Typos and Errors

VecSetValue

Set a single entry into a vector.

Synopsis

#include <petscvec.h>
PetscErrorCode VecSetValue(Vec v,PetscInt row,PetscScalar value, InsertMode mode);
Not Collective

Input Parameters

v - the vector
row - the row location of the entry
value - the value to insert
mode - either INSERT_VALUES or ADD_VALUES

Notes

For efficiency one should use VecSetValues() and set several or many values simultaneously if possible.

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

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

See Also

VecSetValues(), VecAssemblyBegin(), VecAssemblyEnd(), VecSetValuesBlockedLocal(), VecSetValueLocal()

Level

beginner

Location

src/vec/vscat/../../../include/petscvec.h

Examples

src/ksp/ksp/examples/tutorials/ex43.c.html
src/ksp/ksp/examples/tutorials/ex49.c.html
src/ksp/ksp/examples/tutorials/ex56.c.html
src/snes/examples/tutorials/ex28.c.html
src/snes/examples/tutorials/ex30.c.html
src/snes/examples/tutorials/ex56.c.html
src/snes/examples/tutorials/ex70.c.html
src/ts/examples/tutorials/extchem.c.html

Index of all Vec routines
Table of Contents for all manual pages
Index of all manual pages