Actual source code: pipefgmresimpl.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 explicit storage of preconditioned basis vectors */
 10:   Vec  *prevecs;           /* holds the preconditioned basis vectors for fgmres. We will allocate these at the same time as vecs
 11:                               above (and in the same size "chunks". */
 12:   Vec **prevecs_user_work; /* same purpose as user_work above, but this one is for our preconditioned vectors */

 14:   /* new storage for explicit storage of pipelining quantities */
 15:   Vec  *zvecs;
 16:   Vec **zvecs_user_work;

 18:   /* A shift parameter */
 19:   PetscScalar shift;

 21:   /* Work space to allow all reductions in a single call */
 22:   Vec *redux;

 24: } KSP_PIPEFGMRES;

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

 34: /* vector names */
 35: #define VEC_OFFSET     4
 36: #define VEC_TEMP       pipefgmres->vecs[0] /* work space */
 37: #define VEC_TEMP_MATOP pipefgmres->vecs[1] /* work space */
 38: #define VEC_Q          pipefgmres->vecs[2] /* work space - Q pipelining var */
 39: #define VEC_W          pipefgmres->vecs[3] /* work space - W pipelining var */

 41: #define VEC_VV(i) pipefgmres->vecs[VEC_OFFSET + i] /* use to access othog basis vectors. Note the offset, since we use the first few as workspace */

 43: #define PREVEC(i) pipefgmres->prevecs[i] /* use to access preconditioned basis */
 44: #define ZVEC(i)   pipefgmres->zvecs[i]

 46: #define PIPEFGMRES_DELTA_DIRECTIONS 10
 47: #define PIPEFGMRES_DEFAULT_MAXK     30