# DMRegister
Adds a new `DM` type implementation 
## Synopsis
```
#include "petscdm.h"          
#include "petscdmlabel.h"     
#include "petscds.h"     
PetscErrorCode DMRegister(const char sname[], PetscErrorCode (*function)(DM))
```
Not Collective


## Input Parameters

- ***name        -*** The name of a new user-defined creation routine
- ***create_func -*** The creation routine itself



## Notes
DMRegister() may be called multiple times to add several user-defined `DM`s


## Sample usage
```none
    DMRegister("my_da", MyDMCreate);
```


Then, your DM type can be chosen with the procedural interface via
```none
    DMCreate(MPI_Comm, DM *);
    DMSetType(DM,"my_da");
```

or at runtime via the option
```none
    -da_type my_da
```





## See Also
 `DM`, `DMType`, `DMSetType()`, `DMRegisterAll()`, `DMRegisterDestroy()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/interface/dm.c.html#DMRegister">src/dm/interface/dm.c</A>


---
[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](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
