xref: /petsc/src/mat/impls/aij/seq/aij.h (revision c4ac5f5fc01a91c2bb048584e85ba147c7d8a938)
1 /* $Id: aij.h,v 1.37 2000/01/11 21:00:37 bsmith Exp bsmith $ */
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 } Mat_SeqAIJ_Inode;
16 
17 /*
18   MATSEQAIJ format - Compressed row storage (also called Yale sparse matrix
19   format), compatible with Fortran.  The i[] and j[] arrays start at 1,
20   or 0, depending on the value of shift.  For example, in Fortran
21   j[i[k]+p+shift] 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              m,n;             /* rows, columns */
33   int              nz,maxnz;        /* nonzeros, allocated nonzeros */
34   int              *diag;            /* pointers to diagonal elements */
35   int              *i;               /* pointer to beginning of each row */
36   int              *imax;            /* maximum space allocated for each row */
37   int              *ilen;            /* actual length of each row */
38   int              *j;               /* column values: j + i[k] - 1 is start of row k */
39   Scalar           *a;               /* nonzero elements */
40   IS               row,col,icol;   /* index sets, used for reorderings */
41   Scalar           *solve_work;      /* work space used in MatSolve */
42   void             *spptr;           /* pointer for special library like SuperLU */
43   int              indexshift;       /* zero or -one for C or Fortran indexing */
44   Mat_SeqAIJ_Inode inode;            /* identical node informaton */
45   int              reallocs;         /* number of mallocs done during MatSetValues()
46                                         as more values are set than were prealloced */
47   int              rmax;             /* max nonzeros in any row */
48   PetscTruth       ilu_preserve_row_sums;
49   Scalar           *saved_values;    /* location for stashing nonzero values of matrix */
50   Scalar           *idiag,*ssor;     /* inverse of diagonal entries; space for eisen */
51 
52   PetscTruth       keepzeroedrows;   /* keeps matrix structure same in calls to MatZeroRows()*/
53   PetscTruth       ignorezeroentries;
54 } Mat_SeqAIJ;
55 
56 extern int MatILUFactorSymbolic_SeqAIJ(Mat,IS,IS,MatILUInfo*,Mat *);
57 extern int MatConvert_SeqAIJ(Mat,MatType,Mat *);
58 extern int MatDuplicate_SeqAIJ(Mat,MatDuplicateOption,Mat*);
59 extern int MatMarkDiagonal_SeqAIJ(Mat);
60 
61 extern int MatMult_SeqAIJ(Mat A,Vec,Vec);
62 extern int MatMultAdd_SeqAIJ(Mat A,Vec,Vec,Vec);
63 extern int MatMultTranspose_SeqAIJ(Mat A,Vec,Vec);
64 extern int MatMultTransposeAdd_SeqAIJ(Mat A,Vec,Vec,Vec);
65 extern int MatRelax_SeqAIJ(Mat,Vec,double,MatSORType,double,int,Vec);
66 
67 #endif
68