:orphan: # 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 ## 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` then x^t M x is an approximation to the L2 norm of the vector x which is obtained by `DMCreateGlobalVector()` ## See Also [](ch_dmbase), `DM`, `DMCreateMassMatrixLumped()`, `DMCreateMatrix()`, `DMCreateMassMatrix()`, `DMRefine()`, `DMCoarsen()`, `DMCreateRestriction()`, `DMCreateInterpolation()`, `DMCreateInjection()` ## Level developer ## Location src/dm/interface/dm.c ## Examples src/dm/impls/swarm/tutorials/ex1.c
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
--- [Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/dm/interface/dm.c) [Index of all DM routines](index.md) [Table of Contents for all manual pages](/manualpages/index.md) [Index of all manual pages](/manualpages/singleindex.md)