xref: /petsc/src/mat/impls/dense/mpi/mpidense.h (revision 292f8084fb157dadf9a2ae26c5bd14368ed7ffcb)
1 
2 #include "src/mat/impls/dense/seq/dense.h"
3 
4   /*  Data stuctures for basic parallel dense matrix  */
5 
6 /* Structure to hold the information for factorization of a dense matrix */
7 /* Most of this info is used in the pipe send/recv routines */
8 typedef struct {
9   int    nlnr;        /* number of local rows downstream */
10   int    nrend;       /* rend for downstream processor */
11   int    nbr,pnbr;   /* Down and upstream neighbors */
12   int    *tag;        /* message tags */
13   int    currow;      /* current row number */
14   int    phase;       /* phase (used to indicate tag) */
15   int    up;          /* Are we moving up or down in row number? */
16   int    use_bcast;   /* Are we broadcasting max length? */
17   int    nsend;       /* number of sends */
18   int    nrecv;       /* number of receives */
19 
20   /* data initially in matrix context */
21   int    k;           /* Blocking factor (unused as yet) */
22   int    k2;          /* Blocking factor for solves */
23   PetscScalar *temp;
24   int    nlptr;
25   int    *lrows;
26   int    *nlrows;
27   int    *pivots;
28 } FactorCtx;
29 
30 #define PIPEPHASE (ctx->phase == 0)
31 
32 typedef struct {
33   int           *rowners,*cowners;     /* ranges owned by each processor */
34                                         /* note n == N */
35   int           nvec;                   /* this is the n size for the vector one multiplies with */
36   int           rstart,rend;           /* starting and ending owned rows */
37   Mat           A;                      /* local submatrix */
38   int           size;                   /* size of communicator */
39   int           rank;                   /* rank of proc in communicator */
40   /* The following variables are used for matrix assembly */
41   PetscTruth    donotstash;             /* Flag indicationg if values should be stashed */
42   MPI_Request   *send_waits;            /* array of send requests */
43   MPI_Request   *recv_waits;            /* array of receive requests */
44   int           nsends,nrecvs;         /* numbers of sends and receives */
45   PetscScalar   *svalues,*rvalues;     /* sending and receiving data */
46   int           rmax;                   /* maximum message length */
47 
48   /* The following variables are used for matrix-vector products */
49 
50   Vec           lvec;                   /* local vector */
51   VecScatter    Mvctx;                  /* scatter context for vector */
52 
53   PetscTruth    roworiented;            /* if true, row oriented input (default) */
54   FactorCtx     *factor;                /* factorization context */
55 } Mat_MPIDense;
56 
57 EXTERN PetscErrorCode MatLoad_MPIDense(PetscViewer,const MatType,Mat*);
58 EXTERN PetscErrorCode MatSetUpMultiply_MPIDense(Mat);
59 EXTERN PetscErrorCode MatGetSubMatrices_MPIDense(Mat,int,const IS[],const IS[],MatReuse,Mat *[]);
60