:orphan:
# DMSetFromOptions
sets parameters in a `DM` from the options database 
## Synopsis
```
#include "petscdm.h"          
#include "petscdmlabel.h"     
#include "petscds.h"     
PetscErrorCode DMSetFromOptions(DM dm)
```
Collective


## Input Parameter

- ***dm -*** the `DM` object to set options for



## Options Database Keys

- ***-dm_preallocate_only -*** Only preallocate the matrix for `DMCreateMatrix()` and `DMCreateMassMatrix()`, but do not fill it with zeros
- ***-dm_vec_type <type>  -*** type of vector to create inside `DM`
- ***-dm_mat_type <type>  -*** type of matrix to create inside `DM`
- ***-dm_is_coloring_type -*** <global or local>
- ***-dm_bind_below <n>   -*** bind (force execution on CPU) for `Vec` and `Mat` objects with local size (number of vector entries or matrix rows) below n; currently only supported for `DMDA`
- ***-dm_plex_filename <str>           -*** File containing a mesh
- ***-dm_plex_boundary_filename <str>  -*** File containing a mesh boundary
- ***-dm_plex_name <str>               -*** Name of the mesh in the file
- ***-dm_plex_shape <shape>            -*** The domain shape, such as `BOX`, `SPHERE`, etc.
- ***-dm_plex_cell <ct>                -*** Cell shape
- ***-dm_plex_reference_cell_domain <bool> -*** Use a reference cell domain
- ***-dm_plex_dim <dim>                -*** Set the topological dimension
- ***-dm_plex_simplex <bool>           -*** `PETSC_TRUE` for simplex elements, `PETSC_FALSE` for tensor elements
- ***-dm_plex_interpolate <bool>       -*** `PETSC_TRUE` turns on topological interpolation (creating edges and faces)
- ***-dm_plex_scale <sc>               -*** Scale factor for mesh coordinates
- ***-dm_plex_box_faces <m,n,p>        -*** Number of faces along each dimension
- ***-dm_plex_box_lower <x,y,z>        -*** Specify lower-left-bottom coordinates for the box
- ***-dm_plex_box_upper <x,y,z>        -*** Specify upper-right-top coordinates for the box
- ***-dm_plex_box_bd <bx,by,bz>        -*** Specify the `DMBoundaryType` for each direction
- ***-dm_plex_sphere_radius <r>        -*** The sphere radius
- ***-dm_plex_ball_radius <r>          -*** Radius of the ball
- ***-dm_plex_cylinder_bd <bz>         -*** Boundary type in the z direction
- ***-dm_plex_cylinder_num_wedges <n>  -*** Number of wedges around the cylinder
- ***-dm_plex_reorder <order>          -*** Reorder the mesh using the specified algorithm
- ***-dm_refine_pre <n>                -*** The number of refinements before distribution
- ***-dm_refine_uniform_pre <bool>     -*** Flag for uniform refinement before distribution
- ***-dm_refine_volume_limit_pre <v>   -*** The maximum cell volume after refinement before distribution
- ***-dm_refine <n>                    -*** The number of refinements after distribution
- ***-dm_extrude <l>                   -*** Activate extrusion and specify the number of layers to extrude
- ***-dm_plex_transform_extrude_thickness <t>           -*** The total thickness of extruded layers
- ***-dm_plex_transform_extrude_use_tensor <bool>       -*** Use tensor cells when extruding
- ***-dm_plex_transform_extrude_symmetric <bool>        -*** Extrude layers symmetrically about the surface
- ***-dm_plex_transform_extrude_normal <n0,...,nd>      -*** Specify the extrusion direction
- ***-dm_plex_transform_extrude_thicknesses <t0,...,tl> -*** Specify thickness of each layer
- ***-dm_plex_create_fv_ghost_cells    -*** Flag to create finite volume ghost cells on the boundary
- ***-dm_plex_fv_ghost_cells_label <name> -*** Label name for ghost cells boundary
- ***-dm_distribute <bool>             -*** Flag to redistribute a mesh among processes
- ***-dm_distribute_overlap <n>        -*** The size of the overlap halo
- ***-dm_plex_adj_cone <bool>          -*** Set adjacency direction
- ***-dm_plex_adj_closure <bool>       -*** Set adjacency size
- ***-dm_plex_check_symmetry        -*** Check that the adjacency information in the mesh is symmetric - `DMPlexCheckSymmetry()`
- ***-dm_plex_check_skeleton        -*** Check that each cell has the correct number of vertices (only for homogeneous simplex or tensor meshes) - `DMPlexCheckSkeleton()`
- ***-dm_plex_check_faces           -*** Check that the faces of each cell give a vertex order this is consistent with what we expect from the cell type - `DMPlexCheckFaces()`
- ***-dm_plex_check_geometry        -*** Check that cells have positive volume - `DMPlexCheckGeometry()`
- ***-dm_plex_check_pointsf         -*** Check some necessary conditions for `PointSF` - `DMPlexCheckPointSF()`
- ***-dm_plex_check_interface_cones -*** Check points on inter-partition interfaces have conforming order of cone points - `DMPlexCheckInterfaceCones()`
- ***-dm_plex_check_all             -*** Perform all the checks above





