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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3482 - (show annotations)
Wed Mar 23 04:06:52 2011 UTC (8 years, 5 months ago) by gross
File MIME type: text/plain
File size: 6927 byte(s)
some work on AMG MPI
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 Paso_SparseMatrix* remote_coupleBlock; /* coupling of rows-cols on naighbouring 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 controling 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_SystemMatrix* Paso_SystemMatrix_alloc(Paso_SystemMatrixType,Paso_SystemMatrixPattern*,dim_t,dim_t, const bool_t patternIsUnrolled);
90 Paso_SystemMatrix* Paso_SystemMatrix_getReference(Paso_SystemMatrix*);
91 void Paso_SystemMatrix_free(Paso_SystemMatrix*);
92
93 void Paso_SystemMatrix_MatrixVector(const double alpha, Paso_SystemMatrix* A, const double* in, const double beta, double* out);
94 void Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(double alpha, Paso_SystemMatrix* A, const double* in, const double beta, double* out);
95 void Paso_SystemMatrix_nullifyRowsAndCols(Paso_SystemMatrix* A, double* mask_row, double* mask_col, double main_diagonal_value);
96 void Paso_SystemMatrix_applyBalanceInPlace(const Paso_SystemMatrix* A, double* x, const bool_t RHS);
97 void Paso_SystemMatrix_applyBalance(const Paso_SystemMatrix* A, double* x_out, const double* x, const bool_t RHS);
98 void Paso_SystemMatrix_balance(Paso_SystemMatrix* A);
99
100 void Paso_solve(Paso_SystemMatrix* A, double* out, double* in, Paso_Options* options);
101 void Paso_solve_free(Paso_SystemMatrix* in);
102 void Paso_SystemMatrix_startCollect(Paso_SystemMatrix* A,const double* in);
103 double* Paso_SystemMatrix_finishCollect(Paso_SystemMatrix* A);
104 void Paso_SystemMatrix_startColCollect(Paso_SystemMatrix* A,const double* in);
105 double* Paso_SystemMatrix_finishColCollect(Paso_SystemMatrix* A);
106 void Paso_SystemMatrix_startRowCollect(Paso_SystemMatrix* A,const double* in);
107 double* Paso_SystemMatrix_finishRowCollect(Paso_SystemMatrix* A);
108
109 dim_t Paso_SystemMatrix_getTotalNumRows(const Paso_SystemMatrix* A);
110 dim_t Paso_SystemMatrix_getTotalNumCols(const Paso_SystemMatrix*);
111 dim_t Paso_SystemMatrix_getGlobalNumRows(const Paso_SystemMatrix*);
112 dim_t Paso_SystemMatrix_getGlobalNumCols(const Paso_SystemMatrix*);
113 dim_t Paso_SystemMatrix_getGlobalTotalNumRows(const Paso_SystemMatrix* A);
114 dim_t Paso_SystemMatrix_getGlobalTotalNumCols(const Paso_SystemMatrix* A);
115 double Paso_SystemMatrix_getGlobalSize(const Paso_SystemMatrix*A);
116 double Paso_SystemMatrix_getSparsity(const Paso_SystemMatrix*A);
117 dim_t Paso_SystemMatrix_getNumRows(const Paso_SystemMatrix* A);
118 dim_t Paso_SystemMatrix_getNumCols(const Paso_SystemMatrix* A);
119 dim_t Paso_SystemMatrix_getRowOverlap(const Paso_SystemMatrix* A);
120 dim_t Paso_SystemMatrix_getColOverlap(const Paso_SystemMatrix* A);
121
122
123
124 void Paso_SystemMatrix_saveMM(Paso_SystemMatrix *, char *);
125 void Paso_SystemMatrix_saveHB(Paso_SystemMatrix *, char *);
126 Paso_SystemMatrix* Paso_SystemMatrix_loadMM_toCSR(char *);
127 Paso_SystemMatrix* Paso_SystemMatrix_loadMM_toCSC(char *);
128 void Paso_RHS_loadMM_toCSR( char *fileName_p, double *b, dim_t size);
129
130 int Paso_SystemMatrix_getSystemMatrixTypeId(const index_t solver,const index_t preconditioner, const index_t package,const bool_t symmetry, Esys_MPIInfo *mpi_info);
131 dim_t Paso_SystemMatrix_getNumOutput(Paso_SystemMatrix* A);
132
133 void Paso_SystemMatrix_setValues(Paso_SystemMatrix*,double);
134 void Paso_SystemMatrix_add(Paso_SystemMatrix*,dim_t,index_t*, dim_t,dim_t,index_t*,dim_t, double*);
135 void Paso_SystemMatrix_rowSum(Paso_SystemMatrix* A, double* row_sum);
136 void Paso_SystemMatrix_nullifyRows(Paso_SystemMatrix* A, double* mask_row, double main_diagonal_value);
137
138 void Paso_SystemMatrix_makeZeroRowSums(Paso_SystemMatrix * A_p, double* left_over);
139
140 void Paso_SystemMatrix_copyBlockFromMainDiagonal(Paso_SystemMatrix * A_p, double* out);
141 void Paso_SystemMatrix_copyBlockToMainDiagonal(Paso_SystemMatrix * A_p, const double* in);
142 void Paso_SystemMatrix_copyFromMainDiagonal(Paso_SystemMatrix * A_p, double* out);
143 void Paso_SystemMatrix_copyToMainDiagonal(Paso_SystemMatrix * A_p, const double* in);
144
145 void Paso_SystemMatrix_solvePreconditioner(Paso_SystemMatrix* A,double* x,double* b);
146 void Paso_SystemMatrix_setPreconditioner(Paso_SystemMatrix* A,Paso_Options* options);
147 void Paso_SystemMatrix_freePreconditioner(Paso_SystemMatrix* A);
148 void Paso_SystemMatrix_copyColCoupleBlock(Paso_SystemMatrix *A);
149 void Paso_SystemMatrix_copyRemoteCoupleBlock(Paso_SystemMatrix *A, const bool_t recreatePattern);
150 void Paso_SystemMatrix_fillWithGlobalCoordinates(Paso_SystemMatrix *A, const double f1);
151 void Paso_SystemMatrix_print(Paso_SystemMatrix *A);
152
153
154 #endif /* #ifndef INC_PASO_SYSTEMMATRIX */
155

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26