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