xref: /petsc/src/mat/impls/baij/mpi/mpibaij.h (revision 8bc8193efbc389280f83b3d41dffa9e2d23e2ace)
1 
2 #if !defined(__MPIBAIJ_H)
3 #define __MPIBAIJ_H
4 #include "src/mat/impls/baij/seq/baij.h"
5 #include "src/sys/ctable.h"
6 
7 #if defined (PETSC_USE_CTABLE)
8 #define PETSCTABLE PetscTable
9 #else
10 #define PETSCTABLE PetscInt*
11 #endif
12 
13 #define MPIBAIJHEADER \
14   PetscInt      *rowners,*cowners;      /* ranges owned by each processor, in blocks */        \
15   PetscInt      *rowners_bs;            /* rowners*bs */                                       \
16   PetscInt      rstart,rend;           /* starting and ending owned rows */                    \
17   PetscInt      cstart,cend;           /* starting and ending owned columns */                 \
18   Mat           A,B;                   /* local submatrices: A (diag part),                    \
19                                            B (off-diag part) */                                \
20   PetscMPIInt   size;                   /* size of communicator */                             \
21   PetscMPIInt   rank;                   /* rank of proc in communicator */                     \
22   PetscInt      bs2;                    /* block size, bs2 = bs*bs */                           \
23   PetscInt      Mbs,Nbs;               /* number block rows/cols in matrix; M/bs, N/bs */      \
24   PetscInt      mbs,nbs;               /* number block rows/cols on processor; m/bs, n/bs */   \
25                                                                                                \
26   /* The following variables are used for matrix assembly */                                   \
27                                                                                                \
28   PetscTruth    donotstash;             /* if 1, off processor entries dropped */              \
29   MPI_Request   *send_waits;            /* array of send requests */                           \
30   MPI_Request   *recv_waits;            /* array of receive requests */                        \
31   PetscInt      nsends,nrecvs;         /* numbers of sends and receives */                     \
32   MatScalar     *svalues,*rvalues;     /* sending and receiving data */                        \
33   PetscInt      rmax;                   /* maximum message length */                           \
34   PETSCTABLE    colmap;                 /* local col number of off-diag col */                 \
35                                                                                                \
36   PetscInt     *garray;                /* work array */                                       \
37                                                                                                \
38   /* The following variable is used by blocked matrix assembly */                              \
39   MatScalar     *barray;                /* Block array of size bs2 */                          \
40                                                                                                \
41   /* The following variables are used for matrix-vector products */                            \
42                                                                                                \
43   Vec           lvec;              /* local vector */                                          \
44   VecScatter    Mvctx;             /* scatter context for vector */                            \
45   PetscTruth    roworiented;       /* if true, row-oriented input, default true */             \
46                                                                                                \
47   /* The following variables are for MatGetRow() */                                            \
48                                                                                                \
49   PetscInt      *rowindices;       /* column indices for row */                                \
50   PetscScalar   *rowvalues;        /* nonzero values in row */                                 \
51   PetscTruth    getrowactive;      /* indicates MatGetRow(), not restored */                   \
52                                                                                                \
53   /* Some variables to make MatSetValues and others more efficient */                          \
54   PetscInt      rstart_bs,rend_bs;                                                             \
55   PetscInt      cstart_bs,cend_bs;                                                             \
56   PetscInt      *ht;                      /* Hash table to speed up matrix assembly */         \
57   MatScalar     **hd;                     /* Hash table data */                                \
58   PetscInt      ht_size;                                                                       \
59   PetscInt      ht_total_ct,ht_insert_ct; /* Hash table statistics */                          \
60   PetscTruth    ht_flag;                  /* Flag to indicate if hash tables are used */       \
61   double        ht_fact;                  /* Factor to determine the HT size */                \
62                                                                                                \
63   PetscInt      setvalueslen;    /* only used for single precision computations */             \
64   MatScalar     *setvaluescopy; /* area double precision values in MatSetValuesXXX() are copied\
65                                       before calling MatSetValuesXXX_MPIBAIJ_MatScalar() */
66 
67 typedef struct {
68   MPIBAIJHEADER
69 } Mat_MPIBAIJ;
70 
71 EXTERN PetscErrorCode MatLoad_MPIBAIJ(PetscViewer,const MatType,Mat*);
72 EXTERN PetscErrorCode CreateColmap_MPIBAIJ_Private(Mat);
73 EXTERN PetscErrorCode MatGetSubMatrices_MPIBAIJ(Mat,PetscInt,const IS[],const IS[],MatReuse,Mat*[]);
74 #endif
75