xref: /petsc/include/petscsnes.h (revision 82bf6240e2c962f3f106f2e53a46e3db58a7d347)
1*82bf6240SBarry Smith /* $Id: snes.h,v 1.63 1998/01/15 21:54:49 curfman Exp bsmith $ */
2f26ada1bSBarry Smith /*
384cb2905SBarry Smith     User interface for the nonlinear solvers and unconstrained minimization package.
4f26ada1bSBarry Smith */
5f03417d3SBarry Smith #if !defined(__SNES_PACKAGE)
6f03417d3SBarry Smith #define __SNES_PACKAGE
7ce3d82beSBarry Smith #include "sles.h"
8b1f5cb9dSBarry Smith 
9f09e8eb9SSatish Balay typedef struct _p_SNES* SNES;
10ce3d82beSBarry Smith #define SNES_COOKIE PETSC_COOKIE+13
11b1f5cb9dSBarry Smith 
12*82bf6240SBarry Smith #define SNES_EQ_LS          "ls"
13*82bf6240SBarry Smith #define SNES_EQ_TR          "tr"
14*82bf6240SBarry Smith #define SNES_EQ_TR_DOG_LEG
15*82bf6240SBarry Smith #define SNES_EQ_TR2_LIN
16*82bf6240SBarry Smith #define SNES_EQ_TEST        "test"
17*82bf6240SBarry Smith #define SNES_UM_LS          "umls"
18*82bf6240SBarry Smith #define SNES_UM_TR          "umtr"
19*82bf6240SBarry Smith #define SNES_LS_LM          "lslm"
20*82bf6240SBarry Smith 
21*82bf6240SBarry Smith typedef char *SNESType;
22b1f5cb9dSBarry Smith 
232a03e22aSLois Curfman McInnes typedef enum {SNES_NONLINEAR_EQUATIONS, SNES_UNCONSTRAINED_MINIMIZATION, SNES_LEAST_SQUARES} SNESProblemType;
242a03e22aSLois Curfman McInnes 
252a03e22aSLois Curfman McInnes /* temporarily add this declaration here */
262a03e22aSLois Curfman McInnes extern int JorgeQuadraticMinimizer(SNES,Vec,Vec,double,Vec,int*);
272a03e22aSLois Curfman McInnes 
284b0e389bSBarry Smith extern int SNESCreate(MPI_Comm,SNESProblemType,SNES*);
294b0e389bSBarry Smith extern int SNESDestroy(SNES);
304b0e389bSBarry Smith extern int SNESSetType(SNES,SNESType);
31eafb4bcbSBarry Smith extern int SNESSetMonitor(SNES,int(*)(SNES,int,double,void*),void *);
3251979daaSLois Curfman McInnes extern int SNESSetConvergenceHistory(SNES,double*,int);
338ddd3da0SLois Curfman McInnes extern int SNESSetUp(SNES,Vec);
348ddd3da0SLois Curfman McInnes extern int SNESSolve(SNES,Vec,int*);
3584cb2905SBarry Smith 
36*82bf6240SBarry Smith extern DLList SNESList;
37c01c455dSBarry Smith extern int SNESRegisterDestroy();
38*82bf6240SBarry Smith extern int SNESRegisterAll(char *);
3984cb2905SBarry Smith 
40ce3d82beSBarry Smith extern int SNESGetSLES(SNES,SLES*);
41ce3d82beSBarry Smith extern int SNESGetSolution(SNES,Vec*);
42e81d6643SLois Curfman McInnes extern int SNESGetSolutionUpdate(SNES,Vec*);
43eafb4bcbSBarry Smith extern int SNESGetFunction(SNES,Vec*);
44ce3d82beSBarry Smith extern int SNESPrintHelp(SNES);
45e9e17121SLois Curfman McInnes extern int SNESView(SNES,Viewer);
467bc3d0afSSatish Balay 
476daaf66cSBarry Smith extern int SNESSetOptionsPrefix(SNES,char*);
487bc3d0afSSatish Balay extern int SNESAppendOptionsPrefix(SNES,char*);
497bc3d0afSSatish Balay extern int SNESGetOptionsPrefix(SNES,char**);
50ce3d82beSBarry Smith extern int SNESSetFromOptions(SNES);
51639f9d9dSBarry Smith extern int SNESAddOptionsChecker(int (*)(SNES));
5240191667SLois Curfman McInnes 
5340191667SLois Curfman McInnes extern int SNESDefaultMatrixFreeMatCreate(SNES,Vec x,Mat*);
54eb9086c3SLois Curfman McInnes extern int SNESSetMatrixFreeParameters(SNES,double,double);
55*82bf6240SBarry Smith extern int SNESGetType(SNES,SNESType*);
56eafb4bcbSBarry Smith extern int SNESDefaultMonitor(SNES,int,double,void *);
57c512e24aSBarry Smith extern int SNESDefaultSMonitor(SNES,int,double,void *);
58d7a720efSLois Curfman McInnes extern int SNESSetTolerances(SNES,double,double,double,int,int);
5933174efeSLois Curfman McInnes extern int SNESGetTolerances(SNES,double*,double*,double*,int*,int*);
6052392280SLois Curfman McInnes extern int SNESSetTrustRegionTolerance(SNES,double);
617e984346SBarry Smith extern int SNESGetIterationNumber(SNES,int*);
624f6d0874SLois Curfman McInnes extern int SNESGetFunctionNorm(SNES,Scalar*);
63a96f0e77SLois Curfman McInnes extern int SNESGetNumberUnsuccessfulSteps(SNES,int*);
64d2bb1046SLois Curfman McInnes extern int SNESGetNumberLinearIterations(SNES,int*);
6555b5a45fSLois Curfman McInnes extern int SNES_KSP_SetParametersEW(SNES,int,double,double,double,double,double,double);
6655b5a45fSLois Curfman McInnes extern int SNES_KSP_SetConvergenceTestEW(SNES);
67eafb4bcbSBarry Smith 
683369ce9aSBarry Smith /*
693369ce9aSBarry Smith      Reuse the default KSP monitor routines for SNES
703369ce9aSBarry Smith */
71eafb4bcbSBarry Smith #define SNESLGMonitorCreate  KSPLGMonitorCreate
72eafb4bcbSBarry Smith #define SNESLGMonitorDestroy KSPLGMonitorDestroy
73eafb4bcbSBarry Smith #define SNESLGMonitor        ((int (*)(SNES,int,double,void*))KSPLGMonitor)
74eafb4bcbSBarry Smith 
75c01c455dSBarry Smith extern int SNESSetApplicationContext(SNES,void *);
76c01c455dSBarry Smith extern int SNESGetApplicationContext(SNES,void **);
77f26ada1bSBarry Smith extern int SNESSetConvergenceTest(SNES,int (*)(SNES,double,double,double,void*),void*);
78ddbbdb52SLois Curfman McInnes 
79b67197daSBarry Smith /* --------- Solving systems of nonlinear equations --------------- */
8040191667SLois Curfman McInnes extern int SNESSetFunction(SNES,Vec,int(*)(SNES,Vec,Vec,void*),void *);
8140191667SLois Curfman McInnes extern int SNESComputeFunction(SNES,Vec,Vec);
8240191667SLois Curfman McInnes extern int SNESSetJacobian(SNES,Mat,Mat,int(*)(SNES,Vec,Mat*,Mat*,MatStructure*,void*),void *);
8340191667SLois Curfman McInnes extern int SNESGetJacobian(SNES,Mat*,Mat*,void **);
8440191667SLois Curfman McInnes extern int SNESDefaultComputeJacobian(SNES,Vec,Mat*,Mat*,MatStructure*,void*);
85639f9d9dSBarry Smith extern int SNESDefaultComputeJacobianWithColoring(SNES,Vec,Mat*,Mat*,MatStructure*,void*);
8640191667SLois Curfman McInnes extern int SNESConverged_EQ_LS(SNES,double,double,double,void*);
8740191667SLois Curfman McInnes extern int SNESConverged_EQ_TR(SNES,double,double,double,void*);
8884cb2905SBarry Smith extern int SNESSetLineSearch(SNES,int(*)(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*));
8940191667SLois Curfman McInnes extern int SNESNoLineSearch(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*);
9093c39befSBarry Smith extern int SNESNoLineSearchNoNorms(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*);
9140191667SLois Curfman McInnes extern int SNESCubicLineSearch(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*);
9240191667SLois Curfman McInnes extern int SNESQuadraticLineSearch(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*);
9340191667SLois Curfman McInnes 
9484cb2905SBarry Smith /* --------- Unconstrained minimization routines --------------------------------*/
95ddbbdb52SLois Curfman McInnes extern int SNESSetHessian(SNES,Mat,Mat,int(*)(SNES,Vec,Mat*,Mat*,MatStructure*,void*),void *);
9682590567SLois Curfman McInnes extern int SNESGetHessian(SNES,Mat*,Mat*,void **);
9740191667SLois Curfman McInnes extern int SNESDefaultComputeHessian(SNES,Vec,Mat*,Mat*,MatStructure*,void*);
98ddbbdb52SLois Curfman McInnes extern int SNESSetGradient(SNES,Vec,int(*)(SNES,Vec,Vec,void*),void*);
99ddbbdb52SLois Curfman McInnes extern int SNESGetGradient(SNES,Vec*);
10025c7317fSLois Curfman McInnes extern int SNESGetGradientNorm(SNES,Scalar*);
101ddbbdb52SLois Curfman McInnes extern int SNESComputeGradient(SNES,Vec,Vec);
10225c7317fSLois Curfman McInnes extern int SNESSetMinimizationFunction(SNES,int(*)(SNES,Vec,double*,void*),void*);
10325c7317fSLois Curfman McInnes extern int SNESComputeMinimizationFunction(SNES,Vec,double*);
10425c7317fSLois Curfman McInnes extern int SNESGetMinimizationFunction(SNES,double*);
10577c4ece6SBarry Smith extern int SNESSetMinimizationFunctionTolerance(SNES,double);
106*82bf6240SBarry Smith extern int SNESLineSearchSetDampingParameter(SNES,Scalar*);
10740191667SLois Curfman McInnes extern int SNESConverged_UM_LS(SNES,double,double,double,void*);
10840191667SLois Curfman McInnes extern int SNESConverged_UM_TR(SNES,double,double,double,void*);
10952392280SLois Curfman McInnes 
1104b0e389bSBarry Smith extern int SNESDefaultMatrixFreeMatAddNullSpace(Mat,int,int,Vec *);
1114b0e389bSBarry Smith 
11252392280SLois Curfman McInnes /* Should these 2 routines be private? */
11352392280SLois Curfman McInnes extern int SNESComputeHessian(SNES,Vec,Mat*,Mat*,MatStructure*);
11452392280SLois Curfman McInnes extern int SNESComputeJacobian(SNES,Vec,Mat*,Mat*,MatStructure*);
115ddbbdb52SLois Curfman McInnes 
116ce3d82beSBarry Smith #endif
117b1f5cb9dSBarry Smith 
118