Actual source code: bjacobi.h

      1: #pragma once
      2: /*
      3:     Private data for block Jacobi and block Gauss-Seidel preconditioner.
      4: */
      5: #include <petsc/private/pcimpl.h>

      7: /*
      8:        This data is general for all implementations
      9: */
     10: typedef struct {
     11:   PetscInt     n;              /* number of global blocks */
     12:   PetscInt     n_local;        /* number of blocks in this subcommunicator or in this process */
     13:   PetscInt     first_local;    /* number of first block on processor */
     14:   PetscBool    use_true_local; /* use block from true matrix, not preconditioner matrix for local MatMult() */
     15:   KSP         *ksp;            /* KSP contexts for blocks or for subcommunicator */
     16:   void        *data;           /* implementation-specific data */
     17:   PetscInt    *l_lens;         /* lens of each block */
     18:   PetscInt    *g_lens;
     19:   PetscSubcomm psubcomm; /* for multiple processors per block */
     20: } PC_BJacobi;

     22: /*
     23:        This data is specific for certain implementations
     24: */

     26: /*  This is for multiple blocks per processor */
     27: typedef struct {
     28:   Vec      *x, *y;      /* work vectors for solves on each block */
     29:   PetscInt *starts;     /* starting point of each block */
     30:   Mat      *mat, *pmat; /* submatrices for each block */
     31:   IS       *is;         /* for gathering the submatrices */
     32: } PC_BJacobi_Multiblock;

     34: /*  This is for a single block per processor */
     35: typedef struct {
     36:   Vec x, y;
     37: } PC_BJacobi_Singleblock;

     39: /*  This is for multiple processors per block */
     40: typedef struct {
     41:   PC           pc;         /* preconditioner used on each subcommunicator */
     42:   Vec          xsub, ysub; /* vectors of a subcommunicator to hold parallel vectors of PetscObjectComm((PetscObject)pc) */
     43:   Mat          submats;    /* matrix and optional preconditioner matrix belong to a subcommunicator */
     44:   PetscSubcomm psubcomm;
     45: } PC_BJacobi_Multiproc;