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