ParMooN
 All Classes Functions Variables Friends Pages
amg_sp.h
1 /****************************************************************************/
2 /* */
3 /* File: amg_sp.h */
4 /* */
5 /* Purpose: interface to sparse matrix/vector data structure for amg */
6 /* */
7 /* Author: Peter Bastian */
8 /* Institut fuer Computeranwendungen III */
9 /* Universitaet Stuttgart */
10 /* Pfaffenwaldring 27 */
11 /* 70550 Stuttgart */
12 /* email: peter@ica3.uni-stuttgart.de */
13 /* phone: 0049-(0)711-685-7003 */
14 /* fax : 0049-(0)711-685-7000 */
15 /* */
16 /* History: 01 FEB 1996 Begin */
17 /* 30 SEP 1997 redesign */
18 /* */
19 /* Remarks: */
20 /* */
21 /* Author: Volker John */
22 /* Otto--von--Guericke Universitaet Magdeburg */
23 /* Institut fuer Analysis und Numerik */
24 /* Postfach 4120 */
25 /* 39016 Magdeburg */
26 /* email : volker.john@mathematik.uni-magdeburg.de */
27 /* */
28 /* History: 1998/04/28 start changing structures for solving saddle */
29 /* point problems */
30 /* */
31 /* Remarks: */
32 /* */
33 /****************************************************************************/
34 
35 
36 /****************************************************************************/
37 /* */
38 /* auto include mechanism and other include files */
39 /* */
40 /****************************************************************************/
41 
42 #ifndef __AMG_SP__
43 #define __AMG_SP__
44 
45 #include "amg_header.h"
46 
47 /****************************************************************************/
48 /* */
49 /* defines in the following order */
50 /* */
51 /* compile time constants defining static data size (i.e. arrays) */
52 /* other constants */
53 /* macros */
54 /* */
55 /****************************************************************************/
56 
57 #define AMG_LINES_PER_PAGE 60 /* repeat legend every this line */
58 #define AMG_COLS_PER_LINE 3 /* matrix entries per line */
59 
60 /****************************************************************************/
61 /* */
62 /* data structures exported by the corresponding source file */
63 /* */
64 /****************************************************************************/
65 
66 /****************************************************************************/
67 /******** a block vector, i.e. n*blocksize entries ***********************/
68 /****************************************************************************/
69 
70 struct amg_vector
71 { /* data + ptr to nodes structure */
72  char name[AMG_NAME_SIZE]; /* name of this vector */
73  int n; /* dimension of vector in blocks */
74  int b; /* dimension of block */
75  double *x; /* n*b doubles */
76 } ;
77 typedef
78 struct amg_vector AMG_VECTOR; /* a whole vector */
79 
80 /****************************************************************************/
81 /******** functions for vectors *****************/
82 /****************************************************************************/
83 
84 #define AMG_VECTOR_NAME(p) ((p)->name)
85 #define AMG_VECTOR_N(p) ((p)->n)
86 #define AMG_VECTOR_B(p) ((p)->b)
87 #define AMG_VECTOR_X(p) ((p)->x)
88 #define AMG_VECTOR_ENTRY(p,i,ii) ((p)->x[(i)*(p)->b+(ii)])
89 
90 AMG_VECTOR *AMG_NewVector (int n, int b, char *name);
91 
92 /****************************************************************************/
93 /******** pattern of a general m x n sparse block matrix *****************/
94 /****************************************************************************/
95 
96 struct amg_matrix
97 { /* combines all links */
98  char name[AMG_NAME_SIZE]; /* name of this matrix */
99  int m; /* number of lines */
100  int n; /* number of columns */
101  int b; /* dimension of blocks: b x b */
102  int bb; /* block size in doubles: ie bs=b*b */
103  int system_as_scalar; /* system treated as scalars if = 1 */
104  int blocks_in_diag; /* matrix is a block of block diag matrix with blocks_in_diag blocks*/
105  int bandwidth; /* bandwidth of the matrix */
106  int nonzeros; /* number of nonzero blocks allocated */
107  int connections; /* nonzeros actually used */
108  int active; /* active dof (inner + Neumann) */
109  int level; /* number of level */
110  int *ra; /* ra[i]: index of first entry of row i */
111  int *ja; /* aj[k]: col index of entry k */
112  double *a; /* the matrix */
113  int *ratr; /* index of first entry of column i for transposed matrix*/
114  int *jatr; /* aj[k]: row index of transposed matris */
115  int *postr; /* position index of transposed matris */
116 } ;
117 typedef
118 struct amg_matrix AMG_MATRIX; /* a matrix */
119 
120 /****************************************************************************/
121 /******** functions for vectors *****************/
122 /****************************************************************************/
123 
124 #define AMG_MATRIX_NAME(p) ((p)->name)
125 #define AMG_MATRIX_N(p) ((p)->n)
126 #define AMG_MATRIX_M(p) ((p)->m)
127 #define AMG_MATRIX_B(p) ((p)->b)
128 #define AMG_MATRIX_BB(p) ((p)->bb)
129 #define AMG_MATRIX_SAS(p) ((p)->system_as_scalar)
130 #define AMG_MATRIX_BLDI(p) ((p)->blocks_in_diag)
131 #define AMG_MATRIX_NONZEROS(p) ((p)->nonzeros)
132 #define AMG_MATRIX_CONNECTIONS(p) ((p)->connections)
133 #define AMG_MATRIX_BW(p) ((p)->bandwidth)
134 #define AMG_MATRIX_RA(p) ((p)->ra)
135 #define AMG_MATRIX_JA(p) ((p)->ja)
136 #define AMG_MATRIX_A(p) ((p)->a)
137 
138 /* Construction */
139 AMG_MATRIX *AMG_NewMatrix (int n, int b, int nonzeros, int system_as_scalar,
140  int blocks_in_diag,int allocate_row,int allocate_column,char *name);
141 AMG_MATRIX *AMG_CopyMatrix (AMG_MATRIX *A, char *name);
142 int AMG_SetRowLength (AMG_MATRIX *A, int i, int l);
143 int AMG_FindEntry (AMG_MATRIX *A, int i, int j);
144 int AMG_InsertEntry (AMG_MATRIX *A, int i, int j);
145 int AMG_InsertValues (AMG_MATRIX *A, int i, int j, double *aij);
146 int AMG_AddValues (AMG_MATRIX *A, int i, int j, double *aij);
147 
148 /* input / output */
149 int AMG_PrintVector (int k, AMG_VECTOR **vlist, char *text);
150 int AMG_PrintMatrix (AMG_MATRIX *A, char *text);
151 
152 #endif
Definition: amg_sp.h:70
Definition: amg_sp.h:96