xref: /petsc/include/petscsnes.h (revision b1f5cb9dd03f257e0da3d5f1251fa84d5ed962bc)
1*b1f5cb9dSBarry Smith /* $Id: nlsles.h,v 1.1 1995/03/20 00:11:33 bsmith Exp $ */
2*b1f5cb9dSBarry Smith 
3*b1f5cb9dSBarry Smith #if !defined(__NL_SLES)
4*b1f5cb9dSBarry Smith #define __NL_SLES
5*b1f5cb9dSBarry Smith 
6*b1f5cb9dSBarry Smith /* Include file for use of SLES solvers within SNES routines */
7*b1f5cb9dSBarry Smith 
8*b1f5cb9dSBarry Smith #include "nonlin/nlspmat.h"
9*b1f5cb9dSBarry Smith 
10*b1f5cb9dSBarry Smith /* ---- Routines to set information within the NLSles context ---- */
11*b1f5cb9dSBarry Smith extern void     NLSlesSetMethod		ANSI_ARGS((NLCtx*, SVMETHOD ));
12*b1f5cb9dSBarry Smith extern void     NLSlesSetKSPMethod	ANSI_ARGS((NLCtx*, ITMETHOD ));
13*b1f5cb9dSBarry Smith extern void     NLSlesSetDefaults	ANSI_ARGS((NLCtx*, SVMETHOD,
14*b1f5cb9dSBarry Smith 					ITMETHOD ));
15*b1f5cb9dSBarry Smith extern void     NLSlesSetDampingFlag	ANSI_ARGS((NLCtx*, int));
16*b1f5cb9dSBarry Smith extern void     NLSlesSetSaveSolverCtx	ANSI_ARGS((NLCtx *));
17*b1f5cb9dSBarry Smith 
18*b1f5cb9dSBarry Smith /* ---- Routines to extract information from the NLSles context ---- */
19*b1f5cb9dSBarry Smith extern SVMETHOD NLSlesGetMethod		ANSI_ARGS((NLCtx *));
20*b1f5cb9dSBarry Smith extern ITMETHOD NLSlesGetKSPMethod	ANSI_ARGS((NLCtx *));
21*b1f5cb9dSBarry Smith extern ITCntx   *NLSlesGetKSPCtx        ANSI_ARGS((NLCtx *));
22*b1f5cb9dSBarry Smith extern int      NLSlesGetDampingFlag	ANSI_ARGS((NLCtx *));
23*b1f5cb9dSBarry Smith extern int      NLSlesSaveSolverCtx	ANSI_ARGS((NLCtx *));
24*b1f5cb9dSBarry Smith 
25*b1f5cb9dSBarry Smith /* --- Analogues of SLES routines --- */
26*b1f5cb9dSBarry Smith extern SVctx    *NLSlesSVCreate 	ANSI_ARGS((NLCtx*, SpMat*, SVMETHOD ));
27*b1f5cb9dSBarry Smith extern void     NLSlesSVSetUp 		ANSI_ARGS((NLCtx *));
28*b1f5cb9dSBarry Smith extern void     NLSlesSVSetOperators 	ANSI_ARGS((NLCtx*, SpMat*, SpMat*,
29*b1f5cb9dSBarry Smith 					int, int ));
30*b1f5cb9dSBarry Smith extern int      NLSlesSVSolve 		ANSI_ARGS((NLCtx*, void*, void *));
31*b1f5cb9dSBarry Smith extern void     NLSlesSVDestroy 	ANSI_ARGS((NLCtx *));
32*b1f5cb9dSBarry Smith extern void     NLSlesSVSetMonitor	ANSI_ARGS((NLCtx*,
33*b1f5cb9dSBarry Smith 					void (*)(ITCntx*, int, double), void*));
34*b1f5cb9dSBarry Smith extern void     NLSlesSVSetConvergenceTest ANSI_ARGS((NLCtx*,
35*b1f5cb9dSBarry Smith 					int (*)(ITCntx*, int, double), void*));
36*b1f5cb9dSBarry Smith 
37*b1f5cb9dSBarry Smith /* --- Miscellaneous routines --- */
38*b1f5cb9dSBarry Smith extern void     NLSlesSetUp 		ANSI_ARGS((NLCtx*, void *));
39*b1f5cb9dSBarry Smith extern void     NLSlesSetGeneralStep	ANSI_ARGS((NLCtx*,
40*b1f5cb9dSBarry Smith 					void (*)(NLCtx *, void *) ));
41*b1f5cb9dSBarry Smith extern void     NLSlesSetRoutines	ANSI_ARGS((NLCtx*,
42*b1f5cb9dSBarry Smith 					void (*)(NLCtx *, void *) ));
43*b1f5cb9dSBarry Smith extern void     NLSlesApplyForwardSolve ANSI_ARGS((NLCtx*, void*, void *));
44*b1f5cb9dSBarry Smith extern void     NLSlesApplyBackwardSolve ANSI_ARGS((NLCtx*, void*, void *));
45*b1f5cb9dSBarry Smith        void     NLSlesCheck		ANSI_ARGS((NLCtx*, char*));
46*b1f5cb9dSBarry Smith extern int      NLSlesSolveScale	ANSI_ARGS((NLCtx*, void*, void*,
47*b1f5cb9dSBarry Smith 					void*, double*, double*, double*,
48*b1f5cb9dSBarry Smith 					double*, double*, void *));
49*b1f5cb9dSBarry Smith 
50*b1f5cb9dSBarry Smith /*
51*b1f5cb9dSBarry Smith    NLSlesCheck - Checks that a SLES linear solver is set within the
52*b1f5cb9dSBarry Smith    nonlinear solver context.  The usage is:
53*b1f5cb9dSBarry Smith              NLSlesCheck( nlP, name ) {code if context exists;}
54*b1f5cb9dSBarry Smith  */
55*b1f5cb9dSBarry Smith 
56*b1f5cb9dSBarry Smith #define NLSlesCheck( nlP, name ) \
57*b1f5cb9dSBarry Smith  if (!(nlP)->sc.svctx || !(nlP)->sc.is_sles) {char buf[200];\
58*b1f5cb9dSBarry Smith    sprintf(buf,"Must set SLES linear solver context before calling %s\n",name);\
59*b1f5cb9dSBarry Smith    sprintf(buf,"Use NLSlesSVCreate or NLSetLinearSolverCtx.");\
60*b1f5cb9dSBarry Smith    SETERRC(1,buf);}\
61*b1f5cb9dSBarry Smith  else
62*b1f5cb9dSBarry Smith 
63*b1f5cb9dSBarry Smith #endif
64