xref: /petsc/include/petscsnes.h (revision d5d8419b2918bc008f234245f9a674ec9b65d3ab)
1*d5d8419bSLois Curfman McInnes /* $Id: snes.h,v 1.34 1995/11/19 00:55:08 bsmith Exp curfman $ */
2f26ada1bSBarry Smith /*
3f26ada1bSBarry Smith     User interface for the nonlinear solvers package.
4f26ada1bSBarry Smith */
5f03417d3SBarry Smith #if !defined(__SNES_PACKAGE)
6f03417d3SBarry Smith #define __SNES_PACKAGE
7ce3d82beSBarry Smith #include "sles.h"
8b1f5cb9dSBarry Smith 
9353a3ba4SBarry Smith typedef struct _SNES* SNES;
10ce3d82beSBarry Smith #define SNES_COOKIE PETSC_COOKIE+13
11b1f5cb9dSBarry Smith 
1252392280SLois Curfman McInnes typedef enum { SNES_UNKNOWN_METHOD=-1,
1352392280SLois Curfman McInnes                SNES_EQ_NLS,
1425c7317fSLois Curfman McInnes                SNES_EQ_NTR,
1525c7317fSLois Curfman McInnes                SNES_EQ_NTR_DOG_LEG,
1625c7317fSLois Curfman McInnes                SNES_EQ_NTR2_LIN,
1725c7317fSLois Curfman McInnes                SNES_EQ_NTEST,
18ddbbdb52SLois Curfman McInnes                SNES_UM_NLS,
19f26ada1bSBarry Smith                SNES_UM_NTR
20f26ada1bSBarry Smith } SNESMethod;
21b1f5cb9dSBarry Smith 
22f26ada1bSBarry Smith typedef enum { POSITIVE_FUNCTION_VALUE, NEGATIVE_FUNCTION_VALUE} SNESFunctionSign;
23dbb450caSBarry Smith 
24f26ada1bSBarry Smith typedef enum { SNES_NONLINEAR_EQUATIONS, SNES_UNCONSTRAINED_MINIMIZATION} SNESType;
25f03417d3SBarry Smith 
2652392280SLois Curfman McInnes extern int SNESCreate(MPI_Comm,SNESType,SNES*);
2794a5d57cSLois Curfman McInnes extern int SNESSetMethod(SNES,SNESMethod);
28eafb4bcbSBarry Smith extern int SNESSetMonitor(SNES,int(*)(SNES,int,double,void*),void *);
294d08eca6SBarry Smith extern int SNESSetSolution(SNES,Vec,int(*)(SNES,Vec,void*),void *);
30f26ada1bSBarry Smith extern int SNESSetFunction(SNES,Vec,int(*)(SNES,Vec,Vec,void*),void *,SNESFunctionSign);
31722fc279SLois Curfman McInnes extern int SNESSetJacobian(SNES,Mat,Mat,int(*)(SNES,Vec,Mat*,Mat*,MatStructure*,void*),void *);
32ce3d82beSBarry Smith extern int SNESDestroy(SNES);
33353a3ba4SBarry Smith extern int SNESSetUp(SNES);
34ce3d82beSBarry Smith extern int SNESSolve(SNES,int*);
35ce3d82beSBarry Smith extern int SNESRegister(int,char*,int(*)(SNES));
36c01c455dSBarry Smith extern int SNESRegisterDestroy();
37ce3d82beSBarry Smith extern int SNESRegisterAll();
38ce3d82beSBarry Smith extern int SNESGetSLES(SNES,SLES*);
39761aaf1bSLois Curfman McInnes extern int SNESNoLineSearch(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*);
40761aaf1bSLois Curfman McInnes extern int SNESCubicLineSearch(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*);
41761aaf1bSLois Curfman McInnes extern int SNESQuadraticLineSearch(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*);
42761aaf1bSLois Curfman McInnes extern int SNESSetLineSearchRoutine(SNES,int(*)(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*));
43ce3d82beSBarry Smith 
44ce3d82beSBarry Smith extern int SNESGetSolution(SNES,Vec*);
45e81d6643SLois Curfman McInnes extern int SNESGetSolutionUpdate(SNES,Vec*);
46eafb4bcbSBarry Smith extern int SNESGetFunction(SNES,Vec*);
47ce3d82beSBarry Smith 
48ce3d82beSBarry Smith extern int SNESPrintHelp(SNES);
49e9e17121SLois Curfman McInnes extern int SNESView(SNES,Viewer);
50ce3d82beSBarry Smith extern int SNESSetFromOptions(SNES);
5194a5d57cSLois Curfman McInnes extern int SNESGetMethodName(SNESMethod,char **);
5252392280SLois Curfman McInnes extern int SNESGetMethodFromContext(SNES,SNESMethod*);
53eafb4bcbSBarry Smith extern int SNESDefaultMonitor(SNES,int,double,void *);
54c512e24aSBarry Smith extern int SNESDefaultSMonitor(SNES,int,double,void *);
55ce3d82beSBarry Smith extern int SNESDefaultConverged(SNES,double,double,double,void*);
56c01c455dSBarry Smith extern int SNESTrustRegionDefaultConverged(SNES,double,double,double,void*);
570de89847SLois Curfman McInnes extern int SNESSetSolutionTolerance(SNES,double);
580de89847SLois Curfman McInnes extern int SNESSetAbsoluteTolerance(SNES,double);
590de89847SLois Curfman McInnes extern int SNESSetRelativeTolerance(SNES,double);
600de89847SLois Curfman McInnes extern int SNESSetTruncationTolerance(SNES,double);
6152392280SLois Curfman McInnes extern int SNESSetTrustRegionTolerance(SNES,double);
620de89847SLois Curfman McInnes extern int SNESSetMaxIterations(SNES,int);
6306be10caSBarry Smith extern int SNESSetMaxFunctionEvaluations(SNES,int);
647e984346SBarry Smith extern int SNESGetIterationNumber(SNES,int*);
654f6d0874SLois Curfman McInnes extern int SNESGetFunctionNorm(SNES,Scalar*);
66a96f0e77SLois Curfman McInnes extern int SNESGetNumberUnsuccessfulSteps(SNES,int*);
6755b5a45fSLois Curfman McInnes extern int SNES_KSP_SetParametersEW(SNES,int,double,double,double,double,double,double);
6855b5a45fSLois Curfman McInnes extern int SNES_KSP_SetConvergenceTestEW(SNES);
69eafb4bcbSBarry Smith 
70eafb4bcbSBarry Smith #if defined(__DRAW_PACKAGE)
71eafb4bcbSBarry Smith #define SNESLGMonitorCreate  KSPLGMonitorCreate
72eafb4bcbSBarry Smith #define SNESLGMonitorDestroy KSPLGMonitorDestroy
73eafb4bcbSBarry Smith #define SNESLGMonitor        ((int (*)(SNES,int,double,void*))KSPLGMonitor)
74eafb4bcbSBarry Smith #endif
75eafb4bcbSBarry Smith 
76748e9f0dSBarry Smith extern int SNESComputeInitialGuess(SNES,Vec);
77df60cc22SBarry Smith 
78722fc279SLois Curfman McInnes extern int SNESDefaultComputeJacobian(SNES,Vec,Mat*,Mat*,MatStructure*,void*);
797e984346SBarry Smith extern int SNESDefaultMatrixFreeMatCreate(SNES,Vec x,Mat*);
80748e9f0dSBarry Smith 
817f813858SBarry Smith extern int SNESComputeFunction(SNES,Vec,Vec);
82ddbbdb52SLois Curfman McInnes extern int SNESDestroy(SNES);
83ddbbdb52SLois Curfman McInnes 
84c01c455dSBarry Smith extern int SNESSetApplicationContext(SNES,void *);
85c01c455dSBarry Smith extern int SNESGetApplicationContext(SNES,void **);
86f26ada1bSBarry Smith extern int SNESSetConvergenceTest(SNES,int (*)(SNES,double,double,double,void*),void*);
87ddbbdb52SLois Curfman McInnes 
8852392280SLois Curfman McInnes /* Unconstrained minimization routines */
8925c7317fSLois Curfman McInnes 
90ddbbdb52SLois Curfman McInnes extern int SNESSetHessian(SNES,Mat,Mat,int(*)(SNES,Vec,Mat*,Mat*,MatStructure*,void*),void *);
91ddbbdb52SLois Curfman McInnes extern int SNESSetGradient(SNES,Vec,int(*)(SNES,Vec,Vec,void*),void*);
92ddbbdb52SLois Curfman McInnes extern int SNESGetGradient(SNES,Vec*);
9325c7317fSLois Curfman McInnes extern int SNESGetGradientNorm(SNES,Scalar*);
94ddbbdb52SLois Curfman McInnes extern int SNESComputeGradient(SNES,Vec,Vec);
9525c7317fSLois Curfman McInnes extern int SNESSetMinimizationFunction(SNES,int(*)(SNES,Vec,double*,void*),void*);
9625c7317fSLois Curfman McInnes extern int SNESComputeMinimizationFunction(SNES,Vec,double*);
9725c7317fSLois Curfman McInnes extern int SNESGetMinimizationFunction(SNES,double*);
9825c7317fSLois Curfman McInnes extern int SNESSetMinFunctionTolerance(SNES,double);
9952392280SLois Curfman McInnes extern int SNESGetLineSearchDampingParameter(SNES,double*);
100*d5d8419bSLois Curfman McInnes extern int SNESConverged_UMLS(SNES,double,double,double,void*);
101*d5d8419bSLois Curfman McInnes extern int SNESConverged_UMTR(SNES,double,double,double,void*);
10252392280SLois Curfman McInnes 
10352392280SLois Curfman McInnes /* Should these 2 routines be private? */
10452392280SLois Curfman McInnes extern int SNESComputeHessian(SNES,Vec,Mat*,Mat*,MatStructure*);
10552392280SLois Curfman McInnes extern int SNESComputeJacobian(SNES,Vec,Mat*,Mat*,MatStructure*);
106ddbbdb52SLois Curfman McInnes 
107ce3d82beSBarry Smith #endif
108b1f5cb9dSBarry Smith 
109