SNESLineSearchSetPreCheck#

Sets a function that is called after the initial search direction has been computed but before the line search routine has been applied. Allows adjusting the result of (usually a linear solve) that determined the search direction.

Synopsis#

#include "petscsnes.h" 
PetscErrorCode SNESLineSearchSetPreCheck(SNESLineSearch linesearch, PetscErrorCode (*func)(SNESLineSearch ls, Vec x, Vec d, PetscBool *changed_d, void *ctx), void *ctx)

Logically Collective

Input Parameters#

  • linesearch - the SNESLineSearch context

  • func - [optional] function evaluation routine

  • ctx - [optional] user-defined context for private data for the function evaluation routine (may be NULL)

Calling sequence of func#

  • ls - the SNESLineSearch context

  • x - the current solution

  • d - the current search direction

  • changed_d - indicates if the search direction has been changed

  • ctx - the context passed to SNESLineSearchSetPreCheck()

Note#

Use SNESLineSearchSetPostCheck() to change the step after the line search is complete.

Use SNESVISetVariableBounds() and SNESVISetComputeVariableBounds() to cause SNES to automatically control the ranges of variables allowed.

See Also#

SNES: Nonlinear Solvers, SNES, 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


Index of all SNES routines
Table of Contents for all manual pages
Index of all manual pages