Skip to main content
`Ctrl`+`K`

# 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_option_phases <ph0_, ph1_, …> - List of prefixes for option processing phases

- -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_orient <bool> - `PETSC_TRUE` turns on topological orientation (flipping edges and faces)

- -dm_plex_scale <sc> - Scale factor for mesh coordinates

- -dm_coord_remap <bool> - Map coordinates using a function

- -dm_plex_coordinate_dim <dim> - Change the coordinate dimension of a mesh (usually given with cdm_ prefix)

- -dm_coord_map <mapname> - Select a builtin coordinate map

- -dm_coord_map_params <p0,p1,p2,…> - Set coordinate mapping parameters

- -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_save_transform <bool> - Save the `DMPlexTransform` that produced this mesh

- -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_use_ceed <bool> - Use LibCEED as the FEM backend

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

## Note

For some `DMType` such as `DMDA` this cannot be called after `DMSetUp()` has been called.

## See Also

DM Basics, `DM`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateInterpolation()`, `DMCreateColoring()`, `DMCreateMatrix()`, `DMPlexCheckSymmetry()`, `DMPlexCheckSkeleton()`, `DMPlexCheckFaces()`, `DMPlexCheckGeometry()`, `DMPlexCheckPointSF()`, `DMPlexCheckInterfaceCones()`, `DMSetOptionsPrefix()`, `DMType`, `DMPLEX`, `DMDA`, `DMSetUp()`

## Level

intermediate

## Location

src/dm/interface/dm.c

## Examples

src/dm/impls/plex/tutorials/ex14.c
src/dm/impls/plex/tutorials/ex5.c
src/dm/impls/forest/tutorials/ex1.c
src/dm/impls/plex/tutorials/ex16.c
src/dm/impls/plex/tutorials/ex18.c
src/dm/field/tutorials/ex1.c
src/dm/impls/plex/tutorials/ex1.c
src/dm/impls/plex/tutorials/ex11.c
src/dm/impls/plex/tutorials/ex17.c
src/dm/impls/plex/tutorials/ex15.c

## Implementations

DMSetFromOptions_DA() in src/dm/impls/da/dacreate.c
DMSetFromOptions_Forest() in src/dm/impls/forest/forest.c
DMSetFromOptions_pforest() in src/dm/impls/forest/p4est/pforest.h
DMSetFromOptions_Moab() in src/dm/impls/moab/dmmoab.cxx
DMSetFromOptions_Network() in src/dm/impls/network/networkcreate.c
DMSetFromOptions_Patch() in src/dm/impls/patch/patchcreate.c
DMSetFromOptions_Plex() in src/dm/impls/plex/plexcreate.c
DMSetFromOptions_Stag() in src/dm/impls/stag/stag.c
DMSetFromOptions_Swarm() in src/dm/impls/swarm/swarm.c

Index of all DM routines
Table of Contents for all manual pages
Index of all manual pages