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