PETSc version 3.15.5
Fix/Edit manual page

# DMPlexCreateBoxMesh

Creates a mesh on the tensor product of unit intervals (box) using simplices or tensor cells (hexahedra).

### Synopsis

    #include "petscdmplex.h"
    #include "petscdmplex.h"
    PetscErrorCode DMPlexCreateBoxMesh(MPI_Comm comm, PetscInt dim, PetscBool simplex, const PetscInt faces[], const PetscReal lower[], const PetscReal upper[], const DMBoundaryType periodicity[], PetscBool interpolate, DM *dm)

Collective

### Input Parameters

| comm | - The communicator for the DM object
| dim | - The spatial dimension
| simplex | - PETSC_TRUE for simplices, PETSC_FALSE for tensor cells
| faces | - Number of faces per dimension, or NULL for (1,) in 1D and (2, 2) in 2D and (1, 1, 1) in 3D
| lower | - The lower left corner, or NULL for (0, 0, 0)
| upper | - The upper right corner, or NULL for (1, 1, 1)
| periodicity | - The boundary type for the X,Y,Z direction, or NULL for DM_BOUNDARY_NONE
| interpolate | - Flag to create intermediate mesh pieces (edges, faces)

### Output Parameter

| dm | - The DM object

### Options Database Keys

These options override the hard-wired input values.

| -dm_plex_box_dim <dim> | - Set the topological dimension
| -dm_plex_box_simplex <bool> | - PETSC_TRUE for simplex elements, PETSC_FALSE for tensor elements
| -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_faces <m,n,p> | - Number of faces in each linear direction
| -dm_plex_box_bd <bx,by,bz> | - Specify the DMBoundaryType for each direction
| -dm_plex_box_interpolate <bool> | - PETSC_TRUE turns on topological interpolation (creating edges and faces)

### Notes

The options database keys above take lists of length d in d dimensions.

### Here is the numbering returned for 2 faces in each direction for tensor cells

    10---17---11---18----12

     |         |         |

     |         |         |

    20    2   22    3    24

     |         |         |

     |         |         |

     7---15----8---16----9

     |         |         |

     |         |         |

    19    0   21    1   23

     |         |         |

     |         |         |

     4---13----5---14----6

and for simplicial cells

    14----8---15----9----16

     |\     5  |\      7 |

     | \       | \       |

    13   2    14    3    15

     | 4   \   | 6   \   |

     |       \ |       \ |

    11----6---12----7----13

     |\        |\        |

     | \    1  | \     3 |

    10   0    11    1    12

     | 0   \   | 2   \   |

     |       \ |       \ |

     8----4----9----5----10

### See Also

DMPlexCreateFromFile(), DMPlexCreateHexCylinderMesh(), DMSetType(), DMCreate()

### Level

beginner

### Location

src/dm/impls/plex/plexcreate.c

### Examples

src/dm/impls/plex/tutorials/ex1.c.html
src/dm/impls/plex/tutorials/ex2.c.html
src/dm/impls/plex/tutorials/ex6.c.html
src/dm/impls/plex/tutorials/ex8.c.html
src/dm/impls/plex/tutorials/ex9.c.html
src/dm/impls/plex/tutorials/ex1f90.F90.html
src/dm/tutorials/ex20.c.html
src/dm/field/tutorials/ex1.c.html
src/snes/tutorials/ex12.c.html
src/snes/tutorials/ex17.c.html
src/snes/tutorials/ex56.c.html
Index of all DMPLEX routines
Table of Contents for all manual pages
Index of all manual pages