xref: /petsc/include/petscsnes.h (revision 77c4ece699e97450631aa6fc5b0ef04ff52df029)
1*77c4ece6SBarry Smith /* $Id: snes.h,v 1.46 1996/03/10 21:04:06 curfman Exp bsmith $ */
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
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 *);
285334005bSBarry Smith extern int SNESSetFunction(SNES,Vec,int(*)(SNES,Vec,Vec,void*),void *);
29722fc279SLois Curfman McInnes extern int SNESSetJacobian(SNES,Mat,Mat,int(*)(SNES,Vec,Mat*,Mat*,MatStructure*,void*),void *);
304a25c8b5SBarry Smith extern int SNESGetJacobian(SNES,Mat*,Mat*,void **);
318ddd3da0SLois Curfman McInnes extern int SNESSetUp(SNES,Vec);
328ddd3da0SLois Curfman McInnes extern int SNESSolve(SNES,Vec,int*);
33ce3d82beSBarry Smith extern int SNESRegister(int,char*,int(*)(SNES));
34c01c455dSBarry Smith extern int SNESRegisterDestroy();
35ce3d82beSBarry Smith extern int SNESRegisterAll();
36ce3d82beSBarry Smith extern int SNESGetSLES(SNES,SLES*);
374b0e389bSBarry Smith 
38761aaf1bSLois Curfman McInnes extern int SNESNoLineSearch(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*);
39761aaf1bSLois Curfman McInnes extern int SNESCubicLineSearch(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*);
40761aaf1bSLois Curfman McInnes extern int SNESQuadraticLineSearch(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*);
41*77c4ece6SBarry Smith extern int SNESSetLineSearch(SNES,int(*)(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*));
42ce3d82beSBarry Smith 
43ce3d82beSBarry Smith extern int SNESGetSolution(SNES,Vec*);
44e81d6643SLois Curfman McInnes extern int SNESGetSolutionUpdate(SNES,Vec*);
45eafb4bcbSBarry Smith extern int SNESGetFunction(SNES,Vec*);
46ce3d82beSBarry Smith 
47ce3d82beSBarry Smith extern int SNESPrintHelp(SNES);
48e9e17121SLois Curfman McInnes extern int SNESView(SNES,Viewer);
497bc3d0afSSatish Balay 
506daaf66cSBarry Smith extern int SNESSetOptionsPrefix(SNES,char*);
517bc3d0afSSatish Balay extern int SNESAppendOptionsPrefix(SNES,char*);
527bc3d0afSSatish Balay extern int SNESGetOptionsPrefix(SNES,char**);
537bc3d0afSSatish Balay 
54ce3d82beSBarry Smith extern int SNESSetFromOptions(SNES);
554b0e389bSBarry Smith extern int SNESGetType(SNES,SNESType*,char**);
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*);
59c01c455dSBarry 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);
6352392280SLois Curfman McInnes extern int SNESSetTrustRegionTolerance(SNES,double);
640de89847SLois Curfman McInnes extern int SNESSetMaxIterations(SNES,int);
6506be10caSBarry Smith extern int SNESSetMaxFunctionEvaluations(SNES,int);
667e984346SBarry Smith extern int SNESGetIterationNumber(SNES,int*);
674f6d0874SLois Curfman McInnes extern int SNESGetFunctionNorm(SNES,Scalar*);
68a96f0e77SLois Curfman McInnes extern int SNESGetNumberUnsuccessfulSteps(SNES,int*);
6955b5a45fSLois Curfman McInnes extern int SNES_KSP_SetParametersEW(SNES,int,double,double,double,double,double,double);
7055b5a45fSLois Curfman McInnes extern int SNES_KSP_SetConvergenceTestEW(SNES);
71eafb4bcbSBarry Smith 
72eafb4bcbSBarry Smith #if defined(__DRAW_PACKAGE)
73eafb4bcbSBarry Smith #define SNESLGMonitorCreate  KSPLGMonitorCreate
74eafb4bcbSBarry Smith #define SNESLGMonitorDestroy KSPLGMonitorDestroy
75eafb4bcbSBarry Smith #define SNESLGMonitor        ((int (*)(SNES,int,double,void*))KSPLGMonitor)
76eafb4bcbSBarry Smith #endif
77eafb4bcbSBarry Smith 
78722fc279SLois Curfman McInnes extern int SNESDefaultComputeJacobian(SNES,Vec,Mat*,Mat*,MatStructure*,void*);
79b6107737SLois Curfman McInnes extern int SNESDefaultComputeHessian(SNES,Vec,Mat*,Mat*,MatStructure*,void*);
807e984346SBarry Smith extern int SNESDefaultMatrixFreeMatCreate(SNES,Vec x,Mat*);
81748e9f0dSBarry Smith 
827f813858SBarry Smith extern int SNESComputeFunction(SNES,Vec,Vec);
83ddbbdb52SLois Curfman McInnes extern int SNESDestroy(SNES);
84ddbbdb52SLois Curfman McInnes 
85c01c455dSBarry Smith extern int SNESSetApplicationContext(SNES,void *);
86c01c455dSBarry Smith extern int SNESGetApplicationContext(SNES,void **);
87f26ada1bSBarry Smith extern int SNESSetConvergenceTest(SNES,int (*)(SNES,double,double,double,void*),void*);
88ddbbdb52SLois Curfman McInnes 
8952392280SLois Curfman McInnes /* Unconstrained minimization routines */
90ddbbdb52SLois Curfman McInnes extern int SNESSetHessian(SNES,Mat,Mat,int(*)(SNES,Vec,Mat*,Mat*,MatStructure*,void*),void *);
9182590567SLois Curfman McInnes extern int SNESGetHessian(SNES,Mat*,Mat*,void **);
92ddbbdb52SLois Curfman McInnes extern int SNESSetGradient(SNES,Vec,int(*)(SNES,Vec,Vec,void*),void*);
93ddbbdb52SLois Curfman McInnes extern int SNESGetGradient(SNES,Vec*);
9425c7317fSLois Curfman McInnes extern int SNESGetGradientNorm(SNES,Scalar*);
95ddbbdb52SLois Curfman McInnes extern int SNESComputeGradient(SNES,Vec,Vec);
9625c7317fSLois Curfman McInnes extern int SNESSetMinimizationFunction(SNES,int(*)(SNES,Vec,double*,void*),void*);
9725c7317fSLois Curfman McInnes extern int SNESComputeMinimizationFunction(SNES,Vec,double*);
9825c7317fSLois Curfman McInnes extern int SNESGetMinimizationFunction(SNES,double*);
99*77c4ece6SBarry Smith extern int SNESSetMinimizationFunctionTolerance(SNES,double);
100ed967170SLois Curfman McInnes extern int SNESGetLineSearchDampingParameter(SNES,Scalar*);
101d5d8419bSLois Curfman McInnes extern int SNESConverged_UMLS(SNES,double,double,double,void*);
102d5d8419bSLois Curfman McInnes extern int SNESConverged_UMTR(SNES,double,double,double,void*);
10352392280SLois Curfman McInnes 
1044b0e389bSBarry Smith extern int SNESDefaultMatrixFreeMatAddNullSpace(Mat,int,int,Vec *);
1054b0e389bSBarry Smith 
10652392280SLois Curfman McInnes /* Should these 2 routines be private? */
10752392280SLois Curfman McInnes extern int SNESComputeHessian(SNES,Vec,Mat*,Mat*,MatStructure*);
10852392280SLois Curfman McInnes extern int SNESComputeJacobian(SNES,Vec,Mat*,Mat*,MatStructure*);
109ddbbdb52SLois Curfman McInnes 
110ce3d82beSBarry Smith #endif
111b1f5cb9dSBarry Smith 
112