# DMLoad
Loads a DM that has been stored in binary  with `DMView()`. 
## Synopsis
```
#include "petscdm.h"          
#include "petscdmlabel.h"     
#include "petscds.h"     
PetscErrorCode DMLoad(DM newdm, PetscViewer viewer)
```
Collective on viewer


## Input Parameters

- ***newdm -*** the newly loaded `DM`, this needs to have been created with `DMCreate()` or
some related function before a call to `DMLoad()`.
- ***viewer -*** binary file viewer, obtained from `PetscViewerBinaryOpen()` or
`PETSCVIEWERHDF5` file viewer, obtained from `PetscViewerHDF5Open()`





## Notes
The type is determined by the data in the file, any type set into the DM before this call is ignored.

Using `PETSCVIEWERHDF5` type with `PETSC_VIEWER_HDF5_PETSC` format, one can 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.


## Notes for advanced users
Most users should not need to know the details of the binary storage
format, since `DMLoad()` and `DMView()` completely hide these details.
But for anyone who's interested, the standard binary matrix storage
format is
```none
     has not yet been determined
```



## See Also
 `PetscViewerBinaryOpen()`, `DMView()`, `MatLoad()`, `VecLoad()`

## Level
intermediate

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

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/plex/tutorials/ex5.c.html">src/dm/impls/plex/tutorials/ex5.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/tutorials/ex3.c.html">src/tao/tutorials/ex3.c.html</A><BR>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/da/dacreate.c.html#DMLoad_DA">DMLoad_DA in src/dm/impls/da/dacreate.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/plex/plex.c.html#DMLoad_Plex">DMLoad_Plex in src/dm/impls/plex/plex.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/shell/dmshell.c.html#DMLoad_Shell">DMLoad_Shell in src/dm/impls/shell/dmshell.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](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
