/[escript]/trunk/paso/src/SystemMatrix.h
ViewVC logotype

Contents of /trunk/paso/src/SystemMatrix.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3642 - (show annotations)
Thu Oct 27 03:41:51 2011 UTC (7 years, 5 months ago) by caltinay
File MIME type: text/plain
File size: 8198 byte(s)
Assorted spelling/comment fixes in paso.

1
2 /*******************************************************
3 *
4 * Copyright (c) 2003-2010 by University of Queensland
5 * Earth Systems Science Computational Center (ESSCC)
6 * http://www.uq.edu.au/esscc
7 *
8 * Primary Business: Queensland, Australia
9 * Licensed under the Open Software License version 3.0
10 * http://www.opensource.org/licenses/osl-3.0.php
11 *
12 *******************************************************/
13
14
15 /**************************************************************/
16
17 /* Paso: SystemMatrix and SystemVector */
18
19 /**************************************************************/
20
21 /* Copyrights by ACcESS Australia 2003,2004,2005,2006 */
22 /* Author: Lutz Gross, l.gross@uq.edu.au */
23
24 /**************************************************************/
25
26 #ifndef INC_PASO_SYSTEMMATRIX
27 #define INC_PASO_SYSTEMMATRIX
28
29 #include "Common.h"
30 #include "SparseMatrix.h"
31 #include "SystemMatrixPattern.h"
32 #include "Options.h"
33 #include "esysUtils/Esys_MPI.h"
34 #include "Paso.h"
35 #include "Coupler.h"
36
37
38 /**************************************************************/
39
40 /* this struct holds a stiffness matrix: */
41
42 typedef int Paso_SystemMatrixType;
43
44 typedef struct Paso_SystemMatrix {
45 Paso_SystemMatrixType type;
46 Paso_SystemMatrixPattern *pattern;
47
48 dim_t reference_counter;
49
50 dim_t logical_row_block_size;
51 dim_t logical_col_block_size;
52
53 dim_t row_block_size;
54 dim_t col_block_size;
55 dim_t block_size;
56
57 Paso_Distribution *row_distribution;
58 Paso_Distribution *col_distribution;
59 Esys_MPIInfo *mpi_info;
60
61 Paso_Coupler* col_coupler;
62 Paso_Coupler* row_coupler;
63
64 /* this comes into play when PASO is used */
65 Paso_SparseMatrix* mainBlock; /* main block */
66 Paso_SparseMatrix* col_coupleBlock; /* coupling to neighbouring processors (row - col) */
67 Paso_SparseMatrix* row_coupleBlock; /* coupling to neighbouring processors (col - row) */
68 Paso_SparseMatrix* remote_coupleBlock; /* coupling of rows-cols on neighbouring processors
69 don't assume that this is set */
70
71 bool_t is_balanced;
72 double *balance_vector; /* matrix may be balanced by a diagonal matrix D=diagonal(balance_vector)
73 if is_balanced is set, the matrix stored is D*A*D where A is the original matrix.
74 When the system of linear equations is solved we solve D*A*D*y=c.
75 So to solve A*x=b one needs to set c=D*b and x=D*y. */
76
77
78
79 index_t solver_package; /* package controlling the solver pointer */
80 void* solver_p; /* pointer to data needed by a solver */
81
82 /* this is only used for a trilinos matrix */
83 void *trilinos_data;
84
85 } Paso_SystemMatrix;
86
87 /* interfaces: */
88
89 PASO_DLL_API
90 Paso_SystemMatrix* Paso_SystemMatrix_alloc(Paso_SystemMatrixType,Paso_SystemMatrixPattern*,dim_t,dim_t, const bool_t patternIsUnrolled);
91
92 PASO_DLL_API
93 Paso_SystemMatrix* Paso_SystemMatrix_getReference(Paso_SystemMatrix*);
94
95 PASO_DLL_API
96 void Paso_SystemMatrix_free(Paso_SystemMatrix*);
97
98
99 PASO_DLL_API
100 void Paso_SystemMatrix_MatrixVector(const double alpha, Paso_SystemMatrix* A, const double* in, const double beta, double* out);
101
102 PASO_DLL_API
103 void Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(double alpha, Paso_SystemMatrix* A, const double* in, const double beta, double* out);
104
105 PASO_DLL_API
106 void Paso_SystemMatrix_nullifyRowsAndCols(Paso_SystemMatrix* A, double* mask_row, double* mask_col, double main_diagonal_value);
107
108 PASO_DLL_API
109 void Paso_SystemMatrix_applyBalanceInPlace(const Paso_SystemMatrix* A, double* x, const bool_t RHS);
110
111 PASO_DLL_API
112 void Paso_SystemMatrix_applyBalance(const Paso_SystemMatrix* A, double* x_out, const double* x, const bool_t RHS);
113
114 PASO_DLL_API
115 void Paso_SystemMatrix_balance(Paso_SystemMatrix* A);
116
117
118 PASO_DLL_API
119 void Paso_solve(Paso_SystemMatrix* A, double* out, double* in, Paso_Options* options);
120
121 PASO_DLL_API
122 void Paso_solve_free(Paso_SystemMatrix* in);
123
124 PASO_DLL_API
125 void Paso_SystemMatrix_startCollect(Paso_SystemMatrix* A,const double* in);
126
127 PASO_DLL_API
128 double* Paso_SystemMatrix_finishCollect(Paso_SystemMatrix* A);
129
130 PASO_DLL_API
131 void Paso_SystemMatrix_startColCollect(Paso_SystemMatrix* A,const double* in);
132
133 PASO_DLL_API
134 double* Paso_SystemMatrix_finishColCollect(Paso_SystemMatrix* A);
135
136 PASO_DLL_API
137 void Paso_SystemMatrix_startRowCollect(Paso_SystemMatrix* A,const double* in);
138
139 PASO_DLL_API
140 double* Paso_SystemMatrix_finishRowCollect(Paso_SystemMatrix* A);
141
142 PASO_DLL_API
143 dim_t Paso_SystemMatrix_getTotalNumRows(const Paso_SystemMatrix* A);
144
145 PASO_DLL_API
146 dim_t Paso_SystemMatrix_getTotalNumCols(const Paso_SystemMatrix*);
147
148 PASO_DLL_API
149 dim_t Paso_SystemMatrix_getGlobalNumRows(const Paso_SystemMatrix*);
150
151 PASO_DLL_API
152 dim_t Paso_SystemMatrix_getGlobalNumCols(const Paso_SystemMatrix*);
153
154 PASO_DLL_API
155 dim_t Paso_SystemMatrix_getGlobalTotalNumRows(const Paso_SystemMatrix* A);
156
157 PASO_DLL_API
158 dim_t Paso_SystemMatrix_getGlobalTotalNumCols(const Paso_SystemMatrix* A);
159
160 PASO_DLL_API
161 double Paso_SystemMatrix_getGlobalSize(const Paso_SystemMatrix*A);
162
163 PASO_DLL_API
164 double Paso_SystemMatrix_getSparsity(const Paso_SystemMatrix*A);
165
166 PASO_DLL_API
167 dim_t Paso_SystemMatrix_getNumRows(const Paso_SystemMatrix* A);
168
169 PASO_DLL_API
170 dim_t Paso_SystemMatrix_getNumCols(const Paso_SystemMatrix* A);
171
172 PASO_DLL_API
173 dim_t Paso_SystemMatrix_getRowOverlap(const Paso_SystemMatrix* A);
174
175 PASO_DLL_API
176 dim_t Paso_SystemMatrix_getColOverlap(const Paso_SystemMatrix* A);
177
178
179
180
181 PASO_DLL_API
182 void Paso_SystemMatrix_saveMM(Paso_SystemMatrix *, char *);
183
184 PASO_DLL_API
185 void Paso_SystemMatrix_saveHB(Paso_SystemMatrix *, char *);
186
187 PASO_DLL_API
188 Paso_SystemMatrix* Paso_SystemMatrix_loadMM_toCSR(char *);
189
190 PASO_DLL_API
191 Paso_SystemMatrix* Paso_SystemMatrix_loadMM_toCSC(char *);
192
193 PASO_DLL_API
194 void Paso_RHS_loadMM_toCSR( char *fileName_p, double *b, dim_t size);
195
196
197 PASO_DLL_API
198 int Paso_SystemMatrix_getSystemMatrixTypeId(const index_t solver,const index_t preconditioner, const index_t package,const bool_t symmetry, Esys_MPIInfo *mpi_info);
199
200 PASO_DLL_API
201 dim_t Paso_SystemMatrix_getNumOutput(Paso_SystemMatrix* A);
202
203
204 PASO_DLL_API
205 void Paso_SystemMatrix_setValues(Paso_SystemMatrix*,double);
206
207 PASO_DLL_API
208 void Paso_SystemMatrix_add(Paso_SystemMatrix*,dim_t,index_t*, dim_t,dim_t,index_t*,dim_t, double*);
209
210 PASO_DLL_API
211 void Paso_SystemMatrix_rowSum(Paso_SystemMatrix* A, double* row_sum);
212
213 PASO_DLL_API
214 void Paso_SystemMatrix_nullifyRows(Paso_SystemMatrix* A, double* mask_row, double main_diagonal_value);
215
216
217 PASO_DLL_API
218 void Paso_SystemMatrix_makeZeroRowSums(Paso_SystemMatrix * A_p, double* left_over);
219
220
221 PASO_DLL_API
222 void Paso_SystemMatrix_copyBlockFromMainDiagonal(Paso_SystemMatrix * A_p, double* out);
223
224 PASO_DLL_API
225 void Paso_SystemMatrix_copyBlockToMainDiagonal(Paso_SystemMatrix * A_p, const double* in);
226
227 PASO_DLL_API
228 void Paso_SystemMatrix_copyFromMainDiagonal(Paso_SystemMatrix * A_p, double* out);
229
230 PASO_DLL_API
231 void Paso_SystemMatrix_copyToMainDiagonal(Paso_SystemMatrix * A_p, const double* in);
232
233
234 PASO_DLL_API
235 void Paso_SystemMatrix_solvePreconditioner(Paso_SystemMatrix* A,double* x,double* b);
236
237 PASO_DLL_API
238 void Paso_SystemMatrix_setPreconditioner(Paso_SystemMatrix* A,Paso_Options* options);
239
240 PASO_DLL_API
241 void Paso_SystemMatrix_freePreconditioner(Paso_SystemMatrix* A);
242
243 PASO_DLL_API
244 void Paso_SystemMatrix_copyColCoupleBlock(Paso_SystemMatrix *A);
245
246 PASO_DLL_API
247 void Paso_SystemMatrix_copyRemoteCoupleBlock(Paso_SystemMatrix *A, const bool_t recreatePattern);
248
249 PASO_DLL_API
250 void Paso_SystemMatrix_fillWithGlobalCoordinates(Paso_SystemMatrix *A, const double f1);
251
252 PASO_DLL_API
253 void Paso_SystemMatrix_print(Paso_SystemMatrix *A);
254
255
256 PASO_DLL_API
257 void Paso_SystemMatrix_mergeMainAndCouple(Paso_SystemMatrix *A, index_t **p_ptr, index_t **p_idx, double **p_val);
258
259 PASO_DLL_API
260 void Paso_SystemMatrix_mergeMainAndCouple_CSR_OFFSET0(Paso_SystemMatrix* A, index_t** p_ptr, index_t** p_idx, double** p_val);
261
262 PASO_DLL_API
263 void Paso_SystemMatrix_mergeMainAndCouple_CSC_OFFSET1(Paso_SystemMatrix *A, index_t **p_ptr, index_t **p_idx, double **p_val);
264
265 PASO_DLL_API
266 void Paso_SystemMatrix_copyMain_CSC_OFFSET1(Paso_SystemMatrix* A, index_t** p_ptr, index_t** p_idx, double** p_val);
267
268
269 #endif /* #ifndef INC_PASO_SYSTEMMATRIX */
270

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26