:orphan: # DMCreateInterpolation Gets the interpolation matrix between two `DM` objects. The resulting matrix map degrees of freedom in the vector obtained by `DMCreateGlobalVector()` on the coarse `DM` to similar vectors on the fine grid `DM`. ## Synopsis ``` #include "petscdm.h" #include "petscdmlabel.h" #include "petscds.h" PetscErrorCode DMCreateInterpolation(DM dmc, DM dmf, Mat *mat, Vec *vec) ``` Collective ## Input Parameters - ***dmc -*** the `DM` object - ***dmf -*** the second, finer `DM` object ## Output Parameters - ***mat -*** the interpolation - ***vec -*** the scaling (optional), see `DMCreateInterpolationScale()` ## Notes For `DMDA` objects this only works for "uniform refinement", that is the refined mesh was obtained `DMRefine()` or the coarse mesh was obtained by DMCoarsen(). The coordinates set into the `DMDA` are completely ignored in computing the interpolation. For `DMDA` objects you can use this interpolation (more precisely the interpolation from the `DMGetCoordinateDM()`) to interpolate the mesh coordinate vectors EXCEPT in the periodic case where it does not make sense since the coordinate vectors are not periodic. ## See Also [](ch_dmbase), `DM`, `DMDestroy()`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateColoring()`, `DMCreateMatrix()`, `DMCreateMassMatrix()`, `DMRefine()`, `DMCoarsen()`, `DMCreateRestriction()`, `DMCreateInterpolationScale()` ## Level developer ## Location src/dm/interface/dm.c ## Examples src/dm/impls/stag/tutorials/ex4.c
src/dm/tutorials/ex3.c
src/ksp/ksp/tutorials/ex35.cxx
src/ksp/ksp/tutorials/ex36.cxx
src/ksp/ksp/tutorials/ex42.c
src/ksp/ksp/tutorials/ex65.c
src/ksp/ksp/tutorials/ex73.c
src/snes/tutorials/ex36.c
src/snes/tutorials/ex48.c
src/ts/tutorials/ex29.c
## Implementations DMCreateInterpolation_Composite in src/dm/impls/composite/pack.c
DMCreateInterpolation_DA in src/dm/impls/da/dainterp.c
DMCreateInterpolation_pforest in src/dm/impls/forest/p4est/pforest.h
DMCreateInterpolation_Moab in src/dm/impls/moab/dmmbmg.cxx
DMCreateInterpolation_Plex in src/dm/impls/plex/plex.c
DMCreateInterpolation_Redundant in src/dm/impls/redundant/dmredundant.c
DMCreateInterpolation_Stag in src/dm/impls/stag/stag.c
DMCreateInterpolation_SNESVI in src/snes/impls/vi/rs/virs.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)