1 |
ksteube |
1312 |
|
2 |
jgs |
150 |
/* $Id$ */ |
3 |
|
|
|
4 |
ksteube |
1312 |
/******************************************************* |
5 |
|
|
* |
6 |
|
|
* Copyright 2003-2007 by ACceSS MNRF |
7 |
|
|
* Copyright 2007 by University of Queensland |
8 |
|
|
* |
9 |
|
|
* http://esscc.uq.edu.au |
10 |
|
|
* Primary Business: Queensland, Australia |
11 |
|
|
* Licensed under the Open Software License version 3.0 |
12 |
|
|
* http://www.opensource.org/licenses/osl-3.0.php |
13 |
|
|
* |
14 |
|
|
*******************************************************/ |
15 |
dhawcroft |
631 |
|
16 |
jgs |
150 |
/**************************************************************/ |
17 |
|
|
|
18 |
|
|
/* Paso: SystemMatrix and SystemVector */ |
19 |
|
|
|
20 |
|
|
/**************************************************************/ |
21 |
|
|
|
22 |
gross |
412 |
/* Copyrights by ACcESS Australia 2003,2004,2005,2006 */ |
23 |
jgs |
150 |
/* Author: gross@access.edu.au */ |
24 |
|
|
|
25 |
|
|
/**************************************************************/ |
26 |
|
|
|
27 |
ksteube |
1312 |
#ifndef INC_PASO_SYSTEMMATRIX |
28 |
|
|
#define INC_PASO_SYSTEMMATRIX |
29 |
jgs |
150 |
|
30 |
|
|
#include "Common.h" |
31 |
ksteube |
1312 |
#include "SparseMatrix.h" |
32 |
jgs |
150 |
#include "SystemMatrixPattern.h" |
33 |
|
|
#include "Options.h" |
34 |
ksteube |
1312 |
#include "Paso_MPI.h" |
35 |
|
|
#include "Paso.h" |
36 |
jgs |
150 |
|
37 |
|
|
/**************************************************************/ |
38 |
|
|
|
39 |
|
|
/* this struct holds a stiffness matrix: */ |
40 |
|
|
|
41 |
gross |
415 |
#define MATRIX_FORMAT_DEFAULT 0 |
42 |
|
|
#define MATRIX_FORMAT_CSC 1 |
43 |
|
|
#define MATRIX_FORMAT_SYM 2 |
44 |
|
|
#define MATRIX_FORMAT_BLK1 4 |
45 |
|
|
#define MATRIX_FORMAT_OFFSET1 8 |
46 |
ksteube |
1312 |
#define MATRIX_FORMAT_TRILINOS_CRS 16 |
47 |
gross |
412 |
|
48 |
jgs |
150 |
typedef int Paso_SystemMatrixType; |
49 |
|
|
|
50 |
|
|
typedef struct Paso_SystemMatrix { |
51 |
|
|
Paso_SystemMatrixType type; |
52 |
ksteube |
1312 |
Paso_SystemMatrixPattern *pattern; |
53 |
|
|
|
54 |
jgs |
150 |
dim_t reference_counter; |
55 |
|
|
|
56 |
|
|
dim_t logical_row_block_size; |
57 |
|
|
dim_t logical_col_block_size; |
58 |
|
|
dim_t logical_block_size; |
59 |
|
|
|
60 |
|
|
dim_t row_block_size; |
61 |
|
|
dim_t col_block_size; |
62 |
|
|
dim_t block_size; |
63 |
|
|
|
64 |
ksteube |
1312 |
Paso_Distribution *row_distribution; |
65 |
|
|
Paso_Distribution *col_distribution; |
66 |
jgs |
150 |
|
67 |
ksteube |
1312 |
Paso_MPIInfo *mpi_info; |
68 |
jgs |
150 |
|
69 |
ksteube |
1312 |
/* this comes into play when PASO is used */ |
70 |
|
|
Paso_SparseMatrix* mainBlock; |
71 |
|
|
Paso_SparseMatrix* coupleBlock; |
72 |
|
|
bool_t normalizer_is_valid; |
73 |
jgs |
150 |
double *normalizer; /* vector with a inverse of the absolute row/col sum (set by Solver.c)*/ |
74 |
gross |
425 |
index_t solver_package; /* package controling the solver pointer */ |
75 |
|
|
void* solver; /* pointer to data needed by a solver */ |
76 |
jgs |
150 |
|
77 |
ksteube |
1312 |
/* this is only used for a trilinos matrix */ |
78 |
|
|
void *trilinos_data; |
79 |
|
|
|
80 |
jgs |
150 |
} Paso_SystemMatrix; |
81 |
|
|
|
82 |
|
|
/* interfaces: */ |
83 |
|
|
|
84 |
|
|
Paso_SystemMatrix* Paso_SystemMatrix_alloc(Paso_SystemMatrixType,Paso_SystemMatrixPattern*,dim_t,dim_t); |
85 |
|
|
Paso_SystemMatrix* Paso_SystemMatrix_reference(Paso_SystemMatrix*); |
86 |
ksteube |
1312 |
void Paso_SystemMatrix_free(Paso_SystemMatrix*); |
87 |
jgs |
150 |
|
88 |
|
|
void Paso_SystemMatrix_MatrixVector(double alpha, Paso_SystemMatrix* A, double* in, double beta, double* out); |
89 |
gross |
415 |
void Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(double alpha, Paso_SystemMatrix* A, double* in, double beta, double* out); |
90 |
ksteube |
1312 |
void Paso_solve(Paso_SystemMatrix* A, double* out, double* in, Paso_Options* options); |
91 |
|
|
void Paso_solve_free(Paso_SystemMatrix* in); |
92 |
|
|
void Paso_SystemMatrix_allocBuffer(Paso_SystemMatrix* A); |
93 |
|
|
void Paso_SystemMatrix_freeBuffer(Paso_SystemMatrix* A); |
94 |
gross |
1407 |
void Paso_SystemMatrix_startCollect(Paso_SystemMatrix* A,const double* in); |
95 |
ksteube |
1312 |
double* Paso_SystemMatrix_finishCollect(Paso_SystemMatrix* A); |
96 |
|
|
void Paso_SystemMatrix_nullifyRowsAndCols(Paso_SystemMatrix* A, double* mask_row, double* mask_col, double main_diagonal_value); |
97 |
|
|
double* Paso_SystemMatrix_borrowNormalization(Paso_SystemMatrix* A); |
98 |
gross |
1407 |
dim_t Paso_SystemMatrix_getTotalNumRows(const Paso_SystemMatrix* A); |
99 |
|
|
dim_t Paso_SystemMatrix_getTotalNumCols(const Paso_SystemMatrix*); |
100 |
ksteube |
1312 |
dim_t Paso_SystemMatrix_getGlobalNumRows(Paso_SystemMatrix*); |
101 |
|
|
dim_t Paso_SystemMatrix_getGlobalNumCols(Paso_SystemMatrix*); |
102 |
jgs |
150 |
|
103 |
|
|
void Paso_SystemMatrix_saveMM(Paso_SystemMatrix *, char *); |
104 |
|
|
void Paso_SystemMatrix_saveHB(Paso_SystemMatrix *, char *); |
105 |
|
|
Paso_SystemMatrix* Paso_SystemMatrix_loadMM_toCSR(char *); |
106 |
ksteube |
1312 |
Paso_SystemMatrix* Paso_SystemMatrix_loadMM_toCSC(char *); |
107 |
jgs |
150 |
void Paso_SystemMatrix_setDefaults(Paso_Options*); |
108 |
|
|
int Paso_SystemMatrix_getSystemMatrixTypeId(index_t solver, index_t package, bool_t symmetry); |
109 |
gross |
1361 |
dim_t Paso_SystemMatrix_getNumOutput(Paso_SystemMatrix* A); |
110 |
ksteube |
1312 |
void Paso_SystemMatrix_setValues(Paso_SystemMatrix*,double); |
111 |
|
|
void Paso_SystemMatrix_add(Paso_SystemMatrix*,dim_t,index_t*, dim_t,dim_t,index_t*,dim_t, double*); |
112 |
gross |
1363 |
void Paso_SystemMatrix_rowSum(Paso_SystemMatrix* A, double* row_sum); |
113 |
gross |
1417 |
void Paso_SystemMatrix_nullifyRows(Paso_SystemMatrix* A, double* mask_row, double main_diagonal_value); |
114 |
artak |
1425 |
void Paso_SparseMatrix_nullifyRows_CSR(Paso_SparseMatrix*, double*, double); |
115 |
jgs |
150 |
|
116 |
ksteube |
1312 |
#endif /* #ifndef INC_PASO_SYSTEMMATRIX */ |
117 |
|
|
|