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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3369 - (show annotations)
Fri Nov 19 06:26:11 2010 UTC (8 years, 10 months ago) by gross
File MIME type: text/plain
File size: 5864 byte(s)
matrix balance introduced 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 naighbouring processors (row - col) */
67 Paso_SparseMatrix* row_coupleBlock; /* coupling to naighbouring processors (col - row) */
68
69 bool_t is_balanced;
70 double *balance_vector; /* matrix may be balanced by a diagonal matrix D=diagonal(balance_vector)
71 if is_balanced is set, the matrix stored is D*A*D where A is the original matrix
72 When the system of linear equations is solved we solve D*A*D*y=c.
73 so to solve A*x=b one needs to set c=D*b and x=D*y. */
74
75
76
77 index_t solver_package; /* package controling the solver pointer */
78 void* solver_p; /* pointer to data needed by a solver */
79
80 /* this is only used for a trilinos matrix */
81 void *trilinos_data;
82
83 } Paso_SystemMatrix;
84
85 /* interfaces: */
86
87 Paso_SystemMatrix* Paso_SystemMatrix_alloc(Paso_SystemMatrixType,Paso_SystemMatrixPattern*,dim_t,dim_t, const bool_t patternIsUnrolled);
88 Paso_SystemMatrix* Paso_SystemMatrix_getReference(Paso_SystemMatrix*);
89 void Paso_SystemMatrix_free(Paso_SystemMatrix*);
90
91 void Paso_SystemMatrix_MatrixVector(const double alpha, Paso_SystemMatrix* A, const double* in, const double beta, double* out);
92 void Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(double alpha, Paso_SystemMatrix* A, const double* in, const double beta, double* out);
93 void Paso_SystemMatrix_nullifyRowsAndCols(Paso_SystemMatrix* A, double* mask_row, double* mask_col, double main_diagonal_value);
94 void Paso_SystemMatrix_applyBalanceInPlace(const Paso_SystemMatrix* A, double* x, const bool_t RHS);
95 void Paso_SystemMatrix_applyBalance(const Paso_SystemMatrix* A, double* x_out, const double* x, const bool_t RHS);
96 void Paso_SystemMatrix_balance(Paso_SystemMatrix* A);
97
98 void Paso_solve(Paso_SystemMatrix* A, double* out, double* in, Paso_Options* options);
99 void Paso_solve_free(Paso_SystemMatrix* in);
100 void Paso_SystemMatrix_startCollect(Paso_SystemMatrix* A,const double* in);
101 double* Paso_SystemMatrix_finishCollect(Paso_SystemMatrix* A);
102 void Paso_SystemMatrix_startColCollect(Paso_SystemMatrix* A,const double* in);
103 double* Paso_SystemMatrix_finishColCollect(Paso_SystemMatrix* A);
104 void Paso_SystemMatrix_startRowCollect(Paso_SystemMatrix* A,const double* in);
105 double* Paso_SystemMatrix_finishRowCollect(Paso_SystemMatrix* A);
106
107 dim_t Paso_SystemMatrix_getTotalNumRows(const Paso_SystemMatrix* A);
108 dim_t Paso_SystemMatrix_getTotalNumCols(const Paso_SystemMatrix*);
109 dim_t Paso_SystemMatrix_getGlobalNumRows(Paso_SystemMatrix*);
110 dim_t Paso_SystemMatrix_getGlobalNumCols(Paso_SystemMatrix*);
111
112 void Paso_SystemMatrix_saveMM(Paso_SystemMatrix *, char *);
113 void Paso_SystemMatrix_saveHB(Paso_SystemMatrix *, char *);
114 Paso_SystemMatrix* Paso_SystemMatrix_loadMM_toCSR(char *);
115 Paso_SystemMatrix* Paso_SystemMatrix_loadMM_toCSC(char *);
116 void Paso_RHS_loadMM_toCSR( char *fileName_p, double *b, dim_t size);
117
118 int Paso_SystemMatrix_getSystemMatrixTypeId(const index_t solver,const index_t preconditioner, const index_t package,const bool_t symmetry, Esys_MPIInfo *mpi_info);
119 dim_t Paso_SystemMatrix_getNumOutput(Paso_SystemMatrix* A);
120
121 void Paso_SystemMatrix_setValues(Paso_SystemMatrix*,double);
122 void Paso_SystemMatrix_add(Paso_SystemMatrix*,dim_t,index_t*, dim_t,dim_t,index_t*,dim_t, double*);
123 void Paso_SystemMatrix_rowSum(Paso_SystemMatrix* A, double* row_sum);
124 void Paso_SystemMatrix_nullifyRows(Paso_SystemMatrix* A, double* mask_row, double main_diagonal_value);
125
126 void Paso_SystemMatrix_makeZeroRowSums(Paso_SystemMatrix * A_p, double* left_over);
127
128 void Paso_SystemMatrix_copyBlockFromMainDiagonal(Paso_SystemMatrix * A_p, double* out);
129 void Paso_SystemMatrix_copyBlockToMainDiagonal(Paso_SystemMatrix * A_p, const double* in);
130 void Paso_SystemMatrix_copyFromMainDiagonal(Paso_SystemMatrix * A_p, double* out);
131 void Paso_SystemMatrix_copyToMainDiagonal(Paso_SystemMatrix * A_p, const double* in);
132
133 void Paso_SystemMatrix_solvePreconditioner(Paso_SystemMatrix* A,double* x,double* b);
134 void Paso_SystemMatrix_setPreconditioner(Paso_SystemMatrix* A,Paso_Options* options);
135 void Paso_SystemMatrix_freePreconditioner(Paso_SystemMatrix* A);
136
137
138 #endif /* #ifndef INC_PASO_SYSTEMMATRIX */
139

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26