# PCShellSetApplyRichardson
Sets routine to use as preconditioner in Richardson iteration. 
## Synopsis
```
#include "petscpc.h" 
PetscErrorCode PCShellSetApplyRichardson(PC pc, PetscErrorCode (*apply)(PC, Vec, Vec, Vec, PetscReal, PetscReal, PetscReal, PetscInt, PetscBool, PetscInt *, PCRichardsonConvergedReason *))
```
Logically Collective


## Input Parameters

- ***pc -*** the preconditioner context
- ***apply -*** the application-provided preconditioning routine



## Calling sequence of apply
```none
   PetscErrorCode apply (PC pc,Vec b,Vec x,Vec r,PetscReal rtol,PetscReal abstol,PetscReal dtol,PetscInt maxits)
```



- ***pc -*** the preconditioner, get the application context with PCShellGetContext()
- ***b -*** right-hand-side
- ***x -*** current iterate
- ***r -*** work space
- ***rtol -*** relative tolerance of residual norm to stop at
- ***abstol -*** absolute tolerance of residual norm to stop at
- ***dtol -*** if residual norm increases by this factor than return
- ***maxits -*** number of iterations to run



## Note
the function MUST return an error code of 0 on success and nonzero on failure.




## See Also
 `PCShellSetApply()`, `PCShellSetContext()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/pc/impls/shell/shellpc.c.html#PCShellSetApplyRichardson">src/ksp/pc/impls/shell/shellpc.c</A>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/pc/impls/shell/shellpc.c.html#PCShellSetApplyRichardson_Shell(PC pc, PetscErrorCode (*applyrich)">PCShellSetApplyRichardson_Shell(PC pc, PetscErrorCode (*applyrich) in src/ksp/pc/impls/shell/shellpc.c</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/ksp/pc/impls/shell/shellpc.c)


[Index of all PC routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
