xref: /petsc/src/snes/impls/vi/ss/vissimpl.h (revision 5b6bfdb9644f185dbf5e5a09b808ec241507e1e7)
1 /*
2    Private context for semismooth newton method with line search for solving
3    system of mixed complementarity equations
4  */
5 
6 #if !defined(__SNES_VISS_H)
7 #define __SNES_VISS_H
8 
9 #include <petsc/private/snesimpl.h>
10 
11 #define PetscScalarNorm(a,b) (PetscSqrtScalar((a)*(a)+(b)*(b)))
12 
13 typedef struct {
14   Vec         phi;                 /* pointer to semismooth function */
15   PetscReal   phinorm;             /* 2-norm of the semismooth function */
16   PetscReal   merit;               /* Merit function */
17   Vec         dpsi;                /* Merit function gradient */
18   Vec         Da;                  /* B sub-differential work vector (diag perturbation) */
19   Vec         Db;                  /* B sub-differential work vector (row scaling) */
20   Vec         z;                   /* B subdifferential work vector */
21   Vec         t;                   /* B subdifferential work vector */
22   PetscScalar norm_d;              /* two norm of the descent direction */
23 
24   /* Copy of user supplied function evaluation routine  */
25   PetscErrorCode (*computeuserfunction)(SNES,Vec,Vec,void*);
26   /* user supplied function for checking redundant equations for SNESSolveVI_RS2 */
27   PetscErrorCode (*checkredundancy)(SNES,IS,IS*,void*);
28 } SNES_VINEWTONSSLS;
29 
30 #endif
31 
32