1: /* 2: Private context for semismooth newton method with line search for solving 3: system of mixed complementarity equations 4: */ 9: #include <petsc/private/snesimpl.h> 11: #define PetscScalarNorm(a,b) (PetscSqrtScalar((a)*(a)+(b)*(b))) 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 */ 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; 30: #endif