xref: /petsc/src/mat/impls/baij/mpi/mpibaij.h (revision 4da72fa9edbadbed037b02b2107ab8f0d233e822)
1e8823a70SSatish Balay 
279bdfe76SSatish Balay #if !defined(__MPIBAIJ_H)
379bdfe76SSatish Balay #define __MPIBAIJ_H
4c6db04a5SJed Brown #include <../src/mat/impls/baij/seq/baij.h>
579bdfe76SSatish Balay 
6aa482453SBarry Smith #if defined (PETSC_USE_CTABLE)
7c66d48e9SBarry Smith #define PETSCTABLE PetscTable
832b39ab2SSatish Balay #else
9b24ad042SBarry Smith #define PETSCTABLE PetscInt*
1032b39ab2SSatish Balay #endif
11e8823a70SSatish Balay 
126c6c5352SBarry Smith #define MPIBAIJHEADER \
13d0f46423SBarry Smith   PetscInt      *rangebs;              /* rmap->range/bs */                      		\
14899cda47SBarry Smith   PetscInt      rstartbs,rendbs,cstartbs,cendbs;  /* map values / bs  */                        \
151d18e487SKris Buschelman   Mat           A,B;                   /* local submatrices: A (diag part), B (off-diag part) */ \
16b24ad042SBarry Smith   PetscMPIInt   size;                   /* size of communicator */                             \
17b24ad042SBarry Smith   PetscMPIInt   rank;                   /* rank of proc in communicator */                     \
18521d7252SBarry Smith   PetscInt      bs2;                    /* block size, bs2 = bs*bs */                           \
19b24ad042SBarry Smith   PetscInt      Mbs,Nbs;               /* number block rows/cols in matrix; M/bs, N/bs */      \
20b24ad042SBarry Smith   PetscInt      mbs,nbs;               /* number block rows/cols on processor; m/bs, n/bs */   \
216c6c5352SBarry Smith                                                                                                \
226c6c5352SBarry Smith   /* The following variables are used for matrix assembly */                                   \
236c6c5352SBarry Smith                                                                                                \
24ace3abfcSBarry Smith   PetscBool     donotstash;             /* if 1, off processor entries dropped */              \
256c6c5352SBarry Smith   MPI_Request   *send_waits;            /* array of send requests */                           \
266c6c5352SBarry Smith   MPI_Request   *recv_waits;            /* array of receive requests */                        \
27b24ad042SBarry Smith   PetscInt      nsends,nrecvs;         /* numbers of sends and receives */                     \
286c6c5352SBarry Smith   MatScalar     *svalues,*rvalues;     /* sending and receiving data */                        \
29b24ad042SBarry Smith   PetscInt      rmax;                   /* maximum message length */                           \
306c6c5352SBarry Smith   PETSCTABLE    colmap;                 /* local col number of off-diag col */                 \
316c6c5352SBarry Smith                                                                                                \
32b24ad042SBarry Smith   PetscInt     *garray;                /* work array */                                       \
336c6c5352SBarry Smith                                                                                                \
346c6c5352SBarry Smith   /* The following variable is used by blocked matrix assembly */                              \
356c6c5352SBarry Smith   MatScalar     *barray;                /* Block array of size bs2 */                          \
366c6c5352SBarry Smith                                                                                                \
376c6c5352SBarry Smith   /* The following variables are used for matrix-vector products */                            \
386c6c5352SBarry Smith                                                                                                \
396c6c5352SBarry Smith   Vec           lvec;              /* local vector */                                          \
406c6c5352SBarry Smith   VecScatter    Mvctx;             /* scatter context for vector */                            \
41ace3abfcSBarry Smith   PetscBool     roworiented;       /* if true, row-oriented input, default true */             \
426c6c5352SBarry Smith                                                                                                \
436c6c5352SBarry Smith   /* The following variables are for MatGetRow() */                                            \
446c6c5352SBarry Smith                                                                                                \
45b24ad042SBarry Smith   PetscInt      *rowindices;       /* column indices for row */                                \
466c6c5352SBarry Smith   PetscScalar   *rowvalues;        /* nonzero values in row */                                 \
47ace3abfcSBarry Smith   PetscBool     getrowactive;      /* indicates MatGetRow(), not restored */                   \
486c6c5352SBarry Smith                                                                                                \
496c6c5352SBarry Smith   /* Some variables to make MatSetValues and others more efficient */                          \
50b24ad042SBarry Smith   PetscInt      rstart_bs,rend_bs;                                                             \
51b24ad042SBarry Smith   PetscInt      cstart_bs,cend_bs;                                                             \
52b24ad042SBarry Smith   PetscInt      *ht;                      /* Hash table to speed up matrix assembly */         \
536c6c5352SBarry Smith   MatScalar     **hd;                     /* Hash table data */                                \
54b24ad042SBarry Smith   PetscInt      ht_size;                                                                       \
55b24ad042SBarry Smith   PetscInt      ht_total_ct,ht_insert_ct; /* Hash table statistics */                          \
56ace3abfcSBarry Smith   PetscBool     ht_flag;                  /* Flag to indicate if hash tables are used */       \
576c6c5352SBarry Smith   double        ht_fact;                  /* Factor to determine the HT size */                \
586c6c5352SBarry Smith                                                                                                \
59b24ad042SBarry Smith   PetscInt      setvalueslen;    /* only used for single precision computations */             \
607a868f3eSHong Zhang   MatScalar     *setvaluescopy; /* area double precision values in MatSetValuesXXX() are copied*/ \
617a868f3eSHong Zhang                                    /*   before calling MatSetValuesXXX_MPIBAIJ_MatScalar() */   \
627a868f3eSHong Zhang   PetscBool     ijonly         /*   used in  MatGetSubMatrices_MPIBAIJ_local() for getting ij structure only */
636c6c5352SBarry Smith typedef struct {
641d18e487SKris Buschelman   MPIBAIJHEADER;
65e8823a70SSatish Balay } Mat_MPIBAIJ;
6679bdfe76SSatish Balay 
6709573ac7SBarry Smith extern PetscErrorCode MatLoad_MPIBAIJ(Mat,PetscViewer);
6809573ac7SBarry Smith extern PetscErrorCode CreateColmap_MPIBAIJ_Private(Mat);
6909573ac7SBarry Smith extern PetscErrorCode MatGetSubMatrices_MPIBAIJ(Mat,PetscInt,const IS[],const IS[],MatReuse,Mat*[]);
70*4da72fa9SHong Zhang extern PetscErrorCode MatGetSubMatrices_MPIBAIJ_local(Mat,PetscInt,const IS[],const IS[],MatReuse,PetscBool*,PetscBool*,Mat*);
7109573ac7SBarry Smith extern PetscErrorCode MatGetSubMatrix_MPIBAIJ_Private(Mat,IS,IS,PetscInt,MatReuse,Mat*);
72db41cccfSHong Zhang extern PetscErrorCode MatIncreaseOverlap_MPIBAIJ(Mat,PetscInt,IS[],PetscInt);
73db41cccfSHong Zhang extern PetscErrorCode MatIncreaseOverlap_MPIBAIJ_Once(Mat,PetscInt,IS *);
7479bdfe76SSatish Balay #endif
75