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

Annotation of /trunk/paso/src/Solver.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1819 - (hide annotations)
Tue Sep 30 05:58:06 2008 UTC (12 years, 11 months ago) by artak
File MIME type: text/plain
File size: 5093 byte(s)
Firs version of symmetric Gauss-Seidel preconditioner with coloring
1 ksteube 1312
2     /*******************************************************
3 ksteube 1811 *
4     * Copyright (c) 2003-2008 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 dhawcroft 631
14 ksteube 1811
15 jgs 150 #ifndef INC_SOLVER
16     #define INC_SOLVER
17    
18 gross 700 #include "SystemMatrix.h"
19     #include "performance.h"
20 gross 1476 #include "Functions.h"
21 jgs 150
22 ksteube 1312 #define PASO_TRACE
23 jgs 150 /* error codes used in the solver */
24     #define SOLVER_NO_ERROR 0
25     #define SOLVER_MAXITER_REACHED 1
26     #define SOLVER_INPUT_ERROR -1
27     #define SOLVER_MEMORY_ERROR -9
28     #define SOLVER_BREAKDOWN -10
29 artak 1787 #define SOLVER_NEGATIVE_NORM_ERROR -11
30 jgs 150
31 artak 1787
32 jgs 154 static double ONE=1.;
33     static double ZERO=0.;
34     static double TOLERANCE_FOR_SCALARS=0.;
35 jgs 150
36 artak 1819 /* jacobi preconditioner */
37    
38     typedef struct Paso_Solver_Jacobi {
39     dim_t n_block;
40     dim_t n;
41     double* values;
42     index_t* pivot;
43     } Paso_Solver_Jacobi;
44    
45    
46 jgs 150 /* ILU preconditioner */
47     struct Paso_Solver_ILU {
48 gross 431 dim_t n_block;
49 jgs 150 dim_t n;
50 gross 431 index_t num_colors;
51     index_t* colorOf;
52     index_t* main_iptr;
53     double* factors;
54 ksteube 1312 Paso_Pattern* pattern;
55 jgs 150 };
56     typedef struct Paso_Solver_ILU Paso_Solver_ILU;
57    
58 artak 1819 /* GS preconditioner */
59     struct Paso_Solver_GS {
60     dim_t n_block;
61     dim_t n;
62     index_t num_colors;
63     index_t* colorOf;
64     index_t* main_iptr;
65     double* diag;
66     Paso_SparseMatrix * factors;
67     Paso_Pattern* pattern;
68     };
69     typedef struct Paso_Solver_GS Paso_Solver_GS;
70    
71 gross 430 /* RILU preconditioner */
72     struct Paso_Solver_RILU {
73     dim_t n;
74     dim_t n_block;
75     dim_t n_F;
76     dim_t n_C;
77     double* inv_A_FF;
78     index_t* A_FF_pivot;
79 ksteube 1312 Paso_SparseMatrix * A_FC;
80     Paso_SparseMatrix * A_CF;
81 gross 430 index_t* rows_in_F;
82     index_t* rows_in_C;
83     index_t* mask_F;
84     index_t* mask_C;
85     double* x_F;
86     double* b_F;
87     double* x_C;
88     double* b_C;
89     struct Paso_Solver_RILU * RILU_of_Schur;
90     };
91     typedef struct Paso_Solver_RILU Paso_Solver_RILU;
92 jgs 150
93 gross 430
94 jgs 150
95     /* general preconditioner interface */
96    
97     typedef struct Paso_Solver_Preconditioner {
98     dim_t type;
99     /* jacobi preconditioner */
100     Paso_Solver_Jacobi* jacobi;
101     /* ilu preconditioner */
102     Paso_Solver_ILU* ilu;
103 artak 1819 /* rilu preconditioner */
104 gross 430 Paso_Solver_RILU* rilu;
105 artak 1819 /* Gauss-Seidel preconditioner */
106     Paso_Solver_GS* gs;
107 jgs 150 } Paso_Solver_Preconditioner;
108    
109 gross 584 void Paso_Solver(Paso_SystemMatrix*,double*,double*,Paso_Options*,Paso_Performance* pp);
110 jgs 150 void Paso_Solver_free(Paso_SystemMatrix*);
111 ksteube 1312 err_t Paso_Solver_BiCGStab( Paso_SystemMatrix * A, double* B, double * X, dim_t *iter, double * tolerance, Paso_Performance* pp);
112     err_t Paso_Solver_PCG( Paso_SystemMatrix * A, double* B, double * X, dim_t *iter, double * tolerance, Paso_Performance* pp);
113 artak 1703 err_t Paso_Solver_TFQMR( Paso_SystemMatrix * A, double* B, double * X, dim_t *iter, double * tolerance, Paso_Performance* pp);
114 artak 1787 err_t Paso_Solver_MINRES( Paso_SystemMatrix * A, double* B, double * X, dim_t *iter, double * tolerance, double *tol, Paso_Performance* pp);
115 ksteube 1312 err_t Paso_Solver_GMRES(Paso_SystemMatrix * A, double * r, double * x, dim_t *num_iter, double * tolerance,dim_t length_of_recursion,dim_t restart, Paso_Performance* pp);
116 jgs 150 void Paso_Preconditioner_free(Paso_Solver_Preconditioner*);
117     void Paso_Solver_setPreconditioner(Paso_SystemMatrix* A,Paso_Options* options);
118     void Paso_Solver_solvePreconditioner(Paso_SystemMatrix* A,double*,double*);
119     void Paso_Solver_applyBlockDiagonalMatrix(dim_t n_block,dim_t n,double* D,index_t* pivot,double* x,double* b);
120 gross 431
121 jgs 150 void Paso_Solver_ILU_free(Paso_Solver_ILU * in);
122 ksteube 1312 Paso_Solver_ILU* Paso_Solver_getILU(Paso_SparseMatrix * A_p,bool_t verbose);
123 jgs 150 void Paso_Solver_solveILU(Paso_Solver_ILU * ilu, double * x, double * b);
124 gross 431
125 artak 1819 void Paso_Solver_GS_free(Paso_Solver_GS * in);
126     Paso_Solver_GS* Paso_Solver_getGS(Paso_SparseMatrix * A_p,bool_t verbose);
127     void Paso_Solver_solveGS(Paso_Solver_GS * gs, double * x, double * b);
128    
129 gross 431 void Paso_Solver_RILU_free(Paso_Solver_RILU * in);
130 ksteube 1312 Paso_Solver_RILU* Paso_Solver_getRILU(Paso_SparseMatrix * A_p,bool_t verbose);
131 gross 431 void Paso_Solver_solveRILU(Paso_Solver_RILU * rilu, double * x, double * b);
132    
133 ksteube 1312 void Paso_Solver_updateIncompleteSchurComplement(Paso_SparseMatrix* A_CC, Paso_SparseMatrix *A_CF,double* invA_FF,index_t* A_FF_pivot, Paso_SparseMatrix *A_FC);
134     Paso_Solver_Jacobi* Paso_Solver_getJacobi(Paso_SparseMatrix * A_p);
135 jgs 150 void Paso_Solver_solveJacobi(Paso_Solver_Jacobi * prec, double * x, double * b);
136     void Paso_Solver_Jacobi_free(Paso_Solver_Jacobi * in);
137    
138 gross 1639 err_t Paso_Solver_GMRES2(Paso_Function * F, const double* f0, const double* x0, double * x, dim_t *iter, double* tolerance, Paso_Performance* pp);
139 gross 1476 err_t Paso_Solver_NewtonGMRES(Paso_Function *F, double *x, Paso_Options* options, Paso_Performance* pp);
140    
141 gross 1639 Paso_Function * Paso_Function_LinearSystem_alloc(Paso_SystemMatrix* A, double* b, Paso_Options* options);
142 gross 1804 err_t Paso_Function_LinearSystem_call(Paso_Function * F,double* value, const double* arg, Paso_Performance *pp);
143 gross 1639 void Paso_Function_LinearSystem_free(Paso_Function * F);
144 gross 1804 err_t Paso_Function_LinearSystem_setInitialGuess(Paso_SystemMatrix* A, double* x, Paso_Performance *pp);
145 gross 1476
146 jgs 150 #endif /* #ifndef INC_SOLVER */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26