xref: /petsc/src/snes/impls/vi/ss/vissimpl.h (revision 9dd11ecf0918283bb567d8b33a92f53ac4ea7840)
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 
6*a4963045SJacob Faibussowitsch #pragma once
7c2fc9fa9SBarry Smith 
800e125f8SBarry Smith #include <petsc/private/snesimpl.h>
900e125f8SBarry Smith 
1000e125f8SBarry Smith #define PetscScalarNorm(a, b) (PetscSqrtScalar((a) * (a) + (b) * (b)))
1100e125f8SBarry Smith 
12c2fc9fa9SBarry Smith typedef struct {
13c2fc9fa9SBarry Smith   Vec         phi;     /* pointer to semismooth function */
14c2fc9fa9SBarry Smith   PetscReal   phinorm; /* 2-norm of the semismooth function */
15c2fc9fa9SBarry Smith   PetscReal   merit;   /* Merit function */
16c2fc9fa9SBarry Smith   Vec         dpsi;    /* Merit function gradient */
17c2fc9fa9SBarry Smith   Vec         Da;      /* B sub-differential work vector (diag perturbation) */
18c2fc9fa9SBarry Smith   Vec         Db;      /* B sub-differential work vector (row scaling) */
19c2fc9fa9SBarry Smith   Vec         z;       /* B subdifferential work vector */
20c2fc9fa9SBarry Smith   Vec         t;       /* B subdifferential work vector */
21c2fc9fa9SBarry Smith   PetscScalar norm_d;  /* two norm of the descent direction */
22c2fc9fa9SBarry Smith 
23c2fc9fa9SBarry Smith   /* Copy of user supplied function evaluation routine  */
24c2fc9fa9SBarry Smith   PetscErrorCode (*computeuserfunction)(SNES, Vec, Vec, void *);
25c2fc9fa9SBarry Smith   /* user supplied function for checking redundant equations for SNESSolveVI_RS2 */
26c2fc9fa9SBarry Smith   PetscErrorCode (*checkredundancy)(SNES, IS, IS *, void *);
27f450aa47SBarry Smith } SNES_VINEWTONSSLS;
28