1e8823a70SSatish Balay 26524c165SJacob Faibussowitsch #ifndef __MPIBAIJ_H 379bdfe76SSatish Balay #define __MPIBAIJ_H 4c6db04a5SJed Brown #include <../src/mat/impls/baij/seq/baij.h> 5001ddc4fSHong Zhang #include <../src/mat/impls/aij/mpi/mpiaij.h> 6*eec179cfSJacob Faibussowitsch #include <petsc/private/hashmapi.h> 779bdfe76SSatish Balay 8aa482453SBarry Smith #if defined(PETSC_USE_CTABLE) 9*eec179cfSJacob Faibussowitsch #define PETSCTABLE PetscHMapI 1032b39ab2SSatish Balay #else 11b24ad042SBarry Smith #define PETSCTABLE PetscInt * 1232b39ab2SSatish Balay #endif 13e8823a70SSatish Balay 146c6c5352SBarry Smith #define MPIBAIJHEADER \ 15d0f46423SBarry Smith PetscInt *rangebs; /* rmap->range/bs */ \ 16899cda47SBarry Smith PetscInt rstartbs, rendbs, cstartbs, cendbs; /* map values / bs */ \ 171d18e487SKris Buschelman Mat A, B; /* local submatrices: A (diag part), B (off-diag part) */ \ 18b24ad042SBarry Smith PetscMPIInt size; /* size of communicator */ \ 19b24ad042SBarry Smith PetscMPIInt rank; /* rank of proc in communicator */ \ 20521d7252SBarry Smith PetscInt bs2; /* block size, bs2 = bs*bs */ \ 21b24ad042SBarry Smith PetscInt Mbs, Nbs; /* number block rows/cols in matrix; M/bs, N/bs */ \ 22b24ad042SBarry Smith PetscInt mbs, nbs; /* number block rows/cols on processor; m/bs, n/bs */ \ 236c6c5352SBarry Smith \ 246c6c5352SBarry Smith /* The following variables are used for matrix assembly */ \ 256c6c5352SBarry Smith \ 26ace3abfcSBarry Smith PetscBool donotstash; /* if 1, off processor entries dropped */ \ 2797da8949SJed Brown PetscBool subset_off_proc_entries; /* PETSC_TRUE if assembly will always communicate a subset of the entries communicated the first time */ \ 286c6c5352SBarry Smith MPI_Request *send_waits; /* array of send requests */ \ 296c6c5352SBarry Smith MPI_Request *recv_waits; /* array of receive requests */ \ 30b24ad042SBarry Smith PetscInt nsends, nrecvs; /* numbers of sends and receives */ \ 316c6c5352SBarry Smith MatScalar *svalues, *rvalues; /* sending and receiving data */ \ 32b24ad042SBarry Smith PetscInt rmax; /* maximum message length */ \ 336c6c5352SBarry Smith PETSCTABLE colmap; /* local col number of off-diag col */ \ 346c6c5352SBarry Smith \ 35b24ad042SBarry Smith PetscInt *garray; /* work array */ \ 366c6c5352SBarry Smith \ 376c6c5352SBarry Smith /* The following variable is used by blocked matrix assembly */ \ 386c6c5352SBarry Smith MatScalar *barray; /* Block array of size bs2 */ \ 396c6c5352SBarry Smith \ 406c6c5352SBarry Smith /* The following variables are used for matrix-vector products */ \ 416c6c5352SBarry Smith \ 426c6c5352SBarry Smith Vec lvec; /* local vector */ \ 436c6c5352SBarry Smith VecScatter Mvctx; /* scatter context for vector */ \ 44ace3abfcSBarry Smith PetscBool roworiented; /* if true, row-oriented input, default true */ \ 456c6c5352SBarry Smith \ 466c6c5352SBarry Smith /* The following variables are for MatGetRow() */ \ 476c6c5352SBarry Smith \ 48b24ad042SBarry Smith PetscInt *rowindices; /* column indices for row */ \ 496c6c5352SBarry Smith PetscScalar *rowvalues; /* nonzero values in row */ \ 50ace3abfcSBarry Smith PetscBool getrowactive; /* indicates MatGetRow(), not restored */ \ 516c6c5352SBarry Smith \ 526c6c5352SBarry Smith /* Some variables to make MatSetValues and others more efficient */ \ 53b24ad042SBarry Smith PetscInt rstart_bs, rend_bs; \ 54b24ad042SBarry Smith PetscInt cstart_bs, cend_bs; \ 55b24ad042SBarry Smith PetscInt *ht; /* Hash table to speed up matrix assembly */ \ 566c6c5352SBarry Smith MatScalar **hd; /* Hash table data */ \ 57b24ad042SBarry Smith PetscInt ht_size; \ 58b24ad042SBarry Smith PetscInt ht_total_ct, ht_insert_ct; /* Hash table statistics */ \ 59ace3abfcSBarry Smith PetscBool ht_flag; /* Flag to indicate if hash tables are used */ \ 606c6c5352SBarry Smith double ht_fact; /* Factor to determine the HT size */ \ 616c6c5352SBarry Smith \ 62b24ad042SBarry Smith PetscInt setvalueslen; /* only used for single precision computations */ \ 637a868f3eSHong Zhang MatScalar *setvaluescopy; /* area double precision values in MatSetValuesXXX() are copied*/ \ 647a868f3eSHong Zhang /* before calling MatSetValuesXXX_MPIBAIJ_MatScalar() */ \ 657dae84e0SHong Zhang PetscBool ijonly /* used in MatCreateSubMatrices_MPIBAIJ_local() for getting ij structure only */ 66ab9863d7SBarry Smith 676c6c5352SBarry Smith typedef struct { 681d18e487SKris Buschelman MPIBAIJHEADER; 69e8823a70SSatish Balay } Mat_MPIBAIJ; 7079bdfe76SSatish Balay 71b51a4376SLisandro Dalcin PETSC_INTERN PetscErrorCode MatView_MPIBAIJ(Mat, PetscViewer); 725a576424SJed Brown PETSC_INTERN PetscErrorCode MatLoad_MPIBAIJ(Mat, PetscViewer); 73b51a4376SLisandro Dalcin PETSC_INTERN PetscErrorCode MatView_MPIBAIJ_Binary(Mat, PetscViewer); 74b51a4376SLisandro Dalcin PETSC_INTERN PetscErrorCode MatLoad_MPIBAIJ_Binary(Mat, PetscViewer); 75b51a4376SLisandro Dalcin 765a576424SJed Brown PETSC_INTERN PetscErrorCode MatCreateColmap_MPIBAIJ_Private(Mat); 777dae84e0SHong Zhang PETSC_INTERN PetscErrorCode MatCreateSubMatrices_MPIBAIJ(Mat, PetscInt, const IS[], const IS[], MatReuse, Mat *[]); 787dae84e0SHong Zhang PETSC_INTERN PetscErrorCode MatCreateSubMatrices_MPIBAIJ_local(Mat, PetscInt, const IS[], const IS[], MatReuse, Mat *); 797dae84e0SHong Zhang PETSC_INTERN PetscErrorCode MatCreateSubMatrix_MPIBAIJ_Private(Mat, IS, IS, PetscInt, MatReuse, Mat *); 80e8271787SHong Zhang PETSC_INTERN PetscErrorCode MatGetMultiProcBlock_MPIBAIJ(Mat, MPI_Comm, MatReuse, Mat *); 815a576424SJed Brown PETSC_INTERN PetscErrorCode MatIncreaseOverlap_MPIBAIJ(Mat, PetscInt, IS[], PetscInt); 825a576424SJed Brown PETSC_INTERN PetscErrorCode MatIncreaseOverlap_MPIBAIJ_Once(Mat, PetscInt, IS *); 83b5b72c8aSIrina Sokolova PETSC_INTERN PetscErrorCode MatMPIBAIJSetPreallocation_MPIBAIJ(Mat B, PetscInt bs, PetscInt d_nz, const PetscInt *d_nnz, PetscInt o_nz, const PetscInt *o_nnz); 844de5dceeSHong Zhang PETSC_INTERN PetscErrorCode MatAXPYGetPreallocation_MPIBAIJ(Mat, const PetscInt *, Mat, const PetscInt *, PetscInt *); 852726fb6dSPierre Jolivet 862726fb6dSPierre Jolivet PETSC_INTERN PetscErrorCode MatConjugate_SeqBAIJ(Mat); 8779bdfe76SSatish Balay #endif 88