xref: /petsc/src/mat/impls/aij/seq/aij.h (revision 63b9fa5e258ef37d5bcff491ebacde33f30ed49b)
1 /* $Id: aij.h,v 1.46 2001/08/07 03:02:47 balay Exp $ */
2 
3 #include "src/mat/matimpl.h"
4 
5 #if !defined(__AIJ_H)
6 #define __AIJ_H
7 
8 /* Info about i-nodes (identical nodes) */
9 typedef struct {
10   PetscTruth use;
11   int        node_count;                    /* number of inodes */
12   int        *size;                         /* size of each inode */
13   int        limit;                         /* inode limit */
14   int        max_limit;                     /* maximum supported inode limit */
15   PetscTruth checked;                       /* if inodes have been checked for */
16 } Mat_SeqAIJ_Inode;
17 
18 /*
19   MATSEQAIJ format - Compressed row storage (also called Yale sparse matrix
20   format).  The i[] and j[] arrays start at 0. For example,
21   j[i[k]+p] is the pth column in row k.  Note that the diagonal
22   matrix elements are stored with the rest of the nonzeros (not separately).
23 */
24 
25 typedef struct {
26   PetscTruth       sorted;           /* if true, rows are sorted by increasing columns */
27   PetscTruth       roworiented;      /* if true, row-oriented input, default */
28   int              nonew;            /* 1 don't add new nonzeros, -1 generate error on new */
29   PetscTruth       singlemalloc;     /* if true a, i, and j have been obtained with
30                                           one big malloc */
31   PetscTruth       freedata;        /* free the i,j,a data when the matrix is destroyed; true by default */
32   int              nz,maxnz;        /* nonzeros, allocated nonzeros */
33   int              *diag;            /* pointers to diagonal elements */
34   int              *i;               /* pointer to beginning of each row */
35   int              *imax;            /* maximum space allocated for each row */
36   int              *ilen;            /* actual length of each row */
37   int              *j;               /* column values: j + i[k] - 1 is start of row k */
38   PetscScalar      *a;               /* nonzero elements */
39   IS               row,col,icol;   /* index sets, used for reorderings */
40   PetscScalar      *solve_work;      /* work space used in MatSolve */
41   Mat_SeqAIJ_Inode inode;            /* identical node informaton */
42   int              reallocs;         /* number of mallocs done during MatSetValues()
43                                         as more values are set than were prealloced */
44   int              rmax;             /* max nonzeros in any row */
45   PetscTruth       ilu_preserve_row_sums;
46   PetscReal        lu_dtcol;
47   PetscReal        lu_damping;
48   PetscReal        lu_shift;         /* Manteuffel shift switch, fraction */
49   PetscReal        lu_shift_fraction;
50   PetscReal        lu_zeropivot;
51   PetscScalar      *saved_values;    /* location for stashing nonzero values of matrix */
52   PetscScalar      *idiag,*ssor;     /* inverse of diagonal entries; space for eisen */
53 
54   PetscTruth       keepzeroedrows;   /* keeps matrix structure same in calls to MatZeroRows()*/
55   PetscTruth       ignorezeroentries;
56   ISColoring       coloring;         /* set with MatADSetColoring() used by MatADSetValues() */
57   Mat              sbaijMat;         /* mat in sbaij format */
58 
59   int              *xtoy,*xtoyB;     /* map nonzero pattern of X into Y's, used by MatAXPY() */
60   Mat              XtoY;             /* used by MatAXPY() */
61 } Mat_SeqAIJ;
62 
63 EXTERN int MatILUFactorSymbolic_SeqAIJ(Mat,IS,IS,MatFactorInfo*,Mat *);
64 EXTERN int MatICCFactorSymbolic_SeqAIJ(Mat,IS,MatFactorInfo*,Mat *);
65 EXTERN int MatCholeskyFactorSymbolic_SeqAIJ(Mat,IS,MatFactorInfo*,Mat*);
66 EXTERN int MatCholeskyFactorNumeric_SeqAIJ(Mat,Mat *);
67 EXTERN int MatDuplicate_SeqAIJ(Mat,MatDuplicateOption,Mat*);
68 EXTERN int MatMarkDiagonal_SeqAIJ(Mat);
69 
70 EXTERN int MatMult_SeqAIJ(Mat A,Vec,Vec);
71 EXTERN int MatMultAdd_SeqAIJ(Mat A,Vec,Vec,Vec);
72 EXTERN int MatMultTranspose_SeqAIJ(Mat A,Vec,Vec);
73 EXTERN int MatMultTransposeAdd_SeqAIJ(Mat A,Vec,Vec,Vec);
74 EXTERN int MatRelax_SeqAIJ(Mat,Vec,PetscReal,MatSORType,PetscReal,int,int,Vec);
75 
76 EXTERN int MatSetColoring_SeqAIJ(Mat,ISColoring);
77 EXTERN int MatSetValuesAdic_SeqAIJ(Mat,void*);
78 EXTERN int MatSetValuesAdifor_SeqAIJ(Mat,int,void*);
79 
80 EXTERN int MatGetSymbolicTranspose_SeqAIJ(Mat,int *[],int *[]);
81 EXTERN int MatRestoreSymbolicTranspose_SeqAIJ(Mat,int *[],int *[]);
82 
83 #endif
84