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