Skip to main content
`Ctrl`+`K`

# DMPlexFilter

Extract a subset of mesh cells defined by a label as a separate mesh

## Synopsis

    #include "petscdmplex.h"
    #include "petscdmlabel.h"
    PetscErrorCode DMPlexFilter(DM dm, DMLabel cellLabel, PetscInt value, PetscBool ignoreLabelHalo, PetscBool sanitizeSubmesh, MPI_Comm comm, PetscSF *ownershipTransferSF, DM *subdm)

## Input Parameters

- dm - The original mesh

- cellLabel - The `DMLabel` marking cells contained in the new mesh

- value - The label value to use

- ignoreLabelHalo - The flag indicating if labeled points that are in the halo are ignored

- sanitizeSubmesh - The flag indicating if a subpoint is forced to be owned by a rank that owns a subcell that contains that point in its closure

- comm - The communicator you want the mesh on (currently supports only a sequential communicator or the same communicator of the original mesh)

## Output Parameters

- ownershipTransferSF - The `PetscSF` representing the ownership transfers between parent local meshes due to submeshing.

- subdm - The new mesh

## Note

This function produces a `DMLabel` mapping original points in the submesh to their depth. This can be obtained using `DMPlexGetSubpointMap()`.

On a given rank, the leaves of the ownershipTransferSF are the points in the local mesh that this rank gives up ownership of (in the submesh), and the remote locations for these leaves are tuples of rank and point that represent the new owners.

## See Also

DMPlex: Unstructured Grids, `DM`, `DMPLEX`, `DMPlexGetSubpointMap()`, `DMGetLabel()`, `DMLabelSetValue()`, `DMPlexCreateSubmesh()`

## Level

developer

## Location

src/dm/impls/plex/plexsubmesh.c

Index of all DMPlex routines
Table of Contents for all manual pages
Index of all manual pages