xref: /petsc/src/mat/impls/baij/mpi/mpibaij.h (revision b24ad0428a60bb3d8d9be05f5b432634d28bad96)
1e8823a70SSatish Balay 
279bdfe76SSatish Balay #if !defined(__MPIBAIJ_H)
379bdfe76SSatish Balay #define __MPIBAIJ_H
4c833c1fbSBarry Smith #include "src/mat/impls/baij/seq/baij.h"
5c833c1fbSBarry Smith #include "src/sys/ctable.h"
679bdfe76SSatish Balay 
7aa482453SBarry Smith #if defined (PETSC_USE_CTABLE)
8c66d48e9SBarry Smith #define PETSCTABLE PetscTable
932b39ab2SSatish Balay #else
10*b24ad042SBarry Smith #define PETSCTABLE PetscInt*
1132b39ab2SSatish Balay #endif
12e8823a70SSatish Balay 
136c6c5352SBarry Smith #define MPIBAIJHEADER \
14*b24ad042SBarry Smith   PetscInt      *rowners,*cowners;      /* ranges owned by each processor, in blocks */        \
15*b24ad042SBarry Smith   PetscInt      *rowners_bs;            /* rowners*bs */                                       \
16*b24ad042SBarry Smith   PetscInt      rstart,rend;           /* starting and ending owned rows */                    \
17*b24ad042SBarry Smith   PetscInt      cstart,cend;           /* starting and ending owned columns */                 \
186c6c5352SBarry Smith   Mat           A,B;                   /* local submatrices: A (diag part),                    \
196c6c5352SBarry Smith                                            B (off-diag part) */                                \
20*b24ad042SBarry Smith   PetscMPIInt   size;                   /* size of communicator */                             \
21*b24ad042SBarry Smith   PetscMPIInt   rank;                   /* rank of proc in communicator */                     \
22*b24ad042SBarry Smith   PetscInt      bs,bs2;                /* block size, bs2 = bs*bs */                           \
23*b24ad042SBarry Smith   PetscInt      Mbs,Nbs;               /* number block rows/cols in matrix; M/bs, N/bs */      \
24*b24ad042SBarry Smith   PetscInt      mbs,nbs;               /* number block rows/cols on processor; m/bs, n/bs */   \
256c6c5352SBarry Smith                                                                                                \
266c6c5352SBarry Smith   /* The following variables are used for matrix assembly */                                   \
276c6c5352SBarry Smith                                                                                                \
286c6c5352SBarry Smith   PetscTruth    donotstash;             /* if 1, off processor entries dropped */              \
296c6c5352SBarry Smith   MPI_Request   *send_waits;            /* array of send requests */                           \
306c6c5352SBarry Smith   MPI_Request   *recv_waits;            /* array of receive requests */                        \
31*b24ad042SBarry Smith   PetscInt      nsends,nrecvs;         /* numbers of sends and receives */                     \
326c6c5352SBarry Smith   MatScalar     *svalues,*rvalues;     /* sending and receiving data */                        \
33*b24ad042SBarry Smith   PetscInt      rmax;                   /* maximum message length */                           \
346c6c5352SBarry Smith   PETSCTABLE    colmap;                 /* local col number of off-diag col */                 \
356c6c5352SBarry Smith                                                                                                \
36*b24ad042SBarry Smith   PetscInt     *garray;                /* work array */                                       \
376c6c5352SBarry Smith                                                                                                \
386c6c5352SBarry Smith   /* The following variable is used by blocked matrix assembly */                              \
396c6c5352SBarry Smith   MatScalar     *barray;                /* Block array of size bs2 */                          \
406c6c5352SBarry Smith                                                                                                \
416c6c5352SBarry Smith   /* The following variables are used for matrix-vector products */                            \
426c6c5352SBarry Smith                                                                                                \
436c6c5352SBarry Smith   Vec           lvec;              /* local vector */                                          \
446c6c5352SBarry Smith   VecScatter    Mvctx;             /* scatter context for vector */                            \
456c6c5352SBarry Smith   PetscTruth    roworiented;       /* if true, row-oriented input, default true */             \
466c6c5352SBarry Smith                                                                                                \
476c6c5352SBarry Smith   /* The following variables are for MatGetRow() */                                            \
486c6c5352SBarry Smith                                                                                                \
49*b24ad042SBarry Smith   PetscInt      *rowindices;       /* column indices for row */                                \
506c6c5352SBarry Smith   PetscScalar   *rowvalues;        /* nonzero values in row */                                 \
516c6c5352SBarry Smith   PetscTruth    getrowactive;      /* indicates MatGetRow(), not restored */                   \
526c6c5352SBarry Smith                                                                                                \
536c6c5352SBarry Smith   /* Some variables to make MatSetValues and others more efficient */                          \
54*b24ad042SBarry Smith   PetscInt      rstart_bs,rend_bs;                                                             \
55*b24ad042SBarry Smith   PetscInt      cstart_bs,cend_bs;                                                             \
56*b24ad042SBarry Smith   PetscInt      *ht;                      /* Hash table to speed up matrix assembly */         \
576c6c5352SBarry Smith   MatScalar     **hd;                     /* Hash table data */                                \
58*b24ad042SBarry Smith   PetscInt      ht_size;                                                                       \
59*b24ad042SBarry Smith   PetscInt      ht_total_ct,ht_insert_ct; /* Hash table statistics */                          \
606c6c5352SBarry Smith   PetscTruth    ht_flag;                  /* Flag to indicate if hash tables are used */       \
616c6c5352SBarry Smith   double        ht_fact;                  /* Factor to determine the HT size */                \
626c6c5352SBarry Smith                                                                                                \
63*b24ad042SBarry Smith   PetscInt      setvalueslen;    /* only used for single precision computations */             \
646c6c5352SBarry Smith   MatScalar     *setvaluescopy; /* area double precision values in MatSetValuesXXX() are copied\
65a377f70aSBarry Smith                                       before calling MatSetValuesXXX_MPIBAIJ_MatScalar() */
666c6c5352SBarry Smith 
676c6c5352SBarry Smith typedef struct {
686c6c5352SBarry Smith   MPIBAIJHEADER
69e8823a70SSatish Balay } Mat_MPIBAIJ;
7079bdfe76SSatish Balay 
71dfbe8321SBarry Smith EXTERN PetscErrorCode MatLoad_MPIBAIJ(PetscViewer,const MatType,Mat*);
72dfbe8321SBarry Smith EXTERN PetscErrorCode CreateColmap_MPIBAIJ_Private(Mat);
73*b24ad042SBarry Smith EXTERN PetscErrorCode MatGetSubMatrices_MPIBAIJ(Mat,PetscInt,const IS[],const IS[],MatReuse,Mat*[]);
7479bdfe76SSatish Balay #endif
75