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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

1 ksteube 1312
2     /*******************************************************
3 ksteube 1811 *
4 jfenwick 2881 * Copyright (c) 2003-2010 by University of Queensland
5 ksteube 1811 * 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 dhawcroft 631
14 ksteube 1811
15 jgs 150 /**************************************************************/
16    
17     /* Paso: SystemMatrix and SystemVector */
18    
19     /**************************************************************/
20    
21 gross 412 /* Copyrights by ACcESS Australia 2003,2004,2005,2006 */
22 jfenwick 2608 /* Author: Lutz Gross, l.gross@uq.edu.au */
23 jgs 150
24     /**************************************************************/
25    
26 ksteube 1312 #ifndef INC_PASO_SYSTEMMATRIX
27     #define INC_PASO_SYSTEMMATRIX
28 jgs 150
29     #include "Common.h"
30 ksteube 1312 #include "SparseMatrix.h"
31 jgs 150 #include "SystemMatrixPattern.h"
32     #include "Options.h"
33 jfenwick 3259 #include "esysUtils/Esys_MPI.h"
34 ksteube 1312 #include "Paso.h"
35 gross 1552 #include "Coupler.h"
36 jgs 150
37 gross 1552
38 jgs 150 /**************************************************************/
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 ksteube 1312 Paso_SystemMatrixPattern *pattern;
47    
48 jgs 150 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 ksteube 1312 Paso_Distribution *row_distribution;
58     Paso_Distribution *col_distribution;
59 jfenwick 3259 Esys_MPIInfo *mpi_info;
60 jgs 150
61 gross 1552 Paso_Coupler* col_coupler;
62     Paso_Coupler* row_coupler;
63 gross 3094
64 ksteube 1312 /* this comes into play when PASO is used */
65 gross 1552 Paso_SparseMatrix* mainBlock; /* main block */
66 caltinay 3642 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 gross 3482 don't assume that this is set */
70 gross 3369
71     bool_t is_balanced;
72     double *balance_vector; /* matrix may be balanced by a diagonal matrix D=diagonal(balance_vector)
73 caltinay 3642 if is_balanced is set, the matrix stored is D*A*D where A is the original matrix.
74 gross 3369 When the system of linear equations is solved we solve D*A*D*y=c.
75 caltinay 3642 So to solve A*x=b one needs to set c=D*b and x=D*y. */
76 gross 3369
77    
78    
79 caltinay 3642 index_t solver_package; /* package controlling the solver pointer */
80 gross 3283 void* solver_p; /* pointer to data needed by a solver */
81 jgs 150
82 ksteube 1312 /* this is only used for a trilinos matrix */
83     void *trilinos_data;
84    
85 jgs 150 } Paso_SystemMatrix;
86    
87     /* interfaces: */
88    
89 caltinay 3594 PASO_DLL_API
90 gross 2551 Paso_SystemMatrix* Paso_SystemMatrix_alloc(Paso_SystemMatrixType,Paso_SystemMatrixPattern*,dim_t,dim_t, const bool_t patternIsUnrolled);
91 caltinay 3594
92     PASO_DLL_API
93 gross 2551 Paso_SystemMatrix* Paso_SystemMatrix_getReference(Paso_SystemMatrix*);
94 caltinay 3594
95     PASO_DLL_API
96 ksteube 1312 void Paso_SystemMatrix_free(Paso_SystemMatrix*);
97 jgs 150
98 caltinay 3594
99     PASO_DLL_API
100 gross 1639 void Paso_SystemMatrix_MatrixVector(const double alpha, Paso_SystemMatrix* A, const double* in, const double beta, double* out);
101 caltinay 3594
102     PASO_DLL_API
103 gross 1639 void Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(double alpha, Paso_SystemMatrix* A, const double* in, const double beta, double* out);
104 caltinay 3594
105     PASO_DLL_API
106 gross 3369 void Paso_SystemMatrix_nullifyRowsAndCols(Paso_SystemMatrix* A, double* mask_row, double* mask_col, double main_diagonal_value);
107 caltinay 3594
108     PASO_DLL_API
109 gross 3369 void Paso_SystemMatrix_applyBalanceInPlace(const Paso_SystemMatrix* A, double* x, const bool_t RHS);
110 caltinay 3594
111     PASO_DLL_API
112 gross 3369 void Paso_SystemMatrix_applyBalance(const Paso_SystemMatrix* A, double* x_out, const double* x, const bool_t RHS);
113 caltinay 3594
114     PASO_DLL_API
115 gross 3369 void Paso_SystemMatrix_balance(Paso_SystemMatrix* A);
116    
117 caltinay 3594
118     PASO_DLL_API
119 ksteube 1312 void Paso_solve(Paso_SystemMatrix* A, double* out, double* in, Paso_Options* options);
120 caltinay 3594
121     PASO_DLL_API
122 ksteube 1312 void Paso_solve_free(Paso_SystemMatrix* in);
123 caltinay 3594
124     PASO_DLL_API
125 gross 1639 void Paso_SystemMatrix_startCollect(Paso_SystemMatrix* A,const double* in);
126 caltinay 3594
127     PASO_DLL_API
128 ksteube 1312 double* Paso_SystemMatrix_finishCollect(Paso_SystemMatrix* A);
129 caltinay 3594
130     PASO_DLL_API
131 gross 1639 void Paso_SystemMatrix_startColCollect(Paso_SystemMatrix* A,const double* in);
132 caltinay 3594
133     PASO_DLL_API
134 gross 1552 double* Paso_SystemMatrix_finishColCollect(Paso_SystemMatrix* A);
135 caltinay 3594
136     PASO_DLL_API
137 gross 1639 void Paso_SystemMatrix_startRowCollect(Paso_SystemMatrix* A,const double* in);
138 caltinay 3594
139     PASO_DLL_API
140 gross 1552 double* Paso_SystemMatrix_finishRowCollect(Paso_SystemMatrix* A);
141 gross 3369
142 caltinay 3594 PASO_DLL_API
143 gross 1407 dim_t Paso_SystemMatrix_getTotalNumRows(const Paso_SystemMatrix* A);
144 caltinay 3594
145     PASO_DLL_API
146 gross 1407 dim_t Paso_SystemMatrix_getTotalNumCols(const Paso_SystemMatrix*);
147 caltinay 3594
148     PASO_DLL_API
149 gross 3442 dim_t Paso_SystemMatrix_getGlobalNumRows(const Paso_SystemMatrix*);
150 caltinay 3594
151     PASO_DLL_API
152 gross 3442 dim_t Paso_SystemMatrix_getGlobalNumCols(const Paso_SystemMatrix*);
153 caltinay 3594
154     PASO_DLL_API
155 gross 3442 dim_t Paso_SystemMatrix_getGlobalTotalNumRows(const Paso_SystemMatrix* A);
156 caltinay 3594
157     PASO_DLL_API
158 gross 3442 dim_t Paso_SystemMatrix_getGlobalTotalNumCols(const Paso_SystemMatrix* A);
159 caltinay 3594
160     PASO_DLL_API
161 gross 3442 double Paso_SystemMatrix_getGlobalSize(const Paso_SystemMatrix*A);
162 caltinay 3594
163     PASO_DLL_API
164 gross 3442 double Paso_SystemMatrix_getSparsity(const Paso_SystemMatrix*A);
165 caltinay 3594
166     PASO_DLL_API
167 gross 3445 dim_t Paso_SystemMatrix_getNumRows(const Paso_SystemMatrix* A);
168 caltinay 3594
169     PASO_DLL_API
170 gross 3445 dim_t Paso_SystemMatrix_getNumCols(const Paso_SystemMatrix* A);
171 caltinay 3594
172     PASO_DLL_API
173 gross 3445 dim_t Paso_SystemMatrix_getRowOverlap(const Paso_SystemMatrix* A);
174 caltinay 3594
175     PASO_DLL_API
176 gross 3445 dim_t Paso_SystemMatrix_getColOverlap(const Paso_SystemMatrix* A);
177 jgs 150
178 gross 3445
179    
180 caltinay 3594
181     PASO_DLL_API
182 jgs 150 void Paso_SystemMatrix_saveMM(Paso_SystemMatrix *, char *);
183 caltinay 3594
184     PASO_DLL_API
185 jgs 150 void Paso_SystemMatrix_saveHB(Paso_SystemMatrix *, char *);
186 caltinay 3594
187     PASO_DLL_API
188 jgs 150 Paso_SystemMatrix* Paso_SystemMatrix_loadMM_toCSR(char *);
189 caltinay 3594
190     PASO_DLL_API
191 ksteube 1312 Paso_SystemMatrix* Paso_SystemMatrix_loadMM_toCSC(char *);
192 caltinay 3594
193     PASO_DLL_API
194 artak 2168 void Paso_RHS_loadMM_toCSR( char *fileName_p, double *b, dim_t size);
195 gross 3369
196 caltinay 3594
197     PASO_DLL_API
198 jfenwick 3259 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 caltinay 3594
200     PASO_DLL_API
201 gross 1361 dim_t Paso_SystemMatrix_getNumOutput(Paso_SystemMatrix* A);
202 gross 3369
203 caltinay 3594
204     PASO_DLL_API
205 ksteube 1312 void Paso_SystemMatrix_setValues(Paso_SystemMatrix*,double);
206 caltinay 3594
207     PASO_DLL_API
208 ksteube 1312 void Paso_SystemMatrix_add(Paso_SystemMatrix*,dim_t,index_t*, dim_t,dim_t,index_t*,dim_t, double*);
209 caltinay 3594
210     PASO_DLL_API
211 gross 1363 void Paso_SystemMatrix_rowSum(Paso_SystemMatrix* A, double* row_sum);
212 caltinay 3594
213     PASO_DLL_API
214 gross 1417 void Paso_SystemMatrix_nullifyRows(Paso_SystemMatrix* A, double* mask_row, double main_diagonal_value);
215 jgs 150
216 caltinay 3594
217     PASO_DLL_API
218 gross 3005 void Paso_SystemMatrix_makeZeroRowSums(Paso_SystemMatrix * A_p, double* left_over);
219 gross 3369
220 caltinay 3594
221     PASO_DLL_API
222 gross 3005 void Paso_SystemMatrix_copyBlockFromMainDiagonal(Paso_SystemMatrix * A_p, double* out);
223 caltinay 3594
224     PASO_DLL_API
225 gross 3005 void Paso_SystemMatrix_copyBlockToMainDiagonal(Paso_SystemMatrix * A_p, const double* in);
226 caltinay 3594
227     PASO_DLL_API
228 gross 3005 void Paso_SystemMatrix_copyFromMainDiagonal(Paso_SystemMatrix * A_p, double* out);
229 caltinay 3594
230     PASO_DLL_API
231 gross 3005 void Paso_SystemMatrix_copyToMainDiagonal(Paso_SystemMatrix * A_p, const double* in);
232 gross 1562
233 caltinay 3594
234     PASO_DLL_API
235 gross 3120 void Paso_SystemMatrix_solvePreconditioner(Paso_SystemMatrix* A,double* x,double* b);
236 caltinay 3594
237     PASO_DLL_API
238 gross 3120 void Paso_SystemMatrix_setPreconditioner(Paso_SystemMatrix* A,Paso_Options* options);
239 caltinay 3594
240     PASO_DLL_API
241 gross 3120 void Paso_SystemMatrix_freePreconditioner(Paso_SystemMatrix* A);
242 caltinay 3594
243     PASO_DLL_API
244 gross 3458 void Paso_SystemMatrix_copyColCoupleBlock(Paso_SystemMatrix *A);
245 caltinay 3594
246     PASO_DLL_API
247 gross 3482 void Paso_SystemMatrix_copyRemoteCoupleBlock(Paso_SystemMatrix *A, const bool_t recreatePattern);
248 caltinay 3594
249     PASO_DLL_API
250 gross 3458 void Paso_SystemMatrix_fillWithGlobalCoordinates(Paso_SystemMatrix *A, const double f1);
251 caltinay 3594
252     PASO_DLL_API
253 gross 3458 void Paso_SystemMatrix_print(Paso_SystemMatrix *A);
254 gross 3120
255 caltinay 3594
256     PASO_DLL_API
257 lgao 3508 void Paso_SystemMatrix_mergeMainAndCouple(Paso_SystemMatrix *A, index_t **p_ptr, index_t **p_idx, double **p_val);
258 caltinay 3594
259     PASO_DLL_API
260 lgao 3508 void Paso_SystemMatrix_mergeMainAndCouple_CSR_OFFSET0(Paso_SystemMatrix* A, index_t** p_ptr, index_t** p_idx, double** p_val);
261 caltinay 3594
262     PASO_DLL_API
263 lgao 3508 void Paso_SystemMatrix_mergeMainAndCouple_CSC_OFFSET1(Paso_SystemMatrix *A, index_t **p_ptr, index_t **p_idx, double **p_val);
264 caltinay 3594
265     PASO_DLL_API
266 lgao 3508 void Paso_SystemMatrix_copyMain_CSC_OFFSET1(Paso_SystemMatrix* A, index_t** p_ptr, index_t** p_idx, double** p_val);
267    
268 gross 3005
269 ksteube 1312 #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