DMSetDefaultConstraints#
Set the PetscSection and Mat that specify the local constraint interpolation.
Synopsis#
#include "petscdm.h"
#include "petscdmlabel.h"
#include "petscds.h"
PetscErrorCode DMSetDefaultConstraints(DM dm, PetscSection section, Mat mat, Vec bias)
If a constraint matrix is specified, then it is applied during DMGlobalToLocalEnd() when mode is INSERT_VALUES, INSERT_BC_VALUES, or INSERT_ALL_VALUES. Without a constraint matrix, the local vector l returned by DMGlobalToLocalEnd() contains values that have been scattered from a global vector without modification; with a constraint matrix A, l is modified by computing c = A * l + bias, l[s[i]] = c[i], where the scatter s is defined by the PetscSection returned by DMGetDefaultConstraints().
If a constraint matrix is specified, then its adjoint is applied during DMLocalToGlobalBegin() when mode is ADD_VALUES, ADD_BC_VALUES, or ADD_ALL_VALUES. Without a constraint matrix, the local vector l is accumulated into a global vector without modification; with a constraint matrix A, l is first modified by computing c[i] = l[s[i]], l[s[i]] = 0, l = l + A’*c, which is the adjoint of the operation described above. Any bias, if specified, is ignored when accumulating.
collective on dm
Input Parameters#
dm - The
DMsection - The
PetscSectiondescribing the range of the constraint matrix: relates rows of the constraint matrix to dofs of the default section. Must have a local communicator (PETSC_COMM_SELFor derivative).mat - The
Matthat interpolates local constraints: its width should be the layout size of the default section: NULL indicates no constraints. Must have a local communicator (PETSC_COMM_SELFor derivative).bias - A bias vector to be added to constrained values in the local vector. NULL indicates no bias. Must have a local communicator (
PETSC_COMM_SELFor derivative).
Note#
This increments the references of the PetscSection, Mat, and Vec, so they user can destroy them.
See Also#
Level#
advanced
Location#
Index of all DM routines
Table of Contents for all manual pages
Index of all manual pages