Skip to main content
`Ctrl`+`K`

# PCShellSetContext

sets the context for a shell `PC` that can be accessed with `PCShellGetContext()`

## Synopsis

    #include "petscpc.h"
    PetscErrorCode PCShellSetContext(PC pc, PetscCtx ctx)

Logically Collective

## Input Parameters

- pc - the `PC` of type `PCSHELL`

- ctx - the context

## Notes

This routine is intended for use within the various user-provided routines set with, for example, `PCShellSetApply()`

One should also provide a routine to destroy the context when `pc` is destroyed with `PCShellSetDestroy()`

## Fortran Notes

To use this from Fortran you must write a Fortran interface definition for this function that tells Fortran the Fortran derived data type that you are passing in as the `ctx` argument.

## See Also

KSP: Linear System Solvers, `PC`, `PCShellGetContext()`, `PCSHELL`, `PCShellSetApply()`, `PCShellSetDestroy()`

## Level

advanced

## Location

src/ksp/pc/impls/shell/shellpc.c

## Examples

src/ksp/ksp/tutorials/ex15.c
src/ksp/pc/tutorials/ex4.c
src/tao/pde_constrained/tutorials/hyperbolic.c
src/ksp/ksp/tutorials/ex60.c
src/tao/pde_constrained/tutorials/parabolic.c

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