1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML3.2 EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="DOCTEXT">
<TITLE>SNESSetLineSearchCheck</TITLE>
</HEAD>
<BODY BGCOLOR="FFFFFF">
<A NAME="SNESSetLineSearchCheck"><H1>SNESSetLineSearchCheck</H1></A>
Sets a routine to check the validity of new iterate computed by the line search routine in the Newton-based method <A HREF="../SNES/SNESLS.html#SNESLS">SNESLS</A>.
<H3><FONT COLOR="#CC3333">Synopsis</FONT></H3>
<PRE>
int SNESSetLineSearchCheck(SNES snes,int (*func)(SNES,void*,Vec,PetscTruth*),void *checkctx)
</PRE>
<H3><FONT COLOR="#CC3333">Input Parameters</FONT></H3>
<TABLE border="0" cellpadding="0" cellspacing="0">
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>snes </B></TD><TD>- nonlinear context obtained from <A HREF="../SNES/SNESCreate.html#SNESCreate">SNESCreate</A>()
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>func </B></TD><TD>- pointer to int function
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>checkctx </B></TD><TD>- optional user-defined context for use by step checking routine
</TD></TR></TABLE>
<P>
Collective on <A HREF="../SNES/SNES.html#SNES">SNES</A>
<P>
<H3><FONT COLOR="#CC3333">Calling sequence of func</FONT></H3>
<PRE>
int func (<A HREF="../SNES/SNES.html#SNES">SNES</A> snes, void *checkctx, <A HREF="../Vec/Vec.html#Vec">Vec</A> x, <A HREF="../Sys/PetscTruth.html#PetscTruth">PetscTruth</A> *flag)
</PRE>
where func returns an error code of 0 on success and a nonzero
on failure.
<P>
<H3><FONT COLOR="#CC3333">Input parameters for func</FONT></H3>
<TABLE border="0" cellpadding="0" cellspacing="0">
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>snes </B></TD><TD>- nonlinear context
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>checkctx </B></TD><TD>- optional user-defined context for use by step checking routine
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>x </B></TD><TD>- current candidate iterate
</TD></TR></TABLE>
<P>
<H3><FONT COLOR="#CC3333">Output parameters for func</FONT></H3>
<TABLE border="0" cellpadding="0" cellspacing="0">
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>x </B></TD><TD>- current iterate (possibly modified)
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>flag </B></TD><TD>- flag indicating whether x has been modified (either
PETSC_TRUE of PETSC_FALSE)
</TD></TR></TABLE>
<P>
<P>
<H3><FONT COLOR="#CC3333">Notes</FONT></H3>
<A HREF="../SNES/SNESNoLineSearch.html#SNESNoLineSearch">SNESNoLineSearch</A>() and <A HREF="../SNES/SNESNoLineSearchNoNorms.html#SNESNoLineSearchNoNorms">SNESNoLineSearchNoNorms</A>() accept the new
iterate computed by the line search checking routine. In particular,
these routines (1) compute a candidate iterate u_{i+1}, (2) pass control
to the checking routine, and then (3) compute the corresponding nonlinear
function f(u_{i+1}) with the (possibly altered) iterate u_{i+1}.
<P>
<A HREF="../SNES/SNESQuadraticLineSearch.html#SNESQuadraticLineSearch">SNESQuadraticLineSearch</A>() and <A HREF="../SNES/SNESCubicLineSearch.html#SNESCubicLineSearch">SNESCubicLineSearch</A>() also accept the
new iterate computed by the line search checking routine. In particular,
these routines (1) compute a candidate iterate u_{i+1} as well as a
candidate nonlinear function f(u_{i+1}), (2) pass control to the checking
routine, and then (3) force a re-evaluation of f(u_{i+1}) if any changes
were made to the candidate iterate in the checking routine (as indicated
by flag=PETSC_TRUE). The overhead of this function re-evaluation can be
very costly, so use this feature with caution!
<P>
<H3><FONT COLOR="#CC3333">Keywords</FONT></H3>
<A HREF="../SNES/SNES.html#SNES">SNES</A>, nonlinear, set, line search check, step check, routine
<BR>
<P>
<H3><FONT COLOR="#CC3333">See Also</FONT></H3>
<A HREF="../SNES/SNESSetLineSearch.html#SNESSetLineSearch">SNESSetLineSearch</A>()
<BR><P><B><P><B><FONT COLOR="#CC3333">Level:</FONT></B>advanced
<BR><FONT COLOR="#CC3333">Location:</FONT></B><A HREF="../../../src/snes/impls/ls/ls.c.html#SNESSetLineSearchCheck">src/snes/impls/ls/ls.c</A>
<BR><A HREF="./index.html">Index of all SNES routines</A>
<BR><A HREF="../../index.html">Table of Contents for all manual pages</A>
<BR><A HREF="../singleindex.html">Index of all manual pages</A>
<P><H3><FONT COLOR="#CC3333">Examples</FONT></H3>
<A HREF="../../../src/snes/examples/tutorials/ex3.c.html">src/snes/examples/tutorials/ex3.c.html</A><BR>
</BODY></HTML>
|