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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 431 - (show annotations)
Fri Jan 13 05:07:10 2006 UTC (13 years, 9 months ago) by gross
Original Path: trunk/paso/src/Solvers/Solver.h
File MIME type: text/plain
File size: 3125 byte(s)
new implementation of ILU0
1 /* $Id$ */
2
3 #ifndef INC_SOLVER
4 #define INC_SOLVER
5
6 #include "SystemMatrix.h"
7
8 #define FINLEY_SOLVER_TRACE
9 /* error codes used in the solver */
10 #define SOLVER_NO_ERROR 0
11 #define SOLVER_MAXITER_REACHED 1
12 #define SOLVER_INPUT_ERROR -1
13 #define SOLVER_MEMORY_ERROR -9
14 #define SOLVER_BREAKDOWN -10
15
16 static double ONE=1.;
17 static double ZERO=0.;
18 static double TOLERANCE_FOR_SCALARS=0.;
19
20 /* ILU preconditioner */
21 struct Paso_Solver_ILU {
22 dim_t n_block;
23 dim_t n;
24 index_t num_colors;
25 index_t* colorOf;
26 index_t* main_iptr;
27 double* factors;
28 Paso_SystemMatrixPattern* pattern;
29 };
30 typedef struct Paso_Solver_ILU Paso_Solver_ILU;
31
32 /* RILU preconditioner */
33 struct Paso_Solver_RILU {
34 dim_t n;
35 dim_t n_block;
36 dim_t n_F;
37 dim_t n_C;
38 double* inv_A_FF;
39 index_t* A_FF_pivot;
40 Paso_SystemMatrix * A_FC;
41 Paso_SystemMatrix * A_CF;
42 index_t* rows_in_F;
43 index_t* rows_in_C;
44 index_t* mask_F;
45 index_t* mask_C;
46 double* x_F;
47 double* b_F;
48 double* x_C;
49 double* b_C;
50 struct Paso_Solver_RILU * RILU_of_Schur;
51 };
52 typedef struct Paso_Solver_RILU Paso_Solver_RILU;
53
54
55 /* jacobi preconditioner */
56
57 typedef struct Paso_Solver_Jacobi {
58 dim_t n_block;
59 dim_t n;
60 double* values;
61 index_t* pivot;
62 } Paso_Solver_Jacobi;
63
64 /* general preconditioner interface */
65
66 typedef struct Paso_Solver_Preconditioner {
67 dim_t type;
68 /* jacobi preconditioner */
69 Paso_Solver_Jacobi* jacobi;
70 /* ilu preconditioner */
71 Paso_Solver_ILU* ilu;
72 /* ilu preconditioner */
73 Paso_Solver_RILU* rilu;
74 } Paso_Solver_Preconditioner;
75
76 void Paso_Solver(Paso_SystemMatrix*,double*,double*,Paso_Options*);
77 void Paso_Solver_free(Paso_SystemMatrix*);
78 err_t Paso_Solver_BiCGStab( Paso_SystemMatrix * A, double* B, double * X, dim_t *iter, double * tolerance);
79 err_t Paso_Solver_PCG( Paso_SystemMatrix * A, double* B, double * X, dim_t *iter, double * tolerance);
80 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);
81 void Paso_Preconditioner_free(Paso_Solver_Preconditioner*);
82 void Paso_Solver_setPreconditioner(Paso_SystemMatrix* A,Paso_Options* options);
83 void Paso_Solver_solvePreconditioner(Paso_SystemMatrix* A,double*,double*);
84 void Paso_Solver_applyBlockDiagonalMatrix(dim_t n_block,dim_t n,double* D,index_t* pivot,double* x,double* b);
85
86 void Paso_Solver_ILU_free(Paso_Solver_ILU * in);
87 Paso_Solver_ILU* Paso_Solver_getILU(Paso_SystemMatrix * A_p,bool_t verbose);
88 void Paso_Solver_solveILU(Paso_Solver_ILU * ilu, double * x, double * b);
89
90 void Paso_Solver_RILU_free(Paso_Solver_RILU * in);
91 Paso_Solver_RILU* Paso_Solver_getRILU(Paso_SystemMatrix * A_p,bool_t verbose);
92 void Paso_Solver_solveRILU(Paso_Solver_RILU * rilu, double * x, double * b);
93
94 void Paso_Solver_updateIncompleteSchurComplement(Paso_SystemMatrix* A_CC,Paso_SystemMatrix *A_CF,double*
95 invA_FF,index_t* A_FF_pivot,Paso_SystemMatrix *A_FC);
96 Paso_Solver_Jacobi* Paso_Solver_getJacobi(Paso_SystemMatrix * A_p);
97 void Paso_Solver_solveJacobi(Paso_Solver_Jacobi * prec, double * x, double * b);
98 void Paso_Solver_Jacobi_free(Paso_Solver_Jacobi * in);
99
100 #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