1 #ifndef _SNESNGMRES_H 2 #define _SNESNGMRES_H 3 4 #include <petsc-private/snesimpl.h> 5 6 /* Data structure for the Nonlinear GMRES method. */ 7 typedef struct { 8 9 /* Solver parameters and counters */ 10 PetscInt msize; /* maximum size of krylov space */ 11 PetscInt restart_it; /* number of iterations the restart conditions persist before restart */ 12 PetscViewer monitor; /* debugging output for NGMRES */ 13 14 /* History and subspace data */ 15 Vec *Fdot; /* residual history -- length msize */ 16 Vec *Xdot; /* solution history -- length msize */ 17 PetscReal *fnorms; /* the residual norm history */ 18 PetscReal *xnorms; /* the solution norm history */ 19 20 /* General minimization problem context */ 21 PetscScalar *h; /* the constraint matrix */ 22 PetscScalar *beta; /* rhs for the minimization problem */ 23 PetscScalar *xi; /* the dot-product of the current and previous res. */ 24 25 /* Line searches */ 26 SNESLineSearch additive_linesearch; /* Line search for the additive variant */ 27 28 /* Selection constants */ 29 PetscBool anderson; /* use anderson-mixing approach */ 30 PetscBool additive; /* use additive variant instead of selection */ 31 PetscBool singlereduction;/* use a single reduction (with more local work) for tolerance selection */ 32 PetscReal gammaA; /* Criterion A residual tolerance */ 33 PetscReal epsilonB; /* Criterion B difference tolerance */ 34 PetscReal deltaB; /* Criterion B residual tolerance */ 35 PetscReal gammaC; /* Restart residual tolerance */ 36 37 /* Least squares minimization solve context */ 38 PetscScalar *q; /* the matrix formed as q_ij = (rdot_i, rdot_j) */ 39 PetscBLASInt m; /* matrix dimension */ 40 PetscBLASInt n; /* matrix dimension */ 41 PetscBLASInt nrhs; /* the number of right hand sides */ 42 PetscBLASInt lda; /* the padded matrix dimension */ 43 PetscBLASInt ldb; /* the padded vector dimension */ 44 PetscReal *s; /* the singular values */ 45 PetscReal rcond; /* the exit condition */ 46 PetscBLASInt rank; /* the effective rank */ 47 PetscScalar *work; /* the work vector */ 48 PetscReal *rwork; /* the real work vector used for complex */ 49 PetscBLASInt lwork; /* the size of the work vector */ 50 PetscBLASInt info; /* the output condition */ 51 52 PetscBool setup_called; /* indicates whether SNESSetUp_NGMRES() has been called */ 53 } SNES_NGMRES; 54 55 #define H(i,j) ngmres->h[i*ngmres->msize + j] 56 #define Q(i,j) ngmres->q[i*ngmres->msize + j] 57 58 #endif 59