:orphan:
# DMSetApplicationContext
Set a user context into a `DM` object
## Synopsis
```
#include "petscdm.h"
#include "petscdmlabel.h"
#include "petscds.h"
PetscErrorCode DMSetApplicationContext(DM dm, void *ctx)
```
Not Collective
## Input Parameters
- ***dm -*** the `DM` object
- ***ctx -*** the user context
## Note
A user context is a way to pass problem specific information that is accessible whenever the `DM` is available
## See Also
[](ch_dmbase), `DM`, `DMGetApplicationContext()`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateInterpolation()`, `DMCreateColoring()`, `DMCreateMatrix()`, `DMCreateMassMatrix()`, `DMGetApplicationContext()`
## Level
intermediate
## Location
src/dm/interface/dm.c
## Examples
src/dm/tutorials/swarm_ex3.c
src/ksp/ksp/tutorials/ex28.c
src/ksp/ksp/tutorials/ex35.cxx
src/ksp/ksp/tutorials/ex36.cxx
src/ksp/ksp/tutorials/ex50.c
src/ksp/ksp/tutorials/ex66.c
src/ksp/ksp/tutorials/ex73.c
src/snes/tutorials/ex12.c
src/snes/tutorials/ex13.c
src/snes/tutorials/ex15.c
src/snes/tutorials/ex16.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)