xref: /petsc/include/petscsnes.h (revision e6e7e0e6b6c2f1e40d75914d42b863e4bb2ea84f)
1 /* $Id: snes.h,v 1.48 1996/03/23 19:23:27 curfman Exp curfman $ */
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 SNESSetFunction(SNES,Vec,int(*)(SNES,Vec,Vec,void*),void *);
29 extern int SNESSetJacobian(SNES,Mat,Mat,int(*)(SNES,Vec,Mat*,Mat*,MatStructure*,void*),void *);
30 extern int SNESGetJacobian(SNES,Mat*,Mat*,void **);
31 extern int SNESSetUp(SNES,Vec);
32 extern int SNESSolve(SNES,Vec,int*);
33 extern int SNESRegister(int,char*,int(*)(SNES));
34 extern int SNESRegisterDestroy();
35 extern int SNESRegisterAll();
36 extern int SNESGetSLES(SNES,SLES*);
37 
38 extern int SNESNoLineSearch(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*);
39 extern int SNESCubicLineSearch(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*);
40 extern int SNESQuadraticLineSearch(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*);
41 extern int SNESSetLineSearch(SNES,int(*)(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*));
42 
43 extern int SNESGetSolution(SNES,Vec*);
44 extern int SNESGetSolutionUpdate(SNES,Vec*);
45 extern int SNESGetFunction(SNES,Vec*);
46 
47 extern int SNESPrintHelp(SNES);
48 extern int SNESView(SNES,Viewer);
49 
50 extern int SNESSetOptionsPrefix(SNES,char*);
51 extern int SNESAppendOptionsPrefix(SNES,char*);
52 extern int SNESGetOptionsPrefix(SNES,char**);
53 
54 extern int SNESSetFromOptions(SNES);
55 extern int SNESGetType(SNES,SNESType*,char**);
56 extern int SNESDefaultMonitor(SNES,int,double,void *);
57 extern int SNESDefaultSMonitor(SNES,int,double,void *);
58 extern int SNESDefaultConverged(SNES,double,double,double,void*);
59 extern int SNESConverged_EQTR(SNES,double,double,double,void*);
60 extern int SNESSetTolerances(SNES,double,double,double,int,int);
61 extern int SNESSetTrustRegionTolerance(SNES,double);
62 extern int SNESGetIterationNumber(SNES,int*);
63 extern int SNESGetFunctionNorm(SNES,Scalar*);
64 extern int SNESGetNumberUnsuccessfulSteps(SNES,int*);
65 extern int SNES_KSP_SetParametersEW(SNES,int,double,double,double,double,double,double);
66 extern int SNES_KSP_SetConvergenceTestEW(SNES);
67 
68 #if defined(__DRAW_PACKAGE)
69 #define SNESLGMonitorCreate  KSPLGMonitorCreate
70 #define SNESLGMonitorDestroy KSPLGMonitorDestroy
71 #define SNESLGMonitor        ((int (*)(SNES,int,double,void*))KSPLGMonitor)
72 #endif
73 
74 extern int SNESDefaultComputeJacobian(SNES,Vec,Mat*,Mat*,MatStructure*,void*);
75 extern int SNESDefaultComputeHessian(SNES,Vec,Mat*,Mat*,MatStructure*,void*);
76 extern int SNESDefaultMatrixFreeMatCreate(SNES,Vec x,Mat*);
77 
78 extern int SNESComputeFunction(SNES,Vec,Vec);
79 extern int SNESDestroy(SNES);
80 
81 extern int SNESSetApplicationContext(SNES,void *);
82 extern int SNESGetApplicationContext(SNES,void **);
83 extern int SNESSetConvergenceTest(SNES,int (*)(SNES,double,double,double,void*),void*);
84 
85 /* Unconstrained minimization routines */
86 extern int SNESSetHessian(SNES,Mat,Mat,int(*)(SNES,Vec,Mat*,Mat*,MatStructure*,void*),void *);
87 extern int SNESGetHessian(SNES,Mat*,Mat*,void **);
88 extern int SNESSetGradient(SNES,Vec,int(*)(SNES,Vec,Vec,void*),void*);
89 extern int SNESGetGradient(SNES,Vec*);
90 extern int SNESGetGradientNorm(SNES,Scalar*);
91 extern int SNESComputeGradient(SNES,Vec,Vec);
92 extern int SNESSetMinimizationFunction(SNES,int(*)(SNES,Vec,double*,void*),void*);
93 extern int SNESComputeMinimizationFunction(SNES,Vec,double*);
94 extern int SNESGetMinimizationFunction(SNES,double*);
95 extern int SNESSetMinimizationFunctionTolerance(SNES,double);
96 extern int SNESGetLineSearchDampingParameter(SNES,Scalar*);
97 extern int SNESConverged_UMLS(SNES,double,double,double,void*);
98 extern int SNESConverged_UMTR(SNES,double,double,double,void*);
99 
100 extern int SNESDefaultMatrixFreeMatAddNullSpace(Mat,int,int,Vec *);
101 
102 /* Should these 2 routines be private? */
103 extern int SNESComputeHessian(SNES,Vec,Mat*,Mat*,MatStructure*);
104 extern int SNESComputeJacobian(SNES,Vec,Mat*,Mat*,MatStructure*);
105 
106 #endif
107 
108