:orphan:
# DMPlexConstructGhostCells
Construct ghost cells which connect to every boundary face 
## Synopsis
```
#include "petscdmplex.h"    
#include "petscdmlabel.h"   
PetscErrorCode DMPlexConstructGhostCells(DM dm, const char labelName[], PetscInt *numGhostCells, DM *dmGhosted)
```
Collective


## Input Parameters

- ***dm -*** The original `DM`
- ***labelName -*** The label specifying the boundary faces, or "Face Sets" if this is `NULL`



## Output Parameters

- ***numGhostCells -*** The number of ghost cells added to the `DM`
- ***dmGhosted -*** The new `DM`





## Note
If no label exists of that name, one will be created marking all boundary faces


## See Also
 [](ch_unstructured), `DM`, `DMPLEX`, `DMCreate()`

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/plex/plexsubmesh.c.html#DMPlexConstructGhostCells">src/dm/impls/plex/plexsubmesh.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex11.c.html">src/ts/tutorials/ex11.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex11_sa.c.html">src/ts/tutorials/ex11_sa.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex18.c.html">src/ts/tutorials/ex18.c</A><BR>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/plex/plexsubmesh.c.html#DMPlexConstructGhostCells_Internal">DMPlexConstructGhostCells_Internal in src/dm/impls/plex/plexsubmesh.c</A><BR>


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


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