PCGetApplicationContext — PETSc 3.23.0 documentation

Skip to main content
`Ctrl`+`K`

# PCGetApplicationContext

Gets the user-defined context for the preconditioner set with `PCSetApplicationContext()`

## Synopsis

    #include "petscpc.h"
    PetscErrorCode PCGetApplicationContext(PC pc, PeCtx ctx)

Not Collective

## Input Parameter

- pc - `PC` context

## Output Parameter

- ctx - user context

## Fortran Notes

This only works when the context is a Fortran derived type (it cannot be a `PetscObject`) and you must write a Fortran interface definition for this function that tells the Fortran compiler the derived data type that is returned as the `ctx` argument. For example,

      Interface PCGetApplicationContext
        Subroutine PCGetApplicationContext(pc,ctx,ierr)
      #include <petsc/finclude/petscpc.h>
          use petscpc
          PC pc
          type(tUsertype), pointer :: ctx
          PetscErrorCode ierr
        End Subroutine
      End Interface PCGetApplicationContext

The prototpye for `ctx` must be

      type(tUsertype), pointer :: ctx

## See Also

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

## 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