PCSHELL#

Creates a new preconditioner class for use with a users own private data storage format and preconditioner application code

Usage#

  extern PetscErrorCode apply(PC,Vec,Vec);
  extern PetscErrorCode applyba(PC,PCSide,Vec,Vec,Vec);
  extern PetscErrorCode applytranspose(PC,Vec,Vec);
  extern PetscErrorCode setup(PC);
  extern PetscErrorCode destroy(PC);

  PCCreate(comm,&pc);
  PCSetType(pc,PCSHELL);
  PCShellSetContext(pc,ctx)
  PCShellSetApply(pc,apply);
  PCShellSetApplyBA(pc,applyba);               (optional)
  PCShellSetApplyTranspose(pc,applytranspose); (optional)
  PCShellSetSetUp(pc,setup);                   (optional)
  PCShellSetDestroy(pc,destroy);               (optional)

Notes#

Information required for the preconditioner and its internal datastructures can be set with PCShellSetContext() and then accessed with PCShellGetContext() inside the routines provided above.

When using MATSHELL, where the explicit entries of matrix are not available to build the preconditioner, PCSHELL can be used to construct a custom preconditioner for the MATSHELL, assuming the user knows enough about their problem to provide a custom preconditioner.

See Also#

KSP: Linear System Solvers, PCCreate(), PCSetType(), PCType, PC, MATSHELL, PCShellSetSetUp(), PCShellSetApply(), PCShellSetView(), PCShellSetDestroy(), PCShellSetPostSolve(), PCShellSetApplyTranspose(), PCShellSetName(), PCShellSetApplyRichardson(), PCShellSetPreSolve(), PCShellSetView(), PCShellGetName(), PCShellSetContext(), PCShellGetContext(), PCShellSetApplyBA(), MATSHELL, PCShellSetMatApply(),

Level#

advanced

Location#

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

Examples#

src/tao/pde_constrained/tutorials/hyperbolic.c
src/snes/tutorials/ex3.c
src/ksp/ksp/tutorials/ex60.c
src/ksp/pc/tutorials/ex4.c
src/ksp/ksp/tutorials/ex15.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