1 /* 2 Private data structure used by the LGMRES method. 3 */ 4 5 #ifndef PETSC_LGMRESIMPL_H 6 #define PETSC_LGMRESIMPL_H 7 8 #define KSPGMRES_NO_MACROS 9 #include <../src/ksp/ksp/impls/gmres/gmresimpl.h> 10 11 typedef struct { 12 KSPGMRESHEADER 13 14 /* LGMRES_MOD - make these for the z vectors - new storage for lgmres */ 15 Vec *augvecs; /* holds the error approximation vectors for lgmres. */ 16 Vec **augvecs_user_work; /* same purpose as user_work above, but this one is for our error approx vectors */ 17 /* currently only augvecs_user_work[0] is used, not sure if this will be */ 18 /* extended in the future to use more, or if this is a design bug */ 19 PetscInt aug_vv_allocated; /* aug_vv_allocated is the number of allocated lgmres augmentation vectors */ 20 PetscInt aug_vecs_allocated; /* aug_vecs_allocated is the total number of augmentation vecs available */ 21 PetscScalar *hwork; /* work array to hold Hessenberg product */ 22 23 PetscInt augwork_alloc; /*size of chunk allocated for augmentation vectors */ 24 PetscInt aug_dim; /* max number of augmented directions to add */ 25 PetscInt aug_ct; /* number of aug. vectors available */ 26 PetscInt *aug_order; /*keeps track of order to use aug. vectors*/ 27 PetscBool approx_constant; /* = 1 then the approx space at each restart will 28 be size max_k . Therefore, more than (max_k - aug_dim) 29 krylov vectors may be used if less than aug_dim error 30 approximations are available (in the first few restarts, 31 for example) to keep the space a constant size. */ 32 33 PetscInt matvecs; /*keep track of matvecs */ 34 } KSP_LGMRES; 35 36 #define HH(a, b) (lgmres->hh_origin + (b) * (lgmres->max_k + 2) + (a)) 37 /* HH will be size (max_k+2)*(max_k+1) - think of HH as 38 being stored columnwise (inc. zeros) for access purposes. */ 39 #define HES(a, b) (lgmres->hes_origin + (b) * (lgmres->max_k + 1) + (a)) 40 /* HES will be size (max_k + 1) * (max_k + 1) - 41 again, think of HES as being stored columnwise */ 42 #define CC(a) (lgmres->cc_origin + (a)) /* CC will be length (max_k+1) - cosines */ 43 #define SS(a) (lgmres->ss_origin + (a)) /* SS will be length (max_k+1) - sines */ 44 #define GRS(a) (lgmres->rs_origin + (a)) /* GRS will be length (max_k+2) - rt side */ 45 46 /* vector names */ 47 #define VEC_OFFSET 2 48 #define VEC_TEMP lgmres->vecs[0] /* work space */ 49 #define VEC_TEMP_MATOP lgmres->vecs[1] /* work space */ 50 #define VEC_VV(i) lgmres->vecs[VEC_OFFSET + i] /* use to access othog basis vectors */ 51 /*LGMRES_MOD */ 52 #define AUG_OFFSET 1 53 #define AUGVEC(i) lgmres->augvecs[AUG_OFFSET + i] /*error approx vectors */ 54 #define AUG_ORDER(i) lgmres->aug_order[i] /*order in which to augment */ 55 #define A_AUGVEC(i) lgmres->augvecs[AUG_OFFSET + i + lgmres->aug_dim] /*A times error vector */ 56 #define AUG_TEMP lgmres->augvecs[0] /* work vector */ 57 58 #define LGMRES_DELTA_DIRECTIONS 10 59 #define LGMRES_DEFAULT_MAXK 30 60 #define LGMRES_DEFAULT_AUGDIM 2 /*default number of augmentation vectors */ 61 62 #endif // PETSC_LGMRESIMPL_H 63