petsc-3.4.5 2014-06-29

DMADDAMatSetValues

Inserts or adds a block of values into a matrix. The values are indexed geometrically with the help of the ADDA data structure. These values may be cached, so MatAssemblyBegin() and MatAssemblyEnd() MUST be called after all calls to ADDAMatSetValues() have been completed.

Synopsis

#include "petscdmadda.h" 
PetscErrorCode  DMADDAMatSetValues(Mat mat, DM dmm, PetscInt m, const ADDAIdx idxm[],DM dmn, PetscInt n, const ADDAIdx idxn[],const PetscScalar v[], InsertMode addv)
Not Collective

Input Parameters

mat - the matrix
addam - the ADDA geometry information for the rows
m - the number of rows
idxm - the row indices, each of the a proper ADDAIdx + addan - the ADDA geometry information for the columns
n - the number of columns
idxn - the column indices, each of the a proper ADDAIdx
v - a logically two-dimensional array of values of size m*n
addv - either ADD_VALUES or INSERT_VALUES, where ADD_VALUES adds values to any existing entries, and INSERT_VALUES replaces existing entries with new values

Notes

By default the values, v, are row-oriented and unsorted. See MatSetOption() for other options.

Calls to ADDAMatSetValues() (and MatSetValues()) with the INSERT_VALUES and ADD_VALUES options cannot be mixed without intervening calls to the assembly routines.

Efficiency Alert

The routine ADDAMatSetValuesBlocked() may offer much better efficiency for users of block sparse formats (MATSEQBAIJ and MATMPIBAIJ).

See Also

MatSetOption(), MatAssemblyBegin(), MatAssemblyEnd(), MatSetValues(), ADDAMatSetValuesBlocked(),
InsertMode, INSERT_VALUES, ADD_VALUES

Level:beginner
Location:
src/dm/impls/adda/adda.c
Index of all DM routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/ksp/ksp/examples/tutorials/ex40.c.html