1 #ifndef _SNESNGMRES_H 2 #define _SNESNGMRES_H 3 4 #include <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 19 /* General minimization problem context */ 20 PetscScalar *h; /* the constraint matrix */ 21 PetscScalar *beta; /* rhs for the minimization problem */ 22 PetscScalar *xi; /* the dot-product of the current and previous res. */ 23 24 /* Selection constants */ 25 PetscBool anderson; /* use anderson-mixing approach */ 26 PetscBool additive; /* use additive variant instead of selection */ 27 PetscReal gammaA; /* Criterion A residual tolerance */ 28 PetscReal epsilonB; /* Criterion B difference tolerance */ 29 PetscReal deltaB; /* Criterion B residual tolerance */ 30 PetscReal gammaC; /* Restart residual tolerance */ 31 32 /* LS Minimization solve context */ 33 PetscScalar *q; /* the matrix formed as q_ij = (rdot_i, rdot_j) */ 34 PetscBLASInt m; /* matrix dimension */ 35 PetscBLASInt n; /* matrix dimension */ 36 PetscBLASInt nrhs; /* the number of right hand sides */ 37 PetscBLASInt lda; /* the padded matrix dimension */ 38 PetscBLASInt ldb; /* the padded vector dimension */ 39 PetscReal *s; /* the singular values */ 40 PetscReal rcond; /* the exit condition */ 41 PetscBLASInt rank; /* the effective rank */ 42 PetscScalar *work; /* the work vector */ 43 PetscReal *rwork; /* the real work vector used for complex */ 44 PetscBLASInt lwork; /* the size of the work vector */ 45 PetscBLASInt info; /* the output condition */ 46 47 PetscBool setup_called; /* indicates whether SNESSetUp_NGMRES() has been called */ 48 } SNES_NGMRES; 49 50 #define H(i,j) ngmres->h[i*ngmres->msize + j] 51 #define Q(i,j) ngmres->q[i*ngmres->msize + j] 52 53 #endif 54