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