Actual source code: viimpl.h

  1: #include <private/snesimpl.h>



  5: #define PetscScalarNorm(a,b) (PetscSqrtScalar((a)*(a)+(b)*(b)))
  6: /* 
  7:    Private context for semismooth newton method with line search for solving
  8:    system of mixed complementarity equations
  9:  */

 11: #ifndef __SNES_VI_H

 14: typedef struct {
 15:   PetscErrorCode           (*LineSearch)(SNES,void*,Vec,Vec,Vec,Vec,Vec,PetscReal,PetscReal,PetscReal*,PetscReal*,PetscBool *);
 16:   void                     *lsP;                              /* user-defined line-search context (optional) */
 17:   /* --------------- Parameters used by line search method ----------------- */
 18:   PetscReal                alpha;                                                                   /* used to determine sufficient reduction */
 19:   PetscReal                maxstep;                                                          /* maximum step size */
 20:   PetscReal                minlambda;                                                        /* determines smallest line search lambda used */
 21:   PetscErrorCode           (*precheckstep)(SNES,Vec,Vec,void*,PetscBool *);                  /* step-checking routine (optional) */
 22:   void                     *precheck;                                                        /* user-defined step-checking context (optional) */
 23:   PetscErrorCode           (*postcheckstep)(SNES,Vec,Vec,Vec,void*,PetscBool *,PetscBool *); /* step-checking routine (optional) */
 24:   void                     *postcheck;                                                       /* user-defined step-checking context (optional) */
 25:   PetscViewer              lsmonitor;

 27:   /* ------------------ Semismooth algorithm stuff ------------------------------ */
 28:   Vec                      phi;                      /* pointer to semismooth function */
 29:   PetscReal                phinorm;                 /* 2-norm of the semismooth function */
 30:   PetscReal                merit;           /* Merit function */
 31:   Vec                      dpsi;           /* Merit function gradient */
 32:   Vec                      Da;            /* B sub-differential work vector (diag perturbation) */
 33:   Vec                      Db;            /* B sub-differential work vector (row scaling) */
 34:   Vec                      z;    /* B subdifferential work vector */
 35:   Vec                      t;    /* B subdifferential work vector */
 36:   Vec                      xl;            /* lower bound on variables */
 37:   Vec                      xu;            /* upper bound on variables */
 38:   PetscInt                 ntruebounds;   /* number of variables that have at least one non-infinite bound given */

 40:   PetscScalar              norm_d;         /* two norm of the descent direction */
 41:   IS                       IS_inact_prev; /* Inctive set IS for the previous iteration or previous snes solve */

 43:   /* Tolerance to check whether the constraint is satisfied */
 44:   PetscReal                const_tol;
 45:   /* Copy of user supplied function evaluation routine  */
 46:   PetscErrorCode (*computeuserfunction)(SNES,Vec,Vec,void*);
 47:   /* user supplied function for checking redundant equations for SNESSolveVI_RS2 */
 48:   PetscErrorCode (*checkredundancy)(SNES,IS,IS*,void*);
 49:   void                     *ctxP; /* user defined check redundancy context */

 51:   PetscErrorCode           (*computevariablebounds)(SNES,Vec,Vec);
 52:   PetscBool                ignorefunctionsign;    /* when computing active set ignore the sign of the function values */
 53: } SNES_VI;

 55: #endif