# PCPatchSetComputeFunction
Set the callback used to compute patch residuals 
## Synopsis
```
#include "petscpc.h" 
#include "petscmat.h" 
PetscErrorCode PCPatchSetComputeFunction(PC pc, PetscErrorCode (*func)(PC, PetscInt, Vec, Vec, IS, PetscInt, const PetscInt *, const PetscInt *, void *), void *ctx)
```
Logically collective


## Input Parameters

- ***pc   -*** The PC
- ***func -*** The callback
- ***ctx  -*** The user context



## Calling sequence of func
```none
func (PC pc,PetscInt point,Vec x,Vec f,IS cellIS,PetscInt n,const PetscInt* dofsArray,const PetscInt* dofsArrayWithAll,void* ctx)
```


- ***pc               -*** The PC
- ***point            -*** The point
- ***x                -*** The input solution (not used in linear problems)
- ***f                -*** The patch residual vector
- ***cellIS           -*** An array of the cell numbers
- ***n                -*** The size of dofsArray
- ***dofsArray        -*** The dofmap for the dofs to be solved for
- ***dofsArrayWithAll -*** The dofmap for all dofs on the patch
- ***ctx              -*** The user context





## Note
The entries of F (the output residual vector) have been set to zero before the call.


## See Also
 `PCPatchSetComputeOperator()`, `PCPatchGetComputeOperator()`, `PCPatchSetDiscretisationInfo()`, `PCPatchSetComputeFunctionInteriorFacets()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/pc/impls/patch/pcpatch.c.html#PCPatchSetComputeFunction">src/ksp/pc/impls/patch/pcpatch.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/ksp/pc/impls/patch/pcpatch.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)  
