Skip to main content
`Ctrl`+`K`

# DMCreateMassMatrix

Gets the mass matrix between two `DM` objects, M_ij = \int \phi_i \psi_j where the \phi are Galerkin basis functions for a a Galerkin finite element model on the `DM`

## Synopsis

    #include "petscdm.h"
    #include "petscdmlabel.h"
    #include "petscds.h"
    PetscErrorCode DMCreateMassMatrix(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 mass matrix

## Notes

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

if `dmc` is `dmf` or `NULL`, then x^t M x is an approximation to the L2 norm of the vector x which is obtained by `DMCreateGlobalVector()`

## See Also

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

## Level

developer

## Location

src/dm/interface/dm.c

## Examples

src/dm/impls/swarm/tutorials/ex1f90.F90
src/snes/tutorials/ex36.c

## Implementations

DMCreateMassMatrix_Plex() in src/dm/impls/plex/plex.c
DMCreateMassMatrix_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