xref: /petsc/include/petscsnes.h (revision 5334005bcaa1d066a84180769b32245968508082)
1 /* $Id: snes.h,v 1.38 1996/01/01 01:05:46 bsmith Exp bsmith $ */
2 /*
3     User interface for the nonlinear solvers package.
4 */
5 #if !defined(__SNES_PACKAGE)
6 #define __SNES_PACKAGE
7 #include "sles.h"
8 
9 typedef struct _SNES* SNES;
10 #define SNES_COOKIE PETSC_COOKIE+13
11 
12 typedef enum { SNES_UNKNOWN_METHOD=-1,
13                SNES_EQ_NLS,
14                SNES_EQ_NTR,
15                SNES_EQ_NTR_DOG_LEG,
16                SNES_EQ_NTR2_LIN,
17                SNES_EQ_NTEST,
18                SNES_UM_NLS,
19                SNES_UM_NTR
20 } SNESType;
21 
22 typedef enum { SNES_NONLINEAR_EQUATIONS, SNES_UNCONSTRAINED_MINIMIZATION}
23               SNESProblemType;
24 extern int SNESCreate(MPI_Comm,SNESProblemType,SNES*);
25 extern int SNESDestroy(SNES);
26 extern int SNESSetType(SNES,SNESType);
27 extern int SNESSetMonitor(SNES,int(*)(SNES,int,double,void*),void *);
28 extern int SNESSetSolution(SNES,Vec,int(*)(SNES,Vec,void*),void *);
29 extern int SNESSetFunction(SNES,Vec,int(*)(SNES,Vec,Vec,void*),void *);
30 extern int SNESSetJacobian(SNES,Mat,Mat,int(*)(SNES,Vec,Mat*,Mat*,MatStructure*,void*),void *);
31 extern int SNESGetJacobian(SNES,Mat*,Mat*,void **);
32 extern int SNESSetUp(SNES);
33 extern int SNESSolve(SNES,int*);
34 extern int SNESRegister(int,char*,int(*)(SNES));
35 extern int SNESRegisterDestroy();
36 extern int SNESRegisterAll();
37 extern int SNESGetSLES(SNES,SLES*);
38 
39 extern int SNESNoLineSearch(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*);
40 extern int SNESCubicLineSearch(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*);
41 extern int SNESQuadraticLineSearch(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*);
42 extern int SNESSetLineSearchRoutine(SNES,int(*)(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*));
43 
44 extern int SNESGetSolution(SNES,Vec*);
45 extern int SNESGetSolutionUpdate(SNES,Vec*);
46 extern int SNESGetFunction(SNES,Vec*);
47 
48 extern int SNESPrintHelp(SNES);
49 extern int SNESView(SNES,Viewer);
50 extern int SNESSetFromOptions(SNES);
51 extern int SNESGetType(SNES,SNESType*,char**);
52 extern int SNESDefaultMonitor(SNES,int,double,void *);
53 extern int SNESDefaultSMonitor(SNES,int,double,void *);
54 extern int SNESDefaultConverged(SNES,double,double,double,void*);
55 extern int SNESTrustRegionDefaultConverged(SNES,double,double,double,void*);
56 extern int SNESSetSolutionTolerance(SNES,double);
57 extern int SNESSetAbsoluteTolerance(SNES,double);
58 extern int SNESSetRelativeTolerance(SNES,double);
59 extern int SNESSetTruncationTolerance(SNES,double);
60 extern int SNESSetTrustRegionTolerance(SNES,double);
61 extern int SNESSetMaxIterations(SNES,int);
62 extern int SNESSetMaxFunctionEvaluations(SNES,int);
63 extern int SNESGetIterationNumber(SNES,int*);
64 extern int SNESGetFunctionNorm(SNES,Scalar*);
65 extern int SNESGetNumberUnsuccessfulSteps(SNES,int*);
66 extern int SNES_KSP_SetParametersEW(SNES,int,double,double,double,double,double,double);
67 extern int SNES_KSP_SetConvergenceTestEW(SNES);
68 
69 #if defined(__DRAW_PACKAGE)
70 #define SNESLGMonitorCreate  KSPLGMonitorCreate
71 #define SNESLGMonitorDestroy KSPLGMonitorDestroy
72 #define SNESLGMonitor        ((int (*)(SNES,int,double,void*))KSPLGMonitor)
73 #endif
74 
75 extern int SNESComputeInitialGuess(SNES,Vec);
76 
77 extern int SNESDefaultComputeJacobian(SNES,Vec,Mat*,Mat*,MatStructure*,void*);
78 extern int SNESDefaultMatrixFreeMatCreate(SNES,Vec x,Mat*);
79 
80 extern int SNESComputeFunction(SNES,Vec,Vec);
81 extern int SNESDestroy(SNES);
82 
83 extern int SNESSetApplicationContext(SNES,void *);
84 extern int SNESGetApplicationContext(SNES,void **);
85 extern int SNESSetConvergenceTest(SNES,int (*)(SNES,double,double,double,void*),void*);
86 
87 /* Unconstrained minimization routines */
88 extern int SNESSetHessian(SNES,Mat,Mat,int(*)(SNES,Vec,Mat*,Mat*,MatStructure*,void*),void *);
89 extern int SNESSetGradient(SNES,Vec,int(*)(SNES,Vec,Vec,void*),void*);
90 extern int SNESGetGradient(SNES,Vec*);
91 extern int SNESGetGradientNorm(SNES,Scalar*);
92 extern int SNESComputeGradient(SNES,Vec,Vec);
93 extern int SNESSetMinimizationFunction(SNES,int(*)(SNES,Vec,double*,void*),void*);
94 extern int SNESComputeMinimizationFunction(SNES,Vec,double*);
95 extern int SNESGetMinimizationFunction(SNES,double*);
96 extern int SNESSetMinFunctionTolerance(SNES,double);
97 extern int SNESGetLineSearchDampingParameter(SNES,double*);
98 extern int SNESConverged_UMLS(SNES,double,double,double,void*);
99 extern int SNESConverged_UMTR(SNES,double,double,double,void*);
100 
101 extern int SNESDefaultMatrixFreeMatAddNullSpace(Mat,int,int,Vec *);
102 
103 /* Should these 2 routines be private? */
104 extern int SNESComputeHessian(SNES,Vec,Mat*,Mat*,MatStructure*);
105 extern int SNESComputeJacobian(SNES,Vec,Mat*,Mat*,MatStructure*);
106 
107 #endif
108 
109