Skip to main content
`Ctrl`+`K`

# KSPGetPC

Returns a pointer to the preconditioner context with the `KSP`

## Synopsis

    #include "petscksp.h"
    #include "petscmat.h"
    PetscErrorCode KSPGetPC(KSP ksp, PC *pc)

Not Collective

## Input Parameter

- ksp - iterative solver obtained from `KSPCreate()`

## Output Parameter

- pc - preconditioner context

## Note

The `PC` is created if it does not already exist.

## Developer Note

Calls `KSPCheckPCMPI()` to check if the `KSP` is effected by `-mpi_linear_solver_server`

## See Also

KSP: Linear System Solvers, `KSPSetPC()`, `KSP`, `PC`

## Level

beginner

## Location

src/ksp/ksp/interface/itfunc.c

## Examples

src/ksp/ksp/tutorials/ex19.c
src/ksp/ksp/tutorials/ex1.c
src/ksp/ksp/tutorials/ex100.c
src/dm/impls/stag/tutorials/ex2.c
src/dm/impls/stag/tutorials/ex3.c
src/ksp/ksp/tutorials/ex12.c
src/ksp/ksp/tutorials/ex13.c
src/dm/impls/stag/tutorials/ex1.c
src/dm/impls/stag/tutorials/ex4.c
src/ksp/ksp/tutorials/ex15.c

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