xref: /petsc/include/petscsnes.h (revision c01c455d43b147fbcccdf73d28be4d01ad7032e0)
1*c01c455dSBarry Smith /* $Id: snes.h,v 1.30 1995/08/03 21:58:37 curfman Exp bsmith $ */
2b1f5cb9dSBarry Smith 
3f03417d3SBarry Smith #if !defined(__SNES_PACKAGE)
4f03417d3SBarry Smith #define __SNES_PACKAGE
5ce3d82beSBarry Smith #include "sles.h"
6b1f5cb9dSBarry Smith 
7353a3ba4SBarry Smith typedef struct _SNES* SNES;
8ce3d82beSBarry Smith #define SNES_COOKIE PETSC_COOKIE+13
9b1f5cb9dSBarry Smith 
1052392280SLois Curfman McInnes typedef enum { SNES_UNKNOWN_METHOD=-1,
1152392280SLois Curfman McInnes                SNES_EQ_NLS,
1225c7317fSLois Curfman McInnes                SNES_EQ_NTR,
1325c7317fSLois Curfman McInnes                SNES_EQ_NTR_DOG_LEG,
1425c7317fSLois Curfman McInnes                SNES_EQ_NTR2_LIN,
1525c7317fSLois Curfman McInnes                SNES_EQ_NTEST,
16ddbbdb52SLois Curfman McInnes                SNES_UM_NLS,
1725c7317fSLois Curfman McInnes                SNES_UM_NTR }
1894a5d57cSLois Curfman McInnes   SNESMethod;
19b1f5cb9dSBarry Smith 
2025c7317fSLois Curfman McInnes #define SNES_NLS         SNES_EQ_NLS
2125c7317fSLois Curfman McInnes #define SNES_NTR         SNES_EQ_NTR
2225c7317fSLois Curfman McInnes #define SNES_NTR2_LIN    SNES_EQ_NTR2_LIN
2325c7317fSLois Curfman McInnes #define SNES_NTR_DOG_LEG SNES_EQ_NTR_DOG_LEG
2425c7317fSLois Curfman McInnes #define SNES_NTEST       SNES_EQ_NTEST
2525c7317fSLois Curfman McInnes 
2652392280SLois Curfman McInnes typedef enum { SNES_NONLINEAR_EQUATIONS, SNES_UNCONSTRAINED_MINIMIZATION }
2752392280SLois Curfman McInnes         SNESType;
28f03417d3SBarry Smith 
2952392280SLois Curfman McInnes extern int SNESCreate(MPI_Comm,SNESType,SNES*);
3094a5d57cSLois Curfman McInnes extern int SNESSetMethod(SNES,SNESMethod);
31eafb4bcbSBarry Smith extern int SNESSetMonitor(SNES,int(*)(SNES,int,double,void*),void *);
324d08eca6SBarry Smith extern int SNESSetSolution(SNES,Vec,int(*)(SNES,Vec,void*),void *);
334d08eca6SBarry Smith extern int SNESSetFunction(SNES,Vec,int(*)(SNES,Vec,Vec,void*),void *,int);
34722fc279SLois Curfman McInnes extern int SNESSetJacobian(SNES,Mat,Mat,int(*)(SNES,Vec,Mat*,Mat*,MatStructure*,void*),void *);
35ce3d82beSBarry Smith extern int SNESDestroy(SNES);
36353a3ba4SBarry Smith extern int SNESSetUp(SNES);
37ce3d82beSBarry Smith extern int SNESSolve(SNES,int*);
38ce3d82beSBarry Smith extern int SNESRegister(int,char*,int(*)(SNES));
39*c01c455dSBarry Smith extern int SNESRegisterDestroy();
40ce3d82beSBarry Smith extern int SNESRegisterAll();
41ce3d82beSBarry Smith extern int SNESGetSLES(SNES,SLES*);
42761aaf1bSLois Curfman McInnes extern int SNESNoLineSearch(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*);
43761aaf1bSLois Curfman McInnes extern int SNESCubicLineSearch(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*);
44761aaf1bSLois Curfman McInnes extern int SNESQuadraticLineSearch(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*);
45761aaf1bSLois Curfman McInnes extern int SNESSetLineSearchRoutine(SNES,int(*)(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*));
46ce3d82beSBarry Smith 
47ce3d82beSBarry Smith extern int SNESGetSolution(SNES,Vec*);
48e81d6643SLois Curfman McInnes extern int SNESGetSolutionUpdate(SNES,Vec*);
49eafb4bcbSBarry Smith extern int SNESGetFunction(SNES,Vec*);
50ce3d82beSBarry Smith 
51ce3d82beSBarry Smith extern int SNESPrintHelp(SNES);
52e9e17121SLois Curfman McInnes extern int SNESView(SNES,Viewer);
53ce3d82beSBarry Smith extern int SNESSetFromOptions(SNES);
5494a5d57cSLois Curfman McInnes extern int SNESGetMethodName(SNESMethod,char **);
5552392280SLois Curfman McInnes extern int SNESGetMethodFromContext(SNES,SNESMethod*);
56eafb4bcbSBarry Smith extern int SNESDefaultMonitor(SNES,int,double,void *);
57c512e24aSBarry Smith extern int SNESDefaultSMonitor(SNES,int,double,void *);
58ce3d82beSBarry Smith extern int SNESDefaultConverged(SNES,double,double,double,void*);
59*c01c455dSBarry Smith extern int SNESTrustRegionDefaultConverged(SNES,double,double,double,void*);
600de89847SLois Curfman McInnes extern int SNESSetSolutionTolerance(SNES,double);
610de89847SLois Curfman McInnes extern int SNESSetAbsoluteTolerance(SNES,double);
620de89847SLois Curfman McInnes extern int SNESSetRelativeTolerance(SNES,double);
630de89847SLois Curfman McInnes extern int SNESSetTruncationTolerance(SNES,double);
6452392280SLois Curfman McInnes extern int SNESSetTrustRegionTolerance(SNES,double);
650de89847SLois Curfman McInnes extern int SNESSetMaxIterations(SNES,int);
6606be10caSBarry Smith extern int SNESSetMaxFunctionEvaluations(SNES,int);
677e984346SBarry Smith extern int SNESGetIterationNumber(SNES,int*);
684f6d0874SLois Curfman McInnes extern int SNESGetFunctionNorm(SNES,Scalar*);
69a96f0e77SLois Curfman McInnes extern int SNESGetNumberUnsuccessfulSteps(SNES,int*);
7055b5a45fSLois Curfman McInnes extern int SNES_KSP_SetParametersEW(SNES,int,double,double,double,double,double,double);
7155b5a45fSLois Curfman McInnes extern int SNES_KSP_SetConvergenceTestEW(SNES);
72eafb4bcbSBarry Smith 
73eafb4bcbSBarry Smith #if defined(__DRAW_PACKAGE)
74eafb4bcbSBarry Smith #define SNESLGMonitorCreate  KSPLGMonitorCreate
75eafb4bcbSBarry Smith #define SNESLGMonitorDestroy KSPLGMonitorDestroy
76eafb4bcbSBarry Smith #define SNESLGMonitor        ((int (*)(SNES,int,double,void*))KSPLGMonitor)
77eafb4bcbSBarry Smith #endif
78eafb4bcbSBarry Smith 
79748e9f0dSBarry Smith extern int SNESComputeInitialGuess(SNES,Vec);
80df60cc22SBarry Smith 
81722fc279SLois Curfman McInnes extern int SNESDefaultComputeJacobian(SNES,Vec,Mat*,Mat*,MatStructure*,void*);
827e984346SBarry Smith extern int SNESDefaultMatrixFreeMatCreate(SNES,Vec x,Mat*);
83748e9f0dSBarry Smith 
847f813858SBarry Smith extern int SNESComputeFunction(SNES,Vec,Vec);
85ddbbdb52SLois Curfman McInnes extern int SNESDestroy(SNES);
86ddbbdb52SLois Curfman McInnes 
87*c01c455dSBarry Smith extern int SNESSetApplicationContext(SNES,void *);
88*c01c455dSBarry Smith extern int SNESGetApplicationContext(SNES,void **);
89*c01c455dSBarry Smith extern int SNESSetConvergenceTest(SNES,
90*c01c455dSBarry Smith                   int (*)(SNES,double,double,double,void*),void*);
91ddbbdb52SLois Curfman McInnes 
9252392280SLois Curfman McInnes /* Unconstrained minimization routines */
9325c7317fSLois Curfman McInnes 
94ddbbdb52SLois Curfman McInnes extern int SNESSetHessian(SNES,Mat,Mat,int(*)(SNES,Vec,Mat*,Mat*,MatStructure*,void*),void *);
95ddbbdb52SLois Curfman McInnes extern int SNESSetGradient(SNES,Vec,int(*)(SNES,Vec,Vec,void*),void*);
96ddbbdb52SLois Curfman McInnes extern int SNESGetGradient(SNES,Vec*);
9725c7317fSLois Curfman McInnes extern int SNESGetGradientNorm(SNES,Scalar*);
98ddbbdb52SLois Curfman McInnes extern int SNESComputeGradient(SNES,Vec,Vec);
9925c7317fSLois Curfman McInnes extern int SNESSetMinimizationFunction(SNES,int(*)(SNES,Vec,double*,void*),void*);
10025c7317fSLois Curfman McInnes extern int SNESComputeMinimizationFunction(SNES,Vec,double*);
10125c7317fSLois Curfman McInnes extern int SNESGetMinimizationFunction(SNES,double*);
10225c7317fSLois Curfman McInnes extern int SNESSetMinFunctionTolerance(SNES,double);
10352392280SLois Curfman McInnes extern int SNESGetLineSearchDampingParameter(SNES,double*);
10452392280SLois Curfman McInnes 
10552392280SLois Curfman McInnes /* Should these 2 routines be private? */
10652392280SLois Curfman McInnes extern int SNESComputeHessian(SNES,Vec,Mat*,Mat*,MatStructure*);
10752392280SLois Curfman McInnes extern int SNESComputeJacobian(SNES,Vec,Mat*,Mat*,MatStructure*);
108ddbbdb52SLois Curfman McInnes 
109ce3d82beSBarry Smith #endif
110b1f5cb9dSBarry Smith 
111