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