xref: /petsc/include/petscsnes.h (revision 40191667f2a2849ab1e87476dcd3c30babf8386e)
1*40191667SLois Curfman McInnes /* $Id: snes.h,v 1.49 1996/03/23 23:11:00 curfman 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,
13*40191667SLois Curfman McInnes                SNES_EQ_LS,
14*40191667SLois Curfman McInnes                SNES_EQ_TR,
15*40191667SLois Curfman McInnes                SNES_EQ_TR_DOG_LEG,
16*40191667SLois Curfman McInnes                SNES_EQ_TR2_LIN,
17*40191667SLois Curfman McInnes                SNES_EQ_TEST,
18*40191667SLois Curfman McInnes                SNES_UM_LS,
19*40191667SLois Curfman McInnes                SNES_UM_TR
204b0e389bSBarry Smith } SNESType;
21b1f5cb9dSBarry Smith 
224b0e389bSBarry Smith typedef enum { SNES_NONLINEAR_EQUATIONS, SNES_UNCONSTRAINED_MINIMIZATION}
234b0e389bSBarry Smith               SNESProblemType;
244b0e389bSBarry Smith extern int SNESCreate(MPI_Comm,SNESProblemType,SNES*);
254b0e389bSBarry Smith extern int SNESDestroy(SNES);
264b0e389bSBarry Smith extern int SNESSetType(SNES,SNESType);
27eafb4bcbSBarry Smith extern int SNESSetMonitor(SNES,int(*)(SNES,int,double,void*),void *);
288ddd3da0SLois Curfman McInnes extern int SNESSetUp(SNES,Vec);
298ddd3da0SLois Curfman McInnes extern int SNESSolve(SNES,Vec,int*);
30ce3d82beSBarry Smith extern int SNESRegister(int,char*,int(*)(SNES));
31c01c455dSBarry Smith extern int SNESRegisterDestroy();
32ce3d82beSBarry Smith extern int SNESRegisterAll();
33ce3d82beSBarry Smith extern int SNESGetSLES(SNES,SLES*);
34ce3d82beSBarry Smith extern int SNESGetSolution(SNES,Vec*);
35e81d6643SLois Curfman McInnes extern int SNESGetSolutionUpdate(SNES,Vec*);
36eafb4bcbSBarry Smith extern int SNESGetFunction(SNES,Vec*);
37ce3d82beSBarry Smith extern int SNESPrintHelp(SNES);
38e9e17121SLois Curfman McInnes extern int SNESView(SNES,Viewer);
397bc3d0afSSatish Balay 
406daaf66cSBarry Smith extern int SNESSetOptionsPrefix(SNES,char*);
417bc3d0afSSatish Balay extern int SNESAppendOptionsPrefix(SNES,char*);
427bc3d0afSSatish Balay extern int SNESGetOptionsPrefix(SNES,char**);
43ce3d82beSBarry Smith extern int SNESSetFromOptions(SNES);
44*40191667SLois Curfman McInnes 
45*40191667SLois Curfman McInnes extern int SNESDefaultMatrixFreeMatCreate(SNES,Vec x,Mat*);
464b0e389bSBarry Smith extern int SNESGetType(SNES,SNESType*,char**);
47eafb4bcbSBarry Smith extern int SNESDefaultMonitor(SNES,int,double,void *);
48c512e24aSBarry Smith extern int SNESDefaultSMonitor(SNES,int,double,void *);
49d7a720efSLois Curfman McInnes extern int SNESSetTolerances(SNES,double,double,double,int,int);
5052392280SLois Curfman McInnes extern int SNESSetTrustRegionTolerance(SNES,double);
517e984346SBarry Smith extern int SNESGetIterationNumber(SNES,int*);
524f6d0874SLois Curfman McInnes extern int SNESGetFunctionNorm(SNES,Scalar*);
53a96f0e77SLois Curfman McInnes extern int SNESGetNumberUnsuccessfulSteps(SNES,int*);
5455b5a45fSLois Curfman McInnes extern int SNES_KSP_SetParametersEW(SNES,int,double,double,double,double,double,double);
5555b5a45fSLois Curfman McInnes extern int SNES_KSP_SetConvergenceTestEW(SNES);
56eafb4bcbSBarry Smith 
57eafb4bcbSBarry Smith #if defined(__DRAW_PACKAGE)
58eafb4bcbSBarry Smith #define SNESLGMonitorCreate  KSPLGMonitorCreate
59eafb4bcbSBarry Smith #define SNESLGMonitorDestroy KSPLGMonitorDestroy
60eafb4bcbSBarry Smith #define SNESLGMonitor        ((int (*)(SNES,int,double,void*))KSPLGMonitor)
61eafb4bcbSBarry Smith #endif
62eafb4bcbSBarry Smith 
63c01c455dSBarry Smith extern int SNESSetApplicationContext(SNES,void *);
64c01c455dSBarry Smith extern int SNESGetApplicationContext(SNES,void **);
65f26ada1bSBarry Smith extern int SNESSetConvergenceTest(SNES,int (*)(SNES,double,double,double,void*),void*);
66ddbbdb52SLois Curfman McInnes 
67*40191667SLois Curfman McInnes /* Routines for solving systems of nonlinear equations */
68*40191667SLois Curfman McInnes extern int SNESSetFunction(SNES,Vec,int(*)(SNES,Vec,Vec,void*),void *);
69*40191667SLois Curfman McInnes extern int SNESComputeFunction(SNES,Vec,Vec);
70*40191667SLois Curfman McInnes extern int SNESSetJacobian(SNES,Mat,Mat,int(*)(SNES,Vec,Mat*,Mat*,MatStructure*,void*),void *);
71*40191667SLois Curfman McInnes extern int SNESGetJacobian(SNES,Mat*,Mat*,void **);
72*40191667SLois Curfman McInnes extern int SNESDefaultComputeJacobian(SNES,Vec,Mat*,Mat*,MatStructure*,void*);
73*40191667SLois Curfman McInnes extern int SNESConverged_EQ_LS(SNES,double,double,double,void*);
74*40191667SLois Curfman McInnes extern int SNESConverged_EQ_TR(SNES,double,double,double,void*);
75*40191667SLois Curfman McInnes extern int SNESNoLineSearch(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*);
76*40191667SLois Curfman McInnes extern int SNESCubicLineSearch(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*);
77*40191667SLois Curfman McInnes extern int SNESQuadraticLineSearch(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*);
78*40191667SLois Curfman McInnes extern int SNESSetLineSearch(SNES,int(*)(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*));
79*40191667SLois Curfman McInnes 
8052392280SLois Curfman McInnes /* Unconstrained minimization routines */
81ddbbdb52SLois Curfman McInnes extern int SNESSetHessian(SNES,Mat,Mat,int(*)(SNES,Vec,Mat*,Mat*,MatStructure*,void*),void *);
8282590567SLois Curfman McInnes extern int SNESGetHessian(SNES,Mat*,Mat*,void **);
83*40191667SLois Curfman McInnes extern int SNESDefaultComputeHessian(SNES,Vec,Mat*,Mat*,MatStructure*,void*);
84ddbbdb52SLois Curfman McInnes extern int SNESSetGradient(SNES,Vec,int(*)(SNES,Vec,Vec,void*),void*);
85ddbbdb52SLois Curfman McInnes extern int SNESGetGradient(SNES,Vec*);
8625c7317fSLois Curfman McInnes extern int SNESGetGradientNorm(SNES,Scalar*);
87ddbbdb52SLois Curfman McInnes extern int SNESComputeGradient(SNES,Vec,Vec);
8825c7317fSLois Curfman McInnes extern int SNESSetMinimizationFunction(SNES,int(*)(SNES,Vec,double*,void*),void*);
8925c7317fSLois Curfman McInnes extern int SNESComputeMinimizationFunction(SNES,Vec,double*);
9025c7317fSLois Curfman McInnes extern int SNESGetMinimizationFunction(SNES,double*);
9177c4ece6SBarry Smith extern int SNESSetMinimizationFunctionTolerance(SNES,double);
92ed967170SLois Curfman McInnes extern int SNESGetLineSearchDampingParameter(SNES,Scalar*);
93*40191667SLois Curfman McInnes extern int SNESConverged_UM_LS(SNES,double,double,double,void*);
94*40191667SLois Curfman McInnes extern int SNESConverged_UM_TR(SNES,double,double,double,void*);
9552392280SLois Curfman McInnes 
964b0e389bSBarry Smith extern int SNESDefaultMatrixFreeMatAddNullSpace(Mat,int,int,Vec *);
974b0e389bSBarry Smith 
9852392280SLois Curfman McInnes /* Should these 2 routines be private? */
9952392280SLois Curfman McInnes extern int SNESComputeHessian(SNES,Vec,Mat*,Mat*,MatStructure*);
10052392280SLois Curfman McInnes extern int SNESComputeJacobian(SNES,Vec,Mat*,Mat*,MatStructure*);
101ddbbdb52SLois Curfman McInnes 
102ce3d82beSBarry Smith #endif
103b1f5cb9dSBarry Smith 
104