Inserts or adds a block of values into a matrix.
mat - the matrix
v - a logically two-dimensional array of values
m, idxm - the number of block rows and their global block indices
n, idxn - the number of block columns and their global block indices
The m and n count the NUMBER of blocks in the row direction and column direction, NOT the total number of rows/columns; for example, if the block size is 2 and you are passing in values for rows 2,3,4,5 then m would be 2 (not 4). The values in idxm would be 1 2; that is the first index for each block divided by the block size.
Note that you must call
MatSetBlockSize() when constructing this matrix (before
MatSetValuesBlocked() uses 0-based row and column numbers in Fortran
as well as in C.
Negative indices may be passed in idxm and idxn, these rows and columns are simply ignored. This allows easily inserting element stiffness matrices with homogeneous Dirchlet boundary conditions that you don’t want represented in the matrix.
Each time an entry is set within a sparse matrix via
internal searching must be done to determine where to place the
data in the matrix storage space. By instead inserting blocks of
MatSetValuesBlocked(), the overhead of matrix assembly is
Suppose m=n=2 and block size(bs) = 2 The array is 1 2 | 3 4 5 6 | 7 8 - - - | - - - 9 10 | 11 12 13 14 | 15 16 v should be passed in like v = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16] If you are not using row oriented storage of v (that is you called MatSetOption(mat,MAT_ROW_ORIENTED,PETSC_FALSE)) then v = [1,5,9,13,2,6,10,14,3,7,11,15,4,8,12,16]
MatSetValuesBlocked_MPIBAIJ in src/mat/impls/baij/mpi/mpibaij.c
MatSetValuesBlocked_SeqBAIJ in src/mat/impls/baij/seq/baij.c
MatSetValuesBlocked_IS in src/mat/impls/is/matis.c
MatSetValuesBlocked_MPISBAIJ in src/mat/impls/sbaij/mpi/mpisbaij.c
MatSetValuesBlocked_SeqSBAIJ in src/mat/impls/sbaij/seq/sbaij.c