1 #if !defined(__FGMRES) 2 #define __FGMRES 3 4 #include <petsc-private/kspimpl.h> 5 #define KSPGMRES_NO_MACROS 6 #include <../src/ksp/ksp/impls/gmres/gmresimpl.h> 7 8 typedef struct { 9 KSPGMRESHEADER 10 11 /* new storage for fgmres */ 12 Vec *prevecs; /* holds the preconditioned basis vectors for fgmres. 13 We will allocate these at the same time as vecs 14 above (and in the same "chunks". */ 15 Vec **prevecs_user_work; /* same purpose as user_work above, but this one is 16 for our preconditioned vectors */ 17 18 /* we need a function for interacting with the pcfamily */ 19 20 PetscErrorCode (*modifypc)(KSP,PetscInt,PetscInt,PetscReal,void*); /* function to modify the preconditioner*/ 21 PetscErrorCode (*modifydestroy)(void*); 22 void *modifyctx; 23 } KSP_FGMRES; 24 25 #define HH(a,b) (fgmres->hh_origin + (b)*(fgmres->max_k+2)+(a)) 26 /* HH will be size (max_k+2)*(max_k+1) - think of HH as 27 being stored columnwise for access purposes. */ 28 #define HES(a,b) (fgmres->hes_origin + (b)*(fgmres->max_k+1)+(a)) 29 /* HES will be size (max_k + 1) * (max_k + 1) - 30 again, think of HES as being stored columnwise */ 31 #define CC(a) (fgmres->cc_origin + (a)) /* CC will be length (max_k+1) - cosines */ 32 #define SS(a) (fgmres->ss_origin + (a)) /* SS will be length (max_k+1) - sines */ 33 #define RS(a) (fgmres->rs_origin + (a)) /* RS will be length (max_k+2) - rt side */ 34 35 /* vector names */ 36 #define VEC_OFFSET 2 37 #define VEC_TEMP fgmres->vecs[0] /* work space */ 38 #define VEC_TEMP_MATOP fgmres->vecs[1] /* work space */ 39 #define VEC_VV(i) fgmres->vecs[VEC_OFFSET+i] /* use to access 40 othog basis vectors */ 41 #define PREVEC(i) fgmres->prevecs[i] /* use to access 42 preconditioned basis */ 43 44 #endif 45 46 47 48