xref: /petsc/include/petscsnes.h (revision 25c7317f55d3c1589110e0681c70596cf58eb2d0)
1*25c7317fSLois Curfman McInnes /* $Id: snes.h,v 1.26 1995/07/17 20:43:13 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 
10*25c7317fSLois Curfman McInnes typedef enum { SNES_EQ_NLS,
11*25c7317fSLois Curfman McInnes                SNES_EQ_NTR,
12*25c7317fSLois Curfman McInnes                SNES_EQ_NTR_DOG_LEG,
13*25c7317fSLois Curfman McInnes                SNES_EQ_NTR2_LIN,
14*25c7317fSLois Curfman McInnes                SNES_EQ_NTEST,
15ddbbdb52SLois Curfman McInnes                SNES_UM_NLS,
16*25c7317fSLois Curfman McInnes                SNES_UM_NTR }
1794a5d57cSLois Curfman McInnes   SNESMethod;
18b1f5cb9dSBarry Smith 
19*25c7317fSLois Curfman McInnes #define SNES_NLS         SNES_EQ_NLS
20*25c7317fSLois Curfman McInnes #define SNES_NTR         SNES_EQ_NTR
21*25c7317fSLois Curfman McInnes #define SNES_NTR2_LIN    SNES_EQ_NTR2_LIN
22*25c7317fSLois Curfman McInnes #define SNES_NTR_DOG_LEG SNES_EQ_NTR_DOG_LEG
23*25c7317fSLois Curfman McInnes #define SNES_NTEST       SNES_EQ_NTEST
24*25c7317fSLois Curfman McInnes 
25*25c7317fSLois Curfman McInnes typedef enum { SNES_EQ, SNES_UM } SNESType;
26f03417d3SBarry Smith 
27ce3d82beSBarry Smith extern int SNESCreate(MPI_Comm,SNES*);
2894a5d57cSLois Curfman McInnes extern int SNESSetMethod(SNES,SNESMethod);
29eafb4bcbSBarry Smith extern int SNESSetMonitor(SNES,int(*)(SNES,int,double,void*),void *);
304d08eca6SBarry Smith extern int SNESSetSolution(SNES,Vec,int(*)(SNES,Vec,void*),void *);
314d08eca6SBarry Smith extern int SNESSetFunction(SNES,Vec,int(*)(SNES,Vec,Vec,void*),void *,int);
32722fc279SLois Curfman McInnes extern int SNESSetJacobian(SNES,Mat,Mat,int(*)(SNES,Vec,Mat*,Mat*,MatStructure*,void*),void *);
33ce3d82beSBarry Smith extern int SNESDestroy(SNES);
34353a3ba4SBarry Smith extern int SNESSetUp(SNES);
35ce3d82beSBarry Smith extern int SNESSolve(SNES,int*);
36ce3d82beSBarry Smith extern int SNESRegister(int,char*,int(*)(SNES));
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 **);
52eafb4bcbSBarry Smith extern int SNESDefaultMonitor(SNES,int,double,void *);
53c512e24aSBarry Smith extern int SNESDefaultSMonitor(SNES,int,double,void *);
54ce3d82beSBarry Smith extern int SNESDefaultConverged(SNES,double,double,double,void*);
55ce3d82beSBarry Smith 
560de89847SLois Curfman McInnes extern int SNESSetSolutionTolerance(SNES,double);
570de89847SLois Curfman McInnes extern int SNESSetAbsoluteTolerance(SNES,double);
580de89847SLois Curfman McInnes extern int SNESSetRelativeTolerance(SNES,double);
590de89847SLois Curfman McInnes extern int SNESSetTruncationTolerance(SNES,double);
600de89847SLois Curfman McInnes extern int SNESSetMaxIterations(SNES,int);
6106be10caSBarry Smith extern int SNESSetMaxFunctionEvaluations(SNES,int);
627e984346SBarry Smith extern int SNESGetIterationNumber(SNES,int*);
634f6d0874SLois Curfman McInnes extern int SNESGetFunctionNorm(SNES,Scalar*);
64a96f0e77SLois Curfman McInnes extern int SNESGetNumberUnsuccessfulSteps(SNES,int*);
65eafb4bcbSBarry Smith 
66eafb4bcbSBarry Smith #if defined(__DRAW_PACKAGE)
67eafb4bcbSBarry Smith #define SNESLGMonitorCreate  KSPLGMonitorCreate
68eafb4bcbSBarry Smith #define SNESLGMonitorDestroy KSPLGMonitorDestroy
69eafb4bcbSBarry Smith #define SNESLGMonitor        ((int (*)(SNES,int,double,void*))KSPLGMonitor)
70eafb4bcbSBarry Smith #endif
71eafb4bcbSBarry Smith 
72748e9f0dSBarry Smith extern int SNESComputeInitialGuess(SNES,Vec);
73df60cc22SBarry Smith 
74722fc279SLois Curfman McInnes extern int SNESDefaultComputeJacobian(SNES,Vec,Mat*,Mat*,MatStructure*,void*);
75722fc279SLois Curfman McInnes extern int SNESDefaultMatrixFreeComputeJacobian(SNES,Vec,Mat*,Mat*,
76722fc279SLois Curfman McInnes                                                 MatStructure*,void*);
777e984346SBarry Smith extern int SNESDefaultMatrixFreeMatCreate(SNES,Vec x,Mat*);
78748e9f0dSBarry Smith 
797f813858SBarry Smith extern int SNESComputeFunction(SNES,Vec,Vec);
80bbb6d6a8SBarry Smith extern int SNESComputeJacobian(SNES,Vec,Mat*,Mat*,MatStructure*);
81ddbbdb52SLois Curfman McInnes extern int SNESDestroy(SNES);
82ddbbdb52SLois Curfman McInnes 
83ddbbdb52SLois Curfman McInnes 
84ddbbdb52SLois Curfman McInnes /* Unconstrained minimization routines ... Some of these may change! */
85ddbbdb52SLois Curfman McInnes 
86*25c7317fSLois Curfman McInnes /* temporarily define this */
87*25c7317fSLois Curfman McInnes #define KSPQCG 2000
88*25c7317fSLois Curfman McInnes 
89ddbbdb52SLois Curfman McInnes extern int SNESSetHessian(SNES,Mat,Mat,int(*)(SNES,Vec,Mat*,Mat*,MatStructure*,void*),void *);
90ddbbdb52SLois Curfman McInnes extern int SNESComputeHessian(SNES,Vec,Mat*,Mat*,MatStructure*,void*);
91ddbbdb52SLois Curfman McInnes extern int SNESSetGradient(SNES,Vec,int(*)(SNES,Vec,Vec,void*),void*);
92ddbbdb52SLois Curfman McInnes extern int SNESGetGradient(SNES,Vec*);
93*25c7317fSLois Curfman McInnes extern int SNESGetGradientNorm(SNES,Scalar*);
94ddbbdb52SLois Curfman McInnes extern int SNESComputeGradient(SNES,Vec,Vec);
95*25c7317fSLois Curfman McInnes extern int SNESSetMinimizationFunction(SNES,int(*)(SNES,Vec,double*,void*),void*);
96*25c7317fSLois Curfman McInnes extern int SNESComputeMinimizationFunction(SNES,Vec,double*);
97*25c7317fSLois Curfman McInnes extern int SNESGetMinimizationFunction(SNES,double*);
98*25c7317fSLois Curfman McInnes extern int SNESSetMinFunctionTolerance(SNES,double);
99ddbbdb52SLois Curfman McInnes 
100ce3d82beSBarry Smith #endif
101b1f5cb9dSBarry Smith 
102