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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1798 by gross, Wed Sep 17 06:21:12 2008 UTC revision 1933 by artak, Mon Oct 27 04:58:59 2008 UTC
# Line 1  Line 1 
1    
 /* $Id$ */  
   
2  /*******************************************************  /*******************************************************
3   *  *
4   *           Copyright 2003-2007 by ACceSS MNRF  * Copyright (c) 2003-2008 by University of Queensland
5   *       Copyright 2007 by University of Queensland  * Earth Systems Science Computational Center (ESSCC)
6   *  * http://www.uq.edu.au/esscc
7   *                http://esscc.uq.edu.au  *
8   *        Primary Business: Queensland, Australia  * Primary Business: Queensland, Australia
9   *  Licensed under the Open Software License version 3.0  * Licensed under the Open Software License version 3.0
10   *     http://www.opensource.org/licenses/osl-3.0.php  * http://www.opensource.org/licenses/osl-3.0.php
11   *  *
12   *******************************************************/  *******************************************************/
13    
14    
15  #ifndef INC_SOLVER  #ifndef INC_SOLVER
16  #define INC_SOLVER  #define INC_SOLVER
# Line 34  static double ONE=1.; Line 33  static double ONE=1.;
33  static double ZERO=0.;  static double ZERO=0.;
34  static double TOLERANCE_FOR_SCALARS=0.;  static double TOLERANCE_FOR_SCALARS=0.;
35    
36    /* 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  /* ILU preconditioner */  /* ILU preconditioner */
47  struct Paso_Solver_ILU {  struct Paso_Solver_ILU {
48    dim_t n_block;    dim_t n_block;
# Line 46  struct Paso_Solver_ILU { Line 55  struct Paso_Solver_ILU {
55  };  };
56  typedef struct Paso_Solver_ILU Paso_Solver_ILU;  typedef struct Paso_Solver_ILU Paso_Solver_ILU;
57    
58    /* 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      dim_t sweeps;
69      double* x_old;
70    };
71    typedef struct Paso_Solver_GS Paso_Solver_GS;
72    
73  /* RILU preconditioner */  /* RILU preconditioner */
74  struct Paso_Solver_RILU {  struct Paso_Solver_RILU {
75    dim_t n;    dim_t n;
# Line 68  struct Paso_Solver_RILU { Line 92  struct Paso_Solver_RILU {
92  };  };
93  typedef struct Paso_Solver_RILU Paso_Solver_RILU;  typedef struct Paso_Solver_RILU Paso_Solver_RILU;
94    
95    /* AMG preconditioner */
96  /* jacobi  preconditioner */  struct Paso_Solver_AMG {
   
 typedef struct Paso_Solver_Jacobi {  
   dim_t n_block;  
97    dim_t n;    dim_t n;
98    double* values;    dim_t level;
99    index_t* pivot;    dim_t n_block;
100  } Paso_Solver_Jacobi;    dim_t n_F;
101      dim_t n_C;
102      double* inv_A_FF;
103      index_t* A_FF_pivot;
104      Paso_SparseMatrix * A_FC;
105      Paso_SparseMatrix * A_CF;
106      index_t* rows_in_F;
107      index_t* rows_in_C;
108      index_t* mask_F;
109      index_t* mask_C;
110      double* x_F;
111      double* b_F;
112      double* x_C;
113      double* b_C;
114      Paso_SparseMatrix * A;
115      struct Paso_Solver_AMG * AMG_of_Schur;
116    };
117    typedef struct Paso_Solver_AMG Paso_Solver_AMG;
118    
119    
120  /* general preconditioner interface */  /* general preconditioner interface */
121    
# Line 86  typedef struct Paso_Solver_Preconditione Line 125  typedef struct Paso_Solver_Preconditione
125    Paso_Solver_Jacobi* jacobi;    Paso_Solver_Jacobi* jacobi;
126    /* ilu preconditioner */    /* ilu preconditioner */
127    Paso_Solver_ILU* ilu;    Paso_Solver_ILU* ilu;
128    /* ilu preconditioner */    /* rilu preconditioner */
129    Paso_Solver_RILU* rilu;    Paso_Solver_RILU* rilu;
130      /* Gauss-Seidel preconditioner */
131      Paso_Solver_GS* gs;
132      /* amg preconditioner */
133      Paso_Solver_AMG* amg;
134    
135  } Paso_Solver_Preconditioner;  } Paso_Solver_Preconditioner;
136    
137  void Paso_Solver(Paso_SystemMatrix*,double*,double*,Paso_Options*,Paso_Performance* pp);  void Paso_Solver(Paso_SystemMatrix*,double*,double*,Paso_Options*,Paso_Performance* pp);
# Line 95  void Paso_Solver_free(Paso_SystemMatrix* Line 139  void Paso_Solver_free(Paso_SystemMatrix*
139  err_t Paso_Solver_BiCGStab( Paso_SystemMatrix * A, double* B, double * X, dim_t *iter, double * tolerance, Paso_Performance* pp);  err_t Paso_Solver_BiCGStab( Paso_SystemMatrix * A, double* B, double * X, dim_t *iter, double * tolerance, Paso_Performance* pp);
140  err_t Paso_Solver_PCG( Paso_SystemMatrix * A, double* B, double * X, dim_t *iter, double * tolerance, Paso_Performance* pp);  err_t Paso_Solver_PCG( Paso_SystemMatrix * A, double* B, double * X, dim_t *iter, double * tolerance, Paso_Performance* pp);
141  err_t Paso_Solver_TFQMR( Paso_SystemMatrix * A, double* B, double * X, dim_t *iter, double * tolerance, Paso_Performance* pp);  err_t Paso_Solver_TFQMR( Paso_SystemMatrix * A, double* B, double * X, dim_t *iter, double * tolerance, Paso_Performance* pp);
142  err_t Paso_Solver_MINRES( Paso_SystemMatrix * A, double* B, double * X, dim_t *iter, double * tolerance, double *tol, Paso_Performance* pp);  err_t Paso_Solver_MINRES( Paso_SystemMatrix * A, double* B, double * X, dim_t *iter, double * tolerance, Paso_Performance* pp);
143  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);  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);
144  void Paso_Preconditioner_free(Paso_Solver_Preconditioner*);  void Paso_Preconditioner_free(Paso_Solver_Preconditioner*);
145  void Paso_Solver_setPreconditioner(Paso_SystemMatrix* A,Paso_Options* options);  void Paso_Solver_setPreconditioner(Paso_SystemMatrix* A,Paso_Options* options);
# Line 106  void Paso_Solver_ILU_free(Paso_Solver_IL Line 150  void Paso_Solver_ILU_free(Paso_Solver_IL
150  Paso_Solver_ILU* Paso_Solver_getILU(Paso_SparseMatrix * A_p,bool_t verbose);  Paso_Solver_ILU* Paso_Solver_getILU(Paso_SparseMatrix * A_p,bool_t verbose);
151  void Paso_Solver_solveILU(Paso_Solver_ILU * ilu, double * x, double * b);  void Paso_Solver_solveILU(Paso_Solver_ILU * ilu, double * x, double * b);
152    
153    void Paso_Solver_GS_free(Paso_Solver_GS * in);
154    Paso_Solver_GS* Paso_Solver_getGS(Paso_SparseMatrix * A_p,bool_t verbose);
155    Paso_Solver_GS* Paso_Solver_solveGS1(Paso_SparseMatrix * A_p,bool_t verbose);
156    void Paso_Solver_solveGS(Paso_Solver_GS * gs, double * x, double * b);
157    
158  void Paso_Solver_RILU_free(Paso_Solver_RILU * in);  void Paso_Solver_RILU_free(Paso_Solver_RILU * in);
159  Paso_Solver_RILU* Paso_Solver_getRILU(Paso_SparseMatrix * A_p,bool_t verbose);  Paso_Solver_RILU* Paso_Solver_getRILU(Paso_SparseMatrix * A_p,bool_t verbose);
160  void Paso_Solver_solveRILU(Paso_Solver_RILU * rilu, double * x, double * b);  void Paso_Solver_solveRILU(Paso_Solver_RILU * rilu, double * x, double * b);
161    
162    void Paso_Solver_AMG_free(Paso_Solver_AMG * in);
163    Paso_Solver_AMG* Paso_Solver_getAMG(Paso_SparseMatrix * A_p,bool_t verbose,dim_t level);
164    void Paso_Solver_solveAMG(Paso_Solver_AMG * amg, double * x, double * b);
165    
166  void Paso_Solver_updateIncompleteSchurComplement(Paso_SparseMatrix* A_CC, Paso_SparseMatrix *A_CF,double* invA_FF,index_t* A_FF_pivot, Paso_SparseMatrix *A_FC);  void Paso_Solver_updateIncompleteSchurComplement(Paso_SparseMatrix* A_CC, Paso_SparseMatrix *A_CF,double* invA_FF,index_t* A_FF_pivot, Paso_SparseMatrix *A_FC);
167  Paso_Solver_Jacobi* Paso_Solver_getJacobi(Paso_SparseMatrix * A_p);  Paso_Solver_Jacobi* Paso_Solver_getJacobi(Paso_SparseMatrix * A_p);
168  void Paso_Solver_solveJacobi(Paso_Solver_Jacobi * prec, double * x, double * b);  void Paso_Solver_solveJacobi(Paso_Solver_Jacobi * prec, double * x, double * b);
# Line 119  err_t Paso_Solver_GMRES2(Paso_Function * Line 172  err_t Paso_Solver_GMRES2(Paso_Function *
172  err_t Paso_Solver_NewtonGMRES(Paso_Function *F, double *x, Paso_Options* options, Paso_Performance* pp);  err_t Paso_Solver_NewtonGMRES(Paso_Function *F, double *x, Paso_Options* options, Paso_Performance* pp);
173    
174  Paso_Function * Paso_Function_LinearSystem_alloc(Paso_SystemMatrix* A, double* b, Paso_Options* options);  Paso_Function * Paso_Function_LinearSystem_alloc(Paso_SystemMatrix* A, double* b, Paso_Options* options);
175  err_t Paso_Function_LinearSystem_call(Paso_Function * F,double* value, const double* arg);  err_t Paso_Function_LinearSystem_call(Paso_Function * F,double* value, const double* arg, Paso_Performance *pp);
176  void Paso_Function_LinearSystem_free(Paso_Function * F);  void Paso_Function_LinearSystem_free(Paso_Function * F);
177  err_t Paso_Function_LinearSystem_setInitialGuess(Paso_SystemMatrix* A, double* x);  err_t Paso_Function_LinearSystem_setInitialGuess(Paso_SystemMatrix* A, double* x, Paso_Performance *pp);
178    
179  #endif /* #ifndef INC_SOLVER */  #endif /* #ifndef INC_SOLVER */

Legend:
Removed from v.1798  
changed lines
  Added in v.1933

  ViewVC Help
Powered by ViewVC 1.1.26