SNESLineSearchSetPostCheck#

Sets a user function that is called after the line search has been applied to determine the step direction and length. Allows the user a chance to change or override the decision of the line search routine

Synopsis#

#include "petscsnes.h" 
PetscErrorCode SNESLineSearchSetPostCheck(SNESLineSearch linesearch, PetscErrorCode (*func)(SNESLineSearch ls, Vec x, Vec d, Vec w, PetscBool *changed_d, PetscBool *changed_w, 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

  • w - \( w = x + lambda*d \) for some lambda

  • changed_d - indicates if the search direction d has been changed

  • changed_w - indicates w has been changed

  • ctx - the context passed to SNESLineSearchSetPreCheck()

Notes#

Use SNESLineSearchSetPreCheck() to change the step before the line search is completed. The calling sequence of the callback does not contain the current scaling factor. To access the value, use SNESLineSearchGetLambda().

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

See Also#

SNES: Nonlinear Solvers, SNES, SNESLineSearch, SNESGetLineSearch(), SNESLineSearchPostCheck(), SNESLineSearchSetPreCheck(), SNESLineSearchGetPreCheck(), SNESLineSearchGetPostCheck(), SNESVISetVariableBounds(), SNESVISetComputeVariableBounds(), SNESSetFunctionDomainError(), SNESSetJacobianDomainError()

Level#

intermediate

Location#

src/snes/linesearch/interface/linesearch.c

Examples#

src/ts/tutorials/ex27.c
src/snes/tutorials/ex3.c


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