Skip to main content
`Ctrl`+`K`

# VecSetValueLocal

Set a single entry into a vector using the local numbering of the vector, see `VecSetValuesLocal()`

## Synopsis

    static inline PetscErrorCode VecSetValueLocal(Vec v, PetscInt i, PetscScalar va, InsertMode mode)

Not Collective

## Input Parameters

- v - the vector

- row - the local row location of the entry

- value - the value to insert

- mode - either `INSERT_VALUES` or `ADD_VALUES`

## Notes

For efficiency one should use `VecSetValuesLocal()` 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 `VecSetValueLocal()` have been completed.

See `VecSetLocalToGlobalMapping()` for how the local numbering is defined

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

## See Also

Vectors and Parallel Data, `VecSetValuesLocal()`, `VecSetValues()`, `VecAssemblyBegin()`, `VecAssemblyEnd()`, `VecSetValuesBlockedLocal()`, `VecSetValue()`, `VecSetLocalToGlobalMapping()`

## Level

beginner

## Location

include/petscvec.h

## Examples

src/vec/vec/tutorials/ex9.c

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