SNESSetFunction
Sets the function evaluation routine and function vector for use by the SNES routines in solving systems of nonlinear equations.
Synopsis
int SNESSetFunction( SNES snes, Vec r, int (*func)(SNES,Vec,Vec,void*),void *ctx)
Collective on
SNES
Input Parameters
snes | - the SNES context
|
func | - function evaluation routine
|
r | - vector to store function value
|
ctx | - [optional] user-defined context for private data for the
function evaluation routine (may be PETSC_NULL)
|
Calling sequence of func
func (SNES snes,Vec x,Vec f,void *ctx);
f -function vector
ctx -optional user-defined function context
Notes
The Newton-like methods typically solve linear systems of the
form
f'(x) x = -f(x),
where f'(x) denotes the Jacobian matrix and f(x) is the function.
SNESSetFunction() is valid for SNES_NONLINEAR_EQUATIONS methods only.
Analogous routines for SNES_UNCONSTRAINED_MINIMIZATION methods
areSNESSetMinimizationFunction() and SNESSetGradient();
Keywords
SNES, nonlinear, set, function
See Also
SNESGetFunction(), SNESComputeFunction(), SNESSetJacobian()
Examples
src/snes/examples/tutorials/ex1f.F
src/snes/examples/tutorials/ex4f.F
src/snes/examples/tutorials/ex5f.F
src/snes/examples/tutorials/ex5f90.F
src/snes/examples/tutorials/ex4.c
src/snes/examples/tutorials/ex1.c
src/snes/examples/tutorials/ex2.c
src/snes/examples/tutorials/ex5.c
src/snes/examples/tutorials/ex3.c
src/snes/examples/tutorials/ex6.c
src/snes/examples/tutorials/ex5s.c
src/snes/examples/tutorials/ex7.c
src/snes/examples/tutorials/ex8.c
src/snes/examples/tutorials/ex9.c
Location: src/snes/interface/snes.c
SNES Index
Table of Contents