1 #if !defined(__BJACOBI_H) 2 #define __BJACOBI_H 3 /* 4 Private data for block Jacobi and block Gauss-Seidel preconditioner. 5 */ 6 #include <petscksp.h> 7 #include <petsc/private/pcimpl.h> 8 9 /* 10 This data is general for all implementations 11 */ 12 typedef struct { 13 PetscInt n; /* number of global blocks */ 14 PetscInt n_local; /* number of blocks in this subcommunicator or in this process */ 15 PetscInt first_local; /* number of first block on processor */ 16 PetscBool use_true_local; /* use block from true matrix, not preconditioner matrix for local MatMult() */ 17 KSP *ksp; /* KSP contexts for blocks or for subcommunicator */ 18 void *data; /* implementation-specific data */ 19 PetscBool same_local_solves; /* flag indicating whether all local solvers are same (used for PCView()) */ 20 PetscInt *l_lens; /* lens of each block */ 21 PetscInt *g_lens; 22 PetscSubcomm psubcomm; /* for multiple processors per block */ 23 } PC_BJacobi; 24 25 /* 26 This data is specific for certain implementations 27 */ 28 29 /* This is for multiple blocks per processor */ 30 typedef struct { 31 Vec *x,*y; /* work vectors for solves on each block */ 32 PetscInt *starts; /* starting point of each block */ 33 Mat *mat,*pmat; /* submatrices for each block */ 34 IS *is; /* for gathering the submatrices */ 35 } PC_BJacobi_Multiblock; 36 37 /* This is for a single block per processor */ 38 typedef struct { 39 Vec x,y; 40 } PC_BJacobi_Singleblock; 41 42 /* This is for multiple processors per block */ 43 typedef struct { 44 PC pc; /* preconditioner used on each subcommunicator */ 45 Vec xsub,ysub; /* vectors of a subcommunicator to hold parallel vectors of PetscObjectComm((PetscObject)pc) */ 46 Mat submats; /* matrix and optional preconditioner matrix belong to a subcommunicator */ 47 PetscSubcomm psubcomm; 48 } PC_BJacobi_Multiproc; 49 #endif 50