xref: /petsc/include/petscsnes.h (revision 55b5a45fb940f2dd4d8fbc33b88a890ac44d8506)
1*55b5a45fSLois Curfman McInnes /* $Id: snes.h,v 1.29 1995/08/02 04:19:29 bsmith Exp curfman $ */
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));
39ce3d82beSBarry Smith extern int SNESRegisterAll();
40ce3d82beSBarry Smith extern int SNESGetSLES(SNES,SLES*);
41761aaf1bSLois Curfman McInnes extern int SNESNoLineSearch(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*);
42761aaf1bSLois Curfman McInnes extern int SNESCubicLineSearch(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*);
43761aaf1bSLois Curfman McInnes extern int SNESQuadraticLineSearch(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*);
44761aaf1bSLois Curfman McInnes extern int SNESSetLineSearchRoutine(SNES,int(*)(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*));
45ce3d82beSBarry Smith 
46ce3d82beSBarry Smith extern int SNESGetSolution(SNES,Vec*);
47e81d6643SLois Curfman McInnes extern int SNESGetSolutionUpdate(SNES,Vec*);
48eafb4bcbSBarry Smith extern int SNESGetFunction(SNES,Vec*);
49ce3d82beSBarry Smith 
50ce3d82beSBarry Smith extern int SNESPrintHelp(SNES);
51e9e17121SLois Curfman McInnes extern int SNESView(SNES,Viewer);
52ce3d82beSBarry Smith extern int SNESSetFromOptions(SNES);
5394a5d57cSLois Curfman McInnes extern int SNESGetMethodName(SNESMethod,char **);
5452392280SLois Curfman McInnes extern int SNESGetMethodFromContext(SNES,SNESMethod*);
55eafb4bcbSBarry Smith extern int SNESDefaultMonitor(SNES,int,double,void *);
56c512e24aSBarry Smith extern int SNESDefaultSMonitor(SNES,int,double,void *);
57ce3d82beSBarry Smith extern int SNESDefaultConverged(SNES,double,double,double,void*);
5852392280SLois Curfman McInnes extern int SNESDefaultTrustRegionConverged(SNES,double,double,double,void*);
59ce3d82beSBarry Smith 
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*);
70*55b5a45fSLois Curfman McInnes extern int SNES_KSP_SetParametersEW(SNES,int,double,double,double,double,double,double);
71*55b5a45fSLois 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 
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*);
10052392280SLois Curfman McInnes 
10152392280SLois Curfman McInnes /* Should these 2 routines be private? */
10252392280SLois Curfman McInnes extern int SNESComputeHessian(SNES,Vec,Mat*,Mat*,MatStructure*);
10352392280SLois Curfman McInnes extern int SNESComputeJacobian(SNES,Vec,Mat*,Mat*,MatStructure*);
104ddbbdb52SLois Curfman McInnes 
105ce3d82beSBarry Smith #endif
106b1f5cb9dSBarry Smith 
107