DMView — PETSc 3.22.5 documentation

Skip to main content
`Ctrl`+`K`

# DMView

Views a `DM`. Depending on the `PetscViewer` and its `PetscViewerFormat` it may print some ASCII information about the `DM` to the screen or a file or save the `DM` in a binary file to be loaded later or create a visualization of the `DM`

## Synopsis

    #include "petscdm.h"
    #include "petscdmlabel.h"
    #include "petscds.h"
    PetscErrorCode DMView(DM dm, PetscViewer v)

Collective

## Input Parameters

- dm - the `DM` object to view

- v - the viewer

## Notes

`PetscViewer` = `PETSCVIEWERHDF5` i.e. HDF5 format can be used with `PETSC_VIEWER_HDF5_PETSC` as the `PetscViewerFormat` to save multiple `DMPLEX` meshes in a single HDF5 file. This in turn requires one to name the `DMPLEX` object with `PetscObjectSetName()` before saving it with `DMView()` and before loading it with `DMLoad()` for identification of the mesh object.

`PetscViewer` = `PETSCVIEWEREXODUSII` i.e. ExodusII format assumes that element blocks (mapped to “Cell sets” labels) consists of sequentially numbered cells.

If `dm` has been distributed, only the part of the `DM` on MPI rank 0 (including “ghost” cells and vertices) will be written.

Only TRI, TET, QUAD, and HEX cells are supported.

`DMPLEX` only represents geometry while most post-processing software expect that a mesh also provides information on the discretization space. This function assumes that the file represents Lagrange finite elements of order 1 or 2. The order of the mesh shall be set using `PetscViewerExodusIISetOrder()`

Variable names can be set and queried using `PetscViewerExodusII[Set/Get][Nodal/Zonal]VariableNames[s]`.

## See Also

DM Basics, `DM`, `PetscViewer`, `PetscViewerFormat`, `PetscViewerSetFormat()`, `DMDestroy()`, `DMCreateGlobalVector()`, `DMCreateInterpolation()`, `DMCreateColoring()`, `DMCreateMatrix()`, `DMCreateMassMatrix()`, `DMLoad()`, `PetscObjectSetName()`

## Level

beginner

## Location

src/dm/interface/dm.c

## Examples

src/dm/impls/plex/tutorials/ex3f90.F90
src/dm/tutorials/ex19.c
src/dm/impls/plex/tutorials/ex5.c
src/dm/tutorials/swarm_ex1.c
src/dm/tutorials/ex21.c
src/dm/tutorials/swarm_ex2.c
src/dm/tutorials/ex1.c
src/dm/tutorials/ex20.c
src/dm/tutorials/ex5.c
src/dm/tutorials/ex14.c

## Implementations

DMView_Composite() in src/dm/impls/composite/pack.c
DMView_pforest() in src/dm/impls/forest/p4est/pforest.h
DMView_Moab() in src/dm/impls/moab/dmmoab.cxx
DMView_Network() in src/dm/impls/network/networkview.c
DMView_Patch() in src/dm/impls/patch/patch.c
DMView_PlexCGNS() in src/dm/impls/plex/cgns/plexcgns2.c
DMView_PlexExodusII() in src/dm/impls/plex/exodusii/plexexodusii2.c
DMView_Plex() in src/dm/impls/plex/plex.c
DMView_Redundant() in src/dm/impls/redundant/dmredundant.c
DMView_Shell() in src/dm/impls/shell/dmshell.c
DMView_Stag() in src/dm/impls/stag/stag.c
DMView_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