1*ddbbdb52SLois Curfman McInnes /* $Id: snes.h,v 1.24 1995/07/10 19:04:03 curfman Exp curfman $ */ 2b1f5cb9dSBarry Smith 3f03417d3SBarry Smith #if !defined(__SNES_PACKAGE) 4f03417d3SBarry Smith #define __SNES_PACKAGE 5ce3d82beSBarry Smith #include "sles.h" 6b1f5cb9dSBarry Smith 7353a3ba4SBarry Smith typedef struct _SNES* SNES; 8ce3d82beSBarry Smith #define SNES_COOKIE PETSC_COOKIE+13 9b1f5cb9dSBarry Smith 10ce3d82beSBarry Smith typedef enum { SNES_NLS, 11ce3d82beSBarry Smith SNES_NTR, 12ce3d82beSBarry Smith SNES_NTR_DOG_LEG, 13353a3ba4SBarry Smith SNES_NTR2_LIN, 14*ddbbdb52SLois Curfman McInnes SNES_UM_NLS, 15*ddbbdb52SLois Curfman McInnes SNES_UM_NTR, 16748e9f0dSBarry Smith SNES_NTEST } 1794a5d57cSLois Curfman McInnes SNESMethod; 18b1f5cb9dSBarry Smith 1906259719SBarry Smith typedef enum { SNES_T, SUMS_T } SNESType; 20f03417d3SBarry Smith 21ce3d82beSBarry Smith extern int SNESCreate(MPI_Comm,SNES*); 2294a5d57cSLois Curfman McInnes extern int SNESSetMethod(SNES,SNESMethod); 23eafb4bcbSBarry Smith extern int SNESSetMonitor(SNES, int (*)(SNES,int,double,void*),void *); 244d08eca6SBarry Smith extern int SNESSetSolution(SNES,Vec,int (*)(SNES,Vec,void*),void *); 254d08eca6SBarry Smith extern int SNESSetFunction(SNES, Vec, int (*)(SNES,Vec,Vec,void*),void *,int); 26722fc279SLois Curfman McInnes extern int SNESSetJacobian(SNES,Mat,Mat,int(*)(SNES,Vec,Mat*,Mat*,MatStructure*,void*),void *); 27ce3d82beSBarry Smith extern int SNESDestroy(SNES); 28353a3ba4SBarry Smith extern int SNESSetUp(SNES); 29ce3d82beSBarry Smith extern int SNESSolve(SNES,int*); 30ce3d82beSBarry Smith extern int SNESRegister(int, char*, int (*)(SNES)); 31ce3d82beSBarry Smith extern int SNESRegisterAll(); 32ce3d82beSBarry Smith extern int SNESGetSLES(SNES,SLES*); 33761aaf1bSLois Curfman McInnes extern int SNESNoLineSearch(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*); 34761aaf1bSLois Curfman McInnes extern int SNESCubicLineSearch(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*); 35761aaf1bSLois Curfman McInnes extern int SNESQuadraticLineSearch(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*); 36761aaf1bSLois Curfman McInnes extern int SNESSetLineSearchRoutine(SNES,int(*)(SNES,Vec,Vec,Vec,Vec,Vec,double,double*,double*,int*)); 37ce3d82beSBarry Smith 38ce3d82beSBarry Smith extern int SNESGetSolution(SNES,Vec*); 39e81d6643SLois Curfman McInnes extern int SNESGetSolutionUpdate(SNES,Vec*); 40eafb4bcbSBarry Smith extern int SNESGetFunction(SNES,Vec*); 41ce3d82beSBarry Smith 42ce3d82beSBarry Smith extern int SNESPrintHelp(SNES); 43e9e17121SLois Curfman McInnes extern int SNESView(SNES,Viewer); 44ce3d82beSBarry Smith extern int SNESSetFromOptions(SNES); 4594a5d57cSLois Curfman McInnes extern int SNESGetMethodName(SNESMethod,char **); 46eafb4bcbSBarry Smith extern int SNESDefaultMonitor(SNES,int,double,void *); 47c512e24aSBarry Smith extern int SNESDefaultSMonitor(SNES,int,double,void *); 48ce3d82beSBarry Smith extern int SNESDefaultConverged(SNES,double,double,double,void*); 49ce3d82beSBarry Smith 500de89847SLois Curfman McInnes extern int SNESSetSolutionTolerance(SNES,double); 510de89847SLois Curfman McInnes extern int SNESSetAbsoluteTolerance(SNES,double); 520de89847SLois Curfman McInnes extern int SNESSetRelativeTolerance(SNES,double); 530de89847SLois Curfman McInnes extern int SNESSetTruncationTolerance(SNES,double); 540de89847SLois Curfman McInnes extern int SNESSetMaxIterations(SNES,int); 5506be10caSBarry Smith extern int SNESSetMaxFunctionEvaluations(SNES,int); 567e984346SBarry Smith extern int SNESGetIterationNumber(SNES,int*); 574f6d0874SLois Curfman McInnes extern int SNESGetFunctionNorm(SNES,Scalar*); 58a96f0e77SLois Curfman McInnes extern int SNESGetNumberUnsuccessfulSteps(SNES,int*); 59eafb4bcbSBarry Smith 60eafb4bcbSBarry Smith #if defined(__DRAW_PACKAGE) 61eafb4bcbSBarry Smith #define SNESLGMonitorCreate KSPLGMonitorCreate 62eafb4bcbSBarry Smith #define SNESLGMonitorDestroy KSPLGMonitorDestroy 63eafb4bcbSBarry Smith #define SNESLGMonitor ((int (*)(SNES,int,double,void*))KSPLGMonitor) 64eafb4bcbSBarry Smith #endif 65eafb4bcbSBarry Smith 66748e9f0dSBarry Smith extern int SNESComputeInitialGuess(SNES,Vec); 67df60cc22SBarry Smith 68722fc279SLois Curfman McInnes extern int SNESDefaultComputeJacobian(SNES,Vec,Mat*,Mat*,MatStructure*,void*); 69722fc279SLois Curfman McInnes extern int SNESDefaultMatrixFreeComputeJacobian(SNES,Vec,Mat*,Mat*, 70722fc279SLois Curfman McInnes MatStructure*,void*); 717e984346SBarry Smith extern int SNESDefaultMatrixFreeMatCreate(SNES,Vec x,Mat*); 72748e9f0dSBarry Smith 737f813858SBarry Smith extern int SNESComputeFunction(SNES,Vec,Vec); 747f813858SBarry Smith extern int SNESComputeJacobian(SNES,Vec,Mat*,Mat*,MatStructure*,void*); 75*ddbbdb52SLois Curfman McInnes extern int SNESDestroy(SNES); 76*ddbbdb52SLois Curfman McInnes 77*ddbbdb52SLois Curfman McInnes 78*ddbbdb52SLois Curfman McInnes /* Unconstrained minimization routines ... Some of these may change! */ 79*ddbbdb52SLois Curfman McInnes 80*ddbbdb52SLois Curfman McInnes extern int SNESSetHessian(SNES,Mat,Mat,int(*)(SNES,Vec,Mat*,Mat*,MatStructure*,void*),void *); 81*ddbbdb52SLois Curfman McInnes extern int SNESComputeHessian(SNES,Vec,Mat*,Mat*,MatStructure*,void*); 82*ddbbdb52SLois Curfman McInnes extern int SNESSetGradient(SNES,Vec,int(*)(SNES,Vec,Vec,void*),void*); 83*ddbbdb52SLois Curfman McInnes extern int SNESGetGradient(SNES,Vec*); 84*ddbbdb52SLois Curfman McInnes extern int SNESComputeGradient(SNES,Vec,Vec); 85*ddbbdb52SLois Curfman McInnes extern int SNESSetUMFunction(SNES,int(*)(SNES,Vec,Scalar*,void*),void*); 86*ddbbdb52SLois Curfman McInnes extern int SNESComputeUMFunction(SNES,Vec,Scalar*); 87*ddbbdb52SLois Curfman McInnes extern int SNESGetUMFunction(SNES,Scalar*); 88*ddbbdb52SLois Curfman McInnes 89ce3d82beSBarry Smith #endif 90b1f5cb9dSBarry Smith 91