# DMMGCreate

Creates a DA based multigrid solver object. This allows one to easily implement MG methods on regular grids.

### Synopsis

    #include "petscda.h"
    #include "petscksp.h"
    #include "petscmg.h"
    #include "petscdmmg.h"
    #include "petscpc.h"
    PetscErrorCode PETSCSNES_DLLEXPORT DMMGCreate(MPI_Comm comm,PetscInt nlevels,void *user,DMMG **dmmg)

Collective on MPI_Comm

### Input Parameter

| comm | - the processors that will share the grids and solution process
| nlevels | - number of multigrid levels
| user | - an optional user context

### Output Parameters

- the context - Options Database: + -dmmg_nlevels <levels> - number of levels to use
-dmmg_galerkin -use Galerkin approach to compute coarser matrices
-dmmg_mat_type <type> -matrix type that DMMG should create, defaults to MATAIJ

### Notes

To provide a different user context for each level call DMMGSetUser() after calling this routine

### See Also

DMMGDestroy(), DMMGSetUser(), DMMGGetUser(), DMMGSetMatType(), DMMGSetUseGalerkin(), DMMGSetNullSpace(), DMMGSetInitialGuess(),
DMMGSetISColoringType()

Level:advanced
Location:src/snes/utils/damg.c
Index of all DA routines
Table of Contents for all manual pages
Index of all manual pages

### Examples

src/ksp/ksp/examples/tutorials/ex22.c.html
src/ksp/ksp/examples/tutorials/ex25.c.html
src/ksp/ksp/examples/tutorials/ex28.c.html
src/ksp/ksp/examples/tutorials/ex29.c.html
src/ksp/ksp/examples/tutorials/ex32.c.html
src/ksp/ksp/examples/tutorials/ex33.c.html
src/ksp/ksp/examples/tutorials/ex34.c.html
src/ksp/ksp/examples/tutorials/ex22f.F.html
src/snes/examples/tutorials/ex18.c.html
src/snes/examples/tutorials/ex19.c.html
src/snes/examples/tutorials/ex20.c.html