1 2 #if !defined(__AIJ_H) 3 #define __AIJ_H 4 #include "src/mat/matimpl.h" 5 6 /* Info about i-nodes (identical nodes) */ 7 typedef struct { 8 PetscTruth use; 9 PetscInt node_count; /* number of inodes */ 10 PetscInt *size; /* size of each inode */ 11 PetscInt limit; /* inode limit */ 12 PetscInt max_limit; /* maximum supported inode limit */ 13 PetscTruth checked; /* if inodes have been checked for */ 14 } Mat_SeqAIJ_Inode; 15 16 /* Info about using compressed row format */ 17 typedef struct { 18 PetscTruth use; 19 PetscInt nrows; /* number of non-zero rows */ 20 PetscInt *i; /* compressed row pointer */ 21 PetscInt *rindex; /* compressed row index */ 22 PetscTruth checked; /* if compressed row format have been checked for */ 23 } Mat_SeqAIJ_CompressedRow; 24 25 /* 26 MATSEQAIJ format - Compressed row storage (also called Yale sparse matrix 27 format). The i[] and j[] arrays start at 0. For example, 28 j[i[k]+p] is the pth column in row k. Note that the diagonal 29 matrix elements are stored with the rest of the nonzeros (not separately). 30 */ 31 32 typedef struct { 33 PetscTruth sorted; /* if true, rows are sorted by increasing columns */ 34 PetscTruth roworiented; /* if true, row-oriented input, default */ 35 PetscInt nonew; /* 1 don't add new nonzeros, -1 generate error on new */ 36 PetscTruth singlemalloc; /* if true a, i, and j have been obtained with 37 one big malloc */ 38 PetscTruth freedata; /* free the i,j,a data when the matrix is destroyed; true by default */ 39 PetscInt nz,maxnz; /* nonzeros, allocated nonzeros */ 40 PetscInt *diag; /* pointers to diagonal elements */ 41 PetscInt *i; /* pointer to beginning of each row */ 42 PetscInt *imax; /* maximum space allocated for each row */ 43 PetscInt *ilen; /* actual length of each row */ 44 PetscInt *j; /* column values: j + i[k] - 1 is start of row k */ 45 PetscScalar *a; /* nonzero elements */ 46 IS row,col,icol; /* index sets, used for reorderings */ 47 PetscScalar *solve_work; /* work space used in MatSolve */ 48 Mat_SeqAIJ_Inode inode; /* identical node informaton */ 49 Mat_SeqAIJ_CompressedRow compressedrow; /* use compressed row format */ 50 PetscInt reallocs; /* number of mallocs done during MatSetValues() 51 as more values are set than were prealloced */ 52 PetscInt rmax; /* max nonzeros in any row */ 53 PetscTruth ilu_preserve_row_sums; 54 PetscReal lu_dtcol; 55 PetscReal lu_damping; 56 PetscReal lu_shift; /* Manteuffel shift switch, fraction */ 57 PetscReal lu_shift_fraction; 58 PetscReal lu_zeropivot; 59 PetscScalar *saved_values; /* location for stashing nonzero values of matrix */ 60 PetscScalar *idiag,*ssor; /* inverse of diagonal entries; space for eisen */ 61 62 PetscTruth keepzeroedrows; /* keeps matrix structure same in calls to MatZeroRows()*/ 63 PetscTruth ignorezeroentries; 64 ISColoring coloring; /* set with MatADSetColoring() used by MatADSetValues() */ 65 Mat sbaijMat; /* mat in sbaij format */ 66 67 PetscInt *xtoy,*xtoyB; /* map nonzero pattern of X into Y's, used by MatAXPY() */ 68 Mat XtoY; /* used by MatAXPY() */ 69 } Mat_SeqAIJ; 70 71 EXTERN PetscErrorCode MatILUFactorSymbolic_SeqAIJ(Mat,IS,IS,MatFactorInfo*,Mat *); 72 EXTERN PetscErrorCode MatICCFactorSymbolic_SeqAIJ(Mat,IS,MatFactorInfo*,Mat *); 73 EXTERN PetscErrorCode MatCholeskyFactorSymbolic_SeqAIJ(Mat,IS,MatFactorInfo*,Mat*); 74 EXTERN PetscErrorCode MatCholeskyFactorNumeric_SeqAIJ(Mat,Mat *); 75 EXTERN PetscErrorCode MatDuplicate_SeqAIJ(Mat,MatDuplicateOption,Mat*); 76 EXTERN PetscErrorCode MatMissingDiagonal_SeqAIJ(Mat); 77 EXTERN PetscErrorCode MatMarkDiagonal_SeqAIJ(Mat); 78 79 EXTERN PetscErrorCode MatMult_SeqAIJ(Mat A,Vec,Vec); 80 EXTERN PetscErrorCode MatMultAdd_SeqAIJ(Mat A,Vec,Vec,Vec); 81 EXTERN PetscErrorCode MatMultTranspose_SeqAIJ(Mat A,Vec,Vec); 82 EXTERN PetscErrorCode MatMultTransposeAdd_SeqAIJ(Mat A,Vec,Vec,Vec); 83 EXTERN PetscErrorCode MatRelax_SeqAIJ(Mat,Vec,PetscReal,MatSORType,PetscReal,PetscInt,PetscInt,Vec); 84 85 EXTERN PetscErrorCode MatSetColoring_SeqAIJ(Mat,ISColoring); 86 EXTERN PetscErrorCode MatSetValuesAdic_SeqAIJ(Mat,void*); 87 EXTERN PetscErrorCode MatSetValuesAdifor_SeqAIJ(Mat,PetscInt,void*); 88 89 EXTERN PetscErrorCode MatGetSymbolicTranspose_SeqAIJ(Mat,PetscInt *[],PetscInt *[]); 90 EXTERN PetscErrorCode MatGetSymbolicTransposeReduced_SeqAIJ(Mat,PetscInt,PetscInt,PetscInt *[],PetscInt *[]); 91 EXTERN PetscErrorCode MatRestoreSymbolicTranspose_SeqAIJ(Mat,PetscInt *[],PetscInt *[]); 92 EXTERN PetscErrorCode MatToSymmetricIJ_SeqAIJ(PetscInt,PetscInt*,PetscInt*,PetscInt,PetscInt,PetscInt**,PetscInt**); 93 EXTERN PetscErrorCode Mat_AIJ_CheckInode(Mat,PetscTruth); 94 EXTERN PetscErrorCode Mat_AIJ_CheckCompressedRow(Mat,PetscTruth); 95 EXTERN PetscErrorCode MatLUFactorSymbolic_SeqAIJ(Mat,IS,IS,MatFactorInfo*,Mat*); 96 EXTERN PetscErrorCode MatLUFactorNumeric_SeqAIJ(Mat,Mat*); 97 EXTERN PetscErrorCode MatLUFactor_SeqAIJ(Mat,IS,IS,MatFactorInfo*); 98 EXTERN PetscErrorCode MatSolve_SeqAIJ(Mat,Vec,Vec); 99 EXTERN PetscErrorCode MatSolveAdd_SeqAIJ(Mat,Vec,Vec,Vec); 100 EXTERN PetscErrorCode MatSolveTranspose_SeqAIJ(Mat,Vec,Vec); 101 EXTERN PetscErrorCode MatSolveTransposeAdd_SeqAIJ(Mat,Vec,Vec,Vec); 102 EXTERN PetscErrorCode MatEqual_SeqAIJ(Mat A,Mat B,PetscTruth* flg); 103 EXTERN PetscErrorCode MatFDColoringCreate_SeqAIJ(Mat,ISColoring,MatFDColoring); 104 EXTERN PetscErrorCode MatILUDTFactor_SeqAIJ(Mat,MatFactorInfo*,IS,IS,Mat*); 105 EXTERN PetscErrorCode MatLoad_SeqAIJ(PetscViewer,const MatType,Mat*); 106 EXTERN PetscErrorCode RegisterApplyPtAPRoutines_Private(Mat); 107 EXTERN PetscErrorCode MatMatMult_SeqAIJ_SeqAIJ(Mat,Mat,MatReuse,PetscReal,Mat*); 108 EXTERN PetscErrorCode MatMatMultSymbolic_SeqAIJ_SeqAIJ(Mat,Mat,PetscReal,Mat*); 109 EXTERN PetscErrorCode MatMatMultNumeric_SeqAIJ_SeqAIJ(Mat,Mat,Mat); 110 EXTERN PetscErrorCode MatPtAP_SeqAIJ_SeqAIJ(Mat,Mat,MatReuse,PetscReal,Mat*); 111 EXTERN PetscErrorCode MatPtAPSymbolic_SeqAIJ_SeqAIJ(Mat,Mat,PetscReal,Mat*); 112 EXTERN PetscErrorCode MatPtAPNumeric_SeqAIJ_SeqAIJ(Mat,Mat,Mat); 113 EXTERN PetscErrorCode MatMatMultTranspose_SeqAIJ_SeqAIJ(Mat,Mat,MatReuse,PetscReal,Mat*); 114 EXTERN PetscErrorCode MatMatMultTransposeSymbolic_SeqAIJ_SeqAIJ(Mat,Mat,PetscReal,Mat*); 115 EXTERN PetscErrorCode MatMatMultTransposeNumeric_SeqAIJ_SeqAIJ(Mat,Mat,Mat); 116 EXTERN PetscErrorCode MatSetValues_SeqAIJ(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[],const PetscScalar[],InsertMode); 117 EXTERN PetscErrorCode MatGetRow_SeqAIJ(Mat,PetscInt,PetscInt*,PetscInt**,PetscScalar**); 118 EXTERN PetscErrorCode MatRestoreRow_SeqAIJ(Mat,PetscInt,PetscInt*,PetscInt**,PetscScalar**); 119 EXTERN PetscErrorCode MatPrintHelp_SeqAIJ(Mat); 120 EXTERN PetscErrorCode MatAXPY_SeqAIJ(const PetscScalar[],Mat,Mat,MatStructure); 121 122 EXTERN_C_BEGIN 123 EXTERN PetscErrorCode MatConvert_SeqAIJ_SeqSBAIJ(Mat,const MatType,Mat*); 124 EXTERN PetscErrorCode MatConvert_SeqAIJ_SeqBAIJ(Mat,const MatType,Mat*); 125 EXTERN PetscErrorCode MatReorderForNonzeroDiagonal_SeqAIJ(Mat,PetscReal,IS,IS); 126 EXTERN PetscErrorCode MatAdjustForInodes_SeqAIJ(Mat,IS*,IS*); 127 EXTERN PetscErrorCode MatSeqAIJGetInodeSizes_SeqAIJ(Mat,PetscInt*,PetscInt*[],PetscInt*); 128 EXTERN_C_END 129 130 #endif 131