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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1703 - (hide annotations)
Thu Aug 14 05:34:25 2008 UTC (10 years, 11 months ago) by artak
File MIME type: text/plain
File size: 4303 byte(s)
TFQMR solver is added to PASO solver. It is not parallelised yet.
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 #ifndef INC_SOLVER
17     #define INC_SOLVER
18    
19 gross 700 #include "SystemMatrix.h"
20     #include "performance.h"
21 gross 1476 #include "Functions.h"
22 jgs 150
23 ksteube 1312 #define PASO_TRACE
24 jgs 150 /* error codes used in the solver */
25     #define SOLVER_NO_ERROR 0
26     #define SOLVER_MAXITER_REACHED 1
27     #define SOLVER_INPUT_ERROR -1
28     #define SOLVER_MEMORY_ERROR -9
29     #define SOLVER_BREAKDOWN -10
30    
31 jgs 154 static double ONE=1.;
32     static double ZERO=0.;
33     static double TOLERANCE_FOR_SCALARS=0.;
34 jgs 150
35     /* ILU preconditioner */
36     struct Paso_Solver_ILU {
37 gross 431 dim_t n_block;
38 jgs 150 dim_t n;
39 gross 431 index_t num_colors;
40     index_t* colorOf;
41     index_t* main_iptr;
42     double* factors;
43 ksteube 1312 Paso_Pattern* pattern;
44 jgs 150 };
45     typedef struct Paso_Solver_ILU Paso_Solver_ILU;
46    
47 gross 430 /* RILU preconditioner */
48     struct Paso_Solver_RILU {
49     dim_t n;
50     dim_t n_block;
51     dim_t n_F;
52     dim_t n_C;
53     double* inv_A_FF;
54     index_t* A_FF_pivot;
55 ksteube 1312 Paso_SparseMatrix * A_FC;
56     Paso_SparseMatrix * A_CF;
57 gross 430 index_t* rows_in_F;
58     index_t* rows_in_C;
59     index_t* mask_F;
60     index_t* mask_C;
61     double* x_F;
62     double* b_F;
63     double* x_C;
64     double* b_C;
65     struct Paso_Solver_RILU * RILU_of_Schur;
66     };
67     typedef struct Paso_Solver_RILU Paso_Solver_RILU;
68 jgs 150
69 gross 430
70 jgs 150 /* jacobi preconditioner */
71    
72     typedef struct Paso_Solver_Jacobi {
73     dim_t n_block;
74     dim_t n;
75     double* values;
76     index_t* pivot;
77     } Paso_Solver_Jacobi;
78    
79     /* general preconditioner interface */
80    
81     typedef struct Paso_Solver_Preconditioner {
82     dim_t type;
83     /* jacobi preconditioner */
84     Paso_Solver_Jacobi* jacobi;
85     /* ilu preconditioner */
86     Paso_Solver_ILU* ilu;
87 gross 430 /* ilu preconditioner */
88     Paso_Solver_RILU* rilu;
89 jgs 150 } Paso_Solver_Preconditioner;
90    
91 gross 584 void Paso_Solver(Paso_SystemMatrix*,double*,double*,Paso_Options*,Paso_Performance* pp);
92 jgs 150 void Paso_Solver_free(Paso_SystemMatrix*);
93 ksteube 1312 err_t Paso_Solver_BiCGStab( Paso_SystemMatrix * A, double* B, double * X, dim_t *iter, double * tolerance, Paso_Performance* pp);
94     err_t Paso_Solver_PCG( Paso_SystemMatrix * A, double* B, double * X, dim_t *iter, double * tolerance, Paso_Performance* pp);
95 artak 1703 err_t Paso_Solver_TFQMR( Paso_SystemMatrix * A, double* B, double * X, dim_t *iter, double * tolerance, Paso_Performance* pp);
96 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);
97 jgs 150 void Paso_Preconditioner_free(Paso_Solver_Preconditioner*);
98     void Paso_Solver_setPreconditioner(Paso_SystemMatrix* A,Paso_Options* options);
99     void Paso_Solver_solvePreconditioner(Paso_SystemMatrix* A,double*,double*);
100     void Paso_Solver_applyBlockDiagonalMatrix(dim_t n_block,dim_t n,double* D,index_t* pivot,double* x,double* b);
101 gross 431
102 jgs 150 void Paso_Solver_ILU_free(Paso_Solver_ILU * in);
103 ksteube 1312 Paso_Solver_ILU* Paso_Solver_getILU(Paso_SparseMatrix * A_p,bool_t verbose);
104 jgs 150 void Paso_Solver_solveILU(Paso_Solver_ILU * ilu, double * x, double * b);
105 gross 431
106     void Paso_Solver_RILU_free(Paso_Solver_RILU * in);
107 ksteube 1312 Paso_Solver_RILU* Paso_Solver_getRILU(Paso_SparseMatrix * A_p,bool_t verbose);
108 gross 431 void Paso_Solver_solveRILU(Paso_Solver_RILU * rilu, double * x, double * b);
109    
110 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);
111     Paso_Solver_Jacobi* Paso_Solver_getJacobi(Paso_SparseMatrix * A_p);
112 jgs 150 void Paso_Solver_solveJacobi(Paso_Solver_Jacobi * prec, double * x, double * b);
113     void Paso_Solver_Jacobi_free(Paso_Solver_Jacobi * in);
114    
115 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);
116 gross 1476 err_t Paso_Solver_NewtonGMRES(Paso_Function *F, double *x, Paso_Options* options, Paso_Performance* pp);
117    
118 gross 1639 Paso_Function * Paso_Function_LinearSystem_alloc(Paso_SystemMatrix* A, double* b, Paso_Options* options);
119     err_t Paso_Function_LinearSystem_call(Paso_Function * F,double* value, const double* arg);
120     void Paso_Function_LinearSystem_free(Paso_Function * F);
121 gross 1476
122 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