:orphan:
# SNESLineSearchSetPreCheck
Sets a user function that is called after the initial search direction has been computed but before the line search routine has been applied. Allows the user to adjust the result of (usually a linear solve) that determined the search direction.
## Synopsis
```
#include "petscsnes.h"
PetscErrorCode SNESLineSearchSetPreCheck(SNESLineSearch linesearch, PetscErrorCode (*func)(SNESLineSearch, Vec, Vec, PetscBool *, void *), void *ctx)
```
Logically Collective
## Input Parameters
- ***linesearch -*** the `SNESLineSearch` context
- ***func -*** [optional] function evaluation routine, for the calling sequence see `SNESLineSearchPreCheck()`
- ***ctx -*** [optional] user-defined context for private data for the function evaluation routine (may be `NULL`)
## Note
Use `SNESLineSearchSetPostCheck()` to change the step after the line search.
search is complete.
Use `SNESVISetVariableBounds()` and `SNESVISetComputeVariableBounds()` to cause `SNES` to automatically control the ranges of variables allowed.
## See Also
`SNESGetLineSearch()`, `SNESLineSearchPreCheck()`, `SNESLineSearchSetPostCheck()`, `SNESLineSearchGetPostCheck()`, `SNESLineSearchGetPreCheck()`,
`SNESVISetVariableBounds()`, `SNESVISetComputeVariableBounds()`, `SNESSetFunctionDomainError()`, `SNESSetJacobianDomainError()`
## Level
intermediate
## Location
src/snes/linesearch/interface/linesearch.c
## Examples
src/snes/tutorials/ex15.c
src/snes/tutorials/ex3.c
---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/snes/linesearch/interface/linesearch.c)
[Index of all SNES routines](index.md)
[Table of Contents for all manual pages](/manualpages/index.md)
[Index of all manual pages](/manualpages/singleindex.md)