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