DMCreateGradientMatrix — PETSc 3.25.4 documentation

Skip to main content
`Ctrl`+`K`

# DMCreateGradientMatrix

Gets the gradient matrix between two `DM` objects, M_(ic)j = \int \partial_c \phi_i \psi_j where the \phi are Galerkin basis functions for a Galerkin finite element model on the `DM`

## Synopsis

    #include "petscdm.h"
    #include "petscdmlabel.h"
    #include "petscds.h"
    PetscErrorCode DMCreateGradientMatrix(DM dmc, DM dmf, Mat *mat)

Collective

## Input Parameters

- dmc - the target `DM` object

- dmf - the source `DM` object, can be `NULL`

## Output Parameter

- mat - the gradient matrix

## Notes

For `DMPLEX` the finite element model for the `DM` must have been already provided.

## See Also

DM Basics, `DM`, `DMCreateMassMatrix()`, `DMCreateMassMatrixLumped()`, `DMCreateMatrix()`, `DMRefine()`, `DMCoarsen()`, `DMCreateRestriction()`, `DMCreateInterpolation()`, `DMCreateInjection()`

## Level

developer

## Location

src/dm/interface/dm.c

## Implementations

DMCreateGradientMatrix_Plex() in src/dm/impls/plex/plex.c
DMCreateGradientMatrix_Swarm() in src/dm/impls/swarm/swarm.c

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