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