PCSetApplicationContext — PETSc 3.23.0 documentation

Skip to main content
`Ctrl`+`K`

# PCSetApplicationContext

Sets the optional user-defined context for the preconditioner

## Synopsis

    #include "petscpc.h"
    PetscErrorCode PCSetApplicationContext(PC pc, void *ctx)

Logically Collective

## Input Parameters

- pc - the `PC` context

- ctx - optional user context

## Fortran Note

This only works when `ctx` is a Fortran derived type (it cannot be a `PetscObject`), we recommend writing a Fortran interface definition for this function that tells the Fortran compiler the derived data type that is passed in as the `ctx` argument. See `PCGetApplicationContext()` for an example.

## See Also

KSP: Linear System Solvers, `PC`, `PCGetApplicationContext()`, `KSPSetApplicationContext()`, `KSPGetApplicationContext()`, `PetscObjectCompose()`

## Level

advanced

## Location

src/ksp/pc/interface/pcset.c

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