:orphan:
# VecSetValuesBlocked
Inserts or adds blocks of values into certain locations of a vector.
## Synopsis
```
#include "petscvec.h"
PetscErrorCode VecSetValuesBlocked(Vec x, PetscInt ni, const PetscInt ix[], const PetscScalar y[], InsertMode iora)
```
Not Collective
## Input Parameters
- ***x -*** vector to insert in
- ***ni -*** number of blocks to add
- ***ix -*** indices where to add in block count, rather than element count
- ***y -*** array of values
- ***iora -*** either `INSERT_VALUES` replaces existing entries with new values, `ADD_VALUES`, adds values to any existing entries
## Notes
`VecSetValuesBlocked()` sets x[bs*ix[i]+j] = y[bs*i+j],
for j=0,...,bs-1, for i=0,...,ni-1. where bs was set with VecSetBlockSize().
Calls to `VecSetValuesBlocked()` 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 `VecSetValuesBlocked()` have been completed.
`VecSetValuesBlocked()` 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.
## See Also
[](ch_vectors), `Vec`, `VecAssemblyBegin()`, `VecAssemblyEnd()`, `VecSetValuesBlockedLocal()`,
`VecSetValues()`
## Level
intermediate
## Location
src/vec/vec/interface/rvector.c
## Examples
src/ksp/ksp/tutorials/ex56.c
## Implementations
VecSetValuesBlocked_MPI in src/vec/vec/impls/mpi/pdvec.c
VecSetValuesBlocked_Seq in src/vec/vec/impls/seq/bvec2.c
---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/vec/vec/interface/rvector.c)
[Index of all Vec routines](index.md)
[Table of Contents for all manual pages](/manualpages/index.md)
[Index of all manual pages](/manualpages/singleindex.md)