Actual source code: linesearchimpl.h
petsc-3.7.7 2017-09-25
Report Typos and Errors

      1: #ifndef __LINESEARCHIMPL_H

      4: #include <petscsnes.h>
      5: #include <petsc/private/petscimpl.h>

      7: PETSC_EXTERN PetscBool SNESLineSearchRegisterAllCalled;
      8: PETSC_EXTERN PetscErrorCode SNESLineSearchRegisterAll(void);

     10: typedef struct _LineSearchOps *LineSearchOps;

     12: struct _LineSearchOps {
     13:   PetscErrorCode (*view)(SNESLineSearch, PetscViewer);
     14:   SNESLineSearchApplyFunc        apply;
     15:   PetscErrorCode (*precheck)(SNESLineSearch,Vec,Vec,PetscBool*,void*);
     16:   SNESLineSearchVIProjectFunc    viproject;
     17:   SNESLineSearchVINormFunc       vinorm;
     18:   PetscErrorCode (*postcheck)(SNESLineSearch,Vec,Vec,Vec,PetscBool *,PetscBool *,void*);
     19:   PetscErrorCode (*setfromoptions)(PetscOptionItems*,SNESLineSearch);
     20:   PetscErrorCode (*reset)(SNESLineSearch);
     21:   PetscErrorCode (*destroy)(SNESLineSearch);
     22:   PetscErrorCode (*setup)(SNESLineSearch);
     23:   PetscErrorCode (*snesfunc)(SNES,Vec,Vec);
     24: };

     26: #define MAXSNESLSMONITORS 5

     28: struct _p_LineSearch {
     29:   PETSCHEADER(struct _LineSearchOps);

     31:   SNES                 snes;

     33:   void                 *data;

     35:   PetscBool            setupcalled;

     37:   Vec                  vec_sol;
     38:   Vec                  vec_sol_new;
     39:   Vec                  vec_func;
     40:   Vec                  vec_func_new;
     41:   Vec                  vec_update;

     43:   PetscInt             nwork;
     44:   Vec                  *work;

     46:   PetscReal            lambda;

     48:   PetscBool            norms;
     49:   PetscReal            fnorm;
     50:   PetscReal            ynorm;
     51:   PetscReal            xnorm;
     52:   SNESLineSearchReason result;
     53:   PetscBool            keeplambda;

     55:   PetscReal            damping;
     56:   PetscReal            maxstep;
     57:   PetscReal            steptol;
     58:   PetscInt             max_its;
     59:   PetscReal            rtol;
     60:   PetscReal            atol;
     61:   PetscReal            ltol;
     62:   PetscInt             order;

     64:   PetscReal            precheck_picard_angle;

     66:   void *               precheckctx;
     67:   void *               postcheckctx;

     69:   PetscViewer         monitor;
     70:   PetscErrorCode      (*monitorftns[MAXSNESLSMONITORS])(SNESLineSearch,void*);      /* monitor routine */
     71:   PetscErrorCode      (*monitordestroy[MAXSNESLSMONITORS])(void**);                 /* monitor context destroy routine */
     72:   void                *monitorcontext[MAXSNESLSMONITORS];                           /* monitor context */
     73:   PetscInt            numbermonitors;                                             /* number of monitors */
     74: };

     76: #endif