Actual source code: linesearchimpl.h

petsc-master 2019-08-18
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);
  9: PETSC_EXTERN PetscLogEvent SNESLINESEARCH_Apply;

 11: typedef struct _LineSearchOps *LineSearchOps;

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

 27: #define MAXSNESLSMONITORS 5

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

 32:   SNES                 snes;

 34:   void                 *data;

 36:   PetscBool            setupcalled;

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

 44:   PetscInt             nwork;
 45:   Vec                  *work;

 47:   PetscReal            lambda;

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

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

 65:   PetscReal            precheck_picard_angle;

 67:   void *               precheckctx;
 68:   void *               postcheckctx;

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

 77: #endif