# DMPlexCreateFromFile
This takes a filename and produces a DM 
## Synopsis
```
#include "petscdmplex.h"   
#include "petscdmplex.h"   
PetscErrorCode DMPlexCreateFromFile(MPI_Comm comm, const char filename[], const char plexname[], PetscBool interpolate, DM *dm)
```

## Input Parameters

- ***comm -*** The communicator
- ***filename -*** A file name
- ***plexname -*** The object name of the resulting DM, also used for intra-datafile lookup by some formats
- ***interpolate -*** Flag to create intermediate mesh pieces (edges, faces)



## Output Parameter

- ***dm -*** The DM



## Options Database Keys

- ***-dm_plex_create_from_hdf5_xdmf -*** use the PETSC_VIEWER_HDF5_XDMF format for reading HDF5


Use -dm_plex_create_ prefix to pass options to the internal PetscViewer, e.g.
```none
-dm_plex_create_viewer_hdf5_collective
```


## Notes
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.
The input parameter name is thus used to name the DMPlex object when DMPlexCreateFromFile() internally
calls DMLoad(). Currently, name is ignored for other viewer types and/or formats.




## See Also
 `DMPlexCreateFromDAG()`, `DMPlexCreateFromCellListPetsc()`, `DMPlexCreate()`, `PetscObjectSetName()`, `DMView()`, `DMLoad()`

## Level
beginner

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/plex/plexcreate.c.html#DMPlexCreateFromFile">src/dm/impls/plex/plexcreate.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/dm/label/tutorials/ex1.c.html">src/dm/label/tutorials/ex1.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/label/tutorials/ex1f90.F90.html">src/dm/label/tutorials/ex1f90.F90.html</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/dm/impls/plex/plexcreate.c)


[Index of all DMPlex routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
