Skip to main content
`Ctrl`+`K`

# PCSetDM

Sets the `DM` that may be used by some preconditioners

## Synopsis

    #include "petscpc.h"
    PetscErrorCode PCSetDM(PC pc, DM dm)

Logically Collective

## Input Parameters

- pc - the preconditioner context

- dm - the `DM`, can be `NULL` to remove any current `DM`

## Note

Users generally call `KSPSetDM()`, `SNESSetDM()`, or `TSSetDM()` so this is rarely called directly

## Developer Notes

The routines KSP/SNES/TSSetDM() require `dm` to be non-`NULL`, but this one can be `NULL` since all it does is replace the current `DM`

## See Also

KSP: Linear System Solvers, `PC`, `DM`, `PCGetDM()`, `KSPSetDM()`, `KSPGetDM()`, `SNESSetDM()`, `TSSetDM()`

## Level

intermediate

## Location

src/ksp/pc/interface/pcset.c

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