## See Also
 [](ch_dmbase), `DM`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateInterpolation()`, `DMCreateColoring()`, `DMCreateMatrix()`,
`DMPlexCheckSymmetry()`, `DMPlexCheckSkeleton()`, `DMPlexCheckFaces()`, `DMPlexCheckGeometry()`, `DMPlexCheckPointSF()`, `DMPlexCheckInterfaceCones()`,
`DMSetOptionsPrefix()`, `DM`, `DMType`, `DMPLEX`, `DMDA`

## Level
intermediate

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

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/field/tutorials/ex1.c.html">src/dm/field/tutorials/ex1.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/forest/tutorials/ex1.c.html">src/dm/impls/forest/tutorials/ex1.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/plex/tutorials/ex1.c.html">src/dm/impls/plex/tutorials/ex1.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/plex/tutorials/ex10.c.html">src/dm/impls/plex/tutorials/ex10.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/plex/tutorials/ex11.c.html">src/dm/impls/plex/tutorials/ex11.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/plex/tutorials/ex14.c.html">src/dm/impls/plex/tutorials/ex14.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/plex/tutorials/ex1f90.F90.html">src/dm/impls/plex/tutorials/ex1f90.F90</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/plex/tutorials/ex5.c.html">src/dm/impls/plex/tutorials/ex5.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/plex/tutorials/ex6.c.html">src/dm/impls/plex/tutorials/ex6.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/plex/tutorials/ex7.c.html">src/dm/impls/plex/tutorials/ex7.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/plex/tutorials/ex8.c.html">src/dm/impls/plex/tutorials/ex8.c</A><BR>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/da/dacreate.c.html#DMSetFromOptions_DA">DMSetFromOptions_DA in src/dm/impls/da/dacreate.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/forest/forest.c.html#DMSetFromOptions_Forest">DMSetFromOptions_Forest in src/dm/impls/forest/forest.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/forest/p4est/pforest.h.html#DMSetFromOptions_pforest">DMSetFromOptions_pforest in src/dm/impls/forest/p4est/pforest.h</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/moab/dmmoab.cxx.html#DMSetFromOptions_Moab">DMSetFromOptions_Moab in src/dm/impls/moab/dmmoab.cxx</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/network/networkcreate.c.html#DMSetFromOptions_Network">DMSetFromOptions_Network in src/dm/impls/network/networkcreate.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/patch/patchcreate.c.html#DMSetFromOptions_Patch">DMSetFromOptions_Patch in src/dm/impls/patch/patchcreate.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/plex/plexcreate.c.html#DMSetFromOptions_Plex">DMSetFromOptions_Plex in src/dm/impls/plex/plexcreate.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/stag/stag.c.html#DMSetFromOptions_Stag">DMSetFromOptions_Stag in src/dm/impls/stag/stag.c</A><BR>


---
[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)  
