Actual source code: fgmresimpl.h

  1: #pragma once

  3: #define KSPGMRES_NO_MACROS
  4: #include <../src/ksp/ksp/impls/gmres/gmresimpl.h>

  6: typedef struct {
  7:   KSPGMRESHEADER

  9:   /* new storage for fgmres */
 10:   Vec  *prevecs;           /* holds the preconditioned basis vectors for fgmres.
 11:                                     We will allocate these at the same time as vecs
 12:                                     above (and in the same "chunks". */
 13:   Vec **prevecs_user_work; /* same purpose as user_work above, but this one is
 14:                                     for our preconditioned vectors */

 16:   /* we need a function for interacting with the pcfamily */

 18:   PetscErrorCode (*modifypc)(KSP, PetscInt, PetscInt, PetscReal, void *); /* function to modify the preconditioner*/
 19:   PetscErrorCode (*modifydestroy)(void *);
 20:   void *modifyctx;
 21: } KSP_FGMRES;

 23: #define HH(a, b) (fgmres->hh_origin + (b) * (fgmres->max_k + 2) + (a))
 24: /* HH will be size (max_k+2)*(max_k+1)  -  think of HH as
 25:    being stored columnwise for access purposes. */
 26: #define HES(a, b) (fgmres->hes_origin + (b) * (fgmres->max_k + 1) + (a))
 27: /* HES will be size (max_k + 1) * (max_k + 1) -
 28:    again, think of HES as being stored columnwise */
 29: #define CC(a) (fgmres->cc_origin + (a)) /* CC will be length (max_k+1) - cosines */
 30: #define SS(a) (fgmres->ss_origin + (a)) /* SS will be length (max_k+1) - sines */
 31: #define RS(a) (fgmres->rs_origin + (a)) /* RS will be length (max_k+2) - rt side */

 33: /* vector names */
 34: #define VEC_OFFSET     2
 35: #define VEC_TEMP       fgmres->vecs[0] /* work space */
 36: #define VEC_TEMP_MATOP fgmres->vecs[1] /* work space */
 37: #define VEC_VV(i) \
 38:   fgmres->vecs[VEC_OFFSET + i] /* use to access
 39:                                                         othog basis vectors */
 40: #define PREVEC(i) \
 41:   fgmres->prevecs[i] /* use to access
 42:                                                         preconditioned basis */