173f4d377SMatthew Knepley /* $Id: mpibaij.h,v 1.30 2001/08/07 03:02:58 balay Exp $ */ 2e8823a70SSatish Balay 3e8823a70SSatish Balay 479bdfe76SSatish Balay #if !defined(__MPIBAIJ_H) 579bdfe76SSatish Balay #define __MPIBAIJ_H 6c833c1fbSBarry Smith #include "src/mat/impls/baij/seq/baij.h" 7c833c1fbSBarry Smith #include "src/sys/ctable.h" 879bdfe76SSatish Balay 9aa482453SBarry Smith #if defined (PETSC_USE_CTABLE) 10*c66d48e9SBarry Smith #define PETSCTABLE PetscTable 1132b39ab2SSatish Balay #else 126c6c5352SBarry Smith #define PETSCTABLE int* 1332b39ab2SSatish Balay #endif 14e8823a70SSatish Balay 156c6c5352SBarry Smith #define MPIBAIJHEADER \ 166c6c5352SBarry Smith int *rowners,*cowners; /* ranges owned by each processor, in blocks */ \ 176c6c5352SBarry Smith int *rowners_bs; /* rowners*bs */ \ 186c6c5352SBarry Smith int rstart,rend; /* starting and ending owned rows */ \ 196c6c5352SBarry Smith int cstart,cend; /* starting and ending owned columns */ \ 206c6c5352SBarry Smith Mat A,B; /* local submatrices: A (diag part), \ 216c6c5352SBarry Smith B (off-diag part) */ \ 226c6c5352SBarry Smith int size; /* size of communicator */ \ 236c6c5352SBarry Smith int rank; /* rank of proc in communicator */ \ 246c6c5352SBarry Smith int bs,bs2; /* block size, bs2 = bs*bs */ \ 256c6c5352SBarry Smith int Mbs,Nbs; /* number block rows/cols in matrix; M/bs, N/bs */ \ 266c6c5352SBarry Smith int mbs,nbs; /* number block rows/cols on processor; m/bs, n/bs */ \ 276c6c5352SBarry Smith \ 286c6c5352SBarry Smith /* The following variables are used for matrix assembly */ \ 296c6c5352SBarry Smith \ 306c6c5352SBarry Smith PetscTruth donotstash; /* if 1, off processor entries dropped */ \ 316c6c5352SBarry Smith MPI_Request *send_waits; /* array of send requests */ \ 326c6c5352SBarry Smith MPI_Request *recv_waits; /* array of receive requests */ \ 336c6c5352SBarry Smith int nsends,nrecvs; /* numbers of sends and receives */ \ 346c6c5352SBarry Smith MatScalar *svalues,*rvalues; /* sending and receiving data */ \ 356c6c5352SBarry Smith int rmax; /* maximum message length */ \ 366c6c5352SBarry Smith PETSCTABLE colmap; /* local col number of off-diag col */ \ 376c6c5352SBarry Smith \ 386c6c5352SBarry Smith int *garray; /* work array */ \ 396c6c5352SBarry Smith \ 406c6c5352SBarry Smith /* The following variable is used by blocked matrix assembly */ \ 416c6c5352SBarry Smith MatScalar *barray; /* Block array of size bs2 */ \ 426c6c5352SBarry Smith \ 436c6c5352SBarry Smith /* The following variables are used for matrix-vector products */ \ 446c6c5352SBarry Smith \ 456c6c5352SBarry Smith Vec lvec; /* local vector */ \ 466c6c5352SBarry Smith VecScatter Mvctx; /* scatter context for vector */ \ 476c6c5352SBarry Smith PetscTruth roworiented; /* if true, row-oriented input, default true */ \ 486c6c5352SBarry Smith \ 496c6c5352SBarry Smith /* The following variables are for MatGetRow() */ \ 506c6c5352SBarry Smith \ 516c6c5352SBarry Smith int *rowindices; /* column indices for row */ \ 526c6c5352SBarry Smith PetscScalar *rowvalues; /* nonzero values in row */ \ 536c6c5352SBarry Smith PetscTruth getrowactive; /* indicates MatGetRow(), not restored */ \ 546c6c5352SBarry Smith \ 556c6c5352SBarry Smith /* Some variables to make MatSetValues and others more efficient */ \ 566c6c5352SBarry Smith int rstart_bs,rend_bs; \ 576c6c5352SBarry Smith int cstart_bs,cend_bs; \ 586c6c5352SBarry Smith int *ht; /* Hash table to speed up matrix assembly */ \ 596c6c5352SBarry Smith MatScalar **hd; /* Hash table data */ \ 606c6c5352SBarry Smith int ht_size; \ 616c6c5352SBarry Smith int ht_total_ct,ht_insert_ct; /* Hash table statistics */ \ 626c6c5352SBarry Smith PetscTruth ht_flag; /* Flag to indicate if hash tables are used */ \ 636c6c5352SBarry Smith double ht_fact; /* Factor to determine the HT size */ \ 646c6c5352SBarry Smith \ 656c6c5352SBarry Smith int setvalueslen; /* only used for single precision computations */ \ 666c6c5352SBarry Smith MatScalar *setvaluescopy; /* area double precision values in MatSetValuesXXX() are copied\ 67a377f70aSBarry Smith before calling MatSetValuesXXX_MPIBAIJ_MatScalar() */ 686c6c5352SBarry Smith 696c6c5352SBarry Smith typedef struct { 706c6c5352SBarry Smith MPIBAIJHEADER 71e8823a70SSatish Balay } Mat_MPIBAIJ; 7279bdfe76SSatish Balay 73c2999512SBarry Smith EXTERN int MatLoad_MPIBAIJ(PetscViewer,const MatType,Mat*); 74653e4784SBarry Smith EXTERN int CreateColmap_MPIBAIJ_Private(Mat); 75a5e6ed63SBarry Smith EXTERN int MatGetSubMatrices_MPIBAIJ(Mat,int,const IS[],const IS[],MatReuse,Mat*[]); 7679bdfe76SSatish Balay #endif 77