# DMSNESSetFunctionLocal
set a local residual evaluation function. This function is called with local vector containing the local vector information PLUS ghost point information. It should compute a result for all local elements and `DMSNES` will automatically accumulate the overlapping values. 
## Synopsis
```
#include "petscsnes.h" 
PetscErrorCode DMSNESSetFunctionLocal(DM dm, PetscErrorCode (*func)(DM, Vec, Vec, void *), void *ctx)
```
Logically Collective


## Input Parameters

- ***dm -*** `DM` to associate callback with
- ***func -*** local residual evaluation
- ***ctx -*** optional context for local residual evaluation





## See Also
 `DMSNESSetFunction()`, `DMDASNESSetJacobianLocal()`, `DMDACreate1d()`, `DMDACreate2d()`, `DMDACreate3d()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/utils/dmlocalsnes.c.html#DMSNESSetFunctionLocal">src/snes/utils/dmlocalsnes.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/snes/utils/dmlocalsnes.c)


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