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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3441 - (show annotations)
Fri Jan 14 01:09:09 2011 UTC (9 years, 9 months ago) by gross
File MIME type: text/plain
File size: 8402 byte(s)
clarifiaction of function names as a first step towards a MPI version of AMG
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 #ifndef INC_PRECS
16 #define INC_PRECS
17
18 #include "SystemMatrix.h"
19 #include "performance.h"
20
21
22 #define PASO_AMG_UNDECIDED -1
23 #define PASO_AMG_IN_F 0
24 #define PASO_AMG_IN_C 1
25
26 /* GAUSS SEIDEL & Jacobi */
27 typedef struct Paso_Preconditioner_LocalSmoother {
28 bool_t Jacobi;
29 double* diag;
30 double* buffer;
31 index_t* pivot;
32 } Paso_Preconditioner_LocalSmoother;
33
34 typedef struct Paso_Preconditioner_Smoother {
35 Paso_Preconditioner_LocalSmoother* localSmoother;
36 bool_t is_local;
37 } Paso_Preconditioner_Smoother;
38
39 void Paso_Preconditioner_Smoother_free(Paso_Preconditioner_Smoother * in);
40 void Paso_Preconditioner_LocalSmoother_free(Paso_Preconditioner_LocalSmoother * in);
41
42 Paso_Preconditioner_Smoother* Paso_Preconditioner_Smoother_alloc(Paso_SystemMatrix * A_p, const bool_t jacobi, const bool_t is_local, const bool_t verbose);
43 Paso_Preconditioner_LocalSmoother* Paso_Preconditioner_LocalSmoother_alloc(Paso_SparseMatrix * A_p,const bool_t jacobi, const bool_t verbose);
44
45 void Paso_Preconditioner_Smoother_solve(Paso_SystemMatrix* A, Paso_Preconditioner_Smoother * gs, double * x, const double * b, const dim_t sweeps, const bool_t x_is_initial);
46 void Paso_Preconditioner_LocalSmoother_solve(Paso_SparseMatrix* A, Paso_Preconditioner_LocalSmoother * gs, double * x, const double * b, const dim_t sweeps, const bool_t x_is_initial);
47
48 void Paso_Preconditioner_LocalSmoother_Sweep(Paso_SparseMatrix* A, Paso_Preconditioner_LocalSmoother * gs, double * x);
49 void Paso_Preconditioner_LocalSmoother_Sweep_sequential(Paso_SparseMatrix* A, Paso_Preconditioner_LocalSmoother * gs, double * x);
50 void Paso_Preconditioner_LocalSmoother_Sweep_tiled(Paso_SparseMatrix* A, Paso_Preconditioner_LocalSmoother * gs, double * x);
51 void Paso_Preconditioner_LocalSmoother_Sweep_colored(Paso_SparseMatrix* A, Paso_Preconditioner_LocalSmoother * gs, double * x);
52
53
54 /* Local preconditioner */
55 struct Paso_Preconditioner_AMG {
56 dim_t level;
57 dim_t n;
58 dim_t n_F;
59 dim_t n_block;
60 Paso_SystemMatrix * A_C; /* coarse level matrix */
61 Paso_SystemMatrix * P; /* prolongation n x n_C*/
62 Paso_SystemMatrix * R; /* restriction n_C x n */
63
64 Paso_Preconditioner_Smoother* Smoother;
65 dim_t post_sweeps;
66 dim_t pre_sweeps;
67 index_t reordering; /* applied reordering in direct solver */
68 dim_t refinements; /* number of refinements in direct solver (typically =0) */
69 double* r; /* buffer for residual */
70 double* x_C; /* solution of coarse level system */
71 double* b_C; /* right hand side of coarse level system */
72 struct Paso_Preconditioner_AMG * AMG_C;
73 };
74 typedef struct Paso_Preconditioner_AMG Paso_Preconditioner_AMG;
75
76 void Paso_Preconditioner_AMG_free(Paso_Preconditioner_AMG * in);
77 Paso_Preconditioner_AMG* Paso_Preconditioner_AMG_alloc(Paso_SystemMatrix * A_p,dim_t level,Paso_Options* options);
78 void Paso_Preconditioner_AMG_solve(Paso_SystemMatrix* A, Paso_Preconditioner_AMG * amg, double * x, double * b);
79
80 /* Local AMG preconditioner */
81 struct Paso_Preconditioner_LocalAMG {
82 dim_t level;
83 dim_t n;
84 dim_t n_F;
85 dim_t n_block;
86 Paso_SparseMatrix * A_C; /* coarse level matrix */
87 Paso_SparseMatrix * P; /* prolongation n x n_C*/
88 Paso_SparseMatrix * R; /* restriction n_C x n */
89
90 Paso_Preconditioner_LocalSmoother* Smoother;
91 dim_t post_sweeps;
92 dim_t pre_sweeps;
93 index_t reordering; /* applied reordering in direct solver */
94 dim_t refinements; /* number of refinements in direct solver (typically =0) */
95 double* r; /* buffer for residual */
96 double* x_C; /* solution of coarse level system */
97 double* b_C; /* right hand side of coarse level system */
98 struct Paso_Preconditioner_LocalAMG * AMG_C;
99 };
100 typedef struct Paso_Preconditioner_LocalAMG Paso_Preconditioner_LocalAMG;
101
102 void Paso_Preconditioner_LocalAMG_free(Paso_Preconditioner_LocalAMG * in);
103 Paso_Preconditioner_LocalAMG* Paso_Preconditioner_LocalAMG_alloc(Paso_SparseMatrix * A_p,dim_t level,Paso_Options* options);
104 void Paso_Preconditioner_LocalAMG_solve(Paso_SparseMatrix* A, Paso_Preconditioner_LocalAMG * amg, double * x, double * b);
105
106 void Paso_Preconditioner_LocalAMG_RungeStuebenSearch(const dim_t n, const index_t* offset, const dim_t* degree, const index_t* S, index_t*split_marker, const bool_t usePanel);
107 void Paso_Preconditioner_LocalAMG_setStrongConnections_Block(Paso_SparseMatrix* A, dim_t *degree, index_t *S, const double theta, const double tau);
108 void Paso_Preconditioner_LocalAMG_setStrongConnections(Paso_SparseMatrix* A, dim_t *degree, index_t *S, const double theta, const double tau);
109 Paso_SparseMatrix* Paso_Preconditioner_LocalAMG_getProlongation(Paso_SparseMatrix* A_p, const index_t* offset_S, const dim_t* degree_S, const index_t* S, const dim_t n_C, const index_t* counter_C, const index_t interpolation_method);
110 void Paso_Preconditioner_LocalAMG_setDirectProlongation_Block(Paso_SparseMatrix* P_p, const Paso_SparseMatrix* A_p, const index_t *counter_C);
111 void Paso_Preconditioner_LocalAMG_setDirectProlongation(Paso_SparseMatrix* P_p, const Paso_SparseMatrix* A_p, const index_t *counter_C);
112 void Paso_Preconditioner_LocalAMG_setClassicProlongation(Paso_SparseMatrix* P_p, Paso_SparseMatrix* A_p, const index_t* offset_S, const dim_t* degree_S, const index_t* S, const index_t *counter_C);
113 void Paso_Preconditioner_LocalAMG_setClassicProlongation_Block(Paso_SparseMatrix* P_p, Paso_SparseMatrix* A_p, const index_t* offset_S, const dim_t* degree_S, const index_t* S, const index_t *counter_C);
114 index_t Paso_Preconditioner_LocalAMG_getMaxLevel(const Paso_Preconditioner_LocalAMG * in);
115 double Paso_Preconditioner_LocalAMG_getCoarseLevelSparsity(const Paso_Preconditioner_LocalAMG * in);
116 dim_t Paso_Preconditioner_LocalAMG_getNumCoarseUnknwons(const Paso_Preconditioner_LocalAMG * in);
117 void Paso_Preconditioner_LocalAMG_enforceFFConnectivity(const dim_t n, const index_t* offset_S, const dim_t* degree_S, const index_t* S, index_t*split_marker);
118
119
120
121 /*===============================================*/
122 /* ILU preconditioner */
123 struct Paso_Solver_ILU {
124 double* factors;
125 };
126 typedef struct Paso_Solver_ILU Paso_Solver_ILU;
127
128
129
130 /* RILU preconditioner */
131 struct Paso_Solver_RILU {
132 dim_t n;
133 dim_t n_block;
134 dim_t n_F;
135 dim_t n_C;
136 double* inv_A_FF;
137 index_t* A_FF_pivot;
138 Paso_SparseMatrix * A_FC;
139 Paso_SparseMatrix * A_CF;
140 index_t* rows_in_F;
141 index_t* rows_in_C;
142 index_t* mask_F;
143 index_t* mask_C;
144 double* x_F;
145 double* b_F;
146 double* x_C;
147 double* b_C;
148 struct Paso_Solver_RILU * RILU_of_Schur;
149 };
150 typedef struct Paso_Solver_RILU Paso_Solver_RILU;
151
152
153
154 /* general preconditioner interface */
155
156 typedef struct Paso_Preconditioner {
157 dim_t type;
158 dim_t sweeps;
159 /* jacobi preconditioner */
160 Paso_Preconditioner_Smoother* jacobi;
161 /* Gauss-Seidel preconditioner */
162 Paso_Preconditioner_Smoother* gs;
163 /* amg preconditioner */
164 Paso_Preconditioner_LocalAMG* localamg;
165 Paso_Preconditioner_LocalSmoother* localamgsubstitute;
166
167 /* ilu preconditioner */
168 Paso_Solver_ILU* ilu;
169 /* rilu preconditioner */
170 Paso_Solver_RILU* rilu;
171
172 } Paso_Preconditioner;
173
174 void Paso_Preconditioner_free(Paso_Preconditioner*);
175 Paso_Preconditioner* Paso_Preconditioner_alloc(Paso_SystemMatrix* A,Paso_Options* options);
176 void Paso_Preconditioner_solve(Paso_Preconditioner* prec, Paso_SystemMatrix* A,double*,double*);
177
178
179 /*******************************************/
180 void Paso_Solver_ILU_free(Paso_Solver_ILU * in);
181 Paso_Solver_ILU* Paso_Solver_getILU(Paso_SparseMatrix * A_p,bool_t verbose);
182 void Paso_Solver_solveILU(Paso_SparseMatrix * A, Paso_Solver_ILU * ilu, double * x, const double * b);
183
184 void Paso_Solver_RILU_free(Paso_Solver_RILU * in);
185 Paso_Solver_RILU* Paso_Solver_getRILU(Paso_SparseMatrix * A_p,bool_t verbose);
186 void Paso_Solver_solveRILU(Paso_Solver_RILU * rilu, double * x, double * b);
187
188 void Paso_Solver_updateIncompleteSchurComplement(Paso_SparseMatrix* A_CC, Paso_SparseMatrix *A_CF,double* invA_FF,index_t* A_FF_pivot, Paso_SparseMatrix *A_FC);
189
190
191 #endif /* #ifndef INC_PRECS */

  ViewVC Help
Powered by ViewVC 1.1.26