/[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 682 - (show annotations)
Mon Mar 27 02:43:09 2006 UTC (13 years, 7 months ago) by robwdcock
Original Path: trunk/paso/src/Solvers/Solver_preconditioner.c
File MIME type: text/plain
File size: 3955 byte(s)
+ NEW BUILD SYSTEM

This commit contains the new build system with cross-platform support.
Most things work are before though you can have more control.

ENVIRONMENT settings have changed:
+ You no longer require LD_LIBRARY_PATH or PYTHONPATH to point to the
esysroot for building and testing performed via scons
+ ACcESS altix users: It is recommended you change your modules to load
the latest intel compiler and other libraries required by boost to match
the setup in svn (you can override). The correct modules are as follows

module load intel_cc.9.0.026
export
MODULEPATH=${MODULEPATH}:/data/raid2/toolspp4/modulefiles/gcc-3.3.6
module load boost/1.33.0/python-2.4.1
module load python/2.4.1
module load numarray/1.3.3


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