SNESLineSearchShellSetUserFunc#

Sets the user function for the SNESLINESEARCHSHELL implementation.

Synopsis#

PetscErrorCode SNESLineSearchShellSetUserFunc(SNESLineSearch linesearch, SNESLineSearchUserFunc func, void *ctx)

Not Collective

Input Parameters#

  • linesearch - SNESLineSearch context

  • func - function implementing the linesearch shell.

  • ctx - context for func

Calling sequence of func#

  • linesearch - the linesearch instance

  • ctx - the above mentioned context

Usage#

PetscErrorCode shellfunc(SNESLineSearch linesearch,void * ctx)
{
Vec  X,Y,F,W,G;
SNES snes;
PetscCall(SNESLineSearchGetSNES(linesearch,&snes));
PetscCall(SNESLineSearchGetVecs(linesearch,&X,&F,&Y,&W,&G));
.. determine lambda using W and G as work vecs..
PetscCall(VecAXPY(X,-lambda,Y));
}

...

PetscCall(SNESGetLineSearch(snes, &linesearch));
PetscCall(SNESLineSearchShellSetUserFunc(linesearch, shellfunc, NULL));

See Also#

SNESLineSearchShellGetUserFunc(), SNESLINESEARCHSHELL, SNESLineSearchType, SNESLineSearch

Level#

advanced

Location#

src/snes/linesearch/impls/shell/linesearchshell.c

Examples#

src/snes/tutorials/ex1f.F90.html


Edit on GitLab

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