/[escript]/trunk/paso/src/Solver_preconditioner.c
ViewVC logotype

Contents of /trunk/paso/src/Solver_preconditioner.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 700 - (show annotations)
Thu Apr 6 00:13:40 2006 UTC (13 years, 4 months ago) by gross
File MIME type: text/plain
File size: 3949 byte(s)
A few changes in the build mechanism and the file structure so scons can build release tar files:

  * paso/src/Solver has been moved to paso/src 
  * all test_.py are now run_.py files and are assumed to be passing python tests. they can run by 
    scons py_tests and are part of the release test set
  * escript/py_src/test_ are moved to escript/test/python and are installed in to the build directory 
    (rather then the PYTHONPATH).
  * all py files in test/python which don't start with run_ or test_ are now 'local_py_tests'. they are installed i
    by not run automatically.
  * CppUnitTest is now treated as a escript module (against previous decisions).
  * scons realse builds nor tar/zip files with relvant source code (src and tests in seperate files)

the python tests don't pass yet due to path problems.


1 /* $Id$ */
2
3
4 /*
5 ********************************************************************************
6 * Copyright 2006 by ACcESS MNRF *
7 * *
8 * http://www.access.edu.au *
9 * Primary Business: Queensland, Australia *
10 * Licensed under the Open Software License version 3.0 *
11 * http://www.opensource.org/licenses/osl-3.0.php *
12 ********************************************************************************
13 */
14
15 /**************************************************************/
16
17 /* Paso: SystemMatrix: sets-up the preconditioner */
18
19 /**************************************************************/
20
21 /* Copyrights by ACcESS Australia 2003/04 */
22 /* Author: gross@access.edu.au */
23
24 /**************************************************************/
25
26 #include "Paso.h"
27 #include "SystemMatrix.h"
28 #include "Solver.h"
29
30 /***********************************************************************************/
31
32 /* free space */
33
34 void Paso_Preconditioner_free(Paso_Solver_Preconditioner* in) {
35 if (in!=NULL) {
36 Paso_Solver_ILU_free(in->ilu);
37 Paso_Solver_RILU_free(in->rilu);
38 Paso_Solver_Jacobi_free(in->jacobi);
39 MEMFREE(in);
40 }
41 }
42 /* call the iterative solver: */
43
44 void Paso_Solver_setPreconditioner(Paso_SystemMatrix* A,Paso_Options* options) {
45 Paso_Solver_Preconditioner* prec=NULL;
46 if (A->solver==NULL) {
47 /* allocate structure to hold preconditioner */
48 prec=MEMALLOC(1,Paso_Solver_Preconditioner);
49 if (Paso_checkPtr(prec)) return;
50 prec->type=UNKNOWN;
51 prec->rilu=NULL;
52 prec->ilu=NULL;
53 prec->jacobi=NULL;
54 A->solver=prec;
55 switch (options->preconditioner) {
56 default:
57 case PASO_JACOBI:
58 if (options->verbose) printf("Jacobi preconditioner is used.\n");
59 prec->jacobi=Paso_Solver_getJacobi(A);
60 prec->type=PASO_JACOBI;
61 break;
62 case PASO_ILU0:
63 if (options->verbose) printf("ILU preconditioner is used.\n");
64 prec->ilu=Paso_Solver_getILU(A,options->verbose);
65 prec->type=PASO_ILU0;
66 break;
67 case PASO_RILU:
68 if (options->verbose) printf("RILU preconditioner is used.\n");
69 prec->rilu=Paso_Solver_getRILU(A,options->verbose);
70 prec->type=PASO_RILU;
71 break;
72 }
73 if (! Paso_noError()) {
74 Paso_Preconditioner_free(prec);
75 A->solver=NULL;
76 }
77 }
78 }
79
80 /* applies the preconditioner */
81 /* has to be called within a parallel reqion */
82 /* barrier synchronization is performed before the evaluation to make sure that the input vector is available */
83 void Paso_Solver_solvePreconditioner(Paso_SystemMatrix* A,double* x,double* b){
84 Paso_Solver_Preconditioner* prec=(Paso_Solver_Preconditioner*) A->solver;
85 #pragma omp barrier
86 switch (prec->type) {
87 default:
88 case PASO_JACOBI:
89 Paso_Solver_solveJacobi(prec->jacobi,x,b);
90 break;
91 case PASO_ILU0:
92 Paso_Solver_solveILU(prec->ilu,x,b);
93 break;
94 case PASO_RILU:
95 Paso_Solver_solveRILU(prec->rilu,x,b);
96 break;
97 }
98 }
99
100 /*
101 * $Log$
102 * Revision 1.2 2005/09/15 03:44:40 jgs
103 * Merge of development branch dev-02 back to main trunk on 2005-09-15
104 *
105 * Revision 1.1.2.2 2005/09/07 00:59:09 gross
106 * some inconsistent renaming fixed to make the linking work.
107 *
108 * Revision 1.1.2.1 2005/09/05 06:29:50 gross
109 * These files have been extracted from finley to define a stand alone libray for iterative
110 * linear solvers on the ALTIX. main entry through Paso_solve. this version compiles but
111 * has not been tested yet.
112 *
113 *
114 */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